comparison level1/cmds/grfdrv.asm @ 1933:1e312b144f4d

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