1933
|
1 ********************************************************************
|
|
2 * GrfDrv - Graphics module
|
|
3 *
|
|
4 * $Id$
|
|
5 *
|
|
6 * Edt/Rev YYYY/MM/DD Modified by
|
|
7 * Comment
|
|
8 * ------------------------------------------------------------------
|
|
9 * 1 ????/??/??
|
|
10 * From Tandy OS-9 Level One VR 02.00.00.
|
|
11
|
|
12 nam GrfDrv
|
|
13 ttl Graphics module
|
|
14
|
|
15 * Disassembled 02/04/05 23:44:21 by Disasm v1.6 (C) 1988 by RML
|
|
16
|
|
17 ifp1
|
|
18 use defsfile
|
|
19 use vtiodefs
|
|
20 endc
|
|
21
|
|
22 tylg set Systm+Objct
|
|
23 atrv set ReEnt+rev
|
|
24 rev set $00
|
|
25 edition set 1
|
|
26
|
|
27 mod eom,name,tylg,atrv,start,size
|
|
28
|
|
29 org 0
|
|
30 size equ .
|
|
31
|
|
32 fcb $07
|
1942
|
33
|
1933
|
34 name fcs /GrfDrv/
|
|
35 fcb edition
|
|
36
|
|
37 * Dispatch table
|
|
38 start lbra Init
|
|
39 lbra Write
|
|
40 lbra GetStat
|
|
41 lbra SetStat
|
|
42 lbra Term
|
|
43
|
|
44 * 128x192 4 color pixel table
|
|
45 Mode1Clr fdb $0055,$aaff
|
|
46
|
|
47 GetStat
|
|
48 SetStat comb
|
|
49 ldb #E$UnkSvc
|
|
50 rts
|
|
51
|
|
52 Write suba #$15
|
|
53 leax <Table,pcr
|
|
54 lsla
|
|
55 ldd a,x
|
|
56 jmp d,x
|
|
57
|
|
58 Table fdb Do15-Table
|
|
59 fdb Do16-Table
|
|
60 fdb Do17-Table
|
|
61 fdb Do18-Table
|
|
62 fdb Do19-Table
|
|
63 fdb Do1A-Table
|
|
64 fdb NoOp-Table
|
|
65 fdb Do1C-Table
|
|
66 fdb Do1D-Table
|
|
67 fdb NoOp-Table
|
|
68 fdb NoOp-Table
|
|
69
|
|
70 * Fix X/Y coords:
|
|
71 * - if Y > 191 then cap it at 191
|
|
72 * - adjust X coord if in 128x192 mode
|
|
73 FixXY ldd <V.NChar,u get next 2 charas
|
|
74 cmpb #192 Y greater than max?
|
|
75 bcs L0053 branch if lower than
|
|
76 ldb #191
|
|
77 L0053 tst <V.Mode,u which mode?
|
|
78 bmi L0059 branch if 256x192
|
|
79 lsra else divide X by 2
|
|
80 L0059 std <V.NChar,u and save
|
|
81 rts
|
|
82
|
|
83 * $15 - set graphics cursor
|
|
84 Do15 leax <SetGC,pcr load X with return address
|
|
85 GChar2 ldb #$02 need two parameters
|
|
86 lbra GChar
|
|
87
|
|
88 SetGC bsr FixXY fix coords
|
|
89 std <V.GCrsX,u and save new gfx cursor pos
|
|
90
|
|
91 NoOp
|
|
92 Init
|
|
93 Term clrb
|
|
94 rts
|
|
95
|
|
96 * $19 - erase point
|
|
97 Do19 clr <V.Msk1,u
|
|
98 * $18 - set point
|
|
99 Do18 leax <DrawPnt,pcr
|
|
100 bra GChar2
|
|
101
|
|
102 DrawPnt bsr FixXY fix coords
|
|
103 std <V.GCrsX,u save as new gfx cursor pos
|
|
104 bsr DrwPt2
|
|
105 lbra L014A
|
|
106 DrwPt2 jsr [<V.CnvVct,u]
|
|
107 L0081 tfr a,b
|
|
108 comb
|
|
109 andb ,x
|
|
110 stb ,x
|
|
111 anda <V.Msk1,u and with mask
|
|
112 ora ,x
|
|
113 sta ,x
|
|
114 rts
|
|
115
|
|
116 * $17 - erase line
|
|
117 Do17 clr <V.Msk1,u clear mask value
|
|
118
|
|
119 * $16 - draw line
|
|
120 Do16 leax <DrawLine,pcr load X with return address
|
|
121 bra GChar2 need two params
|
|
122
|
|
123 DrawLine bsr FixXY fix up coords
|
|
124 leas -$0E,s make room on stack
|
|
125 std $0C,s save X/Y
|
|
126 jsr [<V.CnvVct,u] get address given X/Y
|
|
127 stx $02,s save on stack
|
|
128 sta $01,s and pixel too
|
|
129 ldd <V.GCrsX,u get current graphics cursor
|
|
130 jsr [<V.CnvVct,u] get address given X/Y
|
|
131 sta ,s
|
|
132 clra
|
|
133 clrb
|
|
134 std $04,s
|
|
135 lda #$BF
|
|
136 suba <V.GCrsY,u
|
|
137 sta <V.GCrsY,u
|
|
138 lda #$BF
|
|
139 suba <V.NChr2,u
|
|
140 sta <V.NChr2,u
|
|
141 lda #$FF
|
|
142 sta $06,s
|
|
143 clra
|
|
144 ldb <V.GCrsX,u
|
|
145 subb <V.NChar,u
|
|
146 sbca #$00
|
|
147 bpl L00D6
|
|
148 nega
|
|
149 negb
|
|
150 sbca #$00
|
|
151 neg $06,s
|
|
152 L00D6 std $08,s
|
|
153 bne L00DF
|
|
154 ldd #$FFFF
|
|
155 std $04,s
|
|
156 L00DF lda #$E0
|
|
157 sta $07,s
|
|
158 clra
|
|
159 ldb <V.GCrsY,u
|
|
160 subb <V.NChr2,u
|
|
161 sbca #$00
|
|
162 bpl L00F4
|
|
163 nega
|
|
164 negb
|
|
165 sbca #$00
|
|
166 neg $07,s
|
|
167 L00F4 std $0A,s
|
|
168 bra L0100
|
|
169 L00F8 sta ,s
|
|
170 ldd $04,s
|
|
171 subd $0A,s
|
|
172 std $04,s
|
|
173 L0100 lda ,s
|
|
174 lbsr L0081
|
|
175 cmpx $02,s
|
|
176 bne L010F
|
|
177 lda ,s
|
|
178 cmpa $01,s
|
|
179 beq L0143
|
|
180 L010F ldd $04,s
|
|
181 bpl L011D
|
|
182 addd $08,s
|
|
183 std $04,s
|
|
184 lda $07,s
|
|
185 leax a,x
|
|
186 bra L0100
|
|
187 L011D lda ,s
|
|
188 ldb $06,s
|
|
189 bpl L0133
|
|
190 lsla
|
|
191 ldb <V.Mode,u which mode?
|
|
192 bmi L012A branch if 256x192
|
|
193 lsla
|
|
194 L012A bcc L00F8
|
|
195 lda <V.4A,u
|
|
196 leax -$01,x
|
|
197 bra L00F8
|
|
198 L0133 lsra
|
|
199 ldb <V.Mode,u which mode?
|
|
200 bmi L013A branch if 256x196
|
|
201 lsra
|
|
202 L013A bcc L00F8
|
|
203 lda <V.MCol,u
|
|
204 leax $01,x
|
|
205 bra L00F8
|
|
206 L0143 ldd $0C,s
|
|
207 std <V.GCrsX,u
|
|
208 leas $0E,s
|
|
209 L014A lda <V.Msk2,u
|
|
210 sta <V.Msk1,u
|
|
211 clrb
|
|
212 rts
|
|
213
|
|
214 * $1C - erase circle
|
|
215 Do1C clr <V.Msk1,u clear mask value
|
|
216 * $1A - draw circle
|
|
217 Do1A leax <Circle,pcr
|
|
218 ldb #$01 require another param -- radius
|
|
219 GChar stb <V.NGChr,u one more char
|
|
220 stx <V.RTAdd,u return address
|
|
221 clrb
|
|
222 rts
|
|
223
|
|
224 Circle leas -$04,s make room on stack
|
|
225 ldb <V.NChr2,u get radius
|
|
226 stb $01,s store on stack
|
|
227 clra
|
|
228 sta ,s
|
|
229 addb $01,s
|
|
230 adca #$00
|
|
231 nega
|
|
232 negb
|
|
233 sbca #$00
|
|
234 addd #$0003
|
|
235 std $02,s
|
|
236 L0179 lda ,s
|
|
237 cmpa $01,s
|
|
238 bcc L01AB
|
|
239 ldb $01,s
|
|
240 bsr L01B9
|
|
241 clra
|
|
242 ldb $02,s
|
|
243 bpl L0193
|
|
244 ldb ,s
|
|
245 lslb
|
|
246 rola
|
|
247 lslb
|
|
248 rola
|
|
249 addd #$0006
|
|
250 bra L01A3
|
|
251 L0193 dec $01,s
|
|
252 clra
|
|
253 ldb ,s
|
|
254 subb $01,s
|
|
255 sbca #$00
|
|
256 lslb
|
|
257 rola
|
|
258 lslb
|
|
259 rola
|
|
260 addd #$000A
|
|
261 L01A3 addd $02,s
|
|
262 std $02,s
|
|
263 inc ,s
|
|
264 bra L0179
|
|
265 L01AB lda ,s
|
|
266 cmpa $01,s
|
|
267 bne L01B5
|
|
268 ldb $01,s
|
|
269 bsr L01B9
|
|
270 L01B5 leas $04,s
|
|
271 bra L014A
|
|
272 L01B9 leas -$08,s
|
|
273 sta ,s
|
|
274 clra
|
|
275 std $02,s
|
|
276 nega
|
|
277 negb
|
|
278 sbca #$00
|
|
279 std $06,s
|
|
280 ldb ,s
|
|
281 clra
|
|
282 std ,s
|
|
283 nega
|
|
284 negb
|
|
285 sbca #$00
|
|
286 std $04,s
|
|
287 ldx $06,s
|
|
288 bsr L0202
|
|
289 ldd $04,s
|
|
290 ldx $02,s
|
|
291 bsr L0202
|
|
292 ldd ,s
|
|
293 ldx $02,s
|
|
294 bsr L0202
|
|
295 ldd ,s
|
|
296 ldx $06,s
|
|
297 bsr L0202
|
|
298 ldd $02,s
|
|
299 ldx ,s
|
|
300 bsr L0202
|
|
301 ldd $02,s
|
|
302 ldx $04,s
|
|
303 bsr L0202
|
|
304 ldd $06,s
|
|
305 ldx $04,s
|
|
306 bsr L0202
|
|
307 ldd $06,s
|
|
308 ldx ,s
|
|
309 bsr L0202
|
|
310 leas $08,s
|
|
311 rts
|
|
312 L0202 pshs b,a
|
|
313 ldb <V.GCrsY,u
|
|
314 clra
|
|
315 leax d,x
|
|
316 cmpx #$0000
|
|
317 bmi L0214
|
|
318 cmpx #$00BF
|
|
319 ble L0216
|
|
320 L0214 puls pc,b,a
|
|
321 L0216 ldb <V.GCrsX,u
|
|
322 clra
|
|
323 tst <V.Mode,u
|
|
324 bmi L0221
|
|
325 lslb
|
|
326 rola
|
|
327 L0221 addd ,s++
|
|
328 tsta
|
|
329 beq L0227
|
|
330 rts
|
|
331 L0227 pshs b
|
|
332 tfr x,d
|
|
333 puls a
|
|
334 tst <V.Mode,u which mode?
|
|
335 lbmi DrwPt2 branch if 256x192
|
|
336 lsra else divide A by 2
|
|
337 lbra DrwPt2
|
|
338
|
|
339 * $1D - flood fill
|
|
340 Do1D clr <V.FFFlag,u
|
|
341 leas -$07,s
|
|
342 lbsr L03AB
|
|
343 lbcs L0346
|
|
344 lda #$FF
|
|
345 sta <V.4F,u
|
|
346 ldd <V.GCrsX,u
|
|
347 lbsr L0351
|
|
348 lda <V.4C,u
|
|
349 sta <V.4D,u
|
|
350 tst <V.Mode,u which mode?
|
|
351 bpl L0261 branch if 128x192
|
|
352 tsta
|
|
353 beq L0267
|
|
354 lda #$FF
|
|
355 bra L0267
|
|
356 L0261 leax >Mode1Clr,pcr
|
|
357 lda a,x
|
|
358 L0267 sta <V.4E,u
|
|
359 cmpa <V.Msk1,u
|
|
360 lbeq L0346
|
|
361 ldd <V.GCrsX,u
|
|
362 L0274 suba #$01
|
|
363 bcs L027F
|
|
364 lbsr L0351
|
|
365 bcs L027F
|
|
366 beq L0274
|
|
367 L027F inca
|
|
368 std $01,s
|
|
369 L0282 lbsr L0384
|
|
370 adda #$01
|
|
371 bcs L0290
|
|
372 lbsr L0351
|
|
373 bcs L0290
|
|
374 beq L0282
|
|
375 L0290 deca
|
|
376 ldx $01,s
|
|
377 lbsr L03D3
|
|
378 neg <V.4F,u
|
|
379 lbsr L03D3
|
|
380 L029C lbsr L03F9
|
|
381 lbcs L0346
|
|
382 tst <V.4F,u
|
|
383 bpl L02B3
|
|
384 subb #$01
|
|
385 bcs L029C
|
|
386 std $03,s
|
|
387 tfr x,d
|
|
388 decb
|
|
389 bra L02BD
|
|
390 L02B3 incb
|
|
391 cmpb #$BF
|
|
392 bhi L029C
|
|
393 std $03,s
|
|
394 tfr x,d
|
|
395 incb
|
|
396 L02BD std $01,s
|
|
397 lbsr L0351
|
|
398 bcs L029C
|
|
399 L02C4 bne L02D2
|
|
400 suba #$01
|
|
401 bcc L02CD
|
|
402 inca
|
|
403 bra L02D6
|
|
404 L02CD lbsr L0351
|
|
405 bcc L02C4
|
|
406 L02D2 adda #$01
|
|
407 bcs L029C
|
|
408 L02D6 cmpd $03,s
|
|
409 bhi L029C
|
|
410 bsr L0351
|
|
411 bcs L029C
|
|
412 bne L02D2
|
|
413 std $05,s
|
|
414 cmpd $01,s
|
|
415 bcc L02FB
|
|
416 ldd $01,s
|
|
417 decb
|
|
418 cmpd $05,s
|
|
419 beq L02FB
|
|
420 neg <V.4F,u
|
|
421 ldx $05,s
|
|
422 lbsr L03D3
|
|
423 neg <V.4F,u
|
|
424 L02FB ldd $05,s
|
|
425 L02FD std $01,s
|
|
426 L02FF bsr L0351
|
|
427 bcs L030B
|
|
428 bne L030B
|
|
429 bsr L0384
|
|
430 adda #$01
|
|
431 bcc L02FF
|
|
432 L030B deca
|
|
433 ldx $01,s
|
|
434 lbsr L03D3
|
|
435 std $05,s
|
|
436 adda #$01
|
|
437 bcs L0326
|
|
438 L0317 cmpd $03,s
|
|
439 bcc L0326
|
|
440 adda #$01
|
|
441 bsr L0351
|
|
442 bcs L0326
|
|
443 bne L0317
|
|
444 bra L02FD
|
|
445 L0326 inc $03,s
|
|
446 inc $03,s
|
|
447 ldd $03,s
|
|
448 cmpa #$02
|
|
449 lbcs L029C
|
|
450 ldd $05,s
|
|
451 cmpd $03,s
|
|
452 lbcs L029C
|
|
453 neg <V.4F,u
|
|
454 ldx $03,s
|
|
455 lbsr L03D3
|
|
456 lbra L029C
|
|
457 L0346 leas $07,s
|
|
458 clrb
|
|
459 ldb <V.FFFlag,u
|
|
460 beq L0350
|
|
461 L034E orcc #Carry
|
|
462 L0350 rts
|
|
463 L0351 pshs b,a
|
|
464 cmpb #$BF
|
|
465 bhi L0380
|
|
466 tst <V.Mode,u which mode?
|
|
467 bmi L0360 branch if 256x192
|
|
468 cmpa #$7F
|
|
469 bhi L0380
|
|
470 L0360 jsr [<V.CnvVct,u]
|
|
471 tfr a,b
|
|
472 andb ,x
|
|
473 L0367 bita #$01
|
|
474 bne L0376
|
|
475 lsra
|
|
476 lsrb
|
|
477 tst <V.Mode,u which mode?
|
|
478 bmi L0367 branch if 256x192
|
|
479 lsra
|
|
480 lsrb
|
|
481 bra L0367
|
|
482 L0376 stb <V.4C,u
|
|
483 cmpb <V.4D,u
|
|
484 andcc #^Carry
|
|
485 puls pc,b,a
|
|
486 L0380 orcc #Carry
|
|
487 puls pc,b,a
|
|
488 L0384 pshs b,a
|
|
489 jsr [<V.CnvVct,u]
|
|
490 bita #$80
|
|
491 beq L03A6
|
|
492 ldb <V.4E,u
|
|
493 cmpb ,x
|
|
494 bne L03A6
|
|
495 ldb <V.Msk1,u
|
|
496 stb ,x
|
|
497 puls b,a
|
|
498 tst <V.Mode,u which mode?
|
|
499 bmi L03A3 branch if 256x192
|
|
500 adda #$03
|
|
501 rts
|
|
502 L03A3 adda #$07
|
|
503 rts
|
|
504 L03A6 lbsr L0081
|
|
505 puls pc,b,a
|
|
506 L03AB ldx <V.FFSTp,u get top of flood fill stack
|
|
507 beq L03B5 if zero, we need to allocate stack
|
|
508 stx <V.FFSPt,u else reset flood fill stack ptr
|
|
509 L03B3 clrb
|
|
510 rts
|
|
511
|
|
512 * Allocate Flood Fill Stack
|
|
513 L03B5 pshs u save U for now
|
|
514 ldd #$0200 get 512 bytes
|
|
515 os9 F$SRqMem from system
|
|
516 bcc AllocOk branch if ok
|
|
517 puls pc,u else pull out with error
|
|
518 AllocOk tfr u,d move pointer to alloced mem to D
|
|
519 puls u get stat pointer we saved earlier
|
|
520 std <V.FFMem,u save pointer to alloc'ed mem
|
|
521 addd #512 point D to end of alloc'ed mem
|
|
522 std <V.FFSTp,u and save here as top of fill stack
|
|
523 std <V.FFSPt,u and here
|
|
524 bra L03B3 do a clean return
|
|
525
|
|
526 L03D3 pshs b,a
|
|
527 ldd <V.FFSPt,u
|
|
528 subd #$0004
|
|
529 cmpd <V.FFMem,u
|
|
530 bcs L03F2
|
|
531 std <V.FFSPt,u
|
|
532 tfr d,y
|
|
533 lda <V.4F,u
|
|
534 sta ,y
|
|
535 stx $01,y
|
|
536 puls b,a
|
|
537 sta $03,y
|
|
538 rts
|
|
539 L03F2 ldb #$F5
|
|
540 stb <V.FFFlag,u
|
|
541 puls pc,b,a
|
|
542 L03F9 ldd <V.FFSPt,u
|
|
543 cmpd <V.FFSTp,u top of flood fill stack?
|
|
544 lbcc L034E
|
|
545 tfr d,y
|
|
546 addd #$0004
|
|
547 std <V.FFSPt,u
|
|
548 lda ,y
|
|
549 sta <V.4F,u
|
|
550 ldd $01,y
|
|
551 tfr d,x
|
|
552 lda $03,y
|
|
553 andcc #^Carry
|
|
554 rts
|
|
555
|
|
556 emod
|
|
557 eom equ *
|
|
558 end
|
|
559
|