4 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6 ;; FILENAME: CPS Printer Device Driver EQUAL Include
10 ;; LINK PROCEDURE: See CPSPx.ASM
14 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
16 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
18 ;; Request Header (Common portion)
20 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
22 RH EQU ES:[DI] ;; addressability to Request Header
24 RHC STRUC ;; fields common to all request types
25 RHC_LEN DB ? ;; length of Request Header
26 DB ? ;; unit code (subunit)
27 RHC_CMD DB ? ;; command code
28 RHC_STA DW ? ;; status
29 DQ ? ;; reserved for DOS
30 RHC ENDS ;; end of common portion
32 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
34 ;; Command in the Request Header
35 ;; (see CMD_CODES table)
37 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
39 CMD_INI EQU 0 ;; init command
40 CMD_WRT EQU 8 ;; write command
41 CMD_GIO EQU 19 ;; generic IOCTL command
42 ;; (see major/minor GIO functions)
44 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
46 ;; status values for RHC_STA
48 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
50 STAT_DONE EQU 01H ;; function complete - high order byte
51 STAT_CMDERR EQU 8003H ;; invalid command code error
52 STAT_ERROR EQU 8000H ;; error returned by normal driver
54 ;; see Generic IOCTL Request Header section
55 ;; for more errorneous status. ;;
57 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
59 ;; Request Header for INIT
61 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
65 DB (TYPE RHC) DUP (?) ;; common portion
67 DB ? ;; not used for CHAR devices
68 RH0_ENDO DW ? ;; offset of ending address
69 RH0_ENDS DW ? ;; segment of ending address
70 RH0_BPBA DD ? ;; pointer to BPBA
72 RH0_CONFIG_ERRMSG dw 0 ;DCR D493 "Error in CONFIG.SYS..." msg flag.
75 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
77 ;; Request Header for IOCTL
79 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
82 DB (TYPE RHC) DUP (?) ;; common portion
85 DB ? ;; media descriptor
86 RH3_DTAO DW ? ;; offset of transfer address
87 RH3_DTAS DW ? ;; segment of transfer address
88 RH3_CNT DW ? ;; byte count
92 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
94 ;; Request Header for GENERIC IOCTL
96 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
99 DB (TYPE RHC) DUP (?) ;; common portion
102 GIH_MAF DB ? ;; major function
103 GIH_MIF DB ? ;; minor function
104 GIH_SI DW ? ;; content of SI
105 GIH_DI DW ? ;; content of DI
106 GIH_GBA DD ? ;; Address of Generic Buffer
109 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
111 ;; GIO major/minor functions
112 ;; (see GIO_CODES table)
114 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
115 MAF_CON EQU 03 ;; major function for CON device
116 MAF_PTR EQU 05 ;; major function for LPTX device
118 MIF_DST EQU 4CH ;; minor function : designate start
119 MIF_DEN EQU 4DH ;; designate end
120 MIF_IVK EQU 4AH ;; invoke
121 MIF_QIV EQU 6AH ;; query-invoked
122 MIF_QLS EQU 6BH ;; query-list
124 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
125 ;; Designate Start (MIF_DST)Flags
126 ;; see GBIS structure
127 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
129 DSF_FIFOCP EQU 08000H ;; Single code page FIFO command
130 DSF_CARTCP EQU 00001H ;; Code page for Cartridge/semi-
133 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
134 ;; Generic IOCTL errorneous status
136 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
138 STAT_DELETE EQU 08000H ;; previous degignate deleted (DST)
139 ;; STAT_DELETE : only for FIFO
140 STAT_NOFIND EQU 08008H ;; codepage,device not found (DST)
141 STAT_DEVERR EQU 0800AH ;; Device error (DST,IVK,QIV,QLS,WRT)
142 STAT_BADATA EQU 0800CH ;; bad font file (DST)
143 STAT_NOBUFF EQU 0800CH ;; no font buffer for (REFRESH)
144 STAT_BADDEN EQU 0800CH ;; no DST (DEN)
145 STAT_bffDEN EQU 08000H ;; bad font file (DEN)
146 STAT_TOMANY EQU 0800aH ;; too manay codepages (DST)
147 STAT_DUPLCP EQU 0800aH ;; too manay codepages (DST)
148 STAT_NOCPIV EQU 08007H ;; no codepage designated/invoked
149 STAT_NOCP EQU 08007H ;; no codepage designated/invoked
152 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
154 ;; Generic IOCTL Buffer DS:[SI]
156 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
160 GB1_FLAG DW ? ;; flag
161 GB1_LEN DW ? ;; length
162 GB1_NUM DW ? ;; length
168 GB2_LEN DW ? ;; length
174 GB3_LEN DW ? ;; length
175 GB3_GBL DW ? ;; hardware code page number
178 GB3_MINILEN EQU 4 ;; minimium length of GB3
181 GBL_LEN DW ? ;; length
182 GBL_CP DW ? ;; hardware code page number
185 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
187 ;; DEVICE Header DS:[SI] -- to locate the next LPTn header
188 ;; NEXT device header ES:[DI]
190 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
197 DH_NEXTO DW ? ;; offset of pointer to next header
198 DH_NEXTS DW ? ;; segment of pointer to next header
200 DH_STRAO DW ? ;; offset to strategy routine
201 DH_INTRO DW ? ;; offset to interrupt routine
202 DH_NAME DB NAME_LEN DUP(0) ;; device name in this header
203 DHS ENDS ;; end of common portion
205 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
209 ;; -- Interface table : FTABLE
211 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
216 ;; ( I=Input O=Output )
218 FTB_LENGTH DW TYPE FTBLK ;; (NOT TO BE CHANGED)
219 FTB_STATUS DW 0FFFFH ;; (O) parsing compelte
221 FTB_TID DB 8 DUP(?) ;; (I)
222 FTB_CP DW 0FFFFH ;; (I)
224 FTB_FONTS DW 0 ;; (O)
225 FTB_ROWS DB 0 ;; (O) DISPLAY TYPE DEVICE
226 FTB_COLS DB 0 ;; (O) DISPLAY TYPE DEVICE
227 FTB_X DB 0 ;; (O) DISPLAY TYPE DEVICE
228 FTB_Y DB 0 ;; (O) DISPLAY TYPE DEVICE
229 FTB_COUNT DW 0 ;; (O) DISPLAY TYPE DEVICE
230 FTB_SELECT DW 0 ;; (O) PRINTER TYPE DEVICE
231 FTB_SELLEN DW 0 ;; (O) PRINTER TYPE DEVICE
232 FTB_DLEFT DW 0 ;; (O) =0, none to come
233 FTB_DLEN DW 0 ;; (O) =0, not in this packet
234 FTB_DALO DW 0 ;; (O) in the DOS "packet" buffer
235 FTB_DAHI DW 0 ;; (O) " " " " "
236 TARGET_LO DW 0 ;; internal registers
237 TARGET_HI DW 0 ;; internal registers
240 TYPE_DISPLAY EQU 01H ;; display type device
241 TYPE_PRINTER EQU 02H ;; printer type device
247 NUM_FTBLK DW 0 ;; no. of FTBKL entries
250 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
252 FLAG_RESTART EQU 000001H ;; bit 1 = restart the parsing
255 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
256 ;; STATUS : (in FTB_STATUS)
258 FSTAT_COMPLETE EQU 0FFFFH ;; parsing compeleted. (good status)
259 FSTAT_FONT EQU 0FFFEH ;; font data is defined and returned
260 FSTAT_FOUND EQU 0FFFDH ;; informations including font-length
261 FSTAT_MATCH EQU 0FFFCH ;; font header matches FTBLK
262 FSTAT_SEARCH EQU 0FFFBH ;; seraching for header & font
263 FSTAT_BOTTOM EQU 0FFF0H ;; below this are the DOS_STATUS.
265 ;; the FSTAT with value lower than 0FFF0H is to be returned to the DOS
267 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
269 ; DEVICE Command Parser Table ES:[DI]
271 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
282 PAR_DEVOT STRUC ;; OFFSET to the parameters of a device
283 PAR_onum DW ? ;; number of offsets in the table
284 PAR_DNMO DW ? ;; device-name table offset
285 PAR_DIDO DW ? ;; device-id table offset
286 PAR_HWCPO DW ? ;; hwcp table offset
287 PAR_DESGO DW ? ;; designate table offset
288 PAR_PARMO DW ? ;; parameter table offset
291 PAR_DNMT STRUC ;; DEVICE NAME table
292 PAR_DNML DW ? ;; length of device name
293 PAR_DNM DB ? ;; device name
296 PAR_DIDT STRUC ;; DEVICE ID table
297 PAR_DIDL DW ? ;; device ID length
298 PAR_DID DB ? ;; device ID
301 PAR_HWCPT STRUC ;; hwcp table
302 PAR_HWCPL DW ? ;; hwcp entry number
303 PAR_HWCP DW ? ;; hwcp
307 PAR_DESGT STRUC ;; DESIGNATE table
308 PAR_DESGL DW ? ;; entry number
309 PAR_DESG DW ? ;; designate
310 PAR_FONT DW ? ;; fonts
314 PAR_PARMT STRUC ;; parameter table
315 PAR_PARML DW ? ;; length
320 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
322 ; LPTn printer data structure CS:[BX]
324 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
327 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
330 NORMAL EQU 0 ;; normal state
332 DESG_WR EQU 2 ;; designate write
333 DESG_END EQU 3 ;; designate end
334 LOCKED EQU 4 ;; WGR locked
336 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
337 GOOD EQU 0 ;; STATUS :
338 REPLX EQU 8000H ;; codepage replaced in DST
339 FAIL EQU 4000H ;; fail in designate
340 LOADED EQU 2000H ;; the font has just been loaded to
341 REFRESH EQU 0800H ;; there was a refresh via DST
346 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
349 BF_PRN EQU 0 ;; 0 = PRN initialized (interrupt)
350 BF_LPT1 EQU 1 ;; 1 = LPT1 initialized (interrupt)
351 BF_LPT2 EQU 2 ;; 2 = LPT2 initialized (interrupt)
352 BF_LPT3 EQU 3 ;; 3 = LPT3 initialized (interrupt)
353 BF_MEM_DONE EQU 08000H ;; memory done for this device
355 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
356 ;; BUFFER DATA structure
357 BUF_DATA STRUC ;;.................................
358 BFLAG DW -1 ;; buf flag for initialisation
359 ;; -1 = buf not yet initialised
360 ;; (see BF_PRN, BF_LPT's)
362 DEV_HDRO DW -1 ;; device driver n header offset
364 LPT_STRAO DW -1 ;; dos lptn strategy offset
366 LPT_INTRO DW -1 ;; dos lptn strategy offset
368 RH_PTRO DW -1 ;; request header offset
369 RH_PTRS DW -1 ;; segment ....................(unique)
371 ;; (following is replicated for LPT1 )
373 RNORMO DW -1 ;; request-normal driver header offset
374 prn_bufo dw -1 ;; offset to prn buffer
375 did_prn dw 0 ;; where PRN is in the DID order
379 ;; (the followings should be used
380 ;; IFF BUT.STATE <> NORMAL : )
382 PDESCO DW -1 ;; offset to printer description table.
384 ;;===== hwcp and designated slots ====
385 HSLMX DW 0 ;; HSLMX is the size of HARDslot (at
386 ;; HARDSO) and the buffer(at HRBUFO)
388 HARDMX DW 0 ;; no. of HWCP+cart slots supported
389 ;; (less than or equal to .HSLOTS)
390 HARDSO DW -1 ;; offset to hardware slots n
392 HCARMX DW 0 ;; no. of cart slots supported
393 HRBUFO DW -1 ;; offset to cart slots' buffer
395 ;;===== physical and designated RAM ===
397 RSLMX DW 0 ;; RSLMX is the size of RAMslot (at
398 ;; RAMSO) and the RAM buffer(at RMBUFO)
401 RAMMX DW 0 ;; no. of physical RAM slots(max.=1)
402 RAMSO DW -1 ;; offset to RAM slots(incl. designated
404 RBUFMX DW 0 ;; no. of designated RAM slots supported
405 RMBUFO DW -1 ;; offset to RAM slots's buffer
407 FTSZPA DW -1 ;; font buffer in paragraph = FONTSZ
408 FTSIZE DW 0 ;; font buffer size = FTSZPA x 16
409 FTSTART DW -1 ;; start of font buffer
410 FTSLOTO DW -1 ;; segment address of font buffer
411 ;; -- of the one to be designated to
412 FTDLO DW -1 ;; offset to where the FTSTART:OFFSET
413 ;; (next destination = total length
415 FSELEN DW 0 ;; length of selection control copied
416 ;; to the selection buffer
417 ;; (USED BY SELECT TYPE = 1 ONLY)
418 ;; -- initialized to 0, if selection
419 ;; is not 0, copied the selection
420 ;; from the font file until the
421 ;; length is reached. After copying
422 ;; to selection buffer, reset to 0
423 FSELMAX DW 0 ;; max. room reserved for selection
426 PAR_EXTRACTO DB (TYPE PAR_DEVOT) DUP (-1);; Offset to parameter extracts
427 SAVED_CP DW -1 ;; WGR saved code page during lock ;AN000;
428 BUFEND DW 0 ;; END OF BUFFER, for LPT1 copy.
431 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
433 ; Printer Description Table
435 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
437 DEVN_LEN EQU 8 ;; device name (type-id) length
440 PD_LEN DW 30 ;; length of each entry
441 TYPEID DB ' ' ;; device name (id), length DEVN_LEN
442 VMINOR DB 0 ;; version : .00
443 VMAJOR DB 1 ;; version : 1.
444 CLASS DW ? ;; reserved
445 FONTSZ DW ? ;; font buffer size in paragraph (max)
446 HSLOTS DW ? ;; hard-slots number (max # of Hslots)
447 HWCPMIN DW ? ;; what left by min_hwcp can be cart.
448 RSLOTS DW ? ;; ram-slots number (max # of Rslots)
449 PDSH ENDS ;; the SELH_O, and SELR_O are defined
450 ;; in the next two entries in PDS
454 DB (TYPE PDSH) DUP (?) ;; common portion
455 SELH_O DW ? ;; offset to select controls on Hslots
456 SELR_O DW ? ;; offset to select controls on Rslots
457 SELB_O DW ? ;; offset to buffered select controls
461 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
463 ; HARD / RAM slots table structure/constants
465 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
466 ;; NOTE : must be only FOUR bytes for
467 ;; codepage positioning
468 ;; calculation as compared
469 ;; with each entry in FTDL_OFF
471 SLTS STRUC ;; slots-table structure
472 SLT_CP DW -1 ;; code page : no code page
473 SLT_AT DW 0 ;; attribute : empty
477 AT_RAM1 EQU 00001H ;; in the 1st physical RAM slot
478 AT_RAM2 EQU 00002H ;; in the 2nd physical RAM slot
479 AT_RAM3 EQU 00004H ;; in the 3rd physical RAM slot
480 AT_RAM4 EQU 00008H ;; in the 4th physical RAM slot
481 AT_RAMS EQU 0000FH ;;(note the current logic supports
482 ;; only ONE physical RAM slot)
484 AT_OCC EQU 01000H ;; slot occupied
485 AT_ACT EQU 02000H ;; slot active
486 AT_HWCP EQU 04000H ;; slot is hwcp
487 AT_OLD EQU 08000H ;; codepage in buffer is not newly
489 AT_LOAD EQU 00100H ;; slot with font to be loaded
490 AT_FONT EQU 00200H ;; font in this slot has been loaded
491 AT_NO_LOAD EQU NOT AT_LOAD ;; to reset the bit
492 AT_NO_FONT EQU NOT AT_FONT ;; to reset the bit
493 AT_SELECT EQU 00400H ;; for SELECT TYPE = 1
494 ;; -- mark the FTBLK where control is
496 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
497 ;; constants on SLOTS
502 CTL_MAX EQU 32 ;; max.length of each selection control
503 CTL5202_OFFS EQU 8 ;; offset to CTL5202_H for codepage
505 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
509 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
511 STACK_SIZE EQU 28H ;; in paragraph, total 200H bytes
513 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
518 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
520 PARSE_NAME STRUC ;; ;AN000;
521 N_LENGTH DW ? ;; ;AN000;
522 FNAME DB " " ;; ;AN000;
523 PARSE_NAME ENDS ;; ;AN000;
525 PARSE_OFFSETS STRUC ;; ;AN000;
527 DN_OFFSET DW ? ;; ;AN000;
528 DI_OFFSET DW ? ;; ;AN000;
529 DCP_OFFSET DW ? ;; ;AN000;
530 DD_OFFSET DW ? ;; ;AN000;
532 PARSE_OFFSETS ENDS ;; ;AN000;
534 PARSE_HWCP STRUC ;; ;AN000;
535 NUM_HWCPS DW ? ;; ;AN000;
536 HWCP_1 DW ? ;; ;AN000;
537 HWCP_2 DW ? ;; ;AN000;
538 HWCP_3 DW ? ;; ;AN000;
539 HWCP_4 DW ? ;; ;AN000;
540 HWCP_5 DW ? ;; ;AN000;
541 HWCP_6 DW ? ;; ;AN000;
542 HWCP_7 DW ? ;; ;AN000;
543 HWCP_8 DW ? ;; ;AN000;
544 HWCP_9 DW ? ;; ;AN000;
545 HWCP_10 DW ? ;; ;AN000;
546 PARSE_HWCP ENDS ;; ;AN000;
548 PARSE_DESG STRUC ;; ;AN000;
549 NUM_VALUES DW ? ;; ;AN000;
550 NUM_DESGS DW ? ;; ;AN000;
551 NUM_FONTS DW ? ;; ;AN000;
552 PARSE_DESG ENDS ;; ;AN000;
555 ZERO EQU 0H ;; ;AN000;
556 ONE EQU 1H ;; ;AN000;
557 TWO EQU 2H ;; ;AN000;
558 THREE EQU 3H ;; ;AN000;
559 FOUR EQU 4H ;; ;AN000;
560 FIVE EQU 5H ;; ;AN000;
561 SIX EQU 6H ;; ;AN000;
562 SEVEN EQU 7H ;; ;AN000;
563 EIGHT EQU 8H ;; ;AN000;
564 NINE EQU 9H ;; ;AN000;
565 TEN EQU 0AH ;; ;AN000;
566 NUMBER EQU 1 ;; ;AN000;
567 STRING EQU 3 ;; ;AN000;
568 COMPLEX EQU 4 ;; ;AN000;
569 RC_EOL EQU -1 ;; ;AN000;
570 RC_NO_ERROR EQU 0 ;; ;AN000;
571 RC_OP_MISSING EQU 2 ;; ;AN000;
574 BAD_SYNTAX_MSG EQU 12 ;; ;AN000;
575 BAD_DEVICE_MSG EQU 2 ;; ;AN000;