summaryrefslogtreecommitdiff
path: root/v4.0/src/DEV/PRINTER/CPSPI07.ASM
diff options
context:
space:
mode:
Diffstat (limited to 'v4.0/src/DEV/PRINTER/CPSPI07.ASM')
-rw-r--r--v4.0/src/DEV/PRINTER/CPSPI07.ASM1416
1 files changed, 1416 insertions, 0 deletions
diff --git a/v4.0/src/DEV/PRINTER/CPSPI07.ASM b/v4.0/src/DEV/PRINTER/CPSPI07.ASM
new file mode 100644
index 0000000..740b136
--- /dev/null
+++ b/v4.0/src/DEV/PRINTER/CPSPI07.ASM
@@ -0,0 +1,1416 @@
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 ;;
25INCLUDE CPSPEQU.INC ;;
26INT2F_LOW EQU (4*2FH) ;; WGR interrupt 2F vector location ;AN000;
27INT2F_HI EQU (4*2FH)+2 ;; WGR ;AN000;
28 ;;
29.XLIST ;;
30INCLUDE SYSMSG.INC ;; WGR ;AN000;
31.LIST ;;
32 ;;
33MSG_UTILNAME <PRINTER> ;; WGR ;AN000;
34 ;;
35PUBLIC INIT ;;
36PUBLIC CODE_END ;; for MAP listing only
37PUBLIC RESIDENT_END ;;
38PUBLIC STACK_ALLOCATED ;;
39 ;;
40 ;;
41EXTRN PRINTER_DESC_NUM:WORD ;;
42EXTRN PRINTER_DESC_TBL:WORD ;;
43EXTRN INIT_CHK:WORD,TABLE:WORD ;;
44EXTRN HARD_SL1:BYTE,RAM_SL1:BYTE ;;
45EXTRN HARD_SL2:BYTE,RAM_SL2:BYTE ;;
46EXTRN HARD_SL3:BYTE,RAM_SL3:BYTE ;;
47EXTRN HARD_SL4:BYTE,RAM_SL4:BYTE ;;
48EXTRN RESERVED1:WORD,RESERVED2:WORD ;;
49 ;;
50 ;;
51 ;;
52CSEG SEGMENT PARA PUBLIC 'CODE' ;;
53 ASSUME CS:CSEG ;;
54 ;;
55 ;;
56EXTRN PARSER:NEAR ;; WGR ;AN000;
57EXTRN ROM_INT2F:WORD ;; WGR ;AN000;
58EXTRN INT2F_COM:NEAR ;; WGR ;AN000;
59EXTRN ABORT:BYTE ;; WGR ;AN000;
60
61CODE_END EQU $ ;; end of resident code
62 ;;
63 DW 0 ;; -- there are 16 bytes kept,
64 ;; including this word
65 ;;
66RESIDENT_END DW 0FFFH ;; end of extended resident area
67STACK_ALLOCATED DW -1 ;; end of extended resident area
68 ;;
69 DW 150 DUP(0) ;; need some space here.
70;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
71;;
72;; End of resident code
73;;
74;;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
75;;
76;; ++++++++++++++++++++++++
77;; ++ INIT Command ++
78;; ++++++++++++++++++++++++
79;;
80;;==== Command Code 0 - Initialization ======
81;;
82;; messages returned :
83;;
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
87;;
88;; layout : the initialization is done in two stages :
89;;
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
96;; device_id.
97;;
98;; ++++++++++++++++++++++++
99;; ++ INIT Stage 2 ++ to set the BUFfer for the LPTn
100;; ++++++++++++++++++++++++ or PRN according to device_id's
101;; parameters
102;;
103;;
104;;
105;;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
106 ;;
107DEV_NUM dw ? ;;
108 ;;
109;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
110;
111; Tables for the deivce_id parameters in the order of device_id in the
112; PARSE table
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.
115;
116;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
117 ;;
118 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
119 ;; device ID indicators :
120 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
121DID_MAX EQU 4 ;; device entris exepcted in PARSE
122;; not more than 16. ;; table
123 ;;
124DID_STATUS DW 0 ;; status of parsing device id
125 ;; = 0 : all Device-ID bad
126 ;; -- see DID_BIT
127 ;;
128DID_MATCH DW 0 ;; this DID has device_name matched
129 ;;
130DID_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.)
134 ;;
135;; (DID_STATUS) AND (DID_MATCH) XOR (DID_FAIL) determines the success of DID
136 ;; initialization
137 ;;
138DID_ONE EQU 00001H ;; first device-ID
139DID_TWO EQU 00002H ;; second "
140DID_THREE EQU 00004H ;; third "
141DID_FOUR EQU 00008H ;; fourth "
142;;maximun number of device_id = 16 ;;
143 ;;
144DID_BIT LABEL WORD ;;
145 DW DID_ONE ;;
146 DW DID_TWO ;;
147 DW DID_THREE ;;
148 DW DID_FOUR ;;
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.
155 ;;
156HRMAX LABEL word ;; number of hwcp+cart slots supported
157 DW 0 ;; did = 1
158 DW 0 ;; did = 2
159 DW 0 ;; did = 3
160 DW 0 ;; did = 4
161;upto max DID_MAX ;;
162 ;;
163CTMAX LABEL word ;; number of cart slots supported
164 DW 0 ;; did = 1
165 DW 0 ;; did = 2
166 DW 0 ;; did = 3
167 DW 0 ;; did = 4
168;upto max DID_MAX ;;
169 ;;
170RMMAX LABEL word ;; number of ram-slots supported
171 DW 0 ;; did = 1
172 DW 0 ;; did = 2
173 DW 0 ;; did = 3
174 DW 0 ;; did = 4
175;upto max DID_MAX ;;
176 ;;
177RBUMAX LABEL word ;; number of ram-designate slots
178 DW 0 ;; did = 1
179 DW 0 ;; did = 2
180 DW 0 ;; did = 3
181 DW 0 ;; did = 4
182;upto max DID_MAX ;;
183 ;;
184DESCO LABEL word ;; offset to the description table
185 ;; where the device_id is defined.
186 DW -1 ;; did = 1
187 DW -1 ;; did = 2
188 DW -1 ;; did = 3
189 DW -1 ;; did = 4
190;upto max DID_MAX ;;
191 ;;
192FSIZE LABEL word ;; font size of the device
193 DW 0 ;; did = 1
194 DW 0 ;; did = 2
195 DW 0 ;; did = 3
196 DW 0 ;; did = 4
197;upto max DID_MAX ;;
198 ;;
199;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
200;
201; Hard/RAM slots table in the order of DEVICE parameters
202;
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}
205;
206; -- they are initialized according to the device_id defined in the DEVICE.
207;
208;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
209 ;;
210HARD_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) ;;
215; up to DID_MAX ;;
216 ;;
217RAM_SLA LABEL word ;;
218 DW OFFSET (RAM_SL1) ;;
219 DW OFFSET (RAM_SL2) ;;
220 DW OFFSET (RAM_SL3) ;;
221 DW OFFSET (RAM_SL4) ;;
222; up to DID_MAX ;;
223 ;;
224SUB_SIZE EQU 11 ;; WGR sublist size ;AN000;
225LEFT_ASCIIZ EQU 00010000B ;; WGR left-aligned asciiz string ;AN000;
226UNLIMITED EQU 0 ;; WGR unlimited message size. ;AN000;
227 ;; WGR ;AN000;
228SUBLIST LABEL DWORD ;; WGR ;AN000;
229 DB SUB_SIZE ;; WGR ;AN000;
230 DB 0 ;; WGR ;AN000;
231MSG_PTR DW ? ;; WGR ;AN000;
232MSG_SEG DW SEG CSEG ;; WGR ;AN000;
233 DB 1 ;; WGR ;AN000;
234 DB LEFT_ASCIIZ ;; WGR ;AN000;
235 DB UNLIMITED ;; WGR ;AN000;
236 DB 1 ;; WGR ;AN000;
237 DB " " ;; WGR ;AN000;
238 ;
239;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
240;;
241;; ++++++++++++++++++++++++
242;; ++ INIT Command ++
243;; ++++++++++++++++++++++++
244;;
245;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
246 ;;
247INIT PROC NEAR ;;
248 ;;
249;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
250;; parse the initialization parameters in DEVICE command
251;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
252;;
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;
259 ;; WGR ;AN000;
260CONT_1: ;; WGR ;AN000;
261 POP BX ;; WGR ;AN000;
262 CMP BUF.BFLAG,BF_PRN ;; since PRN is the FIRST device header
263 JNE NOT_PRN ;;
264 ;;
265 ;;
266 MOV AX,OFFSET CODE_END ;; defined only once for each DEVICE
267 XOR CX,CX ;;
268 MOV CL,4 ;;
269 SHR AX,CL ;;
270 PUSH CS ;;
271 POP CX ;;
272 ADD AX,CX ;;
273 INC AX ;; leave 16 bytes,room for resident_end
274 MOV RESIDENT_END,AX ;;
275 ;;
276 CALL PARSER ;; call only once, for PRM
277 ;;
278 JMP PROCESS_TABLE ;;
279 ;;
280NOT_PRN : ;;
281 CMP DEV_NUM,1 ;;
282 ;;
283 JNB PROCESS_TABLE ;;
284 ;;
285 JMP SYNTAX_ERROR ;;
286 ;;
287 ;;
288 ;;
289;;
290;;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
291;;
292;; ++++++++++++++++++++++++
293;; ++ INIT Stage 1 ++
294;; ++++++++++++++++++++++++
295;;
296;; INIT - FIRST STAGE :
297;;
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
301;;
302;;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
303 ;;
304PROCESS_TABLE : ;;
305 ;;
306 PUSH CS ;;
307 POP ES ;; PSE points to Device offsets
308 MOV DI,OFFSET(table) ;; ES:[DI]
309 MOV DX,PSE.PAR_DEV_NUM ;;
310 MOV DEV_NUM,DX ;;
311 ;;
312 CMP DEV_NUM,0 ;;
313 JNZ NO_SYNTAX_ERR ;;
314 ;;
315 ;; WGR ;AN000;
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;
324 ;;
325 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
326SYNTAX_ERROR : ;; set the request header status
327 ;; according to the STATE
328 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
329 MOV AX, RESIDENT_END ;;
330 PUSH CS ;;
331 POP CX ;; CX=CS
332 SUB AX,Cx ;; additional segment required.
333CS_LOOP1: ;;
334 CMP AX,1000H ;;
335 JB CS_LPEND1 ;;
336 ADD CX,1000H ;;
337 SUB AX,1000H ;;
338 JMP CS_LOOP1 ;;
339 ;;
340CS_LPEND1: ;;
341 SHL AX,1 ;;
342 SHL AX,1 ;;
343 SHL AX,1 ;;
344 SHL AX,1 ;;
345 ;;
346 LES DI,dword ptr buf.rh_ptro ;; get Request Header address
347; MOV RH.RH0_ENDO,AX ;;
348 MOV RH.RH0_ENDO,0 ;;
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
352 ;;
353 JMP INIT_RETurn ;;
354 ;;
355 ;;
356NO_SYNTAX_ERR : ;;
357 ;;
358 CMP DX,DID_MAX ;;
359 JNA NEXT_DID ;;
360 ;;
361 MOV INIT_CHK,0001H ;; ERROR 0001
362 JMP BAD_DID ;; more than supported no. of device
363 ;;
364NEXT_DID: ;;
365 PUSH DI ;; pointer to PAR_OT (table 1)
366 AND DX,DX ;;
367 JNZ SCAN_DESC ;;
368 JMP END_DID ;; DI = offset to the 1st PARSE table
369;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
370SCAN_DESC: ;;
371 MOV DI,PSE.PAR_OFF ;; points to the nth device
372 ;;
373 ;; find the description for the
374 ;;device-id
375 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
376 MOV CX,PRINTER_DESC_NUM ;;
377 MOV SI, OFFSET(PRINTER_DESC_TBL); offset to the description table
378 PUSH CS ;;
379 POP DS ;;
380; $SEARCH ;;
381$$DO1:
382 PUSH CX ;; save device count
383 PUSH SI ;; pointer to printer-descn's offset
384 MOV SI,CS:WORD PTR[SI] ;;
385 AND CX,CX ;;
386 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
387; $LEAVE Z ;; LEAVE if no more device description
388 JZ $$EN1
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
393 ;;
394 PUSH SI ;;
395 LEA SI,[SI].TYPEID ;; offset to name of device-id
396 REPE CMPSB ;;
397 POP SI ;;
398 POP DI ;; get back offset to PAR_DEVOT
399 ;;;;;;;;;;;;;;;;;;;;;;;;
400; $EXITIF Z ;; EXIT if name matched
401 JNZ $$IF1
402 ;;
403 CALL DID_EXTRACT ;; get the parameters
404 ;;
405 POP SI ;; balance push-pop
406 POP CX ;;
407 ;;
408 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
409; $ORELSE ;; try next description :
410 JMP SHORT $$SR1
411$$IF1:
412 ;;
413 POP SI ;; of printer_descn offset table
414 INC SI ;;
415 INC SI ;; next offset to PRINTER_DESCn
416 ;;
417 POP CX ;; one description less
418 DEC CX ;;
419 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
420; $ENDLOOP ;; DEVICE-ID not defined in
421 JMP SHORT $$DO1
422$$EN1:
423 ;; printer_desc;
424 ;;
425 MOV AX,INIT_CHK ;;
426 AND AX,AX ;;
427 JNZ UNCHANGED ;;
428 MOV INIT_CHK,0004H ;; ERROR 0004
429UNCHANGED: ;;
430 POP SI ;; balance push-pop
431 POP CX ;;
432 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
433; $ENDSRCH ;; End of scanning printer_desc
434$$SR1:
435;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
436 POP DI ;;
437 INC DI ;;
438 INC DI ;; points to next device in PART_OT
439 DEC DX ;;
440 ;;
441 JMP NEXT_DID ;;
442 ;;
443END_DID : ;;
444 POP DI ;;
445BAD_DID : ;;
446 ;;
447 MOV AX,DID_STATUS ;;
448 AND AX,AX ;;
449 JNZ DEF_BUFFER ;;
450 ;;
451 JMP END_LPT ;;
452 ;;
453;;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
454;;
455;; ++++++++++++++++++++++++
456;; ++ INIT Stage 2 ++
457;; ++++++++++++++++++++++++
458;;
459;; INIT -- SECOND STAGE :
460;;
461;; == match the device_name extracted in stage 1 with the name of PRN or
462;; LPTn
463;;
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.
467;;
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.
472;;
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
476;; initialized.
477;;
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.
483;;
484;;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
485DEF_BUFFER : ;;
486 PUSH CS ;;
487 POP ES ;; PSE points to Device offsets
488 MOV DI,OFFSET(table) ;; ES:[DI]
489 xor cx,cx ;; device order in parse table
490;SEARCH ;;
491$$DO7:
492 PUSH DI ;; pointer to PAR_OT
493 PUSH CX ;; save device count
494 MOV DI,PSE.PAR_OFF ;; " " PAR_DEVOT
495 cmp cx,dev_num ;;
496 ;;
497;LEAVE NB ;; LEAVE if no more device entry
498 jb MORE_DEVICE ;;
499 JMP $$EN7
500MORE_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
506 ;;
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
509 REPE CMPSB ;;
510 POP DI ;; get back offset to PAR_DEVOT
511 ;;
512 ;;;;;;;;;;;;;;;;;;;;;;;;;;
513;EXITIF Z ;; EXIT if name matched
514 JZ NAME_MATCHED ;;
515 ;;
516 JMP MORE_PARSED_DEVICE ;;
517 ;;
518NAME_MATCHED : ;;
519 ;;
520 POP CX ;; the DID order
521 PUSH BX ;;
522 MOV BX,CX ;;
523 ADD BX,BX ;;
524 MOV AX,DID_BIT[BX] ;;
525 OR DID_MATCH,AX ;; this DID matched
526 POP BX ;;
527 PUSH CX ;;
528 ;;
529 LEA SI,BUF.PAR_EXTRACTO ;; was the LPT1/PRN defined before ?
530 MOV AX,CS:[SI].PAR_DNMO ;;
531 CMP AX,0FFFFH ;;
532 ;;
533 JNE DEV_COMPARE ;; DI = PAR_DEVOT
534 ;;-----------------------------------
535 ;;
536 ;; no device previousely defined
537 MOV AX,PSE.PAR_DNMO ;;
538 MOV CS:[SI].PAR_DNMO,AX ;; define device parameters for LPTn
539 ;;
540 MOV AX,PSE.PAR_DIDO ;;
541 MOV CS:[SI].PAR_DIDO,AX ;;
542 ;;
543 MOV AX,PSE.PAR_HWCPO ;;
544 MOV CS:[SI].PAR_HWCPO,AX ;;
545 ;;
546 MOV AX,PSE.PAR_DESGO ;;
547 MOV CS:[SI].PAR_DESGO,AX ;;
548 ;;
549 MOV AX,PSE.PAR_PARMO ;;
550 MOV CS:[SI].PAR_PARMO,AX ;;
551 ;;
552 ;;---------------------------------
553 CALL CHK_DID ;; define the STATE according to
554 ;; DID_STATUS
555 JMP MORE_PARSED_DEVICE ;;
556 ;;
557DEV_COMPARE : ;;-------------------------------
558 ;; e.g. LPT1 and PRN shares one BUF.
559 ;; or duplicated device name
560 CALL DEV_CHECK ;;
561 ;;
562 CMP BUF.STATE,CPSW ;;
563 JNE DEV_COMPARE_FAIL ;;
564 ;;
565 JMP MORE_PARSED_DEVICE ;;
566 ;;
567DEV_COMPARE_FAIL : ;;
568 ;;
569 POP CX ;;
570 POP DI ;; balance push-pop
571 ;;
572 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
573;$ORELSE ;;
574 JMP END_LPT
575 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
576MORE_PARSED_DEVICE : ;; name does not match
577 ;;
578 POP CX ;;
579 INC CX ;;
580 POP DI ;;
581 INC DI ;;
582 INC DI ;; points to next device in PART_OT
583 ;;
584 jmp $$DO7 ;;
585;$ENDLOOP ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
586$$EN7: ;; no device found for LPTn
587 ;;
588 POP CX ;;
589 POP DI ;; balance push-pop
590 ;;
591 CMP BUF.STATE,CPSW ;;
592 JE END_LPT ;; for LPT1/PRN pair
593 ;;
594 MOV BUF.STATE,NORMAL ;; no device defined for the LPTn
595 ;;
596 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
597 ;; End of defining LPTn Buffer
598 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
599;$ENDSRCH ;;
600END_LPT : ;;
601 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
602 ;; set the request header status
603 ;; according to the STATE
604 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
605 MOV AX, RESIDENT_END ;;
606 PUSH CS ;;
607 POP CX ;; CX=CS
608 SUB AX,Cx ;; additional segment required.
609CS_LOOP2: ;;
610 CMP AX,1000H ;;
611 JB CS_LPEND2 ;;
612 ADD CX,1000H ;;
613 SUB AX,1000H ;;
614 JMP CS_LOOP2 ;;
615 ;;
616CS_LPEND2: ;;
617 SHL AX,1 ;;
618 SHL AX,1 ;;
619 SHL AX,1 ;;
620 SHL AX,1 ;;
621 ;;
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
626 MOV CX,BUF.STATE ;;
627 CMP CX,CPSW ;;
628 JE MATCH_GOOD ;;
629 MOV AX,STAT_CMDERR ;;
630 ;;
631MATCH_GOOD : ;;
632 MOV RH.RHC_STA,AX ;; set status in request header
633 CALL LOAD_INT2F ;; WGR load INT2f handler ;AN000;
634 ;;
635BUF_END : ;;
636 ;;
637 CMP BUF.BFLAG,BF_LPT1 ;;
638 JNE BUF_MESSAGES ;;
639 ;;
640 CMP BUF.STATE,CPSW ;;
641 JNE BUF_MESSAGES ;;
642 ;; set PRN to the same setting as LPT1
643 PUSH BX ;;
644 ;;
645 LEA SI,BUF.RNORMO ;;
646 LEA CX,BUF.BUFEND ;;
647 SUB CX,SI ;;
648 MOV BX,BUF.PRN_BUFO ;; where PRN buffer is
649 LEA DI,BUF.RNORMO ;;
650 PUSH CS ;;
651 POP ES ;;
652 PUSH CS ;;
653 POP DS ;;
654 REP MOVSB ;;
655 ;;
656 POP BX ;;
657 ;;
658BUF_MESSAGES : ;;
659 CMP BUF.BFLAG,BF_LPT3 ;; generate error message is this is
660 je last_round ;; the last LPTn
661 Jmp INIT_RETURN ;;
662 ;; ERROR messages will be generated
663 ;; at the end of initialization of all
664 ;; the LPT devices
665last_round : ;;
666 MOV AX,RESIDENT_END ;;
667 ADD AX,STACK_SIZE ;;
668 MOV RESIDENT_END,AX ;;
669 PUSH CS ;;
670 POP CX ;; CX=CS
671 SUB AX,Cx ;; additional segment required.
672CS_LOOP3: ;;
673 CMP AX,1000H ;;
674 JB CS_LPEND3 ;;
675 ADD CX,1000H ;;
676 SUB AX,1000H ;;
677 JMP CS_LOOP3 ;;
678 ;;
679CS_LPENd3: ;;
680 SHL AX,1 ;;
681 SHL AX,1 ;;
682 SHL AX,1 ;;
683 SHL AX,1 ;;
684 ;;
685 MOV RH.RH0_ENDO,AX ;; STACK !!!!!
686 MOV STACK_ALLOCATED,0 ;; from now on, internal stack is used
687 ;;
688 MOV AX,DID_STATUS ;; what is the DID combination ?
689 AND AX,DID_MATCH ;;
690 XOR AX,DID_FAIL ;;
691 ;;
692 AND AX,AX ;;
693 JNZ CODE_STAYED ;;
694; MOV RH.RH0_ENDO,0 ;; none of the devices are good
695 ;;
696 ;;
697CODE_STAYED : ;;
698 MOV DI,OFFSET TABLE ;;
699 push CS ;;
700 POP ES ;;
701 ;;
702 XOR CX,CX ;;
703MSG_LOOP : ;;
704 CMP CX,DEV_NUM ;;
705 JNB INIT_RETURN ;;
706 SHR AX,1 ;;
707 JC MSG_NEXT ;;
708 ;; this device in parse table is bad
709 PUSH DI ;;
710 PUSH CX ;;
711 PUSH AX ;;
712 PUSH BX ;; WGR ;AN000;
713 PUSH DX ;; WGR ;AN000;
714 ;;
715 MOV DI,PSE.PAR_OFF ;;
716 MOV SI,PSE.PAR_DNMO ;;
717 ;;
718 PUSH CS ;;
719 POP ES ;;
720 PUSH CS ;;
721 POP DS ;;
722 ;;
723 MOV CX,8 ;;
724 LEA SI,[SI].PAR_DNM ;;
725 MOV DI,SI ;;
726 MOV AL,' ' ;; WGR ;AN000;
727 CLD ;; WGR ;AN000;
728 REPNE SCASB ;; WGR ;AN000;
729 DEC DI ;; WGR ;AN000;
730 MOV BYTE PTR ES:[DI],ZERO ;; WGR ;AN000;
731 ;; 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;
741 ;; ;AN000;
742 POP DX ;; WGR ;AN000;
743 POP BX ;; WGR ;AN000;
744 POP AX ;;
745 POP CX ;;
746 POP DI ;;
747 ;;
748MSG_NEXT : ;;
749 INC CX ;;
750 INC DI ;;
751 INC DI ;;
752 JMP MSG_LOOP ;;
753 ;;
754 ;;
755INIT_RETURN : ;;
756 ;;
757 ;;
758 RET ;;
759 ;;
760INIT ENDP ;;
761;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
762;;
763;; Call by INIT to extract parameters for the deivce_id
764;;
765;; on rntry :
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
769;;
770;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
771 ;;
772 ;;
773DID_EXTRACT PROC ;;
774 ;;
775 PUSH DX ;;
776 ;;-----------------------------
777 ;; define the DID_parameters
778 PUSH BX ;;
779 ;;
780 MOV BX,DEV_NUM ;;
781 SUB BX,DX ;; order in the Parse table
782 add bx,bx ;; double to index [bx]
783 MOV DX,BX ;;
784 ;;
785 MOV AX,DS:[SI].FONTSZ ;;
786 MOV FSIZE[BX],AX ;; size of font buffer to be created
787 ;;
788 MOV AX,DS:[SI].HSLOTS ;;
789 CMP AX,HARDSL_MAX ;;
790 JNA LESS_HARDSL ;;
791 MOV INIT_CHK, 0010H ;; ERROR 0010H
792 POP BX ;;
793 JMP END_MATCH_BAD ;;
794LESS_HARDSL : ;;
795 CMP AX,DS:[SI].HWCPMIN ;;
796 JNB VALID_HARDSL ;;
797 MOV INIT_CHK, 0012H ;; ERROR 0012H
798 POP BX ;;
799 JMP END_MATCH_BAD ;;
800VALID_HARDSL : ;;
801 MOV HRMAX[BX],AX ;;
802 MOV CTMAX[BX],AX ;; will be reduced by the no. of hwcp
803 ;;
804 MOV AX,DS:[SI].RSLOTS ;;
805 CMP AX,RAMSL_MAX ;;
806 JNA LESS_RAMSL ;;
807 MOV INIT_CHK, 0011H ;; ERROR 0011H
808 POP BX ;;
809 JMP END_MATCH_BAD ;;
810LESS_RAMSL : ;;
811 MOV RMMAX[BX],AX ;; see also designate
812 ;;
813 MOV DESCO[BX],SI ;;
814 ;;
815 POP BX ;;
816 ;;----------------------------------
817 ;;
818 PUSH CX ;;
819 ;;
820HWCPgt: PUSH DI ;; get the hwcp
821 ;;
822 MOV DI,PSE.PAR_HWCPO ;;
823 MOV CX,PSE.PAR_HWCPL ;; no. of hwcp
824 AND CX,CX ;;
825 JNZ chk_hwcp ;;
826 push bx ;;
827 mov bx,dx ;;
828 MOV HRMAX[BX],CX ;;
829 MOV CX,DS:[SI].HWCPMIN ;;
830 SUB CTMAX[BX],CX ;; what is left becomes cartridge slot
831 pop bx ;;
832 JMP DESIGN ;;
833 ;; hwcp to be defined
834chk_hwcp: MOV AX,DS:[SI].HSLOTS ;; defined in printer_desc
835 CMP CX,AX ;;
836 JA BAD_MATCH2 ;;
837 CMP CX,HARDSL_MAX ;;
838 JNA HWCP_GOOD ;; jump if system error
839 MOV INIT_CHK,0003H ;; ERROR 0003
840 JMP END_MATCH ;;
841BAD_MATCH2: ;;
842 MOV INIT_CHK,0002H ;; ERROR 0002
843 JMP END_MATCH ;;
844 ;;
845HWCP_GOOD: ;; there are sufficient hard-slot for
846 ;; HWCP
847 PUSH SI ;; printer description table of TYPEID
848 PUSH BX ;;
849 ;;
850 MOV BX,DX ;;
851 MOV AX,CTMAX[BX] ;;
852 ;;
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 ;;
857MORE_THAN_HWCPMIN : ;;
858 SUB AX,CX ;;
859 POP CX ;;
860 mov HRMAX[BX],CX ;;
861 ;;
862 MOV CTMAX[BX],AX ;; no of cart-slot for designate
863 MOV SI,HARD_SLA[BX] ;; get the corresponding hard-slots
864 ;;
865 POP BX ;;
866 ;;
867 push bx ;;
868 push dx ;;
869 mov bx,si ;;
870 mov dx,cx ;;
871 mov reserved1,dx ;; IF THERE IS ANY REPETITIVE HWCP
872 mov reserved2,bx ;; IF THERE IS ANY REPETITIVE HWCP
873 ;;
874FILL_HWCP: ;;
875 AND CX,CX ;;
876 JZ DESIGN_P ;;
877 INC DI ;; next code page in PARSE table
878 INC DI ;;
879 MOV AX,ES:[DI] ;; get code page value
880 ;;
881 ;; IF THERE IS ANY REPETITIVE HWCP
882 push dx ;;
883 push bx ;;
884hwcp_norep : ;;
885 cmp ax,cs:[bx].slt_cp ;;
886 jne hwcp_repnext ;;
887 pop bx ;;
888 pop dx ;;
889 pop dx ;;
890 pop bx ;;
891 pop si ;;
892 jmp end_match ;;
893 ;;
894hwcp_repnext: ;;
895 inc bx ;;
896 inc bx ;;
897 inc bx ;;
898 inc bx ;;
899 dec dx ;;
900 jnz hwcp_norep ;;
901 pop bx ;;
902 pop dx ;;
903 ;;
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 ;;
909 INC SI ;;
910 INC SI ;; next slot
911 INC SI ;; next slot
912 INC SI ;; next slot
913 DEC CX ;;
914 JMP FILL_HWCP ;;
915DESIGN_P: ;;
916 pop dx ;;
917 pop bx ;;
918 POP SI ;;
919 ;;---------------------
920DESIGN: POP DI ;; get the designate no.
921 PUSH DI ;;
922 ;;
923 MOV DI,PSE.PAR_DESGO ;;
924 MOV AX,PSE.PAR_DESGL ;;
925 CMP AX,1 ;;
926 JA END_MATCH ;; there should have no font entry
927 AND AX,AX ;;
928 JZ DEF_RBUFMAX ;;
929 ;;
930 MOV AX,PSE.PAR_DESG ;;
931 AND AX,AX ;;
932 JZ DEF_RBUFMAX ;;
933 ;;
934 CMP CS:[SI].CLASS,1 ;;
935 JNE DESIG_NOt_CLASS1 ;;
936 ;;
937 PUSH BX ;; if there is any cartridge slot ?
938 PUSH AX ;;
939 MOV BX,DX ;;
940 MOV AX,ctmax[BX] ;;
941 AND AX,AX ;;
942 POP AX ;;
943 POP BX ;;
944 JZ END_MATCH ;; fail, as there is no physical RAM.
945 ;;
946 CMP AX,HARDSL_MAX ;; is the designate more than max ?
947 JA END_MATCH ;;
948 ;;
949 ;;
950 JMP DEF_RBUFMAX ;;
951 ;;
952 ;;
953 ;;
954DESIG_NOT_CLASS1 : ;;
955 PUSH BX ;; if there is any physical RAM slot ?
956 PUSH AX ;;
957 MOV BX,DX ;;
958 MOV AX,RMMAX[BX] ;;
959 AND AX,AX ;;
960 POP AX ;;
961 POP BX ;;
962 JZ END_MATCH ;; fail, as there is no physical RAM.
963 ;;
964 ;;
965 CMP AX,RAMSL_MAX ;; is the designate more than max ?
966 JA END_MATCH ;;
967 ;;
968DEF_RBUFMAX : ;;
969 PUSH BX ;;
970 MOV BX,DX ;;
971 MOV RBUMAX[BX],AX ;;
972 POP BX ;;
973 ;;
974 ;;
975PARAM : ;;
976;PARM: POP DI ;;
977; PUSH DI ;;
978;; MOV DI,PSE.PAR_PARMO ;;
979 ;;
980 ;,--------------------------
981 ;; GOOD device_id parameters
982 shr dx,1 ;;
983 MOV AX,DID_ONE ;;
984 MOV CX,DX ;;
985 AND CX,CX ;;
986 JZ NO_SHL ;;
987 SHL AX,CL ;;
988NO_SHL: OR DID_STATUS,AX ;; is defined
989 ;;-------------------------
990END_MATCH: POP DI ;; end of extract
991 POP CX ;;
992END_MATCH_BAD : ;;
993 POP DX ;;
994 ;;
995 RET ;;
996 ;;
997DID_EXTRACT ENDP ;;
998 ;;
999;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1000;;
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"
1003;;
1004;; at entry : CX = device order in parse table
1005;;
1006;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1007CHK_DID PROC ;;
1008 ;;
1009 push cx ;;
1010 push di ;;
1011 push dx ;;
1012 ;;
1013 MOV AX,DID_STATUS ;;
1014 ;;
1015 PUSH CX ;; order 0 to m
1016 POP DI ;;
1017 ADD DI,DI ;; indexing : [DI]
1018 ;;
1019 INC CX ;;
1020 SHR AX,CL ;; is the device parameter valid ?
1021 ;;
1022 JC DEFINE_BUFFER ;;
1023 JMP LPT_FAIL ;;--------------------------
1024 ;;
1025DEFINE_BUFFER : ;;
1026 ;; good device parameters as determined
1027 MOV AX,DESCO[DI] ;;
1028 MOV BUF.PDESCO,AX ;;
1029 ;;
1030 PUSH DI ;;
1031 MOV DI,AX ;;
1032 MOV AX,CS:[DI].CLASS ;;
1033 MOV BUF.PCLASS,AX ;;
1034 POP DI ;;
1035 ;;
1036 MOV AX,HARD_SLA[DI] ;; in the DID_EXTRACT
1037 MOV BUF.HARDSO,AX ;;
1038 ;;
1039 MOV AX,RAM_SLA[DI] ;;
1040 MOV BUF.RAMSO,AX ;;
1041 ;;
1042 MOV AX,HRMAX[DI] ;;
1043 MOV BUF.HARDMX,AX ;;
1044 ;;
1045 MOV AX,CTMAX[DI] ;;
1046 MOV BUF.HCARMX,AX ;;
1047 ;;
1048 ADD AX,HRMAX[DI] ;; defore "designate"
1049 MOV BUF.HSLMX,AX ;;
1050 ;;
1051 ;;
1052 MOV AX,RMMAX[DI] ;;
1053 MOV BUF.RAMMX,AX ;;
1054 ;;
1055 XOR AX,AX ;;
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.
1059 JNE CTL_LOOP ;;
1060 MOV CX,1 ;; class 1 printer has one control seq.
1061CTL_LOOP : ;;
1062 ADD AX,CTL_MAX ;;
1063 DEC AX ;; leave one byte for the length
1064 DEC CX ;;
1065 JNZ CTL_LOOP ;;
1066 MOV BUF.FSELMAX,AX ;;
1067 POP CX ;;
1068 ;;
1069 MOV AX,FSIZE[DI] ;;
1070 MOV BUF.FTSZPA,AX ;; FTSIZE in paragraph
1071 ;;
1072 PUSH AX ;;
1073 ;;
1074 MOV DX,4 ;;
1075FT_PARA: ;;
1076 ADD AX,AX ;;
1077 DEC DX ;;
1078 JNZ FT_PARA ;; font size
1079 MOV BUF.FTSIZE,AX ;; font size in bytes (used with.RBUFMX)
1080 ;;
1081 POP DX ;; FTSIZE in paragraph
1082 ;;
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"
1086 PUSH CX ;;
1087 ;;
1088 CMP BUF.PCLASS,1 ;; always create font buffer for class1
1089 JNE CLASS_NOT_1 ;;
1090 ;;
1091 AND CX,CX ;;
1092 JZ CLASS1_NOCX ;;
1093 ADD CX,BUF.HARDMX ;;
1094 MOV BUF.HSLMX,CX ;;
1095 JMP CLASS_NOT_1 ;;
1096 ;;
1097CLASS1_NOCX: ;;
1098 MOV CX,BUF.HSLMX ;;
1099 ;;
1100CLASS_NOT_1 : ;;
1101 AND CX,CX ;;
1102 JZ MULTIPLE_DONE ;;
1103 MOV AX,RESIDENT_END ;;
1104MULTIPLE_FT : ;;
1105 ADD AX,DX ;; allocate the font buffers at the end
1106 DEC CX ;; of the resident codes
1107 JNZ MULTIPLE_FT ;;
1108 ;;
1109 ;;
1110 MOV CX,RESIDENT_END ;;
1111 MOV BUF.FTSTART,CX ;;
1112 MOV RESIDENT_END,AX ;;
1113 ;;
1114 ;;
1115MULTIPLE_DONE : ;;
1116 POP CX ;; designate requested
1117 ;;
1118 CMP BUF.PCLASS,1 ;;
1119 JNE DEF_RBUF ;;
1120 ;; CLASS 1
1121 CMP BUF.HARDMX,0 ;;
1122 JE DEFBUF_DONE ;;
1123 ;;
1124 PUSH CX ;; STACKS...
1125 PUSH SI ;;
1126 PUSH DS ;;
1127 PUSH ES ;;
1128 PUSH DI ;;
1129 PUSH DX ;;
1130 ;;
1131 MOV DX,BUF.HARDMX ;;
1132 PUSH DX ;; STACK +1 -- # of HWCP
1133 ;;
1134 PUSH CS ;;
1135 POP DS ;;
1136 MOV BUF.RBUFMX,0 ;;
1137 MOV SI,BUF.PDESCO ;;
1138 MOV SI,CS:[SI].SELH_O ;;
1139 XOR CX,CX ;;
1140 MOV CL,CS:BYTE PTR [SI] ;;
1141 INC CX ;; including the length byte
1142 ;;
1143 MOV DI,BUF.FTSTART ;; control template
1144DEF_FTBUF: ;; fill the font buffer with the
1145 PUSH DI ;;
1146 POP ES ;;
1147 XOR DI,DI ;;
1148 ;;
1149 PUSH CX ;;
1150 PUSH SI ;;
1151 REP MOVSB ;;
1152 POP SI ;;
1153 POP CX ;;
1154 ;;
1155 PUSH ES ;;
1156 POP DI ;;
1157 ADD DI,BUF.FTszpa ;;
1158 DEC DX ;;
1159 JNZ DEF_FTBUF ;;
1160 ;;
1161 POP DX ;; STACK -1
1162 ;;
1163 MOV SI,BUF.HARDSO ;;
1164 MOV DI,BUF.FTSTART ;; define the HWCP values
1165DEF_FThwcp : ;;
1166 PUSH DI ;;
1167 POP ES ;;
1168 MOV DI,CTL5202_OFFS ;; offset to the HWCP words
1169 ;;
1170 MOV AX,CS:[SI].SLT_CP ;;
1171 MOV ES:WORD PTR [DI],AX ;;
1172 ;;
1173 INC SI ;;
1174 INC SI ;;
1175 INC SI ;;
1176 INC SI ;;
1177 ;;
1178 PUSH ES ;;
1179 POP DI ;;
1180 ADD DI,BUF.FTSZPA ;;
1181 DEC DX ;;
1182 JNZ DEF_FThwcp ;;
1183 ;;
1184 POP DX ;;
1185 POP DI ;;
1186 POP ES ;;
1187 POP DS ;;
1188 POP SI ;;
1189 POP CX ;;
1190 ;;
1191 JMP DEFBUF_DONE ;;
1192 ;;
1193 ;;
1194DEF_RBUF : ;;
1195 MOV BUF.RSLMX,CX ;; the no. of ram slots supported
1196 CMP CX,RMMAX[DI] ;;
1197 JNB DEFBUF_DONE ;;
1198 MOV AX,RMMAX[DI] ;;
1199 MOV BUF.RSLMX,AX ;; the max. of .RAMMX and .RBUFMX
1200 ;;
1201DEFBUF_DONE : ;;
1202 MOV BUF.STATE,CPSW ;; the LPTn is CPSW ----- STATE
1203 ;;
1204 CMP BUF.BFLAG,BF_PRN ;;
1205 JNE RET_CHK_DID ;;
1206 MOV AX,DID_BIT[DI] ;;
1207 MOV BUF.DID_PRN,AX ;;
1208 ;;
1209 ;;
1210 JMP RET_CHK_DID ;;
1211 ;;
1212LPT_FAIL: ;;
1213 ;;
1214 MOV BUF.STATE,NORMAL ;; the LPTn is NORMAL --- STATE
1215 ;;
1216 ;;
1217RET_CHK_DID: ;;
1218 ;;
1219 pop dx ;;
1220 pop di ;;
1221 pop cx ;;
1222 ;;
1223 RET ;;
1224 ;;
1225CHK_DID ENDP ;;
1226 ;;
1227;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1228;;
1229;; Called by INIT to check for consistency between duplicated device name and
1230;; between PRN and LPT1
1231;;
1232;; at entry : DI = pointer to PAR_DEVOT
1233;; BUF.STATE = any state
1234;; CX = DID order
1235;;
1236;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1237 ;;
1238DEV_CHECK PROC ;;
1239 ;;
1240 LEA SI,BUF.PAR_EXTRACTO ;;
1241 ;;
1242 PUSH CX ;;
1243 ;;
1244 PUSH SI ;; compare device id
1245 PUSH DI ;;
1246 mov SI,[SI].PAR_DIDO ;;
1247 MOV DI,PSE.PAR_DIDO ;;
1248 MOV CX,PSE.PAR_DNML ;;
1249 INC CX ;; including length
1250 INC CX ;;
1251 REPE CMPSB ;;
1252 POP DI ;;
1253 POP SI ;;
1254 Jz hwcp_check ;;
1255 mov init_chk,0021h ;; error 0021h
1256 Jmp FORCE_LPT_BAD ;;
1257 ;;
1258hwcp_check : ;;
1259 PUSH SI ;; compare HWCP
1260 PUSH DI ;;
1261 mov SI,[SI].PAR_HWCPO ;;
1262 MOV DI,PSE.PAR_HWCPO ;;
1263 MOV AX,PSE.PAR_HWCPL ;;
1264 MOV CX,2 ;;
1265 SHL AX,CL ;; multiply by two
1266 INC AX ;; including length
1267 INC AX ;;
1268 MOV CX,AX ;;
1269 REPE CMPSB ;;
1270 POP DI ;;
1271 POP SI ;;
1272 Jz desig_check ;;
1273 mov init_chk,0022h ;; error 0022h
1274 Jmp FORCE_LPT_BAD ;;
1275 ;;
1276desig_check : ;;
1277 PUSH SI ;; compare DESIGNATE
1278 PUSH DI ;;
1279 mov SI,[SI].PAR_DESGO ;;
1280 MOV DI,PSE.PAR_DESGO ;;
1281 MOV AX,PSE.PAR_DESGL ;;
1282 MOV CX,2 ;;
1283 SHL AX,CL ;; multiply by two
1284 INC AX ;; including length
1285 INC AX ;;
1286 MOV CX,AX ;;
1287 REPE CMPSB ;;
1288 POP DI ;;
1289 POP SI ;;
1290 Jz param_check ;;
1291 mov init_chk,0023h ;; error 0023h
1292 Jmp FORCE_LPT_BAD ;;
1293 ;;
1294param_check : ;;
1295 PUSH SI ;; compare parameters
1296 PUSH DI ;;
1297 mov SI,[SI].PAR_PARMO ;;
1298 MOV DI,PSE.PAR_PARMO ;;
1299 MOV CX,PSE.PAR_PARML ;;
1300 INC CX ;; including length
1301 INC CX ;;
1302 REPE CMPSB ;;
1303 POP DI ;;
1304 POP SI ;;
1305 JZ M_END ;;
1306 mov init_chk,0024h ;; error 0024h
1307 ;;
1308FORCE_LPT_BAD : ;; the second set of parameters is
1309 MOV BUF.STATE,NORMAL ;; bad
1310 ;;
1311 CMP BUF.BFLAG,BF_LPT1 ;;
1312 JNE M_END ;;
1313 ;;
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 ;;
1318 pop bx ;;
1319 ;;
1320 mov AX,BUF.DID_PRN ;; if PRN was not good, DID_PRN = 0
1321 OR DID_FAIL,AX ;;
1322 ;;
1323 ;;
1324M_END: ;; force the good did_status to fail if
1325 ;; STATE is bad
1326 POP CX ;;
1327 PUSH CX ;; order 0 to m
1328 MOV AX,DID_STATUS ;;
1329 ;;
1330 INC CX ;;
1331 SHR AX,CL ;;
1332 POP CX ;;
1333 JNC DEV_CHECK_RET ;; already failed
1334 ;;
1335 CMP BUF.STATE,CPSW ;;
1336 JE DEV_CHECK_RET ;;
1337 ;;
1338 PUSH BX ;;
1339 MOV BX,CX ;;
1340 ADD BX,BX ;;
1341 MOV AX,DID_BIT[BX] ;;
1342 OR DID_FAIL,AX ;; force DID to fail
1343 POP BX ;;
1344 ;;
1345 ;;
1346DEV_CHECK_RET : ;;
1347 ;;
1348 RET ;;
1349 ;;
1350 ;;
1351DEV_CHECK ENDP ;;
1352 ;;
1353;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1354 ;;
1355
1356;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1357;
1358; PROCEDURE_NAME: LOAD_INT2F
1359;
1360; FUNCTION:
1361; THIS PROCEDURE LOADS THE INTERRUPT HANDLER FOR INT2FH
1362;
1363; AT ENTRY:
1364;
1365; AT EXIT:
1366; NORMAL: INTERRUPT 2FH VECTOR POINTS TO INT2F_COM. OLD INT 2FH
1367; VECTOR STORED.
1368;
1369; ERROR: N/A
1370;
1371;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1372
1373SEMAPHORE DB 0 ;AN000;
1374 ;AN000;
1375LOAD_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;
1379 PUSH CX ; ;AN000;
1380 PUSH AX ; ;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;
1391 MOV AX,CS ; ;AN000;
1392 MOV CS:ROM_INT2F+2,AX ; ;AN000;
1393LI_0: ; ;AN000;
1394 CLI ; ;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;
1397 STI ; ;AN000;
1398 POP AX ; ;AN000;
1399 POP CX ; ;AN000;
1400 POP ES ; ;AN000;
1401 MOV CS:SEMAPHORE,1 ; now loaded. ;AN000;
1402LI_1: RET ; ;AN000;
1403LOAD_INT2F ENDP
1404
1405.XLIST
1406MSG_SERVICES <MSGDATA> ; WGR ;AN000;
1407MSG_SERVICES <DISPLAYmsg,LOADmsg,CHARmsg> ; WGR ;AN000;
1408MSG_SERVICES <PRINTER.CL1> ; WGR ;AN000;
1409MSG_SERVICES <PRINTER.CL2> ; WGR ;AN000;
1410MSG_SERVICES <PRINTER.CLA> ; WGR ;AN000;
1411.LIST
1412
1413include msgdcl.inc
1414
1415CSEG ENDS
1416 END