diff options
Diffstat (limited to 'v4.0/src/DEV/PRINTER/CPSPI.ASM')
| -rw-r--r-- | v4.0/src/DEV/PRINTER/CPSPI.ASM | 2422 |
1 files changed, 2422 insertions, 0 deletions
diff --git a/v4.0/src/DEV/PRINTER/CPSPI.ASM b/v4.0/src/DEV/PRINTER/CPSPI.ASM new file mode 100644 index 0000000..30bb7c9 --- /dev/null +++ b/v4.0/src/DEV/PRINTER/CPSPI.ASM | |||
| @@ -0,0 +1,2422 @@ | |||
| 1 | |||
| 2 | PAGE ,132 | ||
| 3 | |||
| 4 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 5 | ;; | ||
| 6 | ;; FILENAME: CPS Printer Device Driver INIT module (CPSPInn) | ||
| 7 | ;; MODULE NAME: | ||
| 8 | ;; TYPE: Assemble file (non-resident code) | ||
| 9 | ;; LINK PROCEDURE: Link CPSPMnn+CPSFONT+CPSPInn into .EXE format. CPSPM01 | ||
| 10 | ;; must be first. CPSPInn must be last. Everything | ||
| 11 | ;; before CPSPInn will be resident. | ||
| 12 | ;; INCLUDE FILES: | ||
| 13 | ;; CPSPEQU.INC | ||
| 14 | ;; | ||
| 15 | ;; LAYOUT : This file is divided into two main section : | ||
| 16 | ;; ++++++++++++++++++++++++ | ||
| 17 | ;; ++ DEVICE Parser ++ | ||
| 18 | ;; ++++++++++++++++++++++++ | ||
| 19 | ;; | ||
| 20 | ;; ++++++++++++++++++++++++ | ||
| 21 | ;; ++ INIT Command ++ | ||
| 22 | ;; ++++++++++++++++++++++++ | ||
| 23 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 24 | ;; | ||
| 25 | INCLUDE CPSPEQU.INC ;; | ||
| 26 | ;; | ||
| 27 | PUBLIC INIT ;; | ||
| 28 | PUBLIC CODE_END ;; for MAP listing only | ||
| 29 | PUBLIC RESIDENT_END ;; | ||
| 30 | PUBLIC STACK_ALLOCATED ;; | ||
| 31 | ;; | ||
| 32 | ;; | ||
| 33 | EXTRN PRINTER_DESC_NUM:WORD ;; | ||
| 34 | EXTRN PRINTER_DESC_TBL:WORD ;; | ||
| 35 | EXTRN INIT_CHK:WORD,TABLE:WORD ;; | ||
| 36 | EXTRN HARD_SL1:BYTE,RAM_SL1:BYTE ;; | ||
| 37 | EXTRN HARD_SL2:BYTE,RAM_SL2:BYTE ;; | ||
| 38 | EXTRN HARD_SL3:BYTE,RAM_SL3:BYTE ;; | ||
| 39 | EXTRN HARD_SL4:BYTE,RAM_SL4:BYTE ;; | ||
| 40 | EXTRN RESERVED1:WORD,RESERVED2:WORD ;; | ||
| 41 | ;; | ||
| 42 | EXTRN MSG_NO_INIT_P:BYTE ;; | ||
| 43 | EXTRN MSG_NO_INIT:BYTE ;; | ||
| 44 | EXTRN MSG_BAD_SYNTAX:BYTE ;; | ||
| 45 | EXTRN MSG_INSUFF_MEM:BYTE ;; | ||
| 46 | ;; | ||
| 47 | ;; | ||
| 48 | CSEG SEGMENT PARA PUBLIC 'CODE' ;; | ||
| 49 | ASSUME CS:CSEG ;; | ||
| 50 | ;; | ||
| 51 | ;; | ||
| 52 | CODE_END EQU $ ;; end of resident code | ||
| 53 | ;; | ||
| 54 | DW 0 ;; -- there are 16 bytes kept, | ||
| 55 | ;; including this word | ||
| 56 | ;; | ||
| 57 | RESIDENT_END DW 0FFFH ;; end of extended resident area | ||
| 58 | STACK_ALLOCATED DW -1 ;; end of extended resident area | ||
| 59 | ;; | ||
| 60 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 61 | ;; | ||
| 62 | ;; End of resident code | ||
| 63 | ;; | ||
| 64 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 65 | ;; | ||
| 66 | ;; Incorporating Device Command Parser : | ||
| 67 | ;; | ||
| 68 | ;; -- extracted from PARSE4E.ASM, size 49582 bytes | ||
| 69 | ;; | ||
| 70 | ;; (some modifications have to be made in the section right after the parser's | ||
| 71 | ;; document and before the GET_PARMS_A, one of them is :) | ||
| 72 | ;; | ||
| 73 | ;; -- move the TABLE to the printer device driver's main module | ||
| 74 | ;; | ||
| 75 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 76 | ;; | ||
| 77 | ;; ++++++++++++++++++++++++ | ||
| 78 | ;; ++ DEVICE Parser ++ | ||
| 79 | ;; ++++++++++++++++++++++++ | ||
| 80 | ;; | ||
| 81 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 82 | ;; | ||
| 83 | ;; | ||
| 84 | ;; PARSER's code -- non resident | ||
| 85 | ;; | ||
| 86 | ;; -- set ES:[DI] pointing to the Request Header before calling PARSER | ||
| 87 | ;; | ||
| 88 | ;; to be called as PARSER with ES:[DI] defined as Request Header | ||
| 89 | ;; If there is any syntax error in the DEVICE command line, the | ||
| 90 | ;; Parser return a 0 in the first word (NUMBER)of the first table. | ||
| 91 | ;; | ||
| 92 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 93 | ;; | ||
| 94 | ; | ||
| 95 | ; Description: A command parser for DEVICE command in the CONFIG.SYS file. | ||
| 96 | ; ------------ | ||
| 97 | ; | ||
| 98 | ; Procedures contained in the file: | ||
| 99 | ; --------------------------------- | ||
| 100 | ; PARSER: Main routine for command processing. | ||
| 101 | ; GET_CHAR: Gets a character from command line. | ||
| 102 | ; IS_ALPH: Checks if character is an alpha character. | ||
| 103 | ; IS_DIGIT: Checks if character is a digit. | ||
| 104 | ; IS_DELIM: Checks if character is a DOS delimiter. | ||
| 105 | ; DEVICE_PARSE: Pulls device name from command line and | ||
| 106 | ; inserts in table. | ||
| 107 | ; ID_PARSE: Pulls id name from command line and insers in table | ||
| 108 | ; HWCP_PARMS: Extract HWCP number, converts it to binary and | ||
| 109 | ; inserts it in table. | ||
| 110 | ; HWCP_PARSE: Extracts HWCP number if only one number is given. | ||
| 111 | ; MUL_HWCP: Extracts multiple HWCP's numbers, if they are given | ||
| 112 | ; in a list. | ||
| 113 | ; DESG_PARMS: Extracts designate number, converts it to binary | ||
| 114 | ; and inserts it in table. | ||
| 115 | ; DESG_FONT: Extracts the designate and the font if both were | ||
| 116 | ; given in command line. | ||
| 117 | ; DESG_PARSE: Pulls designate number if it is the only one given. | ||
| 118 | ; GET_NUMBER: Converts a number to binary. | ||
| 119 | ; OFFSET_TABLE: Updates the counter in table #1. | ||
| 120 | ; FIND_RIGHT_BR: Looks for a right bracket. | ||
| 121 | ; | ||
| 122 | ; | ||
| 123 | ; Change history: | ||
| 124 | ; --------------- | ||
| 125 | ; | ||
| 126 | ; | ||
| 127 | ;LOGIC: | ||
| 128 | ;------ | ||
| 129 | ; Establish addressability to parameters. | ||
| 130 | ; Skip until end of path and file name -first delimiter | ||
| 131 | ; | ||
| 132 | ; Loop: | ||
| 133 | ; Isolate the first non-delimiter or non delimeter characters. | ||
| 134 | ; If End_of_Line_Delimiter then | ||
| 135 | ; return an error_code | ||
| 136 | ; Else | ||
| 137 | ; If first non-delimiter is ALPHA then | ||
| 138 | ; (assume a device name) | ||
| 139 | ; Extracts device name | ||
| 140 | ; Update offset counter | ||
| 141 | ; | ||
| 142 | ; Isolate the first non-delimiter characters after id name. | ||
| 143 | ; If End_of_Line_Delimiter then | ||
| 144 | ; return an error_code | ||
| 145 | ; Else | ||
| 146 | ; If first non-delimiter is ALPHA-NUMARIC or | ||
| 147 | ; If character is '(' then | ||
| 148 | ; (assume an id name) | ||
| 149 | ; Extracts id name | ||
| 150 | ; Update offset counter | ||
| 151 | ; | ||
| 152 | ; Pull out HWCP | ||
| 153 | ; If error flag is set then exit | ||
| 154 | ; Else if end of line flag is set then exit | ||
| 155 | ; | ||
| 156 | ; Pull out DESG parms | ||
| 157 | ; If error_flag is set then exit. | ||
| 158 | ; Else if end of line flag is set then exit | ||
| 159 | ; Else if Number of devices is four then Exit | ||
| 160 | ; Else Loop | ||
| 161 | ; | ||
| 162 | ; | ||
| 163 | ;Subroutines Logic: | ||
| 164 | ;------------------ | ||
| 165 | ; | ||
| 166 | ; GET_CHAR: | ||
| 167 | ; --------- | ||
| 168 | ; Load character in AL | ||
| 169 | ; If character less than 20h then | ||
| 170 | ; turn Z-flag on | ||
| 171 | ; | ||
| 172 | ; IS_ALPHA: | ||
| 173 | ; --------- | ||
| 174 | ; Save character | ||
| 175 | ; 'Convert character to upper case' | ||
| 176 | ; If character >=A and <=Z then | ||
| 177 | ; turn Z-flag on | ||
| 178 | ; exit | ||
| 179 | ; Else | ||
| 180 | ; Restore character | ||
| 181 | ; exit. | ||
| 182 | ; | ||
| 183 | ; IS_DIGIT: | ||
| 184 | ; --------- If Character >=0 and <=9 then | ||
| 185 | ; turn Z-flag on | ||
| 186 | ; | ||
| 187 | ; IS_DELIMITER: | ||
| 188 | ; ------------- | ||
| 189 | ; If character a dos delimiter (' ','=',',',';',TAB) | ||
| 190 | ; then turn Z-flag on | ||
| 191 | ; | ||
| 192 | ; DEVICE_PARSE: | ||
| 193 | ; ------------- | ||
| 194 | ; Set device name length counter. | ||
| 195 | ; Loop | ||
| 196 | ; If a dos delimiter then | ||
| 197 | ; add spaces to name (if require) | ||
| 198 | ; Else if char is ALPHA-NUM then | ||
| 199 | ; save in table | ||
| 200 | ; If name >8 character thne | ||
| 201 | ; error; exit | ||
| 202 | ; Else | ||
| 203 | ; error; exit | ||
| 204 | ; | ||
| 205 | ; ID_PARSE: | ||
| 206 | ; --------- Set id name length counter. | ||
| 207 | ; Loop | ||
| 208 | ; If a dos delimiter then | ||
| 209 | ; add spaces to name (if require) | ||
| 210 | ; Else if char is ALPHA-NUM then | ||
| 211 | ; save in table | ||
| 212 | ; If name >8 character then | ||
| 213 | ; error; exit | ||
| 214 | ; Else if char is ')' or '(' then | ||
| 215 | ; set flags | ||
| 216 | ; Else | ||
| 217 | ; error; exit | ||
| 218 | ; | ||
| 219 | ; HWCP_PARMS: | ||
| 220 | ; ----------- | ||
| 221 | ; Loop: Set flags off | ||
| 222 | ; If char is a DIGIT then | ||
| 223 | ; convert number to binary | ||
| 224 | ; update table | ||
| 225 | ; Else if char is ',' then | ||
| 226 | ; no HWCP was given | ||
| 227 | ; exit | ||
| 228 | ; Else if char is '(' then | ||
| 229 | ; assume multiple HWCP | ||
| 230 | ; Else if char is ')' then | ||
| 231 | ; end of parms, exit | ||
| 232 | ; Else if not a delimiter then | ||
| 233 | ; error, exit set carry flag set carry flag | ||
| 234 | ; Loop | ||
| 235 | ; | ||
| 236 | ; HWCP_PARSE: | ||
| 237 | ; ----------- Increment counter | ||
| 238 | ; Get number and convert to binary | ||
| 239 | ; Update the table | ||
| 240 | ; Set table_5 pointer | ||
| 241 | ; | ||
| 242 | ; MUL_HWCP: | ||
| 243 | ; --------- | ||
| 244 | ; Loop: If char is ')' then | ||
| 245 | ; end of list, exit | ||
| 246 | ; If char is a DIGIT | ||
| 247 | ; Get number and convert to binary | ||
| 248 | ; Update table. | ||
| 249 | ; If char is not a delimiter then | ||
| 250 | ; error, exit set carry flag | ||
| 251 | ; Loop | ||
| 252 | ; | ||
| 253 | ; DESG_PARMS: | ||
| 254 | ; ----------- | ||
| 255 | ; Loop: If char is a DIGIT then | ||
| 256 | ; Get number and convert to binary | ||
| 257 | ; Update table. | ||
| 258 | ; If char is a ')' then | ||
| 259 | ; end of parms, exit | ||
| 260 | ; If char is a '(' then | ||
| 261 | ; assume given desg. and font | ||
| 262 | ; If char is a ',' then | ||
| 263 | ; no desg ginven | ||
| 264 | ; scane for ')' | ||
| 265 | ; If char is not a delimiter then | ||
| 266 | ; error, exit set carry flag | ||
| 267 | ; Loop | ||
| 268 | ; | ||
| 269 | ; DESG_FONT: | ||
| 270 | ; ---------- | ||
| 271 | ; Loop: If char is a ',' then | ||
| 272 | ; no desg number was given | ||
| 273 | ; update table | ||
| 274 | ; If char is a ')' then | ||
| 275 | ; end of desg-font pair, exit | ||
| 276 | ; If char is a DIGIT then | ||
| 277 | ; Get number and convert to binary | ||
| 278 | ; Update table | ||
| 279 | ; If char not a delimiter then | ||
| 280 | ; error, exit set carry flag | ||
| 281 | ; Loop | ||
| 282 | ; | ||
| 283 | ; DESG_PARSE: | ||
| 284 | ; ----------- Get number and conver to binary | ||
| 285 | ; Update table | ||
| 286 | ; | ||
| 287 | ; GET_NUMBER: | ||
| 288 | ; ----------- Get ASCII number from parms | ||
| 289 | ; conver to binary | ||
| 290 | ; add to total | ||
| 291 | ; | ||
| 292 | ; OFFSET_TABLE: | ||
| 293 | ; ------------- | ||
| 294 | ; Increment the number of parms | ||
| 295 | ; | ||
| 296 | ; FIND_RIGHT_BR: | ||
| 297 | ; -------------- | ||
| 298 | ; Loop: If char is ')' then | ||
| 299 | ; found bracket exit | ||
| 300 | ; If char is not ' ' then | ||
| 301 | ; error, exit set carry flag | ||
| 302 | ; Loop | ||
| 303 | ; END | ||
| 304 | ;------------------------------------------------------ | ||
| 305 | ; | ||
| 306 | ; The following is the table structure of the parser. All fields are | ||
| 307 | ; two bytes field (accept for the device and id name) | ||
| 308 | ; | ||
| 309 | ; TABLE HEADER : | ||
| 310 | ; ÍÍÍÍÍÍÍÍÍÍÍÍÍÍ | ||
| 311 | ; ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ | ||
| 312 | ; ³ N = Number of devices. ³ | ||
| 313 | ; ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ | ||
| 314 | ; ³ Device # 1 offset ÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄ>ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ | ||
| 315 | ; ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ ³ ³ | ||
| 316 | ; ³ Device # 2 offset ³ ³ Table_1 (a) ³ | ||
| 317 | ; ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ ³ ³ | ||
| 318 | ; ³ Device # 3 offset ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ | ||
| 319 | ; ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ | ||
| 320 | ; ³ Device # 4 offset ³ | ||
| 321 | ; ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ | ||
| 322 | ; | ||
| 323 | ; | ||
| 324 | ; N = 1,2,3 or 4. A two bytes number indicating the number of device specified. | ||
| 325 | ; DEVICE # N OFFSET : a two bytes offset address to table_1. (ie. Device #1 offset | ||
| 326 | ; is a pointer to table_1 (a). Device #2 offset is a pointer to table_1 | ||
| 327 | ; (b)...etc.). If an error was detected in the command N is set to zero. | ||
| 328 | ; | ||
| 329 | ; | ||
| 330 | ; | ||
| 331 | ; TABLE_1 : | ||
| 332 | ; ÍÍÍÍÍÍÍÍÍ | ||
| 333 | ; | ||
| 334 | ; ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ | ||
| 335 | ; ³ N = Number of Offsets. ³ ³ ³ | ||
| 336 | ; ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ ÚÄÄÄÄÄij Table_2 (a) ³ | ||
| 337 | ; ³ Device Name offset ÄÅÄÄÄÄÙ ³ ³ | ||
| 338 | ; ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ | ||
| 339 | ; ³ Device Id offset ÄÅÄÄÄÄÄÄ¿ | ||
| 340 | ; ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ ³ ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ | ||
| 341 | ; ³ Device HWCP offset ÄÅÄÄÄÄ¿ ³ ³ ³ | ||
| 342 | ; ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ ³ ÀÄÄÄij Table_3 (a) ³ | ||
| 343 | ; ³ Device Desg offset ÄÅÄÄ¿ ³ ³ ³ | ||
| 344 | ; ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ ³ ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ | ||
| 345 | ; ³ "Reserved" ³ ³ ³ | ||
| 346 | ; ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ ³ ³ ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ | ||
| 347 | ; ³ ³ ³ ³ | ||
| 348 | ; ³ ÀÄÄÄÄÄij Table_4 (a) ³ | ||
| 349 | ; ³ ³ ³ | ||
| 350 | ; ³ ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ | ||
| 351 | ; ³ ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ | ||
| 352 | ; ³ ³ ³ | ||
| 353 | ; ÀÄÄÄÄÄÄÄij Table_5 (a) ³ | ||
| 354 | ; ³ ³ | ||
| 355 | ; ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ | ||
| 356 | ; | ||
| 357 | ; | ||
| 358 | ; N=Length of table_1, or the number of offsets contained in table_1. | ||
| 359 | ; The offsets are pointers (two bytes) to the parameters value of the device. | ||
| 360 | ; "Reserved" : a two byte memory reserved for future use of the "PARMS" option. | ||
| 361 | ; | ||
| 362 | ; | ||
| 363 | ; TABLE_2 : | ||
| 364 | ; ÍÍÍÍÍÍÍÍÍ | ||
| 365 | ; | ||
| 366 | ; ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ | ||
| 367 | ; ³ N = Length of devices name ³ | ||
| 368 | ; ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ | ||
| 369 | ; ³ Device name ³ | ||
| 370 | ; ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ | ||
| 371 | ; | ||
| 372 | ; N = Length of device name. Device length is always 8 byte long. | ||
| 373 | ; Device Name : the name of the device (eg. LPT1, CON, PRN). The name | ||
| 374 | ; is paded with spaces to make up the rest of the 8 characters. | ||
| 375 | ; | ||
| 376 | ; | ||
| 377 | ; | ||
| 378 | ; TABLE_3 : | ||
| 379 | ; ÍÍÍÍÍÍÍÍÍ | ||
| 380 | ; | ||
| 381 | ; ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ | ||
| 382 | ; ³ N = Length of Id name. ³ | ||
| 383 | ; ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ | ||
| 384 | ; ³ Id Name ³ | ||
| 385 | ; ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ | ||
| 386 | ; | ||
| 387 | ; N = Length of id name. Id name length is always 8 byte long. | ||
| 388 | ; Id Name : the name of the id (eg. EGA, VGA, 3812). The name | ||
| 389 | ; is paded with spaces to make up the rest of the 8 character. | ||
| 390 | ; | ||
| 391 | ; | ||
| 392 | ; | ||
| 393 | ; TABLE_4 : | ||
| 394 | ; ÍÍÍÍÍÍÍÍÍ | ||
| 395 | ; | ||
| 396 | ; ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ | ||
| 397 | ; ³ N = Length of table. ³ | ||
| 398 | ; ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ | ||
| 399 | ; ³ HWCP # 1 ³ | ||
| 400 | ; ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ | ||
| 401 | ; ³ HWCP # 2 ³ | ||
| 402 | ; ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ | ||
| 403 | ; ³ . ³ | ||
| 404 | ; ³ . ³ | ||
| 405 | ; ³ . ³ | ||
| 406 | ; ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ | ||
| 407 | ; ³ HWCP # 10 ³ | ||
| 408 | ; ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ | ||
| 409 | ; | ||
| 410 | ; | ||
| 411 | ; N = Length of table in words. Or the number of HWCP's. | ||
| 412 | ; HWCP # N : a hardware code page number converted to binary. The maximum | ||
| 413 | ; number of pages allowed is 10. | ||
| 414 | ; | ||
| 415 | ; | ||
| 416 | ; | ||
| 417 | ; TABLE_5 : | ||
| 418 | ; ÍÍÍÍÍÍÍÍÍ | ||
| 419 | ; | ||
| 420 | ; ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿ | ||
| 421 | ; ³ N = Length of table. ³ | ||
| 422 | ; ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ | ||
| 423 | ; ³ Designate ³ | ||
| 424 | ; ÃÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´ | ||
| 425 | ; ³ Font ³ | ||
| 426 | ; ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ | ||
| 427 | ; | ||
| 428 | ; N = Lenght of table. 0 - nothing was specified | ||
| 429 | ; 1 - Only a designate was specified. | ||
| 430 | ; 2 - Designate and font were given. If the Desg field | ||
| 431 | ; was left empty in the DEVICE command then the | ||
| 432 | ; Designate field is filled with 0FFFFH. | ||
| 433 | ; Designate, Font : Are the Desg. and Font binary numbers. | ||
| 434 | ; | ||
| 435 | ;------------------------------------------------------ | ||
| 436 | ; | ||
| 437 | |||
| 438 | ;RESERVED MEMORY: | ||
| 439 | TABLE_1 DW ? ; Pointer at offsets. | ||
| 440 | TABLE_2 DW ? ; Pointer at device name. | ||
| 441 | TABLE_3 DW ? ; Pointer at id name. | ||
| 442 | TABLE_4 DW ? ; Pointer at hwcp. | ||
| 443 | TABLE_5 DW ? ; Pointer at desg and font. | ||
| 444 | ;TABLE DB 290 DUP (?) ; Table of parsed parms. Max 4 devices. | ||
| 445 | DEVNUM DW ? ; Counter to number of devices. | ||
| 446 | RIGHT_FLAG DB ? ; Flag to indicate a left bracket. | ||
| 447 | DEV_ERR_FLG DB ? ; Device name error flag. | ||
| 448 | ID_ERR_FLG DB ? ; Id name error flag. | ||
| 449 | ERROR_FLAG DB ? ; Error flag_terminate program if set to 1. | ||
| 450 | COMMA_FLAG DB ? ; Indicate the number of commas incounterd. | ||
| 451 | HWCP_FLAG DB ? ; Flag for multiple hwcps. | ||
| 452 | DESG_FLAG DB ? ; Flag indicates desg. and font. | ||
| 453 | |||
| 454 | ;Main part of program-links different sumbroutines together | ||
| 455 | |||
| 456 | PARSER PROC | ||
| 457 | |||
| 458 | PUSH AX ; ;;;;;;;;;;;;;;;;;; | ||
| 459 | PUSH BX ; ; | ||
| 460 | PUSH CX ; ; SAVE | ||
| 461 | PUSH DX ; ; ALL | ||
| 462 | PUSH DS ; ; REGISTERS. | ||
| 463 | PUSH ES ; ; | ||
| 464 | PUSH DI ; ; | ||
| 465 | PUSH SI ; ;;;;;;;;;;;;;;;;;; | ||
| 466 | |||
| 467 | LES SI,RH.RH0_BPBA ; Point at all after DEVICE= | ||
| 468 | ; in the CONFIG.SYS file. | ||
| 469 | |||
| 470 | |||
| 471 | ;Skip to end of file name, to the first DOS delimiter. | ||
| 472 | |||
| 473 | MOV DEVNUM,02H ; Number of devices counter. | ||
| 474 | |||
| 475 | GET_PARMS_A: CALL GET_CHAR ; Get command character in AL . | ||
| 476 | JZ EXIT_B ; No parms found. | ||
| 477 | CALL IS_DELIM ; If not a delimiter then. | ||
| 478 | JNE GET_PARMS_A ; Check next character. | ||
| 479 | |||
| 480 | MOV DI,OFFSET TABLE ; Get the table address. | ||
| 481 | ADD DI,02H ; Point at devices offsets. | ||
| 482 | MOV BX,DI ; | ||
| 483 | ADD BX,08H ; Point BX at parms offsets. | ||
| 484 | TAB2: CALL UPDATE_TABLE ; Update table pointers value. | ||
| 485 | |||
| 486 | CLR_DELIM: CALL GET_CHAR ; Get character into AL. | ||
| 487 | JZ EXIT_B ; No parms found. | ||
| 488 | CALL IS_ALPHA ; If alpha then assume. | ||
| 489 | JZ DEVICE ; A device name. | ||
| 490 | CALL IS_DELIM ; Is it a delimiter | ||
| 491 | JNE EXIT_A ; If not then error. | ||
| 492 | JMP CLR_DELIM ; Get next character. | ||
| 493 | |||
| 494 | DEVICE: MOV DEV_ERR_FLG,00H ; Set device error flag off; | ||
| 495 | CALL DEVICE_PARSE ; Call routine to parse device name. | ||
| 496 | CMP DEV_ERR_FLG,01H ; If error flag is | ||
| 497 | JZ EXIT_A ; set then exit. | ||
| 498 | CALL OFFSET_TABLE ; Update table. | ||
| 499 | |||
| 500 | ID_PARMS: CALL GET_CHAR ; Load a character in AL. | ||
| 501 | JZ EXIT_A ; Exit if end of line (error). | ||
| 502 | CMP AL,'(' ; If AL is a '(' then | ||
| 503 | JE ID ; Parse ID name. | ||
| 504 | CALL IS_ALPHA ; If an Alpha | ||
| 505 | JE ID ; Then parse ID name. | ||
| 506 | CALL IS_DIGIT ; If a digit | ||
| 507 | JE ID ; Then parse ID name. | ||
| 508 | CALL IS_DELIM ; If not a delimiter | ||
| 509 | JNE EXIT_A ; Then error, exit | ||
| 510 | JMP ID_PARMS ; Get another number | ||
| 511 | |||
| 512 | EXIT_B: CMP DEVNUM,02H ; If device number above 2 then | ||
| 513 | JA EXIT_C ; Exit parse. | ||
| 514 | JMP EXIT_A ; Else error, exit | ||
| 515 | |||
| 516 | ID: MOV ID_ERR_FLG,00H ; Set id error flag off. | ||
| 517 | CALL ID_PARSE ; Parse ID name. | ||
| 518 | CMP ID_ERR_FLG,01H ; Was error flag set, then | ||
| 519 | JE EXIT_A ; Print error message. | ||
| 520 | CALL OFFSET_TABLE ; Update table of offsets. | ||
| 521 | |||
| 522 | CALL HWCP_PARMS ; Get code page number | ||
| 523 | CMP ERROR_FLAG,01H ; If error, then | ||
| 524 | JE EXIT_A ; Print error message and exit | ||
| 525 | CMP ERROR_FLAG,02H ; If end of string | ||
| 526 | JE EXIT_H ; Then exit. | ||
| 527 | |||
| 528 | CALL DESG_PARMS ; Get designate number | ||
| 529 | CMP ERROR_FLAG,01H ; If error, then | ||
| 530 | JE EXIT_A ; Print error message and exit | ||
| 531 | JMP EXIT_H ; Then exit. | ||
| 532 | |||
| 533 | EXIT_A: MOV DI,OFFSET TABLE ; Load table offset | ||
| 534 | MOV DS:WORD PTR [DI],00H ; Set error to on. | ||
| 535 | STC ; Set carry flag | ||
| 536 | JMP EXIT_P ; Exit parse. | ||
| 537 | |||
| 538 | EXIT_H: MOV DI,OFFSET TABLE ; Load table offset. | ||
| 539 | ADD DS:WORD PTR [DI],01H ; Increment number of devices. | ||
| 540 | CMP DEVNUM,08H ; If 4 devices loaded | ||
| 541 | JE EXIT_C ; Then exit parse. | ||
| 542 | ADD DEVNUM,02H ; Increment the number of devices | ||
| 543 | ADD DI,DEVNUM ; Point at next devices offset. | ||
| 544 | MOV BX,TABLE_5 ; BX point at | ||
| 545 | ADD BX,06H ; end of previous table. | ||
| 546 | JMP TAB2 ; Get next device. | ||
| 547 | |||
| 548 | EXIT_C: CLC | ||
| 549 | |||
| 550 | EXIT_P: POP SI ; ;;;;;;;;;;;;;;;;;; | ||
| 551 | POP DI ; ; | ||
| 552 | POP ES ; ; RESTORE | ||
| 553 | POP DS ; ; ALL | ||
| 554 | POP DX ; ; REGISTERS. | ||
| 555 | POP CX ; ; | ||
| 556 | POP BX ; ; | ||
| 557 | POP AX ; ;;;;;;;;;;;;;;;;;; | ||
| 558 | RET | ||
| 559 | |||
| 560 | PARSER ENDP | ||
| 561 | |||
| 562 | |||
| 563 | ;******************************************************** | ||
| 564 | ;** GET_CHAR : a routine to get next character pointed ** | ||
| 565 | ;** to by ES:SI into AL. ** | ||
| 566 | ;******************************************************** | ||
| 567 | |||
| 568 | GET_CHAR PROC | ||
| 569 | |||
| 570 | MOV AL,ES:BYTE PTR [SI] ; Load character pointed to | ||
| 571 | CMP AL,09H ; by ES:[SI] in AL. | ||
| 572 | JE ZOFF ; If tab then O.K | ||
| 573 | CMP AL,20H ; Turn Z-flag on | ||
| 574 | JL TURN_Z_ON ; if character | ||
| 575 | ZOFF: INC SI ; is below | ||
| 576 | JMP GET_CHAR_X ; 20h. | ||
| 577 | ; ( End of line | ||
| 578 | TURN_Z_ON: CMP AL,AL ; delimiters ). | ||
| 579 | GET_CHAR_X: RET | ||
| 580 | |||
| 581 | GET_CHAR ENDP | ||
| 582 | |||
| 583 | |||
| 584 | ;******************************************************** | ||
| 585 | ;** IS_ALPHA : a routine to check the character in ** | ||
| 586 | ;** AL if it is an alpha character (a...z,A...Z). ** | ||
| 587 | ;** If character is lower case, convert to upper case. ** | ||
| 588 | ;******************************************************** | ||
| 589 | |||
| 590 | IS_ALPHA PROC | ||
| 591 | |||
| 592 | PUSH AX ; Save value of AL | ||
| 593 | AND AL,0DFH ; Convert to upper case | ||
| 594 | CMP AL,'A' ; If <'A', then | ||
| 595 | JB IS_ALPHA_X ; NZ-flag is set, exit | ||
| 596 | CMP AL,'Z' ; If >'Z', then | ||
| 597 | JA IS_ALPHA_X ; NZ-flag is set, exit | ||
| 598 | CMP AL,AL ; Force Z-flag | ||
| 599 | POP DX ; Discard lower case. | ||
| 600 | JMP IA_X ; Exit. | ||
| 601 | IS_ALPHA_X: POP AX ; Restore value of AL | ||
| 602 | IA_X: RET | ||
| 603 | |||
| 604 | IS_ALPHA ENDP | ||
| 605 | |||
| 606 | |||
| 607 | ;******************************************************** | ||
| 608 | ;** IS_DIGIT : a routine to check if the character in ** | ||
| 609 | ;** AL register is a digit (i.e. 1..9). ** | ||
| 610 | ;******************************************************** | ||
| 611 | |||
| 612 | IS_DIGIT PROC | ||
| 613 | |||
| 614 | CMP AL,'0' ; If < '0' then | ||
| 615 | JB IS_NUM_X ; NZ-flag is set, exit | ||
| 616 | CMP AL,'9' ; If > '9' then | ||
| 617 | JA IS_NUM_X ; NZ-flag is set, exit | ||
| 618 | CMP AL,AL ; Set Z-flag to indecate digit | ||
| 619 | IS_NUM_X: RET | ||
| 620 | |||
| 621 | IS_DIGIT ENDP | ||
| 622 | |||
| 623 | |||
| 624 | ;******************************************************** | ||
| 625 | ;** IS_DELIM : This routine check if the character in ** | ||
| 626 | ;** AL is a delimiter. ('+',' ',';',',','=',tab) ** | ||
| 627 | ;******************************************************** | ||
| 628 | |||
| 629 | IS_DELIM PROC | ||
| 630 | |||
| 631 | CMP AL,' ' ; Test for space. | ||
| 632 | JE IS_DELIM_X ; Z-flag is set, exit | ||
| 633 | CMP AL,',' ; Test for comma. | ||
| 634 | JE IS_DELIM_X ; Z-flag is set, exit | ||
| 635 | CMP AL,';' ; Test for semicolon. | ||
| 636 | JE IS_DELIM_X ; Z-flag is set, exit | ||
| 637 | CMP AL,'=' ; Test for equal sign. | ||
| 638 | JE IS_DELIM_X ; Z-flag is set, exit | ||
| 639 | CMP AL,09h ; Test for TAB. | ||
| 640 | |||
| 641 | IS_DELIM_X: RET ; Exit | ||
| 642 | |||
| 643 | IS_DELIM ENDP | ||
| 644 | |||
| 645 | |||
| 646 | ;******************************************************** | ||
| 647 | ;** DEVICE_PARSE : Parse the device driver name and ** | ||
| 648 | ;** store in table. Update offset. ** | ||
| 649 | ;******************************************************** | ||
| 650 | |||
| 651 | DEVICE_PARSE PROC | ||
| 652 | |||
| 653 | MOV DI,TABLE_2 | ||
| 654 | MOV DS:WORD PTR [DI],0008H ; Save dev name size. | ||
| 655 | ADD DI,02H ; Increment DI. | ||
| 656 | MOV CX,9 ; Set counter. | ||
| 657 | NEXT_C: CALL IS_ALPHA ; if Check then. | ||
| 658 | JZ SAVE_C ; Save it. | ||
| 659 | CALL IS_DIGIT ; if Digit then. | ||
| 660 | JZ SAVE_C ; Save it. | ||
| 661 | CMP AL,'-' ; If '-' then. | ||
| 662 | JZ SAVE_C ; Save it. | ||
| 663 | CALL IS_DELIM ; If a delimiter then. | ||
| 664 | JZ ADD_SPACE1 ; Pad with spaces. | ||
| 665 | CMP AL,':' ; If a colon | ||
| 666 | JE ADD_SPACE1 ; then end device parse | ||
| 667 | JMP ERR_DEV_PAR ; Else an error. | ||
| 668 | |||
| 669 | SAVE_C: DEC CX ; Decrement counter. | ||
| 670 | CMP CX,0 ; If counter zero then. | ||
| 671 | JE ERR_DEV_PAR ; Error. | ||
| 672 | MOV DS:BYTE PTR [DI],AL ; Save char in table. | ||
| 673 | INC DI ; Increment pointer. | ||
| 674 | CALL GET_CHAR ; Get another char. | ||
| 675 | JZ ERR_DEV_PAR | ||
| 676 | JMP NEXT_C ; Check char. | ||
| 677 | |||
| 678 | ERR_DEV_PAR: MOV DEV_ERR_FLG,01H ; Set error flag. | ||
| 679 | JMP DEV_PAR_X ; Exit. | ||
| 680 | |||
| 681 | ADD_SPACE1: DEC CX ; Check counter. | ||
| 682 | CMP CX,1 | ||
| 683 | JL DEV_PAR_X ; Exit if already 8. | ||
| 684 | LL1: MOV DS:BYTE PTR [DI],' ' ; Pad name with spaces. | ||
| 685 | INC DI ; Increment pointer. | ||
| 686 | LOOP LL1 ; Loop again. | ||
| 687 | DEV_PAR_X: RET | ||
| 688 | |||
| 689 | DEVICE_PARSE ENDP | ||
| 690 | |||
| 691 | |||
| 692 | ;******************************************************** | ||
| 693 | ;** ID_PARSE : Parse the id driver name and ** | ||
| 694 | ;** store in table. Update offset. ** | ||
| 695 | ;******************************************************** | ||
| 696 | |||
| 697 | ID_PARSE PROC | ||
| 698 | |||
| 699 | MOV DI,TABLE_3 | ||
| 700 | MOV DS:WORD PTR [DI],0008H ; Save dev name size. | ||
| 701 | ADD DI,02H ; Increment DI. | ||
| 702 | MOV RIGHT_FLAG,00H ; Clear flag. | ||
| 703 | MOV CX,9 ; Set counter. | ||
| 704 | |||
| 705 | NEXT_I: CALL IS_ALPHA ; If Check then. | ||
| 706 | JZ SAVE_I ; Save it. | ||
| 707 | CALL IS_DIGIT ; if Digit then. | ||
| 708 | JZ SAVE_I ; Save it. | ||
| 709 | CMP AL,'-' ; If '-' then. | ||
| 710 | JZ SAVE_I ; Save it. | ||
| 711 | CMP AL,'(' ; If '(' then. | ||
| 712 | JE RIG_BR_FLG ; Set flag. | ||
| 713 | CMP AL,')' ; If ')' then | ||
| 714 | JE BR_FLG_LEF ; Pad with spaces. | ||
| 715 | CALL IS_DELIM ; If a delimiter then. | ||
| 716 | JZ ADD_SPACE2 ; Pad with spaces. | ||
| 717 | JMP ERR_ID_PAR ; Else an error. | ||
| 718 | |||
| 719 | SAVE_I: DEC CX ; Decrement counter. | ||
| 720 | CMP CX,0 ; If counter zero then. | ||
| 721 | JLE ERR_ID_PAR ; Error. | ||
| 722 | MOV DS:BYTE PTR [DI],AL ; Save char in table. | ||
| 723 | INC DI ; Increment pointer. | ||
| 724 | CALL GET_CHAR ; Get another char. | ||
| 725 | JZ ADD_SPACE2 ; Exit routine. | ||
| 726 | JMP NEXT_I ; Check char. | ||
| 727 | |||
| 728 | ERR_ID_PAR: MOV ID_ERR_FLG,01H ; Set error falg on. | ||
| 729 | JMP ID_PAR_X ; Exit. | ||
| 730 | |||
| 731 | BR_FLG_LEF: CMP RIGHT_FLAG,01H ; If left bracket was | ||
| 732 | JNE ERR_ID_PAR ; found and no previous | ||
| 733 | JMP ADD_SPACE2 ; Bracket found, then error | ||
| 734 | |||
| 735 | RIG_BR_FLG: CMP RIGHT_FLAG,01H ; If more than one bracket | ||
| 736 | JE ERR_ID_PAR ; then error. | ||
| 737 | CMP CX,09 ; If '(' and already id | ||
| 738 | JB ERR_ID_PAR ; then error. | ||
| 739 | MOV RIGHT_FLAG,01H ; Set flag for. | ||
| 740 | CALL GET_CHAR ; Left brackets. | ||
| 741 | JZ ERR_ID_PAR ; If end of line,exit. | ||
| 742 | JMP NEXT_I ; Check character. | ||
| 743 | |||
| 744 | ADD_SPACE2: DEC CX ; Check counter. | ||
| 745 | CMP CX,1 | ||
| 746 | JL ID_PAR_X ; Exit if already 8. | ||
| 747 | |||
| 748 | LL2: MOV DS:BYTE PTR [DI],' ' ; Pad name with spaces. | ||
| 749 | INC DI ; Increment pointer. | ||
| 750 | LOOP LL2 ; Loop again. | ||
| 751 | |||
| 752 | ID_PAR_X: RET | ||
| 753 | |||
| 754 | ID_PARSE ENDP | ||
| 755 | |||
| 756 | ;******************************************************** | ||
| 757 | ;** HWCP_PARMS : Scane for the hardware code page, and ** | ||
| 758 | ;** parse it if found. Flag codes set to: ** | ||
| 759 | ;** ERROR_FLAG = 0 - parsing completed. No error. ** | ||
| 760 | ;** ERROR_FLAG = 1 - error found exit parse. ** | ||
| 761 | ;** ERROR_FLAG = 2 - end of line found, exit parse. ** | ||
| 762 | ;******************************************************** | ||
| 763 | |||
| 764 | |||
| 765 | HWCP_PARMS PROC | ||
| 766 | |||
| 767 | MOV COMMA_FLAG,00H ; Set the comma flag off. | ||
| 768 | MOV ERROR_FLAG,00H ; Set the error flag off. | ||
| 769 | DEC SI ; Point at current char in Al. | ||
| 770 | CMP RIGHT_FLAG,01H ; If no left brackets then | ||
| 771 | JNE LEFT_BR ; Exit parse. | ||
| 772 | |||
| 773 | HWCP_1: CALL GET_CHAR ; Load character in AL. | ||
| 774 | JZ LEFT_BR ; Exit, if end of line. | ||
| 775 | CALL IS_DIGIT ; Check if digit, then | ||
| 776 | JE HP1 ; Parse hwcp parms. | ||
| 777 | CMP AL,',' ; If a comma | ||
| 778 | JE COMMA_1 ; Jump to comma_1 | ||
| 779 | CMP AL,')' ; If a ')' then | ||
| 780 | JE RIGHT_BR ; end of current dev parms. | ||
| 781 | CMP AL,'(' ; If a '(' then | ||
| 782 | JE HWCP_2 ; There are multible hwcp. | ||
| 783 | CALL IS_DELIM ; Else, if not a delimiter | ||
| 784 | JNE EXIT_2 ; Then error, exit | ||
| 785 | JMP HWCP_1 ; Get another character. | ||
| 786 | |||
| 787 | LEFT_BR: CMP RIGHT_FLAG,01H ; If no left bracket | ||
| 788 | JE EXIT_2 ; Then error, exit | ||
| 789 | JMP RB1 ; Jump to rb1 | ||
| 790 | |||
| 791 | COMMA_1: CMP COMMA_FLAG,01H ; If comma flag set | ||
| 792 | JE COM_2_HC ; Then exit hwcp parse. | ||
| 793 | MOV COMMA_FLAG,01H ; Else set comma flag. | ||
| 794 | JMP HWCP_1 ; Get another character. | ||
| 795 | |||
| 796 | HWCP_2: CMP RIGHT_FLAG,01H ; If left bracket not set | ||
| 797 | JNE EXIT_2 ; then error. | ||
| 798 | CALL MUL_HWCP ; else call multiple hwcp | ||
| 799 | ADD DI,02H ; routine. Increment DI | ||
| 800 | MOV TABLE_5,DI ; Desg. Table starts at end | ||
| 801 | CALL OFFSET_TABLE ; Update table of offsets. | ||
| 802 | JMP HP_X ; Exit. | ||
| 803 | |||
| 804 | HP1: JMP HWCP ; Jump too long. | ||
| 805 | |||
| 806 | COM_2_HC: MOV DI,TABLE_4 ; DI points at hwcp table | ||
| 807 | MOV DS:WORD PTR [DI],0000H ; Set number of pages to | ||
| 808 | MOV COMMA_FLAG,00H ; Zero and reset comma flag. | ||
| 809 | ADD DI,02H ; Increment DI. | ||
| 810 | MOV TABLE_5,DI ; Desg. Table starts at end | ||
| 811 | CALL OFFSET_TABLE ; Update table of offsets. | ||
| 812 | JMP HP_X ; of hwcp table. Exit. | ||
| 813 | |||
| 814 | RIGHT_BR: CMP RIGHT_FLAG,01H ; If left brackets not | ||
| 815 | JNE EXIT_2 ; Found then error. | ||
| 816 | RB1: MOV ERROR_FLAG,02H ; Set end of line flag. | ||
| 817 | MOV BX,TABLE_4 ; Point at hwcp table | ||
| 818 | ADD BX,02H ; Adjust pointer to desg | ||
| 819 | MOV TABLE_5,BX ; table, and save in table_5 | ||
| 820 | MOV DI,TABLE_1 ; Point at table of offsets | ||
| 821 | ADD DI,08H ; Set at DESG offset | ||
| 822 | MOV DS:WORD PTR [DI],BX ; Update table. | ||
| 823 | JMP HP_X ; Exit | ||
| 824 | |||
| 825 | |||
| 826 | |||
| 827 | EXIT_2: MOV ERROR_FLAG,01H ; Set error flag. | ||
| 828 | JMP HP_X ; and exit. | ||
| 829 | |||
| 830 | HWCP: CMP RIGHT_FLAG,01H ; If left brackets not | ||
| 831 | JNE EXIT_2 ; Found then error. | ||
| 832 | CALL HWCP_PARSE ; Call parse one hwcp. | ||
| 833 | CMP ERROR_FLAG,01H ; If error flag set | ||
| 834 | JE HP_X ; Then exit, else | ||
| 835 | CALL OFFSET_TABLE ; Update table of offsets. | ||
| 836 | |||
| 837 | HP_X: RET | ||
| 838 | |||
| 839 | HWCP_PARMS ENDP | ||
| 840 | |||
| 841 | |||
| 842 | ;******************************************************** | ||
| 843 | ;** HWCP_PARSE : Parse the hardware code page page ** | ||
| 844 | ;** number and change it from hex to binary. ** | ||
| 845 | ;******************************************************** | ||
| 846 | |||
| 847 | HWCP_PARSE PROC | ||
| 848 | |||
| 849 | MOV DI,TABLE_4 ; Load address of hwcpages. | ||
| 850 | ADD DS:WORD PTR [DI],0001H ; Set count to 1 | ||
| 851 | |||
| 852 | CALL GET_NUMBER ; Convert number to binary. | ||
| 853 | CMP ERROR_FLAG,01H ; If error then | ||
| 854 | JE HWCP_X ; Exit. | ||
| 855 | MOV DS:WORD PTR [DI+2],BX ; Else, save binary page number | ||
| 856 | ADD DI,04H ; Increment counter | ||
| 857 | MOV TABLE_5,DI ; Set pointer of designate num | ||
| 858 | |||
| 859 | HWCP_X: RET | ||
| 860 | |||
| 861 | HWCP_PARSE ENDP | ||
| 862 | |||
| 863 | |||
| 864 | ;******************************************************** | ||
| 865 | ;** MUL_HWCP : Parse multiple hardware code pages ** | ||
| 866 | ;** and convert them from hex to binary numbers. ** | ||
| 867 | ;******************************************************** | ||
| 868 | |||
| 869 | MUL_HWCP PROC | ||
| 870 | |||
| 871 | MOV DI,TABLE_4 ; Load offset of table_4 | ||
| 872 | MOV BX,DI ; in DI and Bx. | ||
| 873 | MOV HWCP_FLAG,00H ; Set hwcp flag off. | ||
| 874 | |||
| 875 | MH1: CALL GET_CHAR ; Load character in AL. | ||
| 876 | JZ MH3 ; Exit if end of line. | ||
| 877 | CMP AL,')' ; If ')' then exit | ||
| 878 | JE MH2 ; end of parms. | ||
| 879 | CALL IS_DIGIT ; If a digit, then | ||
| 880 | JE MH4 ; Convert number to binary. | ||
| 881 | CALL IS_DELIM ; If not a delimiter | ||
| 882 | JNE MH3 ; then error, exit | ||
| 883 | JMP MH1 ; get another character. | ||
| 884 | |||
| 885 | MH2: CALL GET_CHAR ; Get next character | ||
| 886 | JMP MH_X ; and exit. | ||
| 887 | |||
| 888 | MH3: MOV ERROR_FLAG,01H ; Set error flag on. | ||
| 889 | JMP MH_X ; Exit. | ||
| 890 | |||
| 891 | MH4: ADD HWCP_FLAG,01H ; Set hwcp flag on (0 off) | ||
| 892 | ADD DI,02H ; Increment table pointer | ||
| 893 | PUSH BX ; Save Bx | ||
| 894 | CALL GET_NUMBER ; Convert number to binary. | ||
| 895 | MOV DS:WORD PTR [DI],BX ; Add number to table | ||
| 896 | POP BX ; Restore BX. | ||
| 897 | CMP ERROR_FLAG,01H ; If error then | ||
| 898 | JE MH_X ; Exit. | ||
| 899 | ADD DS:WORD PTR [BX],01H ; Increment hwcp count. | ||
| 900 | DEC SI ; Point at character in AL | ||
| 901 | JMP MH1 ; (delimeter or ')'). | ||
| 902 | MH_X: RET | ||
| 903 | |||
| 904 | MUL_HWCP ENDP | ||
| 905 | |||
| 906 | |||
| 907 | |||
| 908 | ;******************************************************** | ||
| 909 | ;** DESG_PARMS : Scane for the designate numbers, and ** | ||
| 910 | ;** parse it if found. Flag codes set to: ** | ||
| 911 | ;** ERROR_FLAG = 0 - parsing completed. No error. ** | ||
| 912 | ;** ERROR_FLAG = 1 - error found exit parse. ** | ||
| 913 | ;** ERROR_FLAG = 2 - end of line found, exit parse. ** | ||
| 914 | ;******************************************************** | ||
| 915 | |||
| 916 | |||
| 917 | DESG_PARMS PROC | ||
| 918 | |||
| 919 | MOV DI,TABLE_1 ; Get offset of dev in DI | ||
| 920 | MOV BX,TABLE_5 ; & offset of desg. in BX. | ||
| 921 | ADD DI,08 ; Location of desg offset in table. | ||
| 922 | MOV DS:WORD PTR [DI],BX ; Update table. | ||
| 923 | MOV COMMA_FLAG,00H ; Set comma flag off. | ||
| 924 | |||
| 925 | cmp al,'(' | ||
| 926 | je df | ||
| 927 | cmp al,')' | ||
| 928 | je right_br2 | ||
| 929 | |||
| 930 | cmp al,',' | ||
| 931 | jne desg_parm1 | ||
| 932 | mov comma_flag,01h | ||
| 933 | |||
| 934 | DESG_PARM1: CALL GET_CHAR ; Get character in AL. | ||
| 935 | JZ EXIT_3 ; Error, if end of line | ||
| 936 | CALL IS_DIGIT ; If character is a digit | ||
| 937 | JE DESG ; Then convert to binary. | ||
| 938 | CMP AL,')' ; If a ')', then | ||
| 939 | JE RIGHT_BR2 ; end of parameters. | ||
| 940 | CMP AL,'(' ; If a '(' then | ||
| 941 | JE DF ; parse desg and font. | ||
| 942 | CMP AL,',' ; If a comma then | ||
| 943 | JE DP3 ; set flag. | ||
| 944 | CALL IS_DELIM ; If not a delimiter | ||
| 945 | JNE EXIT_3 ; then error. | ||
| 946 | JMP DESG_PARM1 ; Get another character. | ||
| 947 | |||
| 948 | RIGHT_BR2: CMP RIGHT_FLAG,01H ; IF no '(' encountered, | ||
| 949 | JNE EXIT_3 ; then error, exit | ||
| 950 | JMP DP_x ; Jump to DP1. | ||
| 951 | |||
| 952 | EXIT_3: MOV ERROR_FLAG,01H ; Set error flag on | ||
| 953 | JMP DP_X ; Exit. | ||
| 954 | |||
| 955 | DF: CMP RIGHT_FLAG,01H ; If no '(' encountered | ||
| 956 | JB EXIT_3 ; then error, exit | ||
| 957 | CALL DESG_FONT ; Parse desg and font. | ||
| 958 | JMP DP1 ; Jump to DP1. | ||
| 959 | |||
| 960 | DP2: CALL FIND_RIGHT_BR ; Check for ')' | ||
| 961 | JMP DP_X ; Exit. | ||
| 962 | |||
| 963 | DP3: CMP COMMA_FLAG,01H ; If comma flag set | ||
| 964 | JE DP2 ; then error | ||
| 965 | MOV COMMA_FLAG,01H ; Else set comma flag on. | ||
| 966 | JMP DESG_PARM1 ; Get another character. | ||
| 967 | |||
| 968 | DESG: MOV ERROR_FLAG,00H ; Set error flag off. | ||
| 969 | CALL DESG_PARSE ; Parse desg. | ||
| 970 | DP1: CMP ERROR_FLAG,01H ; If error flag on then | ||
| 971 | JE DP_X ; Exit, | ||
| 972 | CALL FIND_RIGHT_BR ; Else check for ')' | ||
| 973 | CALL OFFSET_TABLE ; Update table | ||
| 974 | |||
| 975 | DP_X: RET | ||
| 976 | |||
| 977 | DESG_PARMS ENDP | ||
| 978 | |||
| 979 | |||
| 980 | |||
| 981 | ;******************************************************** | ||
| 982 | ;** DESG_FONT : Parse the designate and font numbers & ** | ||
| 983 | ;** change them from decimal to binary. ** | ||
| 984 | ;******************************************************** | ||
| 985 | |||
| 986 | |||
| 987 | DESG_FONT PROC | ||
| 988 | |||
| 989 | |||
| 990 | MOV DI,TABLE_5 ; Get desg font table. | ||
| 991 | MOV COMMA_FLAG,00H ; Set comma flag off. | ||
| 992 | DF1: CALL GET_CHAR ; Load a character in AL. | ||
| 993 | JZ DF3 ; Error if end of line. | ||
| 994 | CMP AL,',' ; Check if a comma. | ||
| 995 | JE DF2 ; Set flag. | ||
| 996 | CALL IS_DIGIT ; If a digit, then | ||
| 997 | JE DF5 ; Convert number to binary. | ||
| 998 | CMP AL,')' ; If a ')' then | ||
| 999 | JE DF4 ; Exit. | ||
| 1000 | CALL IS_DELIM ; If not a delimiter | ||
| 1001 | JNE DF3 ; then error, exit | ||
| 1002 | JMP DF1 ; Get another character. | ||
| 1003 | |||
| 1004 | DF2: CMP COMMA_FLAG,01H ; If comma flag on | ||
| 1005 | JE DF3 ; then error, exit | ||
| 1006 | MOV COMMA_FLAG,01H ; Set comma flag on | ||
| 1007 | ADD DS:WORD PTR [DI],01H ; Increment desg counter. | ||
| 1008 | MOV DS:WORD PTR [DI+2],0FFFFH ; Load ffffh for desg empty | ||
| 1009 | JMP DF1 ; field. | ||
| 1010 | |||
| 1011 | DF3: MOV ERROR_FLAG,01H ; Set error flag on. | ||
| 1012 | JMP DF_X ; Exit. | ||
| 1013 | |||
| 1014 | DF4: CMP DESG_FLAG,00H ; If desg flag off | ||
| 1015 | JE DF3 ; then error, exit | ||
| 1016 | JMP DF_X ; Else exit. | ||
| 1017 | |||
| 1018 | DF5: ADD DS:WORD PTR [DI],01H ; Increment desg font count. | ||
| 1019 | CMP DESG_FLAG,01H ; If desg flag is on | ||
| 1020 | JE DF6 ; then get font. | ||
| 1021 | CMP COMMA_FLAG,01H ; if comma flag is on | ||
| 1022 | JE DF6 ; then get font. | ||
| 1023 | MOV DESG_FLAG,01H ; Set desg flag on | ||
| 1024 | JMP DF7 ; Get desg number. | ||
| 1025 | |||
| 1026 | DF6: ADD DI,02H ; adjust pointer to font. | ||
| 1027 | MOV DESG_FLAG,02H ; Set desg and font flag. | ||
| 1028 | DF7: CALL GET_NUMBER ; Get a number & convert to | ||
| 1029 | CMP ERROR_FLAG,01H ; binary. | ||
| 1030 | JE DF_X ; If error flag set, Exit. | ||
| 1031 | MOV DS:WORD PTR [DI+2],BX ; Store number in table. | ||
| 1032 | CMP DESG_FLAG,02H ; If desg and font flag | ||
| 1033 | JNE DF1 ; not set, then get char. | ||
| 1034 | CALL FIND_RIGHT_BR ; Check for right bracket. | ||
| 1035 | |||
| 1036 | DF_X: RET | ||
| 1037 | |||
| 1038 | DESG_FONT ENDP | ||
| 1039 | |||
| 1040 | |||
| 1041 | ;******************************************************** | ||
| 1042 | ;** DESG_PARSE : Parse the designate number and ** | ||
| 1043 | ;** change it from decimal to binary. ** | ||
| 1044 | ;******************************************************** | ||
| 1045 | |||
| 1046 | DESG_PARSE PROC | ||
| 1047 | |||
| 1048 | MOV DI,TABLE_5 ; Load designate location | ||
| 1049 | ADD DS:WORD PTR [DI],0001H ; Update table count. | ||
| 1050 | |||
| 1051 | CALL GET_NUMBER ; Get the ascii number and | ||
| 1052 | CMP ERROR_FLAG,01H ; conver it to binary | ||
| 1053 | JE DESG_X ; If error then exit | ||
| 1054 | |||
| 1055 | MOV DS:WORD PTR [DI+2],BX ; Else, save desg number | ||
| 1056 | |||
| 1057 | |||
| 1058 | DESG_X: RET | ||
| 1059 | |||
| 1060 | DESG_PARSE ENDP | ||
| 1061 | |||
| 1062 | |||
| 1063 | ;******************************************************** | ||
| 1064 | ;** GET_NUMBER : Convert the number pointed to by SI ** | ||
| 1065 | ;** to a binary number and store it in BX ** | ||
| 1066 | ;******************************************************** | ||
| 1067 | |||
| 1068 | GET_NUMBER PROC | ||
| 1069 | |||
| 1070 | MOV CX,0AH ; Set multiplying factor | ||
| 1071 | XOR BX,BX ; Clear DX | ||
| 1072 | |||
| 1073 | NEXT_NUM: SUB AL,30H ; Conver number to binary | ||
| 1074 | CBW ; Clear AH | ||
| 1075 | XCHG AX,BX ; Switch ax and bx to mul | ||
| 1076 | MUL CX ; already converted number by 10. | ||
| 1077 | JO ERR_NUM ; On over flow jump to error. | ||
| 1078 | ADD BX,AX ; Add number to total. | ||
| 1079 | JC ERR_NUM ; On over flow jump to error. | ||
| 1080 | XOR AX,AX ; Clear AX (clear if al=0a). | ||
| 1081 | CALL GET_CHAR ; Get next character | ||
| 1082 | JZ GET_NUM_X ; Exit, if end of line. | ||
| 1083 | CALL IS_DIGIT ; Call is digit. | ||
| 1084 | JNZ GET_NUM_X ; Exit if not a number. | ||
| 1085 | JMP NEXT_NUM ; Loop. | ||
| 1086 | |||
| 1087 | ERR_NUM: MOV ERROR_FLAG,01H ; Set error code to 1. | ||
| 1088 | |||
| 1089 | GET_NUM_X: RET | ||
| 1090 | |||
| 1091 | GET_NUMBER ENDP | ||
| 1092 | |||
| 1093 | |||
| 1094 | ;******************************************************** | ||
| 1095 | ;** UPDATE_TABLE : This routine set up pointers to the ** | ||
| 1096 | ;** different offsets of the different tables ** | ||
| 1097 | ;******************************************************** | ||
| 1098 | |||
| 1099 | UPDATE_TABLE PROC | ||
| 1100 | |||
| 1101 | MOV DS:WORD PTR [DI],BX ; Offset of offsets | ||
| 1102 | MOV TABLE_1,BX ; Table_1 points at offsets | ||
| 1103 | |||
| 1104 | MOV DI,BX ; | ||
| 1105 | ADD BX,0CH ; | ||
| 1106 | MOV DS:WORD PTR [DI+2],BX ; Offset of DEVICE name. | ||
| 1107 | MOV TABLE_2,BX ; Table_2 point at device name. | ||
| 1108 | |||
| 1109 | ADD BX,0AH ; | ||
| 1110 | MOV DS:WORD PTR [DI+4],BX ; Offset of ID name. | ||
| 1111 | MOV TABLE_3,BX ; Table_3 point at ID name. | ||
| 1112 | |||
| 1113 | ADD BX,0AH ; | ||
| 1114 | MOV DS:WORD PTR [DI+6],BX ; Offset of HWCP pages. | ||
| 1115 | MOV TABLE_4,BX ; Table_4 point at HWCP pages. | ||
| 1116 | |||
| 1117 | RET | ||
| 1118 | |||
| 1119 | UPDATE_TABLE ENDP | ||
| 1120 | |||
| 1121 | |||
| 1122 | ;******************************************************** | ||
| 1123 | ;** OFFSET_TABLE : This routine set up pointers of ** | ||
| 1124 | ;** tables number one and two. ** | ||
| 1125 | ;******************************************************** | ||
| 1126 | |||
| 1127 | OFFSET_TABLE PROC | ||
| 1128 | |||
| 1129 | MOV DI,TABLE_1 ; Increment the number | ||
| 1130 | ADD DS:WORD PTR [DI],01H ; of parms foun. (ie. id,hwcp | ||
| 1131 | RET ; and desg) | ||
| 1132 | |||
| 1133 | OFFSET_TABLE ENDP | ||
| 1134 | |||
| 1135 | |||
| 1136 | ;******************************************************** | ||
| 1137 | ;** FIND_RIGHT_BR :This routine scane the line for a ** | ||
| 1138 | ;** ')' if cannot find it turns error flag on ** | ||
| 1139 | ;******************************************************** | ||
| 1140 | |||
| 1141 | FIND_RIGHT_BR PROC | ||
| 1142 | |||
| 1143 | FBR1: CMP AL,')' ; If a right bracket | ||
| 1144 | JE FBR_X ; then exit. | ||
| 1145 | CMP AL,' ' ; If not a space | ||
| 1146 | JNE FBR2 ; Then error. | ||
| 1147 | CALL GET_CHAR ; Get a character | ||
| 1148 | JZ FBR2 ; If end of line then exit. | ||
| 1149 | JMP FBR1 ; Else get another character. | ||
| 1150 | |||
| 1151 | FBR2: MOV ERROR_FLAG,01H ; Set error flag on | ||
| 1152 | FBR_X: MOV AL,20H ; Erase character from AL. | ||
| 1153 | RET | ||
| 1154 | |||
| 1155 | FIND_RIGHT_BR ENDP | ||
| 1156 | |||
| 1157 | ;;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | ||
| 1158 | ;; | ||
| 1159 | ;; ++++++++++++++++++++++++ | ||
| 1160 | ;; ++ INIT Command ++ | ||
| 1161 | ;; ++++++++++++++++++++++++ | ||
| 1162 | ;; | ||
| 1163 | ;;==== Command Code 0 - Initialization ====== | ||
| 1164 | ;; | ||
| 1165 | ;; messages returned : | ||
| 1166 | ;; | ||
| 1167 | ;; msg_bad_syntax -- syntax error from parser, no driver installation | ||
| 1168 | ;; msg_no_init -- device cannot be initialised | ||
| 1169 | ;; msg_insuff_mem -- insufficient memory | ||
| 1170 | ;; | ||
| 1171 | ;; layout : the initialization is done in two stages : | ||
| 1172 | ;; | ||
| 1173 | ;; ++++++++++++++++++++++++ | ||
| 1174 | ;; ++ INIT Stage 1 ++ to examine and extract the | ||
| 1175 | ;; ++++++++++++++++++++++++ parameters defined for the | ||
| 1176 | ;; device_id in DEVICE command, | ||
| 1177 | ;; according to the printer | ||
| 1178 | ;; description table for the | ||
| 1179 | ;; device_id. | ||
| 1180 | ;; | ||
| 1181 | ;; ++++++++++++++++++++++++ | ||
| 1182 | ;; ++ INIT Stage 2 ++ to set the BUFfer for the LPTn | ||
| 1183 | ;; ++++++++++++++++++++++++ or PRN according to device_id's | ||
| 1184 | ;; parameters | ||
| 1185 | ;; | ||
| 1186 | ;; | ||
| 1187 | ;; | ||
| 1188 | ;;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | ||
| 1189 | ;; | ||
| 1190 | DEV_NUM dw ? ;; | ||
| 1191 | ;; | ||
| 1192 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 1193 | ; | ||
| 1194 | ; Tables for the deivce_id parameters in the order of device_id in the | ||
| 1195 | ; PARSE table | ||
| 1196 | ; === the tables serves as the link between LPTn to be defined in the 2nd | ||
| 1197 | ; stage, and the device_id that is processed in the first stage. | ||
| 1198 | ; | ||
| 1199 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 1200 | ;; | ||
| 1201 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 1202 | ;; device ID indicators : | ||
| 1203 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 1204 | DID_MAX EQU 4 ;; device entris exepcted in PARSE | ||
| 1205 | ;; not more than 16. ;; table | ||
| 1206 | ;; | ||
| 1207 | DID_STATUS DW 0 ;; status of parsing device id | ||
| 1208 | ;; = 0 : all Device-ID bad | ||
| 1209 | ;; -- see DID_BIT | ||
| 1210 | ;; | ||
| 1211 | DID_MATCH DW 0 ;; this DID has device_name matched | ||
| 1212 | ;; | ||
| 1213 | DID_FAIL DW 0 ;; to fail the good DID_STATUS and | ||
| 1214 | ;; the matched name. (due to | ||
| 1215 | ;; inconsistency among the same LPTn | ||
| 1216 | ;; or between PRN and LPT1.) | ||
| 1217 | ;; | ||
| 1218 | ;; (DID_STATUS) AND (DID_MATCH) XOR (DID_FAIL) determines the success of DID | ||
| 1219 | ;; initialization | ||
| 1220 | ;; | ||
| 1221 | DID_ONE EQU 00001H ;; first device-ID | ||
| 1222 | DID_TWO EQU 00002H ;; second " | ||
| 1223 | DID_THREE EQU 00004H ;; third " | ||
| 1224 | DID_FOUR EQU 00008H ;; fourth " | ||
| 1225 | ;;maximun number of device_id = 16 ;; | ||
| 1226 | ;; | ||
| 1227 | DID_BIT LABEL WORD ;; | ||
| 1228 | DW DID_ONE ;; | ||
| 1229 | DW DID_TWO ;; | ||
| 1230 | DW DID_THREE ;; | ||
| 1231 | DW DID_FOUR ;; | ||
| 1232 | ;;maximun number of device_id = 16 ;; | ||
| 1233 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 1234 | ;; device paramters according to the | ||
| 1235 | ;; device_id defined in DEVICE and the | ||
| 1236 | ;; parameters defined for the device_id | ||
| 1237 | ;; in the printer description table. | ||
| 1238 | ;; | ||
| 1239 | HRMAX LABEL word ;; number of hwcp+cart slots supported | ||
| 1240 | DW 0 ;; did = 1 | ||
| 1241 | DW 0 ;; did = 2 | ||
| 1242 | DW 0 ;; did = 3 | ||
| 1243 | DW 0 ;; did = 4 | ||
| 1244 | ;upto max DID_MAX ;; | ||
| 1245 | ;; | ||
| 1246 | CTMAX LABEL word ;; number of cart slots supported | ||
| 1247 | DW 0 ;; did = 1 | ||
| 1248 | DW 0 ;; did = 2 | ||
| 1249 | DW 0 ;; did = 3 | ||
| 1250 | DW 0 ;; did = 4 | ||
| 1251 | ;upto max DID_MAX ;; | ||
| 1252 | ;; | ||
| 1253 | RMMAX LABEL word ;; number of ram-slots supported | ||
| 1254 | DW 0 ;; did = 1 | ||
| 1255 | DW 0 ;; did = 2 | ||
| 1256 | DW 0 ;; did = 3 | ||
| 1257 | DW 0 ;; did = 4 | ||
| 1258 | ;upto max DID_MAX ;; | ||
| 1259 | ;; | ||
| 1260 | RBUMAX LABEL word ;; number of ram-designate slots | ||
| 1261 | DW 0 ;; did = 1 | ||
| 1262 | DW 0 ;; did = 2 | ||
| 1263 | DW 0 ;; did = 3 | ||
| 1264 | DW 0 ;; did = 4 | ||
| 1265 | ;upto max DID_MAX ;; | ||
| 1266 | ;; | ||
| 1267 | DESCO LABEL word ;; offset to the description table | ||
| 1268 | ;; where the device_id is defined. | ||
| 1269 | DW -1 ;; did = 1 | ||
| 1270 | DW -1 ;; did = 2 | ||
| 1271 | DW -1 ;; did = 3 | ||
| 1272 | DW -1 ;; did = 4 | ||
| 1273 | ;upto max DID_MAX ;; | ||
| 1274 | ;; | ||
| 1275 | FSIZE LABEL word ;; font size of the device | ||
| 1276 | DW 0 ;; did = 1 | ||
| 1277 | DW 0 ;; did = 2 | ||
| 1278 | DW 0 ;; did = 3 | ||
| 1279 | DW 0 ;; did = 4 | ||
| 1280 | ;upto max DID_MAX ;; | ||
| 1281 | ;; | ||
| 1282 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 1283 | ; | ||
| 1284 | ; Hard/RAM slots table in the order of DEVICE parameters | ||
| 1285 | ; | ||
| 1286 | ; number of entries in all HARD_SLn is determined by the max. {HSLOTS}, and | ||
| 1287 | ; number of entries in all RAM_SLn is determined by the max. {RSLOTS} | ||
| 1288 | ; | ||
| 1289 | ; -- they are initialized according to the device_id defined in the DEVICE. | ||
| 1290 | ; | ||
| 1291 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 1292 | ;; | ||
| 1293 | HARD_SLA LABEL word ;; index in the order of device in | ||
| 1294 | DW OFFSET (HARD_SL1) ;; the PARSE-talbes | ||
| 1295 | DW OFFSET (HARD_SL2) ;; | ||
| 1296 | DW OFFSET (HARD_SL3) ;; | ||
| 1297 | DW OFFSET (HARD_SL4) ;; | ||
| 1298 | ; up to DID_MAX ;; | ||
| 1299 | ;; | ||
| 1300 | RAM_SLA LABEL word ;; | ||
| 1301 | DW OFFSET (RAM_SL1) ;; | ||
| 1302 | DW OFFSET (RAM_SL2) ;; | ||
| 1303 | DW OFFSET (RAM_SL3) ;; | ||
| 1304 | DW OFFSET (RAM_SL4) ;; | ||
| 1305 | ; up to DID_MAX ;; | ||
| 1306 | ;; | ||
| 1307 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 1308 | ;; | ||
| 1309 | ;; ++++++++++++++++++++++++ | ||
| 1310 | ;; ++ INIT Command ++ | ||
| 1311 | ;; ++++++++++++++++++++++++ | ||
| 1312 | ;; | ||
| 1313 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 1314 | ;; | ||
| 1315 | INIT PROC NEAR ;; | ||
| 1316 | ;; | ||
| 1317 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 1318 | ;; parse the initialization parameters in DEVICE command | ||
| 1319 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 1320 | ;; | ||
| 1321 | ;; | ||
| 1322 | CMP BUF.BFLAG,BF_PRN ;; since PRN is the FIRST device header | ||
| 1323 | JNE NOT_PRN ;; | ||
| 1324 | ;; | ||
| 1325 | ;; | ||
| 1326 | MOV AX,OFFSET CODE_END ;; defined only once for each DEVICE | ||
| 1327 | XOR CX,CX ;; | ||
| 1328 | MOV CL,4 ;; | ||
| 1329 | SHR AX,CL ;; | ||
| 1330 | PUSH CS ;; | ||
| 1331 | POP CX ;; | ||
| 1332 | ADD AX,CX ;; | ||
| 1333 | INC AX ;; leave 16 bytes,room for resident_end | ||
| 1334 | MOV RESIDENT_END,AX ;; | ||
| 1335 | ;; | ||
| 1336 | CALL PARSER ;; call only once, for PRM | ||
| 1337 | ;; | ||
| 1338 | JMP PROCESS_TABLE ;; | ||
| 1339 | ;; | ||
| 1340 | NOT_PRN : ;; | ||
| 1341 | CMP DEV_NUM,1 ;; | ||
| 1342 | ;; | ||
| 1343 | JNB PROCESS_TABLE ;; | ||
| 1344 | ;; | ||
| 1345 | JMP SYNTAX_ERROR ;; | ||
| 1346 | ;; | ||
| 1347 | ;; | ||
| 1348 | ;; | ||
| 1349 | ;; | ||
| 1350 | ;;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | ||
| 1351 | ;; | ||
| 1352 | ;; ++++++++++++++++++++++++ | ||
| 1353 | ;; ++ INIT Stage 1 ++ | ||
| 1354 | ;; ++++++++++++++++++++++++ | ||
| 1355 | ;; | ||
| 1356 | ;; INIT - FIRST STAGE : | ||
| 1357 | ;; | ||
| 1358 | ;; == test and extract if the parameters on device-id is valid | ||
| 1359 | ;; == determine the DID_STATUS according to the validity of the parameters | ||
| 1360 | ;; == procedure(s) called -- DID_EXTRACT | ||
| 1361 | ;; | ||
| 1362 | ;;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | ||
| 1363 | ;; | ||
| 1364 | PROCESS_TABLE : ;; | ||
| 1365 | ;; | ||
| 1366 | PUSH CS ;; | ||
| 1367 | POP ES ;; PSE points to Device offsets | ||
| 1368 | MOV DI,OFFSET(table) ;; ES:[DI] | ||
| 1369 | MOV DX,PSE.PAR_DEV_NUM ;; | ||
| 1370 | MOV DEV_NUM,DX ;; | ||
| 1371 | ;; | ||
| 1372 | CMP DEV_NUM,0 ;; | ||
| 1373 | JNZ NO_SYNTAX_ERR ;; | ||
| 1374 | ;; | ||
| 1375 | XOR AX,AX ;; | ||
| 1376 | MOV AH,09H ;; | ||
| 1377 | MOV DX,OFFSET MSG_BAD_SYNTAX;; | ||
| 1378 | INT 21H ;; | ||
| 1379 | ;; | ||
| 1380 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 1381 | SYNTAX_ERROR : ;; set the request header status | ||
| 1382 | ;; according to the STATE | ||
| 1383 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 1384 | MOV AX, RESIDENT_END ;; | ||
| 1385 | PUSH CS ;; | ||
| 1386 | POP CX ;; CX=CS | ||
| 1387 | SUB AX,Cx ;; additional segment required. | ||
| 1388 | CS_LOOP1: ;; | ||
| 1389 | CMP AX,1000H ;; | ||
| 1390 | JB CS_LPEND1 ;; | ||
| 1391 | ADD CX,1000H ;; | ||
| 1392 | SUB AX,1000H ;; | ||
| 1393 | JMP CS_LOOP1 ;; | ||
| 1394 | ;; | ||
| 1395 | CS_LPEND1: ;; | ||
| 1396 | SHL AX,1 ;; | ||
| 1397 | SHL AX,1 ;; | ||
| 1398 | SHL AX,1 ;; | ||
| 1399 | SHL AX,1 ;; | ||
| 1400 | ;; | ||
| 1401 | LES DI,dword ptr buf.rh_ptro ;; get Request Header address | ||
| 1402 | ; MOV RH.RH0_ENDO,AX ;; | ||
| 1403 | MOV RH.RH0_ENDO,0 ;; | ||
| 1404 | MOV RH.RH0_ENDS,CX ;; | ||
| 1405 | MOV RH.RHC_STA,stat_cmderr ;; set status in request header | ||
| 1406 | ;; | ||
| 1407 | JMP INIT_RETurn ;; | ||
| 1408 | ;; | ||
| 1409 | ;; | ||
| 1410 | NO_SYNTAX_ERR : ;; | ||
| 1411 | ;; | ||
| 1412 | CMP DX,DID_MAX ;; | ||
| 1413 | JNA NEXT_DID ;; | ||
| 1414 | ;; | ||
| 1415 | MOV INIT_CHK,0001H ;; ERROR 0001 | ||
| 1416 | JMP BAD_DID ;; more than supported no. of device | ||
| 1417 | ;; | ||
| 1418 | NEXT_DID: ;; | ||
| 1419 | PUSH DI ;; pointer to PAR_OT (table 1) | ||
| 1420 | AND DX,DX ;; | ||
| 1421 | JNZ SCAN_DESC ;; | ||
| 1422 | JMP END_DID ;; DI = offset to the 1st PARSE table | ||
| 1423 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 1424 | SCAN_DESC: ;; | ||
| 1425 | MOV DI,PSE.PAR_OFF ;; points to the nth device | ||
| 1426 | ;; | ||
| 1427 | ;; find the description for the | ||
| 1428 | ;;device-id | ||
| 1429 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 1430 | MOV CX,PRINTER_DESC_NUM ;; | ||
| 1431 | MOV SI, OFFSET(PRINTER_DESC_TBL); offset to the description table | ||
| 1432 | PUSH CS ;; | ||
| 1433 | POP DS ;; | ||
| 1434 | ; $SEARCH ;; | ||
| 1435 | $$DO1: | ||
| 1436 | PUSH CX ;; save device count | ||
| 1437 | PUSH SI ;; pointer to printer-descn's offset | ||
| 1438 | MOV SI,CS:WORD PTR[SI] ;; | ||
| 1439 | AND CX,CX ;; | ||
| 1440 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 1441 | ; $LEAVE Z ;; LEAVE if no more device description | ||
| 1442 | JZ $$EN1 | ||
| 1443 | PUSH DI ;; save offset to PAR_DEVOT | ||
| 1444 | MOV DI,PSE.PAR_DIDO ;; | ||
| 1445 | MOV CX,PSE.PAR_DIDL ;; length of parsed device name | ||
| 1446 | LEA DI,PSE.PAR_DID ;; pointer to parse device name | ||
| 1447 | ;; | ||
| 1448 | PUSH SI ;; | ||
| 1449 | LEA SI,[SI].TYPEID ;; offset to name of device-id | ||
| 1450 | REPE CMPSB ;; | ||
| 1451 | POP SI ;; | ||
| 1452 | POP DI ;; get back offset to PAR_DEVOT | ||
| 1453 | ;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 1454 | ; $EXITIF Z ;; EXIT if name matched | ||
| 1455 | JNZ $$IF1 | ||
| 1456 | ;; | ||
| 1457 | CALL DID_EXTRACT ;; get the parameters | ||
| 1458 | ;; | ||
| 1459 | POP SI ;; balance push-pop | ||
| 1460 | POP CX ;; | ||
| 1461 | ;; | ||
| 1462 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 1463 | ; $ORELSE ;; try next description : | ||
| 1464 | JMP SHORT $$SR1 | ||
| 1465 | $$IF1: | ||
| 1466 | ;; | ||
| 1467 | POP SI ;; of printer_descn offset table | ||
| 1468 | INC SI ;; | ||
| 1469 | INC SI ;; next offset to PRINTER_DESCn | ||
| 1470 | ;; | ||
| 1471 | POP CX ;; one description less | ||
| 1472 | DEC CX ;; | ||
| 1473 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 1474 | ; $ENDLOOP ;; DEVICE-ID not defined in | ||
| 1475 | JMP SHORT $$DO1 | ||
| 1476 | $$EN1: | ||
| 1477 | ;; printer_desc; | ||
| 1478 | ;; | ||
| 1479 | MOV AX,INIT_CHK ;; | ||
| 1480 | AND AX,AX ;; | ||
| 1481 | JNZ UNCHANGED ;; | ||
| 1482 | MOV INIT_CHK,0004H ;; ERROR 0004 | ||
| 1483 | UNCHANGED: ;; | ||
| 1484 | POP SI ;; balance push-pop | ||
| 1485 | POP CX ;; | ||
| 1486 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 1487 | ; $ENDSRCH ;; End of scanning printer_desc | ||
| 1488 | $$SR1: | ||
| 1489 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 1490 | POP DI ;; | ||
| 1491 | INC DI ;; | ||
| 1492 | INC DI ;; points to next device in PART_OT | ||
| 1493 | DEC DX ;; | ||
| 1494 | ;; | ||
| 1495 | JMP NEXT_DID ;; | ||
| 1496 | ;; | ||
| 1497 | END_DID : ;; | ||
| 1498 | POP DI ;; | ||
| 1499 | BAD_DID : ;; | ||
| 1500 | ;; | ||
| 1501 | MOV AX,DID_STATUS ;; | ||
| 1502 | AND AX,AX ;; | ||
| 1503 | JNZ DEF_BUFFER ;; | ||
| 1504 | ;; | ||
| 1505 | JMP END_LPT ;; | ||
| 1506 | ;; | ||
| 1507 | ;;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | ||
| 1508 | ;; | ||
| 1509 | ;; ++++++++++++++++++++++++ | ||
| 1510 | ;; ++ INIT Stage 2 ++ | ||
| 1511 | ;; ++++++++++++++++++++++++ | ||
| 1512 | ;; | ||
| 1513 | ;; INIT -- SECOND STAGE : | ||
| 1514 | ;; | ||
| 1515 | ;; == match the device_name extracted in stage 1 with the name of PRN or | ||
| 1516 | ;; LPTn | ||
| 1517 | ;; | ||
| 1518 | ;; == if the PRN/LPTn has never been defined before, then set up the BUF | ||
| 1519 | ;; for the PRN/LPTn if the DID_STATUS is good; otherwise message will | ||
| 1520 | ;; be generated indicating it cannot be initilized. | ||
| 1521 | ;; | ||
| 1522 | ;; == if there is PRN, LPT1 is also setup, and vice vera. IF both PRN and | ||
| 1523 | ;; LPT1 are on the DEVICE command, or there are multiple entries for | ||
| 1524 | ;; the same LPTn, the consistency is checked. It they are inconsistent | ||
| 1525 | ;; the associated LPTn or PRN is forced to fail by : DID_FAIL. | ||
| 1526 | ;; | ||
| 1527 | ;; == if the device_name on the DEVICE command is not one of the supported | ||
| 1528 | ;; PRN or LPTn, then DID_MATCH bit will not be set. An error message | ||
| 1529 | ;; will be generated for the device_name indicating it cannot be | ||
| 1530 | ;; initialized. | ||
| 1531 | ;; | ||
| 1532 | ;; == procedure(s) called : CHK_DID .. check DID parameters for device | ||
| 1533 | ;; whose name matched. | ||
| 1534 | ;; DEV_CHECK .. if device-name duplicated, or | ||
| 1535 | ;; there are both PRN/LPT1 : check | ||
| 1536 | ;; for consistent parameters. | ||
| 1537 | ;; | ||
| 1538 | ;;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | ||
| 1539 | DEF_BUFFER : ;; | ||
| 1540 | PUSH CS ;; | ||
| 1541 | POP ES ;; PSE points to Device offsets | ||
| 1542 | MOV DI,OFFSET(table) ;; ES:[DI] | ||
| 1543 | xor cx,cx ;; device order in parse table | ||
| 1544 | ;SEARCH ;; | ||
| 1545 | $$DO7: | ||
| 1546 | PUSH DI ;; pointer to PAR_OT | ||
| 1547 | PUSH CX ;; save device count | ||
| 1548 | MOV DI,PSE.PAR_OFF ;; " " PAR_DEVOT | ||
| 1549 | cmp cx,dev_num ;; | ||
| 1550 | ;; | ||
| 1551 | ;LEAVE NB ;; LEAVE if no more device entry | ||
| 1552 | jb MORE_DEVICE ;; | ||
| 1553 | JMP $$EN7 | ||
| 1554 | MORE_DEVICE : ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 1555 | ;; more parsed_device to be checked | ||
| 1556 | PUSH DI ;; save offset to PAR_DEVOT | ||
| 1557 | MOV DI,PSE.PAR_DNMO ;; | ||
| 1558 | MOV CX,PSE.PAR_DNML ;; length of parsed device name | ||
| 1559 | LEA DI,PSE.PAR_DNM ;; pointer to parse device name | ||
| 1560 | ;; | ||
| 1561 | LDS SI,DWORD PTR BUF.DEV_HDRO ; get the offset to device-n header | ||
| 1562 | LEA SI,HP.DH_NAME ;; " offset to name of device-n | ||
| 1563 | REPE CMPSB ;; | ||
| 1564 | POP DI ;; get back offset to PAR_DEVOT | ||
| 1565 | ;; | ||
| 1566 | ;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 1567 | ;EXITIF Z ;; EXIT if name matched | ||
| 1568 | JZ NAME_MATCHED ;; | ||
| 1569 | ;; | ||
| 1570 | JMP MORE_PARSED_DEVICE ;; | ||
| 1571 | ;; | ||
| 1572 | NAME_MATCHED : ;; | ||
| 1573 | ;; | ||
| 1574 | POP CX ;; the DID order | ||
| 1575 | PUSH BX ;; | ||
| 1576 | MOV BX,CX ;; | ||
| 1577 | ADD BX,BX ;; | ||
| 1578 | MOV AX,DID_BIT[BX] ;; | ||
| 1579 | OR DID_MATCH,AX ;; this DID matched | ||
| 1580 | POP BX ;; | ||
| 1581 | PUSH CX ;; | ||
| 1582 | ;; | ||
| 1583 | LEA SI,BUF.PAR_EXTRACTO ;; was the LPT1/PRN defined before ? | ||
| 1584 | MOV AX,CS:[SI].PAR_DNMO ;; | ||
| 1585 | CMP AX,0FFFFH ;; | ||
| 1586 | ;; | ||
| 1587 | JNE DEV_COMPARE ;; DI = PAR_DEVOT | ||
| 1588 | ;;----------------------------------- | ||
| 1589 | ;; | ||
| 1590 | ;; no device previousely defined | ||
| 1591 | MOV AX,PSE.PAR_DNMO ;; | ||
| 1592 | MOV CS:[SI].PAR_DNMO,AX ;; define device parameters for LPTn | ||
| 1593 | ;; | ||
| 1594 | MOV AX,PSE.PAR_DIDO ;; | ||
| 1595 | MOV CS:[SI].PAR_DIDO,AX ;; | ||
| 1596 | ;; | ||
| 1597 | MOV AX,PSE.PAR_HWCPO ;; | ||
| 1598 | MOV CS:[SI].PAR_HWCPO,AX ;; | ||
| 1599 | ;; | ||
| 1600 | MOV AX,PSE.PAR_DESGO ;; | ||
| 1601 | MOV CS:[SI].PAR_DESGO,AX ;; | ||
| 1602 | ;; | ||
| 1603 | MOV AX,PSE.PAR_PARMO ;; | ||
| 1604 | MOV CS:[SI].PAR_PARMO,AX ;; | ||
| 1605 | ;; | ||
| 1606 | ;;--------------------------------- | ||
| 1607 | CALL CHK_DID ;; define the STATE according to | ||
| 1608 | ;; DID_STATUS | ||
| 1609 | JMP MORE_PARSED_DEVICE ;; | ||
| 1610 | ;; | ||
| 1611 | DEV_COMPARE : ;;------------------------------- | ||
| 1612 | ;; e.g. LPT1 and PRN shares one BUF. | ||
| 1613 | ;; or duplicated device name | ||
| 1614 | CALL DEV_CHECK ;; | ||
| 1615 | ;; | ||
| 1616 | CMP BUF.STATE,CPSW ;; | ||
| 1617 | JNE DEV_COMPARE_FAIL ;; | ||
| 1618 | ;; | ||
| 1619 | JMP MORE_PARSED_DEVICE ;; | ||
| 1620 | ;; | ||
| 1621 | DEV_COMPARE_FAIL : ;; | ||
| 1622 | ;; | ||
| 1623 | POP CX ;; | ||
| 1624 | POP DI ;; balance push-pop | ||
| 1625 | ;; | ||
| 1626 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 1627 | ;$ORELSE ;; | ||
| 1628 | JMP END_LPT | ||
| 1629 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 1630 | MORE_PARSED_DEVICE : ;; name does not match | ||
| 1631 | ;; | ||
| 1632 | POP CX ;; | ||
| 1633 | INC CX ;; | ||
| 1634 | POP DI ;; | ||
| 1635 | INC DI ;; | ||
| 1636 | INC DI ;; points to next device in PART_OT | ||
| 1637 | ;; | ||
| 1638 | jmp $$DO7 ;; | ||
| 1639 | ;$ENDLOOP ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 1640 | $$EN7: ;; no device found for LPTn | ||
| 1641 | ;; | ||
| 1642 | POP CX ;; | ||
| 1643 | POP DI ;; balance push-pop | ||
| 1644 | ;; | ||
| 1645 | CMP BUF.STATE,CPSW ;; | ||
| 1646 | JE END_LPT ;; for LPT1/PRN pair | ||
| 1647 | ;; | ||
| 1648 | MOV BUF.STATE,NORMAL ;; no device defined for the LPTn | ||
| 1649 | ;; | ||
| 1650 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 1651 | ;; End of defining LPTn Buffer | ||
| 1652 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 1653 | ;$ENDSRCH ;; | ||
| 1654 | END_LPT : ;; | ||
| 1655 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 1656 | ;; set the request header status | ||
| 1657 | ;; according to the STATE | ||
| 1658 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 1659 | MOV AX, RESIDENT_END ;; | ||
| 1660 | PUSH CS ;; | ||
| 1661 | POP CX ;; CX=CS | ||
| 1662 | SUB AX,Cx ;; additional segment required. | ||
| 1663 | CS_LOOP2: ;; | ||
| 1664 | CMP AX,1000H ;; | ||
| 1665 | JB CS_LPEND2 ;; | ||
| 1666 | ADD CX,1000H ;; | ||
| 1667 | SUB AX,1000H ;; | ||
| 1668 | JMP CS_LOOP2 ;; | ||
| 1669 | ;; | ||
| 1670 | CS_LPEND2: ;; | ||
| 1671 | SHL AX,1 ;; | ||
| 1672 | SHL AX,1 ;; | ||
| 1673 | SHL AX,1 ;; | ||
| 1674 | SHL AX,1 ;; | ||
| 1675 | ;; | ||
| 1676 | LES DI,dword ptr buf.rh_ptro ;; get Request Header address | ||
| 1677 | MOV RH.RH0_ENDO,AX ;; | ||
| 1678 | MOV RH.RH0_ENDS,CX ;; | ||
| 1679 | XOR AX,AX ;; clear error code to be returned | ||
| 1680 | MOV CX,BUF.STATE ;; | ||
| 1681 | CMP CX,CPSW ;; | ||
| 1682 | JE MATCH_GOOD ;; | ||
| 1683 | MOV AX,STAT_CMDERR ;; | ||
| 1684 | ;; | ||
| 1685 | MATCH_GOOD : ;; | ||
| 1686 | MOV RH.RHC_STA,AX ;; set status in request header | ||
| 1687 | ;; | ||
| 1688 | BUF_END : ;; | ||
| 1689 | ;; | ||
| 1690 | CMP BUF.BFLAG,BF_LPT1 ;; | ||
| 1691 | JNE BUF_MESSAGES ;; | ||
| 1692 | ;; | ||
| 1693 | CMP BUF.STATE,CPSW ;; | ||
| 1694 | JNE BUF_MESSAGES ;; | ||
| 1695 | ;; set PRN to the same setting as LPT1 | ||
| 1696 | PUSH BX ;; | ||
| 1697 | ;; | ||
| 1698 | LEA SI,BUF.RNORMO ;; | ||
| 1699 | LEA CX,BUF.BUFEND ;; | ||
| 1700 | SUB CX,SI ;; | ||
| 1701 | MOV BX,BUF.PRN_BUFO ;; where PRN buffer is | ||
| 1702 | LEA DI,BUF.RNORMO ;; | ||
| 1703 | PUSH CS ;; | ||
| 1704 | POP ES ;; | ||
| 1705 | PUSH CS ;; | ||
| 1706 | POP DS ;; | ||
| 1707 | REP MOVSB ;; | ||
| 1708 | ;; | ||
| 1709 | POP BX ;; | ||
| 1710 | ;; | ||
| 1711 | BUF_MESSAGES : ;; | ||
| 1712 | CMP BUF.BFLAG,BF_LPT3 ;; generate error message is this is | ||
| 1713 | je last_round ;; the last LPTn | ||
| 1714 | Jmp INIT_RETURN ;; | ||
| 1715 | ;; ERROR messages will be generated | ||
| 1716 | ;; at the end of initialization of all | ||
| 1717 | ;; the LPT devices | ||
| 1718 | last_round : ;; | ||
| 1719 | MOV AX,RESIDENT_END ;; | ||
| 1720 | ADD AX,STACK_SIZE ;; | ||
| 1721 | MOV RESIDENT_END,AX ;; | ||
| 1722 | PUSH CS ;; | ||
| 1723 | POP CX ;; CX=CS | ||
| 1724 | SUB AX,Cx ;; additional segment required. | ||
| 1725 | CS_LOOP3: ;; | ||
| 1726 | CMP AX,1000H ;; | ||
| 1727 | JB CS_LPEND3 ;; | ||
| 1728 | ADD CX,1000H ;; | ||
| 1729 | SUB AX,1000H ;; | ||
| 1730 | JMP CS_LOOP3 ;; | ||
| 1731 | ;; | ||
| 1732 | CS_LPENd3: ;; | ||
| 1733 | SHL AX,1 ;; | ||
| 1734 | SHL AX,1 ;; | ||
| 1735 | SHL AX,1 ;; | ||
| 1736 | SHL AX,1 ;; | ||
| 1737 | ;; | ||
| 1738 | MOV RH.RH0_ENDO,AX ;; STACK !!!!! | ||
| 1739 | MOV STACK_ALLOCATED,0 ;; from now on, internal stack is used | ||
| 1740 | ;; | ||
| 1741 | MOV AX,DID_STATUS ;; what is the DID combination ? | ||
| 1742 | AND AX,DID_MATCH ;; | ||
| 1743 | XOR AX,DID_FAIL ;; | ||
| 1744 | ;; | ||
| 1745 | AND AX,AX ;; | ||
| 1746 | JNZ CODE_STAYED ;; | ||
| 1747 | ; MOV RH.RH0_ENDO,0 ;; none of the devices are good | ||
| 1748 | ;; | ||
| 1749 | ;; | ||
| 1750 | CODE_STAYED : ;; | ||
| 1751 | MOV DI,OFFSET TABLE ;; | ||
| 1752 | push CS ;; | ||
| 1753 | POP ES ;; | ||
| 1754 | ;; | ||
| 1755 | XOR CX,CX ;; | ||
| 1756 | MSG_LOOP : ;; | ||
| 1757 | CMP CX,DEV_NUM ;; | ||
| 1758 | JNB INIT_RETURN ;; | ||
| 1759 | SHR AX,1 ;; | ||
| 1760 | JC MSG_NEXT ;; | ||
| 1761 | ;; this device in parse table is bad | ||
| 1762 | PUSH DI ;; | ||
| 1763 | PUSH CX ;; | ||
| 1764 | PUSH AX ;; | ||
| 1765 | ;; | ||
| 1766 | MOV DI,PSE.PAR_OFF ;; | ||
| 1767 | MOV SI,PSE.PAR_DNMO ;; | ||
| 1768 | ;; | ||
| 1769 | PUSH CS ;; | ||
| 1770 | POP ES ;; | ||
| 1771 | PUSH CS ;; | ||
| 1772 | POP DS ;; | ||
| 1773 | ;; | ||
| 1774 | MOV CX,8 ;; | ||
| 1775 | LEA SI,[SI].PAR_DNM ;; | ||
| 1776 | ;; | ||
| 1777 | MOV DI,SI ;; | ||
| 1778 | ADD DI,7 ;; skip backward the blanks | ||
| 1779 | MOV AL,20H ;; | ||
| 1780 | STD ;; | ||
| 1781 | REPE SCASB ;; | ||
| 1782 | CLD ;; | ||
| 1783 | ;; | ||
| 1784 | MOV DI, OFFSET MSG_NO_INIT_P;; | ||
| 1785 | MOV DX,DI ;; for INT 21H | ||
| 1786 | XOR AX,AX ;; | ||
| 1787 | MOV AH,09H ;; | ||
| 1788 | INT 21H ;; | ||
| 1789 | ;; | ||
| 1790 | ;; | ||
| 1791 | MOV DI, OFFSET MSG_NO_INIT ;; | ||
| 1792 | MOV DX,DI ;; for INT 21H | ||
| 1793 | ;; | ||
| 1794 | INC CX ;; | ||
| 1795 | ;; | ||
| 1796 | PUSH CX ;; remaining name that is non blank | ||
| 1797 | MOV AX,CX ;; | ||
| 1798 | MOV CX,8 ;; | ||
| 1799 | SUB CX,AX ;; | ||
| 1800 | ADD DI,CX ;; | ||
| 1801 | MOV DX,DI ;; | ||
| 1802 | POP CX ;; | ||
| 1803 | REP MOVSB ;; | ||
| 1804 | ;; | ||
| 1805 | ;; | ||
| 1806 | XOR AX,AX ;; | ||
| 1807 | MOV AH,09H ;; | ||
| 1808 | INT 21H ;; | ||
| 1809 | ;; | ||
| 1810 | POP AX ;; | ||
| 1811 | POP CX ;; | ||
| 1812 | POP DI ;; | ||
| 1813 | ;; | ||
| 1814 | MSG_NEXT : ;; | ||
| 1815 | INC CX ;; | ||
| 1816 | INC DI ;; | ||
| 1817 | INC DI ;; | ||
| 1818 | JMP MSG_LOOP ;; | ||
| 1819 | ;; | ||
| 1820 | ;; | ||
| 1821 | INIT_RETURN : ;; | ||
| 1822 | ;; | ||
| 1823 | ;; | ||
| 1824 | RET ;; | ||
| 1825 | ;; | ||
| 1826 | INIT ENDP ;; | ||
| 1827 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 1828 | ;; | ||
| 1829 | ;; Call by INIT to extract parameters for the deivce_id | ||
| 1830 | ;; | ||
| 1831 | ;; on rntry : | ||
| 1832 | ;; ES:[DI] PARSE Table 2, offsets of all parameters | ||
| 1833 | ;; DS:[SI] Printer Description table whose TYPEID matched | ||
| 1834 | ;; DX "inverse" order of devices in the PARSE tables | ||
| 1835 | ;; | ||
| 1836 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 1837 | ;; | ||
| 1838 | ;; | ||
| 1839 | DID_EXTRACT PROC ;; | ||
| 1840 | ;; | ||
| 1841 | PUSH DX ;; | ||
| 1842 | ;;----------------------------- | ||
| 1843 | ;; define the DID_parameters | ||
| 1844 | PUSH BX ;; | ||
| 1845 | ;; | ||
| 1846 | MOV BX,DEV_NUM ;; | ||
| 1847 | SUB BX,DX ;; order in the Parse table | ||
| 1848 | add bx,bx ;; double to index [bx] | ||
| 1849 | MOV DX,BX ;; | ||
| 1850 | ;; | ||
| 1851 | MOV AX,DS:[SI].FONTSZ ;; | ||
| 1852 | MOV FSIZE[BX],AX ;; size of font buffer to be created | ||
| 1853 | ;; | ||
| 1854 | MOV AX,DS:[SI].HSLOTS ;; | ||
| 1855 | CMP AX,HARDSL_MAX ;; | ||
| 1856 | JNA LESS_HARDSL ;; | ||
| 1857 | MOV INIT_CHK, 0010H ;; ERROR 0010H | ||
| 1858 | POP BX ;; | ||
| 1859 | JMP END_MATCH_BAD ;; | ||
| 1860 | LESS_HARDSL : ;; | ||
| 1861 | CMP AX,DS:[SI].HWCPMIN ;; | ||
| 1862 | JNB VALID_HARDSL ;; | ||
| 1863 | MOV INIT_CHK, 0012H ;; ERROR 0012H | ||
| 1864 | POP BX ;; | ||
| 1865 | JMP END_MATCH_BAD ;; | ||
| 1866 | VALID_HARDSL : ;; | ||
| 1867 | MOV HRMAX[BX],AX ;; | ||
| 1868 | MOV CTMAX[BX],AX ;; will be reduced by the no. of hwcp | ||
| 1869 | ;; | ||
| 1870 | MOV AX,DS:[SI].RSLOTS ;; | ||
| 1871 | CMP AX,RAMSL_MAX ;; | ||
| 1872 | JNA LESS_RAMSL ;; | ||
| 1873 | MOV INIT_CHK, 0011H ;; ERROR 0011H | ||
| 1874 | POP BX ;; | ||
| 1875 | JMP END_MATCH_BAD ;; | ||
| 1876 | LESS_RAMSL : ;; | ||
| 1877 | MOV RMMAX[BX],AX ;; see also designate | ||
| 1878 | ;; | ||
| 1879 | MOV DESCO[BX],SI ;; | ||
| 1880 | ;; | ||
| 1881 | POP BX ;; | ||
| 1882 | ;;---------------------------------- | ||
| 1883 | ;; | ||
| 1884 | PUSH CX ;; | ||
| 1885 | ;; | ||
| 1886 | HWCPgt: PUSH DI ;; get the hwcp | ||
| 1887 | ;; | ||
| 1888 | MOV DI,PSE.PAR_HWCPO ;; | ||
| 1889 | MOV CX,PSE.PAR_HWCPL ;; no. of hwcp | ||
| 1890 | AND CX,CX ;; | ||
| 1891 | JNZ chk_hwcp ;; | ||
| 1892 | push bx ;; | ||
| 1893 | mov bx,dx ;; | ||
| 1894 | MOV HRMAX[BX],CX ;; | ||
| 1895 | MOV CX,DS:[SI].HWCPMIN ;; | ||
| 1896 | SUB CTMAX[BX],CX ;; what is left becomes cartridge slot | ||
| 1897 | pop bx ;; | ||
| 1898 | JMP DESIGN ;; | ||
| 1899 | ;; hwcp to be defined | ||
| 1900 | chk_hwcp: MOV AX,DS:[SI].HSLOTS ;; defined in printer_desc | ||
| 1901 | CMP CX,AX ;; | ||
| 1902 | JA BAD_MATCH2 ;; | ||
| 1903 | CMP CX,HARDSL_MAX ;; | ||
| 1904 | JNA HWCP_GOOD ;; jump if system error | ||
| 1905 | MOV INIT_CHK,0003H ;; ERROR 0003 | ||
| 1906 | JMP END_MATCH ;; | ||
| 1907 | BAD_MATCH2: ;; | ||
| 1908 | MOV INIT_CHK,0002H ;; ERROR 0002 | ||
| 1909 | JMP END_MATCH ;; | ||
| 1910 | ;; | ||
| 1911 | HWCP_GOOD: ;; there are sufficient hard-slot for | ||
| 1912 | ;; HWCP | ||
| 1913 | PUSH SI ;; printer description table of TYPEID | ||
| 1914 | PUSH BX ;; | ||
| 1915 | ;; | ||
| 1916 | MOV BX,DX ;; | ||
| 1917 | MOV AX,CTMAX[BX] ;; | ||
| 1918 | ;; | ||
| 1919 | PUSH CX ;; calculate what is left for cart_slot | ||
| 1920 | CMP CX,DS:[SI].HWCPMIN ;; | ||
| 1921 | JNB MORE_THAN_HWCPMIN ;; | ||
| 1922 | MOV CX,DS:[SI].HWCPMIN ;; | ||
| 1923 | MORE_THAN_HWCPMIN : ;; | ||
| 1924 | SUB AX,CX ;; | ||
| 1925 | POP CX ;; | ||
| 1926 | mov HRMAX[BX],CX ;; | ||
| 1927 | ;; | ||
| 1928 | MOV CTMAX[BX],AX ;; no of cart-slot for designate | ||
| 1929 | MOV SI,HARD_SLA[BX] ;; get the corresponding hard-slots | ||
| 1930 | ;; | ||
| 1931 | POP BX ;; | ||
| 1932 | ;; | ||
| 1933 | push bx ;; | ||
| 1934 | push dx ;; | ||
| 1935 | mov bx,si ;; | ||
| 1936 | mov dx,cx ;; | ||
| 1937 | mov reserved1,dx ;; IF THERE IS ANY REPETITIVE HWCP | ||
| 1938 | mov reserved2,bx ;; IF THERE IS ANY REPETITIVE HWCP | ||
| 1939 | ;; | ||
| 1940 | FILL_HWCP: ;; | ||
| 1941 | AND CX,CX ;; | ||
| 1942 | JZ DESIGN_P ;; | ||
| 1943 | INC DI ;; next code page in PARSE table | ||
| 1944 | INC DI ;; | ||
| 1945 | MOV AX,ES:[DI] ;; get code page value | ||
| 1946 | ;; | ||
| 1947 | ;; IF THERE IS ANY REPETITIVE HWCP | ||
| 1948 | push dx ;; | ||
| 1949 | push bx ;; | ||
| 1950 | hwcp_norep : ;; | ||
| 1951 | cmp ax,cs:[bx].slt_cp ;; | ||
| 1952 | jne hwcp_repnext ;; | ||
| 1953 | pop bx ;; | ||
| 1954 | pop dx ;; | ||
| 1955 | pop dx ;; | ||
| 1956 | pop bx ;; | ||
| 1957 | pop si ;; | ||
| 1958 | jmp end_match ;; | ||
| 1959 | ;; | ||
| 1960 | hwcp_repnext: ;; | ||
| 1961 | inc bx ;; | ||
| 1962 | inc bx ;; | ||
| 1963 | inc bx ;; | ||
| 1964 | inc bx ;; | ||
| 1965 | dec dx ;; | ||
| 1966 | jnz hwcp_norep ;; | ||
| 1967 | pop bx ;; | ||
| 1968 | pop dx ;; | ||
| 1969 | ;; | ||
| 1970 | MOV CS:[SI].SLT_CP,AX ;; | ||
| 1971 | MOV AX,CS:[SI].SLT_AT ;; get the attributes | ||
| 1972 | OR AX,AT_OCC ;; occupied | ||
| 1973 | OR AX,AT_HWCP ;; hwcp slot | ||
| 1974 | MOV CS:[SI].SLT_AT,AX ;; | ||
| 1975 | INC SI ;; | ||
| 1976 | INC SI ;; next slot | ||
| 1977 | INC SI ;; next slot | ||
| 1978 | INC SI ;; next slot | ||
| 1979 | DEC CX ;; | ||
| 1980 | JMP FILL_HWCP ;; | ||
| 1981 | DESIGN_P: ;; | ||
| 1982 | pop dx ;; | ||
| 1983 | pop bx ;; | ||
| 1984 | POP SI ;; | ||
| 1985 | ;;--------------------- | ||
| 1986 | DESIGN: POP DI ;; get the designate no. | ||
| 1987 | PUSH DI ;; | ||
| 1988 | ;; | ||
| 1989 | MOV DI,PSE.PAR_DESGO ;; | ||
| 1990 | MOV AX,PSE.PAR_DESGL ;; | ||
| 1991 | CMP AX,1 ;; | ||
| 1992 | JA END_MATCH ;; there should have no font entry | ||
| 1993 | AND AX,AX ;; | ||
| 1994 | JZ DEF_RBUFMAX ;; | ||
| 1995 | ;; | ||
| 1996 | MOV AX,PSE.PAR_DESG ;; | ||
| 1997 | AND AX,AX ;; | ||
| 1998 | JZ DEF_RBUFMAX ;; | ||
| 1999 | ;; | ||
| 2000 | CMP CS:[SI].CLASS,1 ;; | ||
| 2001 | JNE DESIG_NOt_CLASS1 ;; | ||
| 2002 | ;; | ||
| 2003 | PUSH BX ;; if there is any cartridge slot ? | ||
| 2004 | PUSH AX ;; | ||
| 2005 | MOV BX,DX ;; | ||
| 2006 | MOV AX,ctmax[BX] ;; | ||
| 2007 | AND AX,AX ;; | ||
| 2008 | POP AX ;; | ||
| 2009 | POP BX ;; | ||
| 2010 | JZ END_MATCH ;; fail, as there is no physical RAM. | ||
| 2011 | ;; | ||
| 2012 | CMP AX,HARDSL_MAX ;; is the designate more than max ? | ||
| 2013 | JA END_MATCH ;; | ||
| 2014 | ;; | ||
| 2015 | ;; | ||
| 2016 | JMP DEF_RBUFMAX ;; | ||
| 2017 | ;; | ||
| 2018 | ;; | ||
| 2019 | ;; | ||
| 2020 | DESIG_NOT_CLASS1 : ;; | ||
| 2021 | PUSH BX ;; if there is any physical RAM slot ? | ||
| 2022 | PUSH AX ;; | ||
| 2023 | MOV BX,DX ;; | ||
| 2024 | MOV AX,RMMAX[BX] ;; | ||
| 2025 | AND AX,AX ;; | ||
| 2026 | POP AX ;; | ||
| 2027 | POP BX ;; | ||
| 2028 | JZ END_MATCH ;; fail, as there is no physical RAM. | ||
| 2029 | ;; | ||
| 2030 | ;; | ||
| 2031 | CMP AX,RAMSL_MAX ;; is the designate more than max ? | ||
| 2032 | JA END_MATCH ;; | ||
| 2033 | ;; | ||
| 2034 | DEF_RBUFMAX : ;; | ||
| 2035 | PUSH BX ;; | ||
| 2036 | MOV BX,DX ;; | ||
| 2037 | MOV RBUMAX[BX],AX ;; | ||
| 2038 | POP BX ;; | ||
| 2039 | ;; | ||
| 2040 | ;; | ||
| 2041 | PARAM : ;; | ||
| 2042 | ;PARM: POP DI ;; | ||
| 2043 | ; PUSH DI ;; | ||
| 2044 | ;; MOV DI,PSE.PAR_PARMO ;; | ||
| 2045 | ;; | ||
| 2046 | ;,-------------------------- | ||
| 2047 | ;; GOOD device_id parameters | ||
| 2048 | shr dx,1 ;; | ||
| 2049 | MOV AX,DID_ONE ;; | ||
| 2050 | MOV CX,DX ;; | ||
| 2051 | AND CX,CX ;; | ||
| 2052 | JZ NO_SHL ;; | ||
| 2053 | SHL AX,CL ;; | ||
| 2054 | NO_SHL: OR DID_STATUS,AX ;; is defined | ||
| 2055 | ;;------------------------- | ||
| 2056 | END_MATCH: POP DI ;; end of extract | ||
| 2057 | POP CX ;; | ||
| 2058 | END_MATCH_BAD : ;; | ||
| 2059 | POP DX ;; | ||
| 2060 | ;; | ||
| 2061 | RET ;; | ||
| 2062 | ;; | ||
| 2063 | DID_EXTRACT ENDP ;; | ||
| 2064 | ;; | ||
| 2065 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 2066 | ;; | ||
| 2067 | ;; Called by INIT to define the STATE and BUF for the LPTn according to | ||
| 2068 | ;; the DID_STATUS. Create font buffer if requested through the "desi*nate" | ||
| 2069 | ;; | ||
| 2070 | ;; at entry : CX = device order in parse table | ||
| 2071 | ;; | ||
| 2072 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 2073 | CHK_DID PROC ;; | ||
| 2074 | ;; | ||
| 2075 | push cx ;; | ||
| 2076 | push di ;; | ||
| 2077 | push dx ;; | ||
| 2078 | ;; | ||
| 2079 | MOV AX,DID_STATUS ;; | ||
| 2080 | ;; | ||
| 2081 | PUSH CX ;; order 0 to m | ||
| 2082 | POP DI ;; | ||
| 2083 | ADD DI,DI ;; indexing : [DI] | ||
| 2084 | ;; | ||
| 2085 | INC CX ;; | ||
| 2086 | SHR AX,CL ;; is the device parameter valid ? | ||
| 2087 | ;; | ||
| 2088 | JC DEFINE_BUFFER ;; | ||
| 2089 | JMP LPT_FAIL ;;-------------------------- | ||
| 2090 | ;; | ||
| 2091 | DEFINE_BUFFER : ;; | ||
| 2092 | ;; good device parameters as determined | ||
| 2093 | MOV AX,DESCO[DI] ;; | ||
| 2094 | MOV BUF.PDESCO,AX ;; | ||
| 2095 | ;; | ||
| 2096 | PUSH DI ;; | ||
| 2097 | MOV DI,AX ;; | ||
| 2098 | MOV AX,CS:[DI].CLASS ;; | ||
| 2099 | MOV BUF.PCLASS,AX ;; | ||
| 2100 | POP DI ;; | ||
| 2101 | ;; | ||
| 2102 | MOV AX,HARD_SLA[DI] ;; in the DID_EXTRACT | ||
| 2103 | MOV BUF.HARDSO,AX ;; | ||
| 2104 | ;; | ||
| 2105 | MOV AX,RAM_SLA[DI] ;; | ||
| 2106 | MOV BUF.RAMSO,AX ;; | ||
| 2107 | ;; | ||
| 2108 | MOV AX,HRMAX[DI] ;; | ||
| 2109 | MOV BUF.HARDMX,AX ;; | ||
| 2110 | ;; | ||
| 2111 | MOV AX,CTMAX[DI] ;; | ||
| 2112 | MOV BUF.HCARMX,AX ;; | ||
| 2113 | ;; | ||
| 2114 | ADD AX,HRMAX[DI] ;; defore "designate" | ||
| 2115 | MOV BUF.HSLMX,AX ;; | ||
| 2116 | ;; | ||
| 2117 | ;; | ||
| 2118 | MOV AX,RMMAX[DI] ;; | ||
| 2119 | MOV BUF.RAMMX,AX ;; | ||
| 2120 | ;; | ||
| 2121 | XOR AX,AX ;; | ||
| 2122 | PUSH CX ;; calculate the max. length of control | ||
| 2123 | MOV CX,2 ;; sequence that is allowed for the | ||
| 2124 | CMP BUF.PCLASS,1 ;; room reserved for physical slots. | ||
| 2125 | JNE CTL_LOOP ;; | ||
| 2126 | MOV CX,1 ;; class 1 printer has one control seq. | ||
| 2127 | CTL_LOOP : ;; | ||
| 2128 | ADD AX,CTL_MAX ;; | ||
| 2129 | DEC AX ;; leave one byte for the length | ||
| 2130 | DEC CX ;; | ||
| 2131 | JNZ CTL_LOOP ;; | ||
| 2132 | MOV BUF.FSELMAX,AX ;; | ||
| 2133 | POP CX ;; | ||
| 2134 | ;; | ||
| 2135 | MOV AX,FSIZE[DI] ;; | ||
| 2136 | MOV BUF.FTSZPA,AX ;; FTSIZE in paragraph | ||
| 2137 | ;; | ||
| 2138 | PUSH AX ;; | ||
| 2139 | ;; | ||
| 2140 | MOV DX,4 ;; | ||
| 2141 | FT_PARA: ;; | ||
| 2142 | ADD AX,AX ;; | ||
| 2143 | DEC DX ;; | ||
| 2144 | JNZ FT_PARA ;; font size | ||
| 2145 | MOV BUF.FTSIZE,AX ;; font size in bytes (used with.RBUFMX) | ||
| 2146 | ;; | ||
| 2147 | POP DX ;; FTSIZE in paragraph | ||
| 2148 | ;; | ||
| 2149 | MOV CX,RBUMAX[DI] ;; create font buffer per .RBUFMX and | ||
| 2150 | MOV BUF.RBUFMX,CX ;; assume sufficient memory for all the | ||
| 2151 | ;; "designate request" | ||
| 2152 | PUSH CX ;; | ||
| 2153 | ;; | ||
| 2154 | CMP BUF.PCLASS,1 ;; always create font buffer for class1 | ||
| 2155 | JNE CLASS_NOT_1 ;; | ||
| 2156 | ;; | ||
| 2157 | AND CX,CX ;; | ||
| 2158 | JZ CLASS1_NOCX ;; | ||
| 2159 | ADD CX,BUF.HARDMX ;; | ||
| 2160 | MOV BUF.HSLMX,CX ;; | ||
| 2161 | JMP CLASS_NOT_1 ;; | ||
| 2162 | ;; | ||
| 2163 | CLASS1_NOCX: ;; | ||
| 2164 | MOV CX,BUF.HSLMX ;; | ||
| 2165 | ;; | ||
| 2166 | CLASS_NOT_1 : ;; | ||
| 2167 | AND CX,CX ;; | ||
| 2168 | JZ MULTIPLE_DONE ;; | ||
| 2169 | MOV AX,RESIDENT_END ;; | ||
| 2170 | MULTIPLE_FT : ;; | ||
| 2171 | ADD AX,DX ;; allocate the font buffers at the end | ||
| 2172 | DEC CX ;; of the resident codes | ||
| 2173 | JNZ MULTIPLE_FT ;; | ||
| 2174 | ;; | ||
| 2175 | ;; | ||
| 2176 | MOV CX,RESIDENT_END ;; | ||
| 2177 | MOV BUF.FTSTART,CX ;; | ||
| 2178 | MOV RESIDENT_END,AX ;; | ||
| 2179 | ;; | ||
| 2180 | ;; | ||
| 2181 | MULTIPLE_DONE : ;; | ||
| 2182 | POP CX ;; designate requested | ||
| 2183 | ;; | ||
| 2184 | CMP BUF.PCLASS,1 ;; | ||
| 2185 | JNE DEF_RBUF ;; | ||
| 2186 | ;; CLASS 1 | ||
| 2187 | CMP BUF.HARDMX,0 ;; | ||
| 2188 | JE DEFBUF_DONE ;; | ||
| 2189 | ;; | ||
| 2190 | PUSH CX ;; STACKS... | ||
| 2191 | PUSH SI ;; | ||
| 2192 | PUSH DS ;; | ||
| 2193 | PUSH ES ;; | ||
| 2194 | PUSH DI ;; | ||
| 2195 | PUSH DX ;; | ||
| 2196 | ;; | ||
| 2197 | MOV DX,BUF.HARDMX ;; | ||
| 2198 | PUSH DX ;; STACK +1 -- # of HWCP | ||
| 2199 | ;; | ||
| 2200 | PUSH CS ;; | ||
| 2201 | POP DS ;; | ||
| 2202 | MOV BUF.RBUFMX,0 ;; | ||
| 2203 | MOV SI,BUF.PDESCO ;; | ||
| 2204 | MOV SI,CS:[SI].SELH_O ;; | ||
| 2205 | XOR CX,CX ;; | ||
| 2206 | MOV CL,CS:BYTE PTR [SI] ;; | ||
| 2207 | INC CX ;; including the length byte | ||
| 2208 | ;; | ||
| 2209 | MOV DI,BUF.FTSTART ;; control template | ||
| 2210 | DEF_FTBUF: ;; fill the font buffer with the | ||
| 2211 | PUSH DI ;; | ||
| 2212 | POP ES ;; | ||
| 2213 | XOR DI,DI ;; | ||
| 2214 | ;; | ||
| 2215 | PUSH CX ;; | ||
| 2216 | PUSH SI ;; | ||
| 2217 | REP MOVSB ;; | ||
| 2218 | POP SI ;; | ||
| 2219 | POP CX ;; | ||
| 2220 | ;; | ||
| 2221 | PUSH ES ;; | ||
| 2222 | POP DI ;; | ||
| 2223 | ADD DI,BUF.FTszpa ;; | ||
| 2224 | DEC DX ;; | ||
| 2225 | JNZ DEF_FTBUF ;; | ||
| 2226 | ;; | ||
| 2227 | POP DX ;; STACK -1 | ||
| 2228 | ;; | ||
| 2229 | MOV SI,BUF.HARDSO ;; | ||
| 2230 | MOV DI,BUF.FTSTART ;; define the HWCP values | ||
| 2231 | DEF_FThwcp : ;; | ||
| 2232 | PUSH DI ;; | ||
| 2233 | POP ES ;; | ||
| 2234 | MOV DI,CTL5202_OFFS ;; offset to the HWCP words | ||
| 2235 | ;; | ||
| 2236 | MOV AX,CS:[SI].SLT_CP ;; | ||
| 2237 | MOV ES:WORD PTR [DI],AX ;; | ||
| 2238 | ;; | ||
| 2239 | INC SI ;; | ||
| 2240 | INC SI ;; | ||
| 2241 | INC SI ;; | ||
| 2242 | INC SI ;; | ||
| 2243 | ;; | ||
| 2244 | PUSH ES ;; | ||
| 2245 | POP DI ;; | ||
| 2246 | ADD DI,BUF.FTSZPA ;; | ||
| 2247 | DEC DX ;; | ||
| 2248 | JNZ DEF_FThwcp ;; | ||
| 2249 | ;; | ||
| 2250 | POP DX ;; | ||
| 2251 | POP DI ;; | ||
| 2252 | POP ES ;; | ||
| 2253 | POP DS ;; | ||
| 2254 | POP SI ;; | ||
| 2255 | POP CX ;; | ||
| 2256 | ;; | ||
| 2257 | JMP DEFBUF_DONE ;; | ||
| 2258 | ;; | ||
| 2259 | ;; | ||
| 2260 | DEF_RBUF : ;; | ||
| 2261 | MOV BUF.RSLMX,CX ;; the no. of ram slots supported | ||
| 2262 | CMP CX,RMMAX[DI] ;; | ||
| 2263 | JNB DEFBUF_DONE ;; | ||
| 2264 | MOV AX,RMMAX[DI] ;; | ||
| 2265 | MOV BUF.RSLMX,AX ;; the max. of .RAMMX and .RBUFMX | ||
| 2266 | ;; | ||
| 2267 | DEFBUF_DONE : ;; | ||
| 2268 | MOV BUF.STATE,CPSW ;; the LPTn is CPSW ----- STATE | ||
| 2269 | ;; | ||
| 2270 | CMP BUF.BFLAG,BF_PRN ;; | ||
| 2271 | JNE RET_CHK_DID ;; | ||
| 2272 | MOV AX,DID_BIT[DI] ;; | ||
| 2273 | MOV BUF.DID_PRN,AX ;; | ||
| 2274 | ;; | ||
| 2275 | ;; | ||
| 2276 | JMP RET_CHK_DID ;; | ||
| 2277 | ;; | ||
| 2278 | LPT_FAIL: ;; | ||
| 2279 | ;; | ||
| 2280 | MOV BUF.STATE,NORMAL ;; the LPTn is NORMAL --- STATE | ||
| 2281 | ;; | ||
| 2282 | ;; | ||
| 2283 | RET_CHK_DID: ;; | ||
| 2284 | ;; | ||
| 2285 | pop dx ;; | ||
| 2286 | pop di ;; | ||
| 2287 | pop cx ;; | ||
| 2288 | ;; | ||
| 2289 | RET ;; | ||
| 2290 | ;; | ||
| 2291 | CHK_DID ENDP ;; | ||
| 2292 | ;; | ||
| 2293 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 2294 | ;; | ||
| 2295 | ;; Called by INIT to check for consistency between duplicated device name and | ||
| 2296 | ;; between PRN and LPT1 | ||
| 2297 | ;; | ||
| 2298 | ;; at entry : DI = pointer to PAR_DEVOT | ||
| 2299 | ;; BUF.STATE = any state | ||
| 2300 | ;; CX = DID order | ||
| 2301 | ;; | ||
| 2302 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 2303 | ;; | ||
| 2304 | DEV_CHECK PROC ;; | ||
| 2305 | ;; | ||
| 2306 | LEA SI,BUF.PAR_EXTRACTO ;; | ||
| 2307 | ;; | ||
| 2308 | PUSH CX ;; | ||
| 2309 | ;; | ||
| 2310 | PUSH SI ;; compare device id | ||
| 2311 | PUSH DI ;; | ||
| 2312 | mov SI,[SI].PAR_DIDO ;; | ||
| 2313 | MOV DI,PSE.PAR_DIDO ;; | ||
| 2314 | MOV CX,PSE.PAR_DNML ;; | ||
| 2315 | INC CX ;; including length | ||
| 2316 | INC CX ;; | ||
| 2317 | REPE CMPSB ;; | ||
| 2318 | POP DI ;; | ||
| 2319 | POP SI ;; | ||
| 2320 | Jz hwcp_check ;; | ||
| 2321 | mov init_chk,0021h ;; error 0021h | ||
| 2322 | Jmp FORCE_LPT_BAD ;; | ||
| 2323 | ;; | ||
| 2324 | hwcp_check : ;; | ||
| 2325 | PUSH SI ;; compare HWCP | ||
| 2326 | PUSH DI ;; | ||
| 2327 | mov SI,[SI].PAR_HWCPO ;; | ||
| 2328 | MOV DI,PSE.PAR_HWCPO ;; | ||
| 2329 | MOV AX,PSE.PAR_HWCPL ;; | ||
| 2330 | MOV CX,2 ;; | ||
| 2331 | SHL AX,CL ;; multiply by two | ||
| 2332 | INC AX ;; including length | ||
| 2333 | INC AX ;; | ||
| 2334 | MOV CX,AX ;; | ||
| 2335 | REPE CMPSB ;; | ||
| 2336 | POP DI ;; | ||
| 2337 | POP SI ;; | ||
| 2338 | Jz desig_check ;; | ||
| 2339 | mov init_chk,0022h ;; error 0022h | ||
| 2340 | Jmp FORCE_LPT_BAD ;; | ||
| 2341 | ;; | ||
| 2342 | desig_check : ;; | ||
| 2343 | PUSH SI ;; compare DESIGNATE | ||
| 2344 | PUSH DI ;; | ||
| 2345 | mov SI,[SI].PAR_DESGO ;; | ||
| 2346 | MOV DI,PSE.PAR_DESGO ;; | ||
| 2347 | MOV AX,PSE.PAR_DESGL ;; | ||
| 2348 | MOV CX,2 ;; | ||
| 2349 | SHL AX,CL ;; multiply by two | ||
| 2350 | INC AX ;; including length | ||
| 2351 | INC AX ;; | ||
| 2352 | MOV CX,AX ;; | ||
| 2353 | REPE CMPSB ;; | ||
| 2354 | POP DI ;; | ||
| 2355 | POP SI ;; | ||
| 2356 | Jz param_check ;; | ||
| 2357 | mov init_chk,0023h ;; error 0023h | ||
| 2358 | Jmp FORCE_LPT_BAD ;; | ||
| 2359 | ;; | ||
| 2360 | param_check : ;; | ||
| 2361 | PUSH SI ;; compare parameters | ||
| 2362 | PUSH DI ;; | ||
| 2363 | mov SI,[SI].PAR_PARMO ;; | ||
| 2364 | MOV DI,PSE.PAR_PARMO ;; | ||
| 2365 | MOV CX,PSE.PAR_PARML ;; | ||
| 2366 | INC CX ;; including length | ||
| 2367 | INC CX ;; | ||
| 2368 | REPE CMPSB ;; | ||
| 2369 | POP DI ;; | ||
| 2370 | POP SI ;; | ||
| 2371 | JZ M_END ;; | ||
| 2372 | mov init_chk,0024h ;; error 0024h | ||
| 2373 | ;; | ||
| 2374 | FORCE_LPT_BAD : ;; the second set of parameters is | ||
| 2375 | MOV BUF.STATE,NORMAL ;; bad | ||
| 2376 | ;; | ||
| 2377 | CMP BUF.BFLAG,BF_LPT1 ;; | ||
| 2378 | JNE M_END ;; | ||
| 2379 | ;; | ||
| 2380 | ;; since LPT1 is bad, force PRN to bad | ||
| 2381 | push bx ;; force prn to be bad too | ||
| 2382 | mov bx,buf.prn_bufo ;; | ||
| 2383 | MOV BUF.STATE,NORMAL ;; | ||
| 2384 | pop bx ;; | ||
| 2385 | ;; | ||
| 2386 | mov AX,BUF.DID_PRN ;; if PRN was not good, DID_PRN = 0 | ||
| 2387 | OR DID_FAIL,AX ;; | ||
| 2388 | ;; | ||
| 2389 | ;; | ||
| 2390 | M_END: ;; force the good did_status to fail if | ||
| 2391 | ;; STATE is bad | ||
| 2392 | POP CX ;; | ||
| 2393 | PUSH CX ;; order 0 to m | ||
| 2394 | MOV AX,DID_STATUS ;; | ||
| 2395 | ;; | ||
| 2396 | INC CX ;; | ||
| 2397 | SHR AX,CL ;; | ||
| 2398 | POP CX ;; | ||
| 2399 | JNC DEV_CHECK_RET ;; already failed | ||
| 2400 | ;; | ||
| 2401 | CMP BUF.STATE,CPSW ;; | ||
| 2402 | JE DEV_CHECK_RET ;; | ||
| 2403 | ;; | ||
| 2404 | PUSH BX ;; | ||
| 2405 | MOV BX,CX ;; | ||
| 2406 | ADD BX,BX ;; | ||
| 2407 | MOV AX,DID_BIT[BX] ;; | ||
| 2408 | OR DID_FAIL,AX ;; force DID to fail | ||
| 2409 | POP BX ;; | ||
| 2410 | ;; | ||
| 2411 | ;; | ||
| 2412 | DEV_CHECK_RET : ;; | ||
| 2413 | ;; | ||
| 2414 | RET ;; | ||
| 2415 | ;; | ||
| 2416 | ;; | ||
| 2417 | DEV_CHECK ENDP ;; | ||
| 2418 | ;; | ||
| 2419 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | ||
| 2420 | ;; | ||
| 2421 | CSEG ENDS | ||
| 2422 | END | ||