]>
wirehaze git hosting - MS-DOS.git/blob - v4.0/src/DEV/PRINTER/CPSPI07.ASM
4 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6 ;; FILENAME: CPS Printer Device Driver INIT module (CPSPInn)
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.
15 ;; LAYOUT : This file is divided into two main section :
16 ;; ++++++++++++++++++++++++
17 ;; ++ DEVICE Parser ++
18 ;; ++++++++++++++++++++++++
20 ;; ++++++++++++++++++++++++
22 ;; ++++++++++++++++++++++++
23 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
25 INCLUDE CPSPEQU
.INC ;;
26 INT2F_LOW EQU
(4*2FH
) ;; WGR interrupt 2F vector location ;AN000;
27 INT2F_HI EQU
(4*2FH
)+2 ;; WGR ;AN000;
30 INCLUDE SYSMSG
.INC ;; WGR ;AN000;
33 MSG_UTILNAME
<PRINTER
> ;; WGR ;AN000;
36 PUBLIC CODE_END
;; for MAP listing only
37 PUBLIC RESIDENT_END
;;
38 PUBLIC STACK_ALLOCATED
;;
41 EXTRN PRINTER_DESC_NUM
:WORD ;;
42 EXTRN PRINTER_DESC_TBL
:WORD ;;
43 EXTRN INIT_CHK
:WORD,TABLE
:WORD ;;
44 EXTRN HARD_SL1
:BYTE,RAM_SL1
:BYTE ;;
45 EXTRN HARD_SL2
:BYTE,RAM_SL2
:BYTE ;;
46 EXTRN HARD_SL3
:BYTE,RAM_SL3
:BYTE ;;
47 EXTRN HARD_SL4
:BYTE,RAM_SL4
:BYTE ;;
48 EXTRN RESERVED1
:WORD,RESERVED2
:WORD ;;
52 CSEG
SEGMENT PARA
PUBLIC 'CODE' ;;
56 EXTRN PARSER
:NEAR ;; WGR ;AN000;
57 EXTRN ROM_INT2F
:WORD ;; WGR ;AN000;
58 EXTRN INT2F_COM
:NEAR ;; WGR ;AN000;
59 EXTRN ABORT
:BYTE ;; WGR ;AN000;
61 CODE_END EQU
$ ;; end of resident code
63 DW 0 ;; -- there are 16 bytes kept,
64 ;; including this word
66 RESIDENT_END
DW 0FFFH ;; end of extended resident area
67 STACK_ALLOCATED
DW -1 ;; end of extended resident area
69 DW 150 DUP(0) ;; need some space here.
70 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
72 ;; End of resident code
74 ;;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
76 ;; ++++++++++++++++++++++++
78 ;; ++++++++++++++++++++++++
80 ;;==== Command Code 0 - Initialization ======
82 ;; messages returned :
84 ;; msg_bad_syntax -- syntax error from parser, no driver installation
85 ;; msg_no_init -- device cannot be initialised
86 ;; msg_insuff_mem -- insufficient memory
88 ;; layout : the initialization is done in two stages :
90 ;; ++++++++++++++++++++++++
91 ;; ++ INIT Stage 1 ++ to examine and extract the
92 ;; ++++++++++++++++++++++++ parameters defined for the
93 ;; device_id in DEVICE command,
94 ;; according to the printer
95 ;; description table for the
98 ;; ++++++++++++++++++++++++
99 ;; ++ INIT Stage 2 ++ to set the BUFfer for the LPTn
100 ;; ++++++++++++++++++++++++ or PRN according to device_id's
105 ;;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
109 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
111 ; Tables for the deivce_id parameters in the order of device_id in the
113 ; === the tables serves as the link between LPTn to be defined in the 2nd
114 ; stage, and the device_id that is processed in the first stage.
116 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
118 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
119 ;; device ID indicators :
120 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
121 DID_MAX EQU
4 ;; device entris exepcted in PARSE
122 ;; not more than 16. ;; table
124 DID_STATUS
DW 0 ;; status of parsing device id
125 ;; = 0 : all Device-ID bad
128 DID_MATCH
DW 0 ;; this DID has device_name matched
130 DID_FAIL
DW 0 ;; to fail the good DID_STATUS and
131 ;; the matched name. (due to
132 ;; inconsistency among the same LPTn
133 ;; or between PRN and LPT1.)
135 ;; (DID_STATUS) AND (DID_MATCH) XOR (DID_FAIL) determines the success of DID
138 DID_ONE EQU
00001H ;; first device-ID
139 DID_TWO EQU
00002H ;; second "
140 DID_THREE EQU
00004H ;; third "
141 DID_FOUR EQU
00008H ;; fourth "
142 ;;maximun number of device_id = 16 ;;
144 DID_BIT
LABEL WORD ;;
149 ;;maximun number of device_id = 16 ;;
150 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
151 ;; device paramters according to the
152 ;; device_id defined in DEVICE and the
153 ;; parameters defined for the device_id
154 ;; in the printer description table.
156 HRMAX
LABEL word ;; number of hwcp+cart slots supported
163 CTMAX
LABEL word ;; number of cart slots supported
170 RMMAX
LABEL word ;; number of ram-slots supported
177 RBUMAX
LABEL word ;; number of ram-designate slots
184 DESCO
LABEL word ;; offset to the description table
185 ;; where the device_id is defined.
192 FSIZE
LABEL word ;; font size of the device
199 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
201 ; Hard/RAM slots table in the order of DEVICE parameters
203 ; number of entries in all HARD_SLn is determined by the max. {HSLOTS}, and
204 ; number of entries in all RAM_SLn is determined by the max. {RSLOTS}
206 ; -- they are initialized according to the device_id defined in the DEVICE.
208 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
210 HARD_SLA
LABEL word ;; index in the order of device in
211 DW OFFSET
(HARD_SL1
) ;; the PARSE-talbes
212 DW OFFSET
(HARD_SL2
) ;;
213 DW OFFSET
(HARD_SL3
) ;;
214 DW OFFSET
(HARD_SL4
) ;;
217 RAM_SLA
LABEL word ;;
218 DW OFFSET
(RAM_SL1
) ;;
219 DW OFFSET
(RAM_SL2
) ;;
220 DW OFFSET
(RAM_SL3
) ;;
221 DW OFFSET
(RAM_SL4
) ;;
224 SUB_SIZE EQU
11 ;; WGR sublist size ;AN000;
225 LEFT_ASCIIZ EQU
00010000B ;; WGR left-aligned asciiz string ;AN000;
226 UNLIMITED EQU
0 ;; WGR unlimited message size. ;AN000;
228 SUBLIST
LABEL DWORD ;; WGR ;AN000;
229 DB SUB_SIZE
;; WGR ;AN000;
231 MSG_PTR
DW ?
;; WGR ;AN000;
232 MSG_SEG
DW SEG CSEG
;; WGR ;AN000;
234 DB LEFT_ASCIIZ
;; WGR ;AN000;
235 DB UNLIMITED
;; WGR ;AN000;
237 DB " " ;; WGR ;AN000;
239 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
241 ;; ++++++++++++++++++++++++
242 ;; ++ INIT Command ++
243 ;; ++++++++++++++++++++++++
245 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
249 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
250 ;; parse the initialization parameters in DEVICE command
251 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
253 PUSH BX ;; WGR ;AN000;
254 CALL SYSLOADMSG
;; WGR load messages ;AN000;
255 JNC CONT_1
;; WGR if no error then continue ;AN000;
256 CALL SYSDISPMSG
;; WGR error (DOS version)..display ;AN000;
257 POP BX ;; WGR message.... ;AN000;
258 JMP SYNTAX_ERROR
;; WGR ...and exit with error code. ;AN000;
260 CONT_1: ;; WGR ;AN000;
261 POP BX ;; WGR ;AN000;
262 CMP BUF
.BFLAG
,BF_PRN
;; since PRN is the FIRST device header
266 MOV AX,OFFSET CODE_END
;; defined only once for each DEVICE
273 INC AX ;; leave 16 bytes,room for resident_end
274 MOV RESIDENT_END
,AX ;;
276 CALL PARSER
;; call only once, for PRM
290 ;;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
292 ;; ++++++++++++++++++++++++
293 ;; ++ INIT Stage 1 ++
294 ;; ++++++++++++++++++++++++
296 ;; INIT - FIRST STAGE :
298 ;; == test and extract if the parameters on device-id is valid
299 ;; == determine the DID_STATUS according to the validity of the parameters
300 ;; == procedure(s) called -- DID_EXTRACT
302 ;;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
307 POP ES ;; PSE points to Device offsets
308 MOV DI,OFFSET
(table
) ;; ES:[DI]
309 MOV DX,PSE
.PAR_DEV_NUM
;;
316 PUSH BX ;; WGR ;AN000;
317 MOV AX,BAD_SYNTAX_MSG
;; WGR 'bad syntax' message ;AN000;
318 MOV BX,STDERR
;; WGR to standard error ;AN000;
319 XOR CX,CX ;; WGR ;AN000;
320 XOR DL,DL ;; WGR ;AN000;
321 MOV DH,UTILITY_MSG_CLASS
;; WGR class = parse error ;AN000;
322 CALL SYSDISPMSG
;; WGR display message. ;AN000;
323 POP BX ;; WGR ;AN000;
325 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
326 SYNTAX_ERROR
: ;; set the request header status
327 ;; according to the STATE
328 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
329 MOV AX, RESIDENT_END
;;
332 SUB AX,Cx ;; additional segment required.
346 LES DI,dword ptr buf
.rh_ptro
;; get Request Header address
347 ; MOV RH.RH0_ENDO,AX ;;
349 MOV RH
.RH0_ENDS
,CX ;;
350 mov rh
.RH0_CONFIG_ERRMSG
, -1 ;DCR D493 2/25/88 "Error in CONFIG.SYS..." msg flag.
351 MOV RH
.RHC_STA
,stat_cmderr
;; set status in request header
361 MOV INIT_CHK
,0001H ;; ERROR 0001
362 JMP BAD_DID
;; more than supported no. of device
365 PUSH DI ;; pointer to PAR_OT (table 1)
368 JMP END_DID
;; DI = offset to the 1st PARSE table
369 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
371 MOV DI,PSE
.PAR_OFF
;; points to the nth device
373 ;; find the description for the
375 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
376 MOV CX,PRINTER_DESC_NUM
;;
377 MOV SI, OFFSET
(PRINTER_DESC_TBL
); offset to the description table
382 PUSH CX ;; save device count
383 PUSH SI ;; pointer to printer-descn's offset
384 MOV SI,CS:WORD PTR[SI] ;;
386 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
387 ; $LEAVE Z ;; LEAVE if no more device description
389 PUSH DI ;; save offset to PAR_DEVOT
390 MOV DI,PSE
.PAR_DIDO
;;
391 MOV CX,PSE
.PAR_DIDL
;; length of parsed device name
392 LEA DI,PSE
.PAR_DID
;; pointer to parse device name
395 LEA SI,[SI].TYPEID
;; offset to name of device-id
398 POP DI ;; get back offset to PAR_DEVOT
399 ;;;;;;;;;;;;;;;;;;;;;;;;
400 ; $EXITIF Z ;; EXIT if name matched
403 CALL DID_EXTRACT
;; get the parameters
405 POP SI ;; balance push-pop
408 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
409 ; $ORELSE ;; try next description :
413 POP SI ;; of printer_descn offset table
415 INC SI ;; next offset to PRINTER_DESCn
417 POP CX ;; one description less
419 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
420 ; $ENDLOOP ;; DEVICE-ID not defined in
428 MOV INIT_CHK
,0004H ;; ERROR 0004
430 POP SI ;; balance push-pop
432 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
433 ; $ENDSRCH ;; End of scanning printer_desc
435 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
438 INC DI ;; points to next device in PART_OT
453 ;;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
455 ;; ++++++++++++++++++++++++
456 ;; ++ INIT Stage 2 ++
457 ;; ++++++++++++++++++++++++
459 ;; INIT -- SECOND STAGE :
461 ;; == match the device_name extracted in stage 1 with the name of PRN or
464 ;; == if the PRN/LPTn has never been defined before, then set up the BUF
465 ;; for the PRN/LPTn if the DID_STATUS is good; otherwise message will
466 ;; be generated indicating it cannot be initilized.
468 ;; == if there is PRN, LPT1 is also setup, and vice vera. IF both PRN and
469 ;; LPT1 are on the DEVICE command, or there are multiple entries for
470 ;; the same LPTn, the consistency is checked. It they are inconsistent
471 ;; the associated LPTn or PRN is forced to fail by : DID_FAIL.
473 ;; == if the device_name on the DEVICE command is not one of the supported
474 ;; PRN or LPTn, then DID_MATCH bit will not be set. An error message
475 ;; will be generated for the device_name indicating it cannot be
478 ;; == procedure(s) called : CHK_DID .. check DID parameters for device
479 ;; whose name matched.
480 ;; DEV_CHECK .. if device-name duplicated, or
481 ;; there are both PRN/LPT1 : check
482 ;; for consistent parameters.
484 ;;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
487 POP ES ;; PSE points to Device offsets
488 MOV DI,OFFSET
(table
) ;; ES:[DI]
489 xor cx,cx ;; device order in parse table
492 PUSH DI ;; pointer to PAR_OT
493 PUSH CX ;; save device count
494 MOV DI,PSE
.PAR_OFF
;; " " PAR_DEVOT
497 ;LEAVE NB ;; LEAVE if no more device entry
500 MORE_DEVICE
: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
501 ;; more parsed_device to be checked
502 PUSH DI ;; save offset to PAR_DEVOT
503 MOV DI,PSE
.PAR_DNMO
;;
504 MOV CX,PSE
.PAR_DNML
;; length of parsed device name
505 LEA DI,PSE
.PAR_DNM
;; pointer to parse device name
507 LDS SI,DWORD PTR BUF
.DEV_HDRO
; get the offset to device-n header
508 LEA SI,HP
.DH_NAME
;; " offset to name of device-n
510 POP DI ;; get back offset to PAR_DEVOT
512 ;;;;;;;;;;;;;;;;;;;;;;;;;;
513 ;EXITIF Z ;; EXIT if name matched
516 JMP MORE_PARSED_DEVICE
;;
520 POP CX ;; the DID order
524 MOV AX,DID_BIT
[BX] ;;
525 OR DID_MATCH
,AX ;; this DID matched
529 LEA SI,BUF
.PAR_EXTRACTO
;; was the LPT1/PRN defined before ?
530 MOV AX,CS:[SI].PAR_DNMO
;;
533 JNE DEV_COMPARE
;; DI = PAR_DEVOT
534 ;;-----------------------------------
536 ;; no device previousely defined
537 MOV AX,PSE
.PAR_DNMO
;;
538 MOV CS:[SI].PAR_DNMO
,AX ;; define device parameters for LPTn
540 MOV AX,PSE
.PAR_DIDO
;;
541 MOV CS:[SI].PAR_DIDO
,AX ;;
543 MOV AX,PSE
.PAR_HWCPO
;;
544 MOV CS:[SI].PAR_HWCPO
,AX ;;
546 MOV AX,PSE
.PAR_DESGO
;;
547 MOV CS:[SI].PAR_DESGO
,AX ;;
549 MOV AX,PSE
.PAR_PARMO
;;
550 MOV CS:[SI].PAR_PARMO
,AX ;;
552 ;;---------------------------------
553 CALL CHK_DID
;; define the STATE according to
555 JMP MORE_PARSED_DEVICE
;;
557 DEV_COMPARE
: ;;-------------------------------
558 ;; e.g. LPT1 and PRN shares one BUF.
559 ;; or duplicated device name
562 CMP BUF
.STATE
,CPSW
;;
563 JNE DEV_COMPARE_FAIL
;;
565 JMP MORE_PARSED_DEVICE
;;
567 DEV_COMPARE_FAIL
: ;;
570 POP DI ;; balance push-pop
572 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
575 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
576 MORE_PARSED_DEVICE
: ;; name does not match
582 INC DI ;; points to next device in PART_OT
585 ;$ENDLOOP ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
586 $$EN7
: ;; no device found for LPTn
589 POP DI ;; balance push-pop
591 CMP BUF
.STATE
,CPSW
;;
592 JE END_LPT
;; for LPT1/PRN pair
594 MOV BUF
.STATE
,NORMAL
;; no device defined for the LPTn
596 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
597 ;; End of defining LPTn Buffer
598 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
601 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
602 ;; set the request header status
603 ;; according to the STATE
604 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
605 MOV AX, RESIDENT_END
;;
608 SUB AX,Cx ;; additional segment required.
622 LES DI,dword ptr buf
.rh_ptro
;; get Request Header address
623 MOV RH
.RH0_ENDO
,AX ;;
624 MOV RH
.RH0_ENDS
,CX ;;
625 XOR AX,AX ;; clear error code to be returned
629 MOV AX,STAT_CMDERR
;;
632 MOV RH
.RHC_STA
,AX ;; set status in request header
633 CALL LOAD_INT2F
;; WGR load INT2f handler ;AN000;
637 CMP BUF
.BFLAG
,BF_LPT1
;;
640 CMP BUF
.STATE
,CPSW
;;
642 ;; set PRN to the same setting as LPT1
648 MOV BX,BUF
.PRN_BUFO
;; where PRN buffer is
659 CMP BUF
.BFLAG
,BF_LPT3
;; generate error message is this is
660 je last_round
;; the last LPTn
662 ;; ERROR messages will be generated
663 ;; at the end of initialization of all
666 MOV AX,RESIDENT_END
;;
668 MOV RESIDENT_END
,AX ;;
671 SUB AX,Cx ;; additional segment required.
685 MOV RH
.RH0_ENDO
,AX ;; STACK !!!!!
686 MOV STACK_ALLOCATED
,0 ;; from now on, internal stack is used
688 MOV AX,DID_STATUS
;; what is the DID combination ?
694 ; MOV RH.RH0_ENDO,0 ;; none of the devices are good
698 MOV DI,OFFSET TABLE
;;
708 ;; this device in parse table is bad
712 PUSH BX ;; WGR ;AN000;
713 PUSH DX ;; WGR ;AN000;
715 MOV DI,PSE
.PAR_OFF
;;
716 MOV SI,PSE
.PAR_DNMO
;;
724 LEA SI,[SI].PAR_DNM
;;
726 MOV AL,' ' ;; WGR ;AN000;
728 REPNE SCASB ;; WGR ;AN000;
729 DEC DI ;; WGR ;AN000;
730 MOV BYTE PTR ES:[DI],ZERO
;; WGR ;AN000;
732 MOV MSG_SEG
,CS ;; WGR ;AN000;
733 MOV MSG_PTR
,SI ;; WGR ;AN000;
734 MOV AX,BAD_DEVICE_MSG
;; WGR ;AN000;
735 MOV BX,STDERR
;; WGR ;AN000;
736 LEA SI,SUBLIST
;; WGR ;AN000;
737 MOV CX,ONE
;; WGR ;AN000;
738 XOR DL,DL ;; WGR ;AN000;
739 MOV DH,UTILITY_MSG_CLASS
;; WGR ;AN000;
740 CALL SYSDISPMSG
;; WGR ;AN000;
742 POP DX ;; WGR ;AN000;
743 POP BX ;; WGR ;AN000;
761 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
763 ;; Call by INIT to extract parameters for the deivce_id
766 ;; ES:[DI] PARSE Table 2, offsets of all parameters
767 ;; DS:[SI] Printer Description table whose TYPEID matched
768 ;; DX "inverse" order of devices in the PARSE tables
770 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
776 ;;-----------------------------
777 ;; define the DID_parameters
781 SUB BX,DX ;; order in the Parse table
782 add bx,bx ;; double to index [bx]
785 MOV AX,DS:[SI].FONTSZ
;;
786 MOV FSIZE
[BX],AX ;; size of font buffer to be created
788 MOV AX,DS:[SI].HSLOTS
;;
791 MOV INIT_CHK
, 0010H ;; ERROR 0010H
795 CMP AX,DS:[SI].HWCPMIN
;;
797 MOV INIT_CHK
, 0012H ;; ERROR 0012H
802 MOV CTMAX
[BX],AX ;; will be reduced by the no. of hwcp
804 MOV AX,DS:[SI].RSLOTS
;;
807 MOV INIT_CHK
, 0011H ;; ERROR 0011H
811 MOV RMMAX
[BX],AX ;; see also designate
816 ;;----------------------------------
820 HWCPgt: PUSH DI ;; get the hwcp
822 MOV DI,PSE
.PAR_HWCPO
;;
823 MOV CX,PSE
.PAR_HWCPL
;; no. of hwcp
829 MOV CX,DS:[SI].HWCPMIN
;;
830 SUB CTMAX
[BX],CX ;; what is left becomes cartridge slot
833 ;; hwcp to be defined
834 chk_hwcp: MOV AX,DS:[SI].HSLOTS
;; defined in printer_desc
838 JNA HWCP_GOOD
;; jump if system error
839 MOV INIT_CHK
,0003H ;; ERROR 0003
842 MOV INIT_CHK
,0002H ;; ERROR 0002
845 HWCP_GOOD: ;; there are sufficient hard-slot for
847 PUSH SI ;; printer description table of TYPEID
853 PUSH CX ;; calculate what is left for cart_slot
854 CMP CX,DS:[SI].HWCPMIN
;;
855 JNB MORE_THAN_HWCPMIN
;;
856 MOV CX,DS:[SI].HWCPMIN
;;
857 MORE_THAN_HWCPMIN
: ;;
862 MOV CTMAX
[BX],AX ;; no of cart-slot for designate
863 MOV SI,HARD_SLA
[BX] ;; get the corresponding hard-slots
871 mov reserved1
,dx ;; IF THERE IS ANY REPETITIVE HWCP
872 mov reserved2
,bx ;; IF THERE IS ANY REPETITIVE HWCP
877 INC DI ;; next code page in PARSE table
879 MOV AX,ES:[DI] ;; get code page value
881 ;; IF THERE IS ANY REPETITIVE HWCP
885 cmp ax,cs:[bx].slt_cp
;;
904 MOV CS:[SI].SLT_CP
,AX ;;
905 MOV AX,CS:[SI].SLT_AT
;; get the attributes
906 OR AX,AT_OCC
;; occupied
907 OR AX,AT_HWCP
;; hwcp slot
908 MOV CS:[SI].SLT_AT
,AX ;;
919 ;;---------------------
920 DESIGN: POP DI ;; get the designate no.
923 MOV DI,PSE
.PAR_DESGO
;;
924 MOV AX,PSE
.PAR_DESGL
;;
926 JA END_MATCH
;; there should have no font entry
930 MOV AX,PSE
.PAR_DESG
;;
934 CMP CS:[SI].CLASS
,1 ;;
935 JNE DESIG_NOt_CLASS1
;;
937 PUSH BX ;; if there is any cartridge slot ?
944 JZ END_MATCH
;; fail, as there is no physical RAM.
946 CMP AX,HARDSL_MAX
;; is the designate more than max ?
954 DESIG_NOT_CLASS1
: ;;
955 PUSH BX ;; if there is any physical RAM slot ?
962 JZ END_MATCH
;; fail, as there is no physical RAM.
965 CMP AX,RAMSL_MAX
;; is the designate more than max ?
978 ;; MOV DI,PSE.PAR_PARMO ;;
980 ;,--------------------------
981 ;; GOOD device_id parameters
988 NO_SHL: OR DID_STATUS
,AX ;; is defined
989 ;;-------------------------
990 END_MATCH: POP DI ;; end of extract
999 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1001 ;; Called by INIT to define the STATE and BUF for the LPTn according to
1002 ;; the DID_STATUS. Create font buffer if requested through the "desi*nate"
1004 ;; at entry : CX = device order in parse table
1006 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1013 MOV AX,DID_STATUS
;;
1015 PUSH CX ;; order 0 to m
1017 ADD DI,DI ;; indexing : [DI]
1020 SHR AX,CL ;; is the device parameter valid ?
1023 JMP LPT_FAIL
;;--------------------------
1026 ;; good device parameters as determined
1028 MOV BUF
.PDESCO
,AX ;;
1032 MOV AX,CS:[DI].CLASS
;;
1033 MOV BUF
.PCLASS
,AX ;;
1036 MOV AX,HARD_SLA
[DI] ;; in the DID_EXTRACT
1037 MOV BUF
.HARDSO
,AX ;;
1039 MOV AX,RAM_SLA
[DI] ;;
1043 MOV BUF
.HARDMX
,AX ;;
1046 MOV BUF
.HCARMX
,AX ;;
1048 ADD AX,HRMAX
[DI] ;; defore "designate"
1056 PUSH CX ;; calculate the max. length of control
1057 MOV CX,2 ;; sequence that is allowed for the
1058 CMP BUF
.PCLASS
,1 ;; room reserved for physical slots.
1060 MOV CX,1 ;; class 1 printer has one control seq.
1063 DEC AX ;; leave one byte for the length
1066 MOV BUF
.FSELMAX
,AX ;;
1070 MOV BUF
.FTSZPA
,AX ;; FTSIZE in paragraph
1078 JNZ FT_PARA
;; font size
1079 MOV BUF
.FTSIZE
,AX ;; font size in bytes (used with.RBUFMX)
1081 POP DX ;; FTSIZE in paragraph
1083 MOV CX,RBUMAX
[DI] ;; create font buffer per .RBUFMX and
1084 MOV BUF
.RBUFMX
,CX ;; assume sufficient memory for all the
1085 ;; "designate request"
1088 CMP BUF
.PCLASS
,1 ;; always create font buffer for class1
1093 ADD CX,BUF
.HARDMX
;;
1103 MOV AX,RESIDENT_END
;;
1105 ADD AX,DX ;; allocate the font buffers at the end
1106 DEC CX ;; of the resident codes
1110 MOV CX,RESIDENT_END
;;
1111 MOV BUF
.FTSTART
,CX ;;
1112 MOV RESIDENT_END
,AX ;;
1116 POP CX ;; designate requested
1124 PUSH CX ;; STACKS...
1131 MOV DX,BUF
.HARDMX
;;
1132 PUSH DX ;; STACK +1 -- # of HWCP
1137 MOV SI,BUF
.PDESCO
;;
1138 MOV SI,CS:[SI].SELH_O
;;
1140 MOV CL,CS:BYTE PTR [SI] ;;
1141 INC CX ;; including the length byte
1143 MOV DI,BUF
.FTSTART
;; control template
1144 DEF_FTBUF: ;; fill the font buffer with the
1157 ADD DI,BUF
.FTszpa
;;
1163 MOV SI,BUF
.HARDSO
;;
1164 MOV DI,BUF
.FTSTART
;; define the HWCP values
1168 MOV DI,CTL5202_OFFS
;; offset to the HWCP words
1170 MOV AX,CS:[SI].SLT_CP
;;
1171 MOV ES:WORD PTR [DI],AX ;;
1180 ADD DI,BUF
.FTSZPA
;;
1195 MOV BUF
.RSLMX
,CX ;; the no. of ram slots supported
1199 MOV BUF
.RSLMX
,AX ;; the max. of .RAMMX and .RBUFMX
1202 MOV BUF
.STATE
,CPSW
;; the LPTn is CPSW ----- STATE
1204 CMP BUF
.BFLAG
,BF_PRN
;;
1206 MOV AX,DID_BIT
[DI] ;;
1207 MOV BUF
.DID_PRN
,AX ;;
1214 MOV BUF
.STATE
,NORMAL
;; the LPTn is NORMAL --- STATE
1227 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1229 ;; Called by INIT to check for consistency between duplicated device name and
1230 ;; between PRN and LPT1
1232 ;; at entry : DI = pointer to PAR_DEVOT
1233 ;; BUF.STATE = any state
1236 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1240 LEA SI,BUF
.PAR_EXTRACTO
;;
1244 PUSH SI ;; compare device id
1246 mov SI,[SI].PAR_DIDO
;;
1247 MOV DI,PSE
.PAR_DIDO
;;
1248 MOV CX,PSE
.PAR_DNML
;;
1249 INC CX ;; including length
1255 mov init_chk
,0021h ;; error 0021h
1256 Jmp FORCE_LPT_BAD
;;
1259 PUSH SI ;; compare HWCP
1261 mov SI,[SI].PAR_HWCPO
;;
1262 MOV DI,PSE
.PAR_HWCPO
;;
1263 MOV AX,PSE
.PAR_HWCPL
;;
1265 SHL AX,CL ;; multiply by two
1266 INC AX ;; including length
1273 mov init_chk
,0022h ;; error 0022h
1274 Jmp FORCE_LPT_BAD
;;
1277 PUSH SI ;; compare DESIGNATE
1279 mov SI,[SI].PAR_DESGO
;;
1280 MOV DI,PSE
.PAR_DESGO
;;
1281 MOV AX,PSE
.PAR_DESGL
;;
1283 SHL AX,CL ;; multiply by two
1284 INC AX ;; including length
1291 mov init_chk
,0023h ;; error 0023h
1292 Jmp FORCE_LPT_BAD
;;
1295 PUSH SI ;; compare parameters
1297 mov SI,[SI].PAR_PARMO
;;
1298 MOV DI,PSE
.PAR_PARMO
;;
1299 MOV CX,PSE
.PAR_PARML
;;
1300 INC CX ;; including length
1306 mov init_chk
,0024h ;; error 0024h
1308 FORCE_LPT_BAD
: ;; the second set of parameters is
1309 MOV BUF
.STATE
,NORMAL
;; bad
1311 CMP BUF
.BFLAG
,BF_LPT1
;;
1314 ;; since LPT1 is bad, force PRN to bad
1315 push bx ;; force prn to be bad too
1316 mov bx,buf
.prn_bufo
;;
1317 MOV BUF
.STATE
,NORMAL
;;
1320 mov AX,BUF
.DID_PRN
;; if PRN was not good, DID_PRN = 0
1324 M_END: ;; force the good did_status to fail if
1327 PUSH CX ;; order 0 to m
1328 MOV AX,DID_STATUS
;;
1333 JNC DEV_CHECK_RET
;; already failed
1335 CMP BUF
.STATE
,CPSW
;;
1341 MOV AX,DID_BIT
[BX] ;;
1342 OR DID_FAIL
,AX ;; force DID to fail
1353 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1356 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1358 ; PROCEDURE_NAME: LOAD_INT2F
1361 ; THIS PROCEDURE LOADS THE INTERRUPT HANDLER FOR INT2FH
1366 ; NORMAL: INTERRUPT 2FH VECTOR POINTS TO INT2F_COM. OLD INT 2FH
1371 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1373 SEMAPHORE
DB 0 ;AN000;
1375 LOAD_INT2F PROC
NEAR ;AN000;
1376 CMP CS:SEMAPHORE
,0 ; already loaded? ;AN000;
1377 JNE LI_1
; yes.....exit ;AN000;
1378 PUSH ES ; no...load. ;AN000;
1381 XOR AX,AX ; point ES to low.. ;AN000;
1382 MOV ES,AX ; memory. ;AN000;
1383 MOV AX,ES:WORD PTR INT2F_LOW
; store original.. ;AN000;
1384 MOV CS:ROM_INT2F
,AX ; interrupt 2Fh.. ;AN000;
1385 MOV CX,ES:WORD PTR INT2F_HI
; location.. ;AN000;
1386 MOV CS:ROM_INT2F
+2,CX ; ;AN000;
1387 OR AX,CX ; check if old int2F.. ;AN000;
1388 JNZ LI_0
; is 0. ;AN000;
1389 MOV AX,OFFSET ABORT
; yes....point to.. ;AN000;
1390 MOV CS:ROM_INT2F
,AX ; IRET. ;AN000;
1392 MOV CS:ROM_INT2F
+2,AX ; ;AN000;
1395 MOV ES:WORD PTR INT2F_LOW
,OFFSET INT2F_COM
; replace vector.. ;AN000;
1396 MOV ES:WORD PTR INT2F_HI
,CS ; with our own.. ;AN000;
1401 MOV CS:SEMAPHORE
,1 ; now loaded. ;AN000;
1406 MSG_SERVICES
<MSGDATA
> ; WGR ;AN000;
1407 MSG_SERVICES
<DISPLAYmsg
,LOADmsg
,CHARmsg
> ; WGR ;AN000;
1408 MSG_SERVICES
<PRINTER
.CL1
> ; WGR ;AN000;
1409 MSG_SERVICES
<PRINTER
.CL2
> ; WGR ;AN000;
1410 MSG_SERVICES
<PRINTER
.CLA
> ; WGR ;AN000;