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