1706
|
1 *
|
|
2 *
|
|
3 * Graphics subs for PIX picture format.
|
|
4 * setvert: Create buffer for vertical imaging.
|
|
5 * endvert: Trash the buffer.
|
|
6 * pixditherline: Output one vertical row to screen.
|
|
7 *
|
|
8
|
|
9 check macro
|
|
10 pshs b,cc
|
|
11 ldb #\1
|
|
12 os9 F$PErr
|
|
13 puls b,cc
|
|
14 endm
|
|
15
|
|
16 ifp1
|
1777
|
17 use os9defs.a
|
1706
|
18 endc
|
|
19
|
|
20 psect view_pix_gfx_a,0,0,0,0,0
|
|
21
|
|
22 * vsect dp
|
|
23 *pixfirstcol rmb 2 Declared in view_pix.a
|
|
24 * endsect
|
|
25
|
|
26 *
|
|
27 * These are essentially cloned from the row-at-a-time routines in
|
|
28 * view_gfx.a, but since I never expect to see another graphics format
|
|
29 * that does column-at-a-time imaging, I decided it should be safe
|
|
30 * to just put them here, so I could optimize them for this format.
|
|
31 * In order to be fully general, they just need to take into account
|
|
32 * the screen type (here assumed to be type 7).
|
|
33 *
|
|
34 vsect dp
|
|
35 buffadd rmb 2 Address of mapped-in get/put buffer
|
|
36 endsect
|
|
37
|
|
38 vsect
|
|
39 setbufCom
|
|
40 fdb $1b2c
|
|
41 fdb $0002 Group/buffer
|
|
42 fdb 0000 XLoc
|
|
43 fdb 0000 YLoc
|
|
44 fdb 4 XDim
|
|
45 fdb 96 YDim
|
|
46 endsect
|
|
47
|
|
48 setvert:
|
|
49 pshs x,y
|
|
50
|
|
51 leax setbufCom,y
|
|
52 lda <PID
|
|
53 sta 2,x
|
|
54 lda <outpath
|
|
55 pshs y
|
|
56 ldy #12
|
|
57 OS9 I$Write
|
|
58 lbcs _error
|
|
59 puls y
|
|
60
|
|
61 lda <PID
|
|
62 ldb #2
|
|
63 tfr d,x Set up group/buffer in X.
|
|
64 lda #1
|
|
65 ldb #SS.MpGPB map in buffer
|
|
66 pshs y
|
|
67 ldy #1
|
|
68 os9 I$SetStt
|
|
69 lbcs _error
|
|
70 tfr y,d
|
|
71 puls y
|
|
72 stx buffadd
|
|
73
|
|
74 ldd #192 Return size of vertical buffer.
|
|
75 puls x,y,pc
|
|
76
|
|
77 *
|
|
78 * Endvert: Kill and unmap buffer
|
|
79 *
|
|
80 vsect
|
|
81 endbufCom
|
|
82 fcb $1b,$2a,$00,$02
|
|
83 endsect
|
|
84
|
|
85 endvert:
|
|
86 pshs a,b,x,y
|
|
87 lda <PID
|
|
88 ldb #2
|
|
89 tfr d,x
|
|
90 lda #1
|
|
91 ldb #SS.MpGPB
|
|
92 pshs y
|
|
93 ldy #0 Unmap buffer.
|
|
94 os9 I$SetStt
|
|
95 puls y
|
|
96
|
|
97 leax endbufCom,y
|
|
98 lda <PID
|
|
99 sta 2,x
|
|
100 lda <outpath
|
|
101 ldy #4
|
|
102 OS9 I$Write
|
|
103 lbcs _error
|
|
104 puls a,b,x,y,pc
|
|
105
|
|
106 *
|
|
107 * Ditherline:
|
|
108 * Takes buffer pointed to by X, of size D, and dithers it into U.
|
|
109 * 15Feb90- now buffers 4 columns, then calls putvert with all 4 cols.
|
|
110 * 01Jun90- Changed dither patterns to 12x6, for smoother dithering.
|
|
111 *
|
|
112 vsect dp
|
|
113 dithmask fcb $c0 Mask off appropriate bits from dither values.
|
|
114 dithwhich fcb 0 track which byte column we're in.
|
|
115 endsect
|
|
116
|
|
117 pixditherline:
|
|
118 pshs a,b,x,y,u
|
|
119 pshs y
|
|
120 lda #$2b Approx 1/6
|
|
121 mul Divide by six, since we do things six bytes at a time.
|
|
122 pshs a Save number of bytes.
|
|
123 leay dith1table,pcr
|
|
124 lda <dithwhich
|
|
125 cmpa #1
|
|
126 bne dithmod1
|
|
127 leay dith2table,pcr
|
|
128 dithmod1
|
|
129 cmpa #2
|
|
130 bne dithmod2
|
|
131 leay dith3table,pcr
|
|
132 dithmod2
|
|
133 ldb <dithmask Get current dither column
|
|
134 pshs b
|
|
135 dither1
|
|
136 ldd ,x++ Get two bytes,
|
|
137 lda a,y . translate to color
|
|
138 anda ,s . mask off only pertinent pixel
|
|
139 addb #16 . offset into second table
|
|
140 ldb b,y . translate this color
|
|
141 andb ,s . mask off pixel
|
|
142 ora ,u . or new pixel into target array
|
|
143 orb 1,u . "
|
|
144 std ,u++ . store it.
|
|
145 ldd ,x++ Get two more bytes,
|
|
146 adda #32 . offset into third table
|
|
147 lda a,y . translate to color
|
|
148 anda ,s . mask off only pertinent pixel
|
|
149 addb #48 . offset into fourth table
|
|
150 ldb b,y . translate this color
|
|
151 andb ,s . mask off pixel
|
|
152 ora ,u . or new pixel into target array
|
|
153 orb 1,u . "
|
|
154 std ,u++ . store it.
|
|
155 ldd ,x++ Get two more bytes,
|
|
156 adda #64 . offset into fifth table
|
|
157 lda a,y . translate to color
|
|
158 anda ,s . mask off only pertinent pixel
|
|
159 addb #80 . offset into sixth table
|
|
160 ldb b,y . translate this color
|
|
161 andb ,s . mask off pixel
|
|
162 ora ,u . or new pixel into target array
|
|
163 orb 1,u . "
|
|
164 std ,u++ . store it.
|
|
165 dec 1,s
|
|
166 bne dither1
|
|
167 puls a,b
|
|
168 puls y
|
|
169 ldb <dithmask
|
|
170 andcc #^Carry Clear carry, so we don't mung our pixel mask
|
|
171 rorb
|
|
172 rorb
|
|
173 bcc dither3
|
|
174 rorb
|
|
175 lbsr putvert
|
|
176 lda dithwhich Bump dithwhich mod 3
|
|
177 inca
|
|
178 cmpa #3
|
|
179 blo dithermod
|
|
180 clra
|
|
181 dithermod
|
|
182 sta dithwhich
|
|
183 dither3
|
|
184 stb <dithmask
|
|
185 puls a,b,x,y,u,pc
|
|
186
|
|
187 dith1table
|
|
188 fcb $00,$10,$10,$51,$51,$55,$56,$65,$69,$a6,$aa,$ba,$ae,$be,$fb,$ff
|
|
189 fcb $00,$01,$41,$45,$15,$55,$65,$96,$a6,$6a,$aa,$ab,$ba,$fb,$bf,$ff
|
|
190 dith3table
|
|
191 fcb $00,$10,$04,$14,$51,$55,$56,$59,$9a,$a6,$aa,$ba,$eb,$ef,$fb,$ff
|
|
192 fcb $00,$01,$10,$51,$15,$55,$65,$65,$69,$6a,$aa,$ab,$ae,$be,$bf,$ff
|
|
193 dith2table
|
|
194 fcb $00,$10,$41,$45,$51,$55,$56,$96,$a6,$a6,$aa,$ba,$ba,$fb,$fb,$ff
|
|
195 fcb $00,$01,$04,$14,$15,$55,$65,$59,$9a,$6a,$aa,$ab,$eb,$ef,$bf,$ff
|
|
196 fcb $00,$10,$10,$51,$51,$55,$56,$65,$69,$a6,$aa,$ba,$ae,$be,$fb,$ff
|
|
197 fcb $00,$01,$41,$45,$15,$55,$65,$96,$a6,$6a,$aa,$ab,$ba,$fb,$bf,$ff
|
|
198 fcb $00,$10,$04,$14,$51,$55,$56,$59,$9a,$a6,$aa,$ba,$eb,$ef,$fb,$ff
|
|
199 fcb $00,$01,$10,$51,$15,$55,$65,$65,$69,$6a,$aa,$ab,$ae,$be,$bf,$ff
|
|
200
|
|
201 *
|
|
202 * Putvert
|
|
203 *
|
|
204 vsect dp
|
|
205 putcol rmb 2
|
|
206 endsect
|
|
207
|
|
208 vsect
|
|
209 putCom fdb $1b2d
|
|
210 fcb 0,2 Grp/Buf
|
|
211 putcol2 fdb 0 Xloc
|
|
212 fdb 0 Yloc
|
|
213 endsect
|
|
214
|
|
215 putvert
|
|
216 pshs a,b,x,y,u
|
|
217 leax putCom,y
|
|
218 ldd putcol
|
|
219 addd #4
|
|
220 std putcol
|
|
221 addd <pixfirstcol
|
|
222 std putcol2
|
|
223 lda <PID
|
|
224 sta 2,x Set group number
|
|
225
|
|
226 leax linebuff,y Copy linebuff data into get/put buffer
|
|
227 bsr putvert0 Copy first half of data.
|
|
228 ldd #00
|
|
229 bsr putvert1 Put on screen starting at Y offset 0
|
|
230 bsr putvert0 Copy second half.
|
|
231 ldd #96
|
|
232 bsr putvert1 Put at Y offset 96.
|
|
233 puls a,b,x,y,u,pc
|
|
234
|
|
235 putvert0
|
|
236 pshs a,b,u
|
|
237 ldu buffadd
|
|
238 ldb #96
|
|
239 putv1
|
|
240 lda ,x
|
|
241 clr ,x+ Clear out linebuff as we go along.
|
|
242 coma Complement our data.
|
|
243 sta ,u+
|
|
244 decb
|
|
245 bne putv1
|
|
246 puls a,b,u,pc
|
|
247
|
|
248 putvert1
|
|
249 pshs a,b,x,y
|
|
250 leax putCom,y
|
|
251 std 6,x
|
|
252 lda <outpath
|
|
253 ldy #8
|
|
254 os9 I$Write
|
|
255 lbcs _error
|
|
256 puls a,b,x,y,pc
|
|
257
|
|
258 endsect
|