summaryrefslogtreecommitdiff
path: root/v4.0/src/CMD/GRAPHICS
diff options
context:
space:
mode:
authorGravatar Mark Zbikowski2024-04-25 21:24:10 +0100
committerGravatar Microsoft Open Source2024-04-25 22:32:27 +0000
commit2d04cacc5322951f187bb17e017c12920ac8ebe2 (patch)
tree80ee017efa878dfd5344b44249e6a241f2a7f6e2 /v4.0/src/CMD/GRAPHICS
parentMerge pull request #430 from jpbaltazar/typoptbr (diff)
downloadms-dos-main.tar.gz
ms-dos-main.tar.xz
ms-dos-main.zip
MZ is back!HEADmain
Diffstat (limited to 'v4.0/src/CMD/GRAPHICS')
-rw-r--r--v4.0/src/CMD/GRAPHICS/GRAPHICS.ASM76
-rw-r--r--v4.0/src/CMD/GRAPHICS/GRAPHICS.LNK15
-rw-r--r--v4.0/src/CMD/GRAPHICS/GRAPHICS.OB32
-rw-r--r--v4.0/src/CMD/GRAPHICS/GRAPHICS.PRO231
-rw-r--r--v4.0/src/CMD/GRAPHICS/GRAPHICS.SKL66
-rw-r--r--v4.0/src/CMD/GRAPHICS/GRBWPRT.ASM631
-rw-r--r--v4.0/src/CMD/GRAPHICS/GRBWPRT.EXT24
-rw-r--r--v4.0/src/CMD/GRAPHICS/GRCOLPRT.ASM1122
-rw-r--r--v4.0/src/CMD/GRAPHICS/GRCOLPRT.EXT25
-rw-r--r--v4.0/src/CMD/GRAPHICS/GRCOMMON.ASM858
-rw-r--r--v4.0/src/CMD/GRAPHICS/GRCOMMON.EXT32
-rw-r--r--v4.0/src/CMD/GRAPHICS/GRCPSD.ASM109
-rw-r--r--v4.0/src/CMD/GRAPHICS/GRCPSD.EXT24
-rw-r--r--v4.0/src/CMD/GRAPHICS/GRCTRL.ASM2162
-rw-r--r--v4.0/src/CMD/GRAPHICS/GRCTRL.EXT47
-rw-r--r--v4.0/src/CMD/GRAPHICS/GRCTRL.STR111
-rw-r--r--v4.0/src/CMD/GRAPHICS/GRINST.ASM973
-rw-r--r--v4.0/src/CMD/GRAPHICS/GRINST.EXT43
-rw-r--r--v4.0/src/CMD/GRAPHICS/GRINT2FH.ASM146
-rw-r--r--v4.0/src/CMD/GRAPHICS/GRINT2FH.EXT26
-rw-r--r--v4.0/src/CMD/GRAPHICS/GRLOAD.ASM840
-rw-r--r--v4.0/src/CMD/GRAPHICS/GRLOAD.EXT55
-rw-r--r--v4.0/src/CMD/GRAPHICS/GRLOAD2.ASM910
-rw-r--r--v4.0/src/CMD/GRAPHICS/GRLOAD2.EXT32
-rw-r--r--v4.0/src/CMD/GRAPHICS/GRLOAD3.ASM729
-rw-r--r--v4.0/src/CMD/GRAPHICS/GRLOAD3.EXT28
-rw-r--r--v4.0/src/CMD/GRAPHICS/GRMSG.EQU84
-rw-r--r--v4.0/src/CMD/GRAPHICS/GRPARMS.ASM717
-rw-r--r--v4.0/src/CMD/GRAPHICS/GRPARMS.EXT24
-rw-r--r--v4.0/src/CMD/GRAPHICS/GRPARSE.ASM87
-rw-r--r--v4.0/src/CMD/GRAPHICS/GRPARSE.EXT24
-rw-r--r--v4.0/src/CMD/GRAPHICS/GRPATTRN.ASM217
-rw-r--r--v4.0/src/CMD/GRAPHICS/GRPATTRN.EXT31
-rw-r--r--v4.0/src/CMD/GRAPHICS/GRPATTRN.STR125
-rw-r--r--v4.0/src/CMD/GRAPHICS/GRPRINT.EXT29
-rw-r--r--v4.0/src/CMD/GRAPHICS/GRSHAR.STR127
-rw-r--r--v4.0/src/CMD/GRAPHICS/MAKEFILE64
37 files changed, 10876 insertions, 0 deletions
diff --git a/v4.0/src/CMD/GRAPHICS/GRAPHICS.ASM b/v4.0/src/CMD/GRAPHICS/GRAPHICS.ASM
new file mode 100644
index 0000000..8b401b9
--- /dev/null
+++ b/v4.0/src/CMD/GRAPHICS/GRAPHICS.ASM
@@ -0,0 +1,76 @@
1 PAGE ,132 ;AN000;
2 TITLE DOS GRAPHICS Command - Command Entry Point
3 ;AN000;
4;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
5;; MS DOS GRAPHICS Command
6;; (C) Copyright 1988 Microsoft
7;; ;AN000;
8;; File Name: GRAPHICS.ASM ;AN000;
9;; ---------- ;AN000;
10;; ;AN000;
11;; Description: ;AN000;
12;; ------------ ;AN000;
13;; This file contains the GRAPHICS command entry point. ;AN000;
14;; A jump is made to the GRAPHICS_INSTALL procedure ;AN000;
15;; in file GRINST.ASM to begin installation processing. ;AN000;
16;; ;AN000;
17;; Documentation Reference: ;AN000;
18;; ------------------------ ;AN000;
19;; OASIS High Level Design ;AN000;
20;; OASIS GRAPHICS I1 Overview ;AN000;
21;; ;AN000;
22;; Procedures Contained in This File: ;AN000;
23;; ---------------------------------- ;AN000;
24;; None ;AN000;
25;; ;AN000;
26;; Include Files Required: ;AN000;
27;; ----------------------- ;AN000;
28;; GRINST.EXT - Externals for GRINST.ASM ;AN000;
29;; ;AN000;
30;; ;AN000;
31;; External Procedure References: ;AN000;
32;; ------------------------------ ;AN000;
33;; FROM FILE GRINST.ASM: ;AN000;
34;; GRAPHICS_INSTALL - Main module for installation. ;AN000;
35;; ;AN000;
36;; Linkage Instructions: ;AN000;
37;; -------------------- ;AN000;
38;; LINK GRAPHICS GRINT2FH GRPATTRN GRCTRL GRCPSD GRCOLPRT GRBWPRT ;AN000;
39;; GRINST GRPARSE grparms GRLOAD GRLOAD2 GRLOAD3; ;AN000;
40;; EXE2BIN GRAPHICS.EXE GRAPHICS.COM ;AN000;
41;; ;AN000;
42;; Change History: ;AN000;
43;; --------------- ;AN000;
44;; ;AN000;
45;; A000 - Denotes 4.00 level source. ;AN000;
46;; A001 - PTM1779 - invalid parm msg followed by garbage ;AN001;
47;; Module affected: GRPARMS.ASM ;AN001;
48;; A002 - PTM2666 - Release environment string before terminating. ;AN002;
49;; Module affected: GRINST.ASM ;AN002;
50;; A003 - PTM3915 - Change to include common copyright file.
51;; Module affected: GRAPHICS.ASM
52;; ;AN000;
53;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
54 ;; ;AN000;
55 ;; ;AN000;
56CODE SEGMENT PUBLIC 'CODE' ;; ;AN000;
57 ASSUME CS:CODE,DS:CODE ;; ;AN000;
58 ORG 100H ;; required for .COM ;AN000;
59 ;; ;AN000;
60 ;; ;AN000;
61 INCLUDE GRINST.EXT ;; Bring in external declarations ;AN000;
62 ;; for transient command processing ;AN000;
63START: ;; ;AN000;
64 ;; ;AN000;
65 JMP GRAPHICS_INSTALL ;; ;AN000;
66 ;; ;AN000;
67;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
68;;
69;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
70 ;;
71; INCLUDE COPYRIGH.INC ;; included in message services ;AN003;
72 ;; ;AN000;
73;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
74 ;AN000;
75CODE ENDS ;AN000;
76 END START ;AN000;
diff --git a/v4.0/src/CMD/GRAPHICS/GRAPHICS.LNK b/v4.0/src/CMD/GRAPHICS/GRAPHICS.LNK
new file mode 100644
index 0000000..6c3f5bb
--- /dev/null
+++ b/v4.0/src/CMD/GRAPHICS/GRAPHICS.LNK
@@ -0,0 +1,15 @@
1GRAPHICS+
2GRINT2FH+
3GRPATTRN+
4GRCTRL+
5GRCPSD+
6GRCOLPRT+
7GRBWPRT+
8GRINST+
9GRPARSE+
10grparms+
11GRLOAD+
12GRLOAD2+
13GRLOAD3
14GRAPHICS.EXE;
15 \ No newline at end of file
diff --git a/v4.0/src/CMD/GRAPHICS/GRAPHICS.OB b/v4.0/src/CMD/GRAPHICS/GRAPHICS.OB
new file mode 100644
index 0000000..a10128d
--- /dev/null
+++ b/v4.0/src/CMD/GRAPHICS/GRAPHICS.OB
@@ -0,0 +1,32 @@
1PRINTCODECODE_SEGژ( g
2R+2Z%uË&>}n&q;   "k&\-68:>ANDGmKoPV,e
3^_][YZX..
4t>u 3آ^_][YZXPRQSUWV$t >u<}P>uI>tB<~ <
5t/3ؠf"&t׋3t&>|
6t
7u ㋇3'>}?QYQ 2"u IKuJ}YBYQ 2">}
8ĈIKu߿3GGE$EEKI}ً
9׊
10YB;t}4ma!S*0_6<c\fqr__ĆXČ\Ę3Ě=Ġ3Ģ5ı"Ľ3Ŀ9=3k \O\ ZSoi#\:^>ZK@PmS:b^fZj\u|ŌŷoŻ\m !2-(3"-ML3<3$O2!#%'0
11xٜɠ3۹?>uR 2$uBZI}u&AZ+R 2$NB<| Nt N>uZA;uK1<2 \^2?VDmH8O^^n[ă6ĉĝ6Ġ[Ĥ6Ĩ\Į[IJ6ĸ6Ļ[Ŀ6m
12Q
13Q>u3۹?>uQYQ 2$uIuJ}Y+}&BYQ2 2$NI2Q<|
14NY22Q,
15,
16YNYB;uL3<3?U\w\)x1^BExNVSmW8\bxn^|xāĆwĝ6ĠĤxĭw6mooooMM}
17wMMX.$Т ymcb5WR?>uZR 3
18u>t 
19u&BNuI}tMZ|&QRV3ۺAt;~C^ZY4u}ǀZ3RP 3
20u>t "Xt BNuQYZA;u R̵QY332۴
21u >t
22F:uSR3Ҋ3ۃ>t'3OG}es3۸\3>t
23t C:uރ>t Z[2:t&QYQ 3
24u>t 
25u"INuJ}tEY}&GQRV3ۺt;~C^ZY4u} tǀYQP 3
26u>t "Xt INuڋYB;uĸ Q
27COLOR8COLOR4COLOR1COMPACTGRAPHICSTHERMAL/R/r/B/b/LCD/lcd. 2G O= tWV
28t'Q$<a|, :u FGIu. Y^_FF3Ҿ3I O= t3Wt_՜.-\)"03@-G#M[Vu%{%-Č-Ĕ#Ě#Ğ#ĭ.ij%Ĺ%6/6m8"3.o
296m6 D2JNX]=avXŀ!ŋ!Ř6Ŝ/Š6ŧ6Ů6Ŵ6ź6žX!6X6 V-.-"43D-K#Q[Vs%y%}-ƈ-Ɛ#Ɩ#ƚ#Ʃ.Ư%Ʒ%6/6m8"3.o6 m6@
30 ǒ_ǫ
31_  F[
32s.s.s.>u..󫸐..+ء..4..|w.tKu9..GF.D.E.D.E.D.E.D.E..t.O./.o.o.o..-
diff --git a/v4.0/src/CMD/GRAPHICS/GRAPHICS.PRO b/v4.0/src/CMD/GRAPHICS/GRAPHICS.PRO
new file mode 100644
index 0000000..5ccc7b2
--- /dev/null
+++ b/v4.0/src/CMD/GRAPHICS/GRAPHICS.PRO
@@ -0,0 +1,231 @@
1;----------------------------------------------------------------------------
2 ;DOS (C)Copyright 1988 Microsoft
3 ;Licensed Material - Program Property of Microsoft
4;----------------------------------------------------------------------------
5PRINTER GRAPHICS,THERMAL ;; 5152, 4201, 4202(8"), 5201-002(8"), 5202, 3812
6 ;; 4207, 4208, 5140
7
8 ; Maximum Print width: 8"
9 ; Horizontal BPI: 120 Vertical BPI: 72
10 ; SETUP Statements contain the following escape sequences:
11 ; 27,51,24 = set line spacing to 24/216
12 ; GRAPHICS Statements use ESC "L" with the last two bytes being
13 ; the data count (low,high)
14
15 DISPLAYMODE 4,5,13,19 ;; 320x200 > 6.7"x8.9" rotated
16 SETup 27,51,24
17 GRAPHICS 32,32,32,32,32,32,27,76,LOWCOUNT,HIGHCOUNT
18 PRINTBOX STD,4,2,ROTATE
19 PRINTBOX LCD,2,2,ROTATE
20
21 DISPLAYMODE 6,14 ;; 640x200 > 6.7"x8.9" rotated
22 SETup 27,51,24
23 GRAPHICS 32,32,32,32,32,32,27,76,LOWCOUNT,HIGHCOUNT
24 PRINTBOX STD,4,1,ROTATE
25 PRINTBOX LCD,2,1,ROTATE
26
27 DISPLAYMODE 15,16 ;; 640x350 > 5.8"x8.9" rotated
28 SETup 27,51,24
29 GRAPHICS 32,32,32,32,32,32,32,27,76,LOWCOUNT,HIGHCOUNT
30 PRINTBOX STD,2,1,ROTATE
31 PRINTBOX LCD ;; PC/Convertible doesn't support these modes
32
33 DISPLAYMODE 17,18 ;; 640x480 > 8"x8.9" rotated
34 SETup 27,51,24
35 GRAPHICS 27,76,LOWCOUNT,HIGHCOUNT
36 PRINTBOX STD,2,1,ROTATE
37 PRINTBOX LCD ;; PC/Convertible doesn't support these modes
38
39
40;---------------------------------------------------------------------------
41PRINTER COLOR8 ;; 5182 CMY Ribbon
42
43 ; Maximum Print width: 8"
44 ; Horizontal BPI: 168 in 1:1 aspect ratio, 140 in 5:6 aspect ratio
45 ; Vertical BPI: 84
46 ; SETUP Statements contain the following escape sequences:
47 ; 27,51,14 = set line spacing to 14/144
48 ; 27,110,[0|1] = 0 sets aspect ratio to 5:6, 1 sets it to 1:1
49 ; GRAPHICS Statements use ESC "L" with the last two bytes being
50 ; the data count (low,high)
51
52 COLORSELECT Y,27,121 ;; yellow band
53 COLORSELECT M,27,109 ;; magenta band
54 COLORSELECT C,27,99 ;; cyan band
55 COLORSELECT B,27,98 ;; black band
56 ;;
57 ;; Following RGB's represent the first 16
58 ;; screen colors.
59 ;; SCREEN COLOR PRINT COLOR
60 ;; ------------ -----------
61 COLORPRINT 0,0,0,B ;; BLACK BLACK
62 COLORPRINT 0,0,42,C ;; BLUE CYAN
63 COLORPRINT 0,42,0,Y,C ;; GREEN GREEN
64 COLORPRINT 0,42,42,C ;; CYAN CYAN
65 COLORPRINT 42,0,0,Y,M ;; RED RED
66 COLORPRINT 42,0,42,C,M ;; PURPLE PURPLE
67 COLORPRINT 42,21,0,Y,C,M ;; BROWN BROWN
68 COLORPRINT 42,42,42 ;; LOW WHITE WHITE (NOTHING)
69 COLORPRINT 21,21,21,B ;; GREY BLACK
70 COLORPRINT 21,21,63,C ;; HIGH BLUE CYAN
71 COLORPRINT 21,63,21,Y,C ;; HIGH GREEN GREEN
72 COLORPRINT 21,63,63,C ;; HIGH CYAN CYAN
73 COLORPRINT 63,21,21,Y,M ;; HIGH RED RED
74 COLORPRINT 63,21,63,M ;; MAGENTA MAGENTA
75 COLORPRINT 63,63,21,Y ;; YELLOW YELLOW
76 COLORPRINT 63,63,63 ;; HIGH WHITE WHITE (NOTHING)
77
78 COLORPRINT 42,42,0,Y ;; This statement maps the "yellow" in CGA
79 ;; palette 0 to yellow
80 ;;
81 DISPLAYMODE 4,5,13,19 ;; 320x200
82 SETUP 27,51,14,27,110,0 ;; aspect ratio = 5:6
83 GRAPHICS 32,32,32,32,27,76,LOWCOUNT,HIGHCOUNT
84 PRINTBOX STD,4,2,ROTATE
85 DISPLAYMODE 6,14 ;; 640x200
86 SETUP 27,51,14,27,110,0 ;; aspect ratio = 5:6
87 GRAPHICS 32,32,32,32,27,76,LOWCOUNT,HIGHCOUNT
88 PRINTBOX STD,4,1,ROTATE
89 DISPLAYMODE 15,16 ;; 640x350
90 SETUP 27,51,14,27,110,1 ;; aspect ratio = 1:1
91 GRAPHICS 32,32,32,32,27,76,LOWCOUNT,HIGHCOUNT
92 PRINTBOX STD,3,1,ROTATE
93 DISPLAYMODE 17,18 ;; 640x480
94 SETUP 27,51,14,27,110,1 ;; aspect ratio = 1:1
95 GRAPHICS 32,32,32,32,27,76,LOWCOUNT,HIGHCOUNT
96 PRINTBOX STD,2,1
97
98;---------------------------------------------------------------------------
99PRINTER COLOR4 ;; 5182 RGB Ribbon
100
101 ; Maximum Print width: 8"
102 ; Horizontal BPI: 168 in 1:1 aspect ratio, 140 in 5:6 aspect ratio
103 ; Vertical BPI: 84
104 ; SETUP Statements contain the following escape sequences:
105 ; 27,51,14 = set line spacing to 14/144
106 ; 27,110,[0|1] = 0 sets aspect ratio to 5:6, 1 sets it to 1:1
107 ; GRAPHICS Statements use ESC "L" with the last two bytes being
108 ; the data count (low,high)
109
110 COLORSELECT R,27,121 ;; red band
111 COLORSELECT G,27,109 ;; green band
112 COLORSELECT B,27,99 ;; blue band
113 COLORSELECT X,27,98 ;; black band
114 ;;
115 ;; Following RGB's represent the first 16
116 ;; screen colors.
117 ;; SCREEN COLOR PRINT COLOR
118 ;; ------------ -----------
119 COLORPRINT 0,0,0,X ;; BLACK BLACK
120 COLORPRINT 0,0,42,B ;; BLUE BLUE
121 COLORPRINT 0,42,0,G ;; GREEN GREEN
122 COLORPRINT 0,42,42,B ;; CYAN BLUE
123 COLORPRINT 42,0,0,R ;; RED RED
124 COLORPRINT 42,0,42,R ;; PURPLE RED
125 COLORPRINT 42,21,0,X ;; BROWN BLACK
126 COLORPRINT 42,42,42 ;; LOW WHITE WHITE (NOTHING)
127 COLORPRINT 21,21,21,X ;; GREY BLACK
128 COLORPRINT 21,21,63,B ;; HIGH BLUE BLUE
129 COLORPRINT 21,63,21,G ;; HIGH GREEN GREEN
130 COLORPRINT 21,63,63,B ;; HIGH CYAN BLUE
131 COLORPRINT 63,21,21,R ;; HIGH RED RED
132 COLORPRINT 63,21,63,R ;; MAGENTA RED
133 COLORPRINT 63,63,21 ;; YELLOW WHITE (NOTHING)
134 COLORPRINT 63,63,63 ;; HIGH WHITE WHITE (NOTHING)
135
136 COLORPRINT 42,42,0,B ;; This statement maps the "yellow" in CGA
137 ;; palette 0 to blue as was done in
138 ;; versions of GRAPHICS
139 ;;
140 DISPLAYMODE 4,5,13,19 ;; 320x200
141 SETUP 27,51,14,27,110,0 ;; aspect ratio = 5:6
142 GRAPHICS 32,32,32,32,27,76,LOWCOUNT,HIGHCOUNT
143 PRINTBOX STD,4,2,ROTATE
144 DISPLAYMODE 6,14 ;; 640x200
145 SETUP 27,51,14,27,110,0 ;; aspect ratio = 5:6
146 GRAPHICS 32,32,32,32,27,76,LOWCOUNT,HIGHCOUNT
147 PRINTBOX STD,4,1,ROTATE
148 DISPLAYMODE 15,16 ;; 640x350
149 SETUP 27,51,14,27,110,1 ;; aspect ratio = 1:1
150 GRAPHICS 32,32,32,32,27,76,LOWCOUNT,HIGHCOUNT
151 PRINTBOX STD,3,1,ROTATE
152 DISPLAYMODE 17,18 ;; 640x480
153 SETUP 27,51,14,27,110,1 ;; aspect ratio = 1:1
154 GRAPHICS 32,32,32,32,27,76,LOWCOUNT,HIGHCOUNT
155 PRINTBOX STD,2,1
156
157;---------------------------------------------------------------------------
158PRINTER GRAPHICSWIDE ;; 4202(13.5"), 5201-002(13.5")
159
160 ; Maximum Print width: 13.5"
161 ; Horizontal BPI: 120 Vertical BPI: 72
162 ; SETUP Statements contain the following escape sequences:
163 ; 27,88,1,255 = enable 13.5" printing
164 ; 27,51,24 = set line spacing to 24/216
165 ; 27,51,18 = set line spacing to 18/216 (320x200 MODES ONLY!!)
166 ; GRAPHICS Statements use ESC "L" with the last two bytes being
167 ; the data count (low,high)
168
169 DISPLAYMODE 4,5,13,19 ;; 320x200 > 10.7"x8.3" non-rotated
170 SETup 27,88,1,255,27,51,18
171 GRAPHICS 27,76,LOWCOUNT,HIGHCOUNT
172 PRINTBOX STD,4,3
173
174 DISPLAYMODE 6,14 ;; 640x200 - same as for 8" printing
175 SETup 27,88,1,255,27,51,24
176 GRAPHICS 27,76,LOWCOUNT,HIGHCOUNT
177 PRINTBOX STD,4,1,ROTATE
178
179 DISPLAYMODE 15,16 ;; 640x350 > 11.7"x17.8" rotated
180 SETup 27,88,1,255,27,51,24
181 GRAPHICS 27,76,LOWCOUNT,HIGHCOUNT
182 PRINTBOX STD,4,2,ROTATE
183
184 DISPLAYMODE 17,18 ;; 640x480 > 12"x17.8" rotated
185 SETup 27,88,1,255,27,51,24
186 GRAPHICS 27,76,LOWCOUNT,HIGHCOUNT
187 PRINTBOX STD,3,2,ROTATE
188
189;---------------------------------------------------------------------------
190PRINTER COLOR1 ;; 5182 with black ribbon
191
192 ; Maximum Print width: 8"
193 ; Horizontal BPI: 168 in 1:1 aspect ratio, 140 in 5:6 aspect ratio
194 ; Vertical BPI: 84
195 ; SETUP Statements contain the following escape sequences:
196 ; 27,51,14 = set line spacing to 14/144
197 ; 27,110,[0|1] = 0 sets aspect ratio to 5:6, 1 sets it to 1:1
198 ; GRAPHICS Statements use ESC "L" with the last two bytes being
199 ; the data count (low,high)
200
201 DARKADJUST 0 ; Code a positive number to lighten
202 ; printing. Suggested value = 10
203
204 DISPLAYMODE 4,5,13,19 ;; 320x200
205 SETUP 27,51,14,27,110,0 ;; aspect ratio = 5:6
206 GRAPHICS 32,32,32,32,32,32,27,76,LOWCOUNT,HIGHCOUNT
207 PRINTBOX STD,4,2,ROTATE
208 PRINTBOX LCD,2,2,ROTATE
209
210 DISPLAYMODE 6,14 ;; 640x200
211 SETUP 27,51,14,27,110,0 ;; aspect ratio = 5:6
212 GRAPHICS 32,32,32,32,32,32,27,76,LOWCOUNT,HIGHCOUNT
213 PRINTBOX STD,4,1,ROTATE
214 PRINTBOX LCD,2,1,ROTATE
215
216 DISPLAYMODE 15,16 ;; 640x350
217 SETUP 27,51,14,27,110,1 ;; aspect ratio = 1:1
218 GRAPHICS 32,32,32,32,32,27,76,LOWCOUNT,HIGHCOUNT
219 PRINTBOX STD,3,1,ROTATE
220 PRINTBOX LCD ;; PC/Convertible doesn't support these modes
221
222 DISPLAYMODE 17,18 ;; 640x480
223 SETUP 27,51,14,27,110,1 ;; aspect ratio = 1:1
224 GRAPHICS 32,32,32,32,27,76,LOWCOUNT,HIGHCOUNT
225 PRINTBOX STD,2,1
226 PRINTBOX LCD ;; PC/Convertible doesn't support these modes
227
228
229;===========================================================================
230; End of Profile
231;===========================================================================
diff --git a/v4.0/src/CMD/GRAPHICS/GRAPHICS.SKL b/v4.0/src/CMD/GRAPHICS/GRAPHICS.SKL
new file mode 100644
index 0000000..8e6dd15
--- /dev/null
+++ b/v4.0/src/CMD/GRAPHICS/GRAPHICS.SKL
@@ -0,0 +1,66 @@
1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
2;; MS DOS - GRAPHICS Command
3;; (c) Copyright 1988 Microsoft
4;; ;AN000;
5;; File Name: GRAPHICS.MSG ;AN000;
6;; ---------- ;AN000;
7;; ;AN000;
8;; DOS GRAPHICS Command - Message skeleton file
9;; ;AN000;
10;; Description: ;AN000;
11;; ------------ ;AN000;
12;; This file contains the skeleton file for using the DOS message ;AN000;
13;; retriever with GRAPHICS.COM ;AN000;
14;; ;AN000;
15;; This skeleton file is processed by "FASTBLD" in order to create ;AN000;
16;; the following message files wich are included from GRINST.ASM: ;AN000;
17;; ;AN000;
18;; GRAPHICS.CL1 ; Class 1 messages ;AN000;
19;; GRAPHICS.CL2 ; Class 2 messages ;AN000;
20;; GRAPHICS.CLA ; Class A messages ;AN000;
21;; ;AN000;
22;; Documentation Reference: ;AN000;
23;; ------------------------ ;AN000;
24;; DOS 3.3 Message Retriever Interface Supplement. ;AN000;
25;; DOS 3.3 Approved Functional Specification Message Supplement. ;AN000;
26;; ;AN000;
27;; External Procedure References: ;AN000;
28;; ------------------------------ ;AN000;
29;; FROM FILE GRINST.ASM: ;AN000;
30;; GRAPHICS_INSTALL - Main module for GRAPHICS install. ;AN000;
31;; (NOTE: Reference is made to the include file generated from this ;AN000;
32;; skeleton file). ;AN000;
33;; ;AN000;
34;; Change History: ;AN000;
35;; --------------- ;AN000;
36;; ;AC001 - Changed message 15 to match D307 request ;AN000;
37;; ;AN000;
38;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
39:util GRAPHICS ; Utility name ;AN000;
40 ;AN000;
41 ;AN000;
42:class A ; Class A messages (General messages) ;AN000;
43:use 1 COMMON1 ; 'Incorrect DOS version' ;AN000;
44:use 2 EXTEND8 ; 'Insufficient memory' ;AN000;
45 ;AN000;
46 ;AN000;
47:class B ; Class B messages: (Profile loading) ;AN000;
48:def 9 'Cannot find GRAPHICS profile',CR,LF ;AN000;
49:def 10 'Required profile statement missing before line %1',CR,LF ;AN000;
50:def 11 'Invalid profile statement on line %1',CR,LF ;AN000;
51:def 12 'Profile statement out of sequence on line %1',CR,LF ;AN000;
52:def 13 'Error reading GRAPHICS profile',CR,LF ;AN000;
53:def 14 'Syntax errors in GRAPHICS profile',CR,LF ;AN000;
54:def 15 'Printbox ID not in GRAPHICS profile',CR,LF ;AC001;
55:def 16 'Printer type not in GRAPHICS profile',CR,LF ;AN000;
56 ;AN000;
57:class C ; Class C messages: (Command line parsing) ;AN000;
58:use 3 PARSE1 ; 'Too many parameters' ;AN000;
59:use 4 PARSE6 ; 'Parameter value not allowed' ;AN000;
60:def 5 'Invalid parameter: %1',CR,LF ;AN000;
61:use 6 PARSE11 ; 'Invalid parameter combination' ;AN000;
62:def 7 'Duplicate parameters not allowed',CR,LF ;AN000;
63:use 8 PARSE8 ; 'Parameter format not correct' ;AN000;
64:def 17 '/B invalid with a black and white printer',CR,LF ;AN000;
65:def 18 'Unable to reload with profile supplied',CR,LF ;AN000;
66:end ;AN000;
diff --git a/v4.0/src/CMD/GRAPHICS/GRBWPRT.ASM b/v4.0/src/CMD/GRAPHICS/GRBWPRT.ASM
new file mode 100644
index 0000000..7b09ffd
--- /dev/null
+++ b/v4.0/src/CMD/GRAPHICS/GRBWPRT.ASM
@@ -0,0 +1,631 @@
1 PAGE ,132 ;AN000;
2 TITLE DOS GRAPHICS Command - Black and White printing modules
3;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
4;; DOS - GRAPHICS Command
5;; (c) Copyright 1988 Microsoft
6;; ;AN000;
7;; File Name: GRBWPRT.ASM ;AN000;
8;; ---------- ;AN000;
9;; ;AN000;
10;; Description: ;AN000;
11;; ------------ ;AN000;
12;; This file contains the code for printing a GRAPHICS screen on a ;AN000;
13;; BLACK and WHITE printer. ;AN000;
14;; ;AN000;
15;; Documentation Reference: ;AN000;
16;; ------------------------ ;AN000;
17;; OASIS High Level Design ;AN000;
18;; OASIS GRAPHICS I1 Overview ;AN000;
19;; ;AN000;
20;; Procedures Contained in This File: ;AN000;
21;; ---------------------------------- ;AN000;
22;; ;AN000;
23;; PRINT_BW_APA ;AN000;
24;; FILL_BUFFER ;AN000;
25;; INT2PAT ;AN000;
26;; PAT2BOX ;AN000;
27;; ;AN000;
28;; ;AN000;
29;; Include Files Required: ;AN000;
30;; ----------------------- ;AN000;
31;; GRCTRL.EXT - Externals for print screen control ;AN000;
32;; GRCTRL.STR - Structures and equates for print screen control ;AN000;
33;; GRPATTRN.STR - Structures for the printer patterns. ;AN000;
34;; ;AN000;
35;; GRSHAR.STR - Shared Data Area Structure ;AN000;
36;; ;AN000;
37;; STRUC.INC - Macros for using structured assembly language ;AN000;
38;; ;AN000;
39;; ;AN000;
40;; External Procedure References: ;AN000;
41;; ------------------------------ ;AN000;
42;; FROM FILE GRCTRL.ASM: ;AN000;
43;; PRT_SCR - Main module for printing the screen. ;AN000;
44;; TO FILE GRCOMMON.ASM ;AN000;
45;; Common modules - tools for printing a screen. ;AN000;
46;; ;AN000;
47;; Linkage Instructions: ;AN000;
48;; -------------------- ;AN000;
49;; This file is included by GRCTRL.ASM ;AN000;
50;; ;AN000;
51;; Change History: ;AN000;
52;; --------------- ;AN000;
53;; ;AN000;
54;; ;AN000;
55;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
56PAGE ;AN000;
57CODE SEGMENT PUBLIC 'CODE' ;AN000;
58 ASSUME CS:CODE,DS:CODE ;AN000;
59 ;AN000;
60 PUBLIC PRINT_BW_APA ;AN000;
61 PUBLIC LEN_OF_BW_MODULES ;AN000;
62 ;AN000;
63.XLIST ;AN000;
64INCLUDE GRCTRL.STR ; Stuctures needed ;AN000;
65INCLUDE GRSHAR.STR ; for both set of print modules ;AN000;
66INCLUDE GRPATTRN.STR ; ;AN000;
67INCLUDE GRCTRL.EXT ; Externals from PRT_SCR control module ;AN000;
68INCLUDE STRUC.INC ; ;AN000;
69 ;AN000;
70 PUBLIC PRINT_BW_APA ; Black and white modules, ;AN000;
71.LIST ;AN000;
72;===============================================================================;AN000;
73; ;AN000;
74; PRINT_BW_APA : PRINT A GRAPHIC MODE SCREEN ON A BLACK AND WHITE PRINTER ;AN000;
75; ;AN000;
76;-------------------------------------------------------------------------------;AN000;
77; ;AN000;
78; INPUT: BP = Offset of the shared data area ;AN000;
79; XLT_TAB = Color translation table ;AN000;
80; BIOS_INT_5H = Pointer to BIOS int 5h ;AN000;
81; ;AN000;
82; OUTPUT: PRINTER ;AN000;
83; ;AN000;
84;-------------------------------------------------------------------------------;AN000;
85; ;AN000;
86; DESCRIPTION: This procedure maps each pixel of the screen to a box ;AN000;
87; of dots on the printer. The box size depends on the screen resolution ;AN000;
88; and the number of bytes per printer line. It is chosen in order to ;AN000;
89; respect the screen ratio and is documented in each printer profile. ;AN000;
90; ;AN000;
91; For efficiency and space considerations, the print buffer does not ;AN000;
92; hold a full print line. Bytes representing pixels are printed as soon ;AN000;
93; as they are ready to be printed. However, the print buffer is wide ;AN000;
94; enough to hold complete boxes. ;AN000;
95; ;AN000;
96; The order for reading pixels off the screen is driven by the ;AN000;
97; order bytes are expected by the printer. To print the screen in its ;AN000;
98; original orientation we must begin reading it from the top left corner ;AN000;
99; and send the pixels line by line; to print it sideways, reading will ;AN000;
100; start from the bottom left corner and a "LINE" will now be a vertical ;AN000;
101; screen column read from bottom to top. ;AN000;
102; ;AN000;
103; There is more to it however, the printer head is printing a ;AN000;
104; vertical column of 8 dots at a time and each pixel read is mapped to ;AN000;
105; a box of dots that is less than 8 dots high (e.g., 2 cols x 1 row) ;AN000;
106; therefore, many boxes must be stored in the bytes sent to the printer. ;AN000;
107; ;AN000;
108; These boxes represent pixels that are one above each other on the ;AN000;
109; screen. We must read enough pixels on one column of the screen to use ;AN000;
110; all 8 bits of the vertical printer head (e.g., if the box size is 2x1 ;AN000;
111; then 8 pixels must be read and 2 bytes of the print buffer will be ;AN000;
112; filled). ;AN000;
113; ;AN000;
114; The PRINT BUFFER for any box size will be 8 bits high by "BOX ;AN000;
115; WIDTH" bits wide. ;AN000;
116; ;AN000;
117; After the buffer is filled, it is printed and the next "column" ;AN000;
118; of 8 pixels is read. Therefore, the screen is read "line by line" ;AN000;
119; where a line is 8 pixels high for a 2x1 box (4 pixels high for a 3x2 ;AN000;
120; box). ONE SUCH LINE IS CALLED A SCAN LINE. ;AN000;
121; ;AN000;
122PAGE ;AN000;
123; ;AN000;
124; A 350X200 screen mapping to a 3x2 box is read in the following order: ;AN000;
125; ;AN000;
126; SCREEN: ;AN000;
127; ;AN000;
128; column column . . . column ;AN000;
129; no. 0 no. 1 no. 349 ;AN000;
130; ͻ ;AN000;
131; scan 1(0,0) 5(0,1) 1397(0,349) ;AN000;
132; line 2(1,0) 6(1,1) . . . . . . . 1398(1,349) ;AN000;
133; no. 1 3(2,0) 7(2,1) 1399(2,349) ;AN000;
134; 4(3,0) 8(3,1) 1400(3,349) ;AN000;
135; ;AN000;
136; scan 1401(4,0) 1405(4,1) LEGEND: n(X,Y) ;AN000;
137; line 1402(5,0) etc, ;AN000;
138; no. 2 1403(6,0) . . . . . n = READ RANK ;AN000;
139; 1404(7,0) X = ROW NUMBER ;AN000;
140; . Y = COLUMN NUMBER ;AN000;
141; etc, . ;AN000;
142; . 70000(199,349) ;AN000;
143; ͼ ;AN000;
144; ;AN000;
145; ;AN000;
146; LOGIC : ;AN000;
147; ;AN000;
148; Initialize printer and local variables. ;AN000;
149; CALL LOC_MODE_PRT_INFO ; Get printer info related to current mode. ;AN000;
150; CALL GET_SCREEN_INFO ; Get info. about how to read the screen ;AN000;
151; CALL SETUP_PRT ; Set up the printer (Line spacing, etc) ;AN000;
152; ;AN000;
153; FOR each scan line on the screen (NB_SCAN_LINES) ;AN000;
154; (Note: One scan line maps to one print line) ;AN000;
155; BEGIN ;AN000;
156; CALL DET_CUR_SCAN_LNE_LENGTH ; Determine length in pels of the current ;AN000;
157; ; scan line. ;AN000;
158; IF CUR_SCAN_LNE_LENGTH NE 0 THEN ;AN000;
159; CALL NEW_PRT_LINE ; Initialize a new printer line ;AN000;
160; DO CUR_SCAN_LNE_LENGTH times ; For each column ;AN000;
161; BEGIN ;AN000;
162; CALL FILL_BUFFER ; Read top-down enough pels to fill the buffer ;AN000;
163; CALL PRINT_BUFFER ; Print the buffer ;AN000;
164; IF printing sideways THEN INC CUR_ROW ; Get coordinates of next ;AN000;
165; ELSE INC CUR_COLUMN ; "column" (vertical chunk of ;AN000;
166; END (for each column) ; a scan line). ;AN000;
167; PRINT_BYTE CR ; Print a CR and a LF ;AN000;
168; PRINT_BYTE LF ;AN000;
169; ; Get coordinates of next scan line: ;AN000;
170; IF printing sideways THEN ;AN000;
171; ADD CUR_COLUMN,NB_BOXES_PER_PRT_BUF ;AN000;
172; MOV CUR_ROW,SCREEN_HEIGHT - 1 ;AN000;
173; ELSE ;AN000;
174; ADD CUR_ROW,NB_BOXES_PER_PRT_BUF ;AN000;
175; MOV CUR_COLUMN,0 ;AN000;
176; END (for each scan line) ;AN000;
177; ;AN000;
178PRINT_BW_APA PROC NEAR ;AN000;
179 PUSH AX ;AN000;
180 PUSH BX ;AN000;
181 PUSH CX ;AN000;
182 ;AN000;
183;-------------------------------------------------------------------------------;AN000;
184; ;AN000;
185; INITIALIZATION: ;AN000;
186; ;AN000;
187; 1) Locate and extract printer DISPLAYMODE information from ;AN000;
188; the shared data area, calculate the number of boxes fitting ;AN000;
189; in the printer buffer. ;AN000;
190; 2) Determine where to start reading the screen: ;AN000;
191; If printing sideways, start in LOW LEFT corner. ;AN000;
192; If normal printing, start in TOP LEFT corner. ;AN000;
193; Determine the maximum length for a scan line: ;AN000;
194; If printing sideways, it is the height of the screen. ;AN000;
195; For normal printing, it is the width of the screen. ;AN000;
196; Determine the number of scan lines on the screen. ;AN000;
197; 3) Set up the Printer for printing Graphics. ;AN000;
198; ;AN000;
199;-------------------------------------------------------------------------------;AN000;
200 CALL LOC_MODE_PRT_INFO ; Get printer info related to curr. mode;AN000;
201; ;AN000;
202;-------Test if DISPLAYMODE info record was found: ;AN000;
203 .IF <ERROR_CODE EQ DISPLAYMODE_INFO_NOT_FOUND> ;AN000;
204 .THEN ;AN000;
205 MOV ERROR_CODE,UNABLE_TO_PRINT ; IF no record found, ;AN000;
206 JMP PRINT_BW_APA_END ; then, return error code ;AN000;
207 .ENDIF ; and quit procedure ;AN000;
208; ;AN000;
209;-------Get the box size from the DISPLAYMODE info record: ;AN000;
210 MOV BX,CUR_MODE_PTR ; BX := Offset current DISPLAYMODE info.;AN000;
211 MOV AH,[BX].BOX_WIDTH ; Take local copy of the box size. ;AN000;
212 MOV BOX_W,AH ; in BOX_W and BOX_H ;AN000;
213 MOV AL,[BX].BOX_HEIGHT ;AN000;
214 MOV BOX_H,AL ;AN000;
215; ;AN000;
216;-------Verify if the box size obtained from DISPLAYMODE info. is valid ;AN000;
217 .IF <ZERO AL> OR ; IF height of the box is 0 ;AN000;
218 .IF <ZERO AH> ; OR width of the box is 0 ;AN000;
219 .THEN ; THEN we can't print: ;AN000;
220 MOV ERROR_CODE,UNABLE_TO_PRINT ; return error code ;AN000;
221 JMP PRINT_BW_APA_END ; and quit ;AN000;
222 .ENDIF ;AN000;
223; ;AN000;
224;-------Get the Print Orientation from the DISPLAYMODE info record ;AN000;
225 .IF <[BX].PRINT_OPTIONS EQ ROTATE>; If printing sideways ;AN000;
226 .THEN ; then: ;AN000;
227 MOV ROTATE_SW,ON ; Rotate switch := "ON" ;AN000;
228 .ENDIF ;AN000;
229 ;AN000;
230; ;AN000;
231;-------Initialize print variables and the printer: ;AN000;
232 CALL GET_SCREEN_INFO ; Get info. about how to read the screen;AN000;
233 CALL SETUP_PRT ; Set up the printer (Line spacing, etc);AN000;
234 .IF <BIT ERROR_CODE NZ PRINTER_ERROR> ;AN000;
235 .THEN ; A printer error occurred: quit ;AN000;
236 JMP PRINT_BW_APA_END ; ;AN000;
237 .ENDIF ;AN000;
238 ;AN000;
239 MOV CX,NB_SCAN_LINES ;AN000;
240;-------------------------------------------------------------------------------;AN000;
241; ;AN000;
242; FOR EACH SCAN LINE ON THE SCREEN: ;AN000;
243; ;AN000;
244;-------------------------------------------------------------------------------;AN000;
245PRINT_1_SCAN_LINE: ;AN000;
246 CALL DET_CUR_SCAN_LNE_LENGTH ; Determine how many non-blanks on line ;AN000;
247.IF <CUR_SCAN_LNE_LENGTH NE 0> ; If line is not empty ;AN000;
248.THEN ; then, ;AN000;
249 CALL NEW_PRT_LINE ; Send escape sequence to the printer ;AN000;
250 .IF <BIT ERROR_CODE NZ PRINTER_ERROR> ; for starting a new line. ;AN000;
251 .THEN ; If a printer error occurred: ;AN000;
252 JMP PRINT_BW_APA_END ; Quit ! ;AN000;
253 .ENDIF ;AN000;
254 ;AN000;
255 PUSH CX ; Save scan line counter ;AN000;
256 MOV CX,CUR_SCAN_LNE_LENGTH ;AN000;
257;-------------------------------------------------------------------------------;AN000;
258; ;AN000;
259; FOR each column on the current scan line (up to the last non-blank): ;AN000;
260; ;AN000;
261;-------------------------------------------------------------------------------;AN000;
262PRINT_1_SCAN_COLUMN: ;AN000;
263 CALL FILL_BUFFER ; Read all pixels on this column, ;AN000;
264 ; convert each to a printer box, ;AN000;
265 ; store boxes in the print buffer ;AN000;
266 ; (a buffer contains one "column" ;AN000;
267 ; of pixels). ;AN000;
268 CALL PRINT_BUFFER ; Print the buffer. ;AN000;
269 .IF <BIT ERROR_CODE NZ PRINTER_ERROR> ;AN000;
270 .THEN ; A printer error occurred: ;AN000;
271 POP CX ; Restore scan line counter and quit ;AN000;
272 JMP PRINT_BW_APA_END ; ;AN000;
273 .ENDIF ;AN000;
274 ;AN000;
275 ;AN000;
276;-------Get coordinates of next "column": ;AN000;
277 .IF <ROTATE_SW EQ ON> ; If printing sideways ;AN000;
278 .THEN ; ;AN000;
279 DEC CUR_ROW ; then, get row above on screen ;AN000;
280 .ELSE ; ;AN000;
281 INC CUR_COLUMN ; else, get column next right ;AN000;
282 .ENDIF ; ;AN000;
283 ;AN000;
284 LOOP PRINT_1_SCAN_COLUMN ; Print next column ;AN000;
285 ;AN000;
286 POP CX ; Restore scan line counter ;AN000;
287.ENDIF ; Endif line is not empty ;AN000;
288;-------------------------------------------------------------------------------;AN000;
289; ;AN000;
290; Print a carriage return and a line feed: ;AN000;
291; ;AN000;
292;-------------------------------------------------------------------------------;AN000;
293 MOV AL,CR ;AN000;
294 CALL PRINT_BYTE ; Send CR ;AN000;
295 JC PRINT_BW_APA_END ; If printer error, leave ;AN000;
296 MOV AL,LF ;AN000;
297 CALL PRINT_BYTE ; Send LF ;AN000;
298 JC PRINT_BW_APA_END ; If printer error, leave ;AN000;
299;-------------------------------------------------------------------------------;AN000;
300; ;AN000;
301; Get coordinates of next scan line: ;AN000;
302; ;AN000;
303;-------------------------------------------------------------------------------;AN000;
304 .IF <ROTATE_SW EQ ON> ; If printing sideways ;AN000;
305 .THEN ; then: ;AN000;
306 MOV AL,NB_BOXES_PER_PRT_BUF ; AX := Numbers of pels read on row ;AN000;
307 CBW ; ;AN000;
308 ADD CUR_COLUMN,AX ; CUR_COLUMN + Number of pels read ;AN000;
309 MOV AX,SCREEN_HEIGHT ; CUR_ROW := SCREEN_HEIGHT - 1 ;AN000;
310 DEC AX ; ;AN000;
311 MOV CUR_ROW,AX ; ;AN000;
312 .ELSE ; else, printing NOT rotated: ;AN000;
313 MOV AL,NB_BOXES_PER_PRT_BUF ; AX := Number of pels read on colum;AN000;
314 CBW ; ;AN000;
315 ADD CUR_ROW,AX ; CUR_ROW + Number of pels read ;AN000;
316 MOV CUR_COLUMN,0 ; CUR_COLUMN := 0 ;AN000;
317 .ENDIF ; ;AN000;
318 LOOP PRINT_1_SCAN_LINE ; ;AN000;
319 ;AN000;
320;-------------------------------------------------------------------------------;AN000;
321; ;AN000;
322; Restore the printer. ;AN000;
323; ;AN000;
324;-------------------------------------------------------------------------------;AN000;
325 CALL RESTORE_PRT ;AN000;
326PRINT_BW_APA_END: ;AN000;
327 POP CX ;AN000;
328 POP BX ;AN000;
329 POP AX ;AN000;
330 RET ;AN000;
331PRINT_BW_APA ENDP ;AN000;
332PAGE ;AN000;
333;===============================================================================;AN000;
334; ;AN000;
335; FILL_BUFFER : READS ENOUGH PIXELS TO FILL UP THE PRINT BUFFER. ;AN000;
336; THESE PIXELS ARE MAPPED TO A PRINTER DOT BOX. ;AN000;
337; ;AN000;
338;-------------------------------------------------------------------------------;AN000;
339; ;AN000;
340; INPUT: CUR_COLUMN, ;AN000;
341; CUR_ROW = Coordinates of the first pixel to be read ;AN000;
342; BOXES_PER_PRT_BUF = Number of boxes fitting in the print ;AN000;
343; buffer ;AN000;
344; XLT_TAB = Color translation table ;AN000;
345; ;AN000;
346; OUTPUT: PRT_BUF = PRINT BUFFER ;AN000;
347; ;AN000;
348;-------------------------------------------------------------------------------;AN000;
349; ;AN000;
350; DESCRIPTION: ;AN000;
351; ;AN000;
352; 1) Pixels are read one by one vertically from top to bottom in ;AN000;
353; the current column of the screen scan line. ;AN000;
354; NOTE: What is called here a 'column' can actually be a line ;AN000;
355; on the physical display. ;AN000;
356; 2) Each pixel is mapped to a printer dot box. ;AN000;
357; 3) Each Dot box is stored in the printer buffer. ;AN000;
358; 4) The coordinates in input are those of the "top" pixel ;AN000;
359; and restored when leaving this procedure. ;AN000;
360; ;AN000;
361; ;AN000;
362; LOGIC: ;AN000;
363; ;AN000;
364; Save coordinates of the current "column" (slice of a screen scan line) ;AN000;
365; DO for BOXES_PER_PRT_BUF (8 / BOX_H) ;AN000;
366; BEGIN ;AN000;
367; CALL READ_DOT ; Read a pixel, get index in XLT_TAB ;AN000;
368; Get pixel intensity from XLT_TAB ;AN000;
369; CALL INT2PAT ; Locate pattern corresponding to int. ;AN000;
370; CALL PAT2BOX ; Extract box from pattern ;AN000;
371; CALL STORE_BOX ; Store the box in the printer buffer ;AN000;
372; ; Get coordinates of next pixel below: ;AN000;
373; IF printing is sideways THEN INC CUR_COLUMN ;AN000;
374; ELSE INC CUR_ROW ;AN000;
375; END ;AN000;
376; Restore initial coordinates. ;AN000;
377; ;AN000;
378FILL_BUFFER PROC NEAR ;AN000;
379 PUSH AX ;AN000;
380 PUSH BX ;AN000;
381 PUSH CX ;AN000;
382 PUSH SI ;AN000;
383 PUSH DI ;AN000;
384 ;AN000;
385;-------------------------------------------------------------------------------;AN000;
386; ;AN000;
387; Save initial coordinates: ;AN000;
388; ;AN000;
389;-------------------------------------------------------------------------------;AN000;
390 PUSH CUR_ROW ;AN000;
391 PUSH CUR_COLUMN ;AN000;
392 ;AN000;
393;-------Clear the print buffer: ;AN000;
394 XOR BX,BX ; For each byte in the PRT_BUF: ;AN000;
395CLEAR_PRT_BUF: ;AN000;
396 MOV PRT_BUF[BX],0 ; Initialize byte to blanks ;AN000;
397 INC BX ; Get next byte ;AN000;
398 CMP BL,BOX_W ; All bytes cleared ? ;AN000;
399 JL CLEAR_PRT_BUF ; No, clear next one. ;AN000;
400 ;AN000;
401 MOV BX,OFFSET XLT_TAB ; BX := Offset of XLT_TAB ;AN000;
402 ;AN000;
403;-------Fill the print buffer with one box for each pixel read: ;AN000;
404 XOR CX,CX ; CL := Number of pixels to read ;AN000;
405 MOV CL,NB_BOXES_PER_PRT_BUF ;AN000;
406;-------------------------------------------------------------------------------;AN000;
407; ;AN000;
408; For each pixel within the current column of the scan line: ;AN000;
409; ;AN000;
410;-------------------------------------------------------------------------------;AN000;
411READ_AND_STORE_1_PIXEL: ;AN000;
412 CALL READ_DOT ; AL := Index into translation table ;AN000;
413 XLAT XLT_TAB ; AL := Intensity ;AN000;
414 CALL INT2PAT ; SI := Offset of matching Pattern ;AN000;
415 CALL PAT2BOX ; Extract CUR_BOX from the pattern. ;AN000;
416 MOV SI,OFFSET CUR_BOX ; Store it in the PRT_BUF ;AN000;
417 CALL STORE_BOX ;AN000;
418 ;AN000;
419;-------Get coordinates of next pixel: ;AN000;
420 .IF <ROTATE_SW EQ ON> ; If printing sideways ;AN000;
421 .THEN ; ;AN000;
422 INC CUR_COLUMN ; then, increment column number ;AN000;
423 .ELSE ; ;AN000;
424 INC CUR_ROW ; else, increment row number ;AN000;
425 .ENDIF ; ;AN000;
426 LOOP READ_AND_STORE_1_PIXEL ;AN000;
427 ;AN000;
428;-------------------------------------------------------------------------------;AN000;
429; ;AN000;
430; Restore initial coordinates: ;AN000;
431; ;AN000;
432;-------------------------------------------------------------------------------;AN000;
433 POP CUR_COLUMN ;AN000;
434 POP CUR_ROW ;AN000;
435 ;AN000;
436 POP DI ;AN000;
437 POP SI ;AN000;
438 POP CX ;AN000;
439 POP BX ;AN000;
440 POP AX ;AN000;
441 RET ;AN000;
442FILL_BUFFER ENDP ;AN000;
443PAGE ;AN000;
444;===============================================================================;AN000;
445; ;AN000;
446; INT2PAT : MAP AN INTENSITY TO A PATTERN. ;AN000;
447; ;AN000;
448;-------------------------------------------------------------------------------;AN000;
449; ;AN000;
450; INPUT: AL = GREY INTENSITY (0 - 63 = BLACK to WHITE) ;AN000;
451; BOX_W = Number of columns in a box ;AN000;
452; CUR_MODE_PTR = Offset of current DISPLAYMODE info record ;AN000;
453; ;AN000;
454; OUTPUT: SI = OFFSET OF THE PATTERN MATCHING THE INTENSITY ;AN000;
455; ;AN000;
456;-------------------------------------------------------------------------------;AN000;
457; ;AN000;
458; DESCRIPTION: Performs a sequential search in the table of patterns ;AN000;
459; until the proper pattern is found. ;AN000;
460; ;AN000;
461; ;AN000;
462; SI = 0 ; FOUND = FALSE ;AN000;
463; DO UNTIL FOUND = TRUE ;AN000;
464; BEGIN ;AN000;
465; IF AL <= Maximum intensity of the current pattern in the table ;AN000;
466; THEN ;AN000;
467; FOUND = TRUE ;AN000;
468; ELSE ;AN000;
469; SI = SI + (BOX_W * 2) ;AN000;
470; END ;AN000;
471; ;AN000;
472INT2PAT PROC NEAR ;AN000;
473 PUSH AX ;AN000;
474 PUSH BX ;AN000;
475 PUSH DX ;AN000;
476 ;AN000;
477;-------Calculate the size in bytes of one pattern STRUCTURE: (see GRPATTRN.STR);AN000;
478 MOV DL,BOX_W ; DX := Number of columns in the box ;AN000;
479 XOR DH,DH ;AN000;
480 SHL DL,1 ; (DX * 2) = Number of columns in the pattern ;AN000;
481 INC DL ; DL := Size in bytes of one pattern ;AN000;
482 ; (includes intensity field) ;AN000;
483 MOV BX,CUR_MODE_PTR ; BX := Offset of current mode ;AN000;
484 ; SI := Offset of the first pattern ;AN000;
485 MOV SI,[BX].PATTERN_TAB_PTR ;AN000;
486 ADD SI,BP ;AN000;
487 ;AN000;
488COMPARE_INTENSITY: ;AN000;
489 CMP AL,[SI] ; Within the range of this pattern ? ;AN000;
490 JLE FOUND_PATTERN ; Yes, use this pattern. ;AN000;
491 ; No, look at next pattern: ;AN000;
492 ADD SI,DX ; SI := SI + Number columns in pattern) ;AN000;
493 JMP SHORT COMPARE_INTENSITY ;AN000;
494 ;AN000;
495FOUND_PATTERN: ;AN000;
496 ;AN000;
497 POP DX ;AN000;
498 POP BX ;AN000;
499 POP AX ;AN000;
500 RET ;AN000;
501 ;AN000;
502INT2PAT ENDP ;AN000;
503PAGE ;AN000;
504;===============================================================================;AN000;
505; ;AN000;
506; PAT2BOX : SELECT AND EXTRACT THE PROPER BOX FROM THE PATTERN ACCORDING ;AN000;
507; TO THE COORDINATES OF THE PIXEL. ;AN000;
508; ;AN000;
509;-------------------------------------------------------------------------------;AN000;
510; ;AN000;
511; INPUT: SI = OFFSET OF CURRENT PATTERN ;AN000;
512; CUR_COLUMN, ;AN000;
513; CUR_ROW = COORDINATES OF THE CURRENT PIXEL ;AN000;
514; ;AN000;
515; OUTPUT: CUR_BOX = PORTION OF THE PATTERN TO BE PRINTED ;AN000;
516; ;AN000;
517;-------------------------------------------------------------------------------;AN000;
518; ;AN000;
519; DESCRIPTION: If the pixel is on even-even coordinates, then the ;AN000;
520; top-left box of the pattern is extracted. ;AN000;
521; If its Even-odd --> extract the top-right box. ;AN000;
522; Odd-even --> low-left box, and Odd-odd --> low-right box. ;AN000;
523; ;AN000;
524PAGE ;AN000;
525; For example., (with a 3x2 box): ;AN000;
526; ;AN000;
527; PATTERN (over 6 bytes): ;AN000;
528; ;AN000;
529; ;AN000;
530; byte1 byte2 byte3 byte4 byte5 byte6 ;AN000;
531; ;AN000;
532; 0 0 0 0 0 0 ;AN000;
533; 0 0 0 0 0 0 ;AN000;
534; 0 0 0 0 0 0 ;AN000;
535; 0 0 0 0 0 0 ;AN000;
536; even-even --> dot1 dot2 dot3 | dot1 dot2 dot3 <-- even-odd ;AN000;
537; (row-column) dot4 dot5 dot6 | dot4 dot5 dot6 box ;AN000;
538; box. ------------------------------------------------ ;AN000;
539; odd-even --> dot1 dot2 dot3 | dot1 dot2 dot3 <-- odd-odd ;AN000;
540; box dot4 dot5 dot6 | dot4 dot5 dot6 box ;AN000;
541; ;AN000;
542; ;AN000;
543; The selected box is then stored as follow: ;AN000;
544; ;AN000;
545; CUR_BOX: ;AN000;
546; byte1 byte2 byte3 ;AN000;
547; MSB ------> 0 0 0 ;AN000;
548; (bit7) 0 0 0 ;AN000;
549; 0 0 0 ;AN000;
550; 0 0 0 ;AN000;
551; 0 0 0 ;AN000;
552; 0 0 0 ;AN000;
553; dot1 dot2 dot3 <-- box ;AN000;
554; LSB ------>dot4 dot5 dot6 ;AN000;
555; ;AN000;
556; LOGIC: ;AN000;
557; IF CUR_ROW is odd ;AN000;
558; THEN SI := SI + BOX_W ; Access right portion of pattern ;AN000;
559; Build a bit mask in BL of BOX_H bits, right justified. ;AN000;
560; FOR each column in the box (BOX_W) ;AN000;
561; Get the pattern column in AL ;AN000;
562; IF CUR_COLUMN is even ;AN000;
563; THEN ;AN000;
564; Move down the column of the top box. ;AN000;
565; AND BL,AL ; BL <-- Column of the desired box ;AN000;
566; ;AN000;
567; ;AN000;
568PAT2BOX PROC NEAR ;AN000;
569 PUSH AX ;AN000;
570 PUSH BX ;AN000;
571 PUSH CX ;AN000;
572 PUSH SI ;AN000;
573 ;AN000;
574 ; SI := Offset of current pattern ;AN000;
575 INC SI ; Skip the MAX INTENSITY field ;AN000;
576;-------------------------------------------------------------------------------;AN000;
577; ;AN000;
578; Set SI to either the left or right set of 2 boxes in the pattern: ;AN000;
579; ;AN000;
580;-------------------------------------------------------------------------------;AN000;
581 TEST CUR_ROW,1 ; Odd row ? ;AN000;
582 JZ EXTRACT_BOX ; No, access left portion of pattern ;AN000;
583 MOV AL,BOX_W ; ;AN000;
584 CBW ; ;AN000;
585 ADD SI,AX ; Yes, access right portion of pattern;AN000;
586 ;AN000;
587;-------------------------------------------------------------------------------;AN000;
588; ;AN000;
589; Extract the box: ;AN000;
590; ;AN000;
591;-------------------------------------------------------------------------------;AN000;
592EXTRACT_BOX: ;AN000;
593;-------Build a bit mask that will be used to keep only BOX_H bits ;AN000;
594;-------of the bytes where CUR_BOX is stored. ;AN000;
595 XOR AH,AH ; AH := Box column bit mask ;AN000;
596 MOV AL,BOX_H ; For each row of the box: ;AN000;
597INIT_MASK: ; ;AN000;
598 SHL AH,1 ; ;AN000;
599 OR AH,1 ; Insert one bit in the mask. ;AN000;
600 DEC AL ; ;AN000;
601 CMP AL,0 ; ;AN000;
602 JG INIT_MASK ;AN000;
603 ;AN000;
604 XOR BX,BX ; BL := Column number within the box ;AN000;
605; ;AN000;
606;-------For each column of the box: ;AN000;
607EXTRACT_1_BOX_COLUMN: ;AN000;
608 MOV AL,[SI] ; AL := Current column of pattern ;AN000;
609 TEST CUR_COLUMN,1 ; If the pixel is on ODD column ;AN000;
610 JNZ BOTTOM_BOX ; Then, need bottom box portion ;AN000;
611 MOV CL,BOX_H ; Else, need top box portion ;AN000;
612TOP_BOX: ; Need top box: ;AN000;
613 SHR AL,CL ; Shift top box over bottom box ;AN000;
614BOTTOM_BOX: ; The box we want is now at bottom ;AN000;
615 AND AL,AH ; Keep only bits from the box ;AN000;
616 MOV CUR_BOX[BX],AL ; Store this box column ;AN000;
617 INC SI ; Access next column of the pattern ;AN000;
618 INC BX ; One more column stored. ;AN000;
619 CMP BL,BOX_W ; All stored ? ;AN000;
620 JL EXTRACT_1_BOX_COLUMN ; No, continue ;AN000;
621 ;AN000;
622 POP SI ;AN000;
623 POP CX ;AN000;
624 POP BX ;AN000;
625 POP AX ;AN000;
626 RET ;AN000;
627PAT2BOX ENDP ;AN000;
628INCLUDE GRCOMMON.ASM ;AN000;
629LEN_OF_BW_MODULES EQU $-PRINT_BW_APA ;AN000;
630CODE ENDS ;AN000;
631 END ;AN000;
diff --git a/v4.0/src/CMD/GRAPHICS/GRBWPRT.EXT b/v4.0/src/CMD/GRAPHICS/GRBWPRT.EXT
new file mode 100644
index 0000000..4d7526c
--- /dev/null
+++ b/v4.0/src/CMD/GRAPHICS/GRBWPRT.EXT
@@ -0,0 +1,24 @@
1.XLIST ;AN000;
2PAGE ;AN000;
3;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
4;; DOS - GRAPHICS Command
5;; (C) Copyright 1988 Microsoft
6;; ;AN000;
7;; File Name: GRBWPRT.EXT ;AN000;
8;; ---------- ;AN000;
9;; ;AN000;
10;; Description: ;AN000;
11;; ------------ ;AN000;
12;; Include file containing external declarations for ;AN000;
13;; the code and data defined in GRBWPRT.ASM. ;AN000;
14;; ;AN000;
15;; Change History: ;AN000;
16;; --------------- ;AN000;
17;; ;AN000;
18;; ;AN000;
19;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
20 ;; ;AN000;
21;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
22.LIST ;AN000;
23 EXTRN PRINT_BW_APA:NEAR ;AN000;
24 EXTRN LEN_OF_BW_MODULES:ABS ;; ;AN000;
diff --git a/v4.0/src/CMD/GRAPHICS/GRCOLPRT.ASM b/v4.0/src/CMD/GRAPHICS/GRCOLPRT.ASM
new file mode 100644
index 0000000..0c1d0a2
--- /dev/null
+++ b/v4.0/src/CMD/GRAPHICS/GRCOLPRT.ASM
@@ -0,0 +1,1122 @@
1 PAGE ,132 ;AN000;
2 TITLE DOS GRAPHICS Command - Color printing modules
3;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
4;; DOS - GRAPHICS Command
5;; (c) Copyright 1988 Microsoft
6;; ;AN000;
7;; File Name: GRCOLPRT.ASM ;AN000;
8;; ---------- ;AN000;
9;; ;AN000;
10;; Description: ;AN000;
11;; ------------ ;AN000;
12;; This file contains the code for printing a screen (text and graphics) ;AN000;
13;; on a COLOR printer. ;AN000;
14;; ;AN000;
15;; Documentation Reference: ;AN000;
16;; ------------------------ ;AN000;
17;; OASIS High Level Design ;AN000;
18;; OASIS GRAPHICS I1 Overview ;AN000;
19;; ;AN000;
20;; Procedures Contained in This File: ;AN000;
21;; ---------------------------------- ;AN000;
22;; ;AN000;
23;; PRINT_COLOR ;AN000;
24;; SCAN_FOR_BANDS_APA ;AN000;
25;; SCAN_FOR_BANDS_TXT ;AN000;
26;; PRINT_BAND_APA ;AN000;
27;; PRINT_BAND_TXT ;AN000;
28;; SET_CURSOR ;AN000;
29;; SET_COLOR_BAND ;AN000;
30;; INIT_BLACK_BOX ;AN000;
31;; ;AN000;
32;; ;AN000;
33;; Include Files Required: ;AN000;
34;; ----------------------- ;AN000;
35;; ;AN000;
36;; GRCTRL.EXT - Externals for print screen control ;AN000;
37;; GRCTRL.STR - Structures and equates for print screen control ;AN000;
38;; GRPATTRN.STR - Structures for the printer patterns. ;AN000;
39;; ;AN000;
40;; GRSHAR.STR - Shared Data Area Structure ;AN000;
41;; ;AN000;
42;; STRUC.INC - Macros for using structured assembly language ;AN000;
43;; ;AN000;
44;; External Procedure References: ;AN000;
45;; ------------------------------ ;AN000;
46;; FROM FILE GRCTRL.ASM: ;AN000;
47;; PRT_SCR - Main module for printing the screen. ;AN000;
48;; TO FILE GRCOMMON.ASM ;AN000;
49;; Common modules - tools for printing a screen. ;AN000;
50;; ;AN000;
51;; Linkage Instructions: ;AN000;
52;; -------------------- ;AN000;
53;; Refer to GRAPHICS.ASM ;AN000;
54;; ;AN000;
55;; Change History: ;AN000;
56;; --------------- ;AN000;
57;; Date last updated 5/26/87. ;AN000;
58;; ;AN000;
59;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
60PAGE ;AN000;
61CODE SEGMENT PUBLIC 'CODE' ;AN000;
62 ASSUME CS:CODE,DS:CODE ;AN000;
63 ;AN000;
64 PUBLIC PRINT_MODULE_START ;; Color modules public ;AN000;
65 PUBLIC PRINT_COLOR ;; procedures ;AN000;
66 PUBLIC LEN_OF_COLOR_MODULES ;; ;AN000;
67 ;; ;AN000;
68.XLIST ; ;AN000;
69INCLUDE GRCTRL.STR ; Stuctures needed ;AN000;
70INCLUDE GRSHAR.STR ; for both set of print modules ;AN000;
71INCLUDE GRPATTRN.STR ; ;AN000;
72 ; ;AN000;
73INCLUDE GRCTRL.EXT ; Externals from PRT_SCR control module ;AN000;
74INCLUDE STRUC.INC ; ;AN000;
75.LIST ; ;AN000;
76;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AN000;
77;; ;AN000;
78;; ;AN000;
79;; PRINT_COLOR : PRINT TEXT AND APA MODE SCREEN ON A COLOR PRINTER ;AN000;
80;; ;AN000;
81;-------------------------------------------------------------------------------;AN000;
82; ;AN000;
83; INPUT: BP = Offset of the shared data area ;AN000;
84; XLT_TAB = Color translation table ;AN000;
85; ;AN000;
86; OUTPUT: PRINTER ;AN000;
87; ;AN000;
88;-------------------------------------------------------------------------------;AN000;
89;; ;AN000;
90;; Description: ;AN000;
91;; Main control module for printing of text and graphics ;AN000;
92;; on color printers. ;AN000;
93;; ;AN000;
94;; Calls either the text or graphics mode routine. ;AN000;
95;; ;AN000;
96;; Called By: ;AN000;
97;; PRINT_SCREEN ;AN000;
98;; ;AN000;
99;; External Calls: ;AN000;
100;; LOC_MODE_PRT_INFO, PRINT_COLOR_APA, PRINT_COLOR_TXT ;AN000;
101;; ;AN000;
102;; Logic: ;AN000;
103;; IF MODE_TYPE = TXT ;AN000;
104;; THEN CALL PRINT_COLOR_TXT ;AN000;
105;; ELSE (MODE_TYPE = APA) ;AN000;
106;; CALL LOC_MODE_PRT_INFO ; Get DISPLAYMODE record from the SHARED AREA ;AN000;
107;; CALL PRINT_COLOR_APA ;AN000;
108;; RETURN ;AN000;
109;; ;AN000;
110;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
111PRINT_MODULE_START LABEL BYTE ;AN000;
112PRINT_COLOR PROC NEAR ;AN000;
113 JMP SHORT PRINT_COLOR_BEGIN ;AN000;
114WHITE_BOX DB 0,0,0,0 ; Print boxes for APA mode ;AN000;
115BLACK_BOX DB ?,?,?,? ; NOTE: 1 print box = 1 screen pixel ;AN000;
116 ; only BOX_W bytes are used out of these 2 ;AN000;
117 ; boxes. ;AN000;
118 ;AN000;
119REQ_BAND_MASK DB ? ; Mask = "All color bands needed for the current;AN000;
120 ; print line". ;AN000;
121 ;AN000;
122PRINT_COLOR_BEGIN: ;AN000;
123.IF <MODE_TYPE EQ TXT> ;AN000;
124.THEN ;AN000;
125;-------------------------------------------------------------------------------;AN000;
126; The screen is in a text mode: ;AN000;
127;-------------------------------------------------------------------------------;AN000;
128 CALL PRINT_COLOR_TXT ; Print a text screen on a color printer;AN000;
129.ELSE ;AN000;
130;-------------------------------------------------------------------------------;AN000;
131; The screen is in All Points Addressable mode: ;AN000;
132; Locate and extract printer DISPLAYMODE information from ;AN000;
133; the shared data area. ;AN000;
134;-------------------------------------------------------------------------------;AN000;
135 CALL LOC_MODE_PRT_INFO ; Get printer info related to curr. mode;AN000;
136; ;AN000;
137;-------Test if DISPLAYMODE info record was found: ;AN000;
138 .IF <ERROR_CODE EQ DISPLAYMODE_INFO_NOT_FOUND> ;AN000;
139 .THEN ;AN000;
140 MOV ERROR_CODE,UNABLE_TO_PRINT ; IF no record found, ;AN000;
141 JMP SHORT PRINT_COLOR_END ; then, return error code ;AN000;
142 .ENDIF ; and quit procedure ;AN000;
143; ;AN000;
144;-------Get the box size from the DISPLAYMODE info record: ;AN000;
145 MOV BX,CUR_MODE_PTR ; BX := Offset current DISPLAYMODE info.;AN000;
146 MOV AH,[BX].BOX_WIDTH ; Take local copy of the box size. ;AN000;
147 MOV BOX_W,AH ; in BOX_W and BOX_H ;AN000;
148 MOV AL,[BX].BOX_HEIGHT ;AN000;
149 MOV BOX_H,AL ;AN000;
150; ;AN000;
151;-------Verify if the box size obtained from DISPLAYMODE info. is valid ;AN000;
152 .IF <ZERO AL> OR ; IF height of the box is 0 ;AN000;
153 .IF <ZERO AH> ; OR width of the box is 0 ;AN000;
154 .THEN ; THEN we can't print: ;AN000;
155 MOV ERROR_CODE,UNABLE_TO_PRINT ; return error code ;AN000;
156 JMP SHORT PRINT_COLOR_END ; and quit ;AN000;
157 .ENDIF ;AN000;
158; ;AN000;
159;-------Get the Print Orientation from the DISPLAYMODE info record ;AN000;
160 .IF <[BX].PRINT_OPTIONS EQ ROTATE>; If printing sideways ;AN000;
161 .THEN ; then: ;AN000;
162 MOV ROTATE_SW,ON ; Rotate switch := "ON" ;AN000;
163 .ENDIF ;AN000;
164 CALL PRINT_COLOR_APA ; Print APA screen on a color printer ;AN000;
165.ENDIF ;AN000;
166PRINT_COLOR_END: ;AN000;
167 RET ;AN000;
168PRINT_COLOR ENDP ;AN000;
169PAGE ;AN000;
170;===============================================================================;AN000;
171; ;AN000;
172; PRINT_COLOR_TXT: PRINT A TEXT MODE SCREEN ON A COLOR PRINTER ;AN000;
173; ;AN000;
174;-------------------------------------------------------------------------------;AN000;
175; ;AN000;
176; INPUT: BP = Offset of the shared data area ;AN000;
177; XLT_TAB = Color translation table ;AN000;
178; SCREEN_WIDTH = Maximum length of Screen scan line. ;AN000;
179; SCREEN_HEIGHT = Number of SCAN LINES on the screen ;AN000;
180; ;AN000;
181; OUTPUT: PRINTER ;AN000;
182; ;AN000;
183;-------------------------------------------------------------------------------;AN000;
184; ;AN000;
185; DESCRIPTION: The screen is read and printed line by line; character by ;AN000;
186; character. ;AN000;
187; Each line is first scanned in order to determine what colors are present on ;AN000;
188; it and what printer bands will be needed to approximate these colors. ;AN000;
189; ;AN000;
190; For each printer color band needed for the current line, this screen line ;AN000;
191; is READ AGAIN character by character; If the color of the ;AN000;
192; current character must use the current color band to be ;AN000;
193; approximated; then, the character is printed. ;AN000;
194; ;AN000;
195; ;AN000;
196; LOGIC : ;AN000;
197; ;AN000;
198; Save current coordinates of the cursor. ;AN000;
199; Initialize the cursor to the first character to be read (Top-left of screen) ;AN000;
200; FOR each row on the screen (SCREEN_HEIGHT) ;AN000;
201; BEGIN ;AN000;
202; CALL SCAN_FOR_BANDS_TXT(CUR_ROW,CUR_COLUMN,REQ_BAND_MASK) ;AN000;
203; CUR_BAND_MASK := 01H ;AN000;
204; IF REQ_BAND_MASK <> 0 THEN ;AN000;
205; DO 8 TIMES ;AN000;
206; IF (REQ_BAND_MASK AND CUR_BAND_MASK)=1 THEN ;AN000;
207; CALL PRINT_BAND_TXT(CUR_ROW,CUR_COLUMN,CUR_BAND_MASK) ;AN000;
208; CALL PRINT_BYTE(CARRIAGE_RETURN) ;AN000;
209; ENDIF ;AN000;
210; Shift CUR_BAND_MASK one bit left ;AN000;
211; ENDDO ;AN000;
212; CALL PRINT_BYTE(LINE_FEED) ;AN000;
213; ENDIF ;AN000;
214; CUR_COLUMN := 0 ; Get next row coordinates ;AN000;
215; CUR_ROW := CUR_ROW + 1 ;AN000;
216; END ; FOR each row on the screen ;AN000;
217; Restore initial coordinates of the cursor ;AN000;
218; ;AN000;
219PRINT_COLOR_TXT PROC ;AN000;
220 PUSH BX ;AN000;
221 PUSH CX ;AN000;
222 PUSH DX ;AN000;
223; ;AN000;
224;-------Save coordinates of the cursor on the stack: ;AN000;
225 MOV AH,READ_CURSOR_CALL ; Read position of the cursor on the screen;AN000;
226 MOV BH,CUR_PAGE ; for the current page ;AN000;
227 INT 10H ; Call BIOS ;AN000;
228 PUSH DX ; DH := Row number, DL := Column number ;AN000;
229 ; CX := Top line and bottom line for cursor;AN000;
230 ; (not needed) ;AN000;
231; ;AN000;
232;-------Initialize the cursor to the first character to be read ;AN000;
233 MOV CUR_ROW,0 ; cursor = position (0,0) on the screen ;AN000;
234 MOV CUR_COLUMN,0 ; (top-left corner) ;AN000;
235 CALL SET_CURSOR ;AN000;
236 ;AN000;
237 MOV CX,SCREEN_HEIGHT ; CX := Number of rows on the screen ;AN000;
238;-------------------------------------------------------------------------------;AN000;
239; ;AN000;
240; FOR EACH ROW ON THE SCREEN: ;AN000;
241; ;AN000;
242;-------------------------------------------------------------------------------;AN000;
243PRINT_1_TEXT_LINE: ;AN000;
244 CALL SCAN_FOR_BANDS_TXT ; REQ_BAND_MASK := Print bands needed ;AN000;
245 ; for this line ;AN000;
246 MOV DL,01H ; DL :="Current Band printed" mask ;AN000;
247 ;AN000;
248 ; NOTE: The COLORSELECT records are stored sequentially in the ;AN000;
249 ; Shared Data area. The band mask 00000001 corresponds to the first ;AN000;
250 ; record, 00000010 to the second, etc. ;AN000;
251 ; The COLORSELECT record indicates: "How to select the color band" ;AN000;
252 ; on the printer (It contains the bytes that must be sent to the printer;AN000;
253 ;AN000;
254 MOV BX,DS:[BP].COLORSELECT_PTR; BX := relative offset of COLORSELECT;AN000;
255 ADD BX,BP ; BX := absolute offset of COLORSELECT ;AN000;
256 PUSH CX ; Save row counter ;AN000;
257 MOV CX,8 ; For up to the maximum number of print ;AN000;
258 ; bands with this printer ;AN000;
259 ;-----------------------------------------------------------------------;AN000;
260 ; ;AN000;
261 ; FOR each Color Band available with the ribbon installed on the printer;AN000;
262 ; ;AN000;
263 ;-----------------------------------------------------------------------;AN000;
264 PRINT_1_COLOR_BAND_TXT: ; Do one pass of the printer head: ;AN000;
265 .IF <BIT REQ_BAND_MASK AND DL> ; IF this color band is needed ;AN000;
266 .THEN ; by any character on the line ;AN000;
267 CALL SET_COLOR_BAND ; then, select the color band ;AN000;
268 CALL PRINT_BAND_TXT ; and do one Print Pass for it. ;AN000;
269 .IF <BIT ERROR_CODE NZ PRINTER_ERROR> ;AN000;
270 .THEN ; A printer error occurred: ;AN000;
271 POP CX ; Restore the line counter ;AN000;
272 JMP PRINT_COLOR_TXT_END ; and quit. ;AN000;
273 .ENDIF ;AN000;
274 MOV AL,CR ; Print a carriage return ;AN000;
275 CALL PRINT_BYTE ;AN000;
276 .IF C ;AN000;
277 .THEN ; A printer error occurred: ;AN000;
278 POP CX ; Restore the line counter ;AN000;
279 JMP PRINT_COLOR_TXT_END ; and quit. ;AN000;
280 .ENDIF ; ENDIF printer error ;AN000;
281 .ENDIF ; ENDIF this color band is needed ;AN000;
282 SHL DL,1 ; Get next Color Band mask ;AN000;
283 ; [BX] := Next COLORSELECT record: ;AN000;
284 MOV AL,[BX].NUM_SELECT_ESC ; skip the escape bytes ;AN000;
285 XOR AH,AH ; ;AN000;
286 ADD BX,AX ; ;AN000;
287 INC BX ; skip the NUM_SELECT_ESC field ;AN000;
288 LOOP PRINT_1_COLOR_BAND_TXT ;AN000;
289 POP CX ; Restore row counter ;AN000;
290; ;AN000;
291;-----Print a line feed: ;AN000;
292 MOV AL,LF ;AN000;
293 CALL PRINT_BYTE ; Send the LF ;AN000;
294 JC PRINT_COLOR_TXT_END ; If printer error, quit ;AN000;
295; ;AN000;
296;-------Get coordinates of the first character in the next scan line: ;AN000;
297 INC CUR_ROW ; CUR_ROW + 1 ;AN000;
298 MOV CUR_COLUMN,0 ; CUR_COLUMN := 0 ;AN000;
299; ;AN000;
300;-------Point CURSOR to first character in the next scan line: ;AN000;
301 CALL SET_CURSOR ;AN000;
302 ;AN000;
303 LOOP PRINT_1_TEXT_LINE ; Print next scan line ;AN000;
304 ;AN000;
305; ;AN000;
306;-------Restore CURSOR to its original location (saved on the stack) ;AN000;
307PRINT_COLOR_TXT_END: ;AN000;
308 POP DX ; DH := Row number, DL := Column number ;AN000;
309 MOV CL,DH ;AN000;
310 MOV CUR_ROW,CX ; CUR_ROW := Original row number ;AN000;
311 MOV CL,DL ;AN000;
312 MOV CUR_COLUMN,CX ; CUR_COLUMN := Original column number ;AN000;
313 CALL SET_CURSOR ; Set the cursor back there ;AN000;
314 ;AN000;
315 POP DX ;AN000;
316 POP CX ;AN000;
317 POP BX ;AN000;
318 RET ;AN000;
319PRINT_COLOR_TXT ENDP ;AN000;
320PAGE ;AN000;
321;===============================================================================;AN000;
322; ;AN000;
323; SCAN_FOR_BANDS_TEXT: DETERMINE WHAT PRINTER COLOR BANDS ARE NEEDED FOR ;AN000;
324; PRINTING THE COLORS ON THE CURRENT SCREEN LINE. ;AN000;
325; ;AN000;
326;-------------------------------------------------------------------------------;AN000;
327; ;AN000;
328; INPUT: CUR_ROW = row to start scanning ;AN000;
329; CUR_COLUMN = column to start scanning ;AN000;
330; ROTATE_SW = ON if printing is sideways ;AN000;
331; ;AN000;
332; OUTPUT: REQ_BAND_MASK ;AN000;
333; ;AN000;
334; ;AN000;
335; DATA STRUCTURE REFERENCED: ;AN000;
336; XLT_TAB = Color translation table ;AN000;
337; ;AN000;
338;-------------------------------------------------------------------------------;AN000;
339; ;AN000;
340; DESCRIPTION: Read all characters on the current line from left to right. ;AN000;
341; For each character, extract its band mask from the color translation table. ;AN000;
342; Add the band mask required for this character to the "Required Bands" mask. ;AN000;
343; ;AN000;
344; LOGIC : ;AN000;
345; Save current coordinates ;AN000;
346; DO (SCREEN_WIDTH) TIMES ;AN000;
347; Read a character ;AN000;
348; Get its Band Mask from the color translation table in AL ;AN000;
349; OR REQ_BAND_MASK,AL ; Add its band mask to the "Required bands" mask;AN000;
350; ; Get coordinates of the next character: ;AN000;
351; INC CUR_COLUMN ;AN000;
352; Restore initial coordinates ;AN000;
353; ;AN000;
354SCAN_FOR_BANDS_TXT PROC NEAR ;AN000;
355 PUSH CUR_ROW ; Save coordinates ;AN000;
356 PUSH CUR_COLUMN ;AN000;
357 PUSH AX ;AN000;
358 PUSH BX ;AN000;
359 PUSH CX ;AN000;
360 ;AN000;
361 MOV REQ_BAND_MASK,0 ; No Color bands needed so far... ;AN000;
362 MOV CX,SCREEN_WIDTH ; For each character on the screen row ;AN000;
363;-------------------------------------------------------------------------------;AN000;
364; ;AN000;
365; FOR each character on the current scan line: ;AN000;
366; ;AN000;
367;-------------------------------------------------------------------------------;AN000;
368SCAN_1_CHAR: ;AN000;
369; ;AN000;
370;-------Read the character at the current cursor position ;AN000;
371 CALL SET_CURSOR ; Set cursor at character to be read ;AN000;
372 MOV AH,READ_CHAR_CALL ; Read one character ;AN000;
373 MOV BH,CUR_PAGE ; at CUR_PAGE, CUR_COLUMN and CUR_ROW ;AN000;
374 INT 10H ; Call BIOS ;AN000;
375 ; AL:=Character read, AH:=Byte attribute;AN000;
376 AND AH,00001111B ; AH := Foreground color attribute ;AN000;
377 XCHG AL,AH ; AL := AH, used as index in the XLT_TAB;AN000;
378 MOV BX,OFFSET XLT_TAB ; BX := Offset of translation table ;AN000;
379 XLAT XLT_TAB ; AL = Band mask ;AN000;
380; ;AN000;
381;-------Obtain what Print bands are required to print the color of this char: ;AN000;
382 OR REQ_BAND_MASK,AL ;AN000;
383 ;AN000;
384 INC CUR_COLUMN ; Get coordinates of next character ;AN000;
385 LOOP SCAN_1_CHAR ; Scan next character ;AN000;
386 ;AN000;
387 POP CX ;AN000;
388 POP BX ;AN000;
389 POP AX ;AN000;
390 POP CUR_COLUMN ; Restore initial coordinates ;AN000;
391 POP CUR_ROW ;AN000;
392 RET ;AN000;
393SCAN_FOR_BANDS_TXT ENDP ;AN000;
394PAGE ;AN000;
395;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AN000;
396;; ;AN000;
397;; PRINT_BAND_TXT: PRINT ALL CHARACTERS ON THE CURRENT LINE THAT ARE THE SAME ;AN000;
398;; COLOR AS THE CURRENT PRINT BAND. ;AN000;
399;; ;AN000;
400;-------------------------------------------------------------------------------;AN000;
401; ;AN000;
402; INPUT: CUR_ROW, ;AN000;
403; CUR_COLUMN : Coordinates of the first character to be read in ;AN000;
404; the current scan line. ;AN000;
405; DL : Band mask indicating what print band to use ;AN000;
406; for this print pass. ;AN000;
407; SCAN_LINE_LENGTH: Length of the current scan line. ;AN000;
408; ;AN000;
409; OUTPUT: PRINTER ;AN000;
410; ;AN000;
411;-------------------------------------------------------------------------------;AN000;
412; LOGIC: ;AN000;
413; DO (SCAN_LINE_LENGTH) TIMES ;AN000;
414; CALL BIOS INT 10H Read Character - returns CHAR, COLOR_NUM ;AN000;
415; IF (CUR_BAND_MASK AND XLAT_TAB[COLOR_NUM])=1 ;AN000;
416; THEN IF Background color is same as Foreground color ;AN000;
417; THEN ;AN000;
418; CALL PRINT_BYTE(SOLID_BOX) ;AN000;
419; ELSE ;AN000;
420; CALL PRINT_BYTE(CHAR) ;AN000;
421; ELSE ;AN000;
422; CALL PRINT_BYTE(blank) ;AN000;
423; Get coordinates of the next character ;AN000;
424; ;AN000;
425PRINT_BAND_TXT PROC ;AN000;
426SOLID_BOX EQU 219 ; ASCII Code for printing a solid box ;AN000;
427BLANK EQU 32 ; ASCII code for printing a space ;AN000;
428 PUSH CUR_COLUMN ; Save column number ;AN000;
429 PUSH AX ;AN000;
430 PUSH BX ;AN000;
431 PUSH CX ;AN000;
432 MOV CX,SCREEN_WIDTH ; CX := Number of character on one screen row ;AN000;
433;===============================================================================;AN000;
434; ;AN000;
435; FOR each character on the current row: ;AN000;
436; ;AN000;
437;===============================================================================;AN000;
438PRINT_1_CHAR: ;AN000;
439; ;AN000;
440;-------Read the character at the current cursor position ;AN000;
441 CALL SET_CURSOR ; Set cursor at character to be read ;AN000;
442 MOV AH,READ_CHAR_CALL ; Read one character ;AN000;
443 MOV BH,CUR_PAGE ; at CUR_PAGE, CUR_COLUMN and CUR_ROW ;AN000;
444 INT 10H ; Call BIOS ;AN000;
445 ; AL:=Character read, AH:=Byte attribute;AN000;
446 MOV CUR_CHAR,AL ;AN000;
447 MOV DH,AH ; DH := Byte attribute ;AN000;
448 AND DH,11110000B ; DH := Background color ;AN000;
449 SHR DH,1 ; DH := Background color right justified;AN000;
450 SHR DH,1 ;AN000;
451 SHR DH,1 ;AN000;
452 SHR DH,1 ;AN000;
453 AND AH,00001111B ; AH := Foreground color right justified;AN000;
454; ;AN000;
455;-------Test if this character should be printed (need color of the current band;AN000;
456 MOV AL,AH ; AL:=color used as index in the XLT_TAB;AN000;
457 MOV BX,OFFSET XLT_TAB ; BX := Offset of translation table ;AN000;
458 XLAT XLT_TAB ; AL := Band mask (DL=current band mask);AN000;
459 .IF <BIT AL AND DL> ;If needs this band to print the color ;AN000;
460 .THEN ; of this character ;AN000;
461 .IF <AH EQ DH> ; then: when foreground = background ;AN000;
462 .THEN ; send a solid box ;AN000;
463 MOV AL,SOLID_BOX ; ;AN000;
464 .ELSE ; when foreground <> background ;AN000;
465 MOV AL,CUR_CHAR ; send the character ;AN000;
466 .ENDIF ; Endif foreground = background ;AN000;
467 .ELSE ; else: send a blank ;AN000;
468 MOV AL,BLANK ; ;AN000;
469 .ENDIF ; Endif color band needed ;AN000;
470 CALL PRINT_BYTE ; Print the byte ;AN000;
471 JC PRINT_BAND_TXT_END ; If printer error occurred: QUIT ;AN000;
472 INC CUR_COLUMN ; Else, Get next column; keep going ;AN000;
473 LOOP PRINT_1_CHAR ;AN000;
474 ;AN000;
475PRINT_BAND_TXT_END: ;AN000;
476 POP CX ;AN000;
477 POP BX ;AN000;
478 POP AX ;AN000;
479 POP CUR_COLUMN ; Restore column number ;AN000;
480 RET ;AN000;
481CUR_CHAR DB ? ;AN000;
482PRINT_BAND_TXT ENDP ;AN000;
483PAGE ;AN000;
484;===============================================================================;AN000;
485; ;AN000;
486; PRINT_COLOR_APA: PRINT AN APA MODE SCREEN ON A COLOR PRINTER ;AN000;
487; ;AN000;
488;-------------------------------------------------------------------------------;AN000;
489; ;AN000;
490; INPUT: BP = Offset of the shared data area ;AN000;
491; XLT_TAB = Color translation table ;AN000;
492; CUR_MODE_PTR = Coordinates of current DISPLAYMODE info. ;AN000;
493; ;AN000;
494; OUTPUT: PRINTER ;AN000;
495; ;AN000;
496;-------------------------------------------------------------------------------;AN000;
497; ;AN000;
498; DESCRIPTION: Each pixel on the screen is printed as a "box" of dots on the ;AN000;
499; printer. For a screen pixel of a given color, the best color approximation ;AN000;
500; is chosen among the color available on the printer. ;AN000;
501; ;AN000;
502; The printer colors are obtained by selecting a print band. A few more printer ;AN000;
503; color are obtained by printing twice (or more times) with different color ;AN000;
504; bands. ;AN000;
505; ;AN000;
506; For example, let's say we have a ribbon on the printer with a YELLOW CYAN ;AN000;
507; MAGENTA ribbon and we read a GREEN pixel on the screen. ;AN000;
508; ;AN000;
509; We first determine what "box" size will be used to represent this pixel. ;AN000;
510; Let's say it's a 3x2 box (this is obtained from the DISPLAYMODE record) ;AN000;
511; In all cases, we will print this pixel as a 3x2 box of printer dots. ;AN000;
512; That is, we will print 6 dots on the printer for one on the screen. ;AN000;
513; We do not use any kind of patterns (e,g,. printing only 2 dots out of 6) ;AN000;
514; for printing on the color printer. A screen pixel is either printed ;AN000;
515; as a "full" box of printer dots or not printed at all (e,g,. if it's white).;AN000;
516; ;AN000;
517; Now, from the COLORPRINT records, we know all the colors availables on the ;AN000;
518; printer, and what print bands must be used (or overlaid) in order to ;AN000;
519; obtain them. ;AN000;
520; ;AN000;
521; So, we consult these COLORPRINT records one by one comparing how close ;AN000;
522; the color of each of them is to our GREEN pixel. (the colors for our pixel ;AN000;
523; AND for the printer color are both indicated in terms of RGB values) ;AN000;
524; WE PICK THE CLOSEST PRINTER COLOR. ;AN000;
525; ;AN000;
526; To conclude, our GREEN pixel will be printed by first selecting the YELLOW ;AN000;
527; band, then sending to the printer a "box". Then, the BLUE band is selected ;AN000;
528; and the "box" is sent again. ;AN000;
529; ;AN000;
530; This process is carried line by line. ;AN000;
531; ;AN000;
532; For each line, we first read each pixel to see what color bands are going ;AN000;
533; to be needed for this line. ;AN000;
534; ;AN000;
535; Then, we loop for each band available on the printer. ;AN000;
536; ;AN000;
537; IF the current line needs the current printer band (i.e.,if any pixel on ;AN000;
538; the line needs this color band in order to achieve its color. ;AN000;
539; THEN, we select this color band (we know how to do it from the COLORSELECT ;AN000;
540; record in the Shared Data area) ;AN000;
541; AND we must read the line again; for each pixel that needs the current ;AN000;
542; band a "box" is sent to the printer. ;AN000;
543; ;AN000;
544; LOGIC : ;AN000;
545; CALL INIT_BLACK_BOX ; Initialize a print box ;AN000;
546; CALL GET_SCREEN_INFO ;AN000;
547; CALL SETUP_PRT ;AN000;
548; DO (NB_SCAN_LINES) TIMES ;AN000;
549; CALL DET_CUR_SCAN_LNE_LENGTH ;AN000;
550; IF CUR_SCAN_LNE_LENGTH NE 0 THEN ;AN000;
551; CALL SCAN_FOR_BANDS_APA(CUR_ROW,CUR_COLUMN,REQ_BAND_MASK) ;AN000;
552; CUR_BAND_MASK := 01H ;AN000;
553; IF REQ_BAND_MASK <> 0 THEN ;AN000;
554; DO 8 TIMES ;AN000;
555; IF (REQ_BAND_MASK AND CUR_BAND_MASK)=1 THEN ;AN000;
556; CALL NEW_PRT_LINE ;AN000;
557; CALL PRINT_BAND_APA(CUR_ROW,CUR_COLUMN,CUR_BAND_MASK) ;AN000;
558; CALL PRINT_BYTE(CARRIAGE_RETURN) ;AN000;
559; ENDIF ;AN000;
560; Shift CUR_BAND_MASK one bit left ;AN000;
561; ENDDO ;AN000;
562; ENDIF ; Should make a print pass for this color band ;AN000;
563; CALL PRINT_BYTE(LINE_FEED) ;AN000;
564; ENDIF ; Current scan line is not empty ;AN000;
565; IF rotated print THEN ;AN000;
566; CUR_COLUMN := CUR_COLUMN - BOXES_PER_PRT_BUF ;AN000;
567; CUR_ROW := SAVE_START_ROW ;AN000;
568; ELSE ;AN000;
569; CUR_ROW := CUR_ROW + BOXES_PER_PRT_BUF ;AN000;
570; CUR_COLUMN := SAVE_START_COLUMN ;AN000;
571; ENDIF ;AN000;
572; ENDDO ; Number of Scan lines ;AN000;
573; CALL RESTORE_PRT ;AN000;
574; ;AN000;
575PRINT_COLOR_APA PROC ;AN000;
576 PUSH AX ;AN000;
577 PUSH BX ;AN000;
578 PUSH CX ;AN000;
579 PUSH DX ;AN000;
580 ;AN000;
581 ;AN000;
582;-------Initialize print box (A "box" represents one screen pel on the printer) ;AN000;
583 CALL INIT_BLACK_BOX ;AN000;
584;-------------------------------------------------------------------------------;AN000;
585; ;AN000;
586; Determine where to start reading the screen: ;AN000;
587; If printing sideways, start in LOW LEFT corner. ;AN000;
588; If normal printing, start in TOP LEFT corner. ;AN000;
589; Determine the maximum length for a scan line: ;AN000;
590; If printing sideways, it is the height of the screen. ;AN000;
591; For normal printing, it is the width of the screen. ;AN000;
592; Determine the number of scan lines on the screen. ;AN000;
593; ;AN000;
594;-------------------------------------------------------------------------------;AN000;
595 CALL GET_SCREEN_INFO ; Get info. about how to read the screen;AN000;
596 CALL SETUP_PRT ; Set up the printer (Line spacing, etc);AN000;
597 .IF <BIT ERROR_CODE NZ PRINTER_ERROR> ;AN000;
598 .THEN ; A printer error occurred: quit ;AN000;
599 JMP PRINT_COLOR_APA_END ; ;AN000;
600 .ENDIF ;AN000;
601 ;AN000;
602 MOV CX,NB_SCAN_LINES ;AN000;
603;---------------------------------------------------------------------------- ;AN000;
604; ;AN000;
605; FOR EACH SCAN LINE ON THE SCREEN (and each print line): ;AN000;
606; ;AN000;
607;---------------------------------------------------------------------------- ;AN000;
608PRINT_SCAN_LINE: ;AN000;
609 CALL DET_CUR_SCAN_LNE_LENGTH ; Determine length of the scan line ;AN000;
610 .IF <CUR_SCAN_LNE_LENGTH NE 0> ; If line is not empty ;AN000;
611 .THEN ;AN000;
612 CALL SCAN_FOR_BANDS_APA ; REQ_BAND_MASK := Mask for what print;AN000;
613 ; bands are needed. ;AN000;
614 MOV DL,01H ; DL := "Current Band to be printed" ;AN000;
615 MOV BX,DS:[BP].COLORSELECT_PTR; BX := Offset of COLORSELECT record;AN000;
616 ADD BX,BP ; ("How to select the color band");AN000;
617 PUSH CX ; Save scan line counter ;AN000;
618 MOV CX,8 ; For up to the maximum number of prin;AN000;
619 ; bands with this printer ;AN000;
620 ;---------------------------------------------------------------------;AN000;
621 ; ;AN000;
622 ; FOR each Color Band needed: ;AN000;
623 ; ;AN000;
624 ;---------------------------------------------------------------------;AN000;
625 PRINT_1_COLOR_BAND_APA: ; Only if this color band is needed: ;AN000;
626 .IF <BIT REQ_BAND_MASK AND DL> ; Do one pass of the printer head ;AN000;
627 .THEN ; ;AN000;
628 CALL SET_COLOR_BAND ; Select the color band on the printer;AN000;
629 CALL NEW_PRT_LINE ; Send escape sequence to the printer ;AN000;
630 ; for starting a new graphics line ;AN000;
631 .IF <BIT ERROR_CODE NZ PRINTER_ERROR> ;AN000;
632 .THEN ; A printer error occurred: ;AN000;
633 POP CX ; Restore the line counter and ;AN000;
634 JMP PRINT_COLOR_APA_END ; return ;AN000;
635 .ENDIF ; Endif printer error occurred ;AN000;
636 ;AN000;
637 CALL PRINT_BAND_APA ; Do one Print Pass for current band ;AN000;
638 MOV AL,CR ; Print a carriage return ;AN000;
639 CALL PRINT_BYTE ;AN000;
640 .IF C ; If a printer error occurred ;AN000;
641 .THEN ;AN000;
642 POP CX ; Restore the line counter and ;AN000;
643 JMP PRINT_COLOR_APA_END ; return ;AN000;
644 .ENDIF ; End if printer error occurred ;AN000;
645 .ENDIF ; End if this color band is needed ;AN000;
646 SHL DL,1 ; Get next Color Band mask ;AN000;
647 ; Locate next COLORSELECT record: ;AN000;
648 MOV AL,[BX].NUM_SELECT_ESC; skip the escape bytes ;AN000;
649 XOR AH,AH ;AN000;
650 ADD BX,AX ;AN000;
651 INC BX ; skip the NUM_SELECT_ESC field ;AN000;
652 LOOP PRINT_1_COLOR_BAND_APA ;AN000;
653 POP CX ; Restore scan line counter ;AN000;
654 .ENDIF ; Scan line length <> 0 ;AN000;
655; ;AN000;
656;-----Print a line feed: ;AN000;
657 MOV AL,LF ;AN000;
658 CALL PRINT_BYTE ;AN000;
659 JC PRINT_COLOR_APA_END ; If a printer error occurred: quit ;AN000;
660; ;AN000;
661;-------Get coordinates of next scan line: ;AN000;
662 .IF <ROTATE_SW EQ ON> ; If printing sideways ;AN000;
663 .THEN ; then: ;AN000;
664 MOV AL,NB_BOXES_PER_PRT_BUF; AX := Numbers of pels read on row ;AN000;
665 CBW ; ;AN000;
666 ADD CUR_COLUMN,AX ; CUR_COLUMN + Number of pels read ;AN000;
667 MOV AX,SCREEN_HEIGHT ; CUR_ROW := SCREEN_HEIGHT - 1 ;AN000;
668 DEC AX ; ;AN000;
669 MOV CUR_ROW,AX ; ;AN000;
670 .ELSE ; else, printing NOT rotated: ;AN000;
671 MOV AL,NB_BOXES_PER_PRT_BUF ; AX := Number of pels read on column ;AN000;
672 CBW ; ;AN000;
673 ADD CUR_ROW,AX ; CUR_ROW + Number of pels read ;AN000;
674 MOV CUR_COLUMN,0 ; CUR_COLUMN := 0 ;AN000;
675 .ENDIF ; End if printing sideways ;AN000;
676 LOOP PRINT_SCAN_LINE ; ;AN000;
677 ;AN000;
678;-------------------------------------------------------------------------------;AN000;
679; ;AN000;
680; Restore the printer (send a Page Eject, etc.) ;AN000;
681; ;AN000;
682;-------------------------------------------------------------------------------;AN000;
683 CALL RESTORE_PRT ;AN000;
684PRINT_COLOR_APA_END: ;AN000;
685 POP DX ;AN000;
686 POP CX ;AN000;
687 POP BX ;AN000;
688 POP AX ;AN000;
689 RET ;AN000;
690PRINT_COLOR_APA ENDP ;AN000;
691PAGE ;AN000;
692;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AN000;
693;; ;AN000;
694;; ;AN000;
695;; SCAN_FOR_BANDS_APA : DETERMINE WHAT PRINT BANDS ARE NEEDED FOR THE CURRENT ;AN000;
696;; PRINT PASS. ;AN000;
697;; ;AN000;
698;;------------------------------------------------------------------------------;AN000;
699; ;AN000;
700; INPUT: CUR_ROW : row to start scanning (word) ;AN000;
701; CUR_COLUMN : column to start scanning (word) ;AN000;
702; CUR_SCAN_LNE_LENGTH : length of the current scan line (word) ;AN000;
703; ROTATE_SW = ON if printing is sideways ;AN000;
704; ;AN000;
705; OUTPUT: REQ_BAND_MASK : band mask for required bands (byte) ;AN000;
706; ;AN000;
707;;------------------------------------------------------------------------------;AN000;
708;; ;AN000;
709;; Data Structures Referenced: ;AN000;
710;; Shared Data Area ;AN000;
711;; Print Info ;AN000;
712;; Color Translate Table ;AN000;
713;; ;AN000;
714;; ;AN000;
715;; Description: ;AN000;
716;; Read all the dots required for one print line to determine ;AN000;
717;; the print bands required. The print line corresponds to several ;AN000;
718;; screen rows (or columns if rotated printing). The number of ;AN000;
719;; rows / columns per print line is stored in NB_BOXES_PER_PRT_BUF. ;AN000;
720;; The band information is obtained from the Color Translate Table. ;AN000;
721;; ;AN000;
722;; Called By: ;AN000;
723;; PRINT_COLOR_APA ;AN000;
724;; ;AN000;
725;; External Calls: ;AN000;
726;; READ_DOT, BIOS INT 10H ;AN000;
727;; ;AN000;
728;; Logic: ;AN000;
729;; Save initial coordinates ;AN000;
730;; SAVE_START_COLUMN := CUR_COLUMN ;AN000;
731;; REQ_BAND_MASK := 00H ;AN000;
732;; DO (SCAN_LINE_LENGTH) TIMES ;AN000;
733;; Save coordinates of the "column" ;AN000;
734;; DO (BOXES_PER_PRT_BUF) TIMES ;AN000;
735;; CALL READ_DOT(IN CUR_ROW,CUR_COLUMN; OUT COLOR_NUM) ;AN000;
736;; REQ_BAND_MASK := REQ_BAND_MASK OR COLOR_XLAT_TAB[BX] ;AN000;
737;; IF rotated print THEN ;AN000;
738;; Increment CUR_COLUMN ;AN000;
739;; ELSE ;AN000;
740;; Increment CUR_ROW ;AN000;
741;; ENDIF ;AN000;
742;; Restore coordinates of the "column" ;AN000;
743;; ENDDO ;AN000;
744;; IF rotated print THEN ;AN000;
745;; Decrement CUR_ROW ;AN000;
746;; ELSE ;AN000;
747;; Increment CUR_COLUMN ;AN000;
748;; ENDIF ;AN000;
749;; ENDDO ;AN000;
750;; Restore initial coordinates ;AN000;
751;; RETURN ;AN000;
752;; ;AN000;
753;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
754SCAN_FOR_BANDS_APA PROC NEAR ;AN000;
755 PUSH CUR_ROW ;AN000;
756 PUSH CUR_COLUMN ;AN000;
757 PUSH AX ;AN000;
758 PUSH BX ;AN000;
759 PUSH CX ;AN000;
760 ;AN000;
761 MOV REQ_BAND_MASK,0 ; No Color bands needed so far... ;AN000;
762 MOV BX,OFFSET XLT_TAB ; BX := Offset of translation table ;AN000;
763 MOV CX,CUR_SCAN_LNE_LENGTH ;AN000;
764;===============================================================================;AN000;
765; ;AN000;
766; FOR each column on the current scan line (up to the last non=blank): ;AN000;
767; ;AN000;
768;===============================================================================;AN000;
769SCAN_1_COLUMN: ;AN000;
770 PUSH CX ; Save column counter ;AN000;
771 PUSH CUR_ROW ; Save coordinates of the "column" ;AN000;
772 PUSH CUR_COLUMN ;AN000;
773;-------------------------------------------------------------------------------;AN000;
774; ;AN000;
775; For each pixel within the current column of the scan line: ;AN000;
776; ;AN000;
777;-------------------------------------------------------------------------------;AN000;
778 XOR CX,CX ; CX := Number of pixels to read ;AN000;
779 MOV CL,NB_BOXES_PER_PRT_BUF ; within the current "column" ;AN000;
780SCAN_1_PIXEL: ;AN000;
781 CALL READ_DOT ; AL := Index into translation table ;AN000;
782 XLAT XLT_TAB ; AL := Band mask ;AN000;
783 OR REQ_BAND_MASK,AL ; Add bands required for this pixel ;AN000;
784 ;AN000;
785;-------Get coordinates of next pixel: ;AN000;
786 .IF <ROTATE_SW EQ ON> ; If printing sideways ;AN000;
787 .THEN ; ;AN000;
788 INC CUR_COLUMN ; then, increment column number ;AN000;
789 .ELSE ; ;AN000;
790 INC CUR_ROW ; else, increment row number ;AN000;
791 .ENDIF ; ;AN000;
792 LOOP SCAN_1_PIXEL ;AN000;
793 POP CUR_COLUMN ; Restore coordinates of the "column" ;AN000;
794 POP CUR_ROW ; ;AN000;
795 POP CX ; Restore column counter ;AN000;
796 ;AN000;
797 ;AN000;
798;-------Get coordinates of next "column": ;AN000;
799 .IF <ROTATE_SW EQ ON> ; If printing sideways ;AN000;
800 .THEN ; ;AN000;
801 DEC CUR_ROW ; then, get row above on screen ;AN000;
802 .ELSE ; ;AN000;
803 INC CUR_COLUMN ; else, get column next right ;AN000;
804 .ENDIF ; ;AN000;
805 LOOP SCAN_1_COLUMN ;AN000;
806 ;AN000;
807 POP CX ;AN000;
808 POP BX ;AN000;
809 POP AX ;AN000;
810 POP CUR_COLUMN ;AN000;
811 POP CUR_ROW ;AN000;
812 RET ;AN000;
813SCAN_FOR_BANDS_APA ENDP ;AN000;
814PAGE ;AN000;
815;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AN000;
816;; ;AN000;
817;; PRINT_BAND_APA : PRINT ALL DOTS ON CURRENT LINE THAT NEED THE CURRENT BAND ;AN000;
818;; TO APPROXIMATE THEIR COLOR. ;AN000;
819;; ;AN000;
820;-------------------------------------------------------------------------------;AN000;
821; ;AN000;
822; INPUT: CUR_ROW, ;AN000;
823; CUR_COLUMN : Coordinates of the first pixel to be read in the ;AN000;
824; current scan line. ;AN000;
825; DL : Band mask indicating what print band to use ;AN000;
826; for this print pass. ;AN000;
827; CUR_SCAN_LNE_LENGTH: Length of the current scan line. ;AN000;
828; ROTATE_SW = ON if printing is sideways ;AN000;
829; ;AN000;
830; OUTPUT: PRINTER ;AN000;
831; ;AN000;
832;-------------------------------------------------------------------------------;AN000;
833;; ;AN000;
834;; Data Structures Referenced: ;AN000;
835;; Shared Data Area ;AN000;
836;; Print Info ;AN000;
837;; Color Translate Table ;AN000;
838;; ;AN000;
839;; Description: ;AN000;
840;; Print all dots on this print line which need the current ;AN000;
841;; band. The print line corresponds to several ;AN000;
842;; screen rows (or columns if rotated printing). The number of ;AN000;
843;; rows / columns per print line is stored in NB_BOXES_PER_PRT_BUF. ;AN000;
844;; The band information is obtained from the Color Translate Table. ;AN000;
845;; ;AN000;
846;; Called By: ;AN000;
847;; PRINT_COLOR_APA ;AN000;
848;; ;AN000;
849;; External Calls: ;AN000;
850;; READ_DOT, BIOS INT 10H, STORE_BOX, PRT_BUFFER, PRINT_BYTE ;AN000;
851;; ;AN000;
852;; Logic: ;AN000;
853;; SAVE_START_ROW := CUR_ROW ;AN000;
854;; SAVE_START_COLUMN := CUR_COLUMN ;AN000;
855;; ;AN000;
856;; CALL SET_COLOR_BAND ; Select the color for this print pass ;AN000;
857;; DO (SCAN_LINE_LENGTH) TIMES ;AN000;
858;; Save coordinates of the "column" ;AN000;
859;; Clear the print buffer ;AN000;
860;; DO (BOXES_PER_PRT_BUF) TIMES ;AN000;
861;; CALL READ_DOT(CUR_ROW,CUR_COLUMN,COLOR_NUM) ;AN000;
862;; IF (CUR_BAND_MASK AND XLAT_TAB[COLOR_NUM])=1 THEN ;AN000;
863;; CALL STORE_BOX(black box) ;AN000;
864;; ELSE ;AN000;
865;; CALL STORE_BOX(white box) ;AN000;
866;; ENDIF ;AN000;
867;; IF rotated print THEN ;AN000;
868;; Decrement CUR_COLUMN ;AN000;
869;; ELSE ;AN000;
870;; Increment CUR_ROW ;AN000;
871;; ENDIF ;AN000;
872;; ENDDO ;AN000;
873;; CALL PRINT_BUFFER ;AN000;
874;; Restore coordinates of the "column" ;AN000;
875;; ; Get coordinates of the next "column"; ;AN000;
876;; IF rotated print THEN ;AN000;
877;; Decrement CUR_ROW ;AN000;
878;; CUR_COLUMN := SAVE_START_COLUMN ;AN000;
879;; ELSE ;AN000;
880;; Increment CUR_COLUMN ;AN000;
881;; CUR_ROW := SAVE_START_ROW ;AN000;
882;; ENDIF ;AN000;
883;; ENDDO ;AN000;
884;; RETURN ;AN000;
885;; ;AN000;
886;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AN000;
887PRINT_BAND_APA PROC NEAR ;AN000;
888 PUSH CUR_ROW ; Save coordinates ;AN000;
889 PUSH CUR_COLUMN ;AN000;
890 PUSH AX ;AN000;
891 PUSH BX ;AN000;
892 PUSH CX ;AN000;
893 PUSH SI ;AN000;
894 PUSH DI ;AN000;
895 ;AN000;
896 MOV BX,OFFSET XLT_TAB ; BX := Offset of translation table ;AN000;
897 MOV CX,CUR_SCAN_LNE_LENGTH ;AN000;
898;===============================================================================;AN000;
899; ;AN000;
900; FOR each column on the current scan line (up to the last non=blank): ;AN000;
901; (One "column" contains the number of pixels required to fill the Print buffer);AN000;
902; ;AN000;
903;===============================================================================;AN000;
904PRINT_1_COLUMN: ;AN000;
905;-------------------------------------------------------------------------------;AN000;
906; ;AN000;
907; Clear the print buffer "PRT_BUF" ;AN000;
908; ;AN000;
909;-------------------------------------------------------------------------------;AN000;
910 XOR DI,DI ; DI := Number of bytes cleared in the buffer ;AN000;
911 XOR AX,AX ;AN000;
912 MOV AL,BOX_W ; AX := Number of bytes in the print buffer ;AN000;
913CLEAR_BUF: ; For each byte in the PRT_BUF: ;AN000;
914 MOV PRT_BUF[DI],0 ; Initialize byte to blanks ;AN000;
915 INC DI ; One more has been cleared ;AN000;
916 CMP DI,AX ; All bytes cleared ? ;AN000;
917 JL CLEAR_BUF ; No, clear next one. ;AN000;
918 ;AN000;
919;-------------------------------------------------------------------------------;AN000;
920; ;AN000;
921; Fill up the print buffer "PRT_BUF" ;AN000;
922; ;AN000;
923;-------------------------------------------------------------------------------;AN000;
924 PUSH CX ; Save column counter ;AN000;
925 XOR CX,CX ; CX := Number of pixels to read ;AN000;
926 MOV CL,NB_BOXES_PER_PRT_BUF ; within the current "column" ;AN000;
927 ; of the scan line ;AN000;
928 PUSH CUR_ROW ; Save coordinates of the "column" ;AN000;
929 PUSH CUR_COLUMN ;AN000;
930; ;AN000;
931; For each pixel within the current column of the scan line: ;AN000;
932STORE_1_PIXEL: ;AN000;
933 CALL READ_DOT ; AL := Index into translation table ;AN000;
934 XLAT XLT_TAB ; AL := Band mask ;AN000;
935 .IF <BIT AL AND DL> ; If color of the current pixel needs ;AN000;
936 .THEN ; the current printer band ;AN000;
937 MOV SI,OFFSET BLACK_BOX ; then, store a box in the ;AN000;
938 CALL STORE_BOX ; PRT_BUF ;AN000;
939 .ELSE ; ;AN000;
940 MOV SI,OFFSET WHITE_BOX ; else, store an empty box ;AN000;
941 CALL STORE_BOX ; in the PRT_BUF ;AN000;
942 .ENDIF ;AN000;
943; ;AN000;
944;-------Get coordinates of next pixel: ;AN000;
945 .IF <ROTATE_SW EQ ON> ; If printing sideways ;AN000;
946 .THEN ; ;AN000;
947 INC CUR_COLUMN ; then, increment column number ;AN000;
948 .ELSE ; ;AN000;
949 INC CUR_ROW ; else, increment row number ;AN000;
950 .ENDIF ; ;AN000;
951 LOOP STORE_1_PIXEL ;AN000;
952 ;AN000;
953 POP CUR_COLUMN ; Restore coordinates of the "column" ;AN000;
954 POP CUR_ROW ; ;AN000;
955 POP CX ; Restore column counter ;AN000;
956;-------------------------------------------------------------------------------;AN000;
957; ;AN000;
958; Print the PRT_BUF: ;AN000;
959; ;AN000;
960;-------------------------------------------------------------------------------;AN000;
961 CALL PRINT_BUFFER ;AN000;
962 .IF <BIT ERROR_CODE NZ PRINTER_ERROR> ;AN000;
963 .THEN ; A printer error occurred: QUIT ;AN000;
964 JMP SHORT PRINT_BAND_APA_END ; ;AN000;
965 .ENDIF ;AN000;
966 ;AN000;
967;-------------------------------------------------------------------------------;AN000;
968; ;AN000;
969; Get coordinates of next "column": ;AN000;
970; ;AN000;
971;-------------------------------------------------------------------------------;AN000;
972 .IF <ROTATE_SW EQ ON> ; If printing sideways ;AN000;
973 .THEN ; ;AN000;
974 DEC CUR_ROW ; then, get row above on screen ;AN000;
975 .ELSE ; ;AN000;
976 INC CUR_COLUMN ; else, get column next right ;AN000;
977 .ENDIF ; ;AN000;
978 LOOP PRINT_1_COLUMN ;AN000;
979 ;AN000;
980PRINT_BAND_APA_END: ;AN000;
981 POP DI ;AN000;
982 POP SI ;AN000;
983 POP CX ;AN000;
984 POP BX ;AN000;
985 POP AX ;AN000;
986 POP CUR_COLUMN ; Restore initial coordinates ;AN000;
987 POP CUR_ROW ;AN000;
988 RET ;AN000;
989PRINT_BAND_APA ENDP ;AN000;
990PAGE ;AN000;
991;===============================================================================;AN000;
992; ;AN000;
993; SET_CURSOR : SET THE CURSOR TO CUR_ROW, CUR_COLUMN AND CUR_PAGE ;AN000;
994; ;AN000;
995;-------------------------------------------------------------------------------;AN000;
996; ;AN000;
997; INPUT: CUR_ROW, ;AN000;
998; CUR_COLUMN = Coordinates for the cursor (word) ;AN000;
999; CUR_PAGE = Page for which to set the cursor (byte) ;AN000;
1000; ;AN000;
1001; OUTPUT: SCREEN ;AN000;
1002; ;AN000;
1003;-------------------------------------------------------------------------------;AN000;
1004SET_CURSOR PROC NEAR ;AN000;
1005 PUSH AX ;AN000;
1006 PUSH BX ;AN000;
1007 PUSH DX ;AN000;
1008 MOV DH,BYTE PTR CUR_ROW ;AN000;
1009 MOV DL,BYTE PTR CUR_COLUMN ;AN000;
1010 MOV BH,CUR_PAGE ;AN000;
1011 MOV AH,SET_CURSOR_CALL ; Set cursor request ;AN000;
1012 INT 10H ; Call BIOS ;AN000;
1013 POP DX ;AN000;
1014 POP BX ;AN000;
1015 POP AX ;AN000;
1016 RET ;AN000;
1017SET_CURSOR ENDP ;AN000;
1018PAGE ;AN000;
1019;===============================================================================;AN000;
1020; ;AN000;
1021; SET_COLOR_BAND : SET THE PRINTER TO THE CURRENT COLOR BAND ;AN000;
1022; ;AN000;
1023;-------------------------------------------------------------------------------;AN000;
1024; ;AN000;
1025; INPUT: BX = Offset of current COLORSELECT record in the ;AN000;
1026; Shared data area. ;AN000;
1027; DS:[BP] = Offset of shared data area ;AN000;
1028; ;AN000;
1029; OUTPUT: PRINTER ;AN000;
1030; ;AN000;
1031;-------------------------------------------------------------------------------;AN000;
1032SET_COLOR_BAND PROC NEAR ;AN000;
1033 PUSH AX ;AN000;
1034 PUSH BX ;AN000;
1035 PUSH CX ;AN000;
1036 ;AN000;
1037;-------Send the escape sequence for selecting this color band to the printer: ;AN000;
1038 XOR CX,CX ;AN000;
1039 MOV CL,[BX].NUM_SELECT_ESC ; CX := Number of bytes to send ;AN000;
1040 ADD BX,OFFSET SELECT_ESC ; BX := Offset of bytes to send ;AN000;
1041SEND_1_COLORSELECT_BYTE: ;AN000;
1042 MOV AL,[BX] ; AL := Byte to send to printer ;AN000;
1043 CALL PRINT_BYTE ; Send it ;AN000;
1044 JC SET_COLOR_BAND_END ; If printer error: return ;AN000;
1045 INC BX ; Get next byte ;AN000;
1046 LOOP SEND_1_COLORSELECT_BYTE ;AN000;
1047 ;AN000;
1048SET_COLOR_BAND_END: ;AN000;
1049 POP CX ;AN000;
1050 POP BX ;AN000;
1051 POP AX ;AN000;
1052 RET ;AN000;
1053SET_COLOR_BAND ENDP ;AN000;
1054PAGE ;AN000;
1055;===============================================================================;AN000;
1056; ;AN000;
1057; INIT_BLACK_BOX: INIT. THE BOX FOR PRINTING APA MODE DOTS ON A COLOR PRINTER. ;AN000;
1058; ;AN000;
1059;-------------------------------------------------------------------------------;AN000;
1060; ;AN000;
1061; INPUT: BOX_W, ;AN000;
1062; BOX_H = Size of the print box for one pixel. ;AN000;
1063; ;AN000;
1064; OUTPUT: BLACK_BOX = A box for which all dots are on. ;AN000;
1065; ;AN000;
1066;-------------------------------------------------------------------------------;AN000;
1067; ;AN000;
1068; DESCRIPTION: Initialize the print box used to print a screen pixel. ;AN000;
1069; ;AN000;
1070; For example, ;AN000;
1071; with a size of 3x2 the BLACK_BOX will use 3 bytes: ;AN000;
1072; ;AN000;
1073; ;AN000;
1074; byte1 byte2 byte3 ;AN000;
1075; (column1) (column2) (column3) ;AN000;
1076; bit 7 -->0 0 0 ;AN000;
1077; 0 0 0 ;AN000;
1078; 0 0 0 ;AN000;
1079; 0 0 0 ;AN000;
1080; 0 0 0 ;AN000;
1081; 0 0 0 ;AN000;
1082; 1 1 1 ;AN000;
1083; bit 0 -->1 1 1 ;AN000;
1084; ;AN000;
1085;-------------------------------------------------------------------------------;AN000;
1086INIT_BLACK_BOX PROC NEAR ;AN000;
1087 PUSH AX ;AN000;
1088 PUSH BX ;AN000;
1089 PUSH CX ;AN000;
1090 ;AN000;
1091;-------Build one box column: ;AN000;
1092 XOR CX,CX ;AN000;
1093 MOV CL,BOX_H ; CX := Height in bits of the print box ;AN000;
1094 XOR AL,AL ; AX := Bit mask for creating box column ;AN000;
1095 .REPEAT ; For height of the box: ;AN000;
1096 SHL AL,1 ; ;AN000;
1097 OR AL,1 ; Insert one bit in the box column ;AN000;
1098 .LOOP ;AN000;
1099 ;AN000;
1100;-------------------------------------------------------------------------------;AN000;
1101; ;AN000;
1102; AL now contains one box column. ;AN000;
1103; ;AN000;
1104;-------------------------------------------------------------------------------;AN000;
1105 ;AN000;
1106;-------Replicate this column over all columns of the box. ;AN000;
1107 XOR BX,BX ; BX := Index into the BOX ;AN000;
1108INIT_1_BLACK_COLUMN: ;AN000;
1109 MOV BLACK_BOX[BX],AL; Init current column to black box column ;AN000;
1110 INC BX ; Get next column ;AN000;
1111 CMP BL,BOX_W ;AN000;
1112 JL INIT_1_BLACK_COLUMN ;AN000;
1113 ;AN000;
1114 POP CX ;AN000;
1115 POP BX ;AN000;
1116 POP AX ;AN000;
1117 RET ;AN000;
1118INIT_BLACK_BOX ENDP ;AN000;
1119INCLUDE GRCOMMON.ASM ;AN000;
1120LEN_OF_COLOR_MODULES EQU $-PRINT_COLOR ;AN000;
1121CODE ENDS ;AN000;
1122 END ;AN000;
diff --git a/v4.0/src/CMD/GRAPHICS/GRCOLPRT.EXT b/v4.0/src/CMD/GRAPHICS/GRCOLPRT.EXT
new file mode 100644
index 0000000..5e07eaa
--- /dev/null
+++ b/v4.0/src/CMD/GRAPHICS/GRCOLPRT.EXT
@@ -0,0 +1,25 @@
1.XLIST
2PAGE ,132 ;AN000;
3;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
4;; DOS - GRAPHICS Command
5;; (C) Copyright 1988 Microsoft
6;; ;AN000;
7;; File Name: GRCOLPRT.EXT ;AN000;
8;; ---------- ;AN000;
9;; ;AN000;
10;; Description: ;AN000;
11;; ------------ ;AN000;
12;; Include file containing external declarations for ;AN000;
13;; the code and data defined in GRCOLPRT.ASM ;AN000;
14;; ;AN000;
15;; Change History: ;AN000;
16;; --------------- ;AN000;
17;; ;AN000;
18;; ;AN000;
19;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
20 ;; ;AN000;
21;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
22.LIST ;AN000;
23 EXTRN PRINT_MODULE_START:NEAR ;; ;AN000;
24 EXTRN PRINT_COLOR:NEAR ;AN000;
25 EXTRN LEN_OF_COLOR_MODULES:ABS ;; ;AN000;
diff --git a/v4.0/src/CMD/GRAPHICS/GRCOMMON.ASM b/v4.0/src/CMD/GRAPHICS/GRCOMMON.ASM
new file mode 100644
index 0000000..56d1b08
--- /dev/null
+++ b/v4.0/src/CMD/GRAPHICS/GRCOMMON.ASM
@@ -0,0 +1,858 @@
1 PAGE ,132 ;AN000;
2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
3;; DOS - GRAPHICS Command
4;; (c) Copyright 1988 Microsoft
5;; ;AN000;
6;; File Name: GRCOMMON.ASM ;AN000;
7;; ---------- ;AN000;
8;; ;AN000;
9;; Description: ;AN000;
10;; ------------ ;AN000;
11;; ;AN000;
12;; This file contains the modules common to the Print Screen ;AN000;
13;; process of GRAPHICS.COM. ;AN000;
14;; This file is included by both set of Print modules. ;AN000;
15;; ;AN000;
16;; This file MUST BE COMPILED WITH EACH SET OF MODULES since, ;AN000;
17;; one set is relocated in memory at installation time; all ;AN000;
18;; references to the common procedures must be resolved from ;AN000;
19;; within each set of print modules. ;AN000;
20;; ;AN000;
21;; The set of common modules is relocated in memory along with ;AN000;
22;; the selected set of print modules. ;AN000;
23;; ;AN000;
24;; Documentation Reference: ;AN000;
25;; ------------------------ ;AN000;
26;; OASIS High Level Design ;AN000;
27;; OASIS GRAPHICS I1 Overview ;AN000;
28;; ;AN000;
29;; Procedures Contained in This File: ;AN000;
30;; ---------------------------------- ;AN000;
31;; READ_DOT ;AN000;
32;; LOC_MODE_PRT_INFO ;AN000;
33;; STORE_BOX ;AN000;
34;; PRINT_BUFFER ;AN000;
35;; GET_SCREEN_INFO ;AN000;
36;; SETUP_PRT ;AN000;
37;; RESTORE_PRT ;AN000;
38;; NEW_PRT_LINE ;AN000;
39;; PRINT_BYTE ;AN000;
40;; DET_CUR_SCAN_LNE_LENGTH ;AN000;
41;; ;AN000;
42;; Include Files Required: ;AN000;
43;; ----------------------- ;AN000;
44;; none ;AN000;
45;; ;AN000;
46;; External Procedure References: ;AN000;
47;; ------------------------------ ;AN000;
48;; FROM FILE GRCTRL.ASM: ;AN000;
49;; PRT_SCR - Main module for printing the screen. ;AN000;
50;; FROM FILE GRBWPRT.ASM: ;AN000;
51;; PRT_BW_APA - Main module for printing on BW printer. ;AN000;
52;; FROM FILE GRCOLPRT.ASM: ;AN000;
53;; PRINT_COLOR - Main module for printing on COLOR printer. ;AN000;
54;; ;AN000;
55;; Linkage Instructions: ;AN000;
56;; -------------------- ;AN000;
57;; ;AN000;
58;; This file is included by both GRBWPRT.ASM and GRCOLPRT.ASM and is ;AN000;
59;; compiled with each of them. However, only one copy is made resident. ;AN000;
60;; ;AN000;
61;; Change History: ;AN000;
62;; --------------- ;AN000;
63;; ;AN000;
64;; ;AN000;
65;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
66 ;AN000;
67PAGE ;AN000;
68;===============================================================================;AN000;
69; ;AN000;
70; LOC_MODE_PRT_INFO: LOCATE DISPLAYMODE PRINTER INFO. FOR THE CURRENT ;AN000;
71; MODE ;AN000;
72; ;AN000;
73;-------------------------------------------------------------------------------;AN000;
74; ;AN000;
75; INPUT: BP = Offset of the shared data area ;AN000;
76; CUR_MODE = Current video mode ;AN000;
77; ;AN000;
78; OUTPUT: CUR_MODE_PTR = Absolute Offset of the ;AN000;
79; current DISPLAYMODE INFO record. ;AN000;
80; ;AN000;
81; ERROR_CODE = DISPLAYMODE_INFO_NOT_FOUND if not found. ;AN000;
82; ;AN000;
83; CALLED BY: PRINT_COLOR ;AN000;
84; PRINT_BW_APA ;AN000;
85; ;AN000;
86; ;AN000;
87;-------------------------------------------------------------------------------;AN000;
88; ;AN000;
89; DESCRIPTION: DISPLAYMODE_PTR is pointing to the first DISPLAYMODE ;AN000;
90; INFO record within the Shared Data Area. ;AN000;
91; ;AN000;
92; This (chained) list of DISPLAYMODE records is scanned until the record ;AN000;
93; for the current mode is found. ;AN000;
94; ;AN000;
95; Note: All pointers in the DISPLAYMODE records are relative to the beginning ;AN000;
96; of the shared data area. Therefore, we must add the offset of the ;AN000;
97; shared data area (in BP) in order to access the data these pointers ;AN000;
98; are referencing. ;AN000;
99; ;AN000;
100; The CUR_MODE_PTR is relative to the segment and references the ;AN000;
101; DISPLAYMODE record for the video mode currently set at print screen ;AN000;
102; time. ;AN000;
103; ;AN000;
104; LOGIC: ;AN000;
105; ;AN000;
106; FOUND := FALSE ;AN000;
107; DO UNTIL FOUND OR END_OF_LIST ;AN000;
108; Get a display mode information record ;AN000;
109; IF record.DISP_MODE = CUR_MODE ;AN000;
110; THEN FOUND := TRUE ;AN000;
111; ELSE ;AN000;
112; CUR_MODE_PTR := record.NEXT_DISP_MODE ;AN000;
113; ;AN000;
114; ;AN000;
115 ;AN000;
116LOC_MODE_PRT_INFO PROC NEAR ;AN000;
117 PUSH BX ;AN000;
118 PUSH CX ;AN000;
119 PUSH DX ;AN000;
120 PUSH SI ;AN000;
121 ;AN000;
122 MOV BX,DS:[BP].DISPLAYMODE_PTR ; [BX] := Current DISPLAYMODE ;AN000;
123 ADD BX,BP ; record ;AN000;
124 MOV DL,CUR_MODE ; DL := Current mode ;AN000;
125 ;AN000;
126SCAN_1_DISPLAYMODE_RECORD: ;AN000;
127 MOV SI,[BX].DISP_MODE_LIST_PTR ; [SI] : First mode covered ;AN000;
128 ADD SI,BP ; by this DISPLAYMODE record ;AN000;
129 MOV CL,[BX].NUM_DISP_MODE ; Scan each mode in the list ;AN000;
130 XOR CH,CH ;AN000;
131SCAN_LIST_OF_MODES: ;AN000;
132 CMP CS:[SI],DL ; FOUND ? ;AN000;
133 JE FOUND ;AN000;
134 INC SI ; NO, get next mode in ;AN000;
135 LOOP SCAN_LIST_OF_MODES ; DISPLAYMODE record ;AN000;
136 ;AN000;
137 CMP [BX].NEXT_DISP_MODE,-1 ; END OF DISPLAYMODE LIST ? ;AN000;
138 JE NOT_FOUND ; Yes, this mode not supported ;AN000;
139NEXT_RECORD: ; No, ;AN000;
140 MOV BX,[BX].NEXT_DISP_MODE ; [BX] := Next record ;AN000;
141 ADD BX,BP ; ;AN000;
142 JMP SHORT SCAN_1_DISPLAYMODE_RECORD ;AN000;
143 ;AN000;
144FOUND: ; Found: ;AN000;
145 MOV CUR_MODE_PTR,BX ; Update pointer to current ;AN000;
146 JMP SHORT LOC_MODE_PRT_INFO_END ; DISPLAYMODE record. ;AN000;
147 ;AN000;
148NOT_FOUND: ; Not found: ;AN000;
149 MOV ERROR_CODE,DISPLAYMODE_INFO_NOT_FOUND ; Return error condition ;AN000;
150 ;AN000;
151LOC_MODE_PRT_INFO_END: ;AN000;
152 POP SI ;AN000;
153 POP DX ;AN000;
154 POP CX ;AN000;
155 POP BX ;AN000;
156 RET ;AN000;
157LOC_MODE_PRT_INFO ENDP ;AN000;
158PAGE ;AN000;
159;===============================================================================;AN000;
160; ;AN000;
161; STORE_BOX : STORE ONE BOX IN THE PRINT BUFFER. ;AN000;
162; ;AN000;
163;-------------------------------------------------------------------------------;AN000;
164; ;AN000;
165; INPUT: SI = OFFSET OF THE BOX TO BE PRINTED ;AN000;
166; BOX_W = BOX WIDTH IN BITS ;AN000;
167; BOX_H = BOX HEIGHT IN BITS ;AN000;
168; ;AN000;
169; OUTPUT: PRT_BUF = THE PRINT BUFFER ;AN000;
170; ;AN000;
171;-------------------------------------------------------------------------------;AN000;
172; ;AN000;
173; DESCRIPTION: The print buffer is first shifted left in order to make ;AN000;
174; room for the new box (Note: the MSB's are lost; they are assumed to ;AN000;
175; have been printed), then the box is inserted in the low-order bits of ;AN000;
176; the printer buffer. ;AN000;
177; ;AN000;
178PAGE ;AN000;
179; EXAMPLE ;AN000;
180; ------- ;AN000;
181; BEFORE: AFTER: ;AN000;
182; ;AN000;
183; BOX: 0 0 0 ;AN000;
184; 0 0 0 ;AN000;
185; 0 0 0 ;AN000;
186; 0 0 0 ;AN000;
187; 0 0 0 ;AN000;
188; 0 0 0 ;AN000;
189; b1 b2 b3 ;AN000;
190; b4 b5 b6 ;AN000;
191; ;AN000;
192; PRT_BUF: byte1 byte2 byte3 PRT_BUF: byte1 byte2 byte3 ;AN000;
193; 0 1 0 1 1 1 ;AN000;
194; 1 0 1 1 1 1 ;AN000;
195; 1 1 1 1 1 1 ;AN000;
196; 1 1 1 1 1 1 ;AN000;
197; 1 1 1 1 1 1 ;AN000;
198; 1 1 1 1 1 1 ;AN000;
199; 1 1 1 b1 b2 b3 ;AN000;
200; LSB --> 1 1 1 b4 b5 b6 ;AN000;
201; ;AN000;
202; ;AN000;
203; LOGIC: ;AN000;
204; ;AN000;
205; FOR each byte of the buffer (BOX_W) ;AN000;
206; BEGIN ;AN000;
207; Make room for the box to be inserted ;AN000;
208; Insert the box ;AN000;
209; END ;AN000;
210; ;AN000;
211STORE_BOX PROC NEAR ;AN000;
212 PUSH BX ;AN000;
213 PUSH CX ;AN000;
214 PUSH DI ;AN000;
215 ;AN000;
216 MOV DI,OFFSET PRT_BUF ; DI := Offset of the Print buffer ;AN000;
217 XOR BX,BX ; BX := Byte index number ;AN000;
218 ;AN000;
219 MOV CL,BOX_H ; CL := Number of BITS to be shifted ;AN000;
220; FOR each column (byte) of the box to be stored in the buffer: ;AN000;
221STORE_1_BYTE: ;AN000;
222 SHL BYTE PTR [BX][DI],CL ; Make room for the bits to be inserted ;AN000;
223 MOV CH,[BX][SI] ; CH := column of the box to be inserted;AN000;
224 OR [BX][DI],CH ; Insert the box column in the buffer ;AN000;
225 INC BL ; Get next column (byte) of the box ;AN000;
226 CMP BL,BOX_W ; All columns (bytes) of box stored ? ;AN000;
227 JL STORE_1_BYTE ; No, store next one. ;AN000;
228 ;AN000;
229STORE_BOX_END: ;AN000;
230 POP DI ;AN000;
231 POP CX ;AN000;
232 POP BX ;AN000;
233 RET ;AN000;
234STORE_BOX ENDP ;AN000;
235PAGE ;AN000;
236;===============================================================================;AN000;
237; ;AN000;
238; PRINT_BUFFER : PRINT THE BUFFER ;AN000;
239; ;AN000;
240;-------------------------------------------------------------------------------;AN000;
241; ;AN000;
242; INPUT: PRT_BUF = BYTES TO BE PRINTED ;AN000;
243; BOW_W = BOX WIDTH ;AN000;
244; ;AN000;
245; OUTPUT: PRINTER ;AN000;
246; ;AN000;
247;-------------------------------------------------------------------------------;AN000;
248; ;AN000;
249; DESCRIPTION: Prints BOX_W bytes. ;AN000;
250; ;AN000;
251; LOGIC: ;AN000;
252; ;AN000;
253; DO for each column in one pattern ;AN000;
254; BEGIN ;AN000;
255; Print one byte from the buffer ;AN000;
256; END ;AN000;
257; ;AN000;
258PRINT_BUFFER PROC NEAR ;AN000;
259 PUSH AX ;AN000;
260 PUSH BX ;AN000;
261 PUSH CX ;AN000;
262 ;AN000;
263 MOV BX,OFFSET PRT_BUF ;AN000;
264 XOR CX,CX ;AN000;
265 MOV CL,BOX_W ;AN000;
266PRINT_1_BUF_COLUMN: ;AN000;
267 MOV AL,[BX] ; Print one byte ;AN000;
268 CALL PRINT_BYTE ;AN000;
269 JC PRINT_BUFFER_END; If printer error, quit the loop ;AN000;
270 INC BX ; Get next byte ;AN000;
271 LOOP PRINT_1_BUF_COLUMN ;AN000;
272PRINT_BUFFER_END: ;AN000;
273 POP CX ;AN000;
274 POP BX ;AN000;
275 POP AX ;AN000;
276 RET ;AN000;
277PRINT_BUFFER ENDP ;AN000;
278PAGE ;AN000;
279;===============================================================================;AN000;
280; ;AN000;
281; GET_SCREEN_INFO : GET INFORMATION ABOUT HOW TO READ THE SCREEN. ;AN000;
282; ;AN000;
283;-------------------------------------------------------------------------------;AN000;
284; ;AN000;
285; INPUT: SCREEN_HEIGHT = Number of pixel rows on the screen ;AN000;
286; SCREEN_WIDTH = Number of pixel columns on screen ;AN000;
287; CUR_MODE_PTR = Offset of the current DISPLAYMODE info rec. ;AN000;
288; ;AN000;
289; OUTPUT: PRINTER ;AN000;
290; SCAN_LINE_MAX_LENGTH = Maximum length of Screen scan line. ;AN000;
291; NB_SCAN_LINES = Number of SCAN LINES on the screen ;AN000;
292; CUR_ROW,CUR_COLUMN = Coordinates of the first pixel to be ;AN000;
293; read on the screen ;AN000;
294; NB_BOXES_PER_PRT_BUF = Number of boxes fitting in the Print ;AN000;
295; buffer ;AN000;
296; ;AN000;
297; CALLED BY: PRINT_COLOR ;AN000;
298; PRT_BW_APA ;AN000;
299; ;AN000;
300;-------------------------------------------------------------------------------;AN000;
301; ;AN000;
302; DESCRIPTION: ;AN000;
303; ;AN000;
304; 1) Determine where to start reading the screen. ;AN000;
305; For non-rotated printing, it should start with the top-left ;AN000;
306; corner pixel. ;AN000;
307; For rotated printing, it should start with the low-left corner ;AN000;
308; pixel. ;AN000;
309; ;AN000;
310; 2) Determine the length of a scan line. ;AN000;
311; For non-rotated printing, it is the WIDTH of the screen. ;AN000;
312; For rotated printing, it is the HEIGHT of the screen. ;AN000;
313; ;AN000;
314; 3) Determine the number of scan lines on the screen. ;AN000;
315; For non-rotated printing, it is the HEIGHT of the screen divided ;AN000;
316; by the number of boxes fitting in the print buffer. ;AN000;
317; For rotated printing, it is the WIDTH of the screen divided by ;AN000;
318; the number of boxes fitting in the print buffer. ;AN000;
319; ;AN000;
320; LOGIC: ;AN000;
321; ;AN000;
322; CUR_COLUMN := 0 ;AN000;
323; IF printing is sideways ;AN000;
324; THEN ;AN000;
325; CUR_ROW := SCREEN_HEIGHT - 1 ; Low-left pixel ;AN000;
326; SCAN_LINE_MAX_LENGTH := SCREEN_HEIGHT ;AN000;
327; NB_SCAN_LINES := SCREEN_WIDTH / NB_BOXES_PER_PRT_BUF ;AN000;
328; ELSE ;AN000;
329; CUR_ROW := 0 ; Top-left pixel ;AN000;
330; SCAN_LINE_MAX_LENGTH := SCREEN_WIDTH ;AN000;
331; NB_SCAN_LINES := SCREEN_HEIGHT / NB_BOXES_PER_PRT_BUF ;AN000;
332; ;AN000;
333; ;AN000;
334GET_SCREEN_INFO PROC NEAR ;AN000;
335 PUSH AX ;AN000;
336 PUSH BX ; Used for DIV ;AN000;
337 PUSH DX ; Used for DIV ;AN000;
338 ;AN000;
339 MOV BX,CUR_MODE_PTR ; BX := Offset DISPLAYMODE info record ;AN000;
340;-------------------------------------------------------------------------------;AN000;
341; ;AN000;
342; Calculate how many printer boxes fit in the print buffer: ;AN000;
343; ;AN000;
344;-------------------------------------------------------------------------------;AN000;
345 MOV AX,8 ; Num := 8 bits / Box heigth ;AN000;
346 MOV DL,[BX].BOX_HEIGHT ;AN000;
347 DIV DL ;AN000;
348 MOV NB_BOXES_PER_PRT_BUF,AL ;AN000;
349;-------------------------------------------------------------------------------;AN000;
350; ;AN000;
351; Determine where to start reading the screen: ;AN000;
352; ;AN000;
353;-------------------------------------------------------------------------------;AN000;
354 MOV CUR_COLUMN,0 ; Reading always start from left of scr ;AN000;
355.IF <[BX].PRINT_OPTIONS EQ ROTATE> ;AN000;
356.THEN ;AN000;
357;-------------------------------------------------------------------------------;AN000;
358; ;AN000;
359; Printing is sideways; screen must be read starting in low-left corner. ;AN000;
360; ;AN000;
361;-------------------------------------------------------------------------------;AN000;
362 MOV AX,SCREEN_HEIGHT ;AN000;
363 MOV SCAN_LINE_MAX_LENGTH,AX ; Scan line length := screen height ;AN000;
364 DEC AX ;AN000;
365 MOV CUR_ROW,AX ; First row := screen height - 1 ;AN000;
366 ;AN000;
367;-------Calculate the number of scan lines: ;AN000;
368 MOV AX,SCREEN_WIDTH ; DX AX = Screen width ;AN000;
369 CWD ; ;AN000;
370 XOR BX,BX ; BX = Number of boxes per print buf ;AN000;
371 MOV BL,NB_BOXES_PER_PRT_BUF ; ;AN000;
372 DIV BX ; Screen width / number boxes per buff ;AN000;
373 MOV NB_SCAN_LINES,AX ; Number of scan lines := result ;AN000;
374.ELSE ;AN000;
375;-------------------------------------------------------------------------------;AN000;
376; ;AN000;
377; Printing is not sideways; screen must be read starting in top-left corner ;AN000;
378; ;AN000;
379;-------------------------------------------------------------------------------;AN000;
380 MOV AX,SCREEN_WIDTH ;AN000;
381 MOV SCAN_LINE_MAX_LENGTH,AX ; Scan line length := screen width ;AN000;
382 MOV CUR_ROW,0 ; First row := 0 ;AN000;
383 ;AN000;
384;-------Calculate the number of scan lines: ;AN000;
385 MOV AX,SCREEN_HEIGHT ; DX AX = Screen height ;AN000;
386 CWD ; ;AN000;
387 XOR BX,BX ; BX = Number of boxes per print buff ;AN000;
388 MOV BL,NB_BOXES_PER_PRT_BUF ; ;AN000;
389 DIV BX ; Screen height/number boxes per buff. ;AN000;
390 MOV NB_SCAN_LINES,AX ; Number of scan lines := result ;AN000;
391.ENDIF ;AN000;
392 POP DX ;AN000;
393 POP BX ;AN000;
394 POP AX ;AN000;
395 RET ;AN000;
396GET_SCREEN_INFO ENDP ;AN000;
397PAGE ;AN000;
398;===============================================================================;AN000;
399; ;AN000;
400; DET_CUR_SCAN_LNE_LENGTH : Determine where is the last non-blank "scan line ;AN000;
401; column" on the current scan line. ;AN000;
402; ;AN000;
403;-------------------------------------------------------------------------------;AN000;
404; ;AN000;
405; INPUT: CUR_ROW, ;AN000;
406; CUR_COLUMN = Coordinates of the top pixel of the current ;AN000;
407; scan line. ;AN000;
408; XLT_TAB = Color translation table ;AN000;
409; ;AN000;
410; OUTPUT: CUR_SCAN_LNE_LENGTH = Number of "columns" of pixels from the ;AN000;
411; beginning of the scan line up to ;AN000;
412; the last non-blank pixel. ;AN000;
413; ;AN000;
414; DATA SCREEN_WIDTH, ;AN000;
415; REFERENCED: SCREEN_HEIGHT = Dimensions of the screen in pels ;AN000;
416; SCAN_LINE_MAX_LENGTH= Maximum length of the scan line ;AN000;
417; ROTATE_SW = ON if printing is sideways ;AN000;
418; ;AN000;
419;-------------------------------------------------------------------------------;AN000;
420; ;AN000;
421; DESCRIPTION: Determine where is the last non-blank "column" by reading ;AN000;
422; the scan line backwards, one column at a time. ;AN000;
423; ;AN000;
424; ;AN000;
425; LOGIC: ;AN000;
426; ;AN000;
427; ; Obtain coordinates for the top pixel of the last column on the current ;AN000;
428; ; scan line: ;AN000;
429; IF printing is sideways ;AN000;
430; THEN ;AN000;
431; CUR_ROW := 0 ;AN000;
432; ELSE ;AN000;
433; CUR_COLUMN := SCREEN_WIDTH - 1 ;AN000;
434; ;AN000;
435; CUR_SCAN_LNE_LENGTH := SCAN_LINE_MAX_LENGTH ;AN000;
436; ; Read a column of pixels on the scan line until a non-blank is found: ;AN000;
437; For each column on the screen ;AN000;
438; CALL FILL_BUFF ;AN000;
439; ; Check if PRT_BUF is empty ;AN000;
440; IF buffer is empty ;AN000;
441; THEN DEC CUR_SCAN_LNE_LENGTH ;AN000;
442; ; Get next column ;AN000;
443; IF printing sideways THEN DEC CUR_ROW ;AN000;
444; ELSE DEC CUR_COLUMN ;AN000;
445; ELSE quit the loop ;AN000;
446; ;AN000;
447DET_CUR_SCAN_LNE_LENGTH PROC NEAR ;AN000;
448 PUSH AX ;AN000;
449 PUSH BX ;AN000;
450 PUSH CX ;AN000;
451 PUSH DX ;AN000;
452 PUSH SI ;AN000;
453 PUSH DI ;AN000;
454 PUSH CUR_COLUMN ;AN000;
455 PUSH CUR_ROW ;AN000;
456 ;AN000;
457 MOV BX,OFFSET XLT_TAB ; BX := Offset of XLT_TAB ;AN000;
458;-------------------------------------------------------------------------------;AN000;
459; ;AN000;
460; Obtain coordinates of the top pixel for the last column of the current ;AN000;
461; scan line: ;AN000;
462; ;AN000;
463;-------------------------------------------------------------------------------;AN000;
464 .IF <ROTATE_SW EQ ON> ; If printing sideways ;AN000;
465 .THEN ; then, ;AN000;
466 MOV CUR_ROW,0 ; CUR_ROW := 0 ;AN000;
467 .ELSE ; else, ;AN000;
468 MOV CX,SCREEN_WIDTH ; CUR_COLUMN := SCREEN_WIDTH - 1 ;AN000;
469 DEC CX ; ;AN000;
470 MOV CUR_COLUMN,CX ; ;AN000;
471 .ENDIF ;AN000;
472;-------------------------------------------------------------------------------;AN000;
473; ;AN000;
474; Read the scan line backwards "column" by "column" until a non-blank is found: ;AN000;
475; ;AN000;
476;-------------------------------------------------------------------------------;AN000;
477 MOV CX,SCAN_LINE_MAX_LENGTH ; CX := current length ;AN000;
478; ;AN000;
479;-------For each "column" ;AN000;
480CHECK_1_COLUMN: ;AN000;
481 MOV SI,CUR_ROW ; Save coordinates of the column ;AN000;
482 MOV DI,CUR_COLUMN ; in SI, DI ;AN000;
483 XOR DL,DL ; DL := Number of pixels verified in ;AN000;
484 ; one "column" ;AN000;
485; ;AN000;
486;-------For each pixel within that "column" ;AN000;
487CHECK_1_PIXEL: ;AN000;
488 CALL READ_DOT ; AL := Index into translation table ;AN000;
489 XLAT XLT_TAB ; AL := Band mask or Intensity ;AN000;
490 ;AN000;
491;-------Check if pixel will map to an empty box: ;AN000;
492 .IF <DS:[BP].PRINTER_TYPE EQ BLACK_WHITE> ; If BLACK AND WHITE printer ;AN000;
493 .THEN ; then, check for intensity of white ;AN000;
494 CMP AL,WHITE_INT ; If curent pixel not blank ;AN000;
495 JNE DET_LENGTH_END ; THEN, LEAVE THE LOOP ;AN000;
496 .ELSE ; else, COLOR printer ;AN000;
497 OR AL,AL ; IF Band mask not blank ;AN000;
498 JNZ DET_LENGTH_END ; THEN, LEAVE THE LOOP ;AN000;
499 .ENDIF ;AN000;
500 ;AN000;
501;-------All pixels so far on this "column" are blank, get next pixel: ;AN000;
502 .IF <ROTATE_SW EQ ON> ; If printing sideways ;AN000;
503 .THEN ; ;AN000;
504 INC CUR_COLUMN ; then, increment column number ;AN000;
505 .ELSE ; ;AN000;
506 INC CUR_ROW ; else, increment row number ;AN000;
507 .ENDIF ; ;AN000;
508 INC DL ; One more pixel checked ;AN000;
509 CMP DL,NB_BOXES_PER_PRT_BUF ; All pixels for that column done ? ;AN000;
510 JL CHECK_1_PIXEL ; No, check next one. ;AN000;
511 ;AN000;
512;-------Nothing to print for this column, get next column ;AN000;
513 .IF <ROTATE_SW EQ ON> ; If printing sideways ;AN000;
514 .THEN ; then, ;AN000;
515 MOV CUR_COLUMN,DI ; Restore column number ;AN000;
516 INC CUR_ROW ; Get next row ;AN000;
517 .ELSE ; else, ;AN000;
518 MOV CUR_ROW,SI ; Restore row number ;AN000;
519 DEC CUR_COLUMN ; Get next column ;AN000;
520 .ENDIF ; ;AN000;
521 LOOP CHECK_1_COLUMN ; CX (length) := CX - 1 ;AN000;
522 ;AN000;
523DET_LENGTH_END: ;AN000;
524 MOV CUR_SCAN_LNE_LENGTH,CX ; Get current length ;AN000;
525 ;AN000;
526 POP CUR_ROW ;AN000;
527 POP CUR_COLUMN ;AN000;
528 POP DI ;AN000;
529 POP SI ;AN000;
530 POP DX ;AN000;
531 POP CX ;AN000;
532 POP BX ;AN000;
533 POP AX ;AN000;
534 RET ;AN000;
535DET_CUR_SCAN_LNE_LENGTH ENDP ;AN000;
536PAGE ;AN000;
537;===============================================================================;AN000;
538; ;AN000;
539; SETUP_PRT : SET UP THE PRINTER FOR PRINTING IN GRAPHIC MODE ;AN000;
540; ;AN000;
541;-------------------------------------------------------------------------------;AN000;
542; ;AN000;
543; INPUT: CUR_MODE_PTR = Offset of the DISPLAYMODE information ;AN000;
544; record for the current mode ;AN000;
545; ;AN000;
546; OUTPUT: PRINTER ;AN000;
547; ;AN000;
548; CALLED BY: PRINT_COLOR ;AN000;
549; PRT_BW_APA ;AN000;
550; ;AN000;
551;-------------------------------------------------------------------------------;AN000;
552; ;AN000;
553; DESCRIPTION: Extract the SETUP escape sequence from the DISPLAYMODE ;AN000;
554; information record; Send this escape sequence to the printer. ;AN000;
555; ;AN000;
556; LOGIC: ;AN000;
557; ;AN000;
558; Number of bytes to print := CUR_MODE_PTR.NUM_SETUP_ESC ;AN000;
559; ;AN000;
560; Get the escape sequence: ;AN000;
561; SI := CUR_MODE_PTR.SETUP_ESC_PTR ;AN000;
562; ;AN000;
563; FOR each byte to be printed ;AN000;
564; PRINT_BYTE [SI] ; Send the byte to the printer ;AN000;
565; INC SI ; Get the next byte ;AN000;
566; ;AN000;
567SETUP_PRT PROC NEAR ;AN000;
568 PUSH AX ;AN000;
569 PUSH BX ;AN000;
570 PUSH CX ;AN000;
571 ;AN000;
572 MOV BX,CUR_MODE_PTR ; BX := Displaymode info record. ;AN000;
573 ;AN000;
574 XOR CX,CX ; CX := Number of bytes to print ;AN000;
575 MOV CL,[BX].NUM_SETUP_ESC ; ;AN000;
576.IF <CL G 0> ; If there is at least one ;AN000;
577.THEN ; byte to be printed: ;AN000;
578 MOV BX,[BX].SETUP_ESC_PTR ; BX := Offset sequence to send ;AN000;
579 ADD BX,BP ;AN000;
580 ;AN000;
581SEND_1_SETUP_BYTE: ;AN000;
582 MOV AL,[BX] ; AL := byte to print ;AN000;
583 CALL PRINT_BYTE ; Send it to the printer ;AN000;
584 JC SETUP_PRT_END ; If printer error, quit the loop ;AN000;
585 INC BX ; Get next byte ;AN000;
586 LOOP SEND_1_SETUP_BYTE ;AN000;
587.ENDIF ;AN000;
588SETUP_PRT_END: ;AN000;
589 POP CX ;AN000;
590 POP BX ;AN000;
591 POP AX ;AN000;
592 RET ;AN000;
593SETUP_PRT ENDP ;AN000;
594PAGE ;AN000;
595;===============================================================================;AN000;
596; ;AN000;
597; RESTORE_PRT : RESTORE THE PRINTER TO ITS INITIAL STATUS ;AN000;
598; ;AN000;
599;-------------------------------------------------------------------------------;AN000;
600; ;AN000;
601; INPUT: CUR_MODE_PTR = Offset of the DISPLAYMODE information ;AN000;
602; record for the current mode ;AN000;
603; ;AN000;
604; OUTPUT: PRINTER ;AN000;
605; ;AN000;
606; CALLED BY: PRINT_COLOR ;AN000;
607; PRT_BW_APA ;AN000;
608;-------------------------------------------------------------------------------;AN000;
609; ;AN000;
610; DESCRIPTION: Extract the RESTORE escape sequence from the DISPLAYMODE ;AN000;
611; information record; Send this escape sequence to the printer. ;AN000;
612; ;AN000;
613; LOGIC: ;AN000;
614; ;AN000;
615; Number of bytes to print := CUR_MODE_PTR.NUM_RESTORE_ESC ;AN000;
616; ;AN000;
617; Get the escape sequence: ;AN000;
618; SI := CUR_MODE_PTR.RESTORE_ESC_PTR ;AN000;
619; FOR each byte to be printed ;AN000;
620; PRINT_BYTE [SI] ; Send the byte to the printer ;AN000;
621; INC SI ; Get the next byte ;AN000;
622; ;AN000;
623RESTORE_PRT PROC NEAR ;AN000;
624 PUSH AX ;AN000;
625 PUSH BX ;AN000;
626 PUSH CX ;AN000;
627 ;AN000;
628 MOV BX,CUR_MODE_PTR ; BX := Displaymode info record. ;AN000;
629 ;AN000;
630 XOR CX,CX ; CX := Number of bytes to print ;AN000;
631 MOV CL,[BX].NUM_RESTORE_ESC ;AN000;
632.IF <CL G 0> ; If there is at least one ;AN000;
633.THEN ; byte to be printed: ;AN000;
634 MOV BX,[BX].RESTORE_ESC_PTR ; BX := Offset sequence to send ;AN000;
635 ADD BX,BP ;AN000;
636 ;AN000;
637SEND_1_RESTORE_BYTE: ;AN000;
638 MOV AL,[BX] ; AL := byte to print ;AN000;
639 CALL PRINT_BYTE ; Send it to the printer ;AN000;
640 JC RESTORE_PRT_END ; If printer error, quit the loop ;AN000;
641 INC BX ; Get next byte ;AN000;
642 LOOP SEND_1_RESTORE_BYTE ;AN000;
643.ENDIF ;AN000;
644RESTORE_PRT_END: ;AN000;
645 POP CX ;AN000;
646 POP BX ;AN000;
647 POP AX ;AN000;
648 RET ;AN000;
649RESTORE_PRT ENDP ;AN000;
650PAGE ;AN000;
651;===============================================================================;AN000;
652; ;AN000;
653; NEW_PRT_LINE : INITIALIZE THE PRINTER FOR A GRAPHIC LINE ;AN000;
654; ;AN000;
655;-------------------------------------------------------------------------------;AN000;
656; ;AN000;
657; INPUT: CUR_MODE_PTR = Offset of the DISPLAYMODE information ;AN000;
658; record for the current mode ;AN000;
659; CUR_SCAN_LNE_LENGTH = Number of bytes to send to the printer. ;AN000;
660; ;AN000;
661; OUTPUT: PRINTER ;AN000;
662; ;AN000;
663; CALLED BY: PRINT_BAND ;AN000;
664; PRT_BW_APA ;AN000;
665; ;AN000;
666;-------------------------------------------------------------------------------;AN000;
667; ;AN000;
668; DESCRIPTION: Extract the GRAPHICS escape sequence from the DISPLAYMODE ;AN000;
669; information record; Send this escape sequence to the printer. ;AN000;
670; Then, send the number of bytes that will follow. ;AN000;
671; ;AN000;
672; LOGIC: ;AN000;
673; ;AN000;
674; Number of bytes to print := CUR_MODE_PTR.NUM_GRAPHICS_ESC ;AN000;
675; ;AN000;
676; Get the escape sequence: ;AN000;
677; Set up the 2 bytes containing the number of bytes to send in this sequence. ;AN000;
678; SI := CUR_MODE_PTR.GRAPHICS_ESC_PTR ;AN000;
679; ;AN000;
680; FOR each byte to be printed ;AN000;
681; PRINT_BYTE [SI] ; Send the byte to the printer ;AN000;
682; INC SI ; Get the next byte ;AN000;
683; ;AN000;
684; Send the byte count ;AN000;
685; ;AN000;
686 ;AN000;
687NEW_PRT_LINE PROC NEAR ;AN000;
688 PUSH AX ;AN000;
689 PUSH BX ;AN000;
690 PUSH CX ;AN000;
691 PUSH DX ;AN000;
692 PUSH DI ;AN000;
693 ;AN000;
694 MOV BX,CUR_MODE_PTR ; BX := Displaymode info record. ;AN000;
695 ;AN000;
696;-------------------------------------------------------------------------------;AN000;
697; Set up the 2 bytes containing the number of bytes to send in the GRAPHICS seq.;AN000;
698; NOTE: number of bytes to send is "CUR_SCAN_LNE_LENGTH * BOX_W" ;AN000;
699;-------------------------------------------------------------------------------;AN000;
700 MOV AL,BOX_W ; cur_scan_lne_length * ;AN000;
701 CBW ; printer box width = nb bytes to send;AN000;
702 MUL CUR_SCAN_LNE_LENGTH ; (result in DX AX) ;AN000;
703 ; ;AN000;
704;-------AX := Number of bytes to print ;AN000;
705 MOV DI,[BX].LOW_BYT_COUNT_PTR; DI := Offset of LOW byte of ;AN000;
706 ADD DI,BP ; byte count ;AN000;
707 MOV [DI],AL ; Store low byte ;AN000;
708 MOV DI,[BX].HGH_BYT_COUNT_PTR; DI := Offset of HIGH byte of ;AN000;
709 ADD DI,BP ; byte count ;AN000;
710 MOV [DI],AH ; Store high byte ;AN000;
711 ;AN000;
712;-------------------------------------------------------------------------------;AN000;
713; Send the GRAPHICS escape sequence to the printer: ;AN000;
714;-------------------------------------------------------------------------------;AN000;
715 XOR CX,CX ; CX := Length of the escape seq;AN000;
716 MOV CL,[BX].NUM_GRAPHICS_ESC ;AN000;
717 MOV BX,[BX].GRAPHICS_ESC_PTR ; BX := Offset sequence to send ;AN000;
718 ADD BX,BP ;AN000;
719 ;AN000;
720SEND_1_GRAPHICS_BYTE: ;AN000;
721 MOV AL,[BX] ; AL := byte to print ;AN000;
722 CALL PRINT_BYTE ; Send it to the printer ;AN000;
723 JC NEW_PRT_LINE_ENDP ; If printer error, quit the loop ;AN000;
724 INC BX ; Get next byte ;AN000;
725 LOOP SEND_1_GRAPHICS_BYTE ;AN000;
726 ;AN000;
727NEW_PRT_LINE_ENDP: ;AN000;
728 POP DI ;AN000;
729 POP DX ;AN000;
730 POP CX ;AN000;
731 POP BX ;AN000;
732 POP AX ;AN000;
733 RET ;AN000;
734NEW_PRT_LINE ENDP ;AN000;
735PAGE ;AN000;
736;===============================================================================;AN000;
737; ;AN000;
738; PRINT_BYTE : SEND A BYTE TO THE PRINTER AT LPT1 ;AN000;
739; ;AN000;
740;-------------------------------------------------------------------------------;AN000;
741; ;AN000;
742; INPUT: AL = Byte to be printed ;AN000;
743; ;AN000;
744; OUTPUT: PRINTER ;AN000;
745; ERROR_CODE = PRINTER_ERROR if an error is detected. ;AN000;
746; Carry flag is set in case of error. ;AN000;
747; ;AN000;
748;-------------------------------------------------------------------------------;AN000;
749PRINT_BYTE PROC NEAR ;AN000;
750 PUSH AX ;AN000;
751 PUSH DX ;AN000;
752 ;AN000;
753 MOV DX,0000 ; PRINTER NUMBER ;AN000;
754 MOV AH,00 ; REQUEST PRINT ;AN000;
755 INT 17H ; CALL BIOS : SEND THE CHARACTER ;AN000;
756 ;AN000;
757 AND AH,00101001B ; Test error code returned in AH for ;AN000;
758 ; "Out of paper", "I/O error" and "Time-out". ;AN000;
759 JNZ PRINT_BYTE_ERROR; Set the error code if error ;AN000;
760 JMP SHORT PRINT_BYTE_END ; else, return normally ;AN000;
761PRINT_BYTE_ERROR: ;AN000;
762 MOV ERROR_CODE,PRINTER_ERROR ;AN000;
763 STC ; Set the carry flag to indicate ERROR ;AN000;
764PRINT_BYTE_END: ;AN000;
765 POP DX ;AN000;
766 POP AX ;AN000;
767 RET ;AN000;
768PRINT_BYTE ENDP ;AN000;
769PAGE ;AN000;
770;===============================================================================;AN000;
771; ;AN000;
772; READ_DOT: READ A PIXEL - RETURN A COLOR TRANSLATION TABLE INDEX ;AN000;
773; ;AN000;
774;-------------------------------------------------------------------------------;AN000;
775; ;AN000;
776; INPUT: CUR_MODE = Current video mode. ;AN000;
777; CUR_ROW, ;AN000;
778; CUR_COLUMN = Coordinates of the pixel to be read. ;AN000;
779; CUR_PAGE = Active page number ;AN000;
780; ;AN000;
781; OUTPUT: AL = Index into COLOR TRANSLATION TABLE. ;AN000;
782; ;AN000;
783; DEPENDENCIES : COLOR TRANSLATION TABLE entries must be bytes ;AN000;
784; ;AN000;
785; ;AN000;
786;-------------------------------------------------------------------------------;AN000;
787; ;AN000;
788; DESCRIPTION: Use VIDEO BIOS INTERRUPT 10H "READ DOT CALL". ;AN000;
789; ;AN000;
790; Depending on the video hardware, the dot returned by BIOS has ;AN000;
791; different meanings. ;AN000;
792; With an EGA it is an index into the Palette registers, ;AN000;
793; With a CGA it is a number from 0 to 3, mapping to a specific color ;AN000;
794; depending on the background color and the color palette currently ;AN000;
795; selected. ;AN000;
796; ;AN000;
797; The Color Translation table has been set up to hold the correct color ;AN000;
798; mapping for any "dot" in any mode. Therefore, the dot number returned ;AN000;
799; by INT 10H can be used with any mode as a direct index within that ;AN000;
800; table. ;AN000;
801; ;AN000;
802; With APA Monochrome mode 0FH there are 4 different dots: white, ;AN000;
803; blinking white, high-intensity white, and black. ;AN000;
804; ;AN000;
805; For mode 0FH, the dot returned by interrupt 10 "read dot" call is a byte ;AN000;
806; where only bits 0 and 2 are significant. These 2 bits must be appended ;AN000;
807; together in order to obtain a binary number (from 0 to 3) that will be used ;AN000;
808; as an index in the Color Translation table. ;AN000;
809; ;AN000;
810; For mode 11H, the dot is either 0 (for background color) or 7 (for the ;AN000;
811; foreground color) only the LSB is returned. That is, we return either ;AN000;
812; 0 or 1. ;AN000;
813; ;AN000;
814; LOGIC: ;AN000;
815; ;AN000;
816; Call VIDEO BIOS "READ DOT" ;AN000;
817; IF CUR_MODE = 0FH ;AN000;
818; THEN ;AN000;
819; Append bits 1 and 3. ;AN000;
820; IF CUR_MODE = 11H ;AN000;
821; THEN ;AN000;
822; Wipe out bits 1 and 2. ;AN000;
823; ;AN000;
824READ_DOT PROC NEAR ;AN000;
825 PUSH BX ; Save registers ;AN000;
826 PUSH CX ;AN000;
827 PUSH DX ;AN000;
828 ;AN000;
829 MOV BH,CUR_PAGE ;AN000;
830 MOV DX,CUR_ROW ;AN000;
831 MOV CX,CUR_COLUMN ;AN000;
832 MOV AH,READ_DOT_CALL ;AN000;
833 INT 10H ; Call BIOS: AL <-- Dot read ;AN000;
834 ;AN000;
835 CMP CUR_MODE,0FH ; Is it Mode 0fH ? ;AN000;
836 JNE MODE_11H? ; No, look for mode 11h. ;AN000;
837;-------Mode 0Fh is the current mode: ;AN000;
838;-------Convert bits 2 and 0 into a 2 bit number: ;AN000;
839 MOV BL,AL ; BL := AL = "Pixel read" ;AN000;
840 AND BL,00000100B ; Wipe off all bits but bit 2 in BL ;AN000;
841 AND AL,00000001B ; Wipe off all bits but bit 0 in AL ;AN000;
842 SHR BL,1 ; Move bit 2 to bit 1 in BL ;AN000;
843 OR AL,BL ; Append bit 1 and bit 0 ;AN000;
844 JMP SHORT READ_DOT_END ; Quit. ;AN000;
845 ;AN000;
846MODE_11H?: ;AN000;
847 CMP CUR_MODE,11H ; Is it Mode 0fH ? ;AN000;
848 JNE READ_DOT_END ; No, quit ;AN000;
849 ;AN000;
850;-------Mode 11H is the current mode: ;AN000;
851 AND AL,00000001B ; Keep only the Least significant bit ;AN000;
852 ;AN000;
853READ_DOT_END: ;AN000;
854 POP DX ; Restore registers ;AN000;
855 POP CX ;AN000;
856 POP BX ;AN000;
857 RET ;AN000;
858READ_DOT ENDP ;AN000;
diff --git a/v4.0/src/CMD/GRAPHICS/GRCOMMON.EXT b/v4.0/src/CMD/GRAPHICS/GRCOMMON.EXT
new file mode 100644
index 0000000..8414070
--- /dev/null
+++ b/v4.0/src/CMD/GRAPHICS/GRCOMMON.EXT
@@ -0,0 +1,32 @@
1.XLIST ;AN000;
2PAGE ,132 ;AN000;
3;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
4;; DOS - GRAPHICS Command
5;; (C) Copyright 1988 Microsoft
6;; ;AN000;
7;; File Name: GRCOMMON.EXT ;AN000;
8;; ---------- ;AN000;
9;; ;AN000;
10;; Description: ;AN000;
11;; ------------ ;AN000;
12;; Include file containing external declarations for ;AN000;
13;; the code and data defined in GRCOMMON.ASM ;AN000;
14;; ;AN000;
15;; Change History: ;AN000;
16;; --------------- ;AN000;
17;; ;AN000;
18;; ;AN000;
19;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
20 ;; ;AN000;
21;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
22.LIST ;AN000;
23EXTRN READ_DOT:NEAR ;AN000;
24EXTRN LOC_MODE_PRT_INFO:NEAR ;AN000;
25EXTRN STORE_BOX:NEAR ;AN000;
26EXTRN PRINT_BUFFER:NEAR ;AN000;
27EXTRN GET_SCREEN_INFO:NEAR ;AN000;
28EXTRN SETUP_PRT:NEAR ;AN000;
29EXTRN RESTORE_PRT:NEAR ;AN000;
30EXTRN NEW_PRT_LINE:NEAR ;AN000;
31EXTRN PRINT_BYTE:NEAR ;AN000;
32EXTRN DET_CUR_SCAN_LNE_LENGTH:NEAR ;AN000;
diff --git a/v4.0/src/CMD/GRAPHICS/GRCPSD.ASM b/v4.0/src/CMD/GRAPHICS/GRCPSD.ASM
new file mode 100644
index 0000000..28c2d10
--- /dev/null
+++ b/v4.0/src/CMD/GRAPHICS/GRCPSD.ASM
@@ -0,0 +1,109 @@
1 PAGE ,132 ;AN000;
2 TITLE DOS GRAPHICS Command - Copy Shared Data
3 ;AN000;
4;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
5;; DOS - GRAPHICS Command
6;; (C) Copyright 1988 Microsoft
7;; ;AN000;
8;; File Name: GRCPSD.ASM ;AN000;
9;; ---------- ;AN000;
10;; ;AN000;
11;; Description: ;AN000;
12;; ------------ ;AN000;
13;; This file contains the COPY_SHARED_DATA module. ;AN000;
14;; ;AN000;
15;; ;AN000;
16;; Documentation Reference: ;AN000;
17;; ------------------------ ;AN000;
18;; PLACID Functional Specifications ;AN000;
19;; OASIS High Level Design ;AN000;
20;; OASIS GRAPHICS I1 Overview ;AN000;
21;; ;AN000;
22;; Procedures Contained in This File: ;AN000;
23;; ---------------------------------- ;AN000;
24;; COPY_SHARED_DATA - Copy the Shared Data Area from temporary ;AN000;
25;; build area to resident memory & exit to DOS ;AN000;
26;; ;AN000;
27;; Include Files Required: ;AN000;
28;; ----------------------- ;AN000;
29;; None ;AN000;
30;; ;AN000;
31;; External Procedure References: ;AN000;
32;; ------------------------------ ;AN000;
33;; None ;AN000;
34;; ;AN000;
35;; Linkage Instructions: ;AN000;
36;; --------------------- ;AN000;
37;; Refer to GRAPHICS.ASM ;AN000;
38;; ;AN000;
39;; Change History: ;AN000;
40;; --------------- ;AN000;
41;; ;AN000;
42;; ;AN000;
43;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
44 ;; ;AN000;
45 ;; ;AN000;
46CODE SEGMENT PUBLIC 'CODE' ;; ;AN000;
47 ASSUME CS:CODE,DS:CODE ;; ;AN000;
48 INCLUDE GRCTRL.EXT ;; Bring in external declarations ;AN000;
49 INCLUDE GRCTRL.STR ;; for transient command processing ;AN000;
50;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
51;; ;AN000;
52;; Public Symbols ;AN000;
53;; ;AN000;
54;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
55 ;; ;AN000;
56 PUBLIC COPY_SHARED_DATA ;; ;AN000;
57 ;; ;AN000;
58;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
59;; ;AN000;
60;; Module Name: ;AN000;
61;; COPY_SHARED_DATA ;AN000;
62;; ;AN000;
63;; Input Parameters: ;AN000;
64;; DS : SI - points to the Temporary Shared Data Area ;AN000;
65;; ES : DI - destination for resident Shared Data Area ;AN000;
66;; BP - offset for new Shared Data Area (same as DI) ;AN000;
67;; AH - Function code for exiting to DOS: ;AN000;
68;; 31H : Terminate & Stay Resident - if first time ;AN000;
69;; 4CH : Terminate - if already installed ;AN000;
70;; DX - resident data segment size in paragraphs ;AN000;
71;; ;AN000;
72;; Output Parameters: ;AN000;
73;; NONE ;AN000;
74;; ;AN000;
75;; Data Structures Referenced: ;AN000;
76;; Control Variables ;AN000;
77;; ;AN000;
78;; Description: ;AN000;
79;; Copy the Temporary Shared Data area over the installation modules ;AN000;
80;; and terminate (stay resident). The data is copied immediately ;AN000;
81;; following this module. ;AN000;
82;; ;AN000;
83;; Called By: ;AN000;
84;; GRAPHICS_INSTALL ;AN000;
85;; ;AN000;
86;; External Calls: ;AN000;
87;; NONE ;AN000;
88;; ;AN000;
89;; Logic: ;AN000;
90;; Copy Temporary Shared Data Area ;AN000;
91;; Set PRINT_SCREEN_ALLOWED to YES ;AN000;
92;; Exit to DOS (Function Code 31 or 4C setup by caller) ;AN000;
93;; ;AN000;
94;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
95 ;; ;AN000;
96COPY_SHARED_DATA PROC NEAR ;; ;AN000;
97 ;; ;AN000;
98 REP MOVSB ;; Copy Shared Data from temporary ;AN000;
99 ;; build area to resident memory ;AN000;
100 ;; Allow print screens now ;AN000;
101 MOV ES:PRINT_SCREEN_ALLOWED,YES ;AN000;
102 ;; ;AN000;
103 INT 21H ;; Exit ;AN000;
104 ;; ;AN000;
105COPY_SHARED_DATA ENDP ;; ;AN000;
106 ;; ;AN000;
107;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
108CODE ENDS ;AN000;
109 END COPY_SHARED_DATA ;AN000;
diff --git a/v4.0/src/CMD/GRAPHICS/GRCPSD.EXT b/v4.0/src/CMD/GRAPHICS/GRCPSD.EXT
new file mode 100644
index 0000000..fb3857f
--- /dev/null
+++ b/v4.0/src/CMD/GRAPHICS/GRCPSD.EXT
@@ -0,0 +1,24 @@
1.XLIST ;AN000;
2PAGE ,132 ;AN000;
3;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
4;; DOS - GRAPHICS Command
5;; (C) Copyright 1988 Microsoft
6;; ;AN000;
7;; File Name: GRCPSD.EXT ;AN000;
8;; ---------- ;AN000;
9;; ;AN000;
10;; Description: ;AN000;
11;; ------------ ;AN000;
12;; External declarations for code and data defined in ;AN000;
13;; GRCPSD.ASM ;AN000;
14;; ;AN000;
15;; Change History: ;AN000;
16;; --------------- ;AN000;
17;; ;AN000;
18;; ;AN000;
19;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
20 ;; ;AN000;
21 EXTRN COPY_SHARED_DATA:NEAR ;; ;AN000;
22 ;; ;AN000;
23;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
24.LIST ;AN000;
diff --git a/v4.0/src/CMD/GRAPHICS/GRCTRL.ASM b/v4.0/src/CMD/GRAPHICS/GRCTRL.ASM
new file mode 100644
index 0000000..1deff0a
--- /dev/null
+++ b/v4.0/src/CMD/GRAPHICS/GRCTRL.ASM
@@ -0,0 +1,2162 @@
1 PAGE ,132 ;AN000;
2 ;AN000;
3 TITLE DOS GRAPHICS Command - Print screen Control module
4;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
5;; DOS - GRAPHICS Command
6;; (c) Copyright 1988 Microsoft
7;; ;AN000;
8;; File Name: GRCTRL.ASM ;AN000;
9;; ---------- ;AN000;
10;; ;AN000;
11;; Description: ;AN000;
12;; ------------ ;AN000;
13;; This file contains the code for the Print Screen control module. ;AN000;
14;; ;AN000;
15;; Documentation Reference: ;AN000;
16;; ------------------------ ;AN000;
17;; OASIS High Level Design ;AN000;
18;; OASIS GRAPHICS I1 Overview ;AN000;
19;; ;AN000;
20;; Procedures Contained in This File: ;AN000;
21;; ---------------------------------- ;AN000;
22;; PRT_SCR ;AN000;
23;; DET_HW_CONFIG ;AN000;
24;; DET_MODE_STATE ;AN000;
25;; GET_MODE_ATTR ;AN000;
26;; SET_UP_XLT_TAB ;AN000;
27;; SET_CGA_XLT_TAB ;AN000;
28;; CGA_COL2RGB ;AN000;
29;; RGB2XLT_TAB ;AN000;
30;; SET_EGA_XLT_TAB ;AN000;
31;; EGA_COL2RGB ;AN000;
32;; SET_MODE_F_XLT_TAB ;AN000;
33;; SET_MODE_13H_XLT_TAB ;AN000;
34;; SET_ROUNDUP_XLT_TAB ;AN000;
35;; SET_BACKG_IN_XLT_TAB ;AN000;
36;; RGB2BAND ;AN000;
37;; RGB2INT ;AN000;
38;; ;AN000;
39;; ;AN000;
40;; Include Files Required: ;AN000;
41;; ----------------------- ;AN000;
42;; GRINST.EXT - Externals for GRINST.ASM ;AN000;
43;; ;AN000;
44;; ;AN000;
45;; External Procedure References: ;AN000;
46;; ------------------------------ ;AN000;
47;; FROM FILE GRINST.ASM: ;AN000;
48;; GRAPHICS_INSTALL - Main module for installation. ;AN000;
49;; ;AN000;
50;; Linkage Instructions: ;AN000;
51;; -------------------- ;AN000;
52;; Refer to GRAPHICS.ASM ;AN000;
53;; ;AN000;
54;; Change History: ;AN000;
55;; --------------- ;AN000;
56;; ;AN000;
57;; ;AN000;
58;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
59CODE SEGMENT PUBLIC 'CODE' ;AN000;
60 ASSUME CS:CODE,DS:CODE ;AN000;
61 ;AN000;
62.XLIST ;AN000;
63INCLUDE GRINT2FH.EXT ;AN000;
64INCLUDE GRBWPRT.EXT ;AN000;
65INCLUDE GRCOLPRT.EXT ;AN000;
66INCLUDE GRSHAR.STR ;AN000;
67INCLUDE GRPATTRN.STR ;AN000;
68INCLUDE GRPATTRN.EXT ;AN000;
69INCLUDE STRUC.INC ;AN000;
70.LIST ;AN000;
71PRT_SCR PROC NEAR ;AN000;
72 JMP PRT_SCR_BEGIN ;AN000;
73PAGE ;AN000;
74;===============================================================================;AN000;
75; ;AN000;
76; GRAPHICS INTERRUPT DRIVER'S DATA: ;AN000;
77; ;AN000;
78;===============================================================================;AN000;
79.xlist ;AN000;
80PUBLIC PRT_SCR,ERROR_CODE,XLT_TAB,MODE_TYPE ;AN000;
81PUBLIC CUR_MODE_PTR,CUR_MODE,NB_COLORS,SCREEN_HEIGHT,SCREEN_WIDTH ;AN000;
82PUBLIC CUR_PAGE,CUR_COLUMN,CUR_ROW,NB_SCAN_LINES,SCAN_LINE_MAX_LENGTH ;AN000;
83PUBLIC CUR_SCAN_LNE_LENGTH ;AN000;
84PUBLIC PRT_BUF,NB_BOXES_PER_PRT_BUF,CUR_BOX,BOX_H,BOX_W ;AN000;
85PUBLIC PRINT_SCREEN_ALLOWED,RGB ;AN000;
86PUBLIC BIOS_INT_5H ;AN000;
87PUBLIC ROTATE_SW ;AN000;
88PUBLIC DET_HW_CONFIG ;AN000;
89PUBLIC NB_CHAR_COLUMNS ;AN000;
90PUBLIC RGB2INT ;AN000;
91PUBLIC RGB2BAND ;AN000;
92.list ;AN000;
93INCLUDE GRCTRL.STR ;AN000;
94;-------------------------------------------------------------------------------;AN000;
95; ;AN000;
96; ENTRY POINT TO BIOS HARDWARE INTERRUPT 5 HANDLER ;AN000;
97; ;AN000;
98;-------------------------------------------------------------------------------;AN000;
99BIOS_INT_5H DW ? ; Pointer to BIOS int 5h ;AN000;
100 DW ? ;AN000;
101 ;AN000;
102;-------------------------------------------------------------------------------;AN000;
103; ;AN000;
104; PRINT SCREEN ERROR CODE (Used at print screen time, see GRCTRL.STR for ;AN000;
105; error codes allowed) ;AN000;
106; ;AN000;
107;-------------------------------------------------------------------------------;AN000;
108ERROR_CODE DB 0 ; ERROR CODE 0 = NO ERROR ;AN000;
109 ;AN000;
110;-------------------------------------------------------------------------------;AN000;
111; ;AN000;
112; SCREEN PIXEL: INTERNAL REPRESENTATION ;AN000;
113; ;AN000;
114;-------------------------------------------------------------------------------;AN000;
115RGB PIXEL_STR < , , > ; PIXEL := RED, GREEN, BLUE Values ;AN000;
116 ;AN000;
117;-------------------------------------------------------------------------------;AN000;
118; ;AN000;
119; COLOR TRANSLATION TABLE: ;AN000;
120; ;AN000;
121; This table is used to translate the color numbers returned by ;AN000;
122; Interrupt 10H Read Dot and Read Character calls into print ;AN000;
123; information. The table consists of 256 entries, one byte each, ;AN000;
124; indexed by color number. ;AN000;
125; In the case of black and white printing, the table ;AN000;
126; entries are grey scale intensities from 0 to 63. In the case ;AN000;
127; of color printing each table entry contains a "band mask" indicating ;AN000;
128; which color print bands are required to generate the required color. ;AN000;
129; The band masks are simply bit masks where each bit corresponds to one ;AN000;
130; of the printer bands. ;AN000;
131; ;AN000;
132; The table is set up at the beginning of the print screen processing, ;AN000;
133; before any data is read from the screen. From then on, translating ;AN000;
134; from screen information into print information is done quickly by ;AN000;
135; accessing this table. Not all 256 entries are initialized for each ;AN000;
136; screen print. The number of entries used is equal to the number ;AN000;
137; of colors available concurrently with the given display mode. ;AN000;
138;-------------------------------------------------------------------------------;AN000;
139XLT_TAB DB 256 DUP(32) ; COLOR TRANSLATION TABLE ;AN000;
140 ; This table is used to translate the Color Dot ;AN000;
141 ; or Byte Attribute to a Band Mask for color ;AN000;
142 ; printing or to a Grey Intensity for Mono- ;AN000;
143 ; chrome printing. ;AN000;
144 ;AN000;
145;-------------------------------------------------------------------------------;AN000;
146; ;AN000;
147; CURRENT VIDEO MODE ATTRIBUTES ;AN000;
148; ;AN000;
149;-------------------------------------------------------------------------------;AN000;
150MODE_TYPE DB ? ; Mode types (bit mask) APA or TXT ;AN000;
151 ;AN000;
152CUR_MODE_PTR DW ? ; DISPLAYMODE INFO RECORD for the current ;AN000;
153 ; mode (defined in the shared data area). ;AN000;
154CUR_MODE DB ? ; Current video mode number ;AN000;
155NB_COLORS DW ? ; Number of colors supported by this mode ;AN000;
156SCREEN_HEIGHT DW ? ; Number of rows on the screen (chars or pixels);AN000;
157SCREEN_WIDTH DW ? ; Number of columns on the screen (chars/pixels);AN000;
158 ; (for text modes is equal to NB_CHAR_COLUMNS) ;AN000;
159NB_CHAR_COLUMNS DB ? ; Number of columns on the screen if in txt mode;AN000;
160CUR_PAGE DB ? ; Active page number ;AN000;
161ROTATE_SW DB ? ; Switch: if "ON" then, must print sideways ;AN000;
162 ;AN000;
163;-------------------------------------------------------------------------------;AN000;
164; ;AN000;
165; ACTIVE SCREEN ATTRIBUTES ;AN000;
166; ;AN000;
167;-------------------------------------------------------------------------------;AN000;
168CUR_COLUMN DW ? ; Current pixel/char column number ;AN000;
169CUR_ROW DW ? ; Current pixel/char row number ;AN000;
170NB_SCAN_LINES DW ? ; Number of screen scan lines ;AN000;
171SCAN_LINE_MAX_LENGTH DW ? ; Maximum number of dots/chars per scan line ;AN000;
172CUR_SCAN_LNE_LENGTH DW ? ; Length in pels/chars of the current scan line ;AN000;
173 ;AN000;
174;-------------------------------------------------------------------------------;AN000;
175; ;AN000;
176; PRINTER VARIABLES ;AN000;
177; ;AN000;
178;-------------------------------------------------------------------------------;AN000;
179PRT_BUF DB ?,?,?,? ; PRINT BUFFER ;AN000;
180NB_BOXES_PER_PRT_BUF DB ? ; Number of boxes fitting in the print buffer ;AN000;
181CUR_BOX DB ?,?,?,? ; BOX = PRINTER REPRESENTATION OF 1 PIXEL ;AN000;
182BOX_H DB ? ; HEIGHT OF THE BOX ;AN000;
183BOX_W DB ? ; WIDTH OF THE BOX ;AN000;
184 ;AN000;
185;-------------------------------------------------------------------------------;AN000;
186; ;AN000;
187; CONTROL VARIABLES: ;AN000;
188; ;AN000;
189; This data is used to communicate between the Installation Modules ;AN000;
190; and the Resident Print Screen Modules. ;AN000;
191;-------------------------------------------------------------------------------;AN000;
192PRINT_SCREEN_ALLOWED DB YES; Used to avoid print screens ;AN000;
193 ; while the GRAPHICS installation ;AN000;
194 ; (or re-install) is in progress ;AN000;
195 ; Set by GRAPHICS_INSTALL module. ;AN000;
196 ;AN000;
197 ;AN000;
198PAGE ;AN000;
199;===============================================================================;AN000;
200; ;AN000;
201; INTERRUPT 5 DRIVER'S CODE: ;AN000;
202; ;AN000;
203;-------------------------------------------------------------------------------;AN000;
204;===============================================================================;AN000;
205; ;AN000;
206; PRT_SCR : PRINT THE ACTIVE SCREEN ;AN000;
207; ;AN000;
208;-------------------------------------------------------------------------------;AN000;
209; ;AN000;
210; INPUT: SHARED_DATA_AREA_PTR = Offset of the data area used for ;AN000;
211; passing data between the ;AN000;
212; Installation process and the Print ;AN000;
213; Screen process. ;AN000;
214; PRINT_SCREEN_ALLOWED = Switch. Set to "No" if currently ;AN000;
215; installing GRAPHICS.COM ;AN000;
216; ;AN000;
217; NOTE: These 2 variables are declared within ;AN000;
218; PRT_SCR but initialized by the ;AN000;
219; Installation process GRAPHICS_INIT ;AN000;
220; OUTPUT: PRINTER ;AN000;
221; ;AN000;
222; CALLED BY: INTERRUPT 5 ;AN000;
223; ;AN000;
224; ;AN000;
225;-------------------------------------------------------------------------------;AN000;
226; ;AN000;
227; DESCRIPTION: ;AN000;
228; ;AN000;
229; PRINT THE ACTIVE SCREEN for all TEXT and All Points Addressable (APA) ;AN000;
230; display modes available with either a MONO, CGA, EGA, or VGA video ;AN000;
231; adapter on a Black and White or Color printer. ;AN000;
232; ;AN000;
233; INITIALIZATION: ;AN000;
234; ;AN000;
235; Each pixel or character on the screen has a color attribute. These ;AN000;
236; colors must be translated into different internal representations: ;AN000;
237; ;AN000;
238; For printing in colors, each color is translated to a BAND MASK. ;AN000;
239; The Band Mask indicates how to obtain this color on the printer. ;AN000;
240; ;AN000;
241; For printing in Black and White, each color is translated to a ;AN000;
242; GREY INTENSITY number between 0 (black) and 63 (white). ;AN000;
243; ;AN000;
244; The BAND MASK or the GREY INTENSITIES are found in the COLOR ;AN000;
245; TRANSLATION TABLE. This table is initialized before calling any of ;AN000;
246; the print screen modules. ;AN000;
247; ;AN000;
248; PRINT SCREEN TIME: ;AN000;
249; ;AN000;
250; When a pixel or character is read off the screen by one of the print ;AN000;
251; screen modules, its color is used as an index into the translation ;AN000;
252; table. ;AN000;
253; ;AN000;
254; ;AN000;
255; LOGIC: ;AN000;
256; ;AN000;
257; IF SCREEN_PRINTS_ALLOWED=NO ; Block print screens until Installation ;AN000;
258; THEN IRET ; Process (or re-install!) is finished. ;AN000;
259; ELSE ;AN000;
260; ;AN000;
261; CALL DET_HW_CONFIG ; Determine hardware configuration ;AN000;
262; CALL DET_MODE_STATE ; Determine video mode and active page ;AN000;
263; CALL GET_MODE_ATTR ; Get video attributes (TXT or APA, etc) ;AN000;
264; ;AN000;
265; IF MODE_TYPE = TXT AND Number of colors = 0 ;AN000;
266; THEN Invoke BIOS INTERRUPT 5 ;AN000;
267; ELSE ;AN000;
268; IF PRINTER_TYPE = BLACK_WHITE ;AN000;
269; THEN ;AN000;
270; IF MODE_TYPE = TXT ;AN000;
271; THEN Invoke BIOS INTERRUPT 5 ;AN000;
272; ELSE ; Mode is APA ;AN000;
273; CALL SET_UP_XLT_TAB ; Set up the color translation table ;AN000;
274; CALL PRINT_BW_APA ; Print the active screen on a B&W printer ;AN000;
275; ELSE ; Color printer attached ;AN000;
276; CALL SET_UP_XLT_TAB ; Set up the color translation table ;AN000;
277; CALL PRINT_COLOR ; Print the active screen on a Color prt. ;AN000;
278; IRET ;AN000;
279; ;AN000;
280PRT_SCR_BEGIN: ;AN000;
281 PUSH AX ; Save Registers ;AN000;
282 PUSH BX ; ;AN000;
283 PUSH CX ; ;AN000;
284 PUSH DX ; ;AN000;
285 PUSH SI ; ;AN000;
286 PUSH DI ; ;AN000;
287 PUSH BP ; ;AN000;
288 PUSH DS ; ;AN000;
289 PUSH ES ; ;AN000;
290 ; ;AN000;
291 CLD ; Clear direction flag ;AN000;
292 PUSH CS ; DS := CS ;AN000;
293 POP DS ;AN000;
294 ;AN000;
295;-------------------------------------------------------------------------------;AN000;
296; Verify if we are allowed to print (not allowed if currently installing ;AN000;
297; GRAPHICS or printing a screen): ;AN000;
298;-------------------------------------------------------------------------------;AN000;
299 CMP PRINT_SCREEN_ALLOWED,NO ; IF not allowed to print ;AN000;
300 JE PRT_SCR_RETURN ; THEN quit ;AN000;
301 ; ELSE print the screen: ;AN000;
302;-------------------------------------------------------------------------------;AN000;
303; INITIALIZATION: ;AN000;
304;-------------------------------------------------------------------------------;AN000;
305PRT_SCR_INIT: ; Disable print screen while ;AN000;
306 MOV PRINT_SCREEN_ALLOWED,NO ; we are printing the current ;AN000;
307 ; screen. ;AN000;
308 MOV BP,SHARED_DATA_AREA_PTR ; BP := Offset Shared Data Area ;AN000;
309 MOV ERROR_CODE,NO_ERROR ; No error so far. ;AN000;
310 CALL DET_HW_CONFIG ; Determine the type of display adapter ;AN000;
311 CALL DET_MODE_STATE ; Init CUR_PAGE, CUR_MODE ;AN000;
312 CALL GET_MODE_ATTR ; Determine if APA or TXT, nb. of colors, ;AN000;
313 ; and screen dimensions in pels or characters. ;AN000;
314 ; ;AN000;
315 ; Test the error code returned by GET_MODE_ATTR: ;AN000;
316 ; ;AN000;
317 TEST ERROR_CODE,MODE_NOT_SUPPORTED ;If mode not supported then, ;AN000;
318 JNZ EXIT_TO_BIOS ; let BIOS give it a try. ;AN000;
319 ;AN000;
320 ;------------------------------------------------------------------------------;AN000;
321 ; Check the printer type: ;AN000;
322 ;------------------------------------------------------------------------------;AN000;
323 .IF <DS:[BP].PRINTER_TYPE EQ BLACK_WHITE> ; Is a black and white printer ;AN000;
324 .THEN ; attached ? ;AN000;
325 ;------------------------------------------------------------------------------;AN000;
326 ; A Black and White printer is attached ;AN000;
327 ;------------------------------------------------------------------------------;AN000;
328 CMP MODE_TYPE,TXT ; Is the screen in text mode ? ;AN000;
329 JNE INVOKE_PRINT_ROUTINE ; No, call GRAPHICS B&W routine ;AN000;
330 JMP SHORT EXIT_TO_BIOS ; Yes, give control to BIOS INTERRUPT 5 ;AN000;
331 .ELSE ;AN000;
332 ;------------------------------------------------------------------------------;AN000;
333 ; A Color printer is attached ;AN000;
334 ;------------------------------------------------------------------------------;AN000;
335 CMP NB_COLORS,0 ; Is the screen in a Monochrome ;AN000;
336 JNE INVOKE_PRINT_ROUTINE ;AN000;
337 TEST MODE_TYPE,TXT ; text mode ? ;AN000;
338 JNZ INVOKE_PRINT_ROUTINE ;AN000;
339 JMP SHORT EXIT_TO_BIOS ; Yes, let BIOS INTERRUPT 5 handle it ;AN000;
340 ; No, we handle it. ;AN000;
341.ENDIF ; ENDIF black and white or color printer ;AN000;
342;-------------------------------------------------------------------------------;AN000;
343; ;AN000;
344; Call the print routine (which is either PRINT_COLOR or PRINT_BW_APA) ;AN000;
345; ;AN000;
346;-------------------------------------------------------------------------------;AN000;
347INVOKE_PRINT_ROUTINE: ;AN000;
348 CALL SET_UP_XLT_TAB ; Set up the color translation table ;AN000;
349 CALL PRINT_MODULE_START ; Call the print modules that were ;AN000;
350 ; made resident at Install time. ;AN000;
351 MOV PRINT_SCREEN_ALLOWED,YES; Enable PrtScr for next calls ;AN000;
352 ;-----------------------------------------------------------------------------;AN000;
353 ; Test the error code returned by either PRINT_COLOR or PRT_BW_APA ;AN000;
354 ;-----------------------------------------------------------------------------;AN000;
355 TEST ERROR_CODE,UNABLE_TO_PRINT ; If unable to print the screen ;AN000;
356 JNZ SHORT EXIT_TO_BIOS ; then, let BIOS give it a try ;AN000;
357 ;AN000;
358PRT_SCR_RETURN: ;AN000;
359 ; Restore registers ;AN000;
360 POP ES ; ;AN000;
361 POP DS ; ;AN000;
362 POP BP ; ;AN000;
363 POP DI ; ;AN000;
364 POP SI ; ;AN000;
365 POP DX ; ;AN000;
366 POP CX ; ;AN000;
367 POP BX ; ;AN000;
368 POP AX ; ;AN000;
369 ; ;AN000;
370 IRET ; Return control to interrupted ;AN000;
371 ; process ;AN000;
372EXIT_TO_BIOS: ;AN000;
373 ; Restore registers ;AN000;
374 POP ES ; ;AN000;
375 POP DS ; ;AN000;
376 POP BP ; ;AN000;
377 POP DI ; ;AN000;
378 POP SI ; ;AN000;
379 POP DX ; ;AN000;
380 POP CX ; ;AN000;
381 POP BX ; ;AN000;
382 POP AX ; ;AN000;
383 CLI ; Disable interrupts ;AN000;
384 MOV CS:PRINT_SCREEN_ALLOWED,YES ; Enable PrtScr for next calls ;AN000;
385 JMP DWORD PTR CS:BIOS_INT_5H ; Exit to BIOS INTERRUPT 5 ;AN000;
386 ;AN000;
387PRT_SCR ENDP ;AN000;
388 ;AN000;
389 ;AN000;
390;===============================================================================;AN000;
391; ;AN000;
392; PRT_SCR MODULES: ;AN000;
393; ;AN000;
394;-------------------------------------------------------------------------------;AN000;
395PAGE ;AN000;
396;===============================================================================;AN000;
397; ;AN000;
398; DET_HW_CONFIG : DETERMINE WHAT TYPE OF VIDEO HARDWARE IS PRESENT ;AN000;
399; ;AN000;
400;-------------------------------------------------------------------------------;AN000;
401; ;AN000;
402; INPUT: BP = Offset of the shared data area ;AN000;
403; ;AN000;
404; OUTPUT: HARDWARE_CONFIG is updated in the shared data area ;AN000;
405; ;AN000;
406; CALLED BY: PRT_SCR ;AN000;
407; ;AN000;
408; EXTERNAL CALLS: BIOS INT 10H ;AN000;
409; ;AN000;
410;-------------------------------------------------------------------------------;AN000;
411; ;AN000;
412; LOGIC: ;AN000;
413; Issue BIOS INT10H Get Display Configuration Code (AX=1A00H) ;AN000;
414; IF AL = 1AH THEN /* VGA (PS/2 OR BRECON-B) */ ;AN000;
415; /* BL = active DCC */ ;AN000;
416; /* BH = alternate DCC */ ;AN000;
417; /* Display Code: */ ;AN000;
418; /* 1 - Mono Adapter */ ;AN000;
419; /* 2 - CGA */ ;AN000;
420; /* 4 - EGA with Mono Display */ ;AN000;
421; /* 5 - EGA with Color Display */ ;AN000;
422; /* 7 - PS/2 Mod 50,60,80 OR BRECON-B with Mono Display */ ;AN000;
423; /* 8 - PS/2 Mod 50,60,80 OR BRECON-B with Color Display */ ;AN000;
424; /* B - PS/2 Mod 30 with Mono Display */ ;AN000;
425; /* C - PS/2 Mod 30 with Color Display */ ;AN000;
426; IF AL = 1AH THEN /* Call is supported */ ;AN000;
427; Set HARDWARE_CONFIG byte based on DCC returned in DL ;AN000;
428; ELSE ;AN000;
429; Issue INT 10H EGA Info (AH=12H BL=10H) ;AN000;
430; IF BL <> 10H THEN /* EGA */ ;AN000;
431; Set EGA bit in HARDWARE_CONFIG ;AN000;
432; ELSE /* CGA or */ ;AN000;
433; Issue INT 10H PC CONVERTIBLE Physical display description param. ;AN000;
434; request. (AH=15H) ;AN000;
435; IF ES:[DI] = 5140H ;AN000;
436; THEN ;AN000;
437; Set PC_CONVERTIBLE bit in HARDWARE_CONFIG ;AN000;
438; ELSE ;AN000;
439; Set OLD_ADAPTER bit in HARDWARE_CONFIG ;AN000;
440; ENDIF ;AN000;
441; ENDIF ;AN000;
442; ENDIF ;AN000;
443; RETURN ;AN000;
444; ;AN000;
445;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
446DET_HW_CONFIG PROC NEAR ;AN000;
447 ;AN000;
448;-------------------------------------------------------------------------------;AN000;
449; ;AN000;
450; Try to read display combination code (PS/2 call): ;AN000;
451; ;AN000;
452;-------------------------------------------------------------------------------;AN000;
453 MOV AX,READ_CONFIG_CALL ;AN000;
454 INT 10H ; Call video BIOS ;AN000;
455 ;AN000;
456 .IF <AL EQ 1AH> ; If call is supported ;AN000;
457 .THEN ;AN000;
458;-------------------------------------------------------------------------------;AN000;
459; ;AN000;
460; Call is supported, PS/2 BIOS is present (Model 39,50,60,80 or BRECON-B card), ;AN000;
461; Determine what is the primary video adapter: ;AN000;
462; ;AN000;
463;-------------------------------------------------------------------------------;AN000;
464 .SELECT ;AN000;
465 .WHEN <BL EQ 1> OR ; MONO or ;AN000;
466 .WHEN <BL EQ 2> ; CGA ;AN000;
467 MOV DS:[BP].HARDWARE_CONFIG,OLD_ADAPTER ;AN000;
468 .WHEN <BL EQ 4> OR ; EGA with Mono or ;AN000;
469 .WHEN <BL EQ 5> ; EGA with Color ;AN000;
470 MOV DS:[BP].HARDWARE_CONFIG,EGA ;AN000;
471 .WHEN <BL EQ 7> OR ; BRECON-B with Mono or ;AN000;
472 .WHEN <BL EQ 8> ; BRECON-B with Color ;AN000;
473 MOV DS:[BP].HARDWARE_CONFIG,ROUNDUP ;AN000;
474 .WHEN <BL EQ 0Bh> OR ; PS/2 Model 30 with Mono or ;AN000;
475 .WHEN <BL EQ 0Ch> ; PS/2 Model 30 with Color ;AN000;
476 MOV DS:[BP].HARDWARE_CONFIG,PALACE ;AN000;
477 .ENDSELECT ;AN000;
478;-------------------------------------------------------------------------------;AN000;
479; ;AN000;
480; PS/2 call is not supported, try the EGA info call: ;AN000;
481; ;AN000;
482;-------------------------------------------------------------------------------;AN000;
483 .ELSE ;AN000;
484 MOV AH,ALT_SELECT_CALL ; Request Alternate select's ;AN000;
485 MOV BL,EGA_INFO_CALL ; "return EGA information call" ;AN000;
486 INT 10H ; Call video BIOS ;AN000;
487 .IF <BL NE EGA_INFO_CALL> ; If a memory value is returned ;AN000;
488 .THEN ; then, there is an EGA ;AN000;
489 MOV DS:[BP].HARDWARE_CONFIG,EGA ;AN000;
490 .ELSE ; else, call is not supported: ;AN000;
491;-------------------------------------------------------------------------------;AN000;
492; ;AN000;
493; EGA call is not supported, try the PC CONVERTIBLE display description call: ;AN000;
494; ;AN000;
495;-------------------------------------------------------------------------------;AN000;
496 MOV AH,DISP_DESC_CALL ;AN000;
497 INT 10H ; Call BIOS, ES:DI :=Offset of parms;AN000;
498 .IF <ES:[DI] EQ 5140H> ; If LCD display type, ;AN000;
499 .THEN ; set LCD bit in Shared Data area ;AN000;
500 MOV DS:[BP].HARDWARE_CONFIG,PC_CONVERTIBLE ;AN000;
501 .ELSE ; else, we have an old adapter. ;AN000;
502 MOV DS:[BP].HARDWARE_CONFIG,OLD_ADAPTER ; (either MONO or CGA);AN000;
503 .ENDIF ; Display type is LCD ;AN000;
504 .ENDIF ; EGA BIOS is present ;AN000;
505 .ENDIF ; PS/2 BIOS is present ;AN000;
506 RET ;AN000;
507DET_HW_CONFIG ENDP ;AN000;
508PAGE ;AN000;
509;======================================================================= ;AN000;
510; ;AN000;
511; DET_MODE_STATE : Determine the current video mode and the active page. ;AN000;
512; ;AN000;
513;----------------------------------------------------------------------- ;AN000;
514; ;AN000;
515; INPUT: HARDWARE_CONFIG = Type of video hardware attached ;AN000;
516; ;AN000;
517; OUTPUT: CUR_MODE = Video mode number (0-13H) ;AN000;
518; CUR_PAGE = Video page number (0-8) ;AN000;
519; NB_CHAR_COLUMNS = Number of columns if in a text mode. ;AN000;
520; ;AN000;
521; ;AN000;
522; CALLED BY: PRT_SCR ;AN000;
523; ;AN000;
524; ;AN000;
525;-------------------------------------------------------------------------------;AN000;
526; ;AN000;
527; DESCRIPTION: Use the BIOS interface to ;AN000;
528; obtain the current mode and active page. ;AN000;
529; ;AN000;
530; LOGIC: ;AN000;
531; ;AN000;
532; Call BIOS INTERRUPT 10H: "Return current video state" (AH = 0fh) ;AN000;
533; ;AN000;
534DET_MODE_STATE PROC NEAR ;AN000;
535 PUSH AX ;AN000;
536 PUSH BX ;AN000;
537 MOV AH,GET_STATE_CALL ;AN000;
538 INT 10H ; CALL BIOS ;AN000;
539 MOV CUR_MODE,AL ;AN000;
540 MOV NB_CHAR_COLUMNS,AH ;AN000;
541 MOV CUR_PAGE,BH ;AN000;
542 ;AN000;
543 POP BX ;AN000;
544 POP AX ;AN000;
545 RET ;AN000;
546DET_MODE_STATE ENDP ;AN000;
547 ;AN000;
548PAGE ;AN000;
549;======================================================================= ;AN000;
550; ;AN000;
551; GET_MODE_ATTR: Obtain attributes of current video mode. ;AN000;
552; ;AN000;
553;----------------------------------------------------------------------- ;AN000;
554; ;AN000;
555; INPUT: CUR_MODE = Current video mode (1 BYTE) ;AN000;
556; ;AN000;
557; OUTPUT: MODE_TYPE = Video mode type (TXT or APA) ;AN000;
558; NB_COLORS = Maximum number of colors (0-256) (0=B&W) ;AN000;
559; ERROR_CODE = Error code if error occurred. ;AN000;
560; SCREEN_HEIGHT= Number of rows (in pixels if APA or char if TEXT);AN000;
561; SCREEN_WIDTH = Number of columns (in pixels/char) ;AN000;
562; ;AN000;
563; CALLED BY: PRT_SCR ;AN000;
564; ;AN000;
565; ;AN000;
566;----------------------------------------------------------------------- ;AN000;
567; ;AN000;
568; DESCRIPTION: Scan the 2 local video mode attribute tables until the ;AN000;
569; current mode is located. Return the attributes. ;AN000;
570; For APA modes SCREEN_HEIGHT and SCREEN_WIDTH are in pixels, ;AN000;
571; for TEXT modes they are in characters. ;AN000;
572; ;AN000;
573; ;AN000;
574; LOGIC: ;AN000;
575; ;AN000;
576; Scan the APA_ATTR_TABLE ;AN000;
577; IF FOUND ;AN000;
578; MODE_TYPE := APA ;AN000;
579; NB_COLORS := mode.MAX_COLORS ;AN000;
580; SCREEN_HEIGHT := mode.NB_L ;AN000;
581; SCREEN_WIDTH := mode.NB_C ;AN000;
582; ELSE ;AN000;
583; Scan the TXT_ATTR_TABLE ;AN000;
584; When FOUND ;AN000;
585; MODE_TYPE := TXT ;AN000;
586; NB_COLORS := mode.NUM_COLORS ;AN000;
587; SCREEN_WIDTH := NB_CHAR_COLUMNS ;AN000;
588; SCREEN_HEIGHT := Byte in ROM BIOS at 40:84 ;AN000;
589; ;AN000;
590;----------------------------------------------------------------------- ;AN000;
591GET_MODE_ATTR PROC NEAR ;AN000;
592 JMP SHORT GET_MODE_ATTR_BEGIN ;AN000;
593;----------------------------------------------------------------------- ;AN000;
594; ;AN000;
595; LOCAL DATA ;AN000;
596; ;AN000;
597;----------------------------------------------------------------------- ;AN000;
598 ;AN000;
599APA_ATTR STRUC ; ATTRIBUTES FOR APA MODES: ;AN000;
600 APA_MODE DB ? ; Mode number ;AN000;
601 NB_C DW ? ; Number of columns ;AN000;
602 NB_L DW ? ; Number of lines ;AN000;
603 MAX_COLORS DW ? ; Maximum number of colors available (0=B&W) ;AN000;
604APA_ATTR ENDS ;AN000;
605 ;AN000;
606TXT_ATTR STRUC ; ATTRIBUTES FOR TXT MODES: ;AN000;
607 TXT_MODE DB ? ; Mode number ;AN000;
608 NUM_COLORS DB ? ; Number of colors ;AN000;
609TXT_ATTR ENDS ;AN000;
610 ;AN000;
611;----------------------------------------------------------------------- ;AN000;
612; ;AN000;
613; APA MODE ATTRIBUTES: ;AN000;
614; ;AN000;
615;----------------------------------------------------------------------- ;AN000;
616NB_APA_MODES DW 10 ;AN000;
617APA_ATTR_TABLE LABEL WORD ;AN000;
618MODE04 APA_ATTR < 4,320,200, 4> ;AN000;
619MODE05 APA_ATTR < 5,320,200, 4> ;AN000;
620MODE06 APA_ATTR < 6,640,200, 2> ;AN000;
621MODE0D APA_ATTR <0DH,320,200, 16> ;AN000;
622MODE0E APA_ATTR <0EH,640,200, 16> ;AN000;
623MODE0F APA_ATTR <0FH,640,350, 4> ;AN000;
624MODE10H APA_ATTR <10H,640,350, 16> ;AN000;
625MODE11H APA_ATTR <11H,640,480, 2> ;AN000;
626MODE12H APA_ATTR <12H,640,480, 16> ;AN000;
627MODE13H APA_ATTR <13H,320,200,256> ;AN000;
628 ;AN000;
629;----------------------------------------------------------------------- ;AN000;
630; ;AN000;
631; TXT MODE ATTRIBUTES: ;AN000;
632; ;AN000;
633;----------------------------------------------------------------------- ;AN000;
634NB_TXT_MODES DW 5 ;AN000;
635TXT_ATTR_TABLE LABEL WORD ;AN000;
636MODE00 TXT_ATTR < 0, 16> ;AN000;
637MODE01 TXT_ATTR < 1, 16> ;AN000;
638MODE02 TXT_ATTR < 2, 16> ;AN000;
639MODE03 TXT_ATTR < 3, 16> ;AN000;
640MODE07 TXT_ATTR < 7, 0> ;AN000;
641 ;AN000;
642;----------------------------------------------------------------------- ;AN000;
643; ;AN000;
644; BEGIN OF GET_MODE_ATTR ;AN000;
645; ;AN000;
646;----------------------------------------------------------------------- ;AN000;
647GET_MODE_ATTR_BEGIN: ;AN000;
648 PUSH AX ;AN000;
649 PUSH BX ;AN000;
650 PUSH CX ;AN000;
651 PUSH DX ;AN000;
652 MOV DL,CUR_MODE ; DL = CURRENT MODE ;AN000;
653; ;AN000;
654; Scan the APA_ATTR_TABLE ;AN000;
655; ;AN000;
656 MOV CX,NB_APA_MODES ; CS <-- Number of APA modes ;AN000;
657 MOV BX,OFFSET APA_ATTR_TABLE; BX <-- Offset of APA mode table ;AN000;
658 SCAN_APA: ;AN000;
659 CMP DL,[BX].APA_MODE ; IF mode found ;AN000;
660 JE SHORT ITS_APA ; THEN get its attributes ;AN000;
661 ADD BX,SIZE APA_ATTR ;AN000;
662 LOOP SCAN_APA ; ELSE keep scanning ;AN000;
663 JMP SHORT SCAN_TXT_INIT ; NOT in this table: scan txt modes ;AN000;
664ITS_APA: ;AN000;
665 MOV MODE_TYPE,APA ; MODE = APA ;AN000;
666 MOV AX,[BX].MAX_COLORS ;AN000;
667 MOV NB_COLORS,AX ; Get number of colors ;AN000;
668 MOV AX,[BX].NB_L ;AN000;
669 MOV SCREEN_HEIGHT,AX ; Get number of lines ;AN000;
670 MOV AX,[BX].NB_C ;AN000;
671 MOV SCREEN_WIDTH,AX ; Get number of columns ;AN000;
672 JMP SHORT GET_MODE_ATTR_END ;AN000;
673 ;AN000;
674; ;AN000;
675; Scan the TXT_ATTR_TABLE ;AN000;
676; ;AN000;
677SCAN_TXT_INIT: ;AN000;
678 MOV CX,NB_TXT_MODES ; CX <-- Number of TXT modes ;AN000;
679 MOV BX,OFFSET TXT_ATTR_TABLE; BX <-- Offset of TXT mode table ;AN000;
680 SCAN_TXT: ;AN000;
681 CMP DL,[BX].TXT_MODE ; IF mode found ;AN000;
682 JE SHORT ITS_TXT ; THEN get its attributes ;AN000;
683 ADD BX,SIZE TXT_ATTR ;AN000;
684 LOOP SCAN_TXT ; ELSE keep scanning ;AN000;
685ITS_TXT: ;AN000;
686 MOV MODE_TYPE,TXT ; MODE = TXT ;AN000;
687 MOV AL,[BX].NUM_COLORS ;AN000;
688 CBW ;AN000;
689 MOV NB_COLORS,AX ; Get number of colors ;AN000;
690 MOV AL,NB_CHAR_COLUMNS ; Get number of columns ;AN000;
691 CBW ;AN000;
692 MOV SCREEN_WIDTH,AX ;AN000;
693 .IF <DS:[BP].HARDWARE_CONFIG EQ OLD_ADAPTER>; If an old adapter is there;AN000;
694 .THEN ; The number of lines is 25 ;AN000;
695 MOV SCREEN_HEIGHT,25 ;AN000;
696 .ELSE ;AN000;
697 MOV AX,BIOS_SEG ; Get number of rows ;AN000;
698 MOV ES,AX ; from BIOS Data Area ;AN000;
699 MOV BX,NB_ROWS_OFFSET ; at 0040:0084 ;AN000;
700 MOV AL,ES:[BX] ;AN000;
701 CBW ;AN000;
702 INC AX ;AN000;
703 MOV SCREEN_HEIGHT,AX ;AN000;
704 .ENDIF ;AN000;
705 JMP SHORT GET_MODE_ATTR_END ;AN000;
706 ;AN000;
707; ;AN000;
708; The current mode was not found in any of the tables ;AN000;
709; ;AN000;
710 MOV ERROR_CODE,MODE_NOT_SUPPORTED ;AN000;
711 ;AN000;
712GET_MODE_ATTR_END: ;AN000;
713 POP AX ;AN000;
714 POP BX ;AN000;
715 POP CX ;AN000;
716 POP DX ;AN000;
717 RET ;AN000;
718GET_MODE_ATTR ENDP ;AN000;
719PAGE ;AN000;
720;======================================================================= ;AN000;
721; ;AN000;
722; SET_UP_XLT_TABLE : SET UP A COLOR MAPPING FOR EACH COLOR AVAILABLE ;AN000;
723; WITH THE CURRENT MODE ;AN000;
724; ;AN000;
725;----------------------------------------------------------------------- ;AN000;
726; ;AN000;
727; INPUT: CUR_MODE = Current video mode. ;AN000;
728; HARDWARE_CONFIG = Type of display adapter. ;AN000;
729; PRINTER_TYPE = Type of printer attached (Color or B&W) ;AN000;
730; XLT_TAB = Color translation table. ;AN000;
731; CUR_PAGE = Active page number ;AN000;
732; BP = Offset of the shared data area ;AN000;
733; ;AN000;
734; ;AN000;
735; OUTPUT: XLT_TAB IS UPDATED ;AN000;
736; ;AN000;
737; CALLED BY: PRT_SCR ;AN000;
738; ;AN000;
739;----------------------------------------------------------------------- ;AN000;
740; ;AN000;
741; DESCRIPTION: The table is updated to hold a mapping for each color ;AN000;
742; available in the current video mode either TEXT or APA. ;AN000;
743; ;AN000;
744; For example, if the current mode supports 16 colors then the first ;AN000;
745; sixteen bytes of the table will hold the corresponding Color printer ;AN000;
746; or Black and White printer mappings for these colors. ;AN000;
747; ;AN000;
748; ;AN000;
749; LOGIC: ;AN000;
750; ;AN000;
751; IF HARDWARE_CONFIG = CGA OR HARDWARE_CONFIG = PC_CONVERTIBLE ;AN000;
752; THEN ;AN000;
753; CALL SET_CGA_XLT_TAB ;AN000;
754; ;AN000;
755; ELSE IF HARDWARE_CONFIG = EGA ;AN000;
756; THEN ;AN000;
757; CALL SET_EGA_XLT_TAB ;AN000;
758; ;AN000;
759; ELSE IF CUR_MODE = 0FH ;AN000;
760; THEN ;AN000;
761; CALL SET_MODE_F_XLT_TAB ;AN000;
762; ;AN000;
763; ELSE IF CUR_MODE = 19 ;AN000;
764; THEN ;AN000;
765; CALL SET_MODE_13H_XLT_TAB ;AN000;
766; ;AN000;
767; ELSE ;AN000;
768; CALL SET_ROUNDUP_XLT_TAB ;AN000;
769; ;AN000;
770; CALL SET_BACKG_IN_XLT_TAB ; Update the background in the translation table ;AN000;
771; ;AN000;
772SET_UP_XLT_TAB PROC NEAR ;AN000;
773;-------------------------------------------------------------------------------;AN000;
774; For old display modes: set up translation table as for a Color Graphics Adapt.;AN000;
775; Either 4 or 16 colors are set up depending if the mode is an APA or text mode.;AN000;
776; ;AN000;
777; NOTE: SET_UP_XLT_TAB cannot be invoked if the display adater is a Monochrome ;AN000;
778; display adater. (When a Mono. adapter is attached, a jump is made to ;AN000;
779; the ROM BIOS for printing the screen, and no translation table is set). ;AN000;
780;-------------------------------------------------------------------------------;AN000;
781.IF <BIT DS:[BP].HARDWARE_CONFIG NZ OLD_ADAPTER> OR ; IF it is a CGA ;AN000;
782.IF <BIT DS:[BP].HARDWARE_CONFIG NZ PC_CONVERTIBLE> ; or a PC convertible ;AN000;
783.THEN ; THEN set up CGA colors ;AN000;
784 CALL SET_CGA_XLT_TAB ; ;AN000;
785.ELSEIF <BIT DS:[BP].HARDWARE_CONFIG NZ EGA> ; ELSEIF it is an EGA ;AN000;
786 CALL SET_EGA_XLT_TAB ; set up EGA colors. ;AN000;
787.ELSEIF <CUR_MODE EQ 0FH> ; ELSEIF we are in mode 15 ;AN000;
788 CALL SET_MODE_F_XLT_TAB ; set up its 4 shades ;AN000;
789;-------------------------------------------------------------------------------;AN000;
790; A PS/2 system is attached: (we either have a PALACE [Model 30] or a ROUNDUP) ;AN000;
791;-------------------------------------------------------------------------------;AN000;
792.ELSEIF <CUR_MODE EQ 13H> ; ELSEIF current mode is 13h;AN000;
793 CALL SET_MODE_13H_XLT_TAB ; set up 256 colors ;AN000;
794.ELSEIF <BIT DS:[BP].HARDWARE_CONFIG NZ PALACE> ; ELSEIF PS/2 Model 30(MCGA);AN000;
795 CALL SET_CGA_XLT_TAB ; handle it like a CGA ;AN000;
796.ELSE ; ELSE we have a ROUNDUP ;AN000;
797;-------------------------------------------------------------------------------;AN000;
798; A PS/2 model 50, 60 or 80 or an ADA 'B' card is attached (in 16 color mode): ;AN000;
799;-------------------------------------------------------------------------------;AN000;
800 CALL SET_ROUNDUP_XLT_TAB ; set up 16 colors ;AN000;
801.ENDIF ;AN000;
802;-------------------------------------------------------------------------------;AN000;
803; Finish setting up the translation table: ;AN000;
804;-------------------------------------------------------------------------------;AN000;
805 ;AN000;
806CALL SET_BACKG_IN_XLT_TAB ; Update the background in the translation table ;AN000;
807 ; according to the command line switch setting ;AN000;
808 ; (i.e.,/R /B) ;AN000;
809 RET ;AN000;
810SET_UP_XLT_TAB ENDP ;AN000;
811PAGE ;AN000;
812;===============================================================================;AN000;
813; ;AN000;
814; SET_BACKG_IN_XLT_TAB : ADJUST THE MAPPING FOR THE BACKGROUND COLOR IN THE ;AN000;
815; XLT_TAB ACCORDING TO PRINTER TYPE AND /R /B. ;AN000;
816; ;AN000;
817; ;AN000;
818;-------------------------------------------------------------------------------;AN000;
819; ;AN000;
820; INPUT: BP = Offset of shared data area (SWITCHES) ;AN000;
821; XLT_TAB = The color translation table. ;AN000;
822; ;AN000;
823; OUTPUT: XLT_TAB IS UPDATED ;AN000;
824; ;AN000;
825;-------------------------------------------------------------------------------;AN000;
826; ;AN000;
827; DESCRIPTION: If there is a black and white printer and /R is NOT specified ;AN000;
828; then the background color should not be printed and it is replaced in the ;AN000;
829; translation table by the Intensity for white (will print nothing). ;AN000;
830; ;AN000;
831; If a color printer is attached and /B is not specified then the background ;AN000;
832; color is replaced by the Print Band mask for white. ;AN000;
833; ;AN000;
834; LOGIC: ;AN000;
835; IF (a black and white printer is attached) AND (/R is OFF) ;AN000;
836; THEN ;AN000;
837; MOV XLT_TAB, WHITE_INT ; Store white in translation table ;AN000;
838; ELSE (a color printer is attached) ;AN000;
839; IF (/B is ON) ;AN000;
840; THEN ;AN000;
841; RGB.R := MAX_INT ;AN000;
842; RGB.G := MAX_INT ;AN000;
843; RGB.B := MAX_INT ;AN000;
844; CALL RGB2BAND ; Convert RGB for white to a Band Mask ;AN000;
845; MOV XLT_TAB,AL ; Store the band mask in the xlt table ;AN000;
846; ;AN000;
847; ;AN000;
848;-------------------------------------------------------------------------------;AN000;
849SET_BACKG_IN_XLT_TAB PROC NEAR ;AN000;
850;-------------------------------------------------------------------------------;AN000;
851; ;AN000;
852; Test if a black and white printer is attached. ;AN000;
853; ;AN000;
854;-------------------------------------------------------------------------------;AN000;
855.IF <BIT DS:[BP].PRINTER_TYPE NZ BLACK_WHITE> AND ; IF black and white ;AN000;
856.IF <BIT DS:[BP].SWITCHES Z REVERSE_SW> ; printer and not /R ;AN000;
857.THEN ; then, map background ;AN000;
858 MOV XLT_TAB,WHITE_INT ; to white. ;AN000;
859;-------------------------------------------------------------------------------;AN000;
860; ;AN000;
861; A Color printer is attached: ;AN000;
862; ;AN000;
863;-------------------------------------------------------------------------------;AN000;
864.ELSEIF <BIT DS:[BP].PRINTER_TYPE NZ COLOR> AND ; else, if color printer ;AN000;
865.IF <BIT DS:[BP].SWITCHES Z BACKGROUND_SW> ; and /B if OFF ;AN000;
866.THEN ; ;AN000;
867 ; Store a null band mask ;AN000;
868 MOV XLT_TAB,0 ; the translation table. ;AN000;
869.ENDIF ;AN000;
870 RET ;AN000;
871SET_BACKG_IN_XLT_TAB ENDP ;AN000;
872PAGE ;AN000;
873;======================================================================= ;AN000;
874; ;AN000;
875; SET_EGA_XLT_TAB : SET UP COLOR TRANSLATION TABLE FOR ENHANCED GRAPHIC ;AN000;
876; ADAPTER ;AN000;
877; ;AN000;
878;----------------------------------------------------------------------- ;AN000;
879; ;AN000;
880; INPUT: XLT_TAB = Color translation table. ;AN000;
881; PRINTER_TYPE = Type of printer attached (Color or B&W) ;AN000;
882; SWITCHES = GRAPHICS command line parameters. ;AN000;
883; ;AN000;
884; OUTPUT: XLT_TAB IS UPDATED ;AN000;
885; ;AN000;
886; CALLED BY: SET_UP_XLT_TABLE ;AN000;
887; ;AN000;
888;----------------------------------------------------------------------- ;AN000;
889; ;AN000;
890; NOTES: With the EGA, "VIDEO BIOS READ DOT call" returns an index into ;AN000;
891; the 16 EGA palette registers. ;AN000;
892; ;AN000;
893; These registers contain the actual colors stored as rgbRGB components ;AN000;
894; (see EGA_COL2RGB for details) for mode hex 10. Under mode hex E these ;AN000;
895; registers contain the actual colors as I0RGB components (see CGA_COL2RGB ;AN000;
896; for details). ;AN000;
897; ;AN000;
898; These registers can be Revised by the user but, are 'WRITE ONLY'. ;AN000;
899; However, it is possible to define a SAVE AREA where BIOS will maintain ;AN000;
900; a copy of the palette registers. ;AN000;
901; ;AN000;
902; This area is called the "DYNAMIC SAVE AREA" and is defined via the ;AN000;
903; BIOS EGA SAVE_PTR AREA. Whenever the palette registers are changed by ;AN000;
904; the user, BIOS updates the EGA_SAVE_AREA. ;AN000;
905; ;AN000;
906; The 16 palette registers are the first 16 bytes of the DYNAMIC SAVE AREA. ;AN000;
907; ;AN000;
908; This program takes advantage of this feature and consults the EGA DYNAMIC ;AN000;
909; SAVE AREA in order to obtain the colors used in the active screen. ;AN000;
910; ;AN000;
911; ;AN000;
912; DESCRIPTION: Obtain each color available with an EGA by reading its ;AN000;
913; palette register in the EGA_SAVE_AREA: ;AN000;
914; ;AN000;
915; Calculate the mapping for this color, either a BAND_MASK or a ;AN000;
916; GREY INTENSITY and store it in the color translation table. ;AN000;
917; ;AN000;
918; ;AN000;
919; LOGIC: ;AN000;
920; ;AN000;
921; Obtain the DYNAMIC EGA SAVE AREA offset from the BIOS SAVE_PTR_AREA. ;AN000;
922; ;AN000;
923; If current mode is either 4,5 or 6 ;AN000;
924; Then, ;AN000;
925; CALL SET_CGA_XLT_TAB ;AN000;
926; Get the background color by reading palette register number 0 ;AN000;
927; Else, ;AN000;
928; For each register number (0 to 15): ;AN000;
929; Get the register contents (rgbRGB values) from the EGA SAVE AREA ;AN000;
930; CALL EGA_COL2RGB ; Obtain the Red, Green, Blue values ;AN000;
931; CALL RGB2XLT_TAB ; Obtain a Band Mask or a Grey Intensity ;AN000;
932; ; and store the result in the XLT_TAB ;AN000;
933; ;AN000;
934SET_EGA_XLT_TAB PROC NEAR ;AN000;
935 PUSH AX ; Save the registers used ;AN000;
936 PUSH BX ;AN000;
937 PUSH CX ;AN000;
938 PUSH DX ;AN000;
939 PUSH DI ;AN000;
940 ;AN000;
941;-------------------------------------------------------------------------------;AN000;
942; ;AN000;
943; Obtain the pointer to the DYNAMIC SAVE AREA from the SAVE AREA POINTER TABLE: ;AN000;
944; ;AN000;
945;-------------------------------------------------------------------------------;AN000;
946EGA_SAVE_PTR EQU 4A8H ; EGA BIOS pointer to table of ;AN000;
947 ; pointer to save areas. ;AN000;
948 XOR AX,AX ; ES segment := paragraph 0 ;AN000;
949 MOV ES,AX ;AN000;
950 ;AN000;
951 LES BX,ES:DWORD PTR EGA_SAVE_PTR ; ES:BX := Pointer to ptr table ;AN000;
952 LES BX,ES:[BX]+4 ; ES:BX := Pointer to dynamic save area;AN000;
953 ; (NOTE: It is the second pointer in ;AN000;
954 ; the table) ;AN000;
955 ;AN000;
956;-------------------------------------------------------------------------------;AN000;
957; ;AN000;
958; Set up one entry in the translation table for each color available. ;AN000;
959; ;AN000;
960;-------------------------------------------------------------------------------;AN000;
961.IF <CUR_MODE EQ 4> OR ; If the current mode is an old CGA ;AN000;
962.IF <CUR_MODE EQ 5> OR ; GRAPHICS mode: ;AN000;
963.IF <CUR_MODE EQ 6> ;AN000;
964.THEN ;AN000;
965;-------------------------------------------------------------------------------;AN000;
966; Current mode is either mode 4, 5 or 6; ;AN000;
967; Store each color of the old CGA All Points Addressable mode: ;AN000;
968;-------------------------------------------------------------------------------;AN000;
969 CALL SET_CGA_XLT_TAB ; Set up colors in the translation ;AN000;
970 ; table, NOTE: The background color ;AN000;
971 ; will not be set properly since the ;AN000;
972 ; EGA BIOS does not update memory ;AN000;
973 ; location 40:66 with the value ;AN000;
974 ; of the background color as CGA ;AN000;
975 ; does. ;AN000;
976;------Adjust the background color in the translation table: ;AN000;
977;------The background color is obtained from the EGA DYNAMIC SAVE AREA ;AN000;
978;------ES:BX = Address of the EGA DYNAMIC SAVE AREA ;AN000;
979;------NOTE : For CGA compatible modes EGA BIOS stores the color in the ;AN000;
980;------DYNAMIC SAVE AREA as a I0RGB value. ;AN000;
981 XOR DI,DI ; DI:=register number = index in XLT_TAB;AN000;
982 MOV AL,ES:[BX][DI] ; AL:=Palette register 0 = Back. color ;AN000;
983 MOV AH,AL ; Convert I0RGB to IRGB (CGA color) ;AN001;
984 AND AL,111B ; Isolate RGB bits ;AN001;
985 AND AH,10000B ; Isolate I bit ;AN001;
986 SHR AH,1 ; Move I bit from position 5 to 4 ;AN001;
987 OR AL,AH ; Get IRGB byte. ;AN001;
988 CALL CGA_COL2RGB ; Convert IRGB to R,G,B values ;AN001;
989 CALL RGB2XLT_TAB ; Convert RGB to an entry in XLT_TAB ;AN000;
990 ;AN000;
991.ELSE ; ELSE, we have an EGA graphics mode: ;AN000;
992;-------------------------------------------------------------------------------;AN000;
993; The current mode is a either a text mode or one of the EGA enhanced mode; ;AN000;
994; Store in the translation table each color available (these modes have 16 col.);AN000;
995;-------------------------------------------------------------------------------;AN000;
996 MOV CX,16 ; CX := Number of palette registers ;AN000;
997 ; to read ;AN000;
998 XOR DI,DI ; DI := Palette register number ;AN000;
999 ; and index in the translation table ;AN000;
1000STORE_1_EGA_COLOR: ;AN000;
1001 MOV AL,ES:[BX][DI] ; AL := Palette register ;AN000;
1002 .IF <CUR_MODE EQ 14> OR ; If mode E (hex) OR mode D (hex) ;AN000;
1003 .IF <CUR_MODE EQ 13> ; the colors are ;AN000;
1004 .THEN ; stored as I0CGA colors ;AN000;
1005 MOV AH,AL ; Convert I0RGB to IRGB (CGA color) ;AN000;
1006 AND AL,111B ; Isolate RGB bits ;AN000;
1007 AND AH,10000B ; Isolate I bit ;AN000;
1008 SHR AH,1 ; Move I bit from position 5 to 4 ;AN000;
1009 OR AL,AH ; Get IRGB byte. ;AN000;
1010 CALL CGA_COL2RGB ; Convert IRGB to R,G,B values ;AN000;
1011 .ELSE ; Else, they are stored as (rgbRGB); ;AN000;
1012 CALL EGA_COL2RGB ; Convert register to R,G,B values ;AN000;
1013 .ENDIF ;AN000;
1014 CALL RGB2XLT_TAB ; Convert RGB to an entry in XLT_TAB ;AN000;
1015 INC DI ; Get next palette register number ;AN000;
1016 LOOP STORE_1_EGA_COLOR ;AN000;
1017.ENDIF ; ENDIF 4 colors or 16 colors ;AN000;
1018 ;AN000;
1019 POP DI ; Restore the registers ;AN000;
1020 POP DX ;AN000;
1021 POP CX ;AN000;
1022 POP BX ;AN000;
1023 POP AX ;AN000;
1024 RET ;AN000;
1025SET_EGA_XLT_TAB ENDP ;AN000;
1026PAGE ;AN000;
1027;======================================================================= ;AN000;
1028; ;AN000;
1029; SET_CGA_XLT_TAB : SET UP COLOR TRANSLATION TABLE FOR COLOR GRAPHIC ;AN000;
1030; ADAPTER ;AN000;
1031; ;AN000;
1032;----------------------------------------------------------------------- ;AN000;
1033; ;AN000;
1034; INPUT: XLT_TAB = Color translation table. ;AN000;
1035; PRINTER_TYPE = Type of printer attached (Color or B&W) ;AN000;
1036; SWITCHES = GRAPHICS command line parameters. ;AN000;
1037; ;AN000;
1038; OUTPUT: XLT_TAB IS UPDATED ;AN000;
1039; ;AN000;
1040; CALLED BY: SET_UP_XLT_TABLE ;AN000;
1041; ;AN000;
1042;----------------------------------------------------------------------- ;AN000;
1043; ;AN000;
1044; NOTES: With the CGA, the "VIDEO BIOS READ DOT call" returns a number ;AN000;
1045; from 0 to 3. A dot of value 0 is of the background color. ;AN000;
1046; ;AN000;
1047; The actual value of the background color is stored in BIOS VIDEO ;AN000;
1048; DISPLAY DATA AREA as a PIIRGB value (see CGA_COL2RGB for details) and ;AN000;
1049; can be any of 16 colors. ;AN000;
1050; ;AN000;
1051; A dot of value 1,2, or 3 represents any of 2 specific colors depending ;AN000;
1052; on the current color palette. ;AN000;
1053; ;AN000;
1054; The palette number is obtained from the BIOS VIDEO DISPLAY DATA AREA ;AN000;
1055; (It is the "P" bit or bit number 5) ;AN000;
1056; ;AN000;
1057; The dot values 1,2,3 expressed in binary actually represent the RG ;AN000;
1058; (Red, Green) components of the color. ;AN000;
1059; ;AN000;
1060; The palette number represents the B (Blue) component therefore, when ;AN000;
1061; the palette number is appended to the color number we obtain the RGB ;AN000;
1062; components for that color. ;AN000;
1063; ;AN000;
1064; (E.G., COLOR = 010 ; COLOR # 2 ;AN000;
1065; PALETTE= 0 ; PALETTE # 0 ;AN000;
1066; ;AN000;
1067; IRGB = 0100 ; Intensity = 0 Ŀ ;AN000;
1068; ; Red = 1 > color = Red ;AN000;
1069; ; Green = 0 ;AN000;
1070; ; Blue = 0 ;AN000;
1071; ;AN000;
1072; ;AN000;
1073; DESCRIPTION: ;AN000;
1074; ;AN000;
1075; For each color available with a CGA: ;AN000;
1076; Calculate the color mapping, either a BAND_MASK or a GREY ;AN000;
1077; INTENSITY and store it in the color translation table. ;AN000;
1078; ;AN000;
1079; LOGIC: ;AN000;
1080; ;AN000;
1081; ; Obtain the background color from VIDEO BIOS DATA AREA ;AN000;
1082; ; and the paletter number ;AN000;
1083; ;AN000;
1084; ; Store the Background color: ;AN000;
1085; CALL CGA_COL2RGB ; Convert IRGB components to RGB values ;AN000;
1086; CALL RGB2XLT_TAB ; Convert RGB to an entry in the translation ;AN000;
1087; ; table ;AN000;
1088; ; Store all other colors: ;AN000;
1089; FOR IRG := 1 TO 3 ; Obtain the color number ;AN000;
1090; Append palette number (B) to IRG ;AN000;
1091; CALL CGA_COL2RGB ; Convert color to RGB values ;AN000;
1092; CALL RGB2XLT_TAB ; Convert RGB to an entry in the translation ;AN000;
1093; ; table ;AN000;
1094; ;AN000;
1095SET_CGA_XLT_TAB PROC NEAR ;AN000;
1096 PUSH AX ;AN000;
1097 PUSH BX ;AN000;
1098 PUSH CX ;AN000;
1099 PUSH DI ;AN000;
1100 PUSH ES ;AN000;
1101 ;AN000;
1102.IF <CUR_MODE EQ 4> OR ;AN000;
1103.IF <CUR_MODE EQ 5> ;AN000;
1104;===============================================================================;AN000;
1105; ;AN000;
1106; THE CURRENT MODE IS MODE 4 OR 5 ;AN000;
1107; ;AN000;
1108;-------------------------------------------------------------------------------;AN000;
1109.THEN ;AN000;
1110;-------------------------------------------------------------------------------;AN000;
1111; Read the CRT palette from the BIOS ROM to obtain the background color and ;AN000;
1112; the current palette number; store the palette number in BL ;AN000;
1113;-------------------------------------------------------------------------------;AN000;
1114ROM_BIOS_SEG EQU 40H ; CGA BIOS SEGMENT ;AN000;
1115CRT_PALETTE_OFF EQU 66H ; BIOS Current palette setting ;AN000;
1116P_BIT_MASK EQU 100000B ; bit 5 = Current palette ;AN000;
1117I_BIT_MASK EQU 1000B ; bit 4 = Intensity bit ;AN000;
1118R_BIT_MASK EQU 100B ; bit 2 = Red bit ;AN000;
1119G_BIT_MASK EQU 10B ; bit 1 = Green bit ;AN000;
1120B_BIT_MASK EQU 1B ; bit 0 = Blue bit ;AN000;
1121 ;AN000;
1122 MOV AX,ROM_BIOS_SEG ; ES := ROM BIOS SEGMENT ;AN000;
1123 PUSH AX ;AN000;
1124 POP ES ;AN000;
1125 ;AN000;
1126 MOV AL,ES:CRT_PALETTE_OFF; AL := CRT Palette (00PIIRGB) ;AN000;
1127 MOV BL,P_BIT_MASK ; LOW NIBBLE = BACKGROUND COLOR ;AN000;
1128 AND BL,AL ; BL := Palette number ;AN000;
1129 MOV CL,5 ;AN000;
1130 SHR BL,CL ;AN000;
1131 ;AN000;
1132 XOR DI,DI ; DI := Index in the XLT_TAB ;AN000;
1133;-------------------------------------------------------------------------------;AN000;
1134; Store the background color, (obtained from low 4 bits of the byte at 40:66) ;AN000;
1135;-------------------------------------------------------------------------------;AN000;
1136 CALL CGA_COL2RGB ; Convert color (in AL) to R, G, B values ;AN000;
1137 CALL RGB2XLT_TAB ; Convert RGB to an entry in XLT_TAB ;AN000;
1138;-------------------------------------------------------------------------------;AN000;
1139; Store the 3 foreground colors for mode 4 and 5 ;AN000;
1140;-------------------------------------------------------------------------------;AN000;
1141 MOV CX,3 ; For each color, but the background: ;AN000;
1142STORE_1_CGA_MODE4_COLOR: ;AN000;
1143 INC DI ; Increment index in the translation table ;AN000;
1144 MOV AX,DI ; AL := IRG ;AN000;
1145 SHL AL,1 ;AN000;
1146 OR AL,BL ; AL := IRGB ;AN000;
1147 CALL CGA_COL2RGB ; Convert color (in AL) to R, G, B values ;AN000;
1148 CALL RGB2XLT_TAB ; Convert RGB to an entry in XLT_TAB ;AN000;
1149 LOOP STORE_1_CGA_MODE4_COLOR ;AN000;
1150.ELSEIF <CUR_MODE EQ 6> ;AN000;
1151;===============================================================================;AN000;
1152; ;AN000;
1153; THE CURRENT MODE IS MODE 6 ;AN000;
1154; ;AN000;
1155;-------------------------------------------------------------------------------;AN000;
1156.THEN ;AN000;
1157;-------------------------------------------------------------------------------;AN000;
1158; Store background color for mode 6 (mode 6 is a 2 colors, APA mode) ;AN000;
1159; Background is stored as BLACK ;AN000;
1160;-------------------------------------------------------------------------------;AN000;
1161 XOR DI,DI ; DI := Index of color in translation table ;AN000;
1162 MOV RGB.R,BLACK_INT ; Foreground color is white ;AN000;
1163 MOV RGB.G,BLACK_INT ; RGB := RGB of white ;AN000;
1164 MOV RGB.B,BLACK_INT ; ;AN000;
1165 CALL RGB2XLT_TAB ; Convert RGB to an entry in XLT_TAB ;AN000;
1166;-------------------------------------------------------------------------------;AN000;
1167; Store foreground color for mode 6 (mode 6 is a 2 colors, APA mode) ;AN000;
1168;-------------------------------------------------------------------------------;AN000;
1169 INC DI ; DI := Index of color in translation table ;AN000;
1170 MOV RGB.R,WHITE_INT ; Background color is BLACK ;AN000;
1171 MOV RGB.G,WHITE_INT ; RGB := RGB of BLACK ;AN000;
1172 MOV RGB.B,WHITE_INT ; ;AN000;
1173 CALL RGB2XLT_TAB ; Convert RGB to an entry in XLT_TAB ;AN000;
1174.ELSE ;AN000;
1175;===============================================================================;AN000;
1176; ;AN000;
1177; THE CURRENT MODE IS A TEXT MODE: ;AN000;
1178; ;AN000;
1179;-------------------------------------------------------------------------------;AN000;
1180 XOR DI,DI ; DI := Index in the translation table ;AN000;
1181 MOV CX,16 ; For each of the 16 colors: ;AN000;
1182STORE_1_CGA_TEXT_COLOR: ;AN000;
1183 MOV AX,DI ; AL := IRGB ;AN000;
1184 CALL CGA_COL2RGB ; Convert color (in AL) to R, G, B values ;AN000;
1185 CALL RGB2XLT_TAB ; Convert RGB to an entry in XLT_TAB ;AN000;
1186 INC DI ; Increment index in the translation table ;AN000;
1187 LOOP STORE_1_CGA_TEXT_COLOR ;AN000;
1188.ENDIF ; ;AN000;
1189 ;AN000;
1190 POP ES ;AN000;
1191 POP DI ;AN000;
1192 POP CX ;AN000;
1193 POP BX ;AN000;
1194 POP AX ;AN000;
1195 ;AN000;
1196 RET ;AN000;
1197SET_CGA_XLT_TAB ENDP ;AN000;
1198PAGE ;AN000;
1199;===============================================================================;AN000;
1200; ;AN000;
1201; RGB2XLT_TAB: CONVERT R,G,B VALUES TO EITHER A BAND MASK OR AN INTENSITY ;AN000;
1202; STORE THE RESULT IN THE TRANSLATION TABLE ;AN000;
1203; ;AN000;
1204;-------------------------------------------------------------------------------;AN000;
1205; ;AN000;
1206; INPUT: DI = Index in the translation table ;AN000;
1207; RGB = Red Green Blue values of the color to be stored. ;AN000;
1208; ;AN000;
1209; OUTPUT: XLT_TAB is updated ;AN000;
1210; ;AN000;
1211;-------------------------------------------------------------------------------;AN000;
1212; DESCRIPTION: Convert the RGB values to either a Band mask or an intensity ;AN000;
1213; depending on the printer type; store the result in the translation table. ;AN000;
1214; ;AN000;
1215; LOGIC: ;AN000;
1216; IF PRINTER_TYPE = COLOR ;AN000;
1217; THEN ;AN000;
1218; CALL RGB2BAND ; Obtain a Band Mask ;AN000;
1219; ELSE ; Printer is Monochrome ;AN000;
1220; CALL RGB2INT ; Obtain a Grey Intensity ;AN000;
1221; Store the result in the XLT_TAB ;AN000;
1222; ;AN000;
1223RGB2XLT_TAB PROC NEAR ;AN000;
1224 .IF <DS:[BP].PRINTER_TYPE EQ COLOR>; Color printer ? ;AN000;
1225 .THEN ;AN000;
1226;-------A color printer is attached: ;AN000;
1227 CALL RGB2BAND ; Yes, convert RGB to color band (in AL);AN000;
1228 .ELSE ;AN000;
1229;-------A black and white printer is attached: ;AN000;
1230 CALL RGB2INT ; No, RGB to an intensity in AL ;AN000;
1231 .ENDIF ;AN000;
1232;-------Store the result ;AN000;
1233 MOV XLT_TAB[DI],AL ;AN000;
1234 RET ;AN000;
1235RGB2XLT_TAB ENDP ;AN000;
1236PAGE ;AN000;
1237;===============================================================================;AN000;
1238; ;AN000;
1239; CGA_COL2RGB : CONVERT A COLOR FROM THE CGA TO RED GREEN BLUE VALUES ;AN000;
1240; ;AN000;
1241;-------------------------------------------------------------------------------;AN000;
1242; ;AN000;
1243; INPUT: AL = 0000IRGB ONE BYTE WHERE BIT: ;AN000;
1244; ;AN000;
1245; I = Intensity bit ;AN000;
1246; R = Red component ;AN000;
1247; G = Green component ;AN000;
1248; B = Blue component ;AN000;
1249; ;AN000;
1250; ;AN000;
1251; OUTPUT: RGB.R = RED component (0-63) ;AN000;
1252; RGB.G = GREEN component (0-63) ;AN000;
1253; RGB.B = BLUE component (0-63) ;AN000;
1254; ;AN000;
1255; CALLED BY: SET_UP_CGA_XLT_TABLE ;AN000;
1256; ;AN000;
1257;----------------------------------------------------------------------- ;AN000;
1258; ;AN000;
1259; DESCRIPTION: If either the RED, GREEN, or BLUE bit is on (in an IRGB ;AN000;
1260; byte) then, the corresponding color gun on the display is firing 2/3 ;AN000;
1261; of its capacity, giving a color intensity of "2/3". ;AN000;
1262; ;AN000;
1263; If the INTENSITY bit is on, then 1/3 is added to EACH color. ;AN000;
1264; ;AN000;
1265; (E.G., IRGB R G B ;AN000;
1266; BLACK = 00000000 ( 0, 0, 0) ;AN000;
1267; WHITE = 00001111 (3/3, 3/3, 3/3) ;AN000;
1268; RED = 00000100 (2/3, 0, 0) ;AN000;
1269; HIGH INT. RED = 00001100 (3/3, 1/3, 1/3) ;AN000;
1270; ;AN000;
1271; Since we want an intensity from 0 to 63, ;AN000;
1272; "2/3" of RED means: ;AN000;
1273; 2/3 * 63 = 42 ;AN000;
1274; ;AN000;
1275; ;AN000;
1276; LOGIC: ;AN000;
1277; Get the intensity. ;AN000;
1278; Get the red component ;AN000;
1279; Get the green component ;AN000;
1280; Get the blue component ;AN000;
1281; ;AN000;
1282CGA_COL2RGB PROC NEAR ;AN000;
1283;----------------------------------------------------------------------- ;AN000;
1284; ;AN000;
1285; Init the R,G,B values: ;AN000;
1286; ;AN000;
1287;----------------------------------------------------------------------- ;AN000;
1288 MOV RGB.R,0 ;AN000;
1289 MOV RGB.G,0 ;AN000;
1290 MOV RGB.B,0 ;AN000;
1291;----------------------------------------------------------------------- ;AN000;
1292; ;AN000;
1293; Test the Intensity bit: ;AN000;
1294; ;AN000;
1295;----------------------------------------------------------------------- ;AN000;
1296 .IF <BIT AL AND I_BIT_MASK> ; IF, I is on ;AN000;
1297 .THEN ;AN000;
1298 ADD RGB.R,ONE_THIRD ; Then, add one third to each ;AN000;
1299 ADD RGB.G,ONE_THIRD ; color. ;AN000;
1300 ADD RGB.B,ONE_THIRD ;AN000;
1301 .ENDIF ;AN000;
1302;----------------------------------------------------------------------- ;AN000;
1303; ;AN000;
1304; Test the RGB bits: ;AN000;
1305; ;AN000;
1306;----------------------------------------------------------------------- ;AN000;
1307 .IF <BIT AL AND R_BIT_MASK> ; If, Red is on ;AN000;
1308 .THEN ;AN000;
1309 ADD RGB.R,TWO_THIRD ; then, add two third RED ;AN000;
1310 .ENDIF ;AN000;
1311 ;AN000;
1312 .IF <BIT AL AND G_BIT_MASK> ; If, Green is on ;AN000;
1313 .THEN ;AN000;
1314 ADD RGB.G,TWO_THIRD ; then, add two third GREEN ;AN000;
1315 .ENDIF ;AN000;
1316 ;AN000;
1317 .IF <BIT AL AND B_BIT_MASK> ; If, Blue is on ;AN000;
1318 .THEN ;AN000;
1319 ADD RGB.B,TWO_THIRD ; then, add two third BLUE ;AN000;
1320 .ENDIF ;AN000;
1321 ;AN000;
1322 RET ;AN000;
1323CGA_COL2RGB ENDP ;AN000;
1324PAGE ;AN000;
1325;======================================================================= ;AN000;
1326; ;AN000;
1327; SET_MODE_F_XLT_TAB: SET UP COLOR TRANSLATION TABLE FOR MONOCHROME ;AN000;
1328; MODE "F" ;AN000;
1329; ;AN000;
1330;----------------------------------------------------------------------- ;AN000;
1331; ;AN000;
1332; INPUT: XLT_TAB = Color translation table. ;AN000;
1333; PRINTER_TYPE = Type of printer attached (Color or B&W) ;AN000;
1334; SWITCHES = GRAPHICS command line parameters. ;AN000;
1335; ;AN000;
1336; OUTPUT: XLT_TAB IS UPDATED ;AN000;
1337; ;AN000;
1338; CALLED BY: SET_UP_XLT_TABLE ;AN000;
1339; ;AN000;
1340;-------------------------------------------------------------------------------;AN000;
1341; ;AN000;
1342; NOTES: In mode F the "VIDEO BIOS READ DOT call" returns a byte where ;AN000;
1343; bit 1 and 3 represent the value of plane 1 and 3. ;AN000;
1344; The following colors are available using this mode: ;AN000;
1345; ;AN000;
1346; plane 2: plane 0: color: ;AN000;
1347; 0 0 black ;AN000;
1348; 0 1 white ;AN000;
1349; 1 0 blinking white ;AN000;
1350; 1 1 high-intensity white ;AN000;
1351; ;AN000;
1352; ;AN000;
1353; DESCRIPTION: A local table holds the Red, Green, Blue values for each of ;AN000;
1354; the 4 Mono colors available in Mode Fh. ;AN000;
1355; Each color is stored as either a Grey intensity if printing in Monochrome ;AN000;
1356; or as a Band Mask if printing in color. ;AN000;
1357; Black is stored as black. ;AN000;
1358; White is stored as a light gray ;AN000;
1359; High-intensity white and blinking white are stored as white. ;AN000;
1360; ;AN000;
1361; ;AN000;
1362; LOGIC: ;AN000;
1363; FOR EACH "COLOR" AVAILABLE WITH MODE F ;AN000;
1364; GET ITS R,G,B VALUES ;AN000;
1365; CALL RGB2XLT_TAB ; Convert RGB to an entry in the translation ;AN000;
1366; ; table ;AN000;
1367; ;AN000;
1368SET_MODE_F_XLT_TAB PROC NEAR ;AN000;
1369 PUSH AX ;AN000;
1370 PUSH SI ;AN000;
1371 PUSH DI ;AN000;
1372 JMP SHORT SET_MODE_F_BEGIN ;AN000;
1373;-------------------------------------------------------------------------------;AN000;
1374; ;AN000;
1375; TABLE OF R,G,B VALUES WE ASSIGN TO THE 4 COLORS AVAILABLE IN MODE F: ;AN000;
1376; ;AN000;
1377;-------------------------------------------------------------------------------;AN000;
1378MODE_F_RGB LABEL BYTE ;AN000;
1379 DB BLACK_INT,BLACK_INT,BLACK_INT ; Black is mapped to black. ;AN000;
1380 DB TWO_THIRD,TWO_THIRD,TWO_THIRD ; White --> light grey ;AN000;
1381 DB WHITE_INT,WHITE_INT,WHITE_INT ; Blinking --> white ;AN000;
1382 DB WHITE_INT,WHITE_INT,WHITE_INT ; High-int. White --> white ;AN000;
1383;-------------------------------------------------------------------------------;AN000;
1384; ;AN000;
1385; STORE THE COLORS AVAILABLE WITH MODE F ;AN000;
1386; ;AN000;
1387;-------------------------------------------------------------------------------;AN000;
1388SET_MODE_F_BEGIN: ;AN000;
1389 MOV SI,OFFSET MODE_F_RGB ; SI <-- Offset of RGB table ;AN000;
1390 XOR DI,DI ; DI <-- Index into translation table ;AN000;
1391 ;AN000;
1392;-------For each color available in mode F: ;AN000;
1393STORE_1_MODE_F_COLOR: ;AN000;
1394 MOV AL,[SI] ; Get the Red component ;AN000;
1395 MOV RGB.R,AL ;AN000;
1396 MOV AL,[SI]+1 ; Get the Green component ;AN000;
1397 MOV RGB.G,AL ;AN000;
1398 MOV AL,[SI]+2 ; Get the Blue component ;AN000;
1399 MOV RGB.B,AL ;AN000;
1400 ;AN000;
1401;-------Convert pixel to either a Color band or an Intensity: ;AN000;
1402 CALL RGB2XLT_TAB ; Convert and store in the xlt table ;AN000;
1403 ;AN000;
1404 ADD SI,3 ; Get next R,G,B values ;AN000;
1405 INC DI ; One more color has been stored ;AN000;
1406 CMP DI,NB_COLORS ; All stored ? ;AN000;
1407 JL STORE_1_MODE_F_COLOR ;AN000;
1408 ;AN000;
1409 POP DI ;AN000;
1410 POP SI ;AN000;
1411 POP AX ;AN000;
1412 RET ;AN000;
1413SET_MODE_F_XLT_TAB ENDP ;AN000;
1414PAGE ;AN000;
1415;======================================================================= ;AN000;
1416; ;AN000;
1417; SET_MODE_13H_XLT_TAB: SET UP COLOR TRANSLATION TABLE FOR PALACE VIDEO ;AN000;
1418; ADAPTER IN MODE 13H ;AN000;
1419; ;AN000;
1420;----------------------------------------------------------------------- ;AN000;
1421; ;AN000;
1422; INPUT: XLT_TAB = Color translation table. ;AN000;
1423; PRINTER_TYPE = Type of printer attached (Color or B&W) ;AN000;
1424; SWITCHES = GRAPHICS command line parameters. ;AN000;
1425; ;AN000;
1426; OUTPUT: XLT_TAB IS UPDATED ;AN000;
1427; ;AN000;
1428; CALLED BY: SET_UP_XLT_TABLE ;AN000;
1429; ;AN000;
1430;----------------------------------------------------------------------- ;AN000;
1431; ;AN000;
1432; NOTES: With the PALACE the "VIDEO BIOS READ DOT call" returns a direct ;AN000;
1433; index to the 256 COLOR REGISTERS. ;AN000;
1434; ;AN000;
1435; These COLORS REGISTERS hold the R,G,B (Red, Green, Blue) values for ;AN000;
1436; each of the 256 colors available at the same time on the screen. ;AN000;
1437; Color register number 0 holds the background color. ;AN000;
1438; ;AN000;
1439; DESCRIPTION: Store a color mapping for each color register. ;AN000;
1440; If the REVERSE_SW is off, exchange white and black. ;AN000;
1441; ;AN000;
1442; LOGIC: ;AN000;
1443; ;AN000;
1444; For each color (0 to 255) ;AN000;
1445; Read the color register ; get the RGB values for this color num. ;AN000;
1446; Store the result in the XLT_TAB ;AN000;
1447; ;AN000;
1448SET_MODE_13H_XLT_TAB PROC NEAR ;AN000;
1449 PUSH AX ;AN000;
1450 PUSH BX ;AN000;
1451 PUSH CX ;AN000;
1452 PUSH DX ;AN000;
1453 PUSH DI ;AN000;
1454 ;AN000;
1455 MOV NB_COLORS_TO_READ,256 ; Read 256 color registers ;AN000;
1456 ;AN000;
1457;-------------------------------------------------------------------------------;AN000;
1458; ;AN000;
1459; Store in the translation table each color available for mode 13h: ;AN000;
1460; ;AN000;
1461;-------------------------------------------------------------------------------;AN000;
1462 XOR DI,DI ; DI := Palette register number ;AN000;
1463 ; and index in the translation table ;AN000;
1464STORE_1_M13H_COLOR: ;AN000;
1465 MOV BX,DI ; BX := Color register to be read ;AN000;
1466 MOV AX,GET_C_REG_CALL ; AX := BIOS Get color register call ;AN000;
1467 INT 10H ; Call BIOS ;AN000;
1468 MOV RGB.R,DH ; Get Red value ;AN000;
1469 MOV RGB.G,CH ; Get Green value ;AN000;
1470 MOV RGB.B,CL ; Get Blue value ;AN000;
1471 CALL RGB2XLT_TAB ; Convert RGB to an entry in XLT_TAB ;AN000;
1472 INC DI ; Get next palette register number ;AN000;
1473 CMP DI,NB_COLORS_TO_READ ; All colors stored ? ;AN000;
1474 JL STORE_1_M13H_COLOR ; No, get next one ;AN000;
1475 ;AN000;
1476 ;AN000;
1477 POP DI ;AN000;
1478 POP DX ;AN000;
1479 POP CX ;AN000;
1480 POP BX ;AN000;
1481 POP AX ;AN000;
1482 RET ;AN000;
1483NB_COLORS_TO_READ DW ? ; Number of colors registers to read with a PS/2;AN000;
1484SET_MODE_13H_XLT_TAB ENDP ;AN000;
1485PAGE ;AN000;
1486;===============================================================================;AN000;
1487; ;AN000;
1488; SET_ROUNDUP_XLT_TAB: SET UP COLOR TRANSLATION TABLE FOR ROUNDUP VIDEO ;AN000;
1489; ADAPTER ;AN000;
1490; ;AN000;
1491;-------------------------------------------------------------------------------;AN000;
1492; ;AN000;
1493; INPUT: XLT_TAB = Color translation table. ;AN000;
1494; PRINTER_TYPE = Type of printer attached (Color or B&W) ;AN000;
1495; SWITCHES = GRAPHICS command line parameters. ;AN000;
1496; ;AN000;
1497; OUTPUT: XLT_TAB IS UPDATED ;AN000;
1498; ;AN000;
1499; CALLED BY: SET_UP_XLT_TABLE ;AN000;
1500; ;AN000;
1501;-------------------------------------------------------------------------------;AN000;
1502; ;AN000;
1503; NOTES: With the ROUNDUP the "VIDEO BIOS READ DOT call" returns an ;AN000;
1504; index into the 16 PALETTE REGISTERS. ;AN000;
1505; ;AN000;
1506; Each palette register holds an index into the current "color page" ;AN000;
1507; within the 256 COLOR REGISTERS. ;AN000;
1508; ;AN000;
1509; These "color pages" represent all the colors from WHICH TO CHOOSE the ;AN000;
1510; screen colors for an active page; 16 colors can be displayed at the ;AN000;
1511; same time on the screen. ;AN000;
1512; ;AN000;
1513; There are 2 paging modes: either 64 color pages or 16 color pages: ;AN000;
1514; ;AN000;
1515; In 64 color mode, there are 4 color pages available (the 256 palette ;AN000;
1516; registers are partitioned in 4 blocks of 64 colors). ;AN000;
1517; ;AN000;
1518; The 16 screen colors for the active page are selected from these 64 ;AN000;
1519; color registers. ;AN000;
1520; ;AN000;
1521; This scheme allows for quickly changing the contents of the screen by ;AN000;
1522; changing the active page. ;AN000;
1523; ;AN000;
1524; The COLOR REGISTERS contains the color information stored as RGB (Red, ;AN000;
1525; Green, Blue) components. There is one byte for each of these 3 ;AN000;
1526; components. The value for each component ranges from 0 to 63 (where ;AN000;
1527; 0 = color not present). ;AN000;
1528; ;AN000;
1529; ;AN000;
1530; DESCRIPTION: Determine the paging mode and the active color page. ;AN000;
1531; For each color available with the current mode, get the palette ;AN000;
1532; register and then, read the corresponding color register in order to ;AN000;
1533; obtain its RGB components. ;AN000;
1534; ;AN000;
1535; For mode 11h, 2 colors only are available. These colors are obtained from ;AN000;
1536; palette register 0 (background) and 7 (foreground color). The contents ;AN000;
1537; of these 2 palette registers is also used as an index within the color ;AN000;
1538; registers. ;AN000;
1539; ;AN000;
1540; If printing is Monochrome, map the RGB to a Grey Intensity. ;AN000;
1541; If printing is in colors, map the RGB to a Band Mask. ;AN000;
1542; Store the result in the translation table ;AN000;
1543; ;AN000;
1544; LOGIC: ;AN000;
1545; ;AN000;
1546; Read color page state (BIOS INT 10H - AL = 1AH) ;AN000;
1547; ;AN000;
1548; If mode 4,5 or 6 ;AN000;
1549; Then ;AN000;
1550; CALL SET_CGA_XLT_TAB ;AN000;
1551; Adjust the background color. ;AN000;
1552; else ;AN000;
1553; If mode 11h ;AN000;
1554; then ;AN000;
1555; For PALETTE_INDEX := 0 to 15 ;AN000;
1556; IF PAGE_MODE = PAGE_64_REGISTERS ;AN000;
1557; THEN ;AN000;
1558; Read the palette register number "PALETTE_INDEX" ;AN000;
1559; COLOR_INDEX := Palette register contents ;AN000;
1560; COLOR_INDEX := (CUR_PAGE_NUM * 64) + COLOR_INDEX ;AN000;
1561; Read color register number "COLOR_INDEX" ; Obtain R,G,B values. ;AN000;
1562; CALL RGB2XLT_TAB ; Convert RGB to an entry in XLT_TAB ;AN000;
1563; ;AN000;
1564; ELSE IF PAGE_MODE = PAGE_16_REGISTERS ;AN000;
1565; COLOR_INDEX := (CUR_PAGE_NUM * 16) + PALETTE_INDEX ;AN000;
1566; Read color register number "COLOR_INDEX" ;AN000;
1567; CALL RGB2XLT_TAB ; Convert RGB to an entry in XLT_TAB ;AN000;
1568; ;AN000;
1569; ;AN000;
1570SET_ROUNDUP_XLT_TAB PROC NEAR ;AN000;
1571PAGING_MODE_64 EQU 0 ;AN000;
1572 ;AN000;
1573 PUSH AX ;AN000;
1574 PUSH BX ;AN000;
1575 PUSH CX ;AN000;
1576 PUSH DI ;AN000;
1577 ;AN000;
1578;-------------------------------------------------------------------------------;AN000;
1579; Obtain the color page state ;AN000;
1580;-------------------------------------------------------------------------------;AN000;
1581 MOV AX,PAGE_STATE_CALL ; Call BIOS ;AN000;
1582 INT 10H ; BL := Paging mode ;AN000;
1583 ; BH := Current page ;AN000;
1584 ;AN000;
1585;-------------------------------------------------------------------------------;AN000;
1586; Check the video mode: ;AN000;
1587;-------------------------------------------------------------------------------;AN000;
1588.SELECT ;AN000;
1589.WHEN <CUR_MODE EQ 4> OR ; If the current mode is an old CGA ;AN000;
1590.WHEN <CUR_MODE EQ 5> OR ; mode: ;AN000;
1591.WHEN <CUR_MODE EQ 6> ; ;AN000;
1592;-------------------------------------------------------------------------------;AN000;
1593; ;AN000;
1594; Old CGA graphics mode (mode 4, 5 or 6) ;AN000;
1595; ;AN000;
1596;-------------------------------------------------------------------------------;AN000;
1597;-------------------------------------------------------------------------------;AN000;
1598; Store colors of the old CGA modes: ;AN000;
1599;-------------------------------------------------------------------------------;AN000;
1600 CALL SET_CGA_XLT_TAB ; Set up colors in the translation ;AN000;
1601 ; table, NOTE: The background color ;AN000;
1602 ; will not be set properly since the ;AN000;
1603 ; PS/2 BIOS does not update memory ;AN000;
1604 ; location 40:66 with the value ;AN000;
1605 ; of the background color as CGA ;AN000;
1606 ; does for modes 4 and 5. However ;AN000;
1607 ; 40:66 holds the current palette;AN000;
1608 ; selected. ;AN000;
1609;-------------------------------------------------------------------------------;AN000;
1610; Adjust the background color for modes 4,5 or 6 ;AN000;
1611;-------------------------------------------------------------------------------;AN000;
1612 MOV PAL_REGISTER_NB,0 ; Read the palette register number 0 ;AN000;
1613 CALL GET_PALETTE_RGB ; this register points to the color ;AN000;
1614 ; register that contains the RGB ;AN000;
1615 ; values of the BACKGROUND color. ;AN000;
1616 MOV DI,0 ; DI := Index in the translation table ;AN000;
1617 CALL RGB2XLT_TAB ; Store mapping in the translation table;AN000;
1618 ;AN000;
1619.WHEN <CUR_MODE EQ 11H> ;AN000;
1620;-------------------------------------------------------------------------------;AN000;
1621; ;AN000;
1622; Mode 11h (2 colors out of 256,000 colors) ;AN000;
1623; ;AN000;
1624;-------------------------------------------------------------------------------;AN000;
1625;-------------------------------------------------------------------------------;AN000;
1626; Get the background color: ;AN000;
1627;-------------------------------------------------------------------------------;AN000;
1628 MOV PAL_REGISTER_NB,0 ; Read the palette register number 0 ;AN000;
1629 CALL GET_PALETTE_RGB ; Get the RGB values for this color ;AN000;
1630 MOV DI,0 ; DI := Index in translation table ;AN000;
1631 CALL RGB2XLT_TAB ; Store mapping in the translation table;AN000;
1632;-------------------------------------------------------------------------------;AN000;
1633; Get the foreground color: ;AN000;
1634;-------------------------------------------------------------------------------;AN000;
1635 MOV PAL_REGISTER_NB,7 ; Read the palette register for the ;AN000;
1636 ; FOREGROUND color (palette register 7);AN000;
1637 CALL GET_PALETTE_RGB ; Get the RGB values for this color ;AN000;
1638 MOV DI,1 ; DI := Index in translation table ;AN000;
1639 CALL RGB2XLT_TAB ; Store mapping in the translation table;AN000;
1640.OTHERWISE ;AN000;
1641;-------------------------------------------------------------------------------;AN000;
1642; ;AN000;
1643; The current mode is a 16 color mode ;AN000;
1644; ;AN000;
1645;-------------------------------------------------------------------------------;AN000;
1646 XOR DI,DI ; DI := Index in translation table ;AN000;
1647 MOV CX,16 ; 16 colors to read and store ;AN000;
1648 MOV PAL_REGISTER_NB,0 ; Palette register to read ;AN000;
1649STORE_1_PS2_COLOR: ;AN000;
1650 CALL GET_PALETTE_RGB ; Get the RGB values for this color ;AN000;
1651; ;AN000;
1652;-------Convert the RGB values to band mask or intensity and store in XLT_TAB: ;AN000;
1653 ;AN000;
1654 CALL RGB2XLT_TAB ; Store mapping in the translation table;AN000;
1655 INC DI ; Get next palette register number ;AN000;
1656 INC PAL_REGISTER_NB ; ;AN000;
1657 LOOP STORE_1_PS2_COLOR ; Read it. ;AN000;
1658.ENDSELECT ;AN000;
1659 ;AN000;
1660 POP DI ;AN000;
1661 POP CX ;AN000;
1662 POP BX ;AN000;
1663 POP AX ;AN000;
1664 RET ;AN000;
1665PAL_REGISTER_NB DB ? ; Number of the palette register to read;AN000;
1666SET_ROUNDUP_XLT_TAB ENDP ;AN000;
1667 ;AN000;
1668PAGE ;AN000;
1669;===============================================================================;AN000;
1670; ;AN000;
1671; GET_PALETTE_RGB: ON THE PS/2 MODEL 50, 60 AND 80, GET THE RGB VALUES FOR A ;AN000;
1672; PALETTE REGISTER BY READING THE CORRESPONDING COLOR REGISTER;AN000;
1673; ;AN000;
1674;-------------------------------------------------------------------------------;AN000;
1675; ;AN000;
1676; INPUT: PAL_REGISTER_NB = Palette register number ;AN000;
1677; BH = Current page number ;AN000;
1678; BL = Current paging mode ;AN000;
1679; ;AN000;
1680; OUTPUT: RGB.R = The RGB values obtained from the color register;AN000;
1681; RGB.G corresponding to the palette register specified;AN000;
1682; RGB.B ;AN000;
1683; ;AN000;
1684; CALLED BY: SET_ROUNDUP_XLT_TAB ;AN000;
1685; ;AN000;
1686;-------------------------------------------------------------------------------;AN000;
1687GET_PALETTE_RGB PROC ;AN000;
1688 PUSH AX ;AN000;
1689 PUSH BX ;AN000;
1690 PUSH CX ;AN000;
1691 PUSH DX ;AN000;
1692 PUSH SI ;AN000;
1693 ;AN000;
1694 MOV AL,BH ; SI := Current page number ;AN000;
1695 CBW ; ;AN000;
1696 MOV SI,AX ; ;AN000;
1697;-------------------------------------------------------------------------------;AN000;
1698; ;AN000;
1699; Calculte the absolute number of the first Color Register for the current page:;AN000;
1700; (calculated in SI) ;AN000;
1701; ;AN000;
1702;-------------------------------------------------------------------------------;AN000;
1703.IF <BL EQ PAGING_MODE_64> ; If mode is 64 Color page ;AN000;
1704.THEN ; then ;AN000;
1705 MOV CL,6 ; SI := Current page num * 64 ;AN000;
1706 SHL SI,CL ; ;AN000;
1707.ELSE ; else, Mode is 16 Color page ;AN000;
1708 MOV CL,4 ; SI := Current page num * 16 ;AN000;
1709 SHL SI,CL ; ;AN000;
1710.ENDIF ;AN000;
1711 ;AN000;
1712; ;AN000;
1713;-------Read the PALETTE REGISTER ;AN000;
1714 MOV BL,PAL_REGISTER_NB ; BL := Palette register to be read ;AN000;
1715 MOV AX,GET_P_REG_CALL ; Read palette register call ;AN000;
1716 INT 10H ; Call BIOS, ;AN000;
1717 ; BH := Color register index ;AN000;
1718 ; WITHIN the current page and is;AN000;
1719 ; either (0-15) or (0-63) ;AN000;
1720 ; NOTE: SI = Absolute index (0-255) to ;AN000;
1721 ; the first color register of the ;AN000;
1722 ; current page and is a multiple of ;AN000;
1723 ; either 16 or 64 ;AN000;
1724 MOV BL,BH ; BX := Index within current color page ;AN000;
1725 XOR BH,BH ; ;AN000;
1726 ;AN000;
1727; ;AN000;
1728;-------Read the Color register: ;AN000;
1729 OR BX,SI ; BX := Index of Color register to read ;AN000;
1730 MOV AX,GET_C_REG_CALL ; Read the color register ;AN000;
1731 INT 10H ; Call BIOS, ;AN000;
1732 MOV RGB.R,DH ; DH := Red value read ;AN000;
1733 MOV RGB.G,CH ; CH := Green value read ;AN000;
1734 MOV RGB.B,CL ; CL := Blue value read ;AN000;
1735 ;AN000;
1736 POP SI ;AN000;
1737 POP DX ;AN000;
1738 POP CX ;AN000;
1739 POP BX ;AN000;
1740 POP AX ;AN000;
1741 RET ;AN000;
1742GET_PALETTE_RGB ENDP ;AN000;
1743PAGE ;AN000;
1744;======================================================================= ;AN000;
1745; ;AN000;
1746; EGA_COL2RGB : CONVERT A COLOR FROM THE EGA TO RED GREEN BLUE VALUES ;AN000;
1747; ;AN000;
1748;----------------------------------------------------------------------- ;AN000;
1749; ;AN000;
1750; INPUT: AL = 00rgbRGB ONE BYTE WHERE BIT: ;AN000;
1751; ;AN000;
1752; r = 1/3 of Red component ;AN000;
1753; g = 1/3 of Green component ;AN000;
1754; b = 1/3 of Blue component ;AN000;
1755; R = 2/3 of Red component ;AN000;
1756; G = 2/3 of Green component ;AN000;
1757; B = 3/3 of Blue component ;AN000;
1758; ;AN000;
1759; ;AN000;
1760; OUTPUT: RGB.R = RED component (0-63) ;AN000;
1761; RGB.G = GREEN component (0-63) ;AN000;
1762; RGB.B = BLUE component (0-63) ;AN000;
1763; ;AN000;
1764; CALLED BY: SET_UP_EGA_XLT_TABLE ;AN000;
1765; ;AN000;
1766;----------------------------------------------------------------------- ;AN000;
1767; ;AN000;
1768; DESCRIPTION: Sums up the values for each color component. ;AN000;
1769; "2/3 of RED" means that the red gun in the display attached to the EGA ;AN000;
1770; is firing at 2/3 of full intensity. ;AN000;
1771; ;AN000;
1772; Since the color intensities range from 0 to 63, "1/3" means an ;AN000;
1773; intensity of: ;AN000;
1774; 1/3 * 63 = 21 ;AN000;
1775; ;AN000;
1776; LOGIC: ;AN000;
1777; ;AN000;
1778; Get the red component ;AN000;
1779; Get the green component ;AN000;
1780; Get the blue component ;AN000;
1781; ;AN000;
1782EGA_COL2RGB PROC NEAR ;AN000;
1783; ;AN000;
1784;-------Get the RED component (bit 5 and 2) ;AN000;
1785; ;AN000;
1786;-------Check bit 2 ;AN000;
1787 MOV RGB.R,0 ;AN000;
1788 TEST AL,100B ; "R" is on ? ;AN000;
1789 JZ CHECK_BIT_5 ; No, check "r" ;AN000;
1790 ADD RGB.R,TWO_THIRD ; Yes, add 2/3 RED ;AN000;
1791CHECK_BIT_5: ;AN000;
1792 TEST AL,100000B ; "r" is on ? ;AN000;
1793 JZ CHECK_BIT_1 ; No, check Green ;AN000;
1794 ADD RGB.R,ONE_THIRD ; Yes, add 1/3 RED ;AN000;
1795; ;AN000;
1796;-------Get the GREEN component (bit 4 and 1) ;AN000;
1797; ;AN000;
1798CHECK_BIT_1: ;AN000;
1799 MOV RGB.G,0 ;AN000;
1800 TEST AL,10B ; "G" is on ? ;AN000;
1801 JZ CHECK_BIT_4 ; No, check "g" ;AN000;
1802 ADD RGB.G,TWO_THIRD ; Yes, add 2/3 GREEN ;AN000;
1803CHECK_BIT_4: ;AN000;
1804 TEST AL,10000B ; "g" is on ? ;AN000;
1805 JZ CHECK_BIT_0 ; No, check for Blue ;AN000;
1806 ADD RGB.G,ONE_THIRD ; Yes, add 1/3 GREEN ;AN000;
1807; ;AN000;
1808;-------Get the BLUE component (bit 3 and 0) ;AN000;
1809; ;AN000;
1810CHECK_BIT_0: ;AN000;
1811 MOV RGB.B,0 ;AN000;
1812 TEST AL,1B ; "B" is on ? ;AN000;
1813 JZ CHECK_BIT_3 ; No, check "b" ;AN000;
1814 ADD RGB.B,TWO_THIRD ; Yes, add 2/3 BLUE ;AN000;
1815CHECK_BIT_3: ;AN000;
1816 TEST AL,1000B ; "b" is on ? ;AN000;
1817 JZ EGA_COL2RGB_RETURN ; No, return ;AN000;
1818 ADD RGB.B,ONE_THIRD ; Yes, add 1/3 BLUE ;AN000;
1819EGA_COL2RGB_RETURN: ;AN000;
1820 RET ;AN000;
1821EGA_COL2RGB ENDP ;AN000;
1822 ;AN000;
1823PAGE ;AN000;
1824;===============================================================================;AN000;
1825; ;AN000;
1826; RGB2INT : MAP RED GREEN BLUE VALUES TO AN INTENSITY. ;AN000;
1827; ;AN000;
1828;-------------------------------------------------------------------------------;AN000;
1829; ;AN000;
1830; INPUT: RGB.R = A RED value (0-63) ;AN000;
1831; RGB.G = A GREEN value (0-63) ;AN000;
1832; RGB.B = A BLUE value (0-63) ;AN000;
1833; DARKADJUST_VALUE= THE DARKNESS VALUE (In shared data area). ;AN000;
1834; SWITCHES = Command line switches ;AN000;
1835; ;AN000;
1836; OUTPUT: AL = THE INTENSITY (0-63) NOTE: 0 = BLACK ;AN000;
1837; 63 = BRIGHT WHITE ;AN000;
1838; ;AN000;
1839; WARNING: AH IS LOST ;AN000;
1840; ;AN000;
1841;-------------------------------------------------------------------------------;AN000;
1842; ;AN000;
1843; DESCRIPTION: When the RGB values for a pixel are at their maximum ;AN000;
1844; value, what we obtain is a bright white pixel on the screen; this is ;AN000;
1845; the brightest color achievable and therefore, its intensity is 63. ;AN000;
1846; ;AN000;
1847; When no color gun is firing on the display: RGB values are 0,0,0 this ;AN000;
1848; is no color at all and therefore maps to intensity 0. ;AN000;
1849; ;AN000;
1850; For intermediate colors, experimentation has shown that the eye will ;AN000;
1851; see blue as darker than red and red as darker than green. ;AN000;
1852; ;AN000;
1853; On a grey rainbow from 0 - 10 where 0 is black and 10 is white: ;AN000;
1854; ;AN000;
1855; Blue corresponds to a grey of intensity 1 ;AN000;
1856; Red corresponds to a grey of intensity 3 ;AN000;
1857; Green corresponds to a grey of intensity 6 ;AN000;
1858; ;AN000;
1859; Therefore, if we mix all 3 colors we obtain a grey of ;AN000;
1860; intensity 1 + 3 + 6 = 10 (i.e.,white). ;AN000;
1861; ;AN000;
1862; ;AN000;
1863; LOGIC: ;AN000;
1864; ;AN000;
1865; Calculate the intensity ;AN000;
1866; ;AN000;
1867; AL = (.6 * G) + (.3 * R) + (.1 * B) ;AN000;
1868; ;AN000;
1869; Adjust Darkness ;AN000;
1870; ;AN000;
1871; AL = AL + DARKADJUST_VALUE ;AN000;
1872; ;AN000;
1873RGB2INT PROC NEAR ;AN000;
1874 PUSH BX ;AN000;
1875 PUSH CX ;AN000;
1876 PUSH DX ;AN000;
1877 ;AN000;
1878 XOR AX,AX ; AL := Current component intensity ;AN000;
1879 XOR BX,BX ; BX is used for calculations ;AN000;
1880 XOR DX,DX ; DL := Running sum for grey intensity ;AN000;
1881 ;AN000;
1882;-------Process /R (Reverse black and white) ;AN000;
1883.IF <BIT DS:[BP].SWITCHES Z REVERSE_SW> ; IF reverse is OFF ;AN000;
1884.THEN ; THEN REVERSE BLACK AND WHITE: ;AN000;
1885;-------Test if the color is BLACK ;AN000;
1886 .IF <RGB.R EQ BLACK_INT> AND ; If black ;AN000;
1887 .IF <RGB.G EQ BLACK_INT> AND ; ;AN000;
1888 .IF <RGB.B EQ BLACK_INT> ; ;AN000;
1889 .THEN ; then, replace it with white ;AN000;
1890 MOV AL,WHITE_INT ;AN000;
1891 JMP SHORT RGB2INT_END ;AN000;
1892 .ELSEIF <RGB.R EQ WHITE_INT> AND ; else if, high-intensity white ;AN000;
1893 .IF <RGB.G EQ WHITE_INT> AND ; ;AN000;
1894 .IF <RGB.B EQ WHITE_INT> ; ;AN000;
1895 .THEN ; then, replace it with black ;AN000;
1896 MOV AL,BLACK_INT ;AN000;
1897 JMP SHORT RGB2INT_END ;AN000;
1898 .ELSEIF <RGB.R EQ TWO_THIRD> AND ; else if, white ;AN000;
1899 .IF <RGB.G EQ TWO_THIRD> AND ; ;AN000;
1900 .IF <RGB.B EQ TWO_THIRD> ; ;AN000;
1901 .THEN ; then, replace it with black ;AN000;
1902 MOV AL,BLACK_INT ;AN000;
1903 JMP SHORT RGB2INT_END ;AN000;
1904 .ENDIF ;AN000;
1905.ENDIF ;AN000;
1906 ;AN000;
1907;-------Calculate Green component ;AN000;
1908 MOV AL,RGB.G ; AL := Green component ;AN000;
1909 MOV BH,6 ; ;AN000;
1910 MUL BH ; AX := Green * 6 ;AN000;
1911 MOV BH,10 ; ;AN000;
1912 DIV BH ; AL := (GREEN * 6) / 10 ;AN000;
1913 ADD DL,AL ; DL := Cumulative intensity ;AN000;
1914 MOV CH,AH ; CH := Cumulative remainder ;AN000;
1915 ;AN000;
1916;-------Calculate Red component ;AN000;
1917 MOV AL,RGB.R ; AL := Red component ;AN000;
1918 MOV BH,3 ; ;AN000;
1919 MUL BH ; AX := Red * 3 ;AN000;
1920 MOV BH,10 ; ;AN000;
1921 DIV BH ; AL := (RED * 3) / 10 ;AN000;
1922 ADD DL,AL ; DL := Cumulative intensity ;AN000;
1923 ADD CH,AH ; CH := Cumulative remainder ;AN000;
1924 ;AN000;
1925;-------Calculate Blue component ;AN000;
1926 MOV AL,RGB.B ; AX := Blue component ;AN000;
1927 XOR AH,AH ; ;AN000;
1928 DIV BH ; AL := BLUE / 10 ;AN000;
1929 ADD DL,AL ; DL := Cumulative intensity ;AN000;
1930 ADD CH,AH ; CH := Cumulative remainder ;AN000;
1931 ;AN000;
1932;-------Adjust intensity with cumulative remainder ;AN000;
1933 XOR AX,AX ;AN000;
1934 MOV AL,CH ; AX := Cumulative remainder ;AN000;
1935 MOV BH,10 ; BH := 10 ;AN000;
1936 DIV BH ; AL := Total remainder / 10 ;AN000;
1937 ADD DL,AL ; DL := Cumulative intensity ;AN000;
1938 .IF <AH GT 4> ; If remainder > 4 ;AN000;
1939 .THEN ; Then, add 1 ;AN000;
1940 INC DL ; to the intensity ;AN000;
1941 .ENDIF ;AN000;
1942 ;AN000;
1943;-------Adjust darkness ;AN000;
1944 ADD DL,DS:[BP].DARKADJUST_VALUE ;AN000;
1945 ;AN000;
1946;-------Return result ;AN000;
1947 MOV AL,DL ; AL := sum of R,G,B intensities ;AN000;
1948 ;AN000;
1949RGB2INT_END: ;AN000;
1950 POP DX ;AN000;
1951 POP CX ;AN000;
1952 POP BX ;AN000;
1953 RET ;AN000;
1954RGB2INT ENDP ;AN000;
1955 ;AN000;
1956PAGE ;AN000;
1957;============================================================================== ;AN000;
1958; ;AN000;
1959; RGB2BAND: MAP RED GREEN BLUE VALUES TO A "SELECT COLOR BAND" MASK FOR ;AN000;
1960; THE COLOR PRINTER. ;AN000;
1961; ;AN000;
1962;------------------------------------------------------------------------------ ;AN000;
1963; ;AN000;
1964; INPUT: RGB.R = A RED value (0-63) ;AN000;
1965; RGB.G = A GREEN value (0-63) ;AN000;
1966; RGB.B = A BLUE value (0-63) ;AN000;
1967; BP = Offset of the Shared Data Area. ;AN000;
1968; ;AN000;
1969; OUTPUT: AL = The Band Mask, one byte where: ;AN000;
1970; ;AN000;
1971; bit 0 = Color Band 1 is needed ;AN000;
1972; bit 1 = Color Band 2 is needed ;AN000;
1973; bit 2 = Color Band 3 is needed ;AN000;
1974; bit 3 = Color Band 4 is needed ;AN000;
1975; ;AN000;
1976; ;AN000;
1977; CALLED BY: SET_CGA_XLT_TAB ;AN000;
1978; SET_EGA_XLT_TAB ;AN000;
1979; SET_ROUNDUP_XLT_TAB ;AN000;
1980; SET_MODE_13H_XLT_TAB ;AN000;
1981; SET_MODE_F_XLT_TAB ;AN000;
1982; ;AN000;
1983;------------------------------------------------------------------------------ ;AN000;
1984; ;AN000;
1985; NOTES: The RGB values in input describe a color from the screen. ;AN000;
1986; Up to 256K different colors can be described with these RGB values. ;AN000;
1987; ;AN000;
1988; On the color printer, the print ribbon is composed of 4 color bands, ;AN000;
1989; each of a different color. By overlapping these 4 bands when ;AN000;
1990; printing, more colors can be obtained. However, the number of colors ;AN000;
1991; that can be achieved by overlapping print bands is very limited (4 or ;AN000;
1992; 8 colors). ;AN000;
1993; ;AN000;
1994; THIS MODULE SELECT THE PRINTER COLOR THAT IS THE CLOSEST TO THE ;AN000;
1995; DESIRED SCREEN COLOR. ;AN000;
1996; ;AN000;
1997; The Band Mask specifies which color bands have to be overlapped to ;AN000;
1998; obtain a color on the printer. ;AN000;
1999; ;AN000;
2000; ;AN000;
2001; DESCRIPTION: Go through the list of printer colors in the SHARED DATA ;AN000;
2002; AREA, for each of these colors, compare its RGB values with those in ;AN000;
2003; input. ;AN000;
2004; Get the BAND_MASK of the closest printer color. ;AN000;
2005; ;AN000;
2006; LOGIC: ;AN000;
2007; ;AN000;
2008; Locate the printer colors info structure in the shared data area: ;AN000;
2009; COLORPRINT_PTR := BP + COLORPRINT_PTR ;AN000;
2010; ;AN000;
2011; Get the number of printer colors from the COLORPRINT info in the Shared ;AN000;
2012; data area: ;AN000;
2013; Number of colors := COLORPRINT_PTR.NUM_PRT_COLOR ;AN000;
2014; ;AN000;
2015; CURRENT_COLOR_PTR : First record in the COLORPRINT info structure ;AN000;
2016; BEST_CHOICE := CURRENT_RECORD_PTR.BAND_MASK ;AN000;
2017; MIN_DIFF := Maximum positive value ;AN000;
2018; ;AN000;
2019; FOR each printer color: ;AN000;
2020; CUR_DIFF := 0 ;AN000;
2021; (* Calculate the geometric distance between the RGB values from the *) ;AN000;
2022; (* input and those of the printer color. *) ;AN000;
2023; Red difference := (R - CURRENT_COLOR_PTR.RED) ;AN000;
2024; Red difference := Red difference * Red difference ;AN000;
2025; CUR_DIFF := CUR_DIFF + Red difference ;AN000;
2026; ;AN000;
2027; Green difference := (G - CURRENT_COLOR_PTR.GREEN) ;AN000;
2028; Green difference := Green difference * Green difference ;AN000;
2029; CUR_DIFF := CUR_DIFF + Green difference ;AN000;
2030; ;AN000;
2031; Blue difference := (B - CURRENT_COLOR_PTR.BLUE) ;AN000;
2032; Blue difference := Blue difference * Blue difference ;AN000;
2033; CUR_DIFF := CUR_DIFF + Blue difference ;AN000;
2034; ;AN000;
2035; IF CUR_DIFF < MIN_DIFF ;AN000;
2036; THEN BEGIN ;AN000;
2037; MIN_DIFF := CUR_DIFF ;AN000;
2038; BEST_CHOICE := printer color.BAND_MASK ;AN000;
2039; END ;AN000;
2040; ;AN000;
2041; CURRENT_COLOR_PTR := Offset of next color ;AN000;
2042; END (For each printer color) ;AN000;
2043; ;AN000;
2044; Return BEST_CHOICE ;AN000;
2045; ;AN000;
2046; ;AN000;
2047RGB2BAND PROC NEAR ;AN000;
2048 PUSH AX ;AN000;
2049 PUSH BX ;AN000;
2050 PUSH CX ;AN000;
2051 PUSH DX ;AN000;
2052 ;AN000;
2053;-------Process /R (Reverse black and white) ;AN000;
2054.IF <BIT DS:[BP].SWITCHES Z REVERSE_SW> ; IF reverse is OFF ;AN000;
2055.THEN ; THEN REVERSE BLACK AND WHITE: ;AN000;
2056;------------------------------------------------------------------------------ ;AN000;
2057; ;AN000;
2058; REVERSE BLACK AND WHITE: ;AN000;
2059; ;AN000;
2060;------------------------------------------------------------------------------ ;AN000;
2061;-------Test if the color is BLACK ;AN000;
2062 .IF <RGB.R EQ BLACK_INT> AND ; If black ;AN000;
2063 .IF <RGB.G EQ BLACK_INT> AND ; ;AN000;
2064 .IF <RGB.B EQ BLACK_INT> ; ;AN000;
2065 .THEN ; then, replace it with the ;AN000;
2066 MOV BEST_CHOICE,0 ; band mask for white ;AN000;
2067 JMP RGB2BAND_END ; return this band mask ;AN000;
2068 .ELSEIF <RGB.R EQ WHITE_INT> AND ; else if, high-intensity white ;AN000;
2069 .IF <RGB.G EQ WHITE_INT> AND ; ;AN000;
2070 .IF <RGB.B EQ WHITE_INT> ; ;AN000;
2071 .THEN ; then, replace it with the ;AN000;
2072 MOV RGB.R,BLACK_INT ; RGB values of black ;AN000;
2073 MOV RGB.G,BLACK_INT ;AN000;
2074 MOV RGB.B,BLACK_INT ;AN000;
2075 .ELSEIF <RGB.R EQ TWO_THIRD> AND ; else if, white ;AN000;
2076 .IF <RGB.G EQ TWO_THIRD> AND ; ;AN000;
2077 .IF <RGB.B EQ TWO_THIRD> ; ;AN000;
2078 .THEN ; then, replace it with the ;AN000;
2079 MOV RGB.R,BLACK_INT ; RGB values of black ;AN000;
2080 MOV RGB.G,BLACK_INT ;AN000;
2081 MOV RGB.B,BLACK_INT ;AN000;
2082 .ENDIF ;AN000;
2083.ENDIF ;AN000;
2084;------------------------------------------------------------------------------ ;AN000;
2085; ;AN000;
2086; CALCULATE THE GEOMETRIC DISTANCE BETWEEN THE COLORS OF THE PIXEL AND THOSE OF ;AN000;
2087; THE PRINTER: ;AN000;
2088; ;AN000;
2089;------------------------------------------------------------------------------ ;AN000;
2090 MOV BX,DS:[BP].COLORPRINT_PTR ; BX := OFFSET of COLORPRINT ;AN000;
2091 ADD BX,BP ;AN000;
2092 MOV MIN_DIFF,7FFFh ; No match yet, minimum diff. ;AN000;
2093 ; is maximum POSITIVE value. ;AN000;
2094 XOR CX,CX ;AN000;
2095 MOV CL,DS:[BP].NUM_PRT_COLOR ; CX := Number of print colors ;AN000;
2096 ;AN000;
2097 ;AN000;
2098INSPECT_1_PRINT_COLOR: ;AN000;
2099 MOV CUR_DIFF,0 ; Current difference := 0 ;AN000;
2100;------------------------------------------------------------------------------ ;AN000;
2101; Calculate the Red difference: ;AN000;
2102;------------------------------------------------------------------------------ ;AN000;
2103 MOV AL,RGB.R ;AN000;
2104 SUB AL,[BX].RED ;AN000;
2105;-------Elevate at the power of two ;AN000;
2106 MOV DL,AL ; DX := Red difference ;AN000;
2107 IMUL DL ; AX := Red diff. square ;AN000;
2108 ADD CUR_DIFF,AX ; CURR_DIF + Red diff. ;AN000;
2109 ;AN000;
2110;------------------------------------------------------------------------------ ;AN000;
2111; Calculate the Green difference: ;AN000;
2112;------------------------------------------------------------------------------ ;AN000;
2113 MOV AL,RGB.G ;AN000;
2114 SUB AL,[BX].GREEN ;AN000;
2115;-------Elevate at the power of two ;AN000;
2116 MOV DL,AL ; DX := Red difference ;AN000;
2117 IMUL DL ; AX := Red diff. square ;AN000;
2118 ADD CUR_DIFF,AX ; CURR_DIF + Green diff. ;AN000;
2119 ;AN000;
2120;------------------------------------------------------------------------------ ;AN000;
2121; Calculate the Blue difference: ;AN000;
2122;------------------------------------------------------------------------------ ;AN000;
2123 MOV AL,RGB.B ;AN000;
2124 SUB AL,[BX].BLUE ;AN000;
2125;-------Elevate at the power of two ;AN000;
2126 MOV DL,AL ; DX := Red difference ;AN000;
2127 IMUL DL ; AX := Red diff. square ;AN000;
2128 ADD CUR_DIFF,AX ; CURR_DIF + Blue diff. ;AN000;
2129 ;AN000;
2130;------------------------------------------------------------------------------ ;AN000;
2131; Check how close is this print color to the screen color: ;AN000;
2132;------------------------------------------------------------------------------ ;AN000;
2133 MOV AX,CUR_DIFF ; If this color is better than what we ;AN000;
2134 .IF <AX L MIN_DIFF> ; had before. ;AN000;
2135 .THEN ; ;AN000;
2136 MOV MIN_DIFF,AX ; then, new minimum distance; ;AN000;
2137 MOV AL,[BX].SELECT_MASK ; get its band mask. ;AN000;
2138 MOV BEST_CHOICE,AL ; ;AN000;
2139 .ENDIF ; ;AN000;
2140 ;AN000;
2141;------------------------------------------------------------------------------ ;AN000;
2142; Get offset of next COLORPRINT info record: ;AN000;
2143;------------------------------------------------------------------------------ ;AN000;
2144 ADD BX,SIZE COLORPRINT_STR ;AN000;
2145 LOOP INSPECT_1_PRINT_COLOR ;AN000;
2146 ;AN000;
2147;------------------------------------------------------------------------------ ;AN000;
2148; BEST_CHOICE contains the print color with the closest RGB values ;AN000;
2149;------------------------------------------------------------------------------ ;AN000;
2150RGB2BAND_END: ;AN000;
2151 POP DX ;AN000;
2152 POP CX ;AN000;
2153 POP BX ;AN000;
2154 POP AX ;AN000;
2155 MOV AL,BEST_CHOICE ;AN000;
2156 RET ;AN000;
2157BEST_CHOICE DB ? ;AN000;
2158MIN_DIFF DW ? ;AN000;
2159CUR_DIFF DW ? ;AN000;
2160RGB2BAND ENDP ;AN000;
2161CODE ENDS ;AN000;
2162 END ;AN000;
diff --git a/v4.0/src/CMD/GRAPHICS/GRCTRL.EXT b/v4.0/src/CMD/GRAPHICS/GRCTRL.EXT
new file mode 100644
index 0000000..2d756fd
--- /dev/null
+++ b/v4.0/src/CMD/GRAPHICS/GRCTRL.EXT
@@ -0,0 +1,47 @@
1PAGE ,132
2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
3;; DOS - GRAPHICS Command
4;; (C) Copyright 1988 Microsoft
5;; ;AN000;
6;; File Name: GRCTRL.EXT ;AN000;
7;; ---------- ;AN000;
8;; ;AN000;
9;; Description: ;AN000;
10;; ------------ ;AN000;
11;; Include file containing external declarations for ;AN000;
12;; the code and data defined in GRCTRL.ASM ;AN000;
13;; ;AN000;
14;; Change History: ;AN000;
15;; --------------- ;AN000;
16;; ;AN000;
17;; ;AN000;
18;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
19 ;; ;AN000;
20;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
21EXTRN DET_HW_CONFIG:NEAR ;AN000;
22EXTRN RGB:BYTE ;AN000;
23EXTRN BIOS_INT_5H:WORD ;AN000;
24EXTRN PRT_SCR:NEAR ;AN000;
25EXTRN PRINT_SCREEN_ALLOWED:BYTE ;AN000;
26EXTRN XLT_TAB:BYTE ;AN000;
27EXTRN MODE_TYPE:BYTE ;AN000;
28EXTRN CUR_MODE_PTR:WORD ;AN000;
29EXTRN CUR_MODE:BYTE ;AN000;
30EXTRN MODE_TYPE:BYTE ;AN000;
31EXTRN NB_COLORS:WORD ;AN000;
32EXTRN SCREEN_HEIGHT:WORD ;AN000;
33EXTRN SCREEN_WIDTH:WORD ;AN000;
34EXTRN NB_CHAR_COLUMNS:BYTE ;AN000;
35EXTRN CUR_PAGE:BYTE ;AN000;
36EXTRN CUR_COLUMN:WORD ;AN000;
37EXTRN CUR_ROW:WORD ;AN000;
38EXTRN NB_SCAN_LINES:WORD ;AN000;
39EXTRN SCAN_LINE_MAX_LENGTH:WORD ;AN000;
40EXTRN CUR_SCAN_LNE_LENGTH:WORD ;AN000;
41EXTRN PRT_BUF:BYTE ;AN000;
42EXTRN NB_BOXES_PER_PRT_BUF:BYTE ;AN000;
43EXTRN CUR_BOX:BYTE ;AN000;
44EXTRN BOX_H:BYTE ;AN000;
45EXTRN BOX_W:BYTE ;AN000;
46EXTRN ERROR_CODE:BYTE ;AN000;
47EXTRN ROTATE_SW:BYTE ;AN000;
diff --git a/v4.0/src/CMD/GRAPHICS/GRCTRL.STR b/v4.0/src/CMD/GRAPHICS/GRCTRL.STR
new file mode 100644
index 0000000..fb913df
--- /dev/null
+++ b/v4.0/src/CMD/GRAPHICS/GRCTRL.STR
@@ -0,0 +1,111 @@
1.XLIST ;AN000;
2PAGE ,132 ;AN000;
3;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
4;; DOS - GRAPHICS Command
5;; (C) Copyright 1988 Microsoft
6;; ;AN000;
7;; File Name: GRCTRL.STR ;AN000;
8;; ---------- ;AN000;
9;; ;AN000;
10;; Description: ;AN000;
11;; ------------ ;AN000;
12;; Include file containing structures and equates for ;AN000;
13;; the Print Screen process. ;AN000;
14;; ;AN000;
15;; Change History: ;AN000;
16;; --------------- ;AN000;
17;; ;AN000;
18;; ;AN000;
19;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
20 ;; ;AN000;
21;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
22.LIST ;AN000;
23;-------------------------------------------------------------------------------;AN000;
24; ;AN000;
25; PRINT SCREEN INTERNAL ERROR CODES ;AN000;
26; ;AN000;
27;-------------------------------------------------------------------------------;AN000;
28NO_ERROR EQU 0 ;AN000;
29UNABLE_TO_PRINT EQU 1 ; The procedure was unable to print the ;AN000;
30 ; screen ;AN000;
31DISPLAYMODE_INFO_NOT_FOUND EQU 2 ; There was no DISPLAYMODE info record ;AN000;
32 ; in the Shared Area for the current mode ;AN000;
33MODE_NOT_SUPPORTED EQU 4 ; This mode is not supported by this version ;AN000;
34 ; of GRAHICS. ;AN000;
35PRINTER_ERROR EQU 8 ; An error occurred while printing a byte ;AN000;
36 ; (i.e., Out of paper, etc) ;AN000;
37;-------------------------------------------------------------------------------;AN000;
38; ;AN000;
39; PIXEL INTERNAL REPRESENTATION ;AN000;
40; ;AN000;
41;-------------------------------------------------------------------------------;AN000;
42PIXEL_STR STRUC ;AN000;
43 R DB ? ; RED component (0 to MAX_INT) ;AN000;
44 G DB ? ; GREEN component (0 to MAX_INT) ;AN000;
45 B DB ? ; BLUE component (0 to MAX_INT) ;AN000;
46PIXEL_STR ENDS ;AN000;
47;-------------------------------------------------------------------------------;AN000;
48; ;AN000;
49; VIDEO MODE TYPES ;AN000;
50; ;AN000;
51;-------------------------------------------------------------------------------;AN000;
52TXT EQU 0 ; Text ;AN000;
53APA EQU 1 ; All Points Addressable ;AN000;
54 ;AN000;
55;-------------------------------------------------------------------------------;AN000;
56; ;AN000;
57; BIOS INTERRUPT 10H CALL EQUATES ;AN000;
58; Note: Either AX or AH must be initialized, depending if the call is ;AN000;
59; a sub-call or not. ;AN000;
60; ;AN000;
61;-------------------------------------------------------------------------------;AN000;
62READ_DOT_CALL EQU 0DH ; Read dot ;AN000;
63SET_CURSOR_CALL EQU 02H ; Set cursor on the screen ;AN000;
64READ_CURSOR_CALL EQU 03H ; Read position of the cursor on the screen ;AN000;
65READ_CHAR_CALL EQU 08H ; Read attribute/character ;AN000;
66GET_STATE_CALL EQU 0FH ; Return current video state ;AN000;
67GET_P_REG_CALL EQU 1007H ; Read a palette register (EGA, VGA) ;AN000;
68GET_C_REG_CALL EQU 1015H ; Read a color register (VGA) ;AN000;
69READ_CONFIG_CALL EQU 1A00H ; Read display adapter configuration (PS/2) ;AN000;
70PAGE_STATE_CALL EQU 101AH ; Read color page state call (PS/2) ;AN000;
71ALT_SELECT_CALL EQU 12H ; Alternate select call (AH = 12h) ;AN000;
72EGA_INFO_CALL EQU 10H ; Return EGA information (AH=12H,BH = 10H) ;AN000;
73DISP_DESC_CALL EQU 15H ; PC CONVERTIBLE display description call ;AN000;
74 ;AN000;
75;-------------------------------------------------------------------------------;AN000;
76; ;AN000;
77; BIOS DATA AREA EQUATES ;AN000;
78; ;AN000;
79;-------------------------------------------------------------------------------;AN000;
80BIOS_SEG EQU 40H ; BIOS segment ;AN000;
81NB_ROWS_OFFSET EQU 84H ; Number of rows displayed when in a text mode ;AN000;
82 ;AN000;
83;-------------------------------------------------------------------------------;AN000;
84; ;AN000;
85; CONSTANT DEFINITIONS ;AN000;
86; ;AN000;
87;-------------------------------------------------------------------------------;AN000;
88NO EQU 0 ;AN000;
89YES EQU 1 ;AN000;
90OFF EQU 0 ;AN000;
91ON EQU 1 ;AN000;
92 ;AN000;
93;-------------------------------------------------------------------------------;AN000;
94; ;AN000;
95; TRANSLATION TABLE DEFINITIONS ;AN000;
96; ;AN000;
97;-------------------------------------------------------------------------------;AN000;
98WHITE_INT EQU 63 ; Intensity for WHITE on the printer ;AN000;
99BLACK_INT EQU 0 ; Intensity for BLACK on the printer ;AN000;
100MAX_INT EQU WHITE_INT ; Maximum intensity for a RGB value, ;AN000;
101 ; (Red, Green, or Blue). ;AN000;
102ONE_THIRD EQU MAX_INT*1/3 ; Used to calculate Red, Green, Blue intensity ;AN000;
103TWO_THIRD EQU MAX_INT*2/3 ; values. ;AN000;
104 ;AN000;
105;-------------------------------------------------------------------------------;AN000;
106; ;AN000;
107; PRINTER CONTROL ASCII CODES ;AN000;
108; ;AN000;
109;-------------------------------------------------------------------------------;AN000;
110CR EQU 0DH ; Carriage return ;AN000;
111LF EQU 0AH ; Line feed ;AN000;
diff --git a/v4.0/src/CMD/GRAPHICS/GRINST.ASM b/v4.0/src/CMD/GRAPHICS/GRINST.ASM
new file mode 100644
index 0000000..cdb8b17
--- /dev/null
+++ b/v4.0/src/CMD/GRAPHICS/GRINST.ASM
@@ -0,0 +1,973 @@
1 PAGE ,132 ;AN000;
2 TITLE DOS - GRAPHICS Command - Installation Modules ;AN000;
3;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
4;; DOS - GRAPHICS Command
5;; (C) Copyright 1988 Microsoft
6;; ;AN000;
7;; File Name: GRINST.ASM ;AN000;
8;; ---------- ;AN000;
9;; ;AN000;
10;; Description: ;AN000;
11;; ------------ ;AN000;
12;; This file contains the installation modules for the ;AN000;
13;; GRAPHICS command. ;AN000;
14;; ;AN000;
15;; GRAPHICS_INSTALL is the main module. ;AN000;
16;; ;AN000;
17;; GRAPHICS_INSTALL calls modules in GRLOAD.ASM to load ;AN000;
18;; the GRAPHICS profile and GRPARMS.ASM to parse the command line. ;AN000;
19;; ;AN000;
20;; ;AN000;
21;; Documentation Reference: ;AN000;
22;; ------------------------ ;AN000;
23;; OASIS High Level Design ;AN000;
24;; OASIS GRAPHICS I1 Overview ;AN000;
25;; DOS 3.3 Message Retriever Interface Supplement. ;AN000;
26;; TUPPER I0 Document - PARSER HIGH LEVEL DESIGN REVIEW ;AN000;
27;; ;AN000;
28;; Procedures Contained in This File: ;AN000;
29;; ---------------------------------- ;AN000;
30;; GRAPHICS_INSTALL - Main installation module ;AN000;
31;; CHAIN_INTERRUPTS - Chain interrupts 5, 2F, EGA Save Pointers ;AN000;
32;; COPY_PRINT_MODULES - Throw away one set of print modules ;AN000;
33;; ;AN000;
34;; ;AN000;
35;; Include Files Required: ;AN000;
36;; ----------------------- ;AN000;
37;; GRLOAD.EXT - Externals for profile load ;AN000;
38;; GRLOAD2.EXT - Externals for profile load ;AN000;
39;; GRCTRL.EXT - Externals for print screen control ;AN000;
40;; GRPRINT.EXT - Externals for print modules ;AN000;
41;; GRCPSD.EXT - Externals for COPY_SHARED_DATA module ;AN000;
42;; GRPARMS.EXT - External for GRAPHICS command line parsing ;AN000;
43;; GRPARSE.EXT - External for DOS parser ;AN000;
44;; GRBWPRT.EXT - Externals for Black and white printing modules ;AN000;
45;; GRCOLPRT.EXT - Externals for color printing modules ;AN000;
46;; GRINT2FH.EXT - Externals for Interrupt 2Fh driver. ;AN000;
47;; ;AN000;
48;; GRMSG.EQU - Equates for the GRAPHICS error messages ;AN000;
49;; SYSMSG.INC - DOS message retriever ;AN000;
50;; ;AN000;
51;; GRSHAR.STR - Shared Data Area Structure ;AN000;
52;; ;AN000;
53;; STRUC.INC - Macros for using structured assembly language ;AN000;
54;; ;AN000;
55;; External Procedure References: ;AN000;
56;; ------------------------------ ;AN000;
57;; FROM FILE GRLOAD.ASM: ;AN000;
58;; LOAD_PROFILE - Main module for profile loading ;AN000;
59;; SYSPARSE - DOS system parser ;AN000;
60;; SYSDISPMSG - DOS message retriever ;AN000;
61;; ;AN000;
62;; Linkage Instructions: ;AN000;
63;; -------------------- ;AN000;
64;; Refer to GRAPHICS.ASM ;AN000;
65;; ;AN000;
66;; Change History: ;AN000;
67;; --------------- ;AN000;
68;; ;AN000;
69;; ;AN000;
70;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
71 ;; ;AN000;
72CODE SEGMENT PUBLIC 'CODE' ;; ;AN000;
73 ASSUME CS:CODE,DS:CODE ;; ;AN000;
74 ;; ;AN000;
75.XLIST ;; ;AN000;
76 INCLUDE GRSHAR.STR ;; Include the Shared data area structure;AN000;
77 INCLUDE SYSMSG.INC ;; Include DOS message retriever ;AN000;
78 INCLUDE STRUC.INC ;; Include macros - Structured Assembler ;AN000;
79 INCLUDE GRLOAD.EXT ;; Bring in external declarations ;AN000;
80 INCLUDE GRLOAD2.EXT ;; ;AN000;
81 INCLUDE GRLOAD3.EXT ;; ;AN000;
82 INCLUDE GRCTRL.EXT ;; ;AN000;
83 INCLUDE GRBWPRT.EXT ;; ;AN000;
84 INCLUDE GRCOLPRT.EXT ;; ;AN000;
85 INCLUDE GRCPSD.EXT ;; ;AN000;
86 INCLUDE GRINT2FH.EXT ;; ;AN000;
87 INCLUDE GRCTRL.EXT ;; ;AN000;
88 INCLUDE GRPARSE.EXT ;; ;AN000;
89 INCLUDE GRPARMS.EXT ;; ;AN000;
90 INCLUDE GRMSG.EQU ;; ;AN000;
91 ;; ;AN000;
92MSG_UTILNAME <GRAPHICS> ;; Identify ourself to Message retriever.;AN000;
93 ;; Include messages ;AN000;
94MSG_SERVICES <MSGDATA> ;; ;AN000;
95MSG_SERVICES <LOADmsg,DISPLAYmsg,CHARmsg,NUMmsg> ;; ;AN000;
96MSG_SERVICES <GRAPHICS.CL1,GRAPHICS.CL2,GRAPHICS.CLA,GRAPHICS.CLB,GRAPHICS.CLC> ;AN000;
97.LIST ;; ;AN000;
98 ;; ;AN000;
99PUBLIC GRAPHICS_INSTALL ;; ;AN000;
100PUBLIC TEMP_SHARED_DATA_PTR ;; ;AN000;
101PUBLIC PRINTER_TYPE_PARM ;; ;AN000;
102PUBLIC PRINTER_TYPE_LENGTH ;; ;AN000;
103PUBLIC PROFILE_PATH ;; ;AN000;
104PUBLIC PRINTBOX_ID_PTR ;; ;AN000;
105PUBLIC PRINTBOX_ID_LENGTH ;; ;AN000;
106PUBLIC DEFAULT_BOX ;; ;AN000;
107PUBLIC LCD_BOX ;; ;AN000;
108PUBLIC NB_FREE_BYTES ;; ;AN000;
109PUBLIC SYSDISPMSG ;; ;AN000;
110PUBLIC DISP_ERROR ;; ;AN000;
111PUBLIC INSTALLED ;; ;AN000;
112PUBLIC ERROR_DEVICE ;; ;AN000;
113PUBLIC STDERR ;; ;AN000;
114PUBLIC STDOUT ;; ;AN000;
115PUBLIC RESIDENT_SHARED_DATA_SIZE ;; ;AN000;
116 ;; ;AN000;
117;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
118;; ;AN000;
119;; Install Variables ;AN000;
120;; ;AN000;
121;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
122 ;; ;AN000;
123NO EQU 0 ;; ;AN000;
124YES EQU 1 ;; ;AN000;
125INSTALLED DB NO ;; YES if GRAPHICS already installed ;AN000;
126 ;; ;AN000;
127 ;; ;AN000;
128BYTES_AVAIL_PSP_OFF EQU 6 ;; Word number 6 of the PSP is the ;AN000;
129 ;; number of bytes available in the ;AN000;
130 ;; current segment ;AN000;
131 ;; ;AN000;
132;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
133;; ;AN000;
134;; GRLOAD (PROFILE LOADING) INPUT PARMS: ;AN000;
135;; ;AN000;
136;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
137PRINTER_TYPE_PARM DB "GRAPHICS",9 DUP(0) ; Printer type ;AN000;
138 ;; (default=GRAPHICS) ;AN000;
139PRINTER_TYPE_LENGTH DB 17 ;; Printer type maximum length of ASCIIZ ;AN000;
140PROFILE_PATH DB 128 DUP(0) ;; Profile name with full path ;AN000;
141 ;; (Max size for ASCIIZ is 128) ;AN000;
142PRINTBOX_ID_PTR DW DEFAULT_BOX ;; Offset of ASCIIZ string containing ;AN000;
143DEFAULT_BOX DB "STD",14 DUP(0); the printbox id. (DEFAULT = STD) ;AN000;
144LCD_BOX DB "LCD",14 DUP(0); ASCIIZ string for the LCD printboxID;AN000;
145PRINTBOX_ID_LENGTH DB 17 ;; Max. length for the printbox id. ;AN000;
146 ;; ASCIIZ string ;AN000;
147NB_FREE_BYTES DW ? ;; Number of bytes available in our ;AN000;
148 ;; resident segment ;AN000;
149RESIDENT_SHARED_DATA_SIZE DW ? ;; Size in bytes of the RESIDENT Shared ;AN000;
150 ;; data area (if GRAPHICS already ;AN000;
151 ;; installed). ;AN000;
152END_OF_RESIDENT_CODE DW ? ;; Offset of the end of the code that ;AN000;
153 ;; has to be made resident. ;AN000;
154TEMP_SHARED_DATA_PTR DW ? ;; Offset of the temporary Shared area ;AN000;
155 ;; ;AN000;
156ERROR_DEVICE DW STDERR ;; Device DISP_ERROR will output ;AN000;
157 ;; messages to (STDERR or STDOUT) ;AN000;
158PAGE ;AN000;
159;===============================================================================;AN000;
160; ;AN000;
161; GRAPHICS_INSTALL : INSTALL GRAPHICS.COM ;AN000;
162; ;AN000;
163;-------------------------------------------------------------------------------;AN000;
164; ;AN000;
165; INPUT: Command line parameters ;AN000;
166; GRAPHICS profile - A file describing printer characteristics and ;AN000;
167; attributes. ;AN000;
168; ;AN000;
169; OUTPUT: If first time invoked: ;AN000;
170; INT 5 VECTOR and INT 2FH VECTOR are replaced; only the required ;AN000;
171; code for printing the screen is made resident. ;AN000;
172; else, ;AN000;
173; The resident code is updated to reflect changes in printing ;AN000;
174; options. ;AN000;
175; ;AN000;
176;-------------------------------------------------------------------------------;AN000;
177;; ;AN000;
178;; DESCRIPTION: ;AN000;
179;; ;AN000;
180;; This module intalls GRAPHICS code and data. ;AN000;
181;; ;AN000;
182;; An INT 2FH driver is also installed. ;AN000;
183;; ;AN000;
184;; If this driver is already present then, we assume GRAPHICS was installed ;AN000;
185;; and do not install it again but, simply update the resident code. ;AN000;
186;; ;AN000;
187;; The resident code contains ONLY the code and data needed for Printing ;AN000;
188;; the screen. The code needed is determined according to the command line ;AN000;
189;; parameters and the information extracted from the printer profile. ;AN000;
190;; ;AN000;
191;; The printer profile is parsed according to the current hardware setting ;AN000;
192;; and also to the command line options. The information extracted from ;AN000;
193;; the profile is stored in a Data area shared between the installation ;AN000;
194;; process and the Print Screen process. ;AN000;
195;; ;AN000;
196;; A temporary Shared Data Area is FIRST built at the end of the .COM file ;AN000;
197;; Before building it, we verify that there is ;AN000;
198;; enough memory left in the current segment. If not, the installation ;AN000;
199;; process is aborted. ;AN000;
200;; ;AN000;
201;; This temporary Data area when completed will be copied over the ;AN000;
202;; installation code. Therefore, the file comprising GRAPHICS must be ;AN000;
203;; linked in a specific order with the installation modules being last. ;AN000;
204;; ;AN000;
205;; These modules will be overwritten by the Shared Data area and the EGA ;AN000;
206;; dynamic save area before we exit and stay resident. ;AN000;
207;; ;AN000;
208;; The end of the resident code is the end of the Shared Data area, anything ;AN000;
209;; else beyond that is not made resident. ;AN000;
210;; ;AN000;
211;; The pointer to the resident Shared Data area is declared within the ;AN000;
212;; Interrupt 2Fh driver. This pointer is initialized by the installation ;AN000;
213;; process and points to the shared data area at Print Screen time. ;AN000;
214;; ;AN000;
215;; Depending on the type of printer attached (i.e., Black and white or Color) ;AN000;
216;; only one set of modules is made resident during the installation. ;AN000;
217;; ;AN000;
218;; The set of print modules required is copied over the previous one at ;AN000;
219;; location "PRINT_MODULE_START". This location is declared within ;AN000;
220;; GRCOLPRT which must be linked before GRBWPRT ;AN000;
221;; ;AN000;
222;; When copying one of the 2 sets of print modules we reserve enough space ;AN000;
223;; for the larger of them. Therefore, if GRAPHICS is already installed but ;AN000;
224;; is reinvoked with a different printer type which needs a bigger set of ;AN000;
225;; modules: this new set of modules is simply recopied over the existing ;AN000;
226;; one in the resident code. ;AN000;
227;; ;AN000;
228;; The Shared Data area is copied rigth after the set of modules that we keep ;AN000;
229;; that is, over the unused set of modules. ;AN000;
230;; ;AN000;
231;; ;AN000;
232;-------------------------------------------------------------------------------;AN000;
233;; ;AN000;
234;; Register Conventions: ;AN000;
235;; BP - points to start of Temp Shared Data (Transiant code) ;AN000;
236;; ;AN000;
237;; Called By: ;AN000;
238;; Entry point for GRAPHICS command processing. ;AN000;
239;; ;AN000;
240;; External Calls: ;AN000;
241;; INT 2FH, LOAD_MESSAGES, LOAD_PROFILE, PARSE_PARMS ;AN000;
242;; CHAIN_INTERRUPTS, COPY_SHARED_DATA, DISPLAY_MESSAGE ;AN000;
243;; COPY_PRINT_MODULES ;AN000;
244;; ;AN000;
245;-------------------------------------------------------------------------------;AN000;
246;; ;AN000;
247;; LOGIC: ;AN000;
248;; Load the message retriever ;AN000;
249;; IF carry flag is set (incorrect DOS version) THEN ;AN000;
250;; Issue message (COMMON1) ;AN000;
251;; Exit ;AN000;
252;; ENDIF ;AN000;
253;; ;AN000;
254;; Get number of bytes available in the segment from PSP (word 6) ;AN000;
255;; /* This is needed since we construct a temporary Shared data area at the ;AN000;
256;; of the .COM file */ ;AN000;
257;; ;AN000;
258;; /* Build Shared Data in temporary area */ ;AN000;
259;; END_OF_RESIDENT_CODE := (end of .COM file) ;AN000;
260;; NB_FREE_BYTES := Number of bytes availables ;AN000;
261;; ;AN000;
262;; CALL PARSE_PARMS ;AN000;
263;; IF error THEN /* PARSE_PARMS will issue messages */ ;AN000;
264;; Exit ;AN000;
265;; ENDIF ;AN000;
266;; ;AN000;
267;; CALL LOAD_PROFILE ;AN000;
268;; IF profile errors THEN ;AN000;
269;; Exit /* LOAD_PROFILE will issue messages */ ;AN000;
270;; ENDIF ;AN000;
271;; ;AN000;
272;; Issue INT 2FH Install Check call (AX=1500H) ;AN000;
273;; /* INT 2FH returns ES:[DI] pointing to the shared data area */ ;AN000;
274;; IF already installed THEN ;AN000;
275;; THEN ;AN000;
276;; Move NO to PRINT_SCREEN_ALLOWED in resident Shared Data ;AN000;
277;; SHARED_DATA_AREA_PTR := DI ;AN000;
278;; ELSE ;AN000;
279;; MOV PRINT_SCREEN_ALLOWED,NO ;AN000;
280;; CALL CHAIN_INTERRUPTS /* Install INT 5 and INT 2FH vectors */ ;AN000;
281;; ES := Our segment ;AN000;
282;; ENDIF ;AN000;
283;; /* Keep only Print Black and White or Print Color: */ ;AN000;
284;; CALL COPY_PRINT_MODULES ;AN000;
285;; /* COPY_SHARED_DATA will terminate & stay resident */ ;AN000;
286;; Set up registers for copy & terminate call ;AN000;
287;; /* reserve enough memory to handle any printer in the profile*/ ;AN000;
288;; jump to COPY_SHARED_DATA module ;AN000;
289;; ELSE ;AN000;
290;; /* Shared Data has been built in place */ ;AN000;
291;; move YES to PRINT_SCREEN_ALLOWED ;AN000;
292;; Return to DOS ;AN000;
293;; ENDIF ;AN000;
294;; ;AN000;
295;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
296GRAPHICS_INSTALL PROC NEAR ; ;AN000;
297 ;AN000;
298;-------------------------------------------------------------------------------;AN000;
299; Load the error messages ;AN000;
300;-------------------------------------------------------------------------------;AN000;
301 CALL SYSLOADMSG ; Load messages ;AN000;
302 .IF C ; If error when loading messages ;AN000;
303 .THEN ; then, ;AN000;
304 MOV CX,0 ; CX := No substitution in message ;AN000;
305 MOV AX,1 ; AX := msg nb. for "Invalid DOS version" ;AN000;
306 CALL DISP_ERROR ; Display error message ;AN000;
307 JMP ERROR_EXIT ; and quit ;AN000;
308 .ENDIF ;AN000;
309 ;AN000;
310;-------------------------------------------------------------------------------;AN000;
311; Get offset of where to build the TEMPORARY Shared Data area (always built) ;AN000;
312;-------------------------------------------------------------------------------;AN000;
313 MOV BP,OFFSET LIMIT ; Build it at the end of this .COM file ;AN000;
314 ; (LIMIT = the offset of the last byte ;AN000;
315 ; of the last .OBJ file linked with ;AN000;
316 ; GRAPHICS) ;AN000;
317 MOV TEMP_SHARED_DATA_PTR,BP ; ;AN000;
318 ;AN000;
319;-------------------------------------------------------------------------------;AN000;
320; Determine if GRAPHICS is already installed; get the resident segment value ;AN000;
321;-------------------------------------------------------------------------------;AN000;
322 MOV AH,PRT_SCR_2FH_NUMBER ; Call INT 2FH (the Multiplex interrupt) ;AN000;
323 XOR AL,AL ; for Print Screen handler ;AN000;
324 INT 2FH ; ;AN000;
325 ;AN000;
326 .IF <AH EQ 0FFH> ; IF already installed ;AN000;
327 .THEN ; then, ;AN000;
328 ;----------------------------------------------------------------------------;AN000;
329 ; GRAPHICS is already installed: Get pointer to the EXISTING Shared Data area;AN000;
330 ;----------------------------------------------------------------------------;AN000;
331 MOV INSTALLED,YES ; Say it's installed ;AN000;
332 MOV AX,ES ; Get the segment and offset of the ;AN000;
333 MOV SHARED_DATA_AREA_PTR,DI; resident Shared Data area. ;AN000;
334 MOV RESIDENT_CODE_SEG,AX ; (returned in ES:DI) ;AN000;
335 ; Disable print screen because we will ;AN000;
336 MOV ES:PRINT_SCREEN_ALLOWED,NO ; be updating the resident code. ;AN000;
337 .ELSE ; ELSE, not installed: ;AN000;
338 ;------------------------------------------------------------------------ ;AN000;
339 ; GRAPHICS is NOT installed: RESIDENT shared data area is in OUR segment ;AN000;
340 ;------------------------------------------------------------------------ ;AN000;
341 PUSH CS ; The Shared Data area will be in our ;AN000;
342 POP RESIDENT_CODE_SEG ; segment. ;AN000;
343 .ENDIF ;AN000;
344 ;AN000;
345;-------------------------------------------------------------------------------;AN000;
346; Determine in AX how many bytes are available for building the TEMPORARY SHARED;AN000;
347; DATA AREA: ;AN000;
348;-------------------------------------------------------------------------------;AN000;
349 MOV AX,ES:BYTES_AVAIL_PSP_OFF;AX := Number of bytes availables in ;AN000;
350 ; the current segment (as indicated in PSP);AN000;
351 .IF <AX B <OFFSET LIMIT>> ; If there is no bytes available past ;AN000;
352 .THEN ; the end of our .COM file ;AN000;
353 XOR AX,AX ; then, AX := 0 bytes available ;AN000;
354 .ELSE ; ;AN000;
355 SUB AX,OFFSET LIMIT ; else, AX := Number of FREE bytes ;AN000;
356 .ENDIF ; in this segment ;AN000;
357 ;AN000;
358;---AX = Number of bytes in our segment available for building the Temp Shared ;AN000;
359;---data area. ;AN000;
360;---IF ALREADY INSTALLED: Get the size of the existing Shared data area. ;AN000;
361;---Since the temporary shared data area will be copied over the resident ;AN000;
362;---shared data area, we do not want to build it any bigger than the one ;AN000;
363;---it will overwrite. Therefore we do not give to LOAD_PROFILE more space ;AN000;
364;---than the size of the existing Shared data area. ;AN000;
365 .IF <INSTALLED EQ YES> ; If already installed then, ;AN000;
366 .THEN ;AN000;
367 PUSH CS:RESIDENT_CODE_SEG ; ES:[DI] := Resident Shared data area ;AN000;
368 POP ES ; ;AN000;
369 MOV DI,SHARED_DATA_AREA_PTR ; ;AN000;
370 MOV CX,ES:[DI].SD_TOTAL_SIZE ; CX := Size of the existing Shared area ;AN000;
371 MOV RESIDENT_SHARED_DATA_SIZE,CX ; Save size for LOAD_PROFILE ;AN000;
372 .IF <AX A CX> ; If AX > size of existing SDA ;AN000;
373 MOV AX,CX ; then, AX := Size of existing Shared area ;AN000;
374 .ENDIF ; ;AN000;
375 .ENDIF ;AN000;
376 ; NB_FREE_BYTES := Number of bytes ;AN000;
377 MOV NB_FREE_BYTES,AX ; available for ;AN000;
378 ; building the TEMPORARY shared area ;AN000;
379;-------------------------------------------------------------------------------;AN000;
380; Parse the command line parameters ;AN000;
381;-------------------------------------------------------------------------------;AN000;
382 MOV BYTE PTR CS:[BP].SWITCHES,0 ; Init. the command line switches ;AN000;
383 PUSH CS ; Set ES to segment containing the PSP ;AN000;
384 POP ES ;AN000;
385 CALL PARSE_PARMS ; Set switches in the Temp. Shared Area ;AN000;
386 .IF C ; If error when parsing the command ;AN000;
387 .THEN ; line then, EXIT ;AN000;
388 JMP ERROR_EXIT ;AN000;
389 .ENDIF ;AN000;
390 ;AN000;
391;-------------------------------------------------------------------------------;AN000;
392; Parse the printer profile - Build the temporary Shared data area ;AN000;
393;-------------------------------------------------------------------------------;AN000;
394 CALL LOAD_PROFILE ; Builds profile info in Temporary Shared ;AN000;
395 ; Data ;AN000;
396 .IF C ; If error when loading the profile ;AN000;
397 .THEN ; then, EXIT ;AN000;
398 JMP ERROR_EXIT ;AN000;
399 .ENDIF ;AN000;
400 ;AN000;
401;-------------------------------------------------------------------------------;AN000;
402; Check if /B was specified with a BLACK and WHITE printer:(invalid combination);AN000;
403;-------------------------------------------------------------------------------;AN000;
404 .IF <CS:[BP].PRINTER_TYPE EQ BLACK_WHITE> AND ;AN000;
405 .IF <BIT CS:[BP].SWITCHES NZ BACKGROUND_SW> ;AN000;
406 .THEN ;AN000;
407 MOV AX,INVALID_B_SWITCH ; Error := /B invalid with B&W prt. ;AN000;
408 MOV CX,0 ; No substitution ;AN000;
409 CALL DISP_ERROR ; Display error message ;AN000;
410 JMP ERROR_EXIT ; and quit ;AN000;
411 .ENDIF ;AN000;
412 ;AN000;
413;-------------------------------------------------------------------------------;AN000;
414; ;AN000;
415; RELOCATE THE TEMPORARY SHARED DATA AREA AND THE SET OF REQUIRED PRINT MODULES ;AN000;
416; ;AN000;
417; (Discard the set of print modules not needed with the printer attached and ;AN000;
418; discard all the code not used at print screen time). ;AN000;
419; ;AN000;
420; If GRAPHICS is already installed then, we copy the ;AN000;
421; Shared Data area and the print modules over the previous ones installed in ;AN000;
422; resident memory. ;AN000;
423; ;AN000;
424; If we are installed for the first time then, we copy those over the ;AN000;
425; installation modules before we exit and stay resident. ;AN000;
426; ;AN000;
427; A temporaty Shared Data area is always created even if a resident one ;AN000;
428; already exist (it is then, copied over), a set of print modules is recopied ;AN000;
429; only if needed. ;AN000;
430; ;AN000;
431; NOTE: END_OF_RESIDENT_CODE points to the first location over which code ;AN000;
432; may be relocated. After data or code is relocated, END_OF_RESIDENT_CODE;AN000;
433; is updated and points to the next available location for copying code ;AN000;
434; that will stay resident. ;AN000;
435;-------------------------------------------------------------------------------;AN000;
436;-------------------------------------------------------------------------------;AN000;
437; Initialize the pointer to the next available location for resident code: ;AN000;
438;-------------------------------------------------------------------------------;AN000;
439 .IF <INSTALLED EQ NO> ; If not installed ;AN000;
440 .THEN ; then, ;AN000;
441 MOV END_OF_RESIDENT_CODE,OFFSET PRINT_MODULE_START ;AN000;
442 .ENDIF ; we make everything up to the print ;AN000;
443 ; modules resident code. ;AN000;
444;-------------------------------------------------------------------------------;AN000;
445; Keep only the set of print modules that is needed: ;AN000;
446;-------------------------------------------------------------------------------;AN000;
447 CALL COPY_PRINT_MODULES ; Updates END_OF_RESIDENT_CODE ;AN000;
448;-------------------------------------------------------------------------------;AN000;
449; Replace the interrupt vectors and install the EGA dynamic area (if needed) ;AN000;
450;-------------------------------------------------------------------------------;AN000;
451 .IF <INSTALLED EQ NO> ; If not already installed ;AN000;
452 .THEN ; then, ;AN000;
453;------Release evironment vector ;AN002;
454 CALL RELEASE_ENVIRONMENT ; release unneeded environment vector ;AN002;
455;------Replace the interrupt vectors ;AN000;
456 MOV PRINT_SCREEN_ALLOWED,NO ; Disable Print Screen ;AN000;
457 CALL CHAIN_INTERRUPTS ; Replace the interrupt vectors ;AN000;
458 ; (END_OF_RESIDENT_CODE is updated) ;AN000;
459 CALL DET_HW_CONFIG ; Find what display adapter we got ;AN000;
460 .IF <CS:[BP].HARDWARE_CONFIG EQ EGA>;If EGA is present ;AN000;
461 .THEN ; then, ;AN000;
462 CALL INST_EGA_SAVE_AREA ; Install the EGA dynamic save area ;AN000;
463 .ENDIF ; (END_OF_RESIDENT_CODE is updated) ;AN000;
464;------Calculate the size of the resident code ;AN000;
465 MOV DX,END_OF_RESIDENT_CODE ; DX := End of resident code ;AN000;
466 ADD DX,CS:[BP].SD_TOTAL_SIZE; Add size of Shared Data area ;AN000;
467 MOV CL,4 ; ;AN000;
468 SHR DX,CL ; convert to paragraphs ;AN000;
469 INC DX ; and add 1 ;AN000;
470;------Set AX to DOS exit function call - (COPY_SHARED_DATA will exit to DOS) ;AN000;
471 MOV AH,31H ; Function call to terminate but stay ;AN000;
472 XOR AL,AL ; resident ;AN000;
473 .ELSE ;AN000;
474 MOV AH,4CH ; Function call to terminate ;AN000;
475 XOR AL,AL ; (EXIT to calling process) ;AN000;
476 .ENDIF ;AN000;
477 ;AN000;
478;-------------------------------------------------------------------------------;AN000;
479; Copy the temporary shared data area in the resident code ;AN000;
480;-------------------------------------------------------------------------------;AN000;
481 MOV CX,CS:[BP].SD_TOTAL_SIZE; CX := MOVSB count for COPY_SHARED_DATA ;AN000;
482 MOV SI,BP ; DS:SI := Temporary Shared data area ;AN000;
483 PUSH RESIDENT_CODE_SEG ; ES:DI := Resident Shared data area: ;AN000;
484 POP ES ; ;AN000;
485 .IF <INSTALLED EQ NO> ; If not installed ;AN000;
486 .THEN ; then, ;AN000;
487 MOV DI,END_OF_RESIDENT_CODE; DI := End of resident code ;AN000;
488 MOV BP,DI ; BP := New resident Shared data area ;AN000;
489 MOV SHARED_DATA_AREA_PTR,DI; Update pointer to resident Shar. area ;AN000;
490 .ELSE ; else, ;AN000;
491 MOV DI,SHARED_DATA_AREA_PTR ; DI := Existing Shared data area ;AN000;
492 MOV BP,DI ; BP = DI:= Existing Shared data area ;AN000;
493 .ENDIF ;AN000;
494 JMP COPY_SHARED_DATA ; Jump to proc that copies area in new ;AN000;
495 ; part of memory and exits to DOS ;AN000;
496ERROR_EXIT: ;AN000;
497 .IF <INSTALLED EQ YES> ; If we are already installed, re-enable ;AN000;
498 MOV ES,RESIDENT_CODE_SEG ; print screens ;AN000;
499 MOV ES:PRINT_SCREEN_ALLOWED,YES ;AN000;
500 .ENDIF ; ;AN000;
501 ; ;AN000;
502 MOV AH,4CH ; Function call to terminate ;AN000;
503 MOV AL,1 ; (EXIT to calling process) ;AN000;
504 INT 21H ;AN000;
505GRAPHICS_INSTALL ENDP ;AN000;
506 ;AN000;
507PAGE ;AN000;
508;===============================================================================;AN000;
509; ;AN000;
510; INST_EGA_SAVE_AREA : INSTALL A DYNAMIC SAVE AREA FOR THE EGA PALETTE REGISTERS;AN000;
511; ;AN000;
512;-------------------------------------------------------------------------------;AN000;
513; ;AN000;
514; INPUT: DS = Data segment for our code ;AN000;
515; END_OF_RESIDENT_CODE = Offset of the end of the resident code ;AN000;
516; ;AN000;
517; OUTPUT: END_OF_RESIDENT_CODE is updated to point to the end of the code ;AN000;
518; that will stay resident. ;AN000;
519; SAVE_AREA_PTR in BIOS segment is updated. ;AN000;
520; ;AN000;
521;-------------------------------------------------------------------------------;AN000;
522;; ;AN000;
523;; Data Structures Referenced: ;AN000;
524;; Shared Data Area ;AN000;
525;; ;AN000;
526;; Description: ;AN000;
527;; ************* The EGA Dynamic Save Area will be built over top ;AN000;
528;; ** NOTE ** of the profile loading modules (file GRLOAD.ASM) ;AN000;
529;; ************* to avoid having to relocate this area just before ;AN000;
530;; terminating. This is safe since the maximum memory used is ;AN000;
531;; 288 bytes and the profile loading modules are MUCH larger than ;AN000;
532;; this. So GRLOAD.ASM MUST be linked before GRINST.ASM and after ;AN000;
533;; GRPRINT.ASM. ;AN000;
534;; ;AN000;
535;; BIOS will update the dynamic save area whenener it's aware the palette ;AN000;
536;; registers have been updated. ;AN000;
537;; ;AN000;
538;; BIOS 4A8H BIOS SAVE EGA DYNAMIC ;AN000;
539;; POINTER: POINTER TABLE SAVE AREA ;AN000;
540;; Ŀ Ŀ (16 first bytes are the 16 ;AN000;
541;; *> EGA palette registers) ;AN000;
542;; Ĵ Ŀ ;AN000;
543;; *>Ĵ ;AN000;
544;; Ĵ Ĵ ;AN000;
545;; Ĵ ;AN000;
546;; Ĵ . ;AN000;
547;; . ;AN000;
548;; Ĵ . 256 bytes ;AN000;
549;; . ;AN000;
550;; Ĵ . ;AN000;
551;; Ĵ ;AN000;
552;; Ĵ Ĵ ;AN000;
553;; Ĵ ;AN000;
554;; Ĵ Ĵ ;AN000;
555;; Ĵ ;AN000;
556;; ;AN000;
557;; ;AN000;
558;; Called By: ;AN000;
559;; GRAPHICS_INSTALL ;AN000;
560;; ;AN000;
561;; External Calls: ;AN000;
562;; ;AN000;
563;; Logic: ;AN000;
564;; IF EGA Dynamic Save Area NOT established THEN ;AN000;
565;; /* Required since default table is in ROM */ ;AN000;
566;; IF Save Table is in ROM ;AN000;
567;; Replicate all the Save Area Table in resident RAM just before ;AN000;
568;; the Shared Data Area ;AN000;
569;; ENDIF ;AN000;
570;; Allocate 256 bytes for EGA Dynamic Save Area just before the ;AN000;
571;; Shared Data Area ;AN000;
572;; Update END_OF_RESIDENT_CODE ;AN000;
573;; ENDIF ;AN000;
574;; RETURN ;AN000;
575;; ;AN000;
576;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
577 ;; ;AN000;
578BIOS_SAVE_PTR EQU 4A8H ;; Offset of the BIOS Save Ptr area ;AN000;
579SAVE_AREA_LEN EQU 8*4 ;; There are 8 pointers in the Save area ;AN000;
580EGA_DYNAMIC_LEN EQU 256 ;; Length of the EGA dynamic save area ;AN000;
581; Standard default colours for the Enhanced Graphics Adapter: (rgbRGB values) ;AN000;
582; The following table is necessary in order to initialize the EGA DYNAMIC ;AN000;
583; SAVE AREA when creating it. ;AN000;
584EGA_DEFAULT_COLORS DB 00h ;; Black ;AN000;
585 DB 01h ;; Blue ;AN000;
586 DB 02h ;; Green ;AN000;
587 DB 03h ;; Cyan ;AN000;
588 DB 04h ;; Red ;AN000;
589 DB 05h ;; Magenta ;AN000;
590 DB 14h ;; Brown ;AN000;
591 DB 07h ;; White ;AN000;
592 DB 38h ;; Dark Grey ;AN000;
593 DB 39h ;; Light Blue ;AN000;
594 DB 3Ah ;; Light Green ;AN000;
595 DB 3Bh ;; Light Cyan ;AN000;
596 DB 3Ch ;; Light Red ;AN000;
597 DB 3Dh ;; Light Magenta ;AN000;
598 DB 3Eh ;; Yellow ;AN000;
599 DB 3Fh ;; Bright white ;AN000;
600 DB 00h ;; OVERSCAN register ;AN000;
601 ;AN000;
602INST_EGA_SAVE_AREA PROC NEAR ;AN000;
603PUSH AX ;AN000;
604PUSH CX ;AN000;
605PUSH DX ;AN000;
606PUSH SI ;AN000;
607PUSH DI ;AN000;
608PUSH ES ;AN000;
609;-------------------------------------------------------------------------------;AN000;
610; Get the BIOS save pointer table ;AN000;
611;-------------------------------------------------------------------------------;AN000;
612XOR AX,AX ; ES := segment 0 ;AN000;
613MOV ES,AX ;AN000;
614LES SI,ES:DWORD PTR BIOS_SAVE_PTR ; ES:[SI] =Current BIOS save table ;AN000;
615.IF <<WORD PTR ES:[SI]+4> EQ 0> AND ; IF the dynamic save are pointer is ;AN000;
616.IF <<WORD PTR ES:[SI]+6> EQ 0> ; null then, it's not defined ;AN000;
617.THEN ; and we have to define it: ;AN000;
618 ;---------------------------------------------------------------------------;AN000;
619 ; The Dynamic EGA save area is NOT DEFINED: ;AN000;
620 ;---------------------------------------------------------------------------;AN000;
621 MOV BYTE PTR ES:[SI]+4,0FFH ; Try to write a byte in the table ;AN000;
622 PUSH AX ; (PUSH AX, POP AX used to create a ;AN000;
623 POP AX ; small delay) ;AN000;
624 .IF <<WORD PTR ES:[SI]+4> NE 0FFH>;If we can't read our byte back then, ;AN000;
625 .THEN ; the Save Ptrs table is in ROM ;AN000;
626 ;------------------------------------------------------------------------;AN000;
627 ; The Save pointer table is in ROM; ;AN000;
628 ; Copy the BIOS save pointer table from ROM to within our .COM file ;AN000;
629 ;------------------------------------------------------------------------;AN000;
630 PUSH ES ; DS:SI := Offset of BIOS save ptrs table ;AN000;
631 POP DS ; ;AN000;
632 PUSH CS ; ES:DI := The next available location ;AN000;
633 POP ES ; for installing resident code ;AN000;
634 MOV DI,CS:END_OF_RESIDENT_CODE ; within our .COM file ;AN000;
635 MOV CS:OUR_SAVE_TAB_OFF,DI ; ;AN000;
636 MOV CX,SAVE_AREA_LEN ; CX := Length of the table to copy ;AN000;
637 REP MOVSB ; Replicate the Save Table ;AN000;
638 PUSH CS ;AN000;
639 POP DS ; Reestablish our data segment ;AN000;
640 ;------------------------------------------------------------------------;AN000;
641 ; Adjust END_OF_RESIDENT_CODE to the next offset available for copying ;AN000;
642 ; resident code and data. ;AN000;
643 ;------------------------------------------------------------------------;AN000;
644 ADD END_OF_RESIDENT_CODE,SAVE_AREA_LEN ;AN000;
645 ;------------------------------------------------------------------------;AN000;
646 ; Set the pointer in OUR Save ptr table to our EGA dynamic save area ;AN000;
647 ; which we create right after the Save pointer table. ;AN000;
648 ;------------------------------------------------------------------------;AN000;
649 MOV DI,OUR_SAVE_TAB_OFF ; DS:[DI] := Our BIOS save ptr tab ;AN000;
650 MOV AX,END_OF_RESIDENT_CODE; Store its offset ;AN000;
651 MOV DS:[DI]+4,AX ; ;AN000;
652 MOV WORD PTR DS:[DI]+6,DS ; Store its segment ;AN000;
653 ;------------------------------------------------------------------------;AN000;
654 ; Initialize our DYNAMIC SAVE AREA with the 16 standard EGA colors ;AN000;
655 ;------------------------------------------------------------------------;AN000;
656 ;AN000;
657 LEA SI,EGA_DEFAULT_COLORS ; DS:[SI] := EGA 16 Default colors ;AN000;
658 MOV DI,END_OF_RESIDENT_CODE ; ES:[DI] := DYNAMIC SAVE AREA ;AN000;
659 MOV CX,17 ; CX := Number of colors ;AN000;
660 REP MOVSB ; Initialize the Dynamic save area ;AN000;
661 ;------------------------------------------------------------------------;AN000;
662 ; Set the BIOS Save Pointer to our table of Save pointers: ;AN000;
663 ;------------------------------------------------------------------------;AN000;
664 CLI ;AN000;
665 XOR AX,AX ; ES:BIOS_SAVE_PTR := Our save table: ;AN000;
666 MOV ES,AX ;AN000;
667 MOV AX,OUR_SAVE_TAB_OFF ;AN000;
668 MOV ES:BIOS_SAVE_PTR,AX ;AN000;
669 MOV ES:BIOS_SAVE_PTR+2,DS ;AN000;
670 STI ;AN000;
671 .ELSE ; ELSE save pointer table is in RAM ;AN000;
672 ;------------------------------------------------------------------------;AN000;
673 ; ELSE, the BIOS save pointer table is in RAM: ;AN000;
674 ;------------------------------------------------------------------------;AN000;
675 ;------------------------------------------------------------------------;AN000;
676 ; Set the pointer in THEIR Save ptr table to OUR EGA dynamic save area ;AN000;
677 ;------------------------------------------------------------------------;AN000;
678 MOV WORD PTR ES:[SI]+6,DS ; ES:[SI] = The existing table in RAM ;AN000;
679 MOV AX,END_OF_RESIDENT_CODE ;AN000;
680 MOV ES:[SI]+4,AX ;AN000;
681 .ENDIF ; ENDIF save pointer table is in ROM ;AN000;
682 ;-----------------------------------------------------------------------------;AN000;
683 ; Adjust END_OF_RESIDENT_CODE to the next offset available for copying ;AN000;
684 ; resident code and data. ;AN000;
685 ;-----------------------------------------------------------------------------;AN000;
686 ADD END_OF_RESIDENT_CODE,EGA_DYNAMIC_LEN ;AN000;
687.ENDIF ;AN000;
688POP ES ;AN000;
689POP DI ;AN000;
690POP SI ;AN000;
691POP DX ;AN000;
692POP CX ;AN000;
693POP AX ;AN000;
694 ;AN000;
695RET ;AN000;
696OUR_SAVE_TAB_OFF DW ? ;AN000;
697INST_EGA_SAVE_AREA ENDP ;AN000;
698PAGE ;AN000;
699;===============================================================================;AN000;
700; ;AN000;
701; CHAIN_INTERRUPTS : INSTALL INT 5 AND INT 2FH VECTORS ;AN000;
702; ;AN000;
703;-------------------------------------------------------------------------------;AN000;
704; ;AN000;
705; INPUT: DS = Data segment for our code ;AN000;
706; END_OF_RESIDENT_CODE = Offset of the end of the resident code ;AN000;
707; ;AN000;
708; OUTPUT: OLD_INT_2FH (within INT_2FH_DRIVER) ;AN000;
709; BIOS_INT_5H (within PRT_SCR module) ;AN000;
710; END_OF_RESIDENT_CODE is updated to point to the end of the code ;AN000;
711; that will stay resident. ;AN000;
712; SAVE_AREA_PTR in BIOS segment is updated if an EGA adapter is found ;AN000;
713; ;AN000;
714;-------------------------------------------------------------------------------;AN000;
715;; ;AN000;
716;; Data Structures Referenced: ;AN000;
717;; Shared Data Area ;AN000;
718;; ;AN000;
719;; Description: ;AN000;
720;; Install Interrupts 5 and 2FH. The old vectors are saved. ;AN000;
721;; ;AN000;
722;; Called By: ;AN000;
723;; GRAPHICS_INSTALL ;AN000;
724;; ;AN000;
725;; External Calls: ;AN000;
726;; DOS INT 21H Replace vector AH=25h ;AN000;
727;; DOS INT 21H Get vector AH=35h ;AN000;
728;; ;AN000;
729;; Logic: ;AN000;
730;; Save interrupt 5 vector in BIOS_INT_5H ;AN000;
731;; Point interrupt 5 to PRT_SCR module ;AN000;
732;; Save interrupt 2FH vector in BIOS_INT_2FH ;AN000;
733;; Point interrupt 2FH to INT_2FH_DRIVER module ;AN000;
734;; RETURN ;AN000;
735;; ;AN000;
736;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
737 ;; ;AN000;
738CHAIN_INTERRUPTS PROC NEAR ;; ;AN000;
739 PUSH ES ;AN000;
740 PUSH BX ;AN000;
741 ;AN000;
742;-------------------------------------------------------------------------------;AN000;
743; Replace INTERRUPT 5 vector ;AN000;
744;-------------------------------------------------------------------------------;AN000;
745 MOV AH,35H ; Get vector for ;AN000;
746 MOV AL,5 ; interrupt 5 request ;AN000;
747 INT 21H ; Call DOS ;AN000;
748 ;AN000;
749 MOV BIOS_INT_5H,BX ; Save the old vector ;AN000;
750 MOV BIOS_INT_5H+2,ES ;AN000;
751 ;AN000;
752 MOV DX,OFFSET PRT_SCR ; DS:DX := Offset of our Print Screen ;AN000;
753 ;AN000;
754 MOV AH,25H ; Replace vector for ;AN000;
755 MOV AL,5 ; interrupt 5 request ;AN000;
756 INT 21H ; Call DOS ;AN000;
757 ;AN000;
758;-------------------------------------------------------------------------------;AN000;
759; Replace INTERRUPT 2FH vector ;AN000;
760;-------------------------------------------------------------------------------;AN000;
761 MOV AH,35H ; Get vector for ;AN000;
762 MOV AL,2FH ; interrupt 2FH request ;AN000;
763 INT 21H ; Call DOS ;AN000;
764 ;AN000;
765 MOV WORD PTR OLD_INT_2FH,BX ; Save the old vector ;AN000;
766 MOV WORD PTR OLD_INT_2FH+2,ES ;AN000;
767 ;AN000;
768 MOV DX,OFFSET INT_2FH_DRIVER; DS:DX := Offset of our 2FH handler ;AN000;
769 ;AN000;
770 MOV AH,25H ; Replace vector for ;AN000;
771 MOV AL,2FH ; interrupt 2FH request ;AN000;
772 INT 21H ; Call DOS ;AN000;
773 ;AN000;
774 POP BX ;AN000;
775 POP ES ;AN000;
776 RET ;AN000;
777CHAIN_INTERRUPTS ENDP ;AN000;
778 ;AN000;
779;===============================================================================;AN000;
780; ;AN000;
781; COPY_PRINT_MODULES: COPY THE SET OF PRINT MODULES NEEDED OVER THE PREVIOUS ONE;AN000;
782; ;AN000;
783;-------------------------------------------------------------------------------;AN000;
784; ;AN000;
785; INPUT: BP = Offset of the temporary Shared Data area ;AN000;
786; END_OF_RESIDENT_CODE = Location of the set of COLOR modules ;AN000;
787; (if first time installed) ;AN000;
788; CS:[BP].PRINTER_TYPE = Printer type NEEDED ;AN000;
789; RESIDENT_CODE_SEG = Segment containing the resident code ;AN000;
790; ;AN000;
791; OUTPUT: END_OF_RESIDENT_CODE = End of the print modules IS UPDATED ;AN000;
792; (If first time installed) ;AN000;
793; ;AN000;
794;-------------------------------------------------------------------------------;AN000;
795;; ;AN000;
796;; Data Structures Referenced: ;AN000;
797;; Control Variables ;AN000;
798;; Shared Data Area ;AN000;
799;; ;AN000;
800;; Description: ;AN000;
801;; This module trashes one set of print modules (Color or Black & White) ;AN000;
802;; depending on the type of printer attached. Since the Shared Data ;AN000;
803;; (resident version) will reside immediately after the print modules, ;AN000;
804;; END_OF_RESIDENT_CODE will be set by this modules. ;AN000;
805;; ;AN000;
806;; The set of COLOR modules is already at the rigth located when installing ;AN000;
807;; GRAPHICS for the first time. This is true since, the color modules are ;AN000;
808;; linked before the black and white modules. ;AN000;
809;; ;AN000;
810;; Therefore, if we are installing GRAPHICS for the first time and we need ;AN000;
811;; the color modules then, we do not need to relocate any print modules. ;AN000;
812;; ;AN000;
813;; When installing GRAPHICS again we first check what is the resident set, ;AN000;
814;; we recopy a new set only if needed. ;AN000;
815;; ;AN000;
816;; Called By: ;AN000;
817;; GRAPHICS_INSTALL ;AN000;
818;; ;AN000;
819;; Logic: ;AN000;
820;; IF color printer THEN ;AN000;
821;; SI := Offset of BW_PRINT_MODULES ;AN000;
822;; ELSE ;AN000;
823;; SI := Offset of COLOR_PRINT_MODULES ;AN000;
824;; ENDIF ;AN000;
825;; REP MOVSB ; Copy the set of modules ;AN000;
826;; END_OF_RESIDENT_CODE := end of the set of modules ;AN000;
827;; RETURN ;AN000;
828;; ;AN000;
829;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
830COPY_PRINT_MODULES PROC NEAR ;AN000;
831 PUSH AX ;AN000;
832 PUSH BX ;AN000;
833 PUSH CX ;AN000;
834 PUSH SI ;AN000;
835 PUSH DI ;AN000;
836 PUSH ES ;AN000;
837 ;AN000;
838;-------------------------------------------------------------------------------;AN000;
839; Determine if we need to relocate the set of print modules, if so, set the ;AN000;
840; source address (DS:SI), the destination address (ES:DI) and the number of ;AN000;
841; bytes to copy (CX). ;AN000;
842;-------------------------------------------------------------------------------;AN000;
843 PUSH CS:RESIDENT_CODE_SEG ; ES := Segment containing the resident ;AN000;
844 POP ES ; code (Where to copy modules) ;AN000;
845 MOV DI,OFFSET PRINT_MODULE_START ; ES:[DI] := Resident print modules ;AN000;
846 ;AN000;
847 .IF <INSTALLED EQ NO> ; IF not installed ;AN000;
848 .THEN ; THEN, ;AN000;
849 ; We relocate the print modules ;AN000;
850 ; at the end of the resident code: ;AN000;
851 ; (this is where the color set is) ;AN000;
852 .IF <CS:[BP].PRINTER_TYPE EQ BLACK_WHITE> ; IF we don't want the color set ;AN000;
853 .THEN ; THEN, ;AN000;
854 MOV NEED_NEW_PRINT_MODULES,YES ; Say we need new modules ;AN000;
855 MOV SI,OFFSET PRINT_BW_APA ; DS:[SI] := Black and white modules;AN000;
856 MOV CX,LEN_OF_BW_MODULES ; CX := Length of B&W modules ;AN000;
857 .ENDIF ; ;AN000;
858 ;AN000;
859 .ELSE ; ELSE, (We are already installed) ;AN000;
860 MOV BX,SHARED_DATA_AREA_PTR ; BX := Offset of Shared Data area ;AN000;
861 MOV AL,ES:[BX].PRINTER_TYPE ; AL := Type of the resident set ;AN000;
862 .IF <AL NE CS:[BP].PRINTER_TYPE> ; IF resident set is not the one ;AN000;
863 .THEN ; we need THEN, ;AN000;
864 MOV NEED_NEW_PRINT_MODULES,YES ; Say we need a new set. ;AN000;
865 .IF <CS:[BP].PRINTER_TYPE EQ COLOR>; IF its color we need then, ;AN000;
866 MOV SI,OFFSET PRINT_COLOR ; DS:[SI] := Color set ;AN000;
867 MOV CX,LEN_OF_COLOR_MODULES ; CX := Length of color mod. ;AN000;
868 .ELSE ; ELSE ;AN000;
869 MOV SI,OFFSET PRINT_BW_APA ; DS:[SI] := B&W set ;AN000;
870 MOV CX,LEN_OF_BW_MODULES ; CX := Length of B&W mod. ;AN000;
871 .ENDIF ; ENDIF we need the color set ;AN000;
872 .ENDIF ; ENDIF we need a new set ;AN000;
873 .ENDIF ; ENDIF we are not installed ;AN000;
874 ;AN000;
875 ;AN000;
876;-------------------------------------------------------------------------------;AN000;
877; If needed: Copy the required set of print modules ;AN000;
878;-------------------------------------------------------------------------------;AN000;
879 .IF <NEED_NEW_PRINT_MODULES EQ YES> ;AN000;
880 .THEN ;AN000;
881 CLD ; Clear the direction flag ;AN000;
882 REP MOVSB ; Copy the set of print modules ;AN000;
883 .ENDIF ; ENDIF needs to copy the print modules ;AN000;
884 ;AN000;
885;-------------------------------------------------------------------------------;AN000;
886; Set END_OF_RESIDENT_CODE pointer to the end of the print modules: ;AN000;
887; (Reserve enough space to store the larger set of modules on a ;AN000;
888; subsequent install) ;AN000;
889;-------------------------------------------------------------------------------;AN000;
890 .IF <INSTALLED EQ NO> ; IF first time installed ;AN000;
891 .THEN ; THEN, ;AN000;
892 MOV CX,LEN_OF_COLOR_MODULES ; Adjust END_OF_RESIDENT_CODE to ;AN000;
893 .IF <CX G LEN_OF_BW_MODULES> ; contains the larger set of modules. ;AN000;
894 .THEN ; ;AN000;
895 ADD END_OF_RESIDENT_CODE,LEN_OF_COLOR_MODULES ;AN000;
896 .ELSE ;AN000;
897 ADD END_OF_RESIDENT_CODE,LEN_OF_BW_MODULES ;AN000;
898 .ENDIF ; ;AN000;
899 .ENDIF ;AN000;
900 ;AN000;
901 POP ES ;AN000;
902 POP DI ;AN000;
903 POP SI ;AN000;
904 POP CX ;AN000;
905 POP BX ;AN000;
906 POP AX ;AN000;
907 RET ;AN000;
908NEED_NEW_PRINT_MODULES DB NO ; True if print modules needed must be ;AN000;
909 ; copied over the other set of print ;AN000;
910 ; modules ;AN000;
911COPY_PRINT_MODULES ENDP ;AN000;
912 ;AN002;
913PAGE ;AN002;
914;===============================================================================;AN002;
915; ;AN002;
916; PROCEDURE_NAME: RELEASE_ENVIRONMENT ;AN002;
917; ;AN002;
918; INPUT: None. ;AN002;
919; ;AN002;
920; OUTPUT: Environment vector released. ;AN002;
921; ;AN002;
922;-------------------------------------------------------------------------------;AN002;
923RELEASE_ENVIRONMENT PROC NEAR ;AN002;
924 PUSH AX ; save regs ;AN002;
925 PUSH BX ;AN002;
926 PUSH ES ;AN002;
927 MOV AH,62H ; function for get the PSP segment ;AN002;
928 INT 21H ; invoke INT 21h ;AN002;
929 MOV ES,BX ; BX contains PSP segment - put in ES ;AN002;
930 MOV BX,WORD PTR ES:[2CH] ; get segment of environmental vector ;AN002;
931 MOV ES,BX ; place segment in ES for Free Memory ;AN002;
932 MOV AH,49H ; Free Allocated Memory function call ;AN002;
933 INT 21H ; invoke INT 21h ;AN002;
934 POP ES ; restore regs ;AN002;
935 POP BX ;AN002;
936 POP AX ;AN002;
937 RET ;AN002;
938RELEASE_ENVIRONMENT ENDP ;AN002;
939 ;AN000;
940PAGE ;AN000;
941;===============================================================================;AN000;
942; ;AN000;
943; PROCEDURE_NAME: DISP_ERROR ;AN000;
944; ;AN000;
945; INPUT: AX := GRAPHICS message number (documented in GRMSG.EQU) ;AN000;
946; CX := Number of substitutions (Needed by SYSDISPMSG) ;AN000;
947; DS:[SI] := Substitution list (needed only if CX <> 0) ;AN000;
948; ;AN000;
949; OUTPUT: Error message is displayed on STANDARD ERROR OUTPUT (STDERR) ;AN000;
950; ;AN000;
951;-------------------------------------------------------------------------------;AN000;
952DISP_ERROR PROC NEAR ;AN000;
953 PUSH BX ;AN000;
954 PUSH DI ;AN000;
955 PUSH SI ;AN000;
956 PUSH BP ;AN000;
957 ;AN000;
958 MOV BX,ERROR_DEVICE ; Issue message to standard error ;AN000;
959 XOR DL,DL ; No input ;AN000;
960 MOV DH,UTILITY_MSG_CLASS;It's one of our messages ;AN000;
961 CALL SYSDISPMSG ; display error message ;AN000;
962 ;AN000;
963 POP BP ;AN000;
964 POP SI ;AN000;
965 POP DI ;AN000;
966 POP BX ;AN000;
967 RET ;AN000;
968DISP_ERROR ENDP ;AN000;
969
970include msgdcl.inc ;AN000;
971 ;AN000;
972CODE ENDS ;AN000;
973 END ;AN000;
diff --git a/v4.0/src/CMD/GRAPHICS/GRINST.EXT b/v4.0/src/CMD/GRAPHICS/GRINST.EXT
new file mode 100644
index 0000000..75b8137
--- /dev/null
+++ b/v4.0/src/CMD/GRAPHICS/GRINST.EXT
@@ -0,0 +1,43 @@
1.XLIST ;AN000;
2PAGE ,132 ;AN000;
3;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
4;; DOS - GRAPHICS Command
5;; (C) Copyright 1988 Microsoft
6;; ;AN000;
7;; File Name: GRINST.EXT ;AN000;
8;; ---------- ;AN000;
9;; ;AN000;
10;; Description: ;AN000;
11;; ------------ ;AN000;
12;; External declarations for code and data defined in ;AN000;
13;; GRINIT.ASM ;AN000;
14;; ;AN000;
15;; Change History: ;AN000;
16;; --------------- ;AN000;
17;; ;AN000;
18;; ;AN000;
19;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
20 ;; ;AN000;
21 EXTRN GRAPHICS_INSTALL:NEAR ;; ;AN000;
22 EXTRN SYSDISPMSG:NEAR ;; ;AN000;
23 EXTRN DISP_ERROR:NEAR ;; ;AN000;
24 EXTRN TEMP_SHARED_DATA_PTR:WORD ;; ;AN000;
25 ;; ;AN000;
26 EXTRN PRINTER_TYPE_PARM:BYTE ;; ;AN000;
27 EXTRN PRINTER_TYPE_LENGTH:BYTE ;; ;AN000;
28 EXTRN INSTALLED:BYTE ;; ;AN000;
29 EXTRN PROFILE_PATH:BYTE ;; ;AN000;
30 EXTRN PRINTBOX_ID_PTR:WORD ;; ;AN000;
31 EXTRN PRINTBOX_ID_LENGTH:BYTE ;; ;AN000;
32 EXTRN DEFAULT_BOX:BYTE ;; ;AN000;
33 EXTRN LCD_BOX:BYTE ;; ;AN000;
34 EXTRN ERROR_DEVICE:WORD ;; ;AN000;
35 ;; ;AN000;
36 EXTRN STDERR:ABS ;; ;AN000;
37 EXTRN STDOUT:ABS ;; ;AN000;
38 ;; ;AN000;
39 EXTRN NB_FREE_BYTES:WORD ;; ;AN000;
40 EXTRN RESIDENT_SHARED_DATA_SIZE:WORD;; ;AN000;
41 ;; ;AN000;
42;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
43.LIST ;AN000;
diff --git a/v4.0/src/CMD/GRAPHICS/GRINT2FH.ASM b/v4.0/src/CMD/GRAPHICS/GRINT2FH.ASM
new file mode 100644
index 0000000..b195c25
--- /dev/null
+++ b/v4.0/src/CMD/GRAPHICS/GRINT2FH.ASM
@@ -0,0 +1,146 @@
1 PAGE ,132 ;AN000;
2 TITLE DOS - GRAPHICS Command - Interrupt 2FH Driver ;AN000;
3 ;AN000;
4;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
5;; DOS - GRAPHICS Command
6;; (C) Copyright 1988 Microsoft
7;; ;AN000;
8;; File Name: GRINT2FH.ASM ;AN000;
9;; ---------- ;AN000;
10;; ;AN000;
11;; Description: ;AN000;
12;; ------------ ;AN000;
13;; This file contains the Interrupt 2FH driver. ;AN000;
14;; ;AN000;
15;; Documentation Reference: ;AN000;
16;; ------------------------ ;AN000;
17;; OASIS High Level Design ;AN000;
18;; OASIS GRAPHICS I1 Overview ;AN000;
19;; ;AN000;
20;; Procedures Contained in This File: ;AN000;
21;; ---------------------------------- ;AN000;
22;; INT_2FH_DRIVER - Interrupt 2FH driver ;AN000;
23;; ;AN000;
24;; Include Files Required: ;AN000;
25;; ----------------------- ;AN000;
26;; GRLOAD.EXT - Externals for profile load ;AN000;
27;; GRCTRL.EXT - Externals for print screen control ;AN000;
28;; GRPRINT.EXT - Externals for print modules ;AN000;
29;; GRCPSD.EXT - Externals for COPY_SHARED_DATA module ;AN000;
30;; ;AN000;
31;; External Procedure References: ;AN000;
32;; ------------------------------ ;AN000;
33;; Calls next Int 2FH handler in the chain. ;AN000;
34;; ;AN000;
35;; Linkage Instructions: ;AN000;
36;; -------------------- ;AN000;
37;; Refer to GRAPHICS.ASM ;AN000;
38;; ;AN000;
39;; Change History: ;AN000;
40;; --------------- ;AN000;
41;; ;AN000;
42;; ;AN000;
43;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
44 ;; ;AN000;
45 ;; ;AN000;
46CODE SEGMENT PUBLIC 'CODE' ;; ;AN000;
47 ASSUME CS:CODE,DS:CODE ;; ;AN000;
48 ;; ;AN000;
49 PUBLIC OLD_INT_2FH ;; ;AN000;
50 PUBLIC INT_2FH_DRIVER ;; ;AN000;
51 PUBLIC PRT_SCR_2FH_NUMBER ;; ;AN000;
52 PUBLIC RESIDENT_CODE_SEG ;; ;AN000;
53 PUBLIC SHARED_DATA_AREA_PTR ;; ;AN000;
54 ;; ;AN000;
55 ;; ;AN000;
56.XLIST ;AN000;
57INCLUDE STRUC.INC ;AN000;
58INCLUDE GRINST.EXT ;AN000;
59INCLUDE GRCTRL.EXT ;AN000;
60INCLUDE GRCPSD.EXT ;AN000;
61.LIST ;AN000;
62;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
63;; ;AN000;
64;; Module: INT_2FH_DRIVER ;AN000;
65;; ;AN000;
66;; Description: ;AN000;
67;; Respond to GRAPHICS Int 2FH calls. ;AN000;
68;; The following calls are handled: ;AN000;
69;; ;AN000;
70;; AL = 0 Install Check ;AN000;
71;; ;AN000;
72;; Invoked By: ;AN000;
73;; INT 2FH instruction. ;AN000;
74;; ;AN000;
75;; Modules Called: ;AN000;
76;; Lower level INT 2FH handlers. ;AN000;
77;; ;AN000;
78;; Input Registers: ;AN000;
79;; Install Check - AH=15H AL=0 ;AN000;
80;; ;AN000;
81;; ;AN000;
82;; Output Registers: ;AN000;
83;; Install Check: IF GRAPHICS installed ;AN000;
84;; AH=FFH AL=FFH ;AN000;
85;; ES : DI points to Shared Data Area ;AN000;
86;; ELSE ;AN000;
87;; AH=15H AL=0 ;AN000;
88;; ;AN000;
89;; Logic: ;AN000;
90;; IF AH=15H THEN ;AN000;
91;; IF AL=0 THEN ;AN000;
92;; AH,AL := -1 ;AN000;
93;; ES : DI := SHARED_DATA_AREA_PTR ;AN000;
94;; ENDIF ;AN000;
95;; IRET ;AN000;
96;; ELSE ;AN000;
97;; IF OLD_INT_2FH is a valid pointer THEN ;AN000;
98;; Jump to Old Int 2FH ;AN000;
99;; ELSE ;AN000;
100;; IRET ;AN000;
101;; ENDIF ;AN000;
102;; ENDIF ;AN000;
103;; ;AN000;
104;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
105 ;AN000;
106INT_2FH_DRIVER PROC NEAR ;AN000;
107 JMP INT_2FH ;AN000;
108PRT_SCR_2FH_NUMBER EQU 15H ; 2FH Multiplex interrupt number ;AN000;
109 ; assigned to Print Screen. ;AN000;
110OLD_INT_2FH DD ? ; Pointer to next 2FH interrupt handler ;AN000;
111RESIDENT_CODE_SEG DW ? ; Segment for installed stuff ;AN000;
112SHARED_DATA_AREA_PTR DW ? ; Offset of the start of the ;AN000;
113 ; Shared Data Area ;AN000;
114 ;AN000;
115INT_2FH: ;AN000;
116;-------------------------------------------------------------------------------;AN000;
117; Verify if the 2FH Interrupt call is for our interrupt handler: ;AN000;
118;-------------------------------------------------------------------------------;AN000;
119 .IF <AH EQ PRT_SCR_2FH_NUMBER> AND;If 2FH call is for us ;AN000;
120 .IF <ZERO AL> ; and request is "Get install state" ;AN000;
121 .THEN ; then, ;AN000;
122;-------------------------------------------------------------------------------;AN000;
123; Yes: return results ;AN000;
124;-------------------------------------------------------------------------------;AN000;
125 MOV DI,CS:SHARED_DATA_AREA_PTR ; ES:DI := Pointer to shared ;AN000;
126 PUSH CS:RESIDENT_CODE_SEG ; data area ;AN000;
127 POP ES ; ;AN000;
128 MOV AH,0FFH ; AL and AH := "We are installed" ;AN000;
129 MOV AL,AH ; ;AN000;
130 IRET ; Return to interrupted process ;AN000;
131;-------------------------------------------------------------------------------;AN000;
132; No, pass control to next 2FH interrupt handler: ;AN000;
133;-------------------------------------------------------------------------------;AN000;
134 .ELSE ; else, this call is not for us: ;AN000;
135 .IF <<WORD PTR CS:OLD_INT_2FH> NE 0> AND ;if there is another ;AN000;
136 .IF <<WORD PTR CS:OLD_INT_2FH+2> NE 0> ; 2FH driver ;AN000;
137 .THEN ; below us then, ;AN000;
138 JMP CS:OLD_INT_2FH ; pass control to it ;AN000;
139 .ELSE ; else, there is nobody to pass ;AN000;
140 IRET ; control to, just return. ;AN000;
141 .ENDIF ; END If there is a driver below us.;AN000;
142 .ENDIF ; END If this call is for us. ;AN000;
143INT_2FH_DRIVER ENDP ;AN000;
144 ;AN000;
145CODE ENDS ;AN000;
146 END ;AN000;
diff --git a/v4.0/src/CMD/GRAPHICS/GRINT2FH.EXT b/v4.0/src/CMD/GRAPHICS/GRINT2FH.EXT
new file mode 100644
index 0000000..54d69c2
--- /dev/null
+++ b/v4.0/src/CMD/GRAPHICS/GRINT2FH.EXT
@@ -0,0 +1,26 @@
1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
2;; DOS - GRAPHICS Command
3;; (C) Copyright 1988 Microsoft
4;; ;AN000;
5;; File Name: GRINT2FH.EXT ;AN000;
6;; ---------- ;AN000;
7;; ;AN000;
8;; Description: ;AN000;
9;; ------------ ;AN000;
10;; External declarations for code and data defined in ;AN000;
11;; GRINT2FH.ASM ;AN000;
12;; ;AN000;
13;; Change History: ;AN000;
14;; --------------- ;AN000;
15;; ;AN000;
16;; ;AN000;
17;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
18 ;; ;AN000;
19 EXTRN OLD_INT_2FH:DWORD ;; ;AN000;
20 EXTRN INT_2FH_DRIVER:NEAR ;; ;AN000;
21 EXTRN PRT_SCR_2FH_NUMBER:ABS ;; ;AN000;
22 EXTRN SHARED_DATA_AREA_PTR:WORD ;AN000;
23 EXTRN RESIDENT_CODE_SEG:WORD ;AN000;
24 ;; ;AN000;
25 ;; ;AN000;
26;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
diff --git a/v4.0/src/CMD/GRAPHICS/GRLOAD.ASM b/v4.0/src/CMD/GRAPHICS/GRLOAD.ASM
new file mode 100644
index 0000000..dd16ca4
--- /dev/null
+++ b/v4.0/src/CMD/GRAPHICS/GRLOAD.ASM
@@ -0,0 +1,840 @@
1 PAGE ,132 ;AN000;
2 TITLE DOS - GRAPHICS Command - Profile Load Modules ;AN000;
3 ;AN000;
4;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
5;; DOS - GRAPHICS Command
6;; (C) Copyright 1988 Microsoft
7;; ;AN000;
8;; File Name: GRLOAD.ASM ;AN000;
9;; ---------- ;AN000;
10;; ;AN000;
11;; Description: ;AN000;
12;; ------------ ;AN000;
13;; This file contains the modules used to load the ;AN000;
14;; GRAPHICS profile into resident memory. ;AN000;
15;; ;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;
23;; ;AN000;
24;; ;AN000;
25;; Documentation Reference: ;AN000;
26;; ------------------------ ;AN000;
27;; PLACID Functional Specifications ;AN000;
28;; OASIS High Level Design ;AN000;
29;; OASIS GRAPHICS I1 Overview ;AN000;
30;; ;AN000;
31;; Procedures Contained in This File: ;AN000;
32;; ---------------------------------- ;AN000;
33;; LOAD_PROFILE - Main module for profile loading ;AN000;
34;; ;AN000;
35;; Include Files Required: ;AN000;
36;; ----------------------- ;AN000;
37;; ?????????? - Externals for profile loading modules ;AN000;
38;; ;AN000;
39;; External Procedure References: ;AN000;
40;; ------------------------------ ;AN000;
41;; None ;AN000;
42;; ;AN000;
43;; Linkage Instructions: ;AN000;
44;; --------------------- ;AN000;
45;; Refer to GRAPHICS.ASM ;AN000;
46;; ;AN000;
47;; Change History: ;AN000;
48;; --------------- ;AN000;
49;; ;AN000;
50;; ;AN000;
51;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
52 ;; ;AN000;
53 ;; ;AN000;
54CODE SEGMENT PUBLIC 'CODE' BYTE ;; ;AN000;
55 ;; ;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 GRPARSE.EXT ;; ;AN000;
61 INCLUDE GRLOAD2.EXT ;; ;AN000;
62 INCLUDE GRLOAD3.EXT ;; ;AN000;
63 INCLUDE GRMSG.EQU ;; ;AN000;
64 ;; ;AN000;
65;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
66;; ;AN000;
67;; Public Symbols ;AN000;
68;; ;AN000;
69;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
70 ;; ;AN000;
71 PUBLIC LOAD_PROFILE ;AN000;
72 PUBLIC GROW_SHARED_DATA ;AN000;
73 PUBLIC BLOCK_START ;AN000;
74 PUBLIC BLOCK_END ;AN000;
75 PUBLIC FIRST_BLOCK ;AN000;
76 PUBLIC MAX_BLOCK_END ;AN000;
77 PUBLIC GROUPS_DONE ;AN000;
78 PUBLIC STMTS_DONE ;AN000;
79 PUBLIC STMTS_DONE ;AN000;
80 PUBLIC PTD_FOUND ;AN000;
81 PUBLIC BUILD_STATE ;AN000;
82 PUBLIC STMT_ERROR ;AN000;
83 PUBLIC FILE_ERROR ;AN000;
84 PUBLIC PARSE_ERROR ;AN000;
85 PUBLIC END_OF_FILE ;AN000;
86 PUBLIC MEM_OVERFLOW ;AN000;
87 PUBLIC STMT_BUFFER ;AN000;
88 PUBLIC CUR_STMT ;AN000;
89 PUBLIC PREV_STMT ;AN000;
90 PUBLIC PRT_BOX_ERROR ;AN000;
91 ;; ;AN000;
92;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
93 ;; ;AN000;
94 ASSUME CS:CODE,DS:CODE ;; ;AN000;
95 ;; ;AN000;
96;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
97 ;; ;AN000;
98 ;; ;AN000;
99;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
100;; ;AN000;
101;; Profile Load Variables ;AN000;
102;; ;AN000;
103;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
104 ;; ;AN000;
105NO EQU 0 ;; ;AN000;
106YES EQU 1 ;; ;AN000;
107 ;; ;AN000;
108 ;; ;AN000;
109;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
110;; ;AN000;
111;; Module Name: ;AN000;
112;; LOAD_PROFILE ;AN000;
113;; ;AN000;
114;; Input Parameters: ;AN000;
115;; DS,ES,SS - points to our transient segment ;AN000;
116;; ;AN000;
117;; Output Parameters: ;AN000;
118;; Temporary Shared Data Area ;AN000;
119;; Carry flag set if errors in profile. ;AN000;
120;; ;AN000;
121;; Data Structures Referenced: ;AN000;
122;; Shared Data Area ;AN000;
123;; Profile Load Variables ;AN000;
124;; ;AN000;
125;; Description: ;AN000;
126;; Build the profile information in the Temporary Shared Data Area. ;AN000;
127;; The information will be built for the printer type parsed off ;AN000;
128;; the command line. ALL Printer Type Descriptions will be ;AN000;
129;; parsed to issue error messages and determine the maximum ;AN000;
130;; amount of resident memory required for initial load. ;AN000;
131;; The Shared Data Area begins with a fixed length section ;AN000;
132;; and then has several variable length sections. PROFILE_BUILD_PTR ;AN000;
133;; is used to build the variable length sections by serving ;AN000;
134;; as a running pointer to the sections as they are built. ;AN000;
135;; ;AN000;
136;; Register Usage: ;AN000;
137;; BP - points to beginning of Temp Shared Data ;AN000;
138;; ;AN000;
139;; Called By: ;AN000;
140;; GRAPHICS_INSTALL ;AN000;
141;; ;AN000;
142;; External Calls: ;AN000;
143;; PARSE_PRINTER, PARSE_DISPLAYMODE, PARSE_SETUP, PARSE_RESTORE ;AN000;
144;; PARSE_PRINTBOX, PARSE_GRAPHICS, PARSE_COLORSELECT, ;AN000;
145;; PARSE_COLORPRINT, GET_STATEMENT ;AN000;
146;; SYSPARSE ;AN000;
147;; ;AN000;
148;; Logic: ;AN000;
149;; IF profile path not specified THEN ;AN000;
150;; PROFILE_PATH := "GRAPHICS.PRO" /* Current directory */ ;AN000;
151;; Open profile using PROFILE_PATH ;AN000;
152;; IF error during open THEN ;AN000;
153;; PROFILE_PATH := ARG(V0) with "GRAPHICS.COM" replaced ;AN000;
154;; by "GRAPHICS.PRO" ;AN000;
155;; Open profile using PROFILE_PATH ;AN000;
156;; IF error during open THEN ;AN000;
157;; Issue "Cannot find profile" msg ;AN000;
158;; Set carry flag ;AN000;
159;; RETURN ;AN000;
160;; ENDIF ;AN000;
161;; ENDIF ;AN000;
162;; ELSE ;AN000;
163;; Open profile using specified path ;AN000;
164;; IF error during open THEN ;AN000;
165;; Issue "Cannot find profile" msg ;AN000;
166;; Set carry flag ;AN000;
167;; RETURN ;AN000;
168;; ENDIF ;AN000;
169;; ENDIF ;AN000;
170;; /* don't start building until we find our printer type*/ ;AN000;
171;; PARSE_MODE := NOBUILD ;AN000;
172;; MAX_BUILD_PTR := 0 ;AN000;
173;; CALL GROW_SHARED_DATA(PROFILE-BUILD_PTR,size of FIXED PART ;AN000;
174;; of Shared Data Area) ;AN000;
175;; WHILE (not end of file) AND (no I/O error) DO ;AN000;
176;; CALL GET_STATEMENT ;AN000;
177;; IF I/O error THEN ;AN000;
178;; Issue error message ;AN000;
179;; ELSE ;AN000;
180;; CALL SYSPARSE to parse the statement verb ;AN000;
181;; IF verb found THEN ;AN000;
182;; IF invalid verb THEN ;AN000;
183;; Issue error message ;AN000;
184;; PARSE_MODE := ERROR ;AN000;
185;; ELSE ;AN000;
186;; CASE statement verb ;AN000;
187;; PRINTER: ;AN000;
188;; CALL PARSE_PRINTER ;AN000;
189;; DISPLAYMODE: ;AN000;
190;; CALL PARSE_DISPLAYMODE ;AN000;
191;; PRINTBOX: ;AN000;
192;; CALL PARSE_PRINTBOX ;AN000;
193;; SETUP: ;AN000;
194;; CALL PARSE_SETUP ;AN000;
195;; RESTORE: ;AN000;
196;; CALL PARSE_RESTORE ;AN000;
197;; GRAPHICS: ;AN000;
198;; CALL PARSE_GRAPHICS ;AN000;
199;; COLORPRINT: ;AN000;
200;; CALL PARSE_COLORPRINT ;AN000;
201;; COLORSELECT: ;AN000;
202;; CALL PARSE_COLORSELECT ;AN000;
203;; ENDCASE ;AN000;
204;; IF error on statement THEN ;AN000;
205;; IF OVERFLOW bit set in RETURN_CODE THEN ;AN000;
206;; Issue "Insufficient memory" message ;AN000;
207;; RETURN to caller ;AN000;
208;; ELSE ;AN000;
209;; IF MISSING bit set in RETURN_CODE THEN ;AN000;
210;; Issue "required statement missing" message ;AN000;
211;; ENDIF ;AN000;
212;; IF INVALID bit set in RETURN_CODE THEN ;AN000;
213;; Issue "statement invalid" message ;AN000;
214;; ENDIF ;AN000;
215;; IF SEQUENCE bit set in RETURN_CODE THEN ;AN000;
216;; Issue "out of sequence" message ;AN000;
217;; ENDIF ;AN000;
218;; display the statement in error ;AN000;
219;; ENDIF ;AN000;
220;; PARSE_MODE := ERROR ;AN000;
221;; ENDIF ;AN000;
222;; ENDIF ;AN000;
223;; ENDIF ;AN000;
224;; ENDIF ;AN000;
225;; ENDWHILE ;AN000;
226;; ;AN000;
227;; /* Check length of last PTD */ ;AN000;
228;; IF PROFILE_BUILD_PTR > MAX_BUILD_PTR THEN ;AN000;
229;; MAX_BUILD_PTR := PROFILE_BUILD_PTR ;AN000;
230;; ENDIF ;AN000;
231;; ;AN000;
232;; /* Make sure all required statements were in previous */ ;AN000;
233;; /* Printer Type Description */ ;AN000;
234;; /* Must have completed PRINTER, DISPLAYMODE, PRINTBOX and */ ;AN000;
235;; /* GRAPHICS statements */ ;AN000;
236;; IF PRT+DISP+BOX+GR bits not all set in STMTS_DONE THEN ;AN000;
237;; Issue "required statement missing" message ;AN000;
238;; Display "END OF FILE." ;AN000;
239;; ENDIF ;AN000;
240;; ;AN000;
241;; IF errors during build THEN ;AN000;
242;; set carry flag ;AN000;
243;; ELSE ;AN000;
244;; SD_TOTAL_SIZE := MAX_BUILD_PTR - TEMP_SHARED_DATA_PTR ;AN000;
245;; ENDIF ;AN000;
246;; RETURN ;AN000;
247;; ;AN000;
248;; ;AN000;
249;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
250 ;; ;AN000;
251FILE_NOT_FOUND EQU 2 ;; DOS Int21H error codes ;AN000;
252PATH_NOT_FOUND EQU 3 ;; ;AN000;
253 ;; ;AN000;
254SUBLIST LABEL BYTE ;; Message substituion list for stmt # ;AN000;
255 DB 11 ;; sublist size ;AN000;
256 DB 0 ;; ;AN000;
257 DW STMT_NUM ;; \ Dword pointer to item ;AN000;
258SUBLIST_SEG DW ? ;; / ;AN000;
259 DB 1 ;; Substitution # ;AN000;
260;; Flag format a0sstttt ;; ;AN000;
261 DB 00100001B ;; Unsigned binary word - left align ;AN000;
262;;;; DB 00000000B ;; charcater ;AN000;
263 DB 0 ;; max field width ;AN000;
264 DB 1 ;; min width width ;AN000;
265 DB ' ' ;; pad characeter ;AN000;
266 ;; ;AN000;
267STMT_NUM DW 0 ;; ;AN000;
268 ;; ;AN000;
269 ;; ;AN000;
270FILE_ERROR DB 0 ;; Error opening or reading PROFILE ;AN000;
271PARSE_ERROR DB 0 ;; Syntax errors in PROFILE ;AN000;
272END_OF_FILE DB 0 ;; 1 if end of file ;AN000;
273MEM_OVERFLOW DB 0 ;; 1 if insufficient memory ;AN000;
274 ;; ;AN000;
275STMT_ERROR DB 0 ;; Error flag for individual stmt errors ;AN000;
276MISSING EQU 1 ;; Required statement missing ;AN000;
277INVALID EQU 2 ;; Invalid statement format ;AN000;
278SEQUENCE EQU 4 ;; Statement out of sequence ;AN000;
279 ;; ;AN000;
280DEFAULT_PATH DB "GRAPHICS.PRO",0 ;; ;AN000;
281BUFFER DB 64 DUP("$") ;; ;AN000;
282 ;; ;AN000;
283HANDLE DW 0 ;; Profile handle ;AN000;
284 ;; ;AN000;
285BUILD_STATE DB 0 ;; 1 if we are currently building ;AN000;
286 ;; data. 0 means syntax checking ;AN000;
287 ;; only ;AN000;
288 ;; ;AN000;
289 ;; Keep track of whether this PTD ;AN000;
290 ;; matches the type requested ;AN000;
291PTD_FOUND DB 0 ;; Values are NO (0), YES (1) and ;AN000;
292PROCESSED EQU 2 ;; PROCESSED (2) ;AN000;
293 ;; ;AN000;
294VERB DB 0 ;; PTR into VERB_JMP_TAB ;AN000;
295 ;; ;AN000;
296VERB_JMP_TAB LABEL WORD ;; ;AN000;
297 DW OFFSET PARSE_PRINTER ;; ;AN000;
298 DW OFFSET PARSE_DISPLAYMODE ;; ;AN000;
299 DW OFFSET PARSE_PRINTBOX ;; ;AN000;
300 DW OFFSET PARSE_SETUP ;; ;AN000;
301 DW OFFSET PARSE_RESTORE ;; ;AN000;
302 DW OFFSET PARSE_GRAPHICS ;; ;AN000;
303 DW OFFSET PARSE_COLORPRINT ;; ;AN000;
304 DW OFFSET PARSE_COLORSELECT ;; ;AN000;
305 DW OFFSET PARSE_DARKADJUST ;; ;AN000;
306 ;; ;AN000;
307STMTS_DONE DW 0 ;; ;AN000;
308GROUPS_DONE DW 0 ;; ;AN000;
309PREV_STMT DW 0 ;; ;AN000;
310CUR_STMT DW 0 ;; ;AN000;
311 ;; ;AN000;
312PRT EQU 1 ;; Bit masks for STMTS_DONE and ;AN000;
313DISP EQU 2 ;; GROUPS_DONE. There is one ;AN000;
314BOX EQU 4 ;; bit for each statement except ;AN000;
315GR EQU 8 ;; DARKADJUST ;AN000;
316SET EQU 10H ;; ;AN000;
317REST EQU 20H ;; ;AN000;
318COLS EQU 40H ;; ;AN000;
319COLP EQU 80H ;; ;AN000;
320DARK EQU 100H ;; ;AN000;
321 ;; ;AN000;
322BLOCK_START DW ? ;; Extents of the variable size block ;AN000;
323BLOCK_END DW ? ;; currently being built ;AN000;
324 ;; These are relative to the ;AN000;
325 ;; start of the Shared Data Area ;AN000;
326 ;; so the area can be relocated ;AN000;
327MAX_BLOCK_END DW 0 ;; End of largest PTD contained ;AN000;
328 ;; in profile ;AN000;
329FIRST_BLOCK DW ? ;; Pointer to first variable block ;AN000;
330 ;; (end of fixed part) ;AN000;
331PRT_BOX_ERROR DB 0 ;; ;AN000;
332 ;; ;AN000;
333LOAD_PROFILE PROC NEAR ;; ;AN000;
334 ;; ;AN000;
335 PUSH CS ;; ;AN000;
336 POP SUBLIST_SEG ;; setup segment for message sublist ;AN000;
337 ;; ;AN000;
338 CALL OPEN_FILE ;; ;AN000;
339 .IF <FILE_ERROR EQ YES> ;; Check for error during open ;AN000;
340 STC ;; ;AN000;
341 RET ;; ;AN000;
342 .ENDIF ;; ;AN000;
343 ;; ;AN000;
344 MOV BP,TEMP_SHARED_DATA_PTR ;; BP points to START of Shared Data ;AN000;
345 MOV AX,SIZE SHARED_DATA_AREA_STR ;; size of fixed part of Shared Data ;AN000;
346 MOV BLOCK_END,0 ;; Initialize BLOCK_START,BLOCK_END ;AN000;
347 MOV [BP].DARKADJUST_VALUE,0 ;; Init some values in the fixed ;AN000;
348 MOV [BP].NUM_PRT_COLOR,0 ;; area ;AN000;
349 MOV [BP].COLORPRINT_PTR,-1 ;; ;AN000;
350 MOV [BP].NUM_PRT_BANDS,0 ;; ;AN000;
351 MOV [BP].COLORSELECT_PTR,-1 ;; ;AN000;
352 MOV [BP].PRINTER_TYPE,BLACK_WHITE ;; ;AN000;
353 CALL GROW_SHARED_DATA ;; to the first byte after the ;AN000;
354 ;; fixed part of Shared Data ;AN000;
355 MOV AX,BLOCK_END ;; Variable size data will be built ;AN000;
356 MOV BLOCK_START,AX ;; starting at BLOCK_START ;AN000;
357 MOV FIRST_BLOCK,AX ;; Save start of variable data ;AN000;
358 ;; ;AN000;
359 MOV SI,BUFFER_PTR ;; Set up SI for GET_BYTE ;AN000;
360 CALL GET_BYTE ;; Get first byte from file ;AN000;
361 MOV NEXT_BYTE,AL ;; and store it ;AN000;
362 MOV BUFFER_PTR,SI ;; Save SI for next GET_BYTE ;AN000;
363 .WHILE <END_OF_FILE EQ NO> AND ;; Keep parsing until end of file or ;AN000;
364 .WHILE <FILE_ERROR EQ NO> ;; file error occurs ;AN000;
365 MOV STMT_ERROR,0 ;; Clear parse error flags ;AN000;
366 CALL GET_STATEMENT ;; Get next profile statement ;AN000;
367 INC STMT_NUM ;; ;AN000;
368 .IF NC ;; Carry flag set if get unsuccessful ;AN000;
369 CALL PARSE_VERB ;; Index into verb jump table returned ;AN000;
370 ;; in BX ;AN000;
371 .IF <AX EQ 0> THEN ;; AX=0 if there is a recognized ;AN000;
372 MOV AX,CUR_STMT ;; ;AN000;
373 MOV PREV_STMT,AX ;; Save last statement verb ;AN000;
374 CALL VERB_JMP_TAB[BX] ;; statement to parse ;AN000;
375 .ELSEIF <AX NE -1> THEN ;; ;AN000;
376 OR STMT_ERROR,INVALID ;; ;AN000;
377 MOV PARSE_ERROR,YES ;; ;AN000;
378 MOV BUILD_STATE,NO ;; ;AN000;
379 .ENDIF ;; ;AN000;
380 .IF <STMT_ERROR NE 0> ;; An error was detected ;AN000;
381 CALL SHOW_PARSE_ERROR ;; ;AN000;
382 MOV PARSE_ERROR,YES ;; ;AN000;
383 MOV STMT_ERROR,0 ;; ;AN000;
384 .ENDIF ;; ;AN000;
385 .ENDIF ;; ;AN000;
386 .ENDWHILE ;; ;AN000;
387 ;; ;AN000;
388 .IF <BIT STMTS_DONE AND PRT> ;; Must have at least one PRINTER ;AN000;
389 CALL TERMINATE_DISPLAYMODE ;; Terminate the last PRINTER and ;AN000;
390 CALL TERMINATE_PRINTER ;; DISPLAYMODE sections ;AN000;
391 .ELSE ;; ;AN000;
392 OR STMT_ERROR,MISSING ;; ;AN000;
393 .ENDIF ;; ;AN000;
394 .IF <STMT_ERROR NE 0> ;; ;AN000;
395 CALL SHOW_PARSE_ERROR ;; Issue Profile syntax messages ;AN000;
396 .ENDIF ;; ;AN000;
397 ;; ;AN000;
398 ;; ;AN000;
399 MOV AX,3E00H ;; Close the file ;AN000;
400 MOV BX,HANDLE ;; ;AN000;
401 INT 21H ;; ;AN000;
402 ;; ;AN000;
403 .IF <PARSE_ERROR EQ YES> ;; ;AN000;
404 MOV AX,SYNTAX_ERRORS ;; Issue "Syntax errors found in ;AN000;
405 MOV CX,0 ;; profile" message. ;AN000;
406 CALL DISP_ERROR ;; ;AN000;
407 .ENDIF ;; ;AN000;
408 ;; ;AN000;
409 .IF <PTD_FOUND EQ NO> ;; Did we find the requested printer ;AN000;
410 MOV AX,INVALID_PRT ;; type? If not issue error ;AN000;
411 MOV CX,0 ;; message. ;AN000;
412 CALL DISP_ERROR ;; ;AN000;
413 MOV PARSE_ERROR,YES ;; ;AN000;
414 .ENDIF ;; ;AN000;
415 ;; ;AN000;
416 .IF <PARSE_ERROR EQ YES> OR ;; ;AN000;
417 .IF <PRT_BOX_ERROR EQ YES> OR ;; ;AN000;
418 .IF <FILE_ERROR EQ YES> ;; Set carry flag if profile load ;AN000;
419 STC ;; was unsuccessful ;AN000;
420 .ELSE ;; ;AN000;
421 .IF <MEM_OVERFLOW EQ YES> ;; Everthing else was OK BUT we ran ;AN000;
422 .IF <INSTALLED EQ YES> ;; out of memory!!! ;AN000;
423 MOV AX,NB_FREE_BYTES ;; ;AN000;
424 .IF <AX LT RESIDENT_SHARED_DATA_SIZE> ;AN000;
425 MOV AX,NO_MEMORY ;; We ran out of physical memory! ;AN000;
426 .ELSE ;; ;AN000;
427 MOV AX,UNABLE_RELOAD ;; Allocated shared data is too small ;AN000;
428 .ENDIF ;; ;AN000;
429 .ELSE ;; ;AN000;
430 MOV AX,NO_MEMORY ;; We ran out of physical memory ;AN000;
431 .ENDIF ;; ;AN000;
432 MOV CX,0 ;; ;AN000;
433 CALL DISP_ERROR ;; ;AN000;
434 STC ;; Indicate unsuccessful ;AN000;
435 .ELSE ;; ;AN000;
436 MOV AX,MAX_BLOCK_END ;; Extent of largest PRINTER section ;AN000;
437 MOV [BP].SD_TOTAL_SIZE,AX ;; we parsed. ;AN000;
438 CLC ;; SUCCESSFUL LOAD!!!! ;AN000;
439 .ENDIF ;; ;AN000;
440 .ENDIF ;; ;AN000;
441 ;; ;AN000;
442 RET ;; ;AN000;
443 ;; ;AN000;
444LOAD_PROFILE ENDP ;; ;AN000;
445 ;; ;AN000;
446;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
447;; ;AN000;
448;; Module Name: ;AN000;
449;; SHOW_PARSE_ERROR ;AN000;
450;; ;AN000;
451;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
452 ;; ;AN000;
453CARRAIGE_RET EQU 13 ;; ;AN000;
454LINE_FEED EQU 10 ;; ;AN000;
455 ;; ;AN000;
456SHOW_PARSE_ERROR PROC ;; ;AN000;
457 ;; ;AN000;
458 MOV ERROR_DEVICE,STDOUT ;; profile syntax messages to STDOUT ;AN000;
459 ;; ;AN000;
460 .IF <BIT STMT_ERROR AND MISSING> ;AN000;
461 PUSH SI ;; ;AN000;
462 MOV AX,MISSING_STMT ;; ;AN000;
463 MOV CX,1 ;; ;AN000;
464 MOV SI,OFFSET SUBLIST ;; ;AN000;
465 CALL DISP_ERROR ;; ;AN000;
466 POP SI ;; ;AN000;
467 .ENDIF ;; ;AN000;
468 .IF <BIT STMT_ERROR AND INVALID> ;AN000;
469 PUSH SI ;; ;AN000;
470 MOV AX,INVALID_STMT ;; ;AN000;
471 MOV CX,1 ;AN000;
472 MOV SI,OFFSET SUBLIST ;; ;AN000;
473 CALL DISP_ERROR ;; ;AN000;
474 POP SI ;; ;AN000;
475 .ENDIF ;; ;AN000;
476 .IF <BIT STMT_ERROR AND SEQUENCE> ;AN000;
477 PUSH SI ;; ;AN000;
478 MOV AX,OUT_SEQ_STMT ;; ;AN000;
479 MOV CX,1 ;AN000;
480 MOV SI,OFFSET SUBLIST ;; ;AN000;
481 CALL DISP_ERROR ;; ;AN000;
482 POP SI ;; ;AN000;
483 .ENDIF ;; ;AN000;
484 ;; ;AN000;
485 MOV DI,STMT_END_INDEX ;; ;AN000;
486 MOV STMT_BUFFER[DI],'$' ;; For display ;AN000;
487 MOV AH,9 ;; ;AN000;
488 MOV DX,OFFSET STMT_BUFFER ;AN000;
489 INT 21H ;; ;AN000;
490 MOV DL,CARRIAGE_RET ;; ;AN000;
491 MOV AH,2 ;; ;AN000;
492 INT 21H ;; ;AN000;
493 MOV DL,LINE_FEED ;; ;AN000;
494 MOV AH,2 ;; ;AN000;
495 INT 21H ;; ;AN000;
496 ;; ;AN000;
497 MOV ERROR_DEVICE,STDERR ;; reset to STDERR ;AN000;
498 ;; ;AN000;
499 RET ;; ;AN000;
500 ;; ;AN000;
501SHOW_PARSE_ERROR ENDP ;; ;AN000;
502 ;; ;AN000;
503 ;; ;AN000;
504;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
505;; ;AN000;
506;; Module Name: ;AN000;
507;; OPEN_FILE ;AN000;
508;; ;AN000;
509;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
510 ;; ;AN000;
511 ;; ;AN000;
512OPEN_FILE PROC NEAR ;; ;AN000;
513 ;; ;AN000;
514 .IF <PROFILE_PATH NE 0> ;; If a path was specified then ;AN000;
515 MOV DX,OFFSET PROFILE_PATH ;; try and open it ;AN000;
516 MOV AX,3D00H ;; ;AN000;
517 INT 21H ;; Open it ;AN000;
518 .IF C ;; Open error if carry flag set ;AN000;
519 .IF <AX EQ FILE_NOT_FOUND> OR ;; Check for error other than ;AN000;
520 .IF <AX EQ PATH_NOT_FOUND> ;; file not found ;AN000;
521 MOV AX,PROFILE_NOT_FOUND ;; ;AN000;
522 MOV CX,0 ;; ;AN000;
523 CALL DISP_ERROR ;; Issue "File not found" common msg ;AN000;
524 MOV FILE_ERROR,YES ;; ;AN000;
525 .ELSE ;; ;AN000;
526 CALL FILE_ERROR_PROC ;; Issue "Open error" ;AN000;
527 .ENDIF ;; ;AN000;
528 .ELSE ;; ;AN000;
529 MOV HANDLE,AX ;; ;AN000;
530 .ENDIF ;; File opened OK ;AN000;
531 .ELSE ;; No path parameter ;AN000;
532 MOV DX,OFFSET DEFAULT_PATH ;; Try and open "GRAPHICS.PRO" ;AN000;
533 MOV AX,3D00H ;; ;AN000;
534 INT 21H ;; Open it ;AN000;
535 .IF C ;; Open error if carry flag set ;AN000;
536 .IF <AX EQ FILE_NOT_FOUND> OR ;; Check for file not found error ;AN000;
537 .IF <AX EQ PATH_NOT_FOUND> ;; ;AN000;
538 CALL COPY_ARGV0 ;; ;AN000;
539 MOV DX,OFFSET PROFILE_PATH ;; Try and open "GRAPHICS.PRO" in ;AN000;
540 MOV AX,3D00H ;; ARGV0 directory ;AN000;
541 INT 21H ;; ;AN000;
542 .IF C ;; Issue "File not found" common msg ;AN000;
543 .IF <AX EQ FILE_NOT_FOUND> OR ;AN000;
544 .IF <AX EQ PATH_NOT_FOUND> ;AN000;
545 MOV AX,PROFILE_NOT_FOUND ;; ;AN000;
546 MOV CX,0 ;; ;AN000;
547 CALL DISP_ERROR ;; Issue "File not found"common MSG;AN000;
548 MOV FILE_ERROR,YES ;; ;AN000;
549 .ELSE ;; ;AN000;
550 CALL FILE_ERROR_PROC ;; Issue "Open error" ;AN000;
551 .ENDIF ;; ;AN000;
552 .ELSE ;; ;AN000;
553 MOV HANDLE,AX ;; ;AN000;
554 .ENDIF ;; File opened OK ;AN000;
555 .ELSE ;; ;AN000;
556 CALL FILE_ERROR_PROC ;; Issue "Open error" ;AN000;
557 .ENDIF ;; ;AN000;
558 .ELSE ;; ;AN000;
559 MOV HANDLE,AX ;; ;AN000;
560 .ENDIF ;; ;AN000;
561 .ENDIF ;; ;AN000;
562 ;; ;AN000;
563 RET ;; ;AN000;
564OPEN_FILE ENDP ;; ;AN000;
565 ;; ;AN000;
566;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
567;; ;AN000;
568;; Module Name: ;AN000;
569;; COPY_ARGV0 ;AN000;
570;; ;AN000;
571;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
572 ;; ;AN000;
573 ;; ;AN000;
574COPY_ARGV0 PROC ;; ;AN000;
575 ;; ;AN000;
576 PUSH ES ;; ;AN000;
577 PUSH DI ;; ;AN000;
578 PUSH SI ;; ;AN000;
579 ;; ;AN000;
580 MOV DI,2CH ;; Locate environment string ;AN000;
581 MOV ES,[DI] ;; ;AN000;
582 XOR SI,SI ;; ;AN000;
583 .WHILE <<WORD PTR ES:[SI]> NE 0> ;; ;AN000;
584 INC SI ;; ;AN000;
585 .ENDWHILE ;; ;AN000;
586 ADD SI,4 ;; ;AN000;
587 LEA DI,PROFILE_PATH ;; Move string to work area ;AN000;
588 .REPEAT ;; ;AN000;
589 MOV AL,ES:[SI] ;; ;AN000;
590 MOV [DI],AL ;; ;AN000;
591 INC SI ;; ;AN000;
592 INC DI ;; ;AN000;
593 .UNTIL <<BYTE PTR ES:[SI]> EQ 0> ;; ;AN000;
594 MOV BYTE PTR [DI],0 ;; ;AN000;
595 MOV BYTE PTR [DI]-3,"P" ;; Change COM to PRO ;AN000;
596 MOV BYTE PTR [DI]-2,"R" ;; ;AN000;
597 MOV BYTE PTR [DI]-1,"O" ;; ;AN000;
598 ;; ;AN000;
599 POP SI ;; ;AN000;
600 POP DI ;; ;AN000;
601 POP ES ;; ;AN000;
602 RET ;; ;AN000;
603 ;; ;AN000;
604COPY_ARGV0 ENDP ;; ;AN000;
605 ;; ;AN000;
606;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
607;; ;AN000;
608;; Module Name: ;AN000;
609;; FILE_ERROR_PROC ;AN000;
610;; ;AN000;
611;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
612 ;; ;AN000;
613 ;; ;AN000;
614FILE_ERROR_PROC PROC ;; ;AN000;
615 MOV AX,FILE_ERRORS ;; ;AN000;
616 MOV CX,0 ;; ;AN000;
617 CALL DISP_ERROR ;; ;AN000;
618 MOV FILE_ERROR,YES ;; ;AN000;
619 RET ;; ;AN000;
620FILE_ERROR_PROC ENDP ;; ;AN000;
621 ;; ;AN000;
622;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
623;; ;AN000;
624;; Module Name: ;AN000;
625;; GET_STATEMENT ;AN000;
626;; ;AN000;
627;; Input Parameters: ;AN000;
628;; NONE ;AN000;
629;; ;AN000;
630;; Output Parameters: ;AN000;
631;; PROFILE_LINE ;AN000;
632;; RETURN CODE : 0 - successfull read ;AN000;
633;; : 1 - end of file ;AN000;
634;; : 2 - error during read ;AN000;
635;; ;AN000;
636;; ;AN000;
637;; Data Structures Referenced: ;AN000;
638;; ;AN000;
639;; Description: ;AN000;
640;; Get a statement from the profile. ;AN000;
641;; The file read in 512 byte buffers and parsed into ;AN000;
642;; lines by the presence of a carriage return at the end of each line. ;AN000;
643;; ;AN000;
644;; Called By: ;AN000;
645;; LOAD_PROFILE ;AN000;
646;; ;AN000;
647;; External Calls: ;AN000;
648;; NONE ;AN000;
649;; ;AN000;
650;; Logic: ;AN000;
651;; FOUND := FALSE ;AN000;
652;; RETURN_CODE := 0 ;AN000;
653;; WHILE NOT FOUND DO ;AN000;
654;; IF end of buffer THEN ;AN000;
655;; Read next profile record into buffer ;AN000;
656;; IF successful read THEN ;AN000;
657;; point to first byte in buffer ;AN000;
658;; ELSE ;AN000;
659;; IF end of file THEN ;AN000;
660;; Close profile ;AN000;
661;; RETURN_CODE := 1 ;AN000;
662;; FOUND := TRUE ;AN000;
663;; ELSE ;AN000;
664;; RETURN_CODE := 2 ;AN000;
665;; FOUND := TRUE ;AN000;
666;; ENDIF ;AN000;
667;; ENDIF ;AN000;
668;; ENDIF ;AN000;
669;; copy byte to PROFILE_LINE ;AN000;
670;; IF byte in buffer is a CR THEN ;AN000;
671;; FOUND := TRUE ;AN000;
672;; ENDIF ;AN000;
673;; ENDWHILE ;AN000;
674;; RETURN ;AN000;
675;; ;AN000;
676;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
677 ;; ;AN000;
678FOUND DB 0 ;; ;AN000;
679 ;; ;AN000;
680CARRIAGE_RET EQU 13 ;; ;AN000;
681LINE_FEED EQU 10 ;; ;AN000;
682NEXT_BYTE DB 0 ;; Save area for byte just read ;AN000;
683BUFFER_SIZE EQU 512 ;; ;AN000;
684FILE_BUFFER DB 512 DUP(0) ;; ;AN000;
685BUFFER_PTR DW 512 ;; ;AN000;
686BUFFER_END DW 512 ;; ;AN000;
687STMT_BUFFER DB 255 DUP(0) ;; ;AN000;
688 DB ? ;; In case we have to insert a CR ;AN000;
689 DB ? ;; and a LF ;AN000;
690 DB ? ;; Too put the "$" for displaying the ;AN000;
691 ;; line. ;AN000;
692 ;; ;AN000;
693STMT_END_INDEX DW ? ;; ;AN000;
694MAX_STMT_LEN EQU 255 ;; ;AN000;
695CR_FOUND DB 0 ;; 1 if we found a line terminator ;AN000;
696 ;; ;AN000;
697GET_STATEMENT PROC ;; ;AN000;
698 ;; ;AN000;
699 MOV FOUND,NO ;; ;AN000;
700 MOV STMT_ERROR,0 ;; Clear error flags ;AN000;
701 XOR DI,DI ;; Index for extracted statement ;AN000;
702 MOV SI,BUFFER_PTR ;; Init file buffer ptr ;AN000;
703 ;; ;AN000;
704 MOV AL,NEXT_BYTE ;; Restore current byte ;AN000;
705 MOV CR_FOUND,NO ;; ;AN000;
706 ;; ;AN000;
707 ;; ;AN000;
708 .WHILE <FOUND EQ NO> AND ;; Keep parsing until we find a stmt ;AN000;
709 .WHILE <FILE_ERROR EQ NO> AND ;; or a file error occurs ;AN000;
710 .WHILE <END_OF_FILE EQ NO> ;; or we reach end of file ;AN000;
711 .IF <CR_FOUND EQ YES> ;; ;AN000;
712 .IF <AL EQ LINE_FEED> ;; Return the line feed as well ;AN000;
713 .IF <DI NA MAX_STMT_LEN> ;; Truncate lines longer than MAX ;AN000;
714 MOV STMT_BUFFER[DI],AL ;; MOVE TO statement buffer ;AN000;
715 INC DI ;; Point to next byte in file buffr ;AN000;
716 .ELSE ;; ;AN000;
717 OR STMT_ERROR,INVALID ;; Line has been truncated > ERROR ;AN000;
718 MOV PARSE_ERROR,YES ;; ;AN000;
719 MOV BUILD_STATE,NO ;; ;AN000;
720 .ENDIF ;; ;AN000;
721 CALL GET_BYTE ;; Get the first byte of next statement ;AN000;
722 .ENDIF ;; ;AN000;
723 MOV FOUND,YES ;; Time to leave this WHILE ;AN000;
724 MOV NEXT_BYTE,AL ;; Save the byte we just read ;AN000;
725 .ELSE ;; ;AN000;
726 .IF <DI NA MAX_STMT_LEN> ;; Truncate lines longer than MAX ;AN000;
727 MOV STMT_BUFFER[DI],AL ;; move byte to statement buffer ;AN000;
728 INC DI ;; Point to next byte in file buffer ;AN000;
729 .ELSE ;; ;AN000;
730 OR STMT_ERROR,INVALID ;; Line has been truncated > ERROR ;AN000;
731 MOV PARSE_ERROR,YES ;; ;AN000;
732 MOV BUILD_STATE,NO ;; ;AN000;
733 .ENDIF ;; ;AN000;
734 .IF <AL EQ CARRIAGE_RET> ;; Found a line terminator ;AN000;
735 MOV CR_FOUND,YES ;; Indicate carriage return found ;AN000;
736 .ENDIF ;; and go through once more to ;AN000;
737 CALL GET_BYTE ;; check for a line feed ;AN000;
738 .ENDIF ;; ;AN000;
739 .ENDWHILE ;; ;AN000;
740 ;; ;AN000;
741 .IF <STMT_BUFFER[DI-1] NE CARRIAGE_RET> AND ;; ;AN000;
742 .IF <STMT_BUFFER[DI-1] NE LINE_FEED> ;; ;AN000;
743 MOV STMT_BUFFER[DI],CARRIAGE_RET ;; ;AN000;
744 MOV STMT_BUFFER[DI+1],LINE_FEED ;; ;AN000;
745 INC DI ;; ;AN000;
746 INC DI ;; ;AN000;
747 .ENDIF ;; ;AN000;
748 MOV STMT_END_INDEX,DI ;; ;AN000;
749 MOV BUFFER_PTR,SI ;; Save buffer ptr for next time ;AN000;
750 ;; ;AN000;
751 .IF <END_OF_FILE EQ YES> ;; ;AN000;
752 .IF <DI EQ 0> ;; Clear carry if we read something ;AN000;
753 STC ;; and no file error occured otherwise ;AN000;
754 .ELSE ;; set carry indicating unsuccessful ;AN000;
755 CLC ;; get. ;AN000;
756 .ENDIF ;; ;AN000;
757 .ELSE ;; ;AN000;
758 .IF <FILE_ERROR EQ YES> ;; ;AN000;
759 STC ;; ;AN000;
760 .ELSE ;; ;AN000;
761 CLC ;; ;AN000;
762 .ENDIF ;; ;AN000;
763 .ENDIF ;; ;AN000;
764 RET ;; ;AN000;
765 ;; ;AN000;
766GET_STATEMENT ENDP ;; ;AN000;
767 ;; ;AN000;
768 ;; ;AN000;
769;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
770;; ;AN000;
771;; Module Name: ;AN000;
772;; GET_BYTE ;AN000;
773;; ;AN000;
774;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
775 ;; ;AN000;
776GET_BYTE PROC ;; ;AN000;
777 ;; ;AN000;
778 .IF <SI EQ BUFFER_END> ;; If buffer empty do another read ;AN000;
779 MOV AH,3FH ;; ;AN000;
780 MOV DX,OFFSET FILE_BUFFER ;; ;AN000;
781 MOV CX,BUFFER_SIZE ;; ;AN000;
782 MOV BX,HANDLE ;; ;AN000;
783 INT 21H ;; ;AN000;
784 .IF C ;; Carry set by DOS if file error ;AN000;
785 CALL FILE_ERROR_PROC ;; ;AN000;
786 .ELSE ;; ;AN000;
787 .IF <AX EQ 0> ;; End of file if AX=0 ;AN000;
788 MOV END_OF_FILE,YES ;; ;AN000;
789 MOV AH,3EH ;; Close the file ;AN000;
790 MOV BX,HANDLE ;; ;AN000;
791 INT 21H ;; ;AN000;
792 .ELSE ;; ;AN000;
793 MOV BUFFER_END,AX ;; Number of bytes read ;AN000;
794 XOR SI,SI ;; Buffer pointer := 0 ;AN000;
795 .ENDIF ;; ;AN000;
796 .ENDIF ;; ;AN000;
797 .ENDIF ;; ;AN000;
798 ;; ;AN000;
799 .IF <FILE_ERROR EQ YES> OR ;; ;AN000;
800 .IF <END_OF_FILE EQ YES> ;; ;AN000;
801 STC ;; Unsuccessful get ;AN000;
802 .ELSE ;; ;AN000;
803 .IF <<FILE_BUFFER[SI]> EQ 1AH> ;; cHECK for EOF marker ;AN000;
804 MOV END_OF_FILE,YES ;; ;AN000;
805 STC ;; ;AN000;
806 .ELSE ;; ;AN000;
807 MOV AL,FILE_BUFFER[SI] ;; Return byte in AL ;AN000;
808 INC SI ;; ;AN000;
809 CLC ;; Successful get ;AN000;
810 .ENDIF ;; ;AN000;
811 .ENDIF ;; ;AN000;
812 RET ;; ;AN000;
813 ;; ;AN000;
814GET_BYTE ENDP ;; ;AN000;
815 ;; ;AN000;
816 ;; ;AN000;
817;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
818;; ;AN000;
819;; Module Name: ;AN000;
820;; GROW_SHARED_DATA ;AN000;
821;; ;AN000;
822;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
823 ;; ;AN000;
824GROW_SHARED_DATA PROC ;; ;AN000;
825 PUSH BX ;; ;AN000;
826 ADD BLOCK_END,AX ;; Grow the current block by AX ;AN000;
827 MOV BX,BLOCK_END ;; ;AN000;
828 .IF <BX A NB_FREE_BYTES> ;; Check for overflow ;AN000;
829 MOV BUILD_STATE,NO ;; Stop building shared data ;AN000;
830 MOV MEM_OVERFLOW,YES ;; ;AN000;
831 .ENDIF ;; ;AN000;
832 POP BX ;; ;AN000;
833 RET ;; ;AN000;
834GROW_SHARED_DATA ENDP ;; ;AN000;
835 ;; ;AN000;
836;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
837 ;AN000;
838CODE ENDS ;; ;AN000;
839 END ;AN000;
840;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
diff --git a/v4.0/src/CMD/GRAPHICS/GRLOAD.EXT b/v4.0/src/CMD/GRAPHICS/GRLOAD.EXT
new file mode 100644
index 0000000..ab48e9a
--- /dev/null
+++ b/v4.0/src/CMD/GRAPHICS/GRLOAD.EXT
@@ -0,0 +1,55 @@
1.XLIST ;AN000;
2 ;AN000;
3;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
4;; DOS - GRAPHICS Command
5;; (C) Copyright 1988 Microsoft
6;; ;AN000;
7;; File Name: GRLOAD.EXT ;AN000;
8;; ---------- ;AN000;
9;; ;AN000;
10;; Description: ;AN000;
11;; ------------ ;AN000;
12;; External declarations for code and data defined in ;AN000;
13;; GRLOAD.ASM ;AN000;
14;; ;AN000;
15;; Change History: ;AN000;
16;; --------------- ;AN000;
17;; ;AN000;
18;; ;AN000;
19;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
20 ;; ;AN000;
21 EXTRN LOAD_PROFILE:NEAR ;; ;AN000;
22 EXTRN GROW_SHARED_DATA:NEAR ;; ;AN000;
23 EXTRN BLOCK_START:WORD ;AN000;
24 EXTRN BLOCK_END:WORD ;AN000;
25 EXTRN FIRST_BLOCK:WORD ;AN000;
26 EXTRN MAX_BLOCK_END:WORD ;AN000;
27 EXTRN GROUPS_DONE:WORD ;AN000;
28 EXTRN STMTS_DONE:WORD ;AN000;
29PRT EQU 1 ;; ;AN000;
30DISP EQU 2 ;; ;AN000;
31BOX EQU 4 ;; ;AN000;
32GR EQU 8 ;; ;AN000;
33SET EQU 10H ;; ;AN000;
34REST EQU 20H ;; ;AN000;
35COLS EQU 40H ;; ;AN000;
36COLP EQU 80H ;; ;AN000;
37DARK EQU 100H ;; ;AN000;
38 EXTRN PTD_FOUND:BYTE ;AN000;
39 PROCESSED EQU 2 ;; ;AN000;
40 EXTRN BUILD_STATE:BYTE ;AN000;
41 EXTRN STMT_ERROR:BYTE ;AN000;
42MISSING EQU 1 ;; Required statement missing ;AN000;
43INVALID EQU 2 ;; Invalid statement format ;AN000;
44SEQUENCE EQU 4 ;; Statement out of sequence ;AN000;
45 EXTRN FILE_ERROR:BYTE ;AN000;
46 EXTRN PARSE_ERROR:BYTE ;AN000;
47 EXTRN END_OF_FILE:BYTE ;AN000;
48 EXTRN MEM_OVERFLOW:BYTE ;AN000;
49 EXTRN STMT_BUFFER:BYTE ;AN000;
50 EXTRN CUR_STMT:WORD ;AN000;
51 EXTRN PREV_STMT:WORD ;AN000;
52 EXTRN PRT_BOX_ERROR:BYTE ;AN000;
53 ;; ;AN000;
54;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
55.LIST ;AN000;
diff --git a/v4.0/src/CMD/GRAPHICS/GRLOAD2.ASM b/v4.0/src/CMD/GRAPHICS/GRLOAD2.ASM
new file mode 100644
index 0000000..68041ba
--- /dev/null
+++ b/v4.0/src/CMD/GRAPHICS/GRLOAD2.ASM
@@ -0,0 +1,910 @@
1 PAGE ,132 ;AN000;
2 TITLE DOS - GRAPHICS Command - Profile Load Modules #2 ;AN000;
3 ;AN000;
4;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
5;; DOS - GRAPHICS Command
6;; (C) Copyright 1988 Microsoft
7;; ;AN000;
8;; File Name: GRLOAD.ASM ;AN000;
9;; ---------- ;AN000;
10;; ;AN000;
11;; Description: ;AN000;
12;; ------------ ;AN000;
13;; This file contains the modules used to load the ;AN000;
14;; GRAPHICS profile into resident memory. ;AN000;
15;; ;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;
23;; ;AN000;
24;; ;AN000;
25;; Documentation Reference: ;AN000;
26;; ------------------------ ;AN000;
27;; PLACID Functional Specifications ;AN000;
28;; OASIS High Level Design ;AN000;
29;; OASIS GRAPHICS I1 Overview ;AN000;
30;; ;AN000;
31;; Procedures Contained in This File: ;AN000;
32;; ---------------------------------- ;AN000;
33;; LOAD_PROFILE - Main module for profile loading ;AN000;
34;; ;AN000;
35;; Include Files Required: ;AN000;
36;; ----------------------- ;AN000;
37;; ?????????? - Externals for profile loading modules ;AN000;
38;; ;AN000;
39;; External Procedure References: ;AN000;
40;; ------------------------------ ;AN000;
41;; None ;AN000;
42;; ;AN000;
43;; Linkage Instructions: ;AN000;
44;; --------------------- ;AN000;
45;; Refer to GRAPHICS.ASM ;AN000;
46;; ;AN000;
47;; Change History: ;AN000;
48;; --------------- ;AN000;
49;; ;AN000;
50;; ;AN000;
51;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
52 ;; ;AN000;
53 ;; ;AN000;
54CODE SEGMENT PUBLIC 'CODE' BYTE ;; ;AN000;
55 ;; ;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;
66 ;; ;AN000;
67;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
68;; ;AN000;
69;; Public Symbols ;AN000;
70;; ;AN000;
71;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
72 ;; ;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;
82 ;; ;AN000;
83;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
84 ;; ;AN000;
85 ASSUME CS:CODE,DS:CODE ;; ;AN000;
86 ;; ;AN000;
87;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
88 ;; ;AN000;
89 ;; ;AN000;
90;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
91;; ;AN000;
92;; Profile Load Variables ;AN000;
93;; ;AN000;
94;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
95 ;; ;AN000;
96NO EQU 0 ;; ;AN000;
97YES EQU 1 ;; ;AN000;
98 ;; ;AN000;
99RESULT_BUFFER LABEL BYTE ;; general purpose result buffer ;AN000;
100 DB ? ;; operand type ;AN000;
101RESULT_TAG DB 0 ;; operand tag ;AN000;
102 DW ? ;; pointer to synonym/keyword ;AN000;
103RESULT_VAL DB ?,?,?,? ;; returned numeric value ;AN000;
104 ;; ;AN000;
105;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
106;; ;AN000;
107;; Module Name: ;AN000;
108;; TERMINATE_DISPLAYMODE ;AN000;
109;; ;AN000;
110;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
111 ;; ;AN000;
112 ;; ;AN000;
113TERMINATE_DISPLAYMODE PROC ;; ;AN000;
114 ;; ;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;
122 MOV CX,0 ;; ;AN000;
123 CALL DISP_ERROR ;; ;AN000;
124 MOV BUILD_STATE,NO ;; ;AN000;
125 MOV PRT_BOX_ERROR,YES ;; Issue this message only once ;AN000;
126 POP AX ;; ;AN000;
127 .ENDIF ;; ;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;
133 .ENDIF ;; ;AN000;
134 ;; ;AN000;
135 ;; ;AN000;
136 ;; ;AN000;
137 RET ;; ;AN000;
138 ;; ;AN000;
139TERMINATE_DISPLAYMODE ENDP ;; ;AN000;
140 ;; ;AN000;
141;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
142;; ;AN000;
143;; Module Name: ;AN000;
144;; TERMINATE_PRINTER ;AN000;
145;; ;AN000;
146;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
147 ;; ;AN000;
148TERMINATE_PRINTER PROC ;; ;AN000;
149 ;; ;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;
154 ;; type. ;AN000;
155 ;; ;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;
163 .ENDIF ;; ;AN000;
164 ;; ;AN000;
165 RET ;; ;AN000;
166 ;; ;AN000;
167TERMINATE_PRINTER ENDP ;; ;AN000;
168 ;; ;AN000;
169;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
170;; ;AN000;
171;; Module Name: ;AN000;
172;; PARSE_PRINTER ;AN000;
173;; ;AN000;
174;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
175 ;; ;AN000;
176PRINTER_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;
182 ;; ;AN000;
183PRINTER_P DB 0,1 ;; Required, max parms ;AN000;
184 DW PRINTER_P1 ;; ;AN000;
185 DB 0 ;; # Switches ;AN000;
186 DB 0 ;; # keywords ;AN000;
187 ;; ;AN000;
188PRINTER_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;
193 ;; ;AN000;
194PRINTER_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;
199PRINTER_P1V1 DW ? ;; string offset ;AN000;
200 ;; ;AN000;
201 ;; ;AN000;
202CUR_PRINTER_TYPE DB 0 ;; Type of printer currently being ;AN000;
203 ;; parsed: 1-color 2-b&w ;AN000;
204 ;; ;AN000;
205PARSE_PRINTER PROC ;; ;AN000;
206 ;; ;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;
210 ;; ;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;
214 .ENDIF ;; ;AN000;
215 ;; ;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;
219 ;; ;AN000;
220 MOV STMTS_DONE,PRT ;; Clear all bits except for PRT ;AN000;
221 MOV GROUPS_DONE,0 ;; Clear ;AN000;
222 ;; ;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;
226 .ENDIF ;; ;AN000;
227 ;; ;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;
234 .LOOP ;; ;AN000;
235 ;; ;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;
240 XOR DX,DX ;; ;AN000;
241 ;; ;AN000;
242 .REPEAT ;; ;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;
249 .ENDIF ;; ;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;
262 .ENDIF ;; ;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;
268 .ENDIF ;; ;AN000;
269 .ENDIF ;; ;AN000;
270 ;; ;AN000;
271 RET ;AN000;
272 ;; ;AN000;
273PARSE_PRINTER ENDP ;AN000;
274 ;AN000;
275 ;; ;AN000;
276 ;; ;AN000;
277;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
278;; ;AN000;
279;; Module Name: ;AN000;
280;; PARSE_DISPLAYMODE ;AN000;
281;; ;AN000;
282;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
283 ;; ;AN000;
284DISPMODE_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;
290 ;; ;AN000;
291DISPMODE_P DB 0,1 ;; Required, max parms ;AN000;
292 DW DISPMODE_P1 ;; ;AN000;
293 DB 0 ;; # Switches ;AN000;
294 DB 0 ;; # keywords ;AN000;
295 ;; ;AN000;
296DISPMODE_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;
301 ;; ;AN000;
302DISPMODE_P1V DB 1 ;; # of value lists ;AN000;
303 DB 1 ;; # of range numerics ;AN000;
304 DB 1 ;; tag ;AN000;
305 DD 0,19 ;; range 0..19 ;AN000;
306 ;; ;AN000;
307 ;; ;AN000;
308 ;; ;AN000;
309PARSE_DISPLAYMODE PROC ;; ;AN000;
310 ;; ;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;
317 .ENDIF ;; ;AN000;
318 ;; ;AN000;
319 ;; ;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;
325 .ENDIF ;; ;AN000;
326 .ELSE ;; ;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;
333 .ENDIF ;; ;AN000;
334 MOV BLOCK_START,AX ;; New block starts after last one ;AN000;
335 .ENDIF ;; ;AN000;
336 ;; ;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;
352 .ENDIF ;; ;AN000;
353 ;; ;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;
361 XOR DX,DX ;; ;AN000;
362 .REPEAT ;; ;AN000;
363 XOR CX,CX ;; ;AN000;
364 CALL SYSPARSE ;; ;AN000;
365 .IF <AX EQ 0> ;; If mode is valid ;AN000;
366 PUSH AX ;; ;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;
370 PUSH DI ;; ;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;
376 POP DI ;; ;AN000;
377 .ENDIF ;; ;AN000;
378 POP AX ;; ;AN000;
379 .ELSE ;; ;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;
384 .ENDIF ;; ;AN000;
385 .ENDIF ;; ;AN000;
386 .UNTIL <AX EQ -1> ;; ;AN000;
387 ;; ;AN000;
388 RET ;AN000;
389 ;; ;AN000;
390PARSE_DISPLAYMODE ENDP ;AN000;
391 ;AN000;
392 ;; ;AN000;
393;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
394;; ;AN000;
395;; Module Name: ;AN000;
396;; PARSE_SETUP ;AN000;
397;; ;AN000;
398;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
399 ;; ;AN000;
400SETUP_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;
406 ;; ;AN000;
407SETUP_P DB 0,1 ;; Required, max parms ;AN000;
408 DW SETUP_P1 ;; ;AN000;
409 DB 0 ;; # Switches ;AN000;
410 DB 0 ;; # keywords ;AN000;
411 ;; ;AN000;
412SETUP_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;
417 ;; ;AN000;
418 ;; ;AN000;
419SETUP_P1V DB 1 ;; # of value lists ;AN000;
420 DB 1 ;; # of range numerics ;AN000;
421 DB 1 ;; tag ;AN000;
422 DD 0,255 ;; range 0..255 ;AN000;
423 ;; ;AN000;
424 ;; ;AN000;
425PARSE_SETUP PROC ;; ;AN000;
426 ;; ;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;
432 .ENDIF ;; ;AN000;
433 ;; ;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;
438 .ENDIF ;; ;AN000;
439 ;; ;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;
446 .ENDIF ;; ;AN000;
447 .ENDIF ;; ;AN000;
448 ;; ;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;
453 .ENDIF ;; ;AN000;
454 ;; ;AN000;
455 MOV DI,OFFSET SETUP_PARSE_PARMS ;; parse parms ;AN000;
456 ;; SI => the line to parse ;AN000;
457 XOR DX,DX ;; ;AN000;
458 .REPEAT ;; ;AN000;
459 XOR CX,CX ;; ;AN000;
460 CALL SYSPARSE ;; ;AN000;
461 .IF <AX EQ 0> ;; If esc byte is valid ;AN000;
462 PUSH AX ;; ;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;
466 PUSH DI ;; ;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;
472 POP DI ;; ;AN000;
473 .ENDIF ;; ;AN000;
474 POP AX ;; ;AN000;
475 .ELSE ;; ;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;
480 .ENDIF ;; ;AN000;
481 .ENDIF ;; ;AN000;
482 .UNTIL <AX EQ -1> NEAR ;; ;AN000;
483 RET ;; ;AN000;
484 ;; ;AN000;
485PARSE_SETUP ENDP ;; ;AN000;
486 ;AN000;
487 ;; ;AN000;
488;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
489;; ;AN000;
490;; Module Name: ;AN000;
491;; PARSE_RESTORE ;AN000;
492;; ;AN000;
493;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
494 ;; ;AN000;
495RESTORE_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;
501 ;; ;AN000;
502RESTORE_P DB 0,1 ;; Required, max parms ;AN000;
503 DW RESTORE_P1 ;; ;AN000;
504 DB 0 ;; # Switches ;AN000;
505 DB 0 ;; # keywords ;AN000;
506 ;; ;AN000;
507RESTORE_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;
512 ;; ;AN000;
513 ;; ;AN000;
514RESTORE_P1V DB 1 ;; # of value lists ;AN000;
515 DB 1 ;; # of range numerics ;AN000;
516 DB 1 ;; tag ;AN000;
517 DD 0,255 ;; range 0..255 ;AN000;
518 ;; ;AN000;
519 ;; ;AN000;
520PARSE_RESTORE PROC ;; ;AN000;
521 ;; ;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;
527 .ENDIF ;; ;AN000;
528 ;; ;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;
533 .ENDIF ;; ;AN000;
534 ;; ;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;
541 .ENDIF ;; ;AN000;
542 .ENDIF ;; ;AN000;
543 ;; ;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;
548 .ENDIF ;; ;AN000;
549 ;; ;AN000;
550 MOV DI,OFFSET RESTORE_PARSE_PARMS ;; parse parms ;AN000;
551 ;; SI => the line to parse ;AN000;
552 XOR DX,DX ;; ;AN000;
553 .REPEAT ;; ;AN000;
554 XOR CX,CX ;; ;AN000;
555 CALL SYSPARSE ;; ;AN000;
556 .IF <AX EQ 0> ;; If esc byte is valid ;AN000;
557 PUSH AX ;; ;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;
561 PUSH DI ;; ;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;
567 POP DI ;; ;AN000;
568 .ENDIF ;; ;AN000;
569 POP AX ;; ;AN000;
570 .ELSE ;; ;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;
575 .ENDIF ;; ;AN000;
576 .ENDIF ;; ;AN000;
577 .UNTIL <AX EQ -1> NEAR ;; ;AN000;
578 RET ;; ;AN000;
579 ;; ;AN000;
580PARSE_RESTORE ENDP ;; ;AN000;
581 ;AN000;
582 ;; ;AN000;
583;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
584;; ;AN000;
585;; Module Name: ;AN000;
586;; PARSE_PRINTBOX ;AN000;
587;; ;AN000;
588;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
589 ;; ;AN000;
590PRINTBOX_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;
596 ;; ;AN000;
597PRINTBOX_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;
604 ;; ;AN000;
605PRINTBOX_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;
610 ;; ;AN000;
611PRINTBOX_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;
615 DB 1 ;; tag ;AN000;
616PRINTBOX_P0V1 DW ? ;; string ;AN000;
617 ;; ;AN000;
618PRINTBOX_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;
623 ;; ;AN000;
624PRINTBOX_P1V DB 1 ;; # of value lists ;AN000;
625 DB 1 ;; # of range numerics ;AN000;
626 DB 1 ;; tag ;AN000;
627 DD 1,9 ;; range 1..9 ;AN000;
628 ;; ;AN000;
629 ;; ;AN000;
630PRINTBOX_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;
635 ;; ;AN000;
636PRINTBOX_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;
640 DB 1 ;; tag ;AN000;
641 DW ROTATE_STR ;; string ;AN000;
642ROTATE_STR DB 'ROTATE',0 ;; ;AN000;
643 ;; ;AN000;
644 ;; ;AN000;
645PROF_BOX_W DB 0 ;; Box width and height extracted from ;AN000;
646PROF_BOX_H DB 0 ;; the profile ;AN000;
647PRINTBOX_MATCH DB 0 ;; ;AN000;
648 ;; ;AN000;
649 ;; ;AN000;
650PARSE_PRINTBOX PROC ;; ;AN000;
651 ;; ;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;
660 .ENDIF ;; ;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;
667 XOR DX,DX ;; ;AN000;
668 XOR CX,CX ;; ;AN000;
669 ;; ;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;
678 .ENDIF ;; ;AN000;
679 ;; ;AN000;
680 ;; ;AN000;
681 ;; ;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;
686 .ELSE ;; ;AN000;
687 .IF <AX EQ -1> ;; ;AN000;
688 JMP PRINTBOX_DONE ;; ;AN000;
689 .ELSE ;; ;AN000;
690 OR STMT_ERROR,INVALID ;; ;AN000;
691 MOV PARSE_ERROR,YES ;; ;AN000;
692 MOV BUILD_STATE,NO ;; ;AN000;
693 .ENDIF ;; ;AN000;
694 .ENDIF ;; ;AN000;
695 ;; ;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;
700 .ELSE ;; ;AN000;
701 .IF <AX EQ -1> ;; ;AN000;
702 JMP PRINTBOX_DONE ;; ;AN000;
703 .ELSE ;; ;AN000;
704 OR STMT_ERROR,INVALID ;; ;AN000;
705 MOV PARSE_ERROR,YES ;; ;AN000;
706 MOV BUILD_STATE,NO ;; ;AN000;
707 .ENDIF ;; ;AN000;
708 .ENDIF ;; ;AN000;
709 ;; ;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;
714 PUSH DI ;; ;AN000;
715 MOV DI,BLOCK_START ;; ;AN000;
716 OR [BP+DI].PRINT_OPTIONS,ROTATE ;; ;AN000;
717 POP DI ;; ;AN000;
718 .ENDIF ;; ;AN000;
719 .ELSE ;; ;AN000;
720 .IF <AX EQ -1> ;; ;AN000;
721 JMP PRINTBOX_DONE ;; ;AN000;
722 .ELSE ;; ;AN000;
723 OR STMT_ERROR,INVALID ;; ;AN000;
724 MOV PARSE_ERROR,YES ;; ;AN000;
725 MOV BUILD_STATE,NO ;; ;AN000;
726 .ENDIF ;; ;AN000;
727 .ENDIF ;; ;AN000;
728 ;; ;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;
734 .ENDIF ;; ;AN000;
735 ;; ;AN000;
736 ;; ;AN000;
737PRINTBOX_DONE: ;; ;AN000;
738 ;; ;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;
747 POP DI ;; ;AN000;
748 .ENDIF ;; ;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;
753 ;; ;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;
760 XOR CH,CH ;; ;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;
764 .REPEAT ;; ;AN000;
765 .IF <[BX].BOX_W_PAT EQ AL> AND ;; ;AN000;
766 .IF <[BX].BOX_H_PAT EQ AH> ;; ;AN000;
767 .LEAVE ;; ;AN000;
768 .ELSE ;; ;AN000;
769 ADD BX,SIZE TAB_ENTRY ;; ;AN000;
770 .ENDIF ;; ;AN000;
771 .LOOP ;; ;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;
785 .ENDIF ;; ;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;
798 ;; ;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;
811 POP SI ;; ;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;
817 .ENDIF ;; ;AN000;
818 .ENDIF ;; ;AN000;
819 .ENDIF ;; ;AN000;
820 .ENDIF ;; ;AN000;
821 .ENDIF ;; ;AN000;
822 .ENDIF ;; ;AN000;
823 RET ;; ;AN000;
824 ;; ;AN000;
825 ;; ;AN000;
826PARSE_PRINTBOX ENDP ;AN000;
827 ;AN000;
828 ;; ;AN000;
829;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
830;; ;AN000;
831;; Module Name: ;AN000;
832;; PARSE_VERB ;AN000;
833;; ;AN000;
834;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
835 ;; ;AN000;
836VERB_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;
842 ;; ;AN000;
843VERB_P DB 0,1 ;; Required, max parms ;AN000;
844 DW VERB_P1 ;; ;AN000;
845 DB 0 ;; # Switches ;AN000;
846 DB 0 ;; # keywords ;AN000;
847 ;; ;AN000;
848VERB_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;
853 ;; ;AN000;
854VERB_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;
860 DB 2 ;; tag ;AN000;
861 DW DISPLAYMODE_STRING ;; string offset ;AN000;
862 DB 4 ;; tag ;AN000;
863 DW PRINTBOX_STRING ;; string offset ;AN000;
864 DB 6 ;; tag ;AN000;
865 DW SETUP_STRING ;; string offset ;AN000;
866 DB 8 ;; tag ;AN000;
867 DW RESTORE_STRING ;; string offset ;AN000;
868 DB 10 ;; tag ;AN000;
869 DW GRAPHICS_STRING ;; string offset ;AN000;
870 DB 12 ;; tag ;AN000;
871 DW COLORPRINT_STRING ;; string offset ;AN000;
872 DB 14 ;; tag ;AN000;
873 DW COLORSELECT_STRING ;; string offset ;AN000;
874 DB 16 ;; tag ;AN000;
875 DW DARKADJUST_STRING ;; string offset ;AN000;
876PRINTER_STRING DB 'PRINTER',0 ;; ;AN000;
877DISPLAYMODE_STRING DB 'DISPLAYMODE',0 ;; ;AN000;
878PRINTBOX_STRING DB 'PRINTBOX',0 ;; ;AN000;
879SETUP_STRING DB 'SETUP',0 ;; ;AN000;
880RESTORE_STRING DB 'RESTORE',0 ;; ;AN000;
881GRAPHICS_STRING DB 'GRAPHICS',0 ;; ;AN000;
882COLORPRINT_STRING DB 'COLORPRINT',0 ;; ;AN000;
883COLORSELECT_STRING DB 'COLORSELECT',0 ;; ;AN000;
884DARKADJUST_STRING DB 'DARKADJUST',0 ;; ;AN000;
885 ;; ;AN000;
886 ;; ;AN000;
887PARSE_VERB PROC ;; ;AN000;
888 ;; ;AN000;
889 MOV DI,OFFSET VERB_PARSE_PARMS ;; parse parms ;AN000;
890 MOV SI,OFFSET STMT_BUFFER ;; the line to parse ;AN000;
891 XOR DX,DX ;; ;AN000;
892 XOR CX,CX ;; ;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;
897 .ELSE ;; ;AN000;
898 .IF <AX NE -1> ;; syntax error ;AN000;
899 OR STMT_ERROR,INVALID ;; set error flag for caller ;AN000;
900 .ENDIF ;; ;AN000;
901 .ENDIF ;; ;AN000;
902 RET ;AN000;
903PARSE_VERB ENDP ;AN000;
904 ;; ;AN000;
905;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
906 ;AN000;
907LIMIT LABEL NEAR ;; ;AN000;
908CODE ENDS ;; ;AN000;
909 END ;AN000;
910;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
diff --git a/v4.0/src/CMD/GRAPHICS/GRLOAD2.EXT b/v4.0/src/CMD/GRAPHICS/GRLOAD2.EXT
new file mode 100644
index 0000000..7c4d04f
--- /dev/null
+++ b/v4.0/src/CMD/GRAPHICS/GRLOAD2.EXT
@@ -0,0 +1,32 @@
1.XLIST ;AN000;
2 ;AN000;
3;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
4;; DOS - GRAPHICS Command
5;; (C) Copyright 1988 Microsoft
6;; ;AN000;
7;; File Name: GRINST.EXT ;AN000;
8;; ---------- ;AN000;
9;; ;AN000;
10;; Description: ;AN000;
11;; ------------ ;AN000;
12;; External declarations for code and data defined in ;AN000;
13;; GRLOAD.ASM ;AN000;
14;; ;AN000;
15;; Change History: ;AN000;
16;; --------------- ;AN000;
17;; ;AN000;
18;; ;AN000;
19;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
20 ;; ;AN000;
21 EXTRN PARSE_VERB:NEAR ;; ;AN000;
22 EXTRN PARSE_PRINTER:NEAR ;; ;AN000;
23 EXTRN PARSE_DISPLAYMODE:NEAR ;; ;AN000;
24 EXTRN PARSE_PRINTBOX:NEAR ;; ;AN000;
25 EXTRN PARSE_SETUP:NEAR ;; ;AN000;
26 EXTRN PARSE_RESTORE:NEAR ;; ;AN000;
27 EXTRN TERMINATE_PRINTER:NEAR ;; ;AN000;
28 EXTRN TERMINATE_DISPLAYMODE:NEAR ;; ;AN000;
29 EXTRN CUR_PRINTER_TYPE:BYTE ;; ;AN000;
30 ;; ;AN000;
31;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
32.LIST ;AN000;
diff --git a/v4.0/src/CMD/GRAPHICS/GRLOAD3.ASM b/v4.0/src/CMD/GRAPHICS/GRLOAD3.ASM
new file mode 100644
index 0000000..ce9d1d4
--- /dev/null
+++ b/v4.0/src/CMD/GRAPHICS/GRLOAD3.ASM
@@ -0,0 +1,729 @@
1 PAGE ,132 ;AN000;
2 TITLE DOS - GRAPHICS Command - Profile Load Modules #2 ;AN000;
3 ;AN000;
4;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
5;; DOS - GRAPHICS Command
6;; (C) Copyright 1988 Microsoft
7;; ;AN000;
8;; File Name: GRLOAD.ASM ;AN000;
9;; ---------- ;AN000;
10;; ;AN000;
11;; Description: ;AN000;
12;; ------------ ;AN000;
13;; This file contains the modules used to load the ;AN000;
14;; GRAPHICS profile into resident memory. ;AN000;
15;; ;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;
23;; ;AN000;
24;; ;AN000;
25;; Documentation Reference: ;AN000;
26;; ------------------------ ;AN000;
27;; PLACID Functional Specifications ;AN000;
28;; OASIS High Level Design ;AN000;
29;; OASIS GRAPHICS I1 Overview ;AN000;
30;; ;AN000;
31;; Procedures Contained in This File: ;AN000;
32;; ---------------------------------- ;AN000;
33;; LOAD_PROFILE - Main module for profile loading ;AN000;
34;; ;AN000;
35;; Include Files Required: ;AN000;
36;; ----------------------- ;AN000;
37;; ?????????? - Externals for profile loading modules ;AN000;
38;; ;AN000;
39;; External Procedure References: ;AN000;
40;; ------------------------------ ;AN000;
41;; None ;AN000;
42;; ;AN000;
43;; Linkage Instructions: ;AN000;
44;; --------------------- ;AN000;
45;; Refer to GRAPHICS.ASM ;AN000;
46;; ;AN000;
47;; Change History: ;AN000;
48;; --------------- ;AN000;
49;; ;AN000;
50;; ;AN000;
51;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
52 ;; ;AN000;
53 ;; ;AN000;
54CODE SEGMENT PUBLIC 'CODE' BYTE ;; ;AN000;
55 ;; ;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 GRLOAD2.EXT ;; ;AN000;
64 INCLUDE GRPARSE.EXT ;; ;AN000;
65 INCLUDE GRPATTRN.STR ;; ;AN000;
66 INCLUDE GRPATTRN.EXT ;; ;AN000;
67 ;; ;AN000;
68;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
69;; ;AN000;
70;; Public Symbols ;AN000;
71;; ;AN000;
72;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
73 ;; ;AN000;
74 PUBLIC PARSE_GRAPHICS ;; ;AN000;
75 PUBLIC PARSE_COLORSELECT ;; ;AN000;
76 PUBLIC PARSE_COLORPRINT ;; ;AN000;
77 PUBLIC PARSE_DARKADJUST ;; ;AN000;
78 PUBLIC LIMIT ;; ;AN000;
79 ;; ;AN000;
80;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
81 ;; ;AN000;
82 ASSUME CS:CODE,DS:CODE ;; ;AN000;
83 ;; ;AN000;
84;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
85 ;; ;AN000;
86 ;; ;AN000;
87;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
88;; ;AN000;
89;; Profile Load Variables ;AN000;
90;; ;AN000;
91;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
92 ;; ;AN000;
93NO EQU 0 ;; ;AN000;
94YES EQU 1 ;; ;AN000;
95 ;; ;AN000;
96RESULT_BUFFER LABEL BYTE ;; general purpose result buffer ;AN000;
97 DB ? ;; operand type ;AN000;
98RESULT_TAG DB 0 ;; operand tag ;AN000;
99 DW ? ;; pointer to synonym/keyword ;AN000;
100RESULT_VAL DB ?,?,?,? ;; returned numeric value ;AN000;
101 ;; ;AN000;
102 ;; ;AN000;
103 ;; ;AN000;
104;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
105;; ;AN000;
106;; Module Name: ;AN000;
107;; PARSE_GRAPHICS ;AN000;
108;; ;AN000;
109;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
110 ;; ;AN000;
111GRAPHICS_PARSE_PARMS LABEL WORD ;; Parser control blocks ;AN000;
112 DW GRAPHICS_P ;; ;AN000;
113 DB 2 ;; # of lists ;AN000;
114 DB 0 ;; # items in delimeter list ;AN000;
115 DB 1 ;; # items in end-of-line list ;AN000;
116 DB ';' ;; ';' used for comments ;AN000;
117 ;; ;AN000;
118GRAPHICS_P DB 0,1 ;; Required, max parms ;AN000;
119 DW GRAPHICS_P1 ;; ;AN000;
120 DB 0 ;; # Switches ;AN000;
121 DB 0 ;; # keywords ;AN000;
122 ;; ;AN000;
123GRAPHICS_P1 DW 0A000H ;; Numeric OR string ;AN000;
124 DW 2 ;; Capitalize ;AN000;
125 DW RESULT_BUFFER ;; Result buffer ;AN000;
126 DW GRAPHICS_P1V ;; Value list ;AN000;
127 DB 0 ;; Synomyms ;AN000;
128 ;; ;AN000;
129 ;; ;AN000;
130GRAPHICS_P1V DB 3 ;; # of value lists ;AN000;
131 DB 1 ;; # of range numerics ;AN000;
132 DB 1 ;; tag ;AN000;
133 DD 0,255 ;; range 0..255 ;AN000;
134 DB 0 ;; 0 - no actual numerics ;AN000;
135 DB 2 ;; 2 STRING VALUES ;AN000;
136 DB 2 ;; tag ;AN000;
137 DW LOWCOUNT_STR ;; ptr ;AN000;
138 DB 3 ;; tag ;AN000;
139 DW HIGHCOUNT_STR ;; ptr ;AN000;
140 ;; ;AN000;
141lowcount_str db 'LOWCOUNT',0 ;; ;AN000;
142HIGHcount_str db 'HIGHCOUNT',0 ;; ;AN000;
143 ;; ;AN000;
144 ;; ;AN000;
145LOWCOUNT_FOUND DB NO ;; ;AN000;
146HIGHCOUNT_FOUND DB NO ;; ;AN000;
147 ;; ;AN000;
148 ;; ;AN000;
149PARSE_GRAPHICS PROC ;; ;AN000;
150 ;; ;AN000;
151 MOV CUR_STMT,GR ;; ;AN000;
152 .IF <BIT STMTS_DONE NAND DISP> ;; ;AN000;
153 OR STMT_ERROR,MISSING ;; ;AN000;
154 MOV PARSE_ERROR,YES ;; ;AN000;
155 MOV BUILD_STATE,NO ;; ;AN000;
156 .ENDIF ;; ;AN000;
157 ;; ;AN000;
158 .IF <BUILD_STATE EQ YES> ;; ;AN000;
159 MOV DI,BLOCK_START ;; ;AN000;
160 MOV AX,BLOCK_END ;; ;AN000;
161 MOV [BP+DI].GRAPHICS_ESC_PTR,AX ;; Set pointer to GRAPHICS seq ;AN000;
162 MOV [BP+DI].NUM_GRAPHICS_ESC,0 ;; Init sequence size ;AN000;
163 .ENDIF ;; ;AN000;
164 ;; ;AN000;
165 MOV LOWCOUNT_FOUND,NO ;; Flags to indicate whether the LOW ;AN000;
166 MOV HIGHCOUNT_FOUND,NO ;; and HIGHCOUNT parms were found ;AN000;
167 ;; ;AN000;
168 OR STMTS_DONE,GR ;; Indicate GRAPHICS found ;AN000;
169 ;; ;AN000;
170 MOV AX,PREV_STMT ;; Terminate any preceeding groups ;AN000;
171 OR GROUPS_DONE,AX ;; ;AN000;
172 ;; ;AN000;
173 MOV DI,OFFSET GRAPHICS_PARSE_PARMS ;; parse parms ;AN000;
174 ;; SI => the line to parse ;AN000;
175 XOR DX,DX ;; ;AN000;
176 .REPEAT ;; ;AN000;
177 XOR CX,CX ;; ;AN000;
178 CALL SYSPARSE ;; ;AN000;
179 ;; ;AN000;
180 .IF <AX EQ 0> NEAR ;; If PARM is valid ;AN000;
181 MOV BL,RESULT_TAG ;; ;AN000;
182 .SELECT ;; ;AN000;
183 .WHEN <BL EQ 1> ;; Escape byte ;AN000;
184 PUSH AX ;; ;AN000;
185 MOV AX,1 ;; Add a byte to the sequence ;AN000;
186 CALL GROW_SHARED_DATA ;; Update block end ;AN000;
187 .IF <BUILD_STATE EQ YES> ;; ;AN000;
188 PUSH DI ;; ;AN000;
189 MOV DI,BLOCK_START ;; ;AN000;
190 INC [BP+DI].NUM_GRAPHICS_ESC ;; Bump number of bytes in sequence ;AN000;
191 MOV DI,BLOCK_END ;; ;AN000;
192 MOV AL,RESULT_VAL ;; Get esc byte from result buffer ;AN000;
193 MOV [BP+DI-1],AL ;; Store at end of sequence ;AN000;
194 POP DI ;; ;AN000;
195 .ENDIF ;; ;AN000;
196 POP AX ;; ;AN000;
197 .WHEN <BL EQ 2> ;; LOWCOUNT ;AN000;
198 .IF <LOWCOUNT_FOUND EQ NO> ;; ;AN000;
199 MOV LOWCOUNT_FOUND,YES ;; ;AN000;
200 PUSH AX ;; ;AN000;
201 MOV AX,1 ;; Add a byte to the sequence ;AN000;
202 CALL GROW_SHARED_DATA ;; Update block end ;AN000;
203 .IF <BUILD_STATE EQ YES> ;; ;AN000;
204 PUSH DI ;; ;AN000;
205 MOV DI,BLOCK_START ;; ;AN000;
206 INC [BP+DI].NUM_GRAPHICS_ESC ;; Bump number of bytes in seq. ;AN000;
207 MOV AX,BLOCK_END ;; Save pointer to low byte ;AN000;
208 DEC AX ;; ;AN000;
209 MOV [BP+DI].LOW_BYT_COUNT_PTR,AX ;AN000;
210 MOV DI,AX ;; ;AN000;
211 MOV BYTE PTR[BP+DI],0 ;; Store 0 in place of count ;AN000;
212 POP DI ;; ;AN000;
213 .ENDIF ;; ;AN000;
214 POP AX ;; ;AN000;
215 ;; ;AN000;
216 .ELSE ;; ;AN000;
217 OR STMT_ERROR,INVALID ;; Duplicate LOWCOUNT parms ;AN000;
218 MOV PARSE_ERROR,YES ;; ;AN000;
219 MOV BUILD_STATE,NO ;; ;AN000;
220 .ENDIF ;; ;AN000;
221 .WHEN <BL EQ 3> ;; HIGHCOUNT ;AN000;
222 .IF <HIGHCOUNT_FOUND EQ NO> ;; ;AN000;
223 MOV HIGHCOUNT_FOUND,YES ;; ;AN000;
224 PUSH AX ;; ;AN000;
225 MOV AX,1 ;; Add a byte to the sequence ;AN000;
226 CALL GROW_SHARED_DATA ;; Update block end ;AN000;
227 .IF <BUILD_STATE EQ YES> ;; ;AN000;
228 PUSH DI ;; ;AN000;
229 MOV DI,BLOCK_START ;; ;AN000;
230 INC [BP+DI].NUM_GRAPHICS_ESC ;; Bump number of bytes in sequen;AN000;
231 MOV AX,BLOCK_END ;; Save pointer to high byte ;AN000;
232 DEC AX ;; Block end always points 1 ahead ;AN000;
233 MOV [BP+DI].HGH_BYT_COUNT_PTR,AX ;AN000;
234 MOV DI,AX ;; ;AN000;
235 MOV BYTE PTR[BP+DI],0 ;; Store 0 in place of count ;AN000;
236 POP DI ;; ;AN000;
237 .ENDIF ;; ;AN000;
238 POP AX ;; ;AN000;
239 .ELSE ;; ;AN000;
240 OR STMT_ERROR,INVALID ;; Duplicate HIGHCOUNT parms ;AN000;
241 MOV PARSE_ERROR,YES ;; ;AN000;
242 MOV BUILD_STATE,NO ;; ;AN000;
243 .ENDIF ;; ;AN000;
244 .ENDSELECT ;; ;AN000;
245 .ELSE NEAR ;; ;AN000;
246 .IF <AX NE -1> ;; ;AN000;
247 OR STMT_ERROR,INVALID ;; parm is invalid ;AN000;
248 MOV PARSE_ERROR,YES ;; ;AN000;
249 MOV BUILD_STATE,NO ;; ;AN000;
250 .ENDIF ;; ;AN000;
251 .ENDIF ;; ;AN000;
252 .UNTIL <AX EQ -1> NEAR ;; ;AN000;
253 ;; ;AN000;
254 .IF <LOWCOUNT_FOUND EQ NO> OR ;; ;AN000;
255 .IF <HIGHCOUNT_FOUND EQ NO> ;; Missing LOWCOUNT/HIGHCOUNT parms ;AN000;
256 OR STMT_ERROR,INVALID ;; ;AN000;
257 MOV PARSE_ERROR,YES ;; ;AN000;
258 MOV BUILD_STATE,NO ;; ;AN000;
259 .ENDIF ;; ;AN000;
260 ;; ;AN000;
261 RET ;; ;AN000;
262 ;; ;AN000;
263PARSE_GRAPHICS ENDP ;; ;AN000;
264 ;; ;AN000;
265;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
266;; ;AN000;
267;; Module Name: ;AN000;
268;; PARSE_COLORSELECT ;AN000;
269;; ;AN000;
270;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
271 ;; ;AN000;
272COLORSELECT_PARSE_PARMS LABEL WORD ;; Parser control blocks ;AN000;
273 DW COLORSELECT_P ;; ;AN000;
274 DB 2 ;; # of lists ;AN000;
275 DB 0 ;; # items in delimeter list ;AN000;
276 DB 1 ;; # items in end-of-line list ;AN000;
277 DB ';' ;; ';' used for comments ;AN000;
278 ;; ;AN000;
279 ;; ;AN000;
280COLORSELECT_P LABEL BYTE ;; ;AN000;
281CS_NUM_REQ DB 1,1 ;; Required, max parms ;AN000;
282COLORSELECT_PARM LABEL WORD ;; ;AN000;
283CS_POSITIONAL DW ? ;; Pointer to our positional ;AN000;
284 DB 0 ;; # Switches ;AN000;
285 DB 0 ;; # keywords ;AN000;
286 ;; ;AN000;
287COLORSELECT_P0 DW 2000H ;; sTRING - display type ;AN000;
288 DW 2 ;; Capitalize ;AN000;
289 DW RESULT_BUFFER ;; Result buffer ;AN000;
290 DW COLORSELECT_P0V ;; Value list ;AN000;
291 DB 0 ;; Synomyms ;AN000;
292 ;; ;AN000;
293COLORSELECT_P0V DB 0 ;; # of value lists ;AN000;
294; DB 0 ;; # of range numerics ;AN000;
295; DB 0 ;; # of discrete numerics ;AN000;
296; DB 1 ;; # of strings ;AN000;
297; DB 1 ;; tag ;AN000;
298;COLORSELECT_P0V1 DW ? ;; string ;AN000;
299 ;; ;AN000;
300COLORSELECT_P1 DW 8001H ;; Numeric - escape sequence byte ;AN000;
301 DW 0 ;; No Capitalize ;AN000;
302 DW RESULT_BUFFER ;; Result buffer ;AN000;
303 DW COLORSELECT_P1V ;; Value list ;AN000;
304 DB 0 ;; Synomyms ;AN000;
305 ;; ;AN000;
306COLORSELECT_P1V DB 1 ;; # of value lists ;AN000;
307 DB 1 ;; # of range numerics ;AN000;
308 DB 1 ;; tag ;AN000;
309 DD 1,255 ;; range 1..255 ;AN000;
310 ;; ;AN000;
311 ;; ;AN000;
312 ;; ;AN000;
313SEQ_LENGTH_PTR DW 0 ;; Number of colorselect statements ;AN000;
314 ;; ;AN000;
315 ;; ;AN000;
316 ;; ;AN000;
317PARSE_COLORSELECT PROC ;; ;AN000;
318 ;; ;AN000;
319 MOV CUR_STMT,COLS ;; ;AN000;
320 .IF <BIT STMTS_DONE NAND PRT> ;; PRINTER statemnet must have been ;AN000;
321 OR STMT_ERROR,MISSING ;; processed ;AN000;
322 MOV PARSE_ERROR,YES ;; ;AN000;
323 MOV BUILD_STATE,NO ;; ;AN000;
324 .ENDIF ;; ;AN000;
325 ;; ;AN000;
326 .IF <BIT STMTS_DONE AND DISP+COLP> ;; DISDPLAYMODE and COLORPRINT stmts ;AN000;
327 OR STMT_ERROR,SEQUENCE ;; should NOT have been processed ;AN000;
328 MOV PARSE_ERROR,YES ;; ;AN000;
329 MOV BUILD_STATE,NO ;; ;AN000;
330 .ENDIF ;; ;AN000;
331 ;; ;AN000;
332 .IF <BIT GROUPS_DONE AND COLS> ;; Check for a previous group of ;AN000;
333 OR STMT_ERROR,SEQUENCE ;; COLORSELECTS within this PTD ;AN000;
334 MOV PARSE_ERROR,YES ;; ;AN000;
335 MOV BUILD_STATE,NO ;; ;AN000;
336 .ENDIF ;; ;AN000;
337 ;; ;AN000;
338 .IF <BIT STMTS_DONE NAND COLS> ;; If first COLORSELECT... ;AN000;
339 MOV NUM_BANDS,0 ;; Init number of COLORSELECT bands ;AN000;
340 .IF <BUILD_STATE EQ YES> ;; Update count and pointer in the ;AN000;
341 MOV AX,BLOCK_END ;; Shared Data Area header ;AN000;
342 MOV [BP].COLORSELECT_PTR,AX ;; Set pointer to COLORSELECT info ;AN000;
343 MOV [BP].NUM_PRT_BANDS,0 ;; Init NUMBER OF COLORSELECTS ;AN000;
344 .ENDIF ;; ;AN000;
345 .ENDIF ;; ;AN000;
346 ;; ;AN000;
347 OR STMTS_DONE,COLS ;; Indicate found ;AN000;
348 .IF <PREV_STMT NE COLS> THEN ;; Terminate any preceeding groups ;AN000;
349 MOV AX,PREV_STMT ;; except for COLORSELECT ;AN000;
350 OR GROUPS_DONE,AX ;; ;AN000;
351 .ENDIF ;; ;AN000;
352 ;; ;AN000;
353 MOV AX,1 ;; Make room for sequence length field ;AN000;
354 CALL GROW_SHARED_DATA ;; ;AN000;
355 .IF <BUILD_STATE EQ YES> ;; ;AN000;
356 INC [BP].NUM_PRT_BANDS ;; Inc number of selects ;AN000;
357 MOV DI,BLOCK_END ;; ;AN000;
358 MOV BYTE PTR [BP+DI-1],0 ;; Init sequence length field ;AN000;
359 LEA AX,[DI-1] ;; ;AN000;
360 MOV SEQ_LENGTH_PTR,AX ;; Save pointer to length of sequence ;AN000;
361 .ENDIF ;; ;AN000;
362 ;; ;AN000;
363 MOV DI,OFFSET COLORSELECT_PARSE_PARMS ;; parse parms ;AN000;
364 MOV CS_NUM_REQ,1 ;; Change to 1 required parameters ;AN000;
365 MOV AX,OFFSET COLORSELECT_P0 ;; Point to control block for the band ;AN000;
366 MOV CS_POSITIONAL,AX ;; ID. (Dealing with only 1 positional ;AN000;
367 ;; parameter at a time was the only way ;AN000;
368 ;; I could get SYSPARSE to handle ;AN000;
369 ;; the COLORSELECT syntax!) ;AN000;
370 ;; SI => the line to parse ;AN000;
371 XOR DX,DX ;; ;AN000;
372 XOR CX,CX ;; ;AN000;
373 ;; ;AN000;
374 CALL SYSPARSE ;; PARSE the band ID ;AN000;
375 .IF <AX NE 0> ;; ;AN000;
376 OR STMT_ERROR,INVALID ;; ;AN000;
377 MOV PARSE_ERROR,YES ;; ;AN000;
378 MOV BUILD_STATE,NO ;; ;AN000;
379 RET ;; statement. ;AN000;
380 .ENDIF ;; ;AN000;
381 ;; ;AN000;
382 PUSH ES ;; We got a band id........ ;AN000;
383 PUSH DI ;; ;AN000;
384 ;; ;AN000;
385 LES DI,DWORD PTR RESULT_VAL ;; Get pointer to the parsed band id ;AN000;
386 .IF <<BYTE PTR ES:[DI+1]> NE 0> ;; Make sure the band id is only ;AN000;
387 OR STMT_ERROR,INVALID ;; one byte long ;AN000;
388 MOV PARSE_ERROR,YES ;; ;AN000;
389 MOV BUILD_STATE,NO ;; ;AN000;
390 .ENDIF ;; ;AN000;
391 ;; ;AN000;
392 MOV BL,NUM_BANDS ;; ;AN000;
393 XOR BH,BH ;; ;AN000;
394 .IF <BX EQ MAX_BANDS> THEN ;; Watch out for too many COLORSELECTs ;AN000;
395 OR STMT_ERROR,SEQUENCE ;; ;AN000;
396 MOV PARSE_ERROR,YES ;; ;AN000;
397 MOV BUILD_STATE,NO ;; ;AN000;
398 .ELSE ;; ;AN000;
399 SHL BX,1 ;; calc index to store band in value list;AN000;
400 MOV AL,ES:[DI] ;; get BAND ID FROM PARSEr ;AN000;
401 MOV BAND_VAL_LIST[BX],AL ;; ;AN000;
402 INC NUM_BANDS ;; bump number of bands ;AN000;
403 .ENDIF ;; ;AN000;
404 ;; ;AN000;
405 POP DI ;; ;AN000;
406 POP ES ;; ;AN000;
407 ;; ;AN000;
408 ;; ;AN000;
409 MOV AX,OFFSET COLORSELECT_P1 ;; Switch to numeric positional parm!!! ;AN000;
410 MOV CS_POSITIONAL,AX ;; ;AN000;
411 MOV CS_NUM_REQ,0 ;; Change to 0 required parameters ;AN000;
412 XOR DX,DX ;; PARSE the sequence of escape bytes ;AN000;
413 .REPEAT ;; ;AN000;
414 XOR CX,CX ;; ;AN000;
415 CALL SYSPARSE ;; ;AN000;
416 .IF <AX EQ 0> ;; If esc byte is valid ;AN000;
417 PUSH AX ;; ;AN000;
418 MOV AX,1 ;; Add a byte to the sequence ;AN000;
419 CALL GROW_SHARED_DATA ;; Update block end ;AN000;
420 .IF <BUILD_STATE EQ YES> ;; ;AN000;
421 PUSH DI ;; ;AN000;
422 MOV DI,SEQ_LENGTH_PTR ;; ;AN000;
423 INC byte ptr [BP+DI] ;; Bump number of bytes in sequence ;AN000;
424 MOV DI,BLOCK_END ;; ;AN000;
425 MOV AL,RESULT_VAL ;; Get esc byte from result buffer ;AN000;
426 MOV [BP+DI-1],AL ;; Store at end of sequence ;AN000;
427 POP DI ;; ;AN000;
428 .ENDIF ;; ;AN000;
429 POP AX ;; ;AN000;
430 .ELSE ;; ;AN000;
431 .IF <AX NE -1> ;; ;AN000;
432 OR STMT_ERROR,INVALID ;; parm is invalid ;AN000;
433 MOV PARSE_ERROR,YES ;; ;AN000;
434 MOV BUILD_STATE,NO ;; ;AN000;
435 .ENDIF ;; ;AN000;
436 .ENDIF ;; ;AN000;
437 .UNTIL <AX EQ -1> NEAR ;; ;AN000;
438 ;; ;AN000;
439 ;; ;AN000;
440 RET ;; ;AN000;
441 ;; ;AN000;
442PARSE_COLORSELECT ENDP ;; ;AN000;
443 ;; ;AN000;
444;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
445;; ;AN000;
446;; Module Name: ;AN000;
447;; PARSE_COLORPRINT ;AN000;
448;; ;AN000;
449;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
450 ;; ;AN000;
451COLORPRINT_PARSE_PARMS LABEL WORD ;; Parser control blocks ;AN000;
452 DW COLORPRINT_P ;; ;AN000;
453 DB 2 ;; # of lists ;AN000;
454 DB 0 ;; # items in delimeter list ;AN000;
455 DB 1 ;; # items in end-of-line list ;AN000;
456 DB ';' ;; ';' used for comments ;AN000;
457 ;; ;AN000;
458 ;; ;AN000;
459COLORPRINT_P LABEL BYTE ;; ;AN000;
460 DB 3,4 ;; Required,MAX ;AN000;
461 DW COLORPRINT_P0 ;; Numeric: Red value ;AN000;
462 DW COLORPRINT_P0 ;; Green value ;AN000;
463 DW COLORPRINT_P0 ;; Blue value ;AN000;
464 DW COLORPRINT_P1 ;; Band ID ... REPEATING ;AN000;
465 DB 0 ;; # Switches ;AN000;
466 DB 0 ;; # keywords ;AN000;
467 ;; ;AN000;
468COLORPRINT_P0 DW 8000H ;; Numeric - RGB value ;AN000;
469 DW 0 ;; No Capitalize ;AN000;
470 DW RESULT_BUFFER ;; Result buffer ;AN000;
471 DW COLORPRINT_P0V ;; Value list ;AN000;
472 DB 0 ;; Synomyms ;AN000;
473 ;; ;AN000;
474COLORPRINT_P0V DB 1 ;; # of value lists ;AN000;
475 DB 1 ;; # of range numerics ;AN000;
476 DB 1 ;; tag ;AN000;
477 DD 0,63 ;; range 0..63 ;AN000;
478 ;; ;AN000;
479COLORPRINT_P1 DW 2001H ;; sTRING - Band ID ;AN000;
480 DW 2 ;; Capitalize ;AN000;
481 DW RESULT_BUFFER ;; Result buffer ;AN000;
482 DW COLORPRINT_P1V ;; Value list ;AN000;
483 DB 0 ;; Synomyms ;AN000;
484 ;; ;AN000;
485COLORPRINT_P1V DB 3 ;; # of value lists ;AN000;
486 DB 0 ;; 0 - no range numerics ;AN000;
487 DB 0 ;; 0 - no actual numerics ;AN000;
488NUM_BANDS DB 0 ;; number of band values ;AN000;
489 DB 01H ;; tag: TAGS ARE BAND MASKS ;AN000;
490 DW BAND_PTR_1 ;; ptr ;AN000;
491 DB 02H ;; tag ;AN000;
492 DW BAND_PTR_2 ;; ptr ;AN000;
493 DB 04H ;; tag ;AN000;
494 DW BAND_PTR_3 ;; ptr ;AN000;
495 DB 08H ;; tag ;AN000;
496 DW BAND_PTR_4 ;; ptr ;AN000;
497 DB 10H ;; tag ;AN000;
498 DW BAND_PTR_5 ;; ptr ;AN000;
499 DB 20H ;; tag ;AN000;
500 DW BAND_PTR_6 ;; ptr ;AN000;
501 DB 40H ;; tag ;AN000;
502 DW BAND_PTR_7 ;; ptr ;AN000;
503 DB 80H ;; tag ;AN000;
504 DW BAND_PTR_8 ;; ptr ;AN000;
505 ;; ;AN000;
506MAX_BANDS EQU 8 ;; ;AN000;
507 ;; ;AN000;
508BAND_VAL_LIST LABEL BYTE ;; ;AN000;
509BAND_PTR_1 DB ?,0 ;; ;AN000;
510BAND_PTR_2 DB ?,0 ;; ;AN000;
511BAND_PTR_3 DB ?,0 ;; ;AN000;
512BAND_PTR_4 DB ?,0 ;; ;AN000;
513BAND_PTR_5 DB ?,0 ;; ;AN000;
514BAND_PTR_6 DB ?,0 ;; ;AN000;
515BAND_PTR_7 DB ?,0 ;; ;AN000;
516BAND_PTR_8 DB ?,0 ;; ;AN000;
517 ;; ;AN000;
518 ;; ;AN000;
519PARSE_COLORPRINT PROC ;; ;AN000;
520 ;; ;AN000;
521 MOV CUR_STMT,COLP ;; ;AN000;
522 .IF <BIT STMTS_DONE NAND PRT> ;; PRINTER statemnet must have been ;AN000;
523 OR STMT_ERROR,MISSING ;; processed ;AN000;
524 MOV PARSE_ERROR,YES ;; ;AN000;
525 MOV BUILD_STATE,NO ;; ;AN000;
526 .ENDIF ;; ;AN000;
527 ;; ;AN000;
528 .IF <BIT STMTS_DONE AND DISP> ;; DISPLAYMODE stmts ;AN000;
529 OR STMT_ERROR,SEQUENCE ;; should NOT have been processed ;AN000;
530 MOV PARSE_ERROR,YES ;; ;AN000;
531 MOV BUILD_STATE,NO ;; ;AN000;
532 .ENDIF ;; ;AN000;
533 ;; ;AN000;
534 .IF <BIT GROUPS_DONE AND COLP> ;; Check for a previous group of ;AN000;
535 OR STMT_ERROR,SEQUENCE ;; COLORPRINTS within this PTD ;AN000;
536 MOV PARSE_ERROR,YES ;; ;AN000;
537 MOV BUILD_STATE,NO ;; ;AN000;
538 .ENDIF ;; ;AN000;
539 ;; ;AN000;
540 MOV CUR_PRINTER_TYPE,COLOR ;; ;AN000;
541 ;; ;AN000;
542 .IF <BIT STMTS_DONE NAND COLP> ;; If first COLORPRINT... ;AN000;
543 .IF <BUILD_STATE EQ YES> ;; Update count and pointer in the ;AN000;
544 MOV AX,BLOCK_END ;; Shared Data Area header ;AN000;
545 MOV [BP].COLORPRINT_PTR,AX ;; Set pointer to COLORPRINT info ;AN000;
546 MOV [BP].PRINTER_TYPE,COLOR ;; ;AN000;
547 MOV [BP].NUM_PRT_COLOR,0 ;; Init NUMBER OF COLORPRINTS ;AN000;
548 .ENDIF ;; ;AN000;
549 .ENDIF ;; ;AN000;
550 ;; ;AN000;
551 .IF <BUILD_STATE EQ YES> ;; ;AN000;
552 INC [BP].NUM_PRT_COLOR ;; Inc number of selects ;AN000;
553 .ENDIF ;; ;AN000;
554 ;; ;AN000;
555 OR STMTS_DONE,COLP ;; Indicate found ;AN000;
556 .IF <PREV_STMT NE COLP> THEN ;; Terminate any preceeding groups ;AN000;
557 MOV AX,PREV_STMT ;; except for COLORPRINT ;AN000;
558 OR GROUPS_DONE,AX ;; ;AN000;
559 .ENDIF ;; ;AN000;
560 ;; ;AN000;
561 MOV AX,BLOCK_END ;; Start a new block ;AN000;
562 MOV BLOCK_START,AX ;; ;AN000;
563 MOV AX,SIZE COLORPRINT_STR ;; Make room for COLORPRINT info ;AN000;
564 CALL GROW_SHARED_DATA ;; ;AN000;
565 ;; ;AN000;
566 MOV DI,OFFSET COLORPRINT_PARSE_PARMS ;; parse parms ;AN000;
567 ;; SI => the line to parse ;AN000;
568 XOR DX,DX ;; ;AN000;
569 XOR CX,CX ;; ;AN000;
570 ;; ;AN000;
571 CALL SYSPARSE ;; PARSE the RED value ;AN000;
572 .IF <AX NE 0> ;; ;AN000;
573 OR STMT_ERROR,INVALID ;; ;AN000;
574 MOV PARSE_ERROR,YES ;; ;AN000;
575 MOV BUILD_STATE,NO ;; ;AN000;
576 .ELSE ;; ;AN000;
577 .IF <BUILD_STATE EQ YES> ;; ;AN000;
578 PUSH DI ;; ;AN000;
579 MOV DI,BLOCK_START ;; ;AN000;
580 MOV AL,RESULT_VAL ;; Store RED value in COLORPRINT info ;AN000;
581 MOV [BP+DI].RED,AL ;; ;AN000;
582 POP DI ;; ;AN000;
583 .ENDIF ;; ;AN000;
584 .ENDIF ;; ;AN000;
585 ;; ;AN000;
586 CALL SYSPARSE ;; PARSE the GREEN value ;AN000;
587 .IF <AX NE 0> ;; ;AN000;
588 OR STMT_ERROR,INVALID ;; ;AN000;
589 MOV PARSE_ERROR,YES ;; ;AN000;
590 MOV BUILD_STATE,NO ;; ;AN000;
591 .ELSE ;; ;AN000;
592 .IF <BUILD_STATE EQ YES> ;; ;AN000;
593 PUSH DI ;; ;AN000;
594 MOV DI,BLOCK_START ;; ;AN000;
595 MOV AL,RESULT_VAL ;; Store GREEN value in COLORPRINT info ;AN000;
596 MOV [BP+DI].GREEN,AL ;; ;AN000;
597 POP DI ;; ;AN000;
598 .ENDIF ;; ;AN000;
599 .ENDIF ;; ;AN000;
600 ;; ;AN000;
601 CALL SYSPARSE ;; PARSE the BLUE value ;AN000;
602 .IF <AX NE 0> ;; ;AN000;
603 OR STMT_ERROR,INVALID ;; ;AN000;
604 MOV PARSE_ERROR,YES ;; ;AN000;
605 MOV BUILD_STATE,NO ;; ;AN000;
606 .ELSE ;; ;AN000;
607 .IF <BUILD_STATE EQ YES> ;; ;AN000;
608 PUSH DI ;; ;AN000;
609 MOV DI,BLOCK_START ;; ;AN000;
610 MOV AL,RESULT_VAL ;; Store BLUE value in COLORPRINT info ;AN000;
611 MOV [BP+DI].BLUE,AL ;; ;AN000;
612 POP DI ;; ;AN000;
613 .ENDIF ;; ;AN000;
614 .ENDIF ;; ;AN000;
615 ;; ;AN000;
616 .IF <BUILD_STATE EQ YES> ;; ;AN000;
617 PUSH DI ;; ;AN000;
618 MOV DI,BLOCK_START ;; ;AN000;
619 MOV [BP+DI].SELECT_MASK,0 ;; Initialize band select mask ;AN000;
620 POP DI ;; ;AN000;
621 .ENDIF ;; ;AN000;
622 XOR DX,DX ;; For each band found "OR" the item ;AN000;
623 .REPEAT ;; tag into the select mask ;AN000;
624 MOV CX,3 ;; Avoid getting too many parms error ;AN000;
625 CALL SYSPARSE ;; from parser ;AN000;
626 .IF <AX EQ 0> ;; ;AN000;
627 .IF <BUILD_STATE EQ YES> ;; ;AN000;
628 PUSH DI ;; ;AN000;
629 MOV DI,BLOCK_START ;; ;AN000;
630 MOV AL,RESULT_TAG ;; ;AN000;
631 OR [BP+DI].SELECT_MASK,AL ;; OR the mask for this band into the ;AN000;
632 ;; select mask for this color ;AN000;
633 POP DI ;; ;AN000;
634 .ENDIF ;; ;AN000;
635 .ELSE ;; ;AN000;
636 .IF <AX NE -1> ;; ;AN000;
637 OR STMT_ERROR,INVALID ;; parm is invalid ;AN000;
638 MOV PARSE_ERROR,YES ;; ;AN000;
639 MOV BUILD_STATE,NO ;; ;AN000;
640 .ENDIF ;; ;AN000;
641 .ENDIF ;; ;AN000;
642 .UNTIL <AX EQ -1> NEAR ;; ;AN000;
643 ;; ;AN000;
644 RET ;; ;AN000;
645 ;; ;AN000;
646PARSE_COLORPRINT ENDP ;; ;AN000;
647 ;; ;AN000;
648;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
649 ;; ;AN000;
650 ;; ;AN000;
651;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
652;; ;AN000;
653;; Module Name: ;AN000;
654;; PARSE_DARKADJUST ;AN000;
655;; ;AN000;
656;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
657 ;AN000;
658DARKADJUST_PARSE_PARMS LABEL WORD ;; Parser control blocks ;AN000;
659 DW DARKADJUST_P ;; ;AN000;
660 DB 2 ;; # of lists ;AN000;
661 DB 0 ;; # items in delimeter list ;AN000;
662 DB 1 ;; # items in end-of-line list ;AN000;
663 DB ';' ;; ';' used for comments ;AN000;
664 ;; ;AN000;
665 ;; ;AN000;
666DARKADJUST_P LABEL BYTE ;; ;AN000;
667 DB 1,1 ;; Required,MAX ;AN000;
668 DW DARKADJUST_P0 ;; Numeric: adjust value ;AN000;
669 DB 0 ;; # Switches ;AN000;
670 DB 0 ;; # keywords ;AN000;
671 ;; ;AN000;
672DARKADJUST_P0 DW 4000H ;; Signed Numeric - adjust value ;AN000;
673 DW 0 ;; No Capitalize ;AN000;
674 DW RESULT_BUFFER ;; Result buffer ;AN000;
675 DW DARKADJUST_P0V ;; Value list ;AN000;
676 DB 0 ;; Synomyms ;AN000;
677 ;; ;AN000;
678DARKADJUST_P0V DB 1 ;; # of value lists ;AN000;
679 DB 1 ;; # of range numerics ;AN000;
680 DB 1 ;; tag ;AN000;
681 DD -63,63 ;; range -63,63 ;AN000;
682;;;;***********************************;; ;AN000;
683 ;; ;AN000;
684 ;AN000;
685PARSE_DARKADJUST PROC ;; ;AN000;
686 ;; ;AN000;
687 MOV CUR_STMT,DARK ;; ;AN000;
688 .IF <BIT STMTS_DONE NAND PRT> ;; PRINTER statemnet must have been ;AN000;
689 OR STMT_ERROR,MISSING ;; processed ;AN000;
690 MOV PARSE_ERROR,YES ;; ;AN000;
691 MOV BUILD_STATE,NO ;; ;AN000;
692 .ENDIF ;; ;AN000;
693 ;; ;AN000;
694 ;; ;AN000;
695 OR STMTS_DONE,DARK ;; Indicate found ;AN000;
696 ;; Terminate any preceeding groups ;AN000;
697 MOV AX,PREV_STMT ;; ;AN000;
698 OR GROUPS_DONE,AX ;; ;AN000;
699 ;; ;AN000;
700 MOV DI,OFFSET DARKADJUST_PARSE_PARMS ;; parse parms ;AN000;
701 ;; SI => the line to parse ;AN000;
702 XOR DX,DX ;; ;AN000;
703 XOR CX,CX ;; ;AN000;
704 ;; ;AN000;
705 CALL SYSPARSE ;; PARSE the ADJUST VALUE ;AN000;
706 .IF <AX NE 0> ;; ;AN000;
707 OR STMT_ERROR,INVALID ;; ;AN000;
708 MOV PARSE_ERROR,YES ;; ;AN000;
709 MOV BUILD_STATE,NO ;; ;AN000;
710 .ELSE ;; ;AN000;
711 .IF <BUILD_STATE EQ YES> ;; ;AN000;
712 MOV AL,RESULT_VAL ;; ;AN000;
713 MOV [BP].DARKADJUST_VALUE,AL ;; ;AN000;
714 .ENDIF ;; ;AN000;
715 CALL SYSPARSE ;; CHECK FOR EXTRA PARMS ;AN000;
716 .IF <AX NE -1> ;; ;AN000;
717 OR STMT_ERROR,INVALID ;; ;AN000;
718 MOV PARSE_ERROR,YES ;; ;AN000;
719 MOV BUILD_STATE,NO ;; ;AN000;
720 .ENDIF ;; ;AN000;
721 .ENDIF ;; ;AN000;
722 ;; ;AN000;
723 RET ;; ;AN000;
724 ;; ;AN000;
725PARSE_DARKADJUST ENDP ;; ;AN000;
726 ;AN000;
727LIMIT LABEL NEAR ;; ;AN000;
728CODE ENDS ;; ;AN000;
729 END ;AN000;
diff --git a/v4.0/src/CMD/GRAPHICS/GRLOAD3.EXT b/v4.0/src/CMD/GRAPHICS/GRLOAD3.EXT
new file mode 100644
index 0000000..6c1b8e5
--- /dev/null
+++ b/v4.0/src/CMD/GRAPHICS/GRLOAD3.EXT
@@ -0,0 +1,28 @@
1.XLIST ;AN000;
2 ;AN000;
3;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
4;; DOS - GRAPHICS Command
5;; (C) Copyright 1988 Microsoft
6;; ;AN000;
7;; File Name: GRINST.EXT ;AN000;
8;; ---------- ;AN000;
9;; ;AN000;
10;; Description: ;AN000;
11;; ------------ ;AN000;
12;; External declarations for code and data defined in ;AN000;
13;; GRLOAD.ASM ;AN000;
14;; ;AN000;
15;; Change History: ;AN000;
16;; --------------- ;AN000;
17;; ;AN000;
18;; ;AN000;
19;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
20 ;; ;AN000;
21 EXTRN PARSE_GRAPHICS:NEAR ;; ;AN000;
22 EXTRN PARSE_COLORSELECT:NEAR ;; ;AN000;
23 EXTRN PARSE_COLORPRINT:NEAR ;; ;AN000;
24 EXTRN PARSE_DARKADJUST:NEAR ;; ;AN000;
25 EXTRN LIMIT:NEAR ;; ;AN000;
26 ;; ;AN000;
27;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
28.LIST ;AN000;
diff --git a/v4.0/src/CMD/GRAPHICS/GRMSG.EQU b/v4.0/src/CMD/GRAPHICS/GRMSG.EQU
new file mode 100644
index 0000000..60b4c0e
--- /dev/null
+++ b/v4.0/src/CMD/GRAPHICS/GRMSG.EQU
@@ -0,0 +1,84 @@
1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
2;; DOS - GRAPHICS Command
3;; (c) Copyright 1988 Microsoft
4;; ;AN000;
5;; File Name: GRMSG.EQU ;AN000;
6;; ---------- ;AN000;
7;; ;AN000;
8;; DOS GRAPHICS Command - Message number AN000;equates
9;; ;AN000;
10;; Description: ;AN000;
11;; ------------ ;AN000;
12;; This file contains the numbers assigned to the error messages ;AN000;
13;; issued by GRAPHICS.COM ;AN000;
14;; ;AN000;
15;; These messages are defined in GRAPHICS.MSG ;AN000;
16;; (The message skeleton file for GRAPHICS.COM) ;AN000;
17;; ;AN000;
18;; This file also contains equates for the error codes returned by ;AN000;
19;; the DOS parser. ;AN000;
20;; ;AN000;
21;; Documentation Reference: ;AN000;
22;; ------------------------ ;AN000;
23;; ;AN000;
24;; DOS 3.3 Message Retriever Interface Supplement. ;AN000;
25;; ;AN000;
26;; External Procedure References: ;AN000;
27;; ------------------------------ ;AN000;
28;; FROM FILE GRINST.ASM: ;AN000;
29;; GRAPHICS_INSTALL - Main module for GRAPHICS install. ;AN000;
30;; PARSE_PARMS - Parse the command line parameters. ;AN000;
31;; FROM FILE GRLOAD.ASM AND GRLOAD2.ASM ;AN000;
32;; All modules ;AN000;
33;; ;AN000;
34;; Change History: ;AN000;
35;; --------------- ;AN000;
36;; ;AN000;
37;; ;AN000;
38;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
39 ;AN000;
40;-------------------------------------------------------------------------------;AN000;
41; GRAPHICS MESSAGE NUMBERS ;AN000;
42;-------------------------------------------------------------------------------;AN000;
43 ;AN000;
44; Class A messages: ;AN000;
45INCORRECT_DOS EQU 1 ; 'Incorrect DOS version' ;AN000;
46NO_MEMORY EQU 2 ; 'Insufficient memory' ;AN000;
47 ;AN000;
48; Class B messages: (Profile loading) ;AN000;
49PROFILE_NOT_FOUND EQU 9 ; 'Cannot find GRAPHICS profile' ;AN000;
50MISSING_STMT EQU 10 ; 'Required profile statement missing ;AN000;
51 ; before line %1' ;AN000;
52INVALID_STMT EQU 11 ; 'Invalid profile statement on line %1' ;AN000;
53OUT_SEQ_STMT EQU 12 ; 'Profile statement out of sequence on line %1';AN000;
54FILE_ERRORS EQU 13 ; 'Error reading GRAPHICS profile' ;AN000;
55SYNTAX_ERRORS EQU 14 ; 'Syntax errors in GRAPHICS profile' ;AN000;
56INVALID_PB EQU 15 ; 'PRINTBOX id not in GRAPHICS profile' ;AN000;
57INVALID_PRT EQU 16 ; 'Printer type not in GRAPHICS profile' ;AN000;
58 ;AN000;
59; Class C messages: (Command line parsing) ;AN000;
60TOO_MANY_PARMS EQU 3 ; 'Too many parameters' ;AN000;
61VALUE_NOT_ALLOWED EQU 4 ; 'Parameter value not allowed' ;AN000;
62INVALID_PARM EQU 5 ; 'Invalid parameter %1' ;AN000;
63INVALID_COMBINATION EQU 6 ; 'Invalid parameter combination' ;AN000;
64DUPLICATE_PARM EQU 7 ; 'Duplicate parameters not allowed' ;AN000;
65FORMAT_NOT_CORRECT EQU 8 ; 'Parameter format not correct' ;AN000;
66INVALID_B_SWITCH EQU 17 ; '/B invalid with a Black and White printer' ;AN000;
67UNABLE_RELOAD EQU 18 ; 'Unable to reload with profile supplied' ;AN000;
68 ;AN000;
69 ;AN000;
70 ;AN000;
71;-------------------------------------------------------------------------------;AN000;
72; PARSER ERROR CODES AND OUR OWN PARSING ERROR CODES ;AN000;
73; *** ;AN000;
74;-------------------------------------------------------------------------------;AN000;
75 ;AN000;
76RC_NO_ERROR EQU 0 ;AN000;
77RC_EOL EQU -1 ;AN000;
78RC_TOO_MANY EQU 1 ;AN000;
79RC_NOT_IN_SW EQU 3 ;AN000;
80RC_NOT_IN_VAL EQU 7 ;AN000;
81RC_NOT_IN_STR EQU 8 ;AN000;
82 ;AN000;
83RC_INVLD_COMBINATION EQU 99 ;AN000;
84RC_DUPLICATE_PARMS EQU 100 ;AN000;
diff --git a/v4.0/src/CMD/GRAPHICS/GRPARMS.ASM b/v4.0/src/CMD/GRAPHICS/GRPARMS.ASM
new file mode 100644
index 0000000..8cebf2e
--- /dev/null
+++ b/v4.0/src/CMD/GRAPHICS/GRPARMS.ASM
@@ -0,0 +1,717 @@
1 PAGE ,132 ;AN000;
2 TITLE DOS - GRAPHICS Command - Command line parsing module ;AN000;
3;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
4;; DOS - GRAPHICS Command
5;; (C) Copyright 1988 Microsoft
6;; ;AN000;
7;; File Name: GRPARMS.ASM ;AN000;
8;; ---------- ;AN000;
9;; ;AN000;
10;; Description: ;AN000;
11;; ------------ ;AN000;
12;; ;AN000;
13;; This file contains modules for parsing the GRAPHICS.COM ;AN000;
14;; command line; using the DOS PARSER. ;AN000;
15;; ;AN000;
16;; ;AN000;
17;; Documentation Reference: ;AN000;
18;; ------------------------ ;AN000;
19;; OASIS High Level Design ;AN000;
20;; OASIS GRAPHICS I1 Overview ;AN000;
21;; DOS 3.3 Message Retriever Interface Supplement. ;AN000;
22;; TUPPER I0 Document - PARSER HIGH LEVEL DESIGN REVIEW ;AN000;
23;; ;AN000;
24;; Procedures Contained in This File: ;AN000;
25;; ---------------------------------- ;AN000;
26;; PARSE_PARMS - Parse the command line ;AN000;
27;; GET_R - Get /R ;AN000;
28;; GET_B - Get /B ;AN000;
29;; GET_LCD - Get /LCD ;AN000;
30;; GET_PRINTBOX - Get /PRINTBOX ;AN000;
31;; GET_PROFILE - Get the profile path and file name ;AN000;
32;; GET_TYPE - Get the printer type ;AN000;
33;; ;AN000;
34;; Include Files Required: ;AN000;
35;; ----------------------- ;AN000;
36;; GRINST.EXT - Externals for installation modules ;AN000;
37;; GRPARSE.EXT - Externals for the DOS parser code ;AN000;
38;; GRSHAR.STR - Shared Data Area Structure ;AN000;
39;; GRMSG.EQU - Equates for GRAPHICS.COM error messages ;AN000;
40;; STRUC.INC - Macros for using structured assembly language ;AN000;
41;; ;AN000;
42;; External Procedure References: ;AN000;
43;; ------------------------------ ;AN000;
44;; FROM FILE GRINST.ASM: ;AN000;
45;; GRAPHICS_INSTALL - Main module for the installation of GRAPHICS ;AN000;
46;; SYSPARSE - DOS system parser ;AN000;
47;; SYSDISPMSG - DOS message retriever ;AN000;
48;; ;AN000;
49;; Linkage Instructions: ;AN000;
50;; -------------------- ;AN000;
51;; Refer to GRAPHICS.ASM ;AN000;
52;; ;AN000;
53;; Change History: ;AN000;
54;; --------------- ;AN000;
55;; ;AN000;
56;; ;AN000;
57;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
58CODE SEGMENT PUBLIC 'CODE' ;AN000;
59 ASSUME CS:CODE,DS:CODE ;AN000;
60PARSE_PARMS PROC NEAR ;AN000;
61 jmp PARSE_PARMS_START ;AN000;
62PUBLIC PARSE_PARMS ;AN000;
63.XLIST ;AN000;
64INCLUDE GRMSG.EQU ; Include GRAPHICS error messages equates ;AN000;
65INCLUDE GRSHAR.STR ; Include the Shared data area structure ;AN000;
66INCLUDE GRINST.EXT ; Include externals for the installation module ;AN000;
67INCLUDE GRPARSE.EXT ; Include externals for the DOS parse code ;AN000;
68INCLUDE STRUC.INC ; Include macros for using STRUCTURES ;AN000;
69.LIST ;AN000;
70 ;AN000;
71PAGE ;AN000;
72;===============================================================================;AN000;
73; ;AN000;
74; PARSE_PARMS : PARSE THE COMMAND LINE PARAMETERS. ;AN000;
75; ;AN000;
76;-------------------------------------------------------------------------------;AN000;
77; ;AN000;
78; INPUT: DS,ES = SEGMENT CONTAINING THE PROGRAM PREFIX SEGMENT ;AN000;(PSP)
79; ;AN000;
80; OUTPUT: SWITCHES = A bit mask in the shared data area indicating ;AN000;
81; which command line switches are set. ;AN000;
82; PROFILE_PATH = The profile file name and path (ASCIIZ string);AN000;
83; PRINTBOX_ID_PTR = Offset of the printbox id (ASCIIZ string) ;AN000;
84; PRINTER_TYPE_PARM = printer type (ASCIIZ string) ;AN000;
85; CARRY FLAG IS SET if an error occurred ;AN000;
86; ;AN000;
87;-------------------------------------------------------------------------------;AN000;
88; ;AN000;
89; DESCRIPTION: Call the DOS parser to parse the command line parameters ;AN000;
90; of the GRAPHICS command line which is obtained from the PSP (Program Segment ;AN000;
91; Prefix). ;AN000;
92; ;AN000;
93; The format of the command line is: ;AN000;
94; ;AN000;
95; ;AN000;
96; GRAPHICS {prt_type {profile}} {/R} {/B} {[/LCD | /PRINTBOX:id]} ;AN000;
97; ;AN000;
98; (All arguments are optional, /PRINTBOX can be spelled /PB.) ;AN000;
99; ;AN000;
100; If no printer type is specified then, a null pointer is returned. ;AN000;
101; If no profile name is supplied then, a null string is returned. ;AN000;
102; If "/LCD" is specified then, a pointer to the printbox id: "LCD" is returned. ;AN000;
103; ;AN000;
104; ;AN000;
105; LOGIC: ;AN000;
106; Set addressibility to the command line parameters in the PSP ;AN000;
107; CALL SYSPARSE ; Call the system parser ;AN000;
108; While not (End Of Line) AND no error ;AN000;
109; IF argument is the profile name ;AN000;
110; THEN Get the profile name ;AN000;
111; IF argument is the printbox switch ;AN000;
112; THEN Get the printbox id ;AN000;
113; IF argument is a /r ;AN000;
114; THEN Get /r ;AN000;
115; IF argument is /b ;AN000;
116; THEN Get /b ;AN000;
117; IF argument /lcd ;AN000;
118; THEN Get /lcd ;AN000;
119; CALL SYSPARSE ;AN000;
120; If error ;AN000;
121; Then display the appropriate error message ;AN000;
122; ;AN000;
123;-------------------------------------------------------------------------------;AN000;
124; BIT MASK INDICATING THE COMMAND LINE SWITCHES PARSED SO FAR: ;AN000;
125;-------------------------------------------------------------------------------;AN000;
126SWITCH_PARSED DB 0 ;AN000;
127GOT_R EQU 1 ; Found /R ;AN000;
128GOT_B EQU 2 ; Found /B ;AN000;
129GOT_LCD EQU 4 ; Found /LCD ;AN000;
130GOT_PRINTBOX EQU 8 ; Found /PB:id or /PRINTBOX:id ;AN000;
131 ;AN000;
132;===============================================================================;AN000;
133; ;AN000;
134; CONTROL BLOCK DEFINITIONS FOR THE PARSER: ;AN000;
135; ;AN000;
136;===============================================================================;AN000;
137 ;AN000;
138;-------------------------------------------------------------------------------;AN000;
139; PARMS INPUT BLOCK ;AN000;
140;-------------------------------------------------------------------------------;AN000;
141PARMS LABEL WORD ;AN000;
142 DW PARMSX ; Offset of parms extension block ;AN000;
143 DB 0 ; No delimiters to define ;AN000;
144 ; or end of line markers. ;AN000;
145 ;AN000;
146 ;AN000;
147;-------------------------------------------------------------------------------;AN000;
148; PARMS EXTENSION BLOCK : Describe what's on the command line ;AN000;
149;-------------------------------------------------------------------------------;AN000;
150PARMSX LABEL BYTE ;AN000;
151 DB 0,2 ; Max. 2 positional parameters ;AN000;
152 DW TYPE_CTL ; Offset of type control block ;AN000;
153 DW PROF_CTL ; Offset of profile control block ;AN000;
154 ;AN000;
155 DB 4 ; Max. 4 switch types ;AN000;
156 DW PRINTBOX_CTL ; Offset of control for Printbox ;AN000;
157 DW R_CTL ; Offset of control for /R ;AN000;
158 DW B_CTL ; Offset of control for /B ;AN000;
159 DW LCD_CTL ; Offset of control for /LCD ;AN000;
160 ;AN000;
161 DB 0 ; No keywords ;AN000;
162 ;AN000;
163;-------------------------------------------------------------------------------;AN000;
164; ;AN000;
165; Describe the printer type parameter: ;AN000;
166; ;AN000;
167;-------------------------------------------------------------------------------;AN000;
168TYPE_CTL LABEL WORD ;AN000;
169 DW 2001H ; Optional simple string ;AN000;
170 DW 0002H ; Capitalize it ;AN000;
171 DW TYPE_RESULT ; Offset of result buffer for printer type ;AN000;
172 DW NO_VALUES ; No values (NOTE: The type returned is checked;AN000;
173 DB 0 ; for validity by LOAD_PROFILE);AN000;
174 ;AN000;
175NO_VALUES DB 0 ;AN000;
176 ;AN000;
177TYPE_RESULT LABEL BYTE ;AN000;
178 DB ? ; Type ;AN000;
179 DB ? ; Item tag ;AN000;
180 DW ? ; Offset of synomym ;AN000;
181 DD ? ; Pointer to string found ;AN000;
182 ;AN000;
183;-------------------------------------------------------------------------------;AN000;
184; ;AN000;
185; Describe the format of the PROFILE parameter: ;AN000;
186; ;AN000;
187;-------------------------------------------------------------------------------;AN000;
188 ;AN000;
189PROF_CTL LABEL WORD ;AN000;
190 DW 0201H ; File spec. - Optional ;AN000;
191 DW 0001h ; Capitalize ;AN000;
192 DW PROFILE_RESULT ; Offset of result buffer for Profile ;AN000;
193 DW NO_VALUES ; No values needed ;AN000;
194 DB 0 ;AN000;
195 ;AN000;
196 ;AN000;
197PROFILE_RESULT LABEL BYTE ;AN000;
198 DB ? ; Type ;AN000;
199 DB ? ; Item tag ;AN000;
200 DW ? ; Offset of synomym ;AN000;
201 DD ? ; Offset of string ;AN000;
202 ;AN000;
203;-------------------------------------------------------------------------------;AN000;
204; ;AN000;
205; Describe the format of /R ;AN000;
206; ;AN000;
207;-------------------------------------------------------------------------------;AN000;
208R_CTL LABEL WORD ;AN000;
209 DW 0 ; ;AN000;
210 DW 0 ; ;AN000;
211 DW R_RESULT ; Offset of result buffer for a simple switch ;AN000;
212 DW NO_VALUES ; No values can be given with these switches. ;AN000;
213 DB 1 ; 1 name for this switch ;AN000;
214 DB "/R",0 ; Reverse ;AN000;
215 ;AN000;
216R_RESULT LABEL BYTE ;AN000;
217 DB ? ; Type ;AN000;
218 DB ? ; Item tag ;AN000;
219 DW ? ; Offset of synomym ;AN000;
220 DD ? ; Offset of value ;AN000;
221 ;AN000;
222;-------------------------------------------------------------------------------;AN000;
223; ;AN000;
224; Describe the format of /B ;AN000;
225; ;AN000;
226;-------------------------------------------------------------------------------;AN000;
227B_CTL LABEL WORD ;AN000;
228 DW 0 ; ;AN000;
229 DW 0 ; ;AN000;
230 DW B_RESULT ; Offset of result buffer for a simple switch ;AN000;
231 DW NO_VALUES ; No values can be given with these switches. ;AN000;
232 DB 1 ; 1 name allowed for this switch ;AN000;
233 DB "/B",0 ; Background ;AN000;
234 ;AN000;
235B_RESULT LABEL BYTE ;AN000;
236 DB ? ; Type ;AN000;
237 DB ? ; Item tag ;AN000;
238 DW ? ; Offset of synomym ;AN000;
239 DD ? ; Offset of value ;AN000;
240 ;AN000;
241;-------------------------------------------------------------------------------;AN000;
242; ;AN000;
243; Describe the format of /LCD ;AN000;
244; ;AN000;
245;-------------------------------------------------------------------------------;AN000;
246LCD_CTL LABEL WORD ;AN000;
247 DW 0 ; ;AN000;
248 DW 0 ; ;AN000;
249 DW LCD_RESULT ; Offset of result buffer for a /LCD ;AN000;
250 DW NO_VALUES ; No values can be given with these switches. ;AN000;
251 DB 1 ; 1 name: ;AN000;
252 DB "/LCD",0 ; /LCD ;AN000;
253 ;AN000;
254LCD_RESULT LABEL BYTE ;AN000;
255 DB ? ; Type ;AN000;
256 DB ? ; Item tag ;AN000;
257 DW ? ; Offset of synomym ;AN000;
258 DD ? ; Offset of value ;AN000;
259 ;AN000;
260;-------------------------------------------------------------------------------;AN000;
261; ;AN000;
262; Describe the format of the PRINTBOX switch: ;AN000;
263; ;AN000;
264;-------------------------------------------------------------------------------;AN000;
265PRINTBOX_CTL LABEL WORD ;AN000;
266 DW 2001H ; Optional simple string ;AN000;
267 DW 0001H ; Capitalize ;AN000;
268 DW PRINTBOX_RESULT ; Offset of result buffer for Printbox ;AN000;
269 DW NO_VALUES ; Values will be validated when loading profile ;AN000;
270 DB 2 ; 2 synomym for this switch: ;AN000;
271 DB "/PRINTBOX",0 ; ;AN000;
272 DB "/PB",0 ;AN000;
273 ;AN000;
274PRINTBOX_RESULT LABEL BYTE ;AN000;
275 DB ? ; Type ;AN000;
276 DB ? ; Item tag ;AN000;
277 DW ? ; Offset of synomym ;AN000;
278 DD ? ; Offset of value ;AN000;
279 ;AN000;
280;===============================================================================;AN000;
281; ;AN000;
282; DOS "MESSAGE RETRIEVER" Substitution list control block: ;AN000;
283; ;AN000;
284;-------------------------------------------------------------------------------;AN000;
285SUBLIST LABEL DWORD ; List for substitution: ;AN000;
286 DB 11 ; Size of this list ;AN000;
287 DB 0 ; Reserved ;AN000;
288SAVE_SI DD ? ; Ptr to data item ;AN001;
289 DB 1 ; Variable to be substitued: %1 ;AN000;
290 DB 00010000B ; %1 is an ASCIIZ string left justifi;AN000;ed
291 DB 0 ; Unlimited size for %1 ;AN000;
292 DB 1 ; Minimum size is 1 character ;AN000;
293 DB " " ; Delimiter is "space" ;AN000;
294 ;AN000;
295;===============================================================================;AN000;
296; ;AN000;
297; START OF EXECUTABLE CODE: ;AN000;
298; ;AN000;
299;-------------------------------------------------------------------------------;AN000;
300 ;AN000;
301PARSE_PARMS_START: ;AN000;
302 PUSH AX ;AN000;
303 PUSH BX ;AN000;
304 PUSH CX ;AN000;
305 PUSH DX ;AN000;
306 PUSH SI ;AN000;
307 PUSH DI ;AN000;
308 PUSH ES ;AN000;
309;-------------------------------------------------------------------------------;AN000;
310; Set up addressibility for the parser ;AN000;
311;-------------------------------------------------------------------------------;AN000;
312 MOV SI,81H ; DS:SI := Command line parameters ;AN000;
313 ; to be parsed ;AN000;
314 PUSH CS ;AN000;
315 POP ES ;AN000;
316 LEA DI,PARMS ; ES:DI := Parms control block ;AN000;
317;(deleted ;AN001;) XOR DX,DX ; CX,DX must be zero for the ;AN000;
318 XOR CX,CX ; Initially, CX should be zero ;AN001;
319 MOV AX,0 ; No error yet ;AN000;
320;-------------------------------------------------------------------------------;AN000;
321; Parse FIRST argument ;AN000;
322;-------------------------------------------------------------------------------;AN000;
323;(deleted ;AN001;) CALL SYSPARSE ; Get one argument from the command line;AN000;
324 CALL CALL_SYSPARSE ; Get one argument from the command line;AN001;
325;(deleted ;AN001;) MOV BX,DX ; BX := Offset of result block ;AN000;
326.WHILE <AX EQ RC_NO_ERROR> ; While there is no error ;AN000;
327;-------------------------------------------------------------------------------;AN000;
328; Get the argument: ;AN000;
329;-------------------------------------------------------------------------------;AN000;
330 .SELECT ;AN000;
331 .WHEN <BX EQ <OFFSET TYPE_RESULT>> ;AN000;
332 CALL GET_TYPE ;AN000;
333 .WHEN <BX EQ <OFFSET PROFILE_RESULT>> ;AN000;
334 CALL GET_PROFILE_NAME ;AN000;
335 .WHEN <BX EQ <OFFSET LCD_RESULT >> ;AN000;
336 CALL GET_LCD ;AN000;
337 .WHEN <BX EQ <OFFSET R_RESULT>> ;AN000;
338 CALL GET_REVERSE ;AN000;
339 .WHEN <BX EQ <OFFSET B_RESULT>> ;AN000;
340 CALL GET_BACKGROUND ;AN000;
341 .WHEN <BX EQ <OFFSET PRINTBOX_RESULT>> ;AN000;
342 CALL GET_PRINTBOX_ID ;AN000;
343 .OTHERWISE ;AN000;
344;-------No result block was returned by the parser ;AN000;
345 STC ; Set error ;AN000;
346 .ENDSELECT ;AN000;
347 .LEAVE C ; IF error occurred while parsing the ;AN000;
348 ; previous argument, exit the loop: ;AN000;
349 ; stop parsing the command line. ;AN000;
350;-------------------------------------------------------------------------------;AN000;
351; Parse next argument: ;AN000;
352;-------------------------------------------------------------------------------;AN000;
353;(deleted ;AN001;) XOR DX,DX ; ;AN000;
354;(deleted ;AN001;) CALL SYSPARSE ; Get one argument from the command line;AN000;
355 CALL CALL_SYSPARSE ; Get one argument from the command line;AN001;
356;(deleted ;AN001;) MOV BX,DX ; ES:BX := Offset of result block ;AN000;
357.ENDWHILE ;AN000;
358;-------------------------------------------------------------------------------;AN000;
359; Check for error, select and display an error message ;AN000;
360;-------------------------------------------------------------------------------;AN000;
361.IF <AL NE RC_EOL> ; IF an error occurred ;AN000;
362.THEN ; then, display error message ;AN000;
363 MOV CX,0 ; Assume no substitutions ;AN000;
364 .SELECT ; (CX := Number of substitutions ;AN000;
365 .WHEN <AL EQ RC_TOO_MANY> ; When RC = Too many parameters ;AN000;
366 MOV AX,TOO_MANY_PARMS ; (AL = Message number to display) ;AN000;
367 .WHEN <AL EQ RC_Not_In_Val> ; When RC = Not in value list provided ;AN000;
368 MOV AX,VALUE_NOT_ALLOWED ; (AL = Message number to display) ;AN000;
369 .WHEN <AL EQ RC_Not_In_Sw> ; When RC = Not in switch list provided ;AN000;
370 MOV CX,1 ; 1 substitution in this message ;AN000;
371 MOV BYTE PTR [SI],0 ; PUT NUL AT END OF THIS PARM ;AN001;
372 LEA SI,SUBLIST ; DS:[SI]:="Invalid parm" Substitution;AN000; list
373;(deleted ;AN001;) LES DX,ES:[BX+4] ; ES:DX := Offset of offending parm. ;AN000;
374;(deleted ;AN001;) MOV [SI]+2,DX ; Store offset to this offender in the;AN000;
375 MOV [SI]+4,ES ; substitution list control block ;AN000;
376 MOV AX,INVALID_PARM ; AL := 'Invalid parameter' msg number;AN000;
377 .WHEN <AL EQ RC_INVLD_COMBINATION> ; When RC = Invalid combination of parms;AN000;
378 MOV AX,INVALID_COMBINATION ; (AL = Message number to display) ;AN000;
379 .WHEN <AL EQ RC_DUPLICATE_PARMS> ; When RC = Invalid combination of parms;AN000;
380 MOV AX,DUPLICATE_PARM ; (AL = Message number to display) ;AN000;
381 .OTHERWISE ; ;AN000;
382 MOV AX,FORMAT_NOT_CORRECT ; RC = Anything else, tell the user ;AN000;
383 ; something is wrong with his ;AN000;
384 .ENDSELECT ; command line. ;AN000;
385 CALL DISP_ERROR ; Display the selected error message ;AN000;
386 STC ; Indicate parse error occurred ;AN000;
387.ENDIF ;AN000;
388 ;AN000;
389 POP ES ;AN000;
390 POP DI ;AN000;
391 POP SI ;AN000;
392 POP DX ;AN000;
393 POP CX ;AN000;
394 POP BX ;AN000;
395 POP AX ;AN000;
396 RET ; Return to GRAPHICS_INSTALL ;AN000;
397 ;AN000;
398PARSE_PARMS ENDP ;AN000;
399CALL_SYSPARSE PROC NEAR ;COMMON INVOCATION OF SYSPARSE ;AN001;
400;INPUT: - CX=ORDINAL VALUE ;AN001;
401; DS:SI=WHERE COMMAND LINE IS, SAVED IN "SAVE_SI" ;AN001;
402; ES:DI=WHERE PARMS DESCRIPTOR BLOCK IS ;AN001;
403;OUTPUT: CX=NEW ORDINAL VALUE ;AN001;
404; BX=OFFSET OF RESULT BLOCK, IF ONE IS RETURNED ;AN001;
405; SI=OFFSET OF CHAR BEYOND PARSED PARM IN COMMAND LINE ;AN001;
406 ;AN001;
407 XOR DX,DX ;CLEAR DX FOR PARSER ;AN001;
408 MOV WORD PTR SAVE_SI,SI ;REMEMBER WHERE TO START LOOKING ;AN001;
409 CALL SYSPARSE ;GO PARSE THE NEXT PARM ;AN001;
410 ;AN001;
411 MOV BX,DX ; BX := Offset of result block ;AN001;
412 RET ;RETURN TO CALLER ;AN001;
413CALL_SYSPARSE ENDP ;AN001;
414PAGE ;AN000;
415;===============================================================================;AN000;
416; ;AN000;
417; PROCEDURE_NAME: GET_PROFILE ;AN000;
418; ;AN000;
419; INPUT: ES:[BX] := Result block ;AN000;
420; ;AN000;
421; OUTPUT: PROFILE_PATH = The profile file name and path (ASCIIZ string) ;AN000;
422; ;AN000;
423;-------------------------------------------------------------------------------;AN000;
424GET_PROFILE_NAME PROC ;AN000;
425 PUSH AX ;AN000;
426 PUSH BX ;AN000;
427 PUSH DX ;AN000;
428 PUSH SI ;AN000;
429 PUSH DI ;AN000;
430 ;AN000;
431;-------------------------------------------------------------------------------;AN000;
432; Get the name of the profile path found on the command line: ;AN000;
433;-------------------------------------------------------------------------------;AN000;
434 MOV DI,ES:[BX+4] ; DI := Offset of filename found ;AN000;
435 XOR BX,BX ; BX := Byte index ;AN000;
436 MOV SI,OFFSET PROFILE_PATH ; [BX][SI] := Where to store it ;AN000;
437 ;AN000;
438.IF <<BYTE PTR [DI]> NE 0> ; Don't copy a NULL parm ;AN000;
439 .REPEAT ; While not end of path name (NULL terminated) ;AN000;
440 MOV AL,[BX][DI] ; Copy the byte (including the NULL) ;AN000;
441 MOV [BX][SI],AL ;AN000;
442 INC BX ; Get next one ;AN000;
443 .UNTIL <<BYTE PTR [BX-1][DI]> EQ 0> ; ;AN000;
444.ENDIF ;AN000;
445 ;AN000;
446 POP DI ;AN000;
447 POP SI ;AN000;
448 POP DX ;AN000;
449 POP BX ;AN000;
450 POP AX ;AN000;
451 CLC ;AN000;
452 RET ;AN000;
453GET_PROFILE_NAME ENDP ;AN000;
454 ;AN000;
455PAGE ;AN000;
456;===============================================================================;AN000;
457; ;AN000;
458; PROCEDURE_NAME: GET_TYPE ;AN000;
459; ;AN000;
460; INPUT: ES:[BX] := Result block ;AN000;
461; PRINTER_TYPE_LENGTH := Maximum length for the printer type string ;AN000;
462; ;AN000;
463; OUTPUT: PRINTER_TYPE_PARM = ASCIIZ string containing ;AN000;
464; the Printer type. ;AN000;
465; AX = Error code ;AN000;
466; ;AN000;
467;-------------------------------------------------------------------------------;AN000;
468GET_TYPE PROC ;AN000;
469 PUSH BX ;AN000;
470 PUSH CX ;AN000;
471 PUSH SI ;AN000;
472 PUSH DI ;AN000;
473 ;AN000;
474;---------------------------------------------------------------------- ;AN000;
475; Overwrite the DEFAULT TYPE with the type found on the command line ;AN000;
476;---------------------------------------------------------------------- ;AN000;
477 MOV SI,ES:[BX+4] ; DS:SI := Offset of printer type found ;AN000;
478 .IF <<BYTE PTR [SI]> NE 0> ; Do not copy an empty string ;AN000;
479 .THEN ; ;AN000;
480 MOV CL,PRINTER_TYPE_LENGTH ; CX := Maximum number of bytes ;AN000;
481 XOR CH,CH ; to copy ;AN000;
482 MOV DI,OFFSET PRINTER_TYPE_PARM; ES:DI := Where to store it ;AN000;
483 REP MOVSB ; Copy the string ;AN000;
484 ;---------------------------------------------------------------------- ;AN000;
485 ; Verify that the string supplied is not too long: ;AN000;
486 ;---------------------------------------------------------------------- ;AN000;
487 .IF <<BYTE PTR [DI-1]> EQ 0> ; If the last byte is a null ;AN000;
488 .THEN ; then, the string was not longer ;AN000;
489 ; than the maximum ;AN000;
490 CLC ; Clear the carry flag = No error ;AN000;
491 .ELSE ; else, string provided is too long ;AN000;
492 MOV AX,RC_Not_In_Sw ; Error := RC for Invalid parm ;AN000;
493 STC ; Set error ;AN000;
494 .ENDIF ; ENDIF string too long ;AN000;
495 .ENDIF ; ENDIF string provided ;AN000;
496 ;AN000;
497GET_TYPE_END: ;AN000;
498 POP DI ;AN000;
499 POP SI ;AN000;
500 POP CX ;AN000;
501 POP BX ;AN000;
502 RET ;AN000;
503GET_TYPE ENDP ;AN000;
504 ;AN000;
505PAGE ;AN000;
506;===============================================================================;AN000;
507; ;AN000;
508; PROCEDURE_NAME: GET_REVERSE ;AN000;
509; ;AN000;
510; INPUT: ES:[BX] := Result block ;AN000;
511; SWITCH_PARSED := The command line switches parsed so far (bit mask) ;AN000;
512; ;AN000;
513; OUTPUT: CS:[BP].SWITCHES (Bit mask in the Shared data area) is updated ;AN000;
514; with the value of the switch found. ;AN000;
515; GOT_R is set in SWITCH_PARSED ;AN000;
516; AX := Error message number. ;AN000;
517; CARRY FLAG IS SET IF ERROR FOUND ;AN000;
518; ;AN000;
519; ;AN000;
520;-------------------------------------------------------------------------------;AN000;
521GET_REVERSE PROC ;AN000;
522 ;AN000;
523 TEST SWITCH_PARSED,GOT_R ; If already parsed this switch ;AN000;
524 JNZ DUPLICATE_R ; then, error ;AN000;
525 OR SWITCH_PARSED,GOT_R ; else, say we parsed it. ;AN000;
526 ;AN000;
527;-------------------------------------------------------------------------------;AN000;
528; Set the Reverse switch in the Shared data area ;AN000;
529;-------------------------------------------------------------------------------;AN000;
530 OR CS:[BP].SWITCHES,REVERSE_SW ; Set the command line switch ;AN000;
531 CLC ; Clear the error flag ;AN000;
532 JMP SHORT GET_REVERSE_END ; Return ;AN000;
533 ;AN000;
534DUPLICATE_R: ; Already got this switch ;AN000;
535 MOV AX,RC_DUPLICATE_PARMS ; AX := error message number ;AN000;
536 STC ; SET ERROR ;AN000;
537GET_REVERSE_END: ;AN000;
538 ;AN000;
539 RET ;AN000;
540GET_REVERSE ENDP ;AN000;
541 ;AN000;
542PAGE ;AN000;
543;===============================================================================;AN000;
544; ;AN000;
545; PROCEDURE_NAME: GET_BACKGROUND ;AN000;
546; ;AN000;
547; INPUT: ES:[BX] := Result block ;AN000;
548; SWITCH_PARSED := The command line switches parsed so far (bit mask) ;AN000;
549; ;AN000;
550; OUTPUT: CS:[BP].SWITCHES (Bit mask in the Shared data area) is updated ;AN000;
551; with the value of the switch found. ;AN000;
552; ;AN000;
553; GOT_B is set in SWITCH_PARSED ;AN000;
554; AX := Error message number. ;AN000;
555; CARRY FLAG IS SET IF ERROR FOUND ;AN000;
556; ;AN000;
557;-------------------------------------------------------------------------------;AN000;
558GET_BACKGROUND PROC ;AN000;
559 ;AN000;
560 TEST SWITCH_PARSED,GOT_B ; If already parsed this switch ;AN000;
561 JNZ DUPLICATE_B ; then, error ;AN000;
562 OR SWITCH_PARSED,GOT_B ; else, say we parsed it. ;AN000;
563;-------------------------------------------------------------------------------;AN000;
564; Set the switch in the Shared data area ;AN000;
565;-------------------------------------------------------------------------------;AN000;
566 OR CS:[BP].SWITCHES,BACKGROUND_SW ; Set the command line switch ;AN000;
567 CLC ; Clear the error flag ;AN000;
568 JMP SHORT GET_BACKGROUND_END ; Return ;AN000;
569 ;AN000;
570DUPLICATE_B: ; Already got this switch ;AN000;
571 MOV AX,RC_DUPLICATE_PARMS ; AX := error message number ;AN000;
572 STC ; SET ERROR ;AN000;
573 ;AN000;
574GET_BACKGROUND_END: ;AN000;
575 RET ;AN000;
576GET_BACKGROUND ENDP ;AN000;
577 ;AN000;
578PAGE ;AN000;
579;===============================================================================;AN000;
580; ;AN000;
581; PROCEDURE_NAME: GET_LCD ;AN000;
582; ;AN000;
583; INPUT: SWITCH_PARSED := The command line switches parsed so far (bit mask) ;AN000;
584; ;AN000;
585; OUTPUT: PRINTBOX_ID_PTR := Point to /LCD ASCIIZ string. ;AN000;
586; GOT_B is set in SWITCH_PARSED ;AN000;
587; AX := Error message number. ;AN000;
588; CARRY FLAG IS SET IF ERROR FOUND ;AN000;
589; ;AN000;
590;-------------------------------------------------------------------------------;AN000;
591; Data Referenced: ;AN000;
592; ;AN000;
593; LCD_BOX = An ASCIIZ string representing the LCD printbox id. ;AN000;
594; ;AN000;
595;-------------------------------------------------------------------------------;AN000;
596GET_LCD PROC ;AN000;
597 ;AN000;
598 TEST SWITCH_PARSED,GOT_LCD ; If already parsed this switch ;AN000;
599 JNZ DUPLICATE_LCD ; then, error: Duplicate switch ;AN000;
600 TEST SWITCH_PARSED,GOT_PRINTBOX ; If printbox already mentioned ;AN000;
601 JNZ BAD_COMBINATION ; then, error: Invalid combination ;AN000;
602 ;AN000;
603;-------------------------------------------------------------------------------;AN000;
604; Set the pointer to the print box id to "LCD" ;AN000;
605;-------------------------------------------------------------------------------;AN000;
606 MOV AX,OFFSET LCD_BOX ; PRINTBOX id := LCD ;AN000;
607 MOV PRINTBOX_ID_PTR,AX ; Save pointer to this printbox id. ;AN000;
608 OR SWITCH_PARSED,GOT_LCD ; Say we found this switch ;AN000;
609 CLC ; Clear the error flag ;AN000;
610 JMP SHORT GET_LCD_END ; Return ;AN000;
611 ;AN000;
612;-------------------------------------------------------------------------------;AN000;
613; /LCD was already parsed: ;AN000;
614;-------------------------------------------------------------------------------;AN000;
615DUPLICATE_LCD: ; Already got this switch ;AN000;
616 MOV AX,RC_DUPLICATE_PARMS ; AX := error message number ;AN000;
617 STC ; SET ERROR ;AN000;
618 JMP SHORT GET_LCD_END ; Return ;AN000;
619 ;AN000;
620;-------------------------------------------------------------------------------;AN000;
621; /PRINTBOX was already parsed: ;AN000;
622;-------------------------------------------------------------------------------;AN000;
623BAD_COMBINATION: ; /LCD and /PRINTBOX invalid at same ;AN000;
624 MOV AX,RC_INVLD_COMBINATION ; time, Set the error flag ;AN000;
625 STC ; AX := Error code ;AN000;
626 ;AN000;
627GET_LCD_END: ;AN000;
628 RET ;AN000;
629GET_LCD ENDP ;AN000;
630 ;AN000;
631PAGE ;AN000;
632;===============================================================================;AN000;
633; ;AN000;
634; PROCEDURE_NAME: GET_PRINTBOX ;AN000;
635; ;AN000;
636; INPUT: ES:[BX] := Result block ;AN000;
637; SWITCH_PARSED := The command line switches parsed so far (bit mask) ;AN000;
638; ;AN000;
639; OUTPUT: DEFAULT_BOX := Is overwritten to contain the printbox id. found on ;AN000;
640; the command line. ;AN000;
641; GOT_PRINTBOX is set in SWITCH_PARSED ;AN000;
642; AX := Error message number. ;AN000;
643; CARRY FLAG IS SET IF ERROR FOUND ;AN000;
644; ;AN000;
645;-------------------------------------------------------------------------------;AN000;
646GET_PRINTBOX_ID PROC ;AN000;
647 ;AN000;
648 PUSH CX ;AN000;
649 PUSH SI ;AN000;
650 PUSH DI ;AN000;
651 ;AN000;
652;-------------------------------------------------------------------------------;AN000;
653; Test for error in the printbox statement: ;AN000;
654;-------------------------------------------------------------------------------;AN000;
655 TEST SWITCH_PARSED,GOT_LCD ; If /LCD already mentioned ;AN000;
656 JNZ BAD_COMBINATION2 ; then, error: Invalid combination ;AN000;
657 TEST SWITCH_PARSED,GOT_PRINTBOX ; If already parsed this switch ;AN000;
658 JNZ DUPLICATE_PRINTBOX ; then, error: Duplicate switch ;AN000;
659 ;AN000;
660 MOV DI,ES:[BX+4] ; DI := Offset of switch VALUE found;AN000;
661 ;AN000;
662 .IF <<BYTE PTR [DI]> EQ 0> ; IF no printbox id ;AN000;
663 .THEN ; then, ;AN000;
664 ;----------------------------------------------------------------------;AN000;
665 ; No printbox id. was found: ;AN000;
666 ;----------------------------------------------------------------------;AN000;
667 MOV AX,FORMAT_NOT_CORRECT ; AX := Error code ;AN000;
668 STC ; Set the error flag ;AN000;
669 .ELSE ; else, ;AN000;
670 OR SWITCH_PARSED,GOT_PRINTBOX; Say we found this switch ;AN000;
671 ;----------------------------------------------------------------------;AN000;
672 ; Overwrite DEFAULT_BOX with the Printbox id. found ;AN000;
673 ;----------------------------------------------------------------------;AN000;
674 MOV CL,PRINTBOX_ID_LENGTH ; CX := Maximum number of bytes ;AN000;
675 XOR CH,CH ; to copy ;AN000;
676 MOV SI,DI ; [DS][SI] := Value found ;AN000;
677 MOV DI,OFFSET DEFAULT_BOX ; [ES][DI] := Default value ;AN000;
678 REP MOVSB ; Copy the string ;AN000;
679 ;----------------------------------------------------------------------;AN000;
680 ; Verify that the Printbox id. string is not too long: ;AN000;
681 ;----------------------------------------------------------------------;AN000;
682 .IF <<BYTE PTR [DI-1]> EQ 0> ; If the last byte is a null ;AN000;
683 .THEN ; then, the string was not longer ;AN000;
684 ; than the maximum ;AN000;
685 CLC ; Clear the carry flag = No error ;AN000;
686 .ELSE ; else, string provided is too long ;AN000;
687 MOV AX,RC_Not_In_Sw ; Error := RC for Invalid parm ;AN000;
688 STC ; Set error ;AN000;
689 .ENDIF ; ENDIF printbox id. too long ;AN000;
690 .ENDIF ; ENDIF printbox id. provided ;AN000;
691 ;AN000;
692 JMP SHORT GET_PRINTBOX_END ; Return ;AN000;
693 ;AN000;
694;-------------------------------------------------------------------------------;AN000;
695; /PRINTBOX was already parsed: ;AN000;
696;-------------------------------------------------------------------------------;AN000;
697DUPLICATE_PRINTBOX: ; Already got this switch ;AN000;
698 MOV AX,RC_DUPLICATE_PARMS ; AX := error message number ;AN000;
699 STC ; SET ERROR ;AN000;
700 JMP SHORT GET_PRINTBOX_END ; Return ;AN000;
701 ;AN000;
702;-------------------------------------------------------------------------------;AN000;
703; /LCD was already parsed: ;AN000;
704;-------------------------------------------------------------------------------;AN000;
705BAD_COMBINATION2: ; /LCD and /PRINTBOX invalid at same;AN000;
706 MOV AX,RC_INVLD_COMBINATION ; time, Set the error flag ;AN000;
707 STC ; AX := Error code ;AN000;
708 ;AN000;
709GET_PRINTBOX_END: ;AN000;
710 POP DI ;AN000;
711 POP SI ;AN000;
712 POP CX ;AN000;
713 RET ;AN000;
714GET_PRINTBOX_ID ENDP ;AN000;
715 ;AN000;
716CODE ENDS ;AN000;
717 END ;AN000;
diff --git a/v4.0/src/CMD/GRAPHICS/GRPARMS.EXT b/v4.0/src/CMD/GRAPHICS/GRPARMS.EXT
new file mode 100644
index 0000000..3587787
--- /dev/null
+++ b/v4.0/src/CMD/GRAPHICS/GRPARMS.EXT
@@ -0,0 +1,24 @@
1.XLIST ;AN000;
2PAGE ,132 ;AN000;
3;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
4;; DOS - GRAPHICS Command
5;; (C) Copyright 1988 Microsoft
6;; ;AN000;
7;; File Name: GRPARMS.EXT ;AN000;
8;; ---------- ;AN000;
9;; ;AN000;
10;; Description: ;AN000;
11;; ------------ ;AN000;
12;; External declarations for code and data defined in ;AN000;
13;; GRPARMS.ASM ;AN000;
14;; ;AN000;
15;; Change History: ;AN000;
16;; --------------- ;AN000;
17;; ;AN000;
18;; ;AN000;
19;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
20 ;; ;AN000;
21 EXTRN PARSE_PARMS:NEAR ;; ;AN000;
22 ;; ;AN000;
23;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
24.LIST ;AN000;
diff --git a/v4.0/src/CMD/GRAPHICS/GRPARSE.ASM b/v4.0/src/CMD/GRAPHICS/GRPARSE.ASM
new file mode 100644
index 0000000..3d837bb
--- /dev/null
+++ b/v4.0/src/CMD/GRAPHICS/GRPARSE.ASM
@@ -0,0 +1,87 @@
1 PAGE ,132 ;AN000;
2 TITLE DOS GRAPHICS Command - Profile Load Modules #2
3 ;AN000;
4;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
5;; DOS - GRAPHICS Command
6;; (C) Copyright 1988 Microsoft
7;; ;AN000;
8;; File Name: GRLOAD.ASM ;AN000;
9;; ---------- ;AN000;
10;; ;AN000;
11;; Description: ;AN000;
12;; ------------ ;AN000;
13;; This file contains the modules used to load the ;AN000;
14;; GRAPHICS profile into resident memory. ;AN000;
15;; ;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;
23;; ;AN000;
24;; ;AN000;
25;; Documentation Reference: ;AN000;
26;; ------------------------ ;AN000;
27;; PLACID Functional Specifications ;AN000;
28;; OASIS High Level Design ;AN000;
29;; OASIS GRAPHICS I1 Overview ;AN000;
30;; ;AN000;
31;; Procedures Contained in This File: ;AN000;
32;; ---------------------------------- ;AN000;
33;; LOAD_PROFILE - Main module for profile loading ;AN000;
34;; ;AN000;
35;; Include Files Required: ;AN000;
36;; ----------------------- ;AN000;
37;; ?????????? - Externals for profile loading modules ;AN000;
38;; ;AN000;
39;; External Procedure References: ;AN000;
40;; ------------------------------ ;AN000;
41;; None ;AN000;
42;; ;AN000;
43;; Linkage Instructions: ;AN000;
44;; --------------------- ;AN000;
45;; Refer to GRAPHICS.ASM ;AN000;
46;; ;AN000;
47;; Change History: ;AN000;
48;; --------------- ;AN000;
49;; ;AN000;
50;; ;AN000;
51;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
52 ;; ;AN000;
53 ;; ;AN000;
54CODE SEGMENT PUBLIC 'CODE' ;; ;AN000;
55 ;; ;AN000;
56 INCLUDE STRUC.INC ;; ;AN000;
57 ;; ;AN000;
58;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
59;; ;AN000;
60;; Public Symbols ;AN000;
61;; ;AN000;
62;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
63 ;; ;AN000;
64 ;; ;AN000;
65;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
66 ;; ;AN000;
67 ASSUME CS:CODE,DS:CODE ;; ;AN000;
68 ;; ;AN000;
69;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
70 ;; ;AN000;
71;-------------------------------------------------------------------------------;AN000;
72; Set assemble switches for parse code that is not required!! ;AN000;
73;-------------------------------------------------------------------------------;AN000;
74DateSW EQU 0 ;AN000;
75TimeSW EQU 0 ;AN000;
76CmpxSW EQU 0 ;AN000;
77DrvSW EQU 0 ;AN000;
78QusSW EQU 0 ;AN000;
79KeySW EQU 0 ;AN000;
80;Val1SW EQU 0 ;AN000;
81;Val2SW EQU 0 ;AN000;
82 ;AN000;
83 PUBLIC SYSPARSE ;; ;AN000;
84 INCLUDE PARSE.ASM ;; parser code ;AN000;
85 ;; ;AN000;
86CODE ENDS ;; ;AN000;
87 END ;AN000;
diff --git a/v4.0/src/CMD/GRAPHICS/GRPARSE.EXT b/v4.0/src/CMD/GRAPHICS/GRPARSE.EXT
new file mode 100644
index 0000000..416c664
--- /dev/null
+++ b/v4.0/src/CMD/GRAPHICS/GRPARSE.EXT
@@ -0,0 +1,24 @@
1.XLIST ;AN000;
2 ;AN000;
3;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
4;; DOS - GRAPHICS Command
5;; (C) Copyright 1988 Microsoft
6;; ;AN000;
7;; File Name: GRINST.EXT ;AN000;
8;; ---------- ;AN000;
9;; ;AN000;
10;; Description: ;AN000;
11;; ------------ ;AN000;
12;; External declarations for code and data defined in ;AN000;
13;; GRLOAD.ASM ;AN000;
14;; ;AN000;
15;; Change History: ;AN000;
16;; --------------- ;AN000;
17;; ;AN000;
18;; ;AN000;
19;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
20 ;; ;AN000;
21 EXTRN SYSPARSE:NEAR ;; ;AN000;
22 ;; ;AN000;
23;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
24.LIST ;AN000;
diff --git a/v4.0/src/CMD/GRAPHICS/GRPATTRN.ASM b/v4.0/src/CMD/GRAPHICS/GRPATTRN.ASM
new file mode 100644
index 0000000..06aed1b
--- /dev/null
+++ b/v4.0/src/CMD/GRAPHICS/GRPATTRN.ASM
@@ -0,0 +1,217 @@
1 PAGE ,132 ;AN000;
2 TITLE DOS - GRAPHICS Command - Common modules ;AN000;
3.xlist ;AN000;
4;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
5;; DOS - GRAPHICS Command
6;; (c) Copyright 1988 Microsoft
7;; ;AN000;
8;; File Name: GRPATTRN.ASM ;AN000;
9;; ---------- ;AN000;
10;; ;AN000;
11;; Description: ;AN000;
12;; ------------ ;AN000;
13;; This file contains the grey patterns used by PRT_BW_APA for printing ;AN000;
14;; on a Black and White printer. ;AN000;
15;; ;AN000;
16;; Documentation Reference: ;AN000;
17;; ------------------------ ;AN000;
18;; OASIS High Level Design ;AN000;
19;; OASIS GRAPHICS I1 Overview ;AN000;
20;; ;AN000;
21;; Procedures Contained in This File: ;AN000;
22;; ---------------------------------- ;AN000;
23;; none ;AN000;
24;; ;AN000;
25;; Include Files Required: ;AN000;
26;; ----------------------- ;AN000;
27;; GRPATTRN.STR - Structures for patterns. ;AN000;
28;; ;AN000;
29;; ;AN000;
30;; External Procedure References: ;AN000;
31;; ------------------------------ ;AN000;
32;; ;AN000;
33;; Called by PRT_BW_APA from file GRBWPRT.ASM ;AN000;
34;; ;AN000;
35;; Linkage Instructions: ;AN000;
36;; -------------------- ;AN000;
37;; ;AN000;
38;; Change History: ;AN000;
39;; --------------- ;AN000;
40;; ;AN000;
41;; ;AN000;
42;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
43.list ;AN000;
44CODE SEGMENT PUBLIC 'CODE' ;AN000;
45 ASSUME CS:CODE,DS:CODE ;AN000;
46INCLUDE GRPATTRN.STR ;AN000;
47 ;AN000;
48PUBLIC TAB_DIRECTORY ;AN000;
49PUBLIC TAB_DIR_NB_ENTRIES ;AN000;
50PUBLIC PAT_4X2 ;AN000;
51PUBLIC PAT_4X4 ;AN000;
52PUBLIC PAT_6X2 ;AN000;
53PUBLIC PAT_8X2 ;AN000;
54PUBLIC PAT_6X4 ;AN000;
55PUBLIC PAT_8X4 ;AN000;
56PUBLIC PAT_8X6 ;AN000;
57 ;AN000;
58;-------------------------------------------------------------------------------;AN000;
59; ;AN000;
60; PATTERN DIRECTORY: ;AN000;
61; ;AN000;
62;-------------------------------------------------------------------------------;AN000;
63TAB_DIR_NB_ENTRIES DB 7 ;AN000;
64TAB_DIRECTORY LABEL BYTE ;AN000;
65; ENTRY = <OFFSET PATTERN TABLE, TABLE SIZE, BOX_W, BOX_H, ;AN000;
66; NUNBER OF PATTERNS(INTENSITIES) > ;AN000;
67 TAB_ENTRY <OFFSET PAT_4X2,-1,40,2,1,8 > ;AN000;
68 TAB_ENTRY <OFFSET PAT_4X4,-1,40,2,2,8 > ;AN000;
69 TAB_ENTRY <OFFSET PAT_6X2,-1,70,3,1,10> ;AN000;
70 TAB_ENTRY <OFFSET PAT_8X2,-1,108,4,1,12> ;AN000;
71 TAB_ENTRY <OFFSET PAT_6X4,-1,119,3,2,17> ;AN000;
72 TAB_ENTRY <OFFSET PAT_8X4,-1,162,4,2,18> ;AN000;
73 TAB_ENTRY <OFFSET PAT_8X6,-1,171,4,3,19> ;AN000;
74;-------------------------------------------------------------------------------;AN000;
75; ;AN000;
76; 4X2 GREY PATTERNS: ;AN000;
77; ;AN000;
78;-------------------------------------------------------------------------------;AN000;
79PAT_4X2 LABEL BYTE ;AN000;
80; PATTERN=<MAXIMUM INTENSITY, 1ST COLUMN (top is left bit), 2ND, 3RD, 4TH > ;AN000;
81 PAT_4X2_STR < 5,11B,11B,11B,11B> ;AN000;
82 PAT_4X2_STR <13,11B,10B,01B,11B> ;AN000;
83 PAT_4X2_STR <20,10B,11B,01B,10B> ;AN000;
84 PAT_4X2_STR <28,10B,01B,01B,10B> ;AN000;
85 PAT_4X2_STR <36,10B,00B,01B,10B> ;AN000;
86 PAT_4X2_STR <47,10B,00B,01B,00B> ;AN000;
87 PAT_4X2_STR <58,10B,00B,00B,00B> ;AN000;
88 PAT_4X2_STR <63,00B,00B,00B,00B> ;AN000;
89 ;AN000;
90;-------------------------------------------------------------------------------;AN000;
91; ;AN000;
92; 4X4 GREY PATTERNS: ;AN000;
93; ;AN000;
94;-------------------------------------------------------------------------------;AN000;
95PAT_4X4 LABEL BYTE ;AN000;
96; PATTERN=<MAXIMUM INTENSITY, 1ST COLUMN (top is left bit), 2ND, 3RD, 4TH > ;AN000;
97 PAT_4X4_STR < 5,1111B,1111B,1111B,1111B> ;AN000;
98 PAT_4X4_STR <13,1111B,1010B,0101B,1111B> ;AN000;
99 PAT_4X4_STR <20,1010B,1111B,0101B,1010B> ;AN000;
100 PAT_4X4_STR <28,1010B,0101B,0101B,1010B> ;AN000;
101 PAT_4X4_STR <36,1010B,0000B,0101B,1010B> ;AN000;
102 PAT_4X4_STR <47,1010B,0000B,0101B,0000B> ;AN000;
103 PAT_4X4_STR <58,1010B,0000B,0000B,0000B> ;AN000;
104 PAT_4X4_STR <63,0000B,0000B,0000B,0000B> ;AN000;
105 ;AN000;
106;-------------------------------------------------------------------------------;AN000;
107; ;AN000;
108; 6X2 GREY PATTERNS: ;AN000;
109; ;AN000;
110;-------------------------------------------------------------------------------;AN000;
111PAT_6X2 LABEL BYTE ;AN000;
112 PAT_6X2_STR < 3,11B,11B,11B,11B,11B,11B> ;AN000;
113 PAT_6X2_STR < 8,11B,11B,10B,11B,11B,01B> ;AN000;
114 PAT_6X2_STR <15,10B,01B,10B,11B,10B,01B> ;AN000;
115 PAT_6X2_STR <21,01B,10B,10B,01B,10B,10B> ;AN000;
116 PAT_6X2_STR <28,01B,10B,10B,01B,10B,00B> ;AN000;
117 PAT_6X2_STR <36,10B,01B,00B,10B,01B,00B> ;AN000;
118 PAT_6X2_STR <45,00B,10B,00B,01B,00B,10B> ;AN000;
119 PAT_6X2_STR <53,10B,00B,00B,01B,00B,00B> ;AN000;
120 PAT_6X2_STR <60,10B,00B,00B,00B,00B,00B> ;AN000;
121 PAT_6X2_STR <63,00B,00B,00B,00B,00B,00B> ;AN000;
122 ;AN000;
123;-------------------------------------------------------------------------------;AN000;
124; ;AN000;
125; 8X2 GREY PATTERNS: ;AN000;
126; ;AN000;
127;-------------------------------------------------------------------------------;AN000;
128PAT_8X2 LABEL BYTE ;AN000;
129 PAT_8X2_STR < 3,11B,11B,11B,11B,11B,11B,11B,11B> ;AN000;
130 PAT_8X2_STR < 9,11B,11B,10B,11B,11B,10B,11B,01B> ;AN000;
131 PAT_8X2_STR <15,10B,11B,01B,11B,10B,11B,00B,11B> ;AN000;
132 PAT_8X2_STR <21,10B,01B,11B,10B,01B,10B,01B,10B> ;AN000;
133 PAT_8X2_STR <27,10B,01B,01B,10B,10B,01B,01B,10B> ;AN000;
134 PAT_8X2_STR <33,00B,10B,01B,10B,00B,01B,10B,01B> ;AN000;
135 PAT_8X2_STR <39,10B,00B,10B,01B,00B,10B,00B,01B> ;AN000;
136 PAT_8X2_STR <45,10B,00B,01B,00B,10B,00B,01B,00B> ;AN000;
137 PAT_8X2_STR <51,10B,00B,00B,01B,00B,00B,10B,00B> ;AN000;
138 PAT_8X2_STR <56,10B,00B,00B,00B,01B,00B,00B,00B> ;AN000;
139 PAT_8X2_STR <61,10B,00B,00B,00B,00B,00B,00B,00B> ;AN000;
140 PAT_8X2_STR <63,00B,00B,00B,00B,00B,00B,00B,00B> ;AN000;
141 ;AN000;
142;-------------------------------------------------------------------------------;AN000;
143; ;AN000;
144; 6X4 GREY PATTERNS: ;AN000;
145; ;AN000;
146;-------------------------------------------------------------------------------;AN000;
147PAT_6X4 LABEL BYTE ;AN000;
148 PAT_6X4_STR < 3,1111B,1111B,1111B,1111B,1111B,1111B> ;AN000;
149 PAT_6X4_STR < 8,1111B,1111B,1101B,1111B,1111B,1011B> ;AN000;
150 PAT_6X4_STR <13,1111B,1111B,0101B,1011B,1111B,1010B> ;AN000;
151 PAT_6X4_STR <16,0101B,1111B,0101B,1010B,0101B,1010B> ;AN000;
152 PAT_6X4_STR <20,0101B,1110B,0101B,1010B,0101B,1010B> ;AN000;
153 PAT_6X4_STR <24,1010B,0101B,1010B,0101B,0010B,0101B> ;AN000;
154 PAT_6X4_STR <28,1010B,0101B,1000B,0101B,0010B,0101B> ;AN000;
155 PAT_6X4_STR <32,1010B,0101B,1000B,1001B,0010B,0100B> ;AN000;
156 PAT_6X4_STR <37,1010B,0000B,1010B,0101B,0000B,0101B> ;AN000;
157 PAT_6X4_STR <40,0100B,0001B,1000B,0010B,1000B,0101B> ;AN000;
158 PAT_6X4_STR <45,0100B,0010B,1000B,0010B,0100B,0001B> ;AN000;
159 PAT_6X4_STR <49,1010B,0000B,1000B,0101B,0000B,0000B> ;AN000;
160 PAT_6X4_STR <52,1010B,0000B,0000B,0101B,0000B,0000B> ;AN000;
161 PAT_6X4_STR <55,0000B,1000B,0000B,0010B,0000B,0100B> ;AN000;
162 PAT_6X4_STR <58,1000B,0000B,0000B,0010B,0000B,0000B> ;AN000;
163 PAT_6X4_STR <61,1000B,0000B,0000B,0000B,0000B,0000B> ;AN000;
164 PAT_6X4_STR <63,0000B,0000B,0000B,0000B,0000B,0000B> ;AN000;
165 ;AN000;
166;-------------------------------------------------------------------------------;AN000;
167; ;AN000;
168; 8X4 GREY PATTERNS: ;AN000;
169; ;AN000;
170;-------------------------------------------------------------------------------;AN000;
171PAT_8X4 LABEL BYTE ;AN000;
172 PAT_8X4_STR < 1,1111B,1111B,1111B,1111B,1111B,1111B,1111B,1111B> ;AN000;
173 PAT_8X4_STR < 4,1010B,1111B,1111B,1111B,1010B,1111B,1111B,1111B> ;AN000;
174 PAT_8X4_STR < 7,1010B,1111B,1101B,1111B,1010B,1111B,0111B,1111B> ;AN000;
175 PAT_8X4_STR <10,1010B,0111B,1110B,0101B,1010B,1101B,1011B,0101B> ;AN000;
176 PAT_8X4_STR <13,1001B,1110B,0110B,1001B,0110B,1011B,1001B,0110B> ;AN000;
177 PAT_8X4_STR <18,1010B,0101B,1110B,0101B,1010B,0101B,1010B,0101B> ;AN000;
178 PAT_8X4_STR <24,1010B,0101B,0101B,1010B,1010B,0101B,0101B,1010B> ;AN000;
179 PAT_8X4_STR <30,1010B,0101B,1010B,0000B,0101B,1010B,0101B,0000B> ;AN000;
180 PAT_8X4_STR <36,1010B,0000B,1010B,0101B,0000B,1010B,0000B,0101B> ;AN000;
181 PAT_8X4_STR <42,1010B,0000B,0101B,0000B,1010B,0000B,0101B,0000B> ;AN000;
182 PAT_8X4_STR <46,0010B,1000B,0000B,0010B,1000B,0001B,0100B,0001B> ;AN000;
183 PAT_8X4_STR <48,1010B,0000B,0101B,0000B,0000B,1010B,0000B,0000B> ;AN000;
184 PAT_8X4_STR <50,0010B,0000B,1000B,0010B,0000B,0100B,0001B,0000B> ;AN000;
185 PAT_8X4_STR <53,1010B,0000B,0000B,0000B,0101B,0000B,0000B,0000B> ;AN000;
186 PAT_8X4_STR <56,0000B,1000B,0000B,0000B,0100B,0000B,0000B,0010B> ;AN000;
187 PAT_8X4_STR <59,1000B,0000B,0000B,0000B,0010B,0000B,0000B,0000B> ;AN000;
188 PAT_8X4_STR <62,1000B,0000B,0000B,0000B,0000B,0000B,0000B,0000B> ;AN000;
189 PAT_8X4_STR <63,0000B,0000B,0000B,0000B,0000B,0000B,0000B,0000B> ;AN000;
190 ;AN000;
191;-------------------------------------------------------------------------------;AN000;
192; ;AN000;
193; 8X6 GREY PATTERNS: ;AN000;
194; ;AN000;
195;-------------------------------------------------------------------------------;AN000;
196PAT_8X6 LABEL BYTE ;AN000;
197 PAT_8X6_STR < 1,111111B,111111B,111111B,111111B,111111B,111111B,111111B,111111B>;AN000;
198 PAT_8X6_STR < 4,011011B,111111B,111111B,111111B,110110B,111111B,111111B,111111B>;AN000;
199 PAT_8X6_STR < 7,101010B,011111B,111111B,110101B,101010B,011111B,111111B,110101B>;AN000;
200 PAT_8X6_STR <10,101010B,010101B,111111B,101010B,010101B,101010B,111111B,010101B>;AN000;
201 PAT_8X6_STR <13,011011B,100100B,111011B,100100B,011011B,100100B,011111B,100100B>;AN000;
202 PAT_8X6_STR <17,101010B,010101B,101010B,010101B,101010B,010101B,101010B,010101B>;AN000;
203 PAT_8X6_STR <21,101010B,010101B,101010B,010101B,001010B,010101B,101010B,010101B>;AN000;
204 PAT_8X6_STR <25,010100B,101010B,010101B,001010B,100100B,010001B,101110B,000001B>;AN000;
205 PAT_8X6_STR <29,000000B,010101B,101010B,010101B,000000B,101010B,010101B,101010B>;AN000;
206 PAT_8X6_STR <33,010010B,100101B,011000B,100010B,001101B,100000B,001010B,100100B>;AN000;
207 PAT_8X6_STR <37,100100B,001010B,010000B,001001B,100010B,001101B,010000B,001010B>;AN000;
208 PAT_8X6_STR <41,100000B,010010B,100100B,000010B,101000B,000101B,010000B,001010B>;AN000;
209 PAT_8X6_STR <45,100010B,001000B,000010B,100000B,010100B,000001B,100100B,000000B>;AN000;
210 PAT_8X6_STR <49,101000B,000001B,000100B,010000B,000010B,100000B,001000B,000101B>;AN000;
211 PAT_8X6_STR <53,101010B,000000B,000000B,000000B,010101B,000000B,000000B,000000B>;AN000;
212 PAT_8X6_STR <57,000000B,010000B,000000B,000100B,000000B,100000B,000000B,000010B>;AN000;
213 PAT_8X6_STR <60,100000B,000000B,000000B,000000B,000100B,000000B,000000B,000000B>;AN000;
214 PAT_8X6_STR <62,100000B,000000B,000000B,000000B,000000B,000000B,000000B,000000B>;AN000;
215 PAT_8X6_STR <63,000000B,000000B,000000B,000000B,000000B,000000B,000000B,000000B>;AN000;
216CODE ENDS ;AN000;
217 END ;AN000;
diff --git a/v4.0/src/CMD/GRAPHICS/GRPATTRN.EXT b/v4.0/src/CMD/GRAPHICS/GRPATTRN.EXT
new file mode 100644
index 0000000..cfe1dad
--- /dev/null
+++ b/v4.0/src/CMD/GRAPHICS/GRPATTRN.EXT
@@ -0,0 +1,31 @@
1PAGE ,132 ;AN000;
2.XLIST ;AN000;
3;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
4;; DOS - GRAPHICS Command
5;; (C) Copyright 1988 Microsoft
6;; ;AN000;
7;; File Name: GRPATTRN.EXT ;AN000;
8;; ---------- ;AN000;
9;; ;AN000;
10;; Description: ;AN000;
11;; ------------ ;AN000;
12;; Include file containing external declarations for ;AN000;
13;; the data defined in GRPATTRN.ASM ;AN000;
14;; ;AN000;
15;; Change History: ;AN000;
16;; --------------- ;AN000;
17;; ;AN000;
18;; ;AN000;
19;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
20 ;; ;AN000;
21;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
22.LIST ;AN000;
23EXTRN PAT_4X2:BYTE ;AN000;
24EXTRN PAT_4X4:BYTE ;AN000;
25EXTRN PAT_6X2:BYTE ;AN000;
26EXTRN PAT_8X2:BYTE ;AN000;
27EXTRN PAT_6X4:BYTE ;AN000;
28EXTRN PAT_8X4:BYTE ;AN000;
29EXTRN PAT_8X6:BYTE ;AN000;
30EXTRN TAB_DIRECTORY:NEAR ;AN000;
31EXTRN TAB_DIR_NB_ENTRIES:BYTE ;AN000;
diff --git a/v4.0/src/CMD/GRAPHICS/GRPATTRN.STR b/v4.0/src/CMD/GRAPHICS/GRPATTRN.STR
new file mode 100644
index 0000000..1e2947d
--- /dev/null
+++ b/v4.0/src/CMD/GRAPHICS/GRPATTRN.STR
@@ -0,0 +1,125 @@
1.XLIST ;AN000;
2PAGE ,132 ;AN000;
3;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
4;; DOS - GRAPHICS Command
5;; (C) Copyright 1988 Microsoft
6;; ;AN000;
7;; File Name: GRPATTRN.STR ;AN000;
8;; ---------- ;AN000;
9;; ;AN000;
10;; Description: ;AN000;
11;; ------------ ;AN000;
12;; Include file containing structures for ;AN000;
13;; the Printer grey patterns. ;AN000;
14;; ;AN000;
15;; Change History: ;AN000;
16;; --------------- ;AN000;
17;; ;AN000;
18;; ;AN000;
19;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
20 ;; ;AN000;
21;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
22.LIST ;AN000;
23 ;AN000;
24TAB_ENTRY STRUC ; TABLE DIRECTORY ENTRY USED TO LOCATED ;AN000;
25 ; WHAT TABLE OF PATTERNS TO USE ;AN000;
26 TAB_OFFSET DW ? ; ADDRESS OF THE PATTERN TABLE ;AN000;
27 TAB_COPY DW ? ; ADDRESS OF PATTERN TABLE COPY IN SHARED DATA ;AN000;
28 TAB_SIZE DW ? ; SIZE OF THE PATTERN TABLE ;AN000;
29 BOX_W_PAT DB ? ; BOX WIDTH FOR PATTERNS IN THIS TABLE ;AN000;
30 BOX_H_PAT DB ? ; BOX HEIGHT FOR PATTERNS IN THIS TABLE ;AN000;
31 NB_INT DB ? ; NUMBER OF INTENSITIES IN THIS TABLE ;AN000;
32TAB_ENTRY ENDS ;AN000;
33 ;AN000;
34;-------------------------------------------------------------------------------;AN000;
35; PATTERN TYPES: ;AN000;
36; ;AN000;
37; The maximum intensity field represents the upper bound for using ;AN000;
38; a pattern (e.g., the acual intensity of a specific pattern may be ;AN000;
39; 25 but, it will be used for printing intensities of up to 32). ;AN000;
40; Intensities range from 0 = Black to 63 = White. ;AN000;
41; ;AN000;
42; For example, a 4x2 structure represents the following pattern: ;AN000;
43; --- ;AN000;
44; ;AN000;
45; BYTES: C1_4X2 C2_4X2 C3_4X2 C4_4X2 ;AN000;
46; ;AN000;
47; Top dot to print ------> 0 0 0 0 ;AN000;
48; ;AN000;
49; Least significatnt bit ------> 0 0 0 0 ;AN000;
50; of the byte is the dot ;AN000;
51; printed below. ;AN000;
52; ;AN000;
53;-------------------------------------------------------------------------------;AN000;
54 ;AN000;
55PAT_4X2_STR STRUC ; PATTERN MADE OF 2X1 BOXES ;AN000;
56 MAX_4X2 DB ? ; Maximum intensity ;AN000;
57 C1_4X2 DB 00B ; Column 1 (Leftmost column) ;AN000;
58 C2_4X2 DB 00B ; Column 2 ;AN000;
59 C3_4X2 DB 00B ; Column 3 ;AN000;
60 C4_4X2 DB 00B ; Column 4 (Rightmost column) ;AN000;
61PAT_4X2_STR ENDS ;AN000;
62 ;AN000;
63PAT_4X4_STR STRUC ; PATTERN MADE OF 2X2 BOXES ;AN000;
64 MAX_4X4 DB ? ; Maximum intensity ;AN000;
65 C1_4X4 DB 0000B ; Column 1 (Leftmost column) ;AN000;
66 C2_4X4 DB 0000B ; Column 2 ;AN000;
67 C3_4X4 DB 0000B ; Column 3 ;AN000;
68 C4_4X4 DB 0000B ; Column 4 (Rightmost column) ;AN000;
69PAT_4X4_STR ENDS ;AN000;
70 ;AN000;
71PAT_6X2_STR STRUC ; PATTERN MADE OF 3X1 BOXES ;AN000;
72 MAX_6X2 DB ? ; Maximum intensity ;AN000;
73 C1_6X2 DB 00B ; Column 1 (Leftmost column) ;AN000;
74 C2_6X2 DB 00B ; Column 2 ;AN000;
75 C3_6X2 DB 00B ; Column 3 ;AN000;
76 C4_6X2 DB 00B ; Column 4 ;AN000;
77 C5_6X2 DB 00B ; Column 5 ;AN000;
78 C6_6X2 DB 00B ; Column 6 (Rightmost column) ;AN000;
79PAT_6X2_STR ENDS ;AN000;
80 ;AN000;
81PAT_8X2_STR STRUC ; PATTERN MADE OF 4X1 BOXES ;AN000;
82 MAX_8X2 DB ? ; Maximum intensity ;AN000;
83 C1_8X2 DB 00B ; Column 1 (Leftmost column) ;AN000;
84 C2_8X2 DB 00B ; Column 2 ;AN000;
85 C3_8X2 DB 00B ; Column 3 ;AN000;
86 C4_8X2 DB 00B ; Column 4 ;AN000;
87 C5_8X2 DB 00B ; Column 5 ;AN000;
88 C6_8X2 DB 00B ; Column 6 ;AN000;
89 C7_8X2 DB 00B ; Column 7 ;AN000;
90 C8_8X2 DB 00B ; Column 8 (Rightmost column) ;AN000;
91PAT_8X2_STR ENDS ;AN000;
92 ;AN000;
93PAT_8X4_STR STRUC ; PATTERN MADE OF 4X2 BOXES ;AN000;
94 MAX_8X4 DB ? ; Maximum intensity ;AN000;
95 C1_8X4 DB 0000B ; Column 1 (Leftmost column) ;AN000;
96 C2_8X4 DB 0000B ; Column 2 ;AN000;
97 C3_8X4 DB 0000B ; Column 3 ;AN000;
98 C4_8X4 DB 0000B ; Column 4 ;AN000;
99 C5_8X4 DB 0000B ; Column 5 ;AN000;
100 C6_8X4 DB 0000B ; Column 6 ;AN000;
101 C7_8X4 DB 0000B ; Column 7 ;AN000;
102 C8_8X4 DB 0000B ; Column 8 (Rightmost column) ;AN000;
103PAT_8X4_STR ENDS ;AN000;
104 ;AN000;
105PAT_6X4_STR STRUC ; PATTERN MADE OF 3X2 BOXES ;AN000;
106 MAX_6X4 DB ? ; Maximum intensity ;AN000;
107 C1_6X4 DB 0000B ; Column 1 (Leftmost column) ;AN000;
108 C2_6X4 DB 0000B ; Column 2 ;AN000;
109 C3_6X4 DB 0000B ; Column 3 ;AN000;
110 C4_6X4 DB 0000B ; Column 4 ;AN000;
111 C5_6X4 DB 0000B ; Column 5 ;AN000;
112 C6_6X4 DB 0000B ; Column 6 (Rightmost column) ;AN000;
113PAT_6X4_STR ENDS ;AN000;
114 ;AN000;
115PAT_8X6_STR STRUC ; PATTERN MADE OF 4X3 BOXES ;AN000;
116 MAX_8X6 DB ? ; Maximum intensity ;AN000;
117 C1_8X6 DB 000000B ; Column 1 (Leftmost column) ;AN000;
118 C2_8X6 DB 000000B ; Column 2 ;AN000;
119 C3_8X6 DB 000000B ; Column 3 ;AN000;
120 C4_8X6 DB 000000B ; Column 4 ;AN000;
121 C5_8X6 DB 000000B ; Column 5 ;AN000;
122 C6_8X6 DB 000000B ; Column 6 ;AN000;
123 C7_8X6 DB 000000B ; Column 7 ;AN000;
124 C8_8X6 DB 000000B ; Column 8 (Rightmost column) ;AN000;
125PAT_8X6_STR ENDS ;AN000;
diff --git a/v4.0/src/CMD/GRAPHICS/GRPRINT.EXT b/v4.0/src/CMD/GRAPHICS/GRPRINT.EXT
new file mode 100644
index 0000000..a4d0732
--- /dev/null
+++ b/v4.0/src/CMD/GRAPHICS/GRPRINT.EXT
@@ -0,0 +1,29 @@
1;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
2;; DOS - GRAPHICS Command
3;; (C) Copyright 1988 Microsoft
4;; ;AN000;
5;; File Name: GRPRINT.EXT ;AN000;
6;; ---------- ;AN000;
7;; ;AN000;
8;; Description: ;AN000;
9;; ------------ ;AN000;
10;; External declarations for code and data defined in ;AN000;
11;; GRPRINT.ASM ;AN000;
12;; ;AN000;
13;; Change History: ;AN000;
14;; --------------- ;AN000;
15;; ;AN000;
16;; ;AN000;
17;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
18 ;; ;AN000;
19 EXTRN PRINT_MODULE_START:NEAR ;; ;AN000;
20 EXTRN LEN_OF_BW_MODULES:ABS ;; ;AN000;
21 EXTRN LEN_OF_COLOR_MODULES:ABS ;; ;AN000;
22 EXTRN COLOR_PRINT_MODULES:NEAR ;; ;AN000;
23 EXTRN BW_PRINT_MODULES:NEAR ;; ;AN000;
24 EXTRN PRINT_COLOR:NEAR ;; ;AN000;
25 EXTRN RGB2BAND:NEAR ;; ;AN000;
26 EXTRN PRINT_BW_APA:NEAR ;; ;AN000;
27 EXTRN RGB2INT:NEAR ;; ;AN000;
28 ;; ;AN000;
29;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
diff --git a/v4.0/src/CMD/GRAPHICS/GRSHAR.STR b/v4.0/src/CMD/GRAPHICS/GRSHAR.STR
new file mode 100644
index 0000000..5e62727
--- /dev/null
+++ b/v4.0/src/CMD/GRAPHICS/GRSHAR.STR
@@ -0,0 +1,127 @@
1.XLIST ;AN000;
2PAGE ;AN000;
3;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
4;; DOS - GRAPHICS Command
5;; (C) Copyright IBM Corp 198?,... ;AN000;
6;; ;AN000;
7;; File Name: GRSHAR.STR ;AN000;
8;; ---------- ;AN000;
9;; ;AN000;
10;; Description: ;AN000;
11;; ------------ ;AN000;
12;; Include file containing structures and equates for ;AN000;
13;; Shared Data Area. ;AN000;
14;; ;AN000;
15;; This area is used for communication between the installation process ;AN000;
16;; and the Print Screen process; it contains all the information ;AN000;
17;; extracted from the printer profile. ;AN000;
18;; ;AN000;
19;; ;AN000;
20;; Change History: ;AN000;
21;; --------------- ;AN000;
22;; ;AN000;
23;; ;AN000;
24;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
25 ;; ;AN000;
26;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
27.LIST ;AN000;
28 ; ;AN000;
29SHARED_DATA_AREA_STR STRUC ; ;AN000;
30 SD_TOTAL_SIZE DW ? ; Total # bytes ALLOCATED to the ;AN000;
31 ; the Shared Data Area. ;AN000;
32 ;;;;;;;;;;;; Environment ;;;;;;;;;;;;;; ;AN000;
33 SWITCHES DB 0 ; Command line switches ;AN000;
34 HARDWARE_CONFIG DB ? ; Type of video hardware ;AN000;
35 PRINTER_TYPE DB ? ; Type of printer attached ;AN000;
36 ; ;AN000;
37 ;;;;;;;;;;;; Profile Data ;;;;;;;;;;;;; ;AN000;
38 DARKADJUST_VALUE DB 0 ; Darkness adjustment value ;AN000;
39 ; ;AN000;
40 NUM_PRT_COLOR DB ? ; Number of print colors ;AN000;
41 COLORPRINT_PTR DW ? ; Pointer to COLORPRINT info ;AN000;
42 ; ;AN000;
43 NUM_PRT_BANDS DB ? ; Number of selectable print bands ;AN000;
44 COLORSELECT_PTR DW ? ; Pointer to COLORSELECT info ;AN000;
45 ; bands ;AN000;
46 DISPLAYMODE_PTR DW ? ; Pointer to start of DISPLAYMODE ;AN000;
47 ; info ;AN000;
48SHARED_DATA_AREA_STR ENDS ;; ;AN000;
49 ;AN000;
50 ;AN000;
51;;;;;;;;; COLORSELECT info structure ;;;; ;AN000;
52 ; ;AN000;
53COLORSELECT_STR STRUC ; ;AN000;
54 NUM_SELECT_ESC DB ? ; number of escape bytes to ;AN000;
55 ; select this band ;AN000;
56 SELECT_ESC DB ? ; Escape bytes to select band ;AN000;
57COLORSELECT_STR ENDS ;; ;AN000;
58 ;AN000;
59 ;AN000;
60 ;AN000;
61;;;;;;;;; COLORPRINT info structure ;;;;; ;AN000;
62 ; ;AN000;
63COLORPRINT_STR STRUC ; ;AN000;
64 RED DB ? ; RGB value ;AN000;
65 GREEN DB ? ; ;AN000;
66 BLUE DB ? ; ;AN000;
67 ; Bit mask indicating color ;AN000;
68 SELECT_MASK DB ? ; bands required: ;AN000;
69 ; Bit 0: first band in table ;AN000;
70COLORPRINT_STR ENDS ;; Bit 1: second band... ;AN000;
71 ;AN000;
72 ;AN000;
73;;;;;;;;; DISPLAYMODE info structure ;;;; ;AN000;
74 ; A new block is built when a ;AN000;
75DISPLAYMODE_STR STRUC ; DISPLAYMODE statement is ;AN000;
76 ; found ;AN000;
77 NEXT_DISP_MODE DW ? ; Pointer to info for next ;AN000;
78 ; display mode; -1 if last ;AN000;
79 NUM_DISP_MODE DB ? ; Number of display modes for ;AN000;
80 DISP_MODE_LIST_PTR DW ? ; this record - list of them ;AN000;
81 ; ;AN000;
82 BOX_WIDTH DB ? ; Print box size - horizontal ;AN000;
83 BOX_HEIGHT DB ? ; Print box size - vertical ;AN000;
84 ; ;AN000;
85 NUM_PATTERNS DB ? ; Number of grey patterns for ;AN000;
86 ; this box size ;AN000;
87 PATTERN_TAB_PTR DW ? ; pointer to grey pattern table ;AN000;
88 ; for this display mode ;AN000;
89 NUM_GRAPHICS_ESC DB ? ; # of escape byte for GRAPHICS ;AN000;
90 GRAPHICS_ESC_PTR DW ? ; pointer to GRAPHICS escape ;AN000;
91 LOW_BYT_COUNT_PTR DW ? ; pointers to number of bytes sent ;AN000;
92 HGH_BYT_COUNT_PTR DW ? ; to the printer (1 word holds this ;AN000;
93 ; number but, must be send 1 byte ;AN000;
94 ; at a time). ;AN000;
95 NUM_SETUP_ESC DB ? ; # of escape byte for SETUP ;AN000;
96 SETUP_ESC_PTR DW ? ; pointer to SETUP escape seq ;AN000;
97 ; for this display mode ;AN000;
98 NUM_RESTORE_ESC DB ? ; # of escape byte for RESTORE ;AN000;
99 RESTORE_ESC_PTR DW ? ; pointer to RESTORE escape ;AN000;
100 ; seq for this display mode ;AN000;
101 PRINT_OPTIONS DB ? ; ;AN000;
102 ; ;AN000;
103DISPLAYMODE_STR ENDS ;; ;AN000;
104 ;AN000;
105;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
106;; ;AN000;
107;; SHARED DATA AREA - EQUATES ;AN000;
108;; ;AN000;
109;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;AN000;
110 ;AN000;
111; SWITCHES DB <bit mask> ; Command line switches: ;AN000;
112 REVERSE_SW EQU 1 ; /R ;AN000;
113 BACKGROUND_SW EQU 2 ; /B ;AN000;
114 ; ;AN000;
115; HARDWARE_CONFIG DB <bit mask> ; Type of video hardware ;AN000;
116 PALACE EQU 1 ; attached ;AN000;
117 ROUNDUP EQU 2 ; PS 2 MODEL 50 60 AND 80 ;AN000;
118 EGA EQU 4 ; Enhance Graphics Adapter ;AN000;
119 PC_CONVERTIBLE EQU 8 ; PC Convertible LCD ;AN000;
120 OLD_ADAPTER EQU 16 ; Color Graph. Adater or MONO ;AN000;
121 ; ;AN000;
122; PRINTER_TYPE DB <bit mask> ; Type of printer attached ;AN000;
123 COLOR EQU 1 ; ;AN000;
124 BLACK_WHITE EQU 2 ; ;AN000;
125 ; ;AN000;
126; PRINT_OPTIONS DB <bit mask> ; ;AN000;
127 ROTATE EQU 1 ; ;AN000;
diff --git a/v4.0/src/CMD/GRAPHICS/MAKEFILE b/v4.0/src/CMD/GRAPHICS/MAKEFILE
new file mode 100644
index 0000000..af52400
--- /dev/null
+++ b/v4.0/src/CMD/GRAPHICS/MAKEFILE
@@ -0,0 +1,64 @@
1#************************** makefile for cmd\... ***************************
2
3msg =..\..\messages
4dos =..\..\dos
5inc =..\..\inc
6hinc =..\..\h
7
8#
9####################### dependencies begin here. #########################
10#
11
12all: graphics.com
13
14
15graphics.ctl: graphics.skl $(msg)\$(COUNTRY).msg
16
17graphics.obj: graphics.asm grinst.ext makefile
18
19grinst.obj: grinst.asm grload.ext grload2.ext grctrl.ext grprint.ext \
20 grcpsd.ext grparms.ext grparse.ext grbwprt.ext grcolprt.ext \
21 grint2fh.ext grmsg.equ graphics.ctl graphics.cla graphics.cl1 \
22 graphics.clb \
23 graphics.cl2 graphics.clc \
24 $(inc)\sysmsg.inc $(inc)\struc.inc grshar.str makefile
25
26grcpsd.obj: grparse.asm makefile $(inc)\parse.asm
27
28grparse.obj: grcpsd.asm makefile
29
30grpattrn.obj: grpattrn.asm grpattrn.str makefile
31
32grbwprt.obj: grbwprt.asm grcommon.ext grctrl.str grshar.str makefile \
33 grpattrn.str $(inc)\struc.inc makefile
34
35grint2fh.obj: grint2fh.asm grload.ext grctrl.ext grprint.ext \
36 grcpsd.ext makefile
37
38grctrl.obj: grctrl.asm grint2fh.ext grbwprt.ext grcolprt.ext grshar.str \
39 grpattrn.str grpattrn.ext grctrl.str $(inc)\struc.inc \
40 makefile
41
42grcolprt.obj: grctrl.str grshar.str grpattrn.str grctrl.ext \
43 $(inc)\struc.inc grcommon.asm makefile
44
45grload.obj: grload.asm $(inc)\struc.inc grinst.ext grshar.str grparse.ext \
46 grload2.ext grload3.ext grmsg.equ makefile
47
48grload2.obj: grload2.asm $(inc)\struc.inc grinst.ext grshar.str grmsg.equ \
49 grinst.ext grload.ext grparse.ext grpattrn.str grpattrn.ext \
50 makefile
51
52grload3.obj: grload3.asm $(inc)\struc.inc grinst.ext grshar.str grmsg.equ \
53 grinst.ext grload.ext grload2.ext grparse.ext grpattrn.str \
54 grpattrn.ext makefile
55
56grparms.obj: grparms.asm grmsg.equ grshar.str grinst.ext grparse.ext \
57 $(inc)\struc.inc makefile
58
59graphics.com: graphics.obj grint2fh.obj grpattrn.obj grctrl.obj grcpsd.obj \
60 grcolprt.obj grbwprt.obj grinst.obj grparse.obj grparms.obj \
61 grload.obj grload2.obj grload3.obj graphics.lnk
62 link @graphics.lnk
63 exe2bin graphics.exe graphics.com
64 del graphics.exe