summaryrefslogtreecommitdiff
path: root/v4.0/src/CMD/FC/ITOUPPER.ASM
blob: 289c691720de129b8a201d4c0c53a616ce045319 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
.xlist
include version.inc
include cmacros.inc
.list

sBegin  code
assumes cs,code

;
; c = IToupper (c, routine);
;
;       c is char to be converted
;       routine is case map call in international table
;

cProc   IToupper,<PUBLIC>
parmW   c
parmD   routine
cBegin
        mov     ax,c
        or      ah,ah
        jnz     donothing
        cmp     al,'a'
        jb      noconv
        cmp     al,'z'
        ja      noconv
        sub     al,20H
noconv:
        call    routine
donothing:
cEnd


;Get_Lbtbl
;
;       Get pointer to LBTBL from DOS if we are running on a version
;       of DOS which supports it.  If not, initialize the table with
;       a pointer to a local "default" table with KANJI lead bytes.
;
;Input: word pointer to LONG "Lbtbl"
;Output: long initialized to Lead byte pointer
;

cProc   get_lbtbl,<PUBLIC> 
                                
parmW   pointer_to_table                        
                                
;	on entry, low word of DWORD pointer has offset of
;	a default table of lead bytes defined within the C program
;	If function 63 is supported, the DWORD pointer to DOS'
;	table will be placed here instead.
cBegin
        push    si
        push    di
        mov     bx,pointer_to_table     ;get pointer
	mov	si,[bx]			;default table pointer in DS:SI
        push    es
	push	ds
        mov     ax,6300h                ;make Get Lead Byte call
        int     21h
        mov     ss:[bx],si		;si didn't change if non ECS dos
        mov     ss:[bx+2],ds            ;store segment
	pop	ds
	pop	es
        pop     di
        pop     si
cEnd       


;
; test_ECS(char,DWORD_prt)      test the char to find out if it is
;                               a valid lead byte using passed DWORD
; Input: char                   PTR to the Lead Byte table.
;        DWORD PTR to table
; Output: AX=FFFF (is_lead)     Lead byte table may be default in 
;         AX=0    (not_lead)    program or ECS table in DOS when
;                               running on a version which supports it.
;
cProc   test_ECS,<PUBLIC>  ;test for lead byte  ;if Lead, then
                                                ; return AX=Is_lead
                                                ; else 
                                                ; return AX=FALSE
Is_lead         EQU     0FFFFH
Not_lead        EQU     0

parmW   char
parmD   pointer         ;DWORD PTR to Lead Byte Table
cBegin 
        mov     ax,char
        xchg    ah,al
        push    SI
        push    DS
        LDS     SI,pointer
ktlop:
        lodsb
        or      al,al
        jz      notlead
        cmp     al,ah
        ja      notlead
        lodsb
        cmp     ah,al
        ja      ktlop
        mov     ax,Is_lead
notl_exit:
        pop     ds
        pop     si
        jmp     cexit
notlead:
        mov     ax,not_lead
        jmp     notl_exit
cexit:
cEnd




sEnd

end