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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
|
INCLUDE STDSW.ASM
KANJI EQU FALSE
Rainbow EQU FALSE
INCLUDE DOSSYM.ASM
;
; segment ordering for MSDOS
;
CONSTANTS SEGMENT BYTE PUBLIC 'CONST'
CONSTANTS ENDS
DATA SEGMENT BYTE PUBLIC 'DATA'
DATA ENDS
CODE SEGMENT BYTE PUBLIC 'CODE'
CODE ENDS
LAST SEGMENT BYTE PUBLIC 'LAST'
LAST ENDS
DOSGROUP GROUP CODE,CONSTANTS,DATA,LAST
CONSTANTS SEGMENT BYTE PUBLIC 'CONST'
PUBLIC DIVMES
DIVMES DB 13,10,"Divide overflow",13,10
PUBLIC DivMesLen
DivMesLen DB $-DivMes ; Length of the above message in bytes
;
; The next variable points to the country table for the current country
; ( the table returned by the AL=0 INTERNATIONAL call).
;
PUBLIC Current_Country
IF KANJI
Current_Country DW OFFSET DOSGROUP:JAPTABLE
ELSE
Current_Country DW OFFSET DOSGROUP:USTABLE
ENDIF
;
; The international tabel(s).
; This is simply a sequence of tables of the following form:
;
; BYTE Size of this table excluding this byte and the next
; BYTE Country code represented by this table
; A sequence of n bytes, where n is the number specified
; by the first byte above and is not > internat_block_max,
; in the correct order for being returned by the
; INTERNATIONAL call as follows:
; WORD Date format 0=mdy, 1=dmy, 2=ymd
; 5 BYTE Currency symbol null terminated
; 2 BYTE thousands separator null terminated
; 2 BYTE Decimal point null terminated
; 2 BYTE Date separator null terminated
; 2 BYTE Time separator null terminated
; 1 BYTE Bit field. Currency format.
; Bit 0. =0 $ before # =1 $ after #
; Bit 1. no. of spaces between # and $ (0 or 1)
; 1 BYTE No. of significant decimal digits in currency
; 1 BYTE Bit field. Time format.
; Bit 0. =0 12 hour clock =1 24 hour
; WORD Segment offset for address of case conversion routine
; WORD RESERVED. Filled in by DOS. Segment value for above routine
; 2 BYTE Data list separator null terminated.
; NOTE: The segment part of the DWORD Map_call is set
; by the INTERNATIONAL call. Do not try to initialize
; it to anything meaningful.
;
; The list of tables is terminated by putting a byte of -1 after the last
; table (a table with length -1).
PUBLIC international_table
international_table LABEL BYTE
IF KANJI
DB SIZE internat_block ; Size in bytes of this table
DB 81 ; Country code
JAPTABLE internat_block <2,'\',0,0,0,0,',',0,'.',0,'-',0,':',0,0,0,1,OFFSET DOSGROUP:MAP_DCASE , 0,',',0>
ENDIF
DB SIZE internat_block ; Size in bytes of this table
DB 1 ; Country code
USTABLE internat_block <0,'$',0,0,0,0,',',0,'.',0,'-',0,':',0,0,2,0,OFFSET DOSGROUP:MAP_DCASE,0,',',0>
; Tables for the IBM PC character set follow. The values
; associated with some of the currency symbols may change with
; other character sets. You may wish to add or delete country
; entries. NOTE: It is not a mistake that the JAPANESE entry
; has different currency symbols for the KANJI and
; non-KANJI versions.
IF NOT KANJI
IF IBM
DB SIZE internat_block ; Size in bytes of this table
DB 44 ; Country code
UKTABLE internat_block <1,9Ch,0,0,0,0,',',0,'.',0,'-',0,':',0,0,2,0,OFFSET DOSGROUP:MAP_DCASE,0,',',0>
DB SIZE internat_block ; Size in bytes of this table
DB 49 ; Country code
GRMTABLE internat_block <1,'D','M',0,0,0,'.',0,',',0,'.',0,'.',0,3,2,1,OFFSET DOSGROUP:MAP_DCASE,0,';',0>
DB SIZE internat_block ; Size in bytes of this table
DB 33 ; Country code
FRNTABLE internat_block <1,'F',0,0,0,0,' ',0,',',0,'/',0,':',0,3,2,1,OFFSET DOSGROUP:MAP_DCASE,0,';',0>
DB SIZE internat_block ; Size in bytes of this table
DB 81 ; Country code
JAPTABLE internat_block <2,9DH,0,0,0,0,',',0,'.',0,'-',0,':',0,0,0,1,OFFSET DOSGROUP:MAP_DCASE , 0,',',0>
ENDIF
ENDIF
DB -1 ; End of tables
CONSTANTS ENDS
CODE SEGMENT BYTE PUBLIC 'CODE'
ASSUME CS:DOSGROUP,DS:NOTHING,ES:NOTHING,SS:NOTHING
;CASE MAPPER ROUTINE FOR 80H-FFH character range
; ENTRY: AL = Character to map
; EXIT: AL = The converted character
; Alters no registers except AL and flags.
; The routine should do nothing to chars below 80H.
;
; Example:
MAP_DCASE PROC FAR
IF NOT KANJI
IF IBM
CMP AL,80H
JB L_RET ;Map no chars below 80H ever
CMP AL,0A7H
JA L_RET ;This routine maps chars between 80H and A7H
SUB AL,80H ;Turn into index value
PUSH DS
PUSH BX
PUSH CS ;Move to DS
POP DS
MOV BX,OFFSET DOSGROUP:TABLE
XLAT ;Get upper case character
POP BX
POP DS
ENDIF
ENDIF
L_RET: RET
MAP_DCASE ENDP
IF NOT KANJI
IF IBM
TABLE: DB 80H,9AH,"E","A",8EH,"A",8FH,80H
DB "E","E","E","I","I","I",8EH,8FH
DB 90H,92H,92H,"O",99H,"O","U","U"
DB "Y",99H,9AH,9BH,9CH,9DH,9EH,9FH
DB "A","I","O","U",0A5H,0A5H,0A6H,0A7H
ENDIF
ENDIF
SUBTTL EDIT FUNCTION ASSIGNMENTS AND HEADERS
PAGE
; The following two tables implement the current buffered input editing
; routines. The tables are pairwise associated in reverse order for ease
; in indexing. That is; The first entry in ESCTAB corresponds to the last
; entry in ESCFUNC, and the last entry in ESCTAB to the first entry in ESCFUNC.
PUBLIC ESCCHAR
ESCCHAR DB ESCCH ;Lead-in character for escape sequences
IF NOT Rainbow
ESCTAB:
IF NOT IBM
IF WANG
DB 0C0h ; ^Z inserter
DB 0C1H ; Copy one char
DB 0C7H ; Skip one char
DB 08AH ; Copy to char
DB 088H ; Skip to char
DB 09AH ; Copy line
DB 0CBH ; Kill line (no change in template)
DB 08BH ; Reedit line (new template)
DB 0C3H ; Backspace
DB 0C6H ; Enter insert mode
IF NOT TOGLINS
DB 0D6H ; Exit insert mode
ENDIF
DB 0C6H ; Escape character
DB 0C6H ; End of table
ELSE
; VT52 equivalences
DB "Z" ; ^Z inserter
DB "S" ; F1 Copy one char
DB "V" ; F4 Skip one char
DB "T" ; F2 Copy to char
DB "W" ; F5 Skip to char
DB "U" ; F3 Copy line
DB "E" ; SHIFT ERASE Kill line (no change in template)
DB "J" ; ERASE Reedit line (new template)
DB "D" ; LEFT Backspace
DB "P" ; BLUE Enter insert mode
DB "Q" ; RED Exit insert mode
DB "R" ; GRAY Escape character
DB "R" ; End of table
ENDIF
ENDIF
IF IBM
DB 64 ; Ctrl-Z - F6
DB 77 ; Copy one char - -->
DB 59 ; Copy one char - F1
DB 83 ; Skip one char - DEL
DB 60 ; Copy to char - F2
DB 62 ; Skip to char - F4
DB 61 ; Copy line - F3
DB 61 ; Kill line (no change to template ) - Not used
DB 63 ; Reedit line (new template) - F5
DB 75 ; Backspace - <--
DB 82 ; Enter insert mode - INS (toggle)
DB 65 ; Escape character - F7
DB 65 ; End of table
ENDIF
ESCEND:
ESCTABLEN EQU ESCEND-ESCTAB
ESCFUNC LABEL WORD
short_addr GETCH ; Ignore the escape sequence
short_addr TWOESC
IF NOT TOGLINS
short_addr EXITINS
ENDIF
short_addr ENTERINS
short_addr BACKSP
short_addr REEDIT
short_addr KILNEW
short_addr COPYLIN
short_addr SKIPSTR
short_addr COPYSTR
short_addr SKIPONE
short_addr COPYONE
IF IBM
short_addr COPYONE
ENDIF
short_addr CTRLZ
ENDIF
;
; OEMFunction key is expected to process a single function
; key input from a device and dispatch to the proper
; routines leaving all registers UNTOUCHED.
;
; Inputs: CS, SS are DOSGROUP
; Outputs: None. This function is expected to JMP to onw of
; the following labels:
;
; GetCh - ignore the sequence
; TwoEsc - insert an ESCChar in the buffer
; ExitIns - toggle insert mode
; EnterIns - toggle insert mode
; BackSp - move backwards one space
; ReEdit - reedit the line with a new template
; KilNew - discard the current line and start from scratch
; CopyLin - copy the rest of the template into the line
; SkipStr - read the next character and skip to it in the template
; CopyStr - read next char and copy from template to line until char
; SkipOne - advance position in template one character
; CopyOne - copy next character in template into line
; CtrlZ - place a ^Z into the template
; Registers that are allowed to be modified by this function are:
; AX, CX, BP
PUBLIC OEMFunctionKey
OEMFunctionKey PROC NEAR
ASSUME DS:NOTHING,ES:NOTHING,SS:DOSGROUP
invoke $STD_CON_INPUT_NO_ECHO ; Get the second byte of the sequence
IF NOT Rainbow
MOV CL,ESCTABLEN ; length of table for scan
PUSH DI ; save DI (cannot change it!)
MOV DI,OFFSET DOSGROUP:ESCTAB ; offset of second byte table
REPNE SCASB ; Look it up in the table
POP DI ; restore DI
SHL CX,1 ; convert byte offset to word
MOV BP,CX ; move to indexable register
JMP [BP+OFFSET DOSGROUP:ESCFUNC] ; Go to the right routine
ENDIF
IF Rainbow
TransferIf MACRO value,address
local a
CMP AL,value
JNZ a
transfer address
a:
ENDM
CMP AL,'[' ; is it second lead char
JZ EatParm ; yes, go walk tree
GoGetCh:
transfer GetCh ; no, ignore sequence
EatParm:
invoke $STD_CON_INPUT_NO_ECHO ; get argument
CMP AL,'A' ; is it alphabetic arg?
JAE EatAlpha ; yes, go snarf one up
XOR BP,BP ; init digit counter
JMP InDigit ; jump into internal eat digit routine
EatNum:
invoke $STD_CON_INPUT_NO_ECHO ; get next digit
InDigit:
CMP AL,'9' ; still a digit?
JA CheckNumEnd ; no, go check for end char
SUB AL,'0' ; turn into potential digit
JB GoGetCh ; oops, not a digit, ignore
MOV CX,BP ; save BP for 10 multiply
CBW ; make AL into AX
SHL BP,1 ; 2*BP
SHL BP,1 ; 4*BP
ADD BP,CX ; 5*BP
SHL BP,1 ; 10*BP
ADD BP,AX ; 10*BP + digit
JMP EatNum ; continue with number
CheckNumEnd:
CMP AL,7Eh ; is it end char ~
JNZ GoGetCh ; nope, ignore key sequence
MOV AX,BP
transferIf 1,SkipStr ; FIND key
transferIf 2,EnterIns ; INSERT HERE key
transferIf 3,SkipOne ; REMOVE
transferIf 4,CopyStr ; SELECT
transferIf 17,TwoEsc ; INTERRUPT
transferIf 18,ReEdit ; RESUME
transferIf 19,KilNew ; CANCEL
transferIf 21,CtrlZ ; EXIT
transferIf 29,CopyLin ; DO
JMP GoGetCh
EatAlpha:
CMP AL,'O' ; is it O?
JA GoGetCh ; no, after assume bogus
JZ EatPQRS ; eat the rest of the bogus key
transferIf 'C',CopyOne ; RIGHT
transferIf 'D',BackSp ; LEFT
JMP GoGetCh
EatPQRS:
invoke $STD_CON_INPUT_NO_ECHO ; eat char after O
JMP GoGetCh
ENDIF
OEMFunctionKey ENDP
CODE ENDS
do_ext
END
|