2 TITLE DOS
- GRAPHICS Command
- Profile
Load Modules
#2 ;AN000;
4 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
5 ;; DOS - GRAPHICS Command
6 ;; (C) Copyright 1988 Microsoft
8 ;; File Name: GRLOAD.ASM ;AN000;
11 ;; Description: ;AN000;
12 ;; ------------ ;AN000;
13 ;; This file contains the modules used to load the ;AN000;
14 ;; GRAPHICS profile into resident memory. ;AN000;
16 ;; ************* The EGA Dynamic Save Area will be built (by ;AN000;
17 ;; ** NOTE ** CHAIN_INTERRUPTS in file GRINST.ASM) over top of these ;AN000;
18 ;; ************* modules to avoid having to relocate this save just before ;AN000;
19 ;; terminating. This is safe since the maximum memory used is ;AN000;
20 ;; 288 bytes and the profile loading modules are MUCH larger than ;AN000;
21 ;; this. So GRLOAD.ASM MUST be linked before GRINST.ASM and after ;AN000;
22 ;; GRPRINT.ASM. ;AN000;
25 ;; Documentation Reference: ;AN000;
26 ;; ------------------------ ;AN000;
27 ;; PLACID Functional Specifications ;AN000;
28 ;; OASIS High Level Design ;AN000;
29 ;; OASIS GRAPHICS I1 Overview ;AN000;
31 ;; Procedures Contained in This File: ;AN000;
32 ;; ---------------------------------- ;AN000;
33 ;; LOAD_PROFILE - Main module for profile loading ;AN000;
35 ;; Include Files Required: ;AN000;
36 ;; ----------------------- ;AN000;
37 ;; ?????????? - Externals for profile loading modules ;AN000;
39 ;; External Procedure References: ;AN000;
40 ;; ------------------------------ ;AN000;
43 ;; Linkage Instructions: ;AN000;
44 ;; --------------------- ;AN000;
45 ;; Refer to GRAPHICS.ASM ;AN000;
47 ;; Change History: ;AN000;
48 ;; --------------- ;AN000;
51 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
54 CODE SEGMENT PUBLIC 'CODE' BYTE ;; ;AN000;
56 INCLUDE STRUC.INC ;; ;AN000;
57 INCLUDE GRINST
.EXT
;; Bring in external declarations ;AN000;
58 ;; for transient command processing ;AN000;
59 INCLUDE GRSHAR
.STR ;; ;AN000;
60 INCLUDE GRMSG
.EQU
;; ;AN000;
61 INCLUDE GRINST
.EXT
;; ;AN000;
62 INCLUDE GRLOAD
.EXT
;; ;AN000;
63 INCLUDE GRPARSE
.EXT
;; ;AN000;
64 INCLUDE GRPATTRN
.STR ;; ;AN000;
65 INCLUDE GRPATTRN
.EXT
;; ;AN000;
67 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
69 ;; Public Symbols ;AN000;
71 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
73 PUBLIC PARSE_VERB
;; ;AN000;
74 PUBLIC PARSE_PRINTER
;; ;AN000;
75 PUBLIC PARSE_DISPLAYMODE
;; ;AN000;
76 PUBLIC PARSE_PRINTBOX
;; ;AN000;
77 PUBLIC PARSE_SETUP
;; ;AN000;
78 PUBLIC PARSE_RESTORE
;; ;AN000;
79 PUBLIC TERMINATE_DISPLAYMODE
;; ;AN000;
80 PUBLIC TERMINATE_PRINTER
;; ;AN000;
81 PUBLIC CUR_PRINTER_TYPE
;; ;AN000;
83 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
85 ASSUME
CS:CODE,DS:CODE ;; ;AN000;
87 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
90 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
92 ;; Profile Load Variables ;AN000;
94 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
99 RESULT_BUFFER
LABEL BYTE ;; general purpose result buffer ;AN000;
100 DB ?
;; operand type ;AN000;
101 RESULT_TAG
DB 0 ;; operand tag ;AN000;
102 DW ?
;; pointer to synonym/keyword ;AN000;
103 RESULT_VAL
DB ?
,?
,?
,?
;; returned numeric value ;AN000;
105 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
107 ;; Module Name: ;AN000;
108 ;; TERMINATE_DISPLAYMODE ;AN000;
110 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
113 TERMINATE_DISPLAYMODE PROC
;; ;AN000;
115 MOV AX,STMTS_DONE
;; ;AN000;
116 .IF <PTD_FOUND
EQ YES
> AND ;; For the matched PTD ;AN000;
117 .IF <BIT
AX NAND BOX
> AND ;; issue "Invalid parm value" ;AN000;
118 .IF <PRT_BOX_ERROR
EQ NO
> ;; message if PRINTBOX ID not ;AN000;
119 ;; matched in each DISPLAYMODE section ;AN000;
120 PUSH AX ;; Save STMT_DONE flags ;AN000;
121 MOV AX,INVALID_PB
;; ;AN000;
123 CALL DISP_ERROR
;; ;AN000;
124 MOV BUILD_STATE
,NO
;; ;AN000;
125 MOV PRT_BOX_ERROR
,YES
;; Issue this message only once ;AN000;
128 AND AX,GR
;; Check for missing statements is last ;AN000;
129 .IF <AX NE GR
> ;; DISPLAYMODE section: ;AN000;
130 OR STMT_ERROR
,MISSING
;; GRAPHICS stmt is required ;AN000;
131 MOV PARSE_ERROR
,YES
;; ;AN000;
132 MOV BUILD_STATE
,NO
;; ;AN000;
139 TERMINATE_DISPLAYMODE ENDP
;; ;AN000;
141 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
143 ;; Module Name: ;AN000;
144 ;; TERMINATE_PRINTER ;AN000;
146 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
148 TERMINATE_PRINTER PROC
;; ;AN000;
150 MOV AX,BLOCK_END
;; ;AN000;
151 .IF <AX A MAX_BLOCK_END
> ;; Keep track of the largest PRINTER ;AN000;
152 MOV MAX_BLOCK_END
,AX ;; section so we can allow space for ;AN000;
153 .ENDIF
;; reload with a different printer ;AN000;
156 ;; Check for missing statements ;AN000;
157 MOV AX,STMTS_DONE
;; ;AN000;
158 AND AX,DISP
;; At least one DISPLAYMODE ;AN000;
159 .IF <AX NE DISP
> ;; must have been found in last ;AN000;
160 OR STMT_ERROR
,MISSING
;; PRINTER section ;AN000;
161 MOV PARSE_ERROR
,YES
;; ;AN000;
162 MOV BUILD_STATE
,NO
;; ;AN000;
167 TERMINATE_PRINTER ENDP
;; ;AN000;
169 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
171 ;; Module Name: ;AN000;
172 ;; PARSE_PRINTER ;AN000;
174 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
176 PRINTER_PARSE_PARMS
LABEL WORD ;; Parser control blocks ;AN000;
177 DW PRINTER_P
;; ;AN000;
178 DB 2 ;; # of lists ;AN000;
179 DB 0 ;; # items in delimeter list ;AN000;
180 DB 1 ;; # items in end-of-line list ;AN000;
181 DB ';' ;; ';' used for comments ;AN000;
183 PRINTER_P
DB 0,1 ;; Required, max parms ;AN000;
184 DW PRINTER_P1
;; ;AN000;
185 DB 0 ;; # Switches ;AN000;
186 DB 0 ;; # keywords ;AN000;
188 PRINTER_P1
DW 2000H
;; simple string ;AN000;
189 DW 0002H ;; Capitalize using character table ;AN000;
190 DW RESULT_BUFFER
;; Result buffer ;AN000;
191 DW PRINTER_P1V
;; Value list ;AN000;
192 DB 0 ;; Synomyms ;AN000;
194 PRINTER_P1V
DB 3 ;; # of value lists ;AN000;
195 DB 0 ;; # of range numerics ;AN000;
196 DB 0 ;; # of discrete numerics ;AN000;
197 DB 1 ;; # of strings ;AN000;
198 DB 1 ;; tag: index into verb jump table ;AN000;
199 PRINTER_P1V1
DW ?
;; string offset ;AN000;
202 CUR_PRINTER_TYPE
DB 0 ;; Type of printer currently being ;AN000;
203 ;; parsed: 1-color 2-b&w ;AN000;
205 PARSE_PRINTER PROC
;; ;AN000;
207 MOV CUR_STMT
,PRT
;; ;AN000;
208 MOV CUR_PRINTER_TYPE
,BLACK_WHITE
;; Assume black & white until we hit ;AN000;
209 ;; a COLORPRINT ;AN000;
211 .IF <BIT STMTS_DONE
AND PRT
> ;; If not the first PRINTER section ;AN000;
212 CALL TERMINATE_DISPLAYMODE
;; then clean up the last one and ;AN000;
213 CALL TERMINATE_PRINTER
;; the last DISPLAYMODE section. ;AN000;
216 MOV AX,FIRST_BLOCK
;; ;AN000;
217 MOV BLOCK_START
,AX ;; Reset block pointers to start ;AN000;
218 MOV BLOCK_END
,AX ;; of variable area ;AN000;
220 MOV STMTS_DONE
,PRT
;; Clear all bits except for PRT ;AN000;
221 MOV GROUPS_DONE
,0 ;; Clear ;AN000;
223 .IF <PTD_FOUND
EQ YES
> ;; PRINTER statement marks the end of ;AN000;
224 MOV PTD_FOUND
,PROCESSED
;; the previous PTD ;AN000;
225 MOV BUILD_STATE
,NO
;; Stop building shared data ;AN000;
228 MOV CL,TAB_DIR_NB_ENTRIES
;; Reset the pattern table copy ;AN000;
229 XOR CH,CH ;; pointers. These pointers ;AN000;
230 MOV BX,OFFSET TAB_DIRECTORY
;; are established when a pattern ;AN000;
231 .REPEAT ;; table is copied to the shared ;AN000;
232 MOV [BX].TAB_COPY
,-1 ;; data area. Initially they ;AN000;
233 ADD BX,SIZE TAB_ENTRY
;; are -1. ;AN000;
236 MOV AX,OFFSET PRINTER_TYPE_PARM
;; Store printer type from command ;AN000;
237 MOV PRINTER_P1V1
,AX ;; line in value list ;AN000;
238 MOV DI,OFFSET PRINTER_PARSE_PARMS
;; parse parms ;AN000;
239 ;; SI => the line to parse ;AN000;
243 XOR CX,CX ;; Don't worry about number of operands ;AN000;
244 CALL SYSPARSE
;; ;AN000;
245 .IF <AX EQ 9> ;; Syntax error is the only thing ;AN000;
246 OR STMT_ERROR
,INVALID
;; which can go wrong ;AN000;
247 MOV PARSE_ERROR
,YES
;; ;AN000;
248 MOV BUILD_STATE
,NO
;; ;AN000;
250 .UNTIL
<AX EQ 0> OR ;; ;AN000;
251 .UNTIL
<AX EQ -1> ;; ;AN000;
252 ;; Printer type parm matched one coded ;AN000;
253 ;; on the PRINTER statement ;AN000;
254 .IF <AX EQ 0> ;; ;AN000;
255 .IF <PTD_FOUND
EQ NO
> ;; ;AN000;
256 MOV PTD_FOUND
,YES
;; If the printer type matches and ;AN000;
257 .IF <PARSE_ERROR
EQ NO
> AND ;; no errors have been found yet ;AN000;
258 .IF <PRT_BOX_ERROR
EQ NO
> AND ;; ;AN000;
259 .IF <MEM_OVERFLOW
EQ NO
> ;; ;AN000;
260 MOV BUILD_STATE
,YES
;; then start building the shared ;AN000;
261 .ENDIF
;; data ;AN000;
263 .ELSE ;; No match ;AN000;
264 MOV BUILD_STATE
,NO
;; ;AN000;
265 .IF <AX NE
-1> ;; Error during parse ;AN000;
266 OR STMT_ERROR
,INVALID
;; set error flag for caller ;AN000;
267 MOV PARSE_ERROR
,YES
;; set error flag for caller ;AN000;
273 PARSE_PRINTER ENDP
;AN000;
277 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
279 ;; Module Name: ;AN000;
280 ;; PARSE_DISPLAYMODE ;AN000;
282 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
284 DISPMODE_PARSE_PARMS
LABEL WORD ;; Parser control blocks ;AN000;
285 DW DISPMODE_P
;; ;AN000;
286 DB 2 ;; # of lists ;AN000;
287 DB 0 ;; # items in delimeter list ;AN000;
288 DB 1 ;; # items in end-of-line list ;AN000;
289 DB ';' ;; ';' used for comments ;AN000;
291 DISPMODE_P
DB 0,1 ;; Required, max parms ;AN000;
292 DW DISPMODE_P1
;; ;AN000;
293 DB 0 ;; # Switches ;AN000;
294 DB 0 ;; # keywords ;AN000;
296 DISPMODE_P1
DW 8000H
;; Numeric ;AN000;
297 DW 0 ;; No Capitalize ;AN000;
298 DW RESULT_BUFFER
;; Result buffer ;AN000;
299 DW DISPMODE_P1V
;; Value list ;AN000;
300 DB 0 ;; Synomyms ;AN000;
302 DISPMODE_P1V
DB 1 ;; # of value lists ;AN000;
303 DB 1 ;; # of range numerics ;AN000;
305 DD 0,19 ;; range 0..19 ;AN000;
309 PARSE_DISPLAYMODE PROC
;; ;AN000;
311 MOV CUR_STMT
,DISP
;; ;AN000;
312 ;; Check for a preceeding PRINTER ;AN000;
313 .IF <BIT STMTS_DONE NAND PRT
> ;; ;AN000;
314 OR STMT_ERROR
,MISSING
;; ;AN000;
315 MOV PARSE_ERROR
,YES
;; ;AN000;
316 MOV BUILD_STATE
,NO
;; ;AN000;
320 .IF <BIT STMTS_DONE NAND DISP
> ;; If first DISPLAYMODE... ;AN000;
321 .IF <BUILD_STATE
EQ YES
> ;; ;AN000;
322 MOV AX,BLOCK_END
;; ;AN000;
323 MOV [BP].DISPLAYMODE_PTR
,AX ;; Set pointer to first DISPLAYMODE ;AN000;
324 MOV BLOCK_START
,AX ;; New block starts after last one ;AN000;
327 CALL TERMINATE_DISPLAYMODE
;; If not the first DISPLAYMODE then ;AN000;
328 ;; clean up the last one. ;AN000;
329 MOV DI,BLOCK_START
;; DI=pointer to DISPLAYMODE block just ;AN000;
330 MOV AX,BLOCK_END
;; built ;AN000;
331 .IF <BUILD_STATE
EQ YES
> ;; ;AN000;
332 MOV [BP+DI].NEXT_DISP_MODE
,AX ;; Add new block to DISPLAYMODE chain ;AN000;
334 MOV BLOCK_START
,AX ;; New block starts after last one ;AN000;
337 MOV AX,SIZE DISPLAYMODE_STR
;; Allocate space for new DISPLAYMODE ;AN000;
338 CALL GROW_SHARED_DATA
;; block ;AN000;
339 .IF <BUILD_STATE
EQ YES
> ;; ;AN000;
340 MOV DI,BLOCK_START
;; Start of new block ;AN000;
341 MOV [BP+DI].NUM_SETUP_ESC
,0 ;; SETUP, RESTORE are optional so set ;AN000;
342 MOV [BP+DI].NUM_RESTORE_ESC
,0 ;; to defaults ;AN000;
343 MOV [BP+DI].SETUP_ESC_PTR
,-1 ;; ;AN000;
344 MOV [BP+DI].RESTORE_ESC_PTR
,-1 ;; ;AN000;
345 MOV [BP+DI].BOX_WIDTH
,0 ;; ;AN000;
346 MOV [BP+DI].BOX_HEIGHT
,0 ;; ;AN000;
347 MOV [BP+DI].PRINT_OPTIONS
,0 ;; Default to NO print options ;AN000;
348 MOV [BP+DI].NUM_DISP_MODE
,0 ;; Get ready to INC this sucker ;AN000;
349 MOV [BP+DI].NEXT_DISP_MODE
,-1 ;; This is the last DISPLAYMODE for now! ;AN000;
350 MOV AX,BLOCK_END
;; ;AN000;
351 MOV [BP+DI].DISP_MODE_LIST_PTR
,AX;; Start mode list at end of new block ;AN000;
354 OR STMTS_DONE
,DISP
;; Indicate DISPLAYMODE found ;AN000;
355 AND STMTS_DONE
,NOT (BOX
+GR
+SET
+REST
) ;; Reset flags for PRINTBOX, GRAPHICS ;AN000;
356 ;; stmts found ;AN000;
357 AND GROUPS_DONE
,NOT (GR
+SET
+REST
) ;; Reset flags for GRAPHICS, SETUP, ;AN000;
358 ;; RESTORE groups processed ;AN000;
359 MOV DI,OFFSET DISPMODE_PARSE_PARMS
;; parse parms ;AN000;
360 ;; SI => the line to parse ;AN000;
364 CALL SYSPARSE
;; ;AN000;
365 .IF <AX EQ 0> ;; If mode is valid ;AN000;
367 MOV AX,1 ;; Add a mode to the list ;AN000;
368 CALL GROW_SHARED_DATA
;; Update block end ;AN000;
369 .IF <BUILD_STATE
EQ YES
> ;; ;AN000;
371 MOV DI,BLOCK_START
;; ;AN000;
372 INC [BP+DI].NUM_DISP_MODE
;; Bump number of modes in list ;AN000;
373 MOV DI,BLOCK_END
;; ;AN000;
374 MOV AL,RESULT_VAL
;; Get mode from result buffer ;AN000;
375 MOV [BP+DI-1],AL ;; Store the mode at end of list ;AN000;
380 .IF <AX NE
-1> ;; ;AN000;
381 OR STMT_ERROR
,INVALID
;; Mode is invalid ;AN000;
382 MOV PARSE_ERROR
,YES
;; ;AN000;
383 MOV BUILD_STATE
,NO
;; ;AN000;
386 .UNTIL
<AX EQ -1> ;; ;AN000;
390 PARSE_DISPLAYMODE ENDP
;AN000;
393 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
395 ;; Module Name: ;AN000;
396 ;; PARSE_SETUP ;AN000;
398 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
400 SETUP_PARSE_PARMS
LABEL WORD ;; Parser control blocks ;AN000;
401 DW SETUP_P
;; ;AN000;
402 DB 2 ;; # of lists ;AN000;
403 DB 0 ;; # items in delimeter list ;AN000;
404 DB 1 ;; # items in end-of-line list ;AN000;
405 DB ';' ;; ';' used for comments ;AN000;
407 SETUP_P
DB 0,1 ;; Required, max parms ;AN000;
408 DW SETUP_P1
;; ;AN000;
409 DB 0 ;; # Switches ;AN000;
410 DB 0 ;; # keywords ;AN000;
412 SETUP_P1
DW 08000H ;; Numeric ;AN000;
413 DW 0 ;; nO Capitalize ;AN000;
414 DW RESULT_BUFFER
;; Result buffer ;AN000;
415 DW SETUP_P1V
;; Value list ;AN000;
416 DB 0 ;; Synomyms ;AN000;
419 SETUP_P1V
DB 1 ;; # of value lists ;AN000;
420 DB 1 ;; # of range numerics ;AN000;
422 DD 0,255 ;; range 0..255 ;AN000;
425 PARSE_SETUP PROC
;; ;AN000;
427 MOV CUR_STMT
,SET
;; ;AN000;
428 .IF <BIT STMTS_DONE NAND DISP
> ;; DISPLAYMODE must preceed this ;AN000;
429 OR STMT_ERROR
,MISSING
;; ;AN000;
430 MOV PARSE_ERROR
,YES
;; ;AN000;
431 MOV BUILD_STATE
,NO
;; ;AN000;
434 .IF <BIT GROUPS_DONE
AND SET
> ;; Check for previous group of SETUP ;AN000;
435 OR STMT_ERROR
,SEQUENCE
;; stmts ;AN000;
436 MOV PARSE_ERROR
,YES
;; ;AN000;
437 MOV BUILD_STATE
,NO
;; ;AN000;
440 .IF <BIT STMTS_DONE NAND SET
> ;; If first SETUP... ;AN000;
441 .IF <BUILD_STATE
EQ YES
> ;; ;AN000;
442 MOV DI,BLOCK_START
;; ;AN000;
443 MOV AX,BLOCK_END
;; ;AN000;
444 MOV [BP+DI].SETUP_ESC_PTR
,AX ;; Set pointer to SETUP seq ;AN000;
445 MOV [BP+DI].NUM_SETUP_ESC
,0 ;; Init sequence size ;AN000;
449 OR STMTS_DONE
,SET
;; Indicate SETUP found ;AN000;
450 .IF <PREV_STMT NE SET
> THEN
;; Terminate any preceeding groups ;AN000;
451 MOV AX,PREV_STMT
;; except for SETUP group ;AN000;
452 OR GROUPS_DONE
,AX ;; ;AN000;
455 MOV DI,OFFSET SETUP_PARSE_PARMS
;; parse parms ;AN000;
456 ;; SI => the line to parse ;AN000;
460 CALL SYSPARSE
;; ;AN000;
461 .IF <AX EQ 0> ;; If esc byte is valid ;AN000;
463 MOV AX,1 ;; Add a byte to the sequence ;AN000;
464 CALL GROW_SHARED_DATA
;; Update block end ;AN000;
465 .IF <BUILD_STATE
EQ YES
> ;; ;AN000;
467 MOV DI,BLOCK_START
;; ;AN000;
468 INC [BP+DI].NUM_SETUP_ESC
;; Bump number of bytes in sequence ;AN000;
469 MOV DI,BLOCK_END
;; ;AN000;
470 MOV AL,RESULT_VAL
;; Get esc byte from result buffer ;AN000;
471 MOV [BP+DI-1],AL ;; Store at end of sequence ;AN000;
476 .IF <AX NE
-1> ;; ;AN000;
477 OR STMT_ERROR
,INVALID
;; parm is invalid ;AN000;
478 MOV PARSE_ERROR
,YES
;; ;AN000;
479 MOV BUILD_STATE
,NO
;; ;AN000;
482 .UNTIL
<AX EQ -1> NEAR ;; ;AN000;
485 PARSE_SETUP ENDP
;; ;AN000;
488 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
490 ;; Module Name: ;AN000;
491 ;; PARSE_RESTORE ;AN000;
493 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
495 RESTORE_PARSE_PARMS
LABEL WORD ;; Parser control blocks ;AN000;
496 DW RESTORE_P
;; ;AN000;
497 DB 2 ;; # of lists ;AN000;
498 DB 0 ;; # items in delimeter list ;AN000;
499 DB 1 ;; # items in end-of-line list ;AN000;
500 DB ';' ;; ';' used for comments ;AN000;
502 RESTORE_P
DB 0,1 ;; Required, max parms ;AN000;
503 DW RESTORE_P1
;; ;AN000;
504 DB 0 ;; # Switches ;AN000;
505 DB 0 ;; # keywords ;AN000;
507 RESTORE_P1
DW 08000H ;; Numeric ;AN000;
508 DW 0 ;; nO Capitalize ;AN000;
509 DW RESULT_BUFFER
;; Result buffer ;AN000;
510 DW RESTORE_P1V
;; Value list ;AN000;
511 DB 0 ;; Synomyms ;AN000;
514 RESTORE_P1V
DB 1 ;; # of value lists ;AN000;
515 DB 1 ;; # of range numerics ;AN000;
517 DD 0,255 ;; range 0..255 ;AN000;
520 PARSE_RESTORE PROC
;; ;AN000;
522 MOV CUR_STMT
,SET
;; ;AN000;
523 .IF <BIT STMTS_DONE NAND DISP
> ;; DISPLAYMODE must preceed this ;AN000;
524 OR STMT_ERROR
,MISSING
;; ;AN000;
525 MOV PARSE_ERROR
,YES
;; ;AN000;
526 MOV BUILD_STATE
,NO
;; ;AN000;
529 .IF <BIT GROUPS_DONE
AND REST
> ;; Check for previous group of RESTORE ;AN000;
530 OR STMT_ERROR
,SEQUENCE
;; stmts ;AN000;
531 MOV PARSE_ERROR
,YES
;; ;AN000;
532 MOV BUILD_STATE
,NO
;; ;AN000;
535 .IF <BIT STMTS_DONE NAND REST
> ;; If first RESTORE... ;AN000;
536 .IF <BUILD_STATE
EQ YES
> ;; ;AN000;
537 MOV DI,BLOCK_START
;; ;AN000;
538 MOV AX,BLOCK_END
;; ;AN000;
539 MOV [BP+DI].RESTORE_ESC_PTR
,AX ;; Set pointer to RESTORE seq ;AN000;
540 MOV [BP+DI].NUM_RESTORE_ESC
,0 ;; Init sequence size ;AN000;
544 OR STMTS_DONE
,REST
;; Indicate RESTORE found ;AN000;
545 .IF <PREV_STMT NE REST
> THEN
;; Terminate any preceeding groups ;AN000;
546 MOV AX,PREV_STMT
;; except for RESTORE group ;AN000;
547 OR GROUPS_DONE
,AX ;; ;AN000;
550 MOV DI,OFFSET RESTORE_PARSE_PARMS
;; parse parms ;AN000;
551 ;; SI => the line to parse ;AN000;
555 CALL SYSPARSE
;; ;AN000;
556 .IF <AX EQ 0> ;; If esc byte is valid ;AN000;
558 MOV AX,1 ;; Add a byte to the sequence ;AN000;
559 CALL GROW_SHARED_DATA
;; Update block end ;AN000;
560 .IF <BUILD_STATE
EQ YES
> ;; ;AN000;
562 MOV DI,BLOCK_START
;; ;AN000;
563 INC [BP+DI].NUM_RESTORE_ESC
;; Bump number of bytes in sequence ;AN000;
564 MOV DI,BLOCK_END
;; ;AN000;
565 MOV AL,RESULT_VAL
;; Get esc byte from result buffer ;AN000;
566 MOV [BP+DI-1],AL ;; Store at end of sequence ;AN000;
571 .IF <AX NE
-1> ;; ;AN000;
572 OR STMT_ERROR
,INVALID
;; parm is invalid ;AN000;
573 MOV PARSE_ERROR
,YES
;; ;AN000;
574 MOV BUILD_STATE
,NO
;; ;AN000;
577 .UNTIL
<AX EQ -1> NEAR ;; ;AN000;
580 PARSE_RESTORE ENDP
;; ;AN000;
583 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
585 ;; Module Name: ;AN000;
586 ;; PARSE_PRINTBOX ;AN000;
588 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
590 PRINTBOX_PARSE_PARMS
LABEL WORD ;; Parser control blocks ;AN000;
591 DW PRINTBOX_P
;; ;AN000;
592 DB 2 ;; # of lists ;AN000;
593 DB 0 ;; # items in delimeter list ;AN000;
594 DB 1 ;; # items in end-of-line list ;AN000;
595 DB ';' ;; ';' used for comments ;AN000;
597 PRINTBOX_P
DB 1,4 ;; Required, max parms ;AN000;
598 DW PRINTBOX_P0
;; LCD/STD ;AN000;
599 DW PRINTBOX_P1
;; width ;AN000;
600 DW PRINTBOX_P1
;; height ;AN000;
601 DW PRINTBOX_P2
;; rotate ;AN000;
602 DB 0 ;; # Switches ;AN000;
603 DB 0 ;; # keywords ;AN000;
605 PRINTBOX_P0
DW 2000H
;; sTRING - display type ;AN000;
606 DW 2 ;; Capitalize ;AN000;
607 DW RESULT_BUFFER
;; Result buffer ;AN000;
608 DW PRINTBOX_P0V
;; Value list ;AN000;
609 DB 0 ;; Synomyms ;AN000;
611 PRINTBOX_P0V
DB 3 ;; # of value lists ;AN000;
612 DB 0 ;; # of range numerics ;AN000;
613 DB 0 ;; # of discrete numerics ;AN000;
614 DB 1 ;; # of strings ;AN000;
616 PRINTBOX_P0V1
DW ?
;; string ;AN000;
618 PRINTBOX_P1
DW 8001H
;; Numeric - BOX DIMENSIONS ;AN000;
619 DW 0 ;; No Capitalize ;AN000;
620 DW RESULT_BUFFER
;; Result buffer ;AN000;
621 DW PRINTBOX_P1V
;; Value list ;AN000;
622 DB 0 ;; Synomyms ;AN000;
624 PRINTBOX_P1V
DB 1 ;; # of value lists ;AN000;
625 DB 1 ;; # of range numerics ;AN000;
627 DD 1,9 ;; range 1..9 ;AN000;
630 PRINTBOX_P2
DW 2001H
;; sTRING - ROTATE PARM ;AN000;
631 DW 2 ;; Capitalize ;AN000;
632 DW RESULT_BUFFER
;; Result buffer ;AN000;
633 DW PRINTBOX_P2V
;; Value list ;AN000;
634 DB 0 ;; Synomyms ;AN000;
636 PRINTBOX_P2V
DB 3 ;; # of value lists ;AN000;
637 DB 0 ;; # of range numerics ;AN000;
638 DB 0 ;; # of discrete numerics ;AN000;
639 DB 1 ;; # of strings ;AN000;
641 DW ROTATE_STR
;; string ;AN000;
642 ROTATE_STR
DB 'ROTATE',0 ;; ;AN000;
645 PROF_BOX_W
DB 0 ;; Box width and height extracted from ;AN000;
646 PROF_BOX_H
DB 0 ;; the profile ;AN000;
647 PRINTBOX_MATCH
DB 0 ;; ;AN000;
650 PARSE_PRINTBOX PROC
;; ;AN000;
652 MOV PRINTBOX_MATCH
,NO
;; Start out assuming the PRINTBOX ID ;AN000;
653 MOV PROF_BOX_W
,0 ;; does not match the one requested ;AN000;
654 MOV PROF_BOX_H
,0 ;; ;AN000;
655 MOV CUR_STMT
,BOX
;; ;AN000;
656 .IF <BIT STMTS_DONE NAND DISP
> ;; DISPLAYMODE must preceed PRINTBOX ;AN000;
657 OR STMT_ERROR
,MISSING
;; ;AN000;
658 MOV PARSE_ERROR
,YES
;; ;AN000;
659 MOV BUILD_STATE
,NO
;; ;AN000;
661 ;; Multiple PRINTBOX stmts may be coded ;AN000;
662 ;; We must decide if this one ;AN000;
663 ;; matches the requested display type ;AN000;
664 ;; If not, ignore the statement ;AN000;
665 MOV DI,OFFSET PRINTBOX_PARSE_PARMS
;; parse parms ;AN000;
666 ;; SI => the line to parse ;AN000;
670 MOV AX,PRINTBOX_ID_PTR
;; Insert requested display type in ;AN000;
671 MOV PRINTBOX_P0V1
,AX ;; parser value list ;AN000;
672 CALL SYSPARSE
;; PARSE display type ;AN000;
673 .IF <AX EQ 0> ;; If ID matches then set this flag. ;AN000;
674 MOV PRINTBOX_MATCH
,YES
;; ;AN000;
675 OR STMTS_DONE
,BOX
;; Indicate PRINTBOX found ;AN000;
676 MOV AX,PREV_STMT
;; Terminate any preceeding groups ;AN000;
677 OR GROUPS_DONE
,AX ;; ;AN000;
682 CALL SYSPARSE
;; PARSE horizontal dimension ;AN000;
683 .IF <AX EQ 0> ;; ;AN000;
684 MOV BL,RESULT_VAL
;; ;AN000;
685 MOV PROF_BOX_W
,BL ;; Save in local var ;AN000;
687 .IF <AX EQ -1> ;; ;AN000;
688 JMP PRINTBOX_DONE
;; ;AN000;
690 OR STMT_ERROR
,INVALID
;; ;AN000;
691 MOV PARSE_ERROR
,YES
;; ;AN000;
692 MOV BUILD_STATE
,NO
;; ;AN000;
696 CALL SYSPARSE
;; PARSE vertical dimension ;AN000;
697 .IF <AX EQ 0> ;; ;AN000;
698 MOV BL,RESULT_VAL
;; ;AN000;
699 MOV PROF_BOX_H
,BL ;; Save in local var ;AN000;
701 .IF <AX EQ -1> ;; ;AN000;
702 JMP PRINTBOX_DONE
;; ;AN000;
704 OR STMT_ERROR
,INVALID
;; ;AN000;
705 MOV PARSE_ERROR
,YES
;; ;AN000;
706 MOV BUILD_STATE
,NO
;; ;AN000;
710 CALL SYSPARSE
;; Parse ROTATE parm ;AN000;
711 .IF <AX EQ 0> ;; ;AN000;
712 .IF <BUILD_STATE
EQ YES
> AND ;; ;AN000;
713 .IF <PRINTBOX_MATCH
EQ YES
> ;; ;AN000;
715 MOV DI,BLOCK_START
;; ;AN000;
716 OR [BP+DI].PRINT_OPTIONS
,ROTATE
;; ;AN000;
720 .IF <AX EQ -1> ;; ;AN000;
721 JMP PRINTBOX_DONE
;; ;AN000;
723 OR STMT_ERROR
,INVALID
;; ;AN000;
724 MOV PARSE_ERROR
,YES
;; ;AN000;
725 MOV BUILD_STATE
,NO
;; ;AN000;
729 CALL SYSPARSE
;; CHECK FOR EXTRA PARMS ;AN000;
730 .IF <AX NE
-1> ;; ;AN000;
731 OR STMT_ERROR
,INVALID
;; ;AN000;
732 MOV PARSE_ERROR
,YES
;; ;AN000;
733 MOV BUILD_STATE
,NO
;; ;AN000;
737 PRINTBOX_DONE: ;; ;AN000;
739 .IF <BUILD_STATE
EQ YES
> AND ;; Store the PRINTBOX dimensions ;AN000;
740 .IF <PRINTBOX_MATCH
EQ YES
> ;; ;AN000;
741 PUSH DI ;; in the DISPLAYMODE block ;AN000;
742 MOV DI,BLOCK_START
;; ;AN000;
743 MOV AL,PROF_BOX_W
;; ;AN000;
744 MOV [BP+DI].BOX_WIDTH
,AL ;; ;AN000;
745 MOV AL,PROF_BOX_H
;; ;AN000;
746 MOV [BP+DI].BOX_HEIGHT
,AL ;; ;AN000;
749 ;; If we have a B&W printer then ;AN000;
750 ;; load the grey patterns for the ;AN000;
751 ;; requested print box size. ;AN000;
752 .IF <CUR_PRINTER_TYPE
EQ BLACK_WHITE
> NEAR ;AN000;
754 .IF <PROF_BOX_W NE
0> AND NEAR ;; Dimensions could also be 0 if the ;AN000;
755 .IF <PROF_BOX_H NE
0> NEAR ;; printbox ID does not apply to this;AN000;
756 ;; displaymode, so don't try for ;AN000;
757 ;; a pattern! ;AN000;
758 MOV BX,OFFSET TAB_DIRECTORY
;; ;AN000;
759 MOV CL,TAB_DIR_NB_ENTRIES
;; ;AN000;
761 MOV DI,BLOCK_START
;; ;AN000;
762 MOV AL,PROF_BOX_W
;; Requested box width ;AN000;
763 MOV AH,PROF_BOX_H
;; Requested box height ;AN000;
765 .IF <[BX].BOX_W_PAT
EQ AL> AND ;; ;AN000;
766 .IF <[BX].BOX_H_PAT
EQ AH> ;; ;AN000;
769 ADD BX,SIZE TAB_ENTRY
;; ;AN000;
772 .IF <ZERO
CX> ;; ;AN000;
773 OR STMT_ERROR
,INVALID
;; Unsupported box size ;AN000;
774 MOV PARSE_ERROR
,YES
;; ;AN000;
775 MOV BUILD_STATE
,NO
;; ;AN000;
776 .ELSE NEAR ;; Box size OK - pattern tab found ;AN000;
777 .IF <[BX].TAB_COPY NE
-1> ;; Pointer is NOT null if the table ;AN000;
778 MOV AX,[BX].TAB_COPY
;; has already been copied to ;AN000;
779 ;; the shared data area. ;AN000;
780 .IF <BUILD_STATE
EQ YES
> AND ;; Point to the copy. ;AN000;
781 .IF <PRINTBOX_MATCH
EQ YES
> ;; Establish pointer to table ONLY ;AN000;
782 MOV [BP+DI].PATTERN_TAB_PTR
,AX ;; if the PB ID matched. ;AN000;
783 MOV AL,[BX].NB_INT
;; Number of table entries (intensitie;AN000;
784 MOV [BP+DI].NUM_PATTERNS
,AL ;; ;AN000;
786 .ELSE ;; Otherwise we have to copy it. ;AN000;
787 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
788 ;; Copy the table even if the printbox ID didn't match! ;AN000;
789 ;; This is a simple way to reserve enough space to allow reloading ;AN000;
790 ;; with a different PRINTBOX ID specified on the command line. ;AN000;
791 ;; This scheme avoids storing ;AN000;
792 ;; duplicate tables but may reserve slightly more space ;AN000;
793 ;; (probably only a hundred bytes or so) than ;AN000;
794 ;; could ever be required. The optimal solution (too ;AN000;
795 ;; complicated!) would involve keeping running totals for each ;AN000;
796 ;; PRINTBOX ID coded. ;AN000;
797 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
799 MOV DI,BLOCK_END
;; Copy it onto the end of the ;AN000;
800 ;; current block ;AN000;
801 MOV DX,DI ;; Save start addr of the copy ;AN000;
802 MOV [BX].TAB_COPY
,DX ;; Store ptr to copy in the directory ;AN000;
803 MOV AX,[BX].TAB_SIZE
;; ;AN000;
804 CALL GROW_SHARED_DATA
;; Allocate room for the table ;AN000;
805 .IF <BUILD_STATE
EQ YES
> ;; ;AN000;
806 MOV CX,AX ;; Number of bytes to copy ;AN000;
807 PUSH SI ;; Save parse pointer ;AN000;
808 MOV SI,[BX].TAB_OFFSET
;; Source pointer ;AN000;
809 ADD DI,BP ;; make DI an absolute pointer (dest) ;AN000;
810 REP MOVSB ;; Move it! ;AN000;
812 .IF <PRINTBOX_MATCH
EQ YES
> ;; Establish pointer to table ONLY ;AN000;
813 MOV DI,BLOCK_START
;; Establish pointer in DISPLAYMODE;AN000;
814 MOV [BP+DI].PATTERN_TAB_PTR
,DX ;; info ;AN000;
815 MOV AL,[BX].NB_INT
;; Number of table entries (intens);AN000;
816 MOV [BP+DI].NUM_PATTERNS
,AL ;; ;AN000;
826 PARSE_PRINTBOX ENDP
;AN000;
829 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
831 ;; Module Name: ;AN000;
832 ;; PARSE_VERB ;AN000;
834 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
836 VERB_PARSE_PARMS
LABEL WORD ;; Parser control blocks to parse verb ;AN000;
837 DW VERB_P
;; Parser control blocks to parse verb ;AN000;
838 DB 2 ;; # of lists ;AN000;
839 DB 0 ;; # items in delimeter list ;AN000;
840 DB 1 ;; # items in end-of-line list ;AN000;
841 DB ';' ;; ';' used for comments ;AN000;
843 VERB_P
DB 0,1 ;; Required, max parms ;AN000;
844 DW VERB_P1
;; ;AN000;
845 DB 0 ;; # Switches ;AN000;
846 DB 0 ;; # keywords ;AN000;
848 VERB_P1
DW 2000H
;; simple string ;AN000;
849 DW 0002H ;; Capitalize using character table ;AN000;
850 DW RESULT_BUFFER
;; Result buffer ;AN000;
851 DW VERB_P1V
;; Value list ;AN000;
852 DB 0 ;; Synomyms ;AN000;
854 VERB_P1V
DB 3 ;; # of value lists ;AN000;
855 DB 0 ;; # of range numerics ;AN000;
856 DB 0 ;; # of discrete numerics ;AN000;
857 DB 9 ;; # of strings ;AN000;
858 DB 0 ;; tag: index into verb jump table ;AN000;
859 DW PRINTER_STRING
;; string offset ;AN000;
861 DW DISPLAYMODE_STRING
;; string offset ;AN000;
863 DW PRINTBOX_STRING
;; string offset ;AN000;
865 DW SETUP_STRING
;; string offset ;AN000;
867 DW RESTORE_STRING
;; string offset ;AN000;
869 DW GRAPHICS_STRING
;; string offset ;AN000;
871 DW COLORPRINT_STRING
;; string offset ;AN000;
873 DW COLORSELECT_STRING
;; string offset ;AN000;
875 DW DARKADJUST_STRING
;; string offset ;AN000;
876 PRINTER_STRING
DB 'PRINTER',0 ;; ;AN000;
877 DISPLAYMODE_STRING
DB 'DISPLAYMODE',0 ;; ;AN000;
878 PRINTBOX_STRING
DB 'PRINTBOX',0 ;; ;AN000;
879 SETUP_STRING
DB 'SETUP',0 ;; ;AN000;
880 RESTORE_STRING
DB 'RESTORE',0 ;; ;AN000;
881 GRAPHICS_STRING
DB 'GRAPHICS',0 ;; ;AN000;
882 COLORPRINT_STRING
DB 'COLORPRINT',0 ;; ;AN000;
883 COLORSELECT_STRING
DB 'COLORSELECT',0 ;; ;AN000;
884 DARKADJUST_STRING
DB 'DARKADJUST',0 ;; ;AN000;
887 PARSE_VERB PROC
;; ;AN000;
889 MOV DI,OFFSET VERB_PARSE_PARMS
;; parse parms ;AN000;
890 MOV SI,OFFSET STMT_BUFFER
;; the line to parse ;AN000;
893 CALL SYSPARSE
;; ;AN000;
894 .IF <AX EQ 0> ;; ;AN000;
895 MOV BL,RESULT_TAG
;; ;AN000;
896 XOR BH,BH ;; return tag in BX ;AN000;
898 .IF <AX NE
-1> ;; syntax error ;AN000;
899 OR STMT_ERROR
,INVALID
;; set error flag for caller ;AN000;
903 PARSE_VERB ENDP
;AN000;
905 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
907 LIMIT
LABEL NEAR ;; ;AN000;
910 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;