]> wirehaze git hosting - MS-DOS.git/blob - v4.0/src/CMD/FC/ITOUPPER.ASM

wirehaze git hosting

MZ is back!
[MS-DOS.git] / v4.0 / src / CMD / FC / ITOUPPER.ASM
1 .xlist
2 include version.inc
3 include cmacros.inc
4 .list
5
6 sBegin code
7 assumes cs,code
8
9 ;
10 ; c = IToupper (c, routine);
11 ;
12 ; c is char to be converted
13 ; routine is case map call in international table
14 ;
15
16 cProc IToupper,<PUBLIC>
17 parmW c
18 parmD routine
19 cBegin
20 mov ax,c
21 or ah,ah
22 jnz donothing
23 cmp al,'a'
24 jb noconv
25 cmp al,'z'
26 ja noconv
27 sub al,20H
28 noconv:
29 call routine
30 donothing:
31 cEnd
32
33
34 ;Get_Lbtbl
35 ;
36 ; Get pointer to LBTBL from DOS if we are running on a version
37 ; of DOS which supports it. If not, initialize the table with
38 ; a pointer to a local "default" table with KANJI lead bytes.
39 ;
40 ;Input: word pointer to LONG "Lbtbl"
41 ;Output: long initialized to Lead byte pointer
42 ;
43
44 cProc get_lbtbl,<PUBLIC>
45
46 parmW pointer_to_table
47
48 ; on entry, low word of DWORD pointer has offset of
49 ; a default table of lead bytes defined within the C program
50 ; If function 63 is supported, the DWORD pointer to DOS'
51 ; table will be placed here instead.
52 cBegin
53 push si
54 push di
55 mov bx,pointer_to_table ;get pointer
56 mov si,[bx] ;default table pointer in DS:SI
57 push es
58 push ds
59 mov ax,6300h ;make Get Lead Byte call
60 int 21h
61 mov ss:[bx],si ;si didn't change if non ECS dos
62 mov ss:[bx+2],ds ;store segment
63 pop ds
64 pop es
65 pop di
66 pop si
67 cEnd
68
69
70 ;
71 ; test_ECS(char,DWORD_prt) test the char to find out if it is
72 ; a valid lead byte using passed DWORD
73 ; Input: char PTR to the Lead Byte table.
74 ; DWORD PTR to table
75 ; Output: AX=FFFF (is_lead) Lead byte table may be default in
76 ; AX=0 (not_lead) program or ECS table in DOS when
77 ; running on a version which supports it.
78 ;
79 cProc test_ECS,<PUBLIC> ;test for lead byte ;if Lead, then
80 ; return AX=Is_lead
81 ; else
82 ; return AX=FALSE
83 Is_lead EQU 0FFFFH
84 Not_lead EQU 0
85
86 parmW char
87 parmD pointer ;DWORD PTR to Lead Byte Table
88 cBegin
89 mov ax,char
90 xchg ah,al
91 push SI
92 push DS
93 LDS SI,pointer
94 ktlop:
95 lodsb
96 or al,al
97 jz notlead
98 cmp al,ah
99 ja notlead
100 lodsb
101 cmp ah,al
102 ja ktlop
103 mov ax,Is_lead
104 notl_exit:
105 pop ds
106 pop si
107 jmp cexit
108 notlead:
109 mov ax,not_lead
110 jmp notl_exit
111 cexit:
112 cEnd
113
114
115
116
117 sEnd
118
119 end