Mercurial > hg > Members > kono > nitros9-code
annotate level2/modules/covdg.asm @ 2018:505c8d261ef6
Futher division of krn, commnents added
author | boisy |
---|---|
date | Wed, 08 Mar 2006 01:58:50 +0000 |
parents | 21bf55c38692 |
children | 8b36468b2edb |
rev | line source |
---|---|
1933 | 1 ******************************************************************** |
2 * CoVDG - CoCo 3 VDG I/O module | |
3 * | |
4 * $Id$ | |
5 * | |
6 * | |
7 * Edt/Rev YYYY/MM/DD Modified by | |
8 * Comment | |
9 * ------------------------------------------------------------------ | |
10 * 4 2003/01/09 Boisy G. Pitre | |
11 * Quite a few changes: | |
12 * - Merged in CoCo 2 gfx code from original OS-9 Level 2 code. | |
13 * - Incorporated code tweaks for 6809 and 6309 code from the vdgint_small | |
14 * and vdgint_tiny source files. | |
15 * - Fixed long-standing cursor color bug. | |
16 * - Fixed long-standing F$SRtMem bug in CoCo 2 "graphics end" code $12 | |
17 * (see comments) | |
18 * | |
19 * 4r1 2003/09/16 Robert Gault | |
20 * Added patch to work 1MB and 2MB CoCo 3s. | |
1938 | 21 * |
22 * 1 2005/11/26 Boisy G. Pitre | |
23 * Renamed from VDGInt, reset edition. | |
1981
21bf55c38692
Changes to permit selection of vdg windows within a script file.
robert
parents:
1938
diff
changeset
|
24 * |
21bf55c38692
Changes to permit selection of vdg windows within a script file.
robert
parents:
1938
diff
changeset
|
25 * 2006/01/17 Robert Gault |
21bf55c38692
Changes to permit selection of vdg windows within a script file.
robert
parents:
1938
diff
changeset
|
26 * Changed the Select routine to permit the use of display 1b 21 within |
21bf55c38692
Changes to permit selection of vdg windows within a script file.
robert
parents:
1938
diff
changeset
|
27 * scripts when changing from a window to a vdg screen. See discriptions |
21bf55c38692
Changes to permit selection of vdg windows within a script file.
robert
parents:
1938
diff
changeset
|
28 * in cowin.asm. RG |
1933 | 29 |
30 nam CoVDG | |
31 ttl CoCo 3 VDG I/O module | |
32 | |
33 * Disassembled 98/09/31 12:15:57 by Disasm v1.6 (C) 1988 by RML | |
34 | |
35 ifp1 | |
36 use defsfile | |
37 use vdgdefs | |
38 endc | |
39 | |
40 FFStSz equ 512 flood fill stack size in bytes | |
41 | |
42 tylg set Systm+Objct | |
43 atrv set ReEnt+rev | |
1938 | 44 rev set $00 |
45 edition set 1 | |
1933 | 46 |
47 skip2 equ $8C cmpx instruction | |
48 | |
49 mod eom,name,tylg,atrv,start,size | |
50 | |
51 u0000 rmb 0 | |
52 size equ . | |
53 | |
54 fcb $07 | |
55 | |
56 name fcs /CoVDG/ | |
57 fcb edition | |
58 | |
59 start lbra Read actually more like INIZ... | |
60 lbra Write | |
61 lbra GetStat | |
62 lbra SetStat | |
63 lbra Term | |
64 | |
65 * Update Window | |
66 * Called from VTIO | |
67 * Entry: A = function code | |
68 * 0 = select new window to be active | |
69 * 1 = update mouse packet | |
70 * >1 = only used by CoGrf/CoWin | |
71 * U = device memory pointer | |
72 * X = path descriptor pointer | |
73 | |
74 tsta zero? | |
75 bne L0035 branch if not | |
76 ldb <VD.DGBuf,u get number of currently displayed buffer | |
77 lbne ShowS branch if not zero | |
78 ldd <VD.TFlg1,u | |
79 lbra DispAlfa | |
80 | |
81 L0035 deca set x,y size of window? | |
82 beq L003B branch if so | |
83 clrb no errors | |
84 rts | |
85 | |
86 L003B ldx <D.CCMem pointer to start of CC memory | |
87 leax <G.Mouse+Pt.AcX,x to X,Y coor, X,Y window | |
88 * leax <$54,x to X,Y coor, X,Y window | |
89 IFNE H6309 | |
90 ldq ,x get X,Y coordinate | |
91 stq $04,x copy to window relative X,Y | |
92 ELSE | |
93 ldd ,x | |
94 std $04,x | |
95 ldd $02,x | |
96 std $06,x | |
97 ENDC | |
98 clrb | |
99 rts | |
100 | |
101 * Terminate device | |
102 Term pshs u,y,x | |
103 ldb #$03 | |
104 L004E pshs b | |
105 lbsr GetScrn get screen table entry into X | |
106 lbsr FreeBlks free blocks used by screen | |
107 puls b get count | |
108 decb decrement | |
109 bne L004E branch until zero | |
110 clr <VD.Start,u no screens in use | |
111 ldd #512 size of alpha screen | |
112 ldu <VD.ScrnA,u get pointer to alpha screen | |
113 beq ClrStat branch if none | |
114 os9 F$SRtMem else return memory | |
115 ClrStat ldb #$E1 size of 1 page -$1D (SCF memory requirements) | |
116 leax <VD.Strt1,u point to start of VDG statics | |
117 L006F clr ,x+ set stored byte to zero | |
118 decb decrement | |
119 bne L006F until zero | |
120 bra L00D5 and exit | |
121 | |
122 * Read bytes from IN | |
123 * Actually, this is more like an INIZ of the device. | |
124 Read pshs u,y,x save regs | |
125 bsr SetupPal set up palettes | |
126 lda #$AF | |
127 sta <VD.CColr,u default color cursor | |
128 pshs u | |
129 ldd #768 gets 1 page on an odd page boundary | |
130 os9 F$SRqMem request from top of sys ram | |
131 bcs L00D6 error out of no system mem | |
132 tfr u,d U = addr of memory | |
133 tfr u,x | |
134 bita #$01 test to see if on even page | |
135 beq IsEven branch if even | |
136 leax >256,x else point 100 bytes into mem | |
137 bra IsOdd and free | |
138 IsEven leau >512,u we only need 2 pages for the screen memory | |
139 IsOdd ldd #256 1 page return | |
140 os9 F$SRtMem return system memory | |
141 puls u | |
142 stx <VD.ScrnA,u save start address of the screen | |
143 stx <VD.CrsrA,u and start cursor position | |
144 leax >512,x point to end of screen | |
145 stx <VD.ScrnE,u save it | |
146 lda #$60 get default character | |
147 sta <VD.CChar,u put character under the cursor | |
148 sta <VD.Chr1,u only referenced here ?? | |
149 lbsr ClrScrn clear the screen | |
150 inc <VD.Start,u increment VDG screen in use | |
151 ldd <VD.Strt1,u seemling useless?? | |
152 lbsr L054C set to true lowercase, screen size | |
153 leax <VD.NChar,u | |
154 stx <VD.EPlt1,u where to get next character from | |
155 stx <VD.EPlt2,u | |
156 ldu <D.CCMem | |
157 IFNE H6309 | |
158 oim #$02,<G.BCFFlg,u set to VDGINT found | |
159 ELSE | |
160 ldb <G.BCFFlg,u | |
161 orb #$02 set to VDGINT found | |
162 stb <G.BCFFlg,u | |
163 ENDC | |
164 L00D5 clrb | |
165 L00D6 puls pc,u,y,x | |
166 | |
167 SetupPal pshs u,y,x,b,a | |
168 lda #$08 | |
169 sta <VD.PlFlg,u | |
170 leax >L011A,pcr default palette | |
171 leay <VD.Palet,u | |
172 L00E6 leau >L00F8,pcr CMP to RGB conversion | |
173 IFNE H6309 | |
174 L00EA tfr u,w | |
175 ELSE | |
176 L00EA pshs u | |
177 ENDC | |
178 leau >L012A,pcr | |
179 ldb #16 | |
180 L00F2 lda ,x+ | |
181 IFNE H6309 | |
182 jmp ,w | |
183 ELSE | |
184 jmp [,s] | |
185 ENDC | |
186 L00F6 lda a,u remap to CMP values | |
187 L00F8 sta ,y+ and save RGB data | |
188 decb | |
189 bne L00F2 | |
190 IFEQ H6309 | |
191 leas $02,s clean up stack | |
192 ENDC | |
193 L00FF puls pc,u,y,x,b,a | |
194 | |
195 SetPals pshs u,y,x,b,a puts palette data in. | |
196 lda >WGlobal+G.CrDvFl is this screen active? | |
197 beq L00FF 0 = not active | |
198 leax <VD.Palet,u point X to palette table | |
199 ldy #$FFB0 point Y to palette register | |
200 lda >WGlobal+G.MonTyp universal RGB/CMP 0 = CMP, 1 = RGB, 2 = MONO | |
201 bne L00E6 if not 0 (CMP) don't re-map colors | |
202 leau >L00F6,pcr else do re-map colors | |
203 bra L00EA | |
204 | |
205 L011A fcb $12,$36,$09,$24 default palette data | |
206 fcb $3f,$1b,$2d,$26 | |
207 fcb $00,$12,$00,$3f | |
208 fcb $00,$12,$00,$26 | |
209 | |
210 * converts CMP to RGB | |
211 L012A fdb $000c,$020e,$0709,$0510 | |
212 fdb $1c2c,$0d1d,$0b1b,$0a2b | |
213 fdb $2211,$1221,$0301,$1332 | |
214 fdb $1e2d,$1f2e,$0f3c,$2f3d | |
215 fdb $1708,$1506,$2716,$2636 | |
216 fdb $192a,$1a3a,$1829,$2838 | |
217 fdb $1404,$2333,$2535,$2434 | |
218 fdb $203B,$313E,$3739,$3F30 | |
219 | |
220 * Entry: A = char to write | |
221 * Y = path desc ptr | |
222 Write equ * | |
223 IFNE COCO2 | |
224 cmpa #$0F | |
225 ELSE | |
226 cmpa #$0E | |
227 ENDC | |
228 bls Dispatch | |
229 cmpa #$1B escape code? | |
230 lbeq Escape yes, do escape immediately | |
231 IFNE COCO2 | |
232 cmpa #$1E | |
233 bcs Do1E | |
234 cmpa #$1F | |
235 bls Dispatch | |
236 ELSE | |
237 cmpa #$1F | |
238 lbls NoOp ignore gfx codes if not CoCo 2 compatible | |
239 ENDC | |
240 tsta | |
241 bmi L01BA | |
242 ldb <VD.CFlag,u | |
243 beq L019A | |
244 cmpa #$5E | |
245 bne L018A re-map characters from ASCII-VDG | |
246 clra | |
247 bra L01BA | |
248 L018A cmpa #$5F | |
249 bne L0192 | |
250 lda #$1F | |
251 bra L01BA | |
252 L0192 cmpa #$60 | |
253 bne L01AA | |
254 lda #$67 | |
255 bra L01BA | |
256 | |
257 L019A cmpa #$7C true lowercase | |
258 bne L01A2 | |
259 lda #$21 | |
260 bra L01BA | |
261 L01A2 cmpa #$7E | |
262 bne L01AA | |
263 lda #$2D | |
264 bra L01BA | |
265 L01AA cmpa #$60 | |
266 bcs L01B2 re-map ASCII | |
267 suba #$60 | |
268 bra L01BA | |
269 L01B2 cmpa #$40 | |
270 bcs L01B8 | |
271 suba #$40 | |
272 L01B8 eora #$40 | |
273 L01BA ldx <VD.CrsrA,u | |
274 sta ,x+ | |
275 stx <VD.CrsrA,u | |
276 cmpx <VD.ScrnE,u | |
277 bcs L01CA | |
278 lbsr SScrl if at end of screen, scroll it | |
279 L01CA lbsr ShowCrsr ends with a CLRB/RTS anyhow | |
280 NoOp clrb | |
281 rts | |
282 | |
283 IFNE COCO2 | |
284 Do1E lbsr ChkDvRdy | |
285 bcc Dispatch | |
286 rts | |
287 ENDC | |
288 | |
289 Dispatch leax >DCodeTbl,pcr | |
290 lsla | |
291 ldd a,x | |
292 jmp d,x | |
293 | |
294 DCodeTbl fdb NoOp-DCodeTbl $00 - No Operation | |
295 fdb CurHome-DCodeTbl $01 - Home Cursor | |
296 fdb CurXY-DCodeTbl $02 - Move Cursor | |
297 fdb DelLine-DCodeTbl $03 - Delete Line | |
298 fdb ErEOLine-DCodeTbl $04 - Erase to End Of Line | |
299 fdb CrsrSw-DCodeTbl $05 - Switch Cursor Color | |
300 fdb CurRght-DCodeTbl $06 - Move Cursor Right | |
301 fdb NoOp-DCodeTbl $07 - Bell (Handled by VTIO) | |
302 fdb CurLeft-DCodeTbl $08 - Move Cursor Left | |
303 fdb CurUp-DCodeTbl $09 - Move Cursor Up | |
304 fdb CurDown-DCodeTbl $0A - Move Cursor Down | |
305 fdb ErEOScrn-DCodeTbl $0B - Erase to End Of Screen | |
306 fdb ClrScrn-DCodeTbl $0C - Clear Screen | |
307 fdb Retrn-DCodeTbl $0D - Carriage Return | |
308 fdb Do0E-DCodeTbl $0E - Display Alpha Screen | |
309 | |
310 IFNE COCO2 | |
311 fdb Do0F-DCodeTbl $0F - Display Graphics | |
312 fdb Do10-DCodeTbl $10 - Preset Screen | |
313 fdb Do11-DCodeTbl $11 - Set Color | |
314 fdb Do12-DCodeTbl $12 - End Graphics | |
315 fdb Do13-DCodeTbl $13 - Erase Graphics | |
316 fdb Do14-DCodeTbl $14 - Home Graphics Cursor | |
317 fdb Do15-DCodeTbl $15 - Set Graphics Cursor | |
318 fdb Do16-DCodeTbl $16 - Draw Line | |
319 fdb Do17-DCodeTbl $17 - Erase Line | |
320 fdb Do18-DCodeTbl $18 - Set Point | |
321 fdb Do19-DCodeTbl $19 - Erase Point | |
322 fdb Do1A-DCodeTbl $1A - Draw Circle | |
323 fdb Escape-DCodeTbl $1B - Escape | |
324 fdb Do1C-DCodeTbl $1C - Erase Circle | |
325 fdb Do1D-DCodeTbl $1D - Flood Fill | |
326 fdb NoOp-DCodeTbl $1E - No Operation | |
327 fdb NoOp-DCodeTbl $1F - No Operation | |
328 ENDC | |
329 | |
330 * Code fragment from original CoCo 3 VDGInt by Tandy - not referenced | |
331 * comb | |
332 * ldb #E$Write | |
333 * rts | |
334 | |
335 * $1B does palette changes | |
336 Escape ldx <VD.EPlt1,u now X points to VD.NChar | |
337 lda ,x get char following | |
338 cmpa #$30 default color? | |
339 bne L0209 branch if not | |
340 lbsr SetupPal do default palette | |
341 lbra L026E put palette and exit | |
342 | |
1981
21bf55c38692
Changes to permit selection of vdg windows within a script file.
robert
parents:
1938
diff
changeset
|
343 * The reasons for the commented out lines below are discussed in cowin.asm |
21bf55c38692
Changes to permit selection of vdg windows within a script file.
robert
parents:
1938
diff
changeset
|
344 * where the functions are identical. RG |
1933 | 345 L0209 cmpa #$31 change palette? |
346 IFNE COCO2 | |
347 lbeq PalProc branch if so | |
348 cmpa #$21 | |
349 lbne NoOp return without error | |
350 ldx PD.RGS,y get registers | |
351 lda R$A,x get path | |
352 ldx <D.Proc get current proc | |
1981
21bf55c38692
Changes to permit selection of vdg windows within a script file.
robert
parents:
1938
diff
changeset
|
353 * There does not seem to be a reason for the next two lines. RG |
21bf55c38692
Changes to permit selection of vdg windows within a script file.
robert
parents:
1938
diff
changeset
|
354 * cmpa >P$SelP,x compare against selected path |
21bf55c38692
Changes to permit selection of vdg windows within a script file.
robert
parents:
1938
diff
changeset
|
355 * beq L0249 branch if empty |
1933 | 356 ldb >P$SelP,x else load selected path from process descriptor |
357 sta >P$SelP,x and store passed path | |
358 pshs y save our path desc ptr | |
359 bsr L024A get device table entry for path | |
360 ldy V$STAT,y get driver statics | |
361 ldx <D.CCMem get CoCo memory | |
1981
21bf55c38692
Changes to permit selection of vdg windows within a script file.
robert
parents:
1938
diff
changeset
|
362 * Again, there does not seem to be a reason for this or the next branch. RG |
21bf55c38692
Changes to permit selection of vdg windows within a script file.
robert
parents:
1938
diff
changeset
|
363 * cmpy <G.CurDev,x |
1933 | 364 puls y restore our path desc ptr |
1981
21bf55c38692
Changes to permit selection of vdg windows within a script file.
robert
parents:
1938
diff
changeset
|
365 * bne L0248 |
1933 | 366 inc <VD.DFlag,u |
367 ldy <G.CurDev,x get current static mem | |
368 sty <G.PrWMPt,x copy to previous | |
369 stu <G.CurDev,x and save new static mem ptr | |
1981
21bf55c38692
Changes to permit selection of vdg windows within a script file.
robert
parents:
1938
diff
changeset
|
370 * Give system a chance to stabilize. RG |
21bf55c38692
Changes to permit selection of vdg windows within a script file.
robert
parents:
1938
diff
changeset
|
371 ldx #2 |
21bf55c38692
Changes to permit selection of vdg windows within a script file.
robert
parents:
1938
diff
changeset
|
372 os9 F$Sleep |
1933 | 373 L0248 clrb |
374 L0249 rts | |
375 | |
376 * Entry: A = path to process | |
377 L024A leax <P$Path,x point to path table in process descriptor | |
378 lda b,x get system path number | |
379 ldx <D.PthDBT point to path descriptor base table | |
1981
21bf55c38692
Changes to permit selection of vdg windows within a script file.
robert
parents:
1938
diff
changeset
|
380 * protect regB incase of error report. RG |
21bf55c38692
Changes to permit selection of vdg windows within a script file.
robert
parents:
1938
diff
changeset
|
381 pshs b |
1933 | 382 os9 F$Find64 put found path descriptor in Y |
383 ldy PD.DEV,y load Y with device table entry | |
1981
21bf55c38692
Changes to permit selection of vdg windows within a script file.
robert
parents:
1938
diff
changeset
|
384 puls b,pc |
1933 | 385 ELSE |
386 bne NoOp | |
387 ENDC | |
388 | |
389 PalProc leax <DoPals,pcr | |
390 ldb #$02 | |
391 lbra GChar | |
392 | |
393 DoPals ldx <VD.EPlt1,u | |
394 ldd ,x | |
395 cmpa #16 max 16 palettes | |
396 lbhi IllArg | |
397 cmpb #63 color has max. 63 | |
398 lbhi IllArg | |
399 leax <VD.Palet,u to palette buffer | |
400 stb a,x save it | |
401 L026E lbsr SetPals | |
402 clrb | |
403 rts | |
404 | |
405 * anda #$0F | |
406 * andb #$3F | |
407 * leax <VD.Palet,u | |
408 * stb a,x | |
409 *L026E inc <VD.DFlag,u | |
410 * clrb | |
411 * rts | |
412 | |
413 * Screen scroll | |
414 SScrl ldx <VD.ScrnA,u | |
415 IFNE H6309 | |
416 ldd #$2060 | |
417 leay a,x down one line | |
418 ldw #512-32 | |
419 tfm y+,x+ scroll screen up | |
420 stx <VD.CrsrA,u save new cursor address | |
421 ELSE | |
422 leax <32,x | |
423 L0279 ldd ,x++ | |
424 std <-34,x | |
425 cmpx <VD.ScrnE,u | |
426 bcs L0279 | |
427 leax <-32,x | |
428 stx <VD.CrsrA,u | |
429 lda #32 | |
430 ldb #$60 | |
431 ENDC | |
432 L028D stb ,x+ | |
433 deca | |
434 bne L028D | |
435 rts | |
436 | |
437 * $0D - carriage return | |
438 Retrn bsr HideCrsr hide cursor | |
439 IFNE H6309 | |
440 aim #$E0,<VD.CrsAL,u | |
441 ELSE | |
442 tfr x,d | |
443 andb #$E0 strip out bits 0-4 | |
444 stb <VD.CrsAL,u save updated cursor address | |
445 ENDC | |
446 ShowCrsr ldx <VD.CrsrA,u get cursor address | |
447 lda ,x get char at cursor position | |
448 sta <VD.CChar,u save it | |
449 lda <VD.CColr,u get cusor character | |
450 beq RtsOk branch if none | |
451 L02A9 sta ,x else turn on cursor | |
452 RtsOk clrb | |
453 rts | |
454 | |
455 * $0A - moves cursor down | |
456 CurDown bsr HideCrsr hide cursor | |
457 leax <32,x move X down one line | |
458 cmpx <VD.SCrnE,u at the end of the screen? | |
459 bcs L02C1 branch if not | |
460 leax <-32,x else go back up one line | |
461 pshs x save X | |
462 lbsr SScrl and scroll the screen | |
463 puls x and restore pointer | |
464 L02C1 stx <VD.CrsrA,u save cursor pointer | |
465 bra ShowCrsr show cursor | |
466 | |
467 * $08 - moves cursor left one | |
468 CurLeft bsr HideCrsr hide cursor | |
469 cmpx <VD.ScrnA,u compare against start of screen | |
470 bls ShowCrsr ignore it if at the screen start | |
471 leax -$01,x else back up one | |
472 stx <VD.CrsrA,u save updated pointer | |
473 bra ShowCrsr and show cur | |
474 | |
475 * $06 - moves cursor right one | |
476 CurRght bsr HideCrsr hide cursor | |
477 leax 1,x move to the right | |
478 cmpx <VD.SCrnE,u compare against start of screen | |
479 bcc ShowCrsr if past end, ignore it | |
480 stx <VD.CrsrA,u else save updated pointer | |
481 bra ShowCrsr and show cursor | |
482 | |
483 * $0B - erase from current char to end of screen | |
484 ErEOScrn bsr HideCrsr kill the cursor | |
485 * bra L02E8 and clear the rest of the screen | |
486 fcb skip2 | |
487 | |
488 * $0C - clear screen & home cursor | |
489 ClrScrn bsr CurHome home cursor (returns X pointing to start of screen) | |
490 lda #$60 get default char | |
491 ClrSLoop sta ,x+ save at location | |
492 cmpx <VD.SCrnE,u end of screen? | |
493 bcs ClrSLoop branch if not | |
494 bra ShowCrsr now show cursor | |
495 | |
496 * $01 - Homes the cursor | |
497 CurHome bsr HideCrsr hide cursor | |
498 ldx <VD.ScrnA,u get pointer to screen | |
499 stx <VD.CrsrA,u save as new cursor position | |
500 bra ShowCrsr and show it | |
501 | |
502 * Hides the cursor from the screen | |
503 * Exit: X = address of cursor | |
504 HideCrsr ldx <VD.CrsrA,u get address of cursor in X | |
505 lda <VD.CChar,u get value of char under cursor | |
506 sta ,x put char in place of cursor | |
507 clrb must be here, in general, for [...] BRA HideCrsr | |
508 rts | |
509 | |
510 * $05 - turns cursor on/off, color | |
511 CrsrSw lda <VD.NChar,u get next char | |
512 suba #C$SPAC take out ASCII space | |
513 bne L0313 branch if not zero | |
514 sta <VD.CColr,u else save cursor color zero (no cursor) | |
515 bra HideCrsr and hide cursor | |
516 L0313 cmpa #$0B greater than $0B? | |
517 bge RtsOk yep, just ignore byte | |
518 cmpa #$01 is it one? | |
519 bgt L031F branch if greater | |
520 lda #$AF else get default blue cursor color | |
521 bra L032F and save cursor color | |
522 L031F cmpa #$02 is it two? | |
523 bgt L0327 branch if larger | |
524 lda #$A0 else get black cursor color | |
525 bra L032F and save it | |
526 ** BUG ** BUG ** BUG ** BUG | |
527 L0327 suba #$03 ** BUG FIXED ! ** !!! Was SUBB | |
528 lsla shift into upper nibble | |
529 lsla | |
530 lsla | |
531 lsla | |
532 ora #$8F | |
533 L032F sta <VD.CColr,u save new cursor | |
534 ldx <VD.CrsrA,u get cursor address | |
535 lbra L02A9 branch to save cursor in X | |
536 | |
537 * $02 - moves cursor to X,Y | |
538 CurXY ldb #$02 we want to claim the next two chars | |
539 leax <DoCurXY,pcr point to processing routine | |
540 lbra GChar get two chars | |
541 | |
542 DoCurXY bsr HideCrsr hide cursor | |
543 ldb <VD.NChr2,u get ASCII Y-pos | |
544 subb #C$SPAC take out ASCII space | |
545 lda #32 go down | |
546 mul multiply it | |
547 addb <VD.NChar,u add in X-pos | |
548 adca #$00 | |
549 subd #C$SPAC take out another ASCII space | |
550 addd <VD.ScrnA,u add top of screen address | |
551 cmpd <VD.ScrnE,u at end of the screen? | |
552 lbcc RtsOk exit if off the screen | |
553 std <VD.CrsrA,u otherwise save new cursor address | |
554 lbra ShowCrsr and show cursor | |
555 | |
556 * $04 - clear characters to end of line | |
557 ErEOLine bsr HideCrsr hide cursor | |
558 tfr x,d move current cursor position to D | |
559 andb #$1F number of characters put on this line | |
560 negb negative | |
561 bra L0374 and clear one line | |
562 * pshs b | |
563 * ldb #32 | |
564 * subb ,s+ | |
565 * bra L0376 and clear one line | |
566 | |
567 * $03 - erase line cursor is on | |
568 DelLine lbsr Retrn do a carriage return | |
569 * ldb #32 B = $00 from Retrn | |
570 L0374 addb #32 B = $00 from Retrn | |
571 L0376 lda #$60 get default char | |
572 ldx <VD.CrsrA,u get cursor address | |
573 L037B sta ,x+ save default char | |
574 decb decrement | |
575 bne L037B and branch if not end | |
576 lbra ShowCrsr else show cursor | |
577 | |
578 * $09 - moves cursor up one line | |
579 CurUp lbsr HideCrsr hide cursor | |
580 leax <-32,x move X up one line | |
581 cmpx <VD.ScrnA,u compare against start of screen | |
582 lbcs ShowCrsr branch if we went beyond | |
583 stx <VD.CrsrA,u else store updated X | |
584 L0391 lbra ShowCrsr and show cursor | |
585 | |
586 * $0E - switches from graphics to alpha mode | |
587 Do0E equ * | |
588 IFNE H6309 | |
589 clrd | |
590 ELSE | |
591 clra | |
592 clrb | |
593 ENDC | |
594 DispAlfa pshs x,y,a | |
595 IFNE COCO2 | |
596 stb <VD.Alpha,u | |
597 ENDC | |
598 clr <VD.DGBuf,u | |
599 lda >PIA1Base+2 | |
600 anda #$07 | |
601 ora ,s+ | |
602 tstb | |
603 bne L03AD | |
604 anda #$EF | |
605 ora <VD.CFlag,u lowercase flag | |
606 L03AD sta <VD.TFlg1,u save VDG info | |
607 tst >WGlobal+G.CrDvFl is this screen currently showing? | |
608 lbeq L0440 | |
609 sta >PIA1Base+2 set lowercase in hardware | |
610 ldy #$FFC6 Ok, now set up via old CoCo 2 mode | |
611 IFNE COCO2 | |
612 tstb | |
613 bne L03CB | |
614 ENDC | |
615 * Set up VDG screen for text | |
616 stb -6,y $FFC0 | |
617 stb -4,y $FFC2 | |
618 stb -2,y $FFC4 | |
619 lda <VD.ScrnA,u | |
620 IFNE COCO2 | |
621 bra L03D7 | |
622 * Set up VDG screen for graphics | |
623 L03CB stb -6,y $FFC0 | |
624 stb -3,y $FFC3 | |
625 stb -1,y $FFC5 | |
626 lda <VD.SBAdd,u | |
627 ENDC | |
628 L03D7 lbsr SetPals | |
629 ldb <D.HINIT | |
630 orb #$80 set CoCo 2 compatible mode | |
631 stb <D.HINIT | |
632 stb >$FF90 | |
633 ldb <D.VIDMD | |
634 andb #$78 | |
635 stb >$FF98 | |
636 stb <D.VIDMD | |
637 pshs a | |
638 IFNE H6309 | |
639 clrd | |
640 ELSE | |
641 clra | |
642 clrb | |
643 ENDC | |
644 std >$FF99 set resolution AND border color | |
645 std <D.VIDRS | |
646 puls a | |
647 tfr a,b | |
648 anda #$1F | |
649 pshs a | |
650 andb #$E0 | |
651 lsrb | |
652 lsrb | |
653 lsrb | |
654 lsrb | |
655 ldx <D.SysDAT | |
656 * leax a,x | |
657 abx | |
658 * lda $01,x get block number to use | |
659 * pshs a | |
660 * anda #$F8 keep high bits only | |
661 * lsla | |
662 * lsla | |
663 * clrb | |
664 * PATCH START: Mod for >512K systems, Robert Gault | |
665 ldb 1,x get block number to use | |
666 pshs b | |
667 andb #$F8 keep high bits only | |
668 clra | |
669 lslb | |
670 rola | |
671 lslb | |
672 rola | |
673 sta >$FF9B | |
674 tfr b,a | |
675 clrb | |
676 * PATCH END: Mod for >512K systems, Robert Gault | |
677 std <D.VOFF1 display it | |
678 std >$FF9D | |
679 ldd #$0F07 | |
680 sta <D.VOFF2 | |
681 sta >$FF9C | |
682 puls a | |
683 asla | |
684 asla | |
685 asla | |
686 asla | |
687 asla | |
688 ora ,s+ | |
689 * Y now holds $FFC6, so we don't need to work with X here | |
690 * ldx #$FFC6 | |
691 lsra | |
692 L0430 lsra | |
693 bcc L041A | |
694 leay 1,y | |
695 sta ,y+ | |
696 fcb skip2 skip 2 bytes | |
697 L041A sta ,y++ rather than additional leax 1,x on next line | |
698 decb | |
699 bne L0430 | |
700 L0440 clrb | |
701 puls pc,y,x | |
702 | |
703 GChar1 ldb #$01 | |
704 GChar stb <VD.NGChr,u | |
705 stx <VD.RTAdd,u | |
706 clrb | |
707 rts | |
708 | |
709 IFNE COCO2 | |
710 * $0F - display graphics | |
711 Do0F leax <DispGfx,pcr | |
712 ldb #$02 | |
713 bra GChar | |
714 | |
715 DispGfx ldb <VD.Rdy,u memory already alloced? | |
716 bne L0468 branch if so | |
717 lbsr Get8KHi else get an 8k block from high ram | |
718 bcs L0486 branch if error | |
719 stb <VD.GBuff,u save starting block number | |
720 stb <VD.Blk,u | |
721 tfr d,x | |
722 ldd <D.Proc | |
723 pshs u,b,a | |
724 ldd <D.SysPrc get system proc desc | |
725 std <D.Proc make current | |
726 ldb #$01 one block | |
727 os9 F$MapBlk map it in to our space | |
728 tfr u,x get address into x | |
729 puls u,b,a restore other regs | |
730 std <D.Proc restore process pointer | |
731 bcs L0486 branch if error occurred | |
732 stx <VD.SBAdd,u else store address of gfx mem | |
733 inc <VD.Rdy,u we're ready | |
734 lda #$01 | |
735 ldb #$20 | |
736 bsr L04D9 | |
737 lbsr Do13 erase gfx screen | |
738 L0468 lda <VD.NChr2,u get character after next | |
739 sta <VD.PMask,u store color set (0-3) | |
740 anda #$03 mask off pertinent bytes | |
741 leax >Mode1Clr,pcr point to mask byte table | |
742 lda a,x get byte | |
743 sta <VD.Msk1,u save mask byte here | |
744 sta <VD.Msk2,u and here | |
745 lda <VD.NChar,u get next char, mode byte (0-1) | |
746 cmpa #$01 compare against max | |
747 bls L0487 branch if valid | |
748 comb | |
749 ldb #E$BMode else invalid mode specified, send error | |
750 L0486 rts | |
751 | |
752 L0487 tsta test user supplied mode byte | |
753 beq L04A7 branch if 256x192 | |
754 ldd #$C003 | |
755 std <VD.MCol,u | |
756 lda #$01 | |
757 sta <VD.Mode,u 128x192 mode | |
758 lda #$E0 | |
759 ldb <VD.NChr2,u | |
760 andb #$08 | |
761 beq L04A0 | |
762 lda #$F0 | |
763 L04A0 ldb #$03 | |
764 leax <L04EB,pcr | |
765 bra L04C4 | |
766 L04A7 ldd #$8001 | |
767 std <VD.MCol,u | |
768 lda #$FF | |
769 tst <VD.Msk1,u | |
770 beq L04BA | |
771 sta <VD.Msk1,u | |
772 sta <VD.Msk2,u | |
773 L04BA sta <VD.Mode,u 256x192 mode | |
774 lda #$F0 | |
775 ldb #$07 | |
776 leax <L04EF,pcr | |
777 L04C4 stb <VD.PixBt,u | |
778 stx <VD.MTabl,u | |
779 ldb <VD.NChr2,u | |
780 andb #$04 | |
781 lslb | |
782 pshs b | |
783 ora ,s+ | |
784 ldb #$01 | |
785 * Indicate screen is current; next line is critical for >512K - Robert Gault | |
786 stb >WGlobal+G.CrDvFl is this screen currently showing? | |
787 lbra DispAlfa | |
788 | |
789 L04D9 pshs x,b,a | |
790 clra | |
791 ldb $02,s | |
792 ldx <D.SysMem | |
793 leax d,x | |
794 puls b,a | |
795 L04E4 sta ,x+ | |
796 decb | |
797 bne L04E4 | |
798 puls pc,x | |
799 | |
800 L04EB fdb $C030,$0C03 | |
801 | |
802 L04EF fcb $80,$40,$20,$10,$08,$04,$02,$01 | |
803 | |
804 * $11 - set color | |
805 Do11 leax <SetColor,pcr | |
806 lbra GChar1 | |
807 SetColor lda <VD.NChar,u get next char | |
808 sta <VD.NChr2,u save in next after | |
809 L0503 clr <VD.NChar,u and clear next | |
810 lda <VD.Mode,u which mode? | |
811 bmi L050E branch if 256x192 | |
812 inc <VD.NChar,u | |
813 L050E lbra L0468 | |
814 | |
815 * $12 - end graphics | |
816 Do12 ldx <VD.SBAdd,u get screen address | |
817 beq L051B branch if empty | |
818 clra | |
819 ldb #$20 | |
820 bsr L04D9 | |
821 L051B leay <VD.GBuff,u point Y to graphics buffer block numbers | |
822 ldb #$03 number of blocks starting at VD.GBuff | |
823 pshs u,b save our static pointer, and counter (3) | |
824 L0522 lda ,y+ get next block | |
825 beq L052D if empty, continue | |
826 clrb else clear B | |
827 tfr d,x transfer D to X | |
828 incb 1 block to deallocate | |
829 os9 F$DelRAM deallocate it | |
830 L052D dec ,s dec counter | |
831 bgt L0522 if not zero, get more | |
832 * Note: this seems to be a bug. Here, Y is pointing to VD.HiRes ($4D), which | |
833 * is the block number of any CoCo 3 Hi-Res screen. This $0E command just | |
834 * deals with CoCo 2 graphics modes. What I think should happen here is | |
835 * that the byte flood fill buffer should be checked for non-zero, | |
836 * then freed. It looks as though this code would work IF the Hi-Res | |
837 * variables from $4D-$5B, which are CoCo 3 specific, didn't exist. So | |
838 * this bug was introduced when the CoCo 3 specific static vars were added | |
839 * between VD.AGBuf and VD.FFMem | |
840 ldu VD.FFMem-VD.HiRes,y get flood fill stack memory ptr | |
841 beq L053B | |
842 ldd #FFStSz get flood fill stack size | |
843 os9 F$SRtMem | |
844 L053B puls u,b | |
845 clr <VD.Rdy,u | |
846 lbra Do0E | |
847 | |
848 * $10 - preset screen to a specific color | |
849 Do10 leax <PrstScrn,pcr | |
850 lbra GChar1 | |
851 | |
852 PrstScrn lda <VD.NChar,u get next char | |
853 tst <VD.Mode,u which mode? | |
854 bpl L0559 branch if 128x192 4 color | |
855 ldb #$FF assume we will clear with $FF | |
856 anda #$01 mask out all but 1 bit (2 colors) | |
857 beq Do13 erase graphic screen with color $00 | |
858 bra L0564 else erase with color $FF | |
859 L0559 anda #$03 mask out all but 2 bits (4 colors) | |
860 leax >Mode1Clr,pcr point to color table | |
861 ldb a,x get appropriate byte | |
862 bra L0564 and start the clearing | |
863 | |
864 * $13 - erase graphics | |
865 Do13 clrb | |
866 L0564 ldx <VD.SBAdd,u | |
867 IFNE H6309 | |
868 * Note: 6309 version clears from top to bottom | |
869 * 6809 version clears from bottom to top | |
870 ldw #$1800 | |
871 pshs b | |
872 tfm s,x+ | |
873 puls b | |
874 ELSE | |
875 leax >$1801,x | |
876 L056B stb ,-x | |
877 cmpx <VD.SBAdd,u | |
878 bhi L056B | |
879 ENDC | |
880 | |
881 * $14 - home graphics cursor | |
882 Do14 equ * | |
883 IFNE H6309 | |
884 clrd | |
885 ELSE | |
886 clra | |
887 clrb | |
888 ENDC | |
889 std <VD.GCrsX,u | |
890 rts | |
891 | |
892 * 128x192 4 color pixel table | |
893 Mode1Clr fcb $00,$55,$aa,$ff | |
894 | |
895 * Fix X/Y coords: | |
896 * - if Y > 191 then cap it at 191 | |
897 * - adjust X coord if in 128x192 mode | |
898 FixXY ldd <VD.NChar,u get next 2 chars | |
899 cmpb #192 Y greater than max? | |
900 bcs L0585 branch if lower than | |
901 ldb #191 | |
902 L0585 tst <VD.Mode,u which mode? | |
903 bmi L058B branch if 256x192 | |
904 lsra else divide X by 2 | |
905 L058B std <VD.NChar,u and save | |
906 rts | |
907 | |
908 * $15 - set graphics cursor | |
909 Do15 leax <SetGC,pcr | |
910 GChar2 ldb #$02 | |
911 lbra GChar | |
912 | |
913 SetGC bsr FixXY fix coords | |
914 std <VD.GCrsX,u and save new gfx cursor pos | |
915 clrb | |
916 rts | |
917 | |
918 * $19 - erase point | |
919 Do19 clr <VD.Msk1,u | |
920 * $18 - set point | |
921 Do18 leax <DrawPnt,pcr | |
922 bra GChar2 | |
923 | |
924 DrawPnt bsr FixXY fix coords | |
925 std <VD.GCrsX,u save as new gfx cursor pos | |
926 bsr DrwPt2 | |
927 lbra L067C | |
928 DrwPt2 lbsr XY2Addr | |
929 L05B3 tfr a,b | |
930 comb | |
931 andb ,x | |
932 stb ,x | |
933 anda <VD.Msk1,u | |
934 ora ,x | |
935 sta ,x | |
936 rts | |
937 | |
938 * $17 - erase line | |
939 Do17 clr <VD.Msk1,u | |
940 | |
941 * $16 - draw line | |
942 Do16 leax <DrawLine,pcr | |
943 bra GChar2 | |
944 | |
945 DrawLine bsr FixXY fix up coords | |
946 leas -$0E,s | |
947 std $0C,s | |
948 lbsr XY2Addr | |
949 stx $02,s | |
950 sta $01,s | |
951 ldd <VD.GCrsX,u | |
952 lbsr XY2Addr | |
953 sta ,s | |
954 IFNE H6309 | |
955 clrd | |
956 ELSE | |
957 clra | |
958 clrb | |
959 ENDC | |
960 std $04,s | |
961 lda #$BF | |
962 suba <VD.GCrsY,u | |
963 sta <VD.GCrsY,u | |
964 lda #$BF | |
965 suba <VD.NChr2,u | |
966 sta <VD.NChr2,u | |
967 lda #$FF | |
968 sta $06,s | |
969 clra | |
970 ldb <VD.GCrsX,u | |
971 subb <VD.NChar,u | |
972 sbca #$00 | |
973 bpl L0608 | |
974 IFNE H6309 | |
975 negd | |
976 ELSE | |
977 nega | |
978 negb | |
979 sbca #$00 | |
980 ENDC | |
981 neg $06,s | |
982 L0608 std $08,s | |
983 bne L0611 | |
984 ldd #$FFFF | |
985 std $04,s | |
986 L0611 lda #$E0 | |
987 sta $07,s | |
988 clra | |
989 ldb <VD.GCrsY,u | |
990 subb <VD.NChr2,u | |
991 sbca #$00 | |
992 bpl L0626 | |
993 IFNE H6309 | |
994 negd | |
995 ELSE | |
996 nega | |
997 negb | |
998 sbca #$00 | |
999 ENDC | |
1000 neg $07,s | |
1001 L0626 std $0A,s | |
1002 bra L0632 | |
1003 L062A sta ,s | |
1004 ldd $04,s | |
1005 subd $0A,s | |
1006 std $04,s | |
1007 L0632 lda ,s | |
1008 lbsr L05B3 | |
1009 cmpx $02,s | |
1010 bne L0641 | |
1011 lda ,s | |
1012 cmpa $01,s | |
1013 beq L0675 | |
1014 L0641 ldd $04,s | |
1015 bpl L064F | |
1016 addd $08,s | |
1017 std $04,s | |
1018 lda $07,s | |
1019 leax a,x | |
1020 bra L0632 | |
1021 L064F lda ,s | |
1022 ldb $06,s | |
1023 bpl L0665 | |
1024 lsla | |
1025 ldb <VD.Mode,u which mode? | |
1026 bmi L065C branch if 256x192 | |
1027 lsla | |
1028 L065C bcc L062A | |
1029 lda <VD.MCol2,u | |
1030 leax -$01,x | |
1031 bra L062A | |
1032 L0665 lsra | |
1033 ldb <VD.Mode,u which mode? | |
1034 bmi L066C branch if 256x192 | |
1035 lsra | |
1036 L066C bcc L062A | |
1037 lda <VD.MCol,u | |
1038 leax $01,x | |
1039 bra L062A | |
1040 L0675 ldd $0C,s | |
1041 std <VD.GCrsX,u | |
1042 leas $0E,s | |
1043 L067C lda <VD.Msk2,u | |
1044 sta <VD.Msk1,u | |
1045 clrb | |
1046 rts | |
1047 | |
1048 * $1C - erase circle | |
1049 Do1C clr <VD.Msk1,u | |
1050 * $1A - draw circle | |
1051 Do1A leax <Circle,pcr | |
1052 lbra GChar1 | |
1053 | |
1054 Circle leas -$04,s | |
1055 ldb <VD.NChar,u get radius | |
1056 stb $01,s store on stack | |
1057 clra | |
1058 sta ,s | |
1059 addb $01,s | |
1060 adca #$00 | |
1061 IFNE H6309 | |
1062 negd | |
1063 ELSE | |
1064 nega | |
1065 negb | |
1066 sbca #$00 | |
1067 ENDC | |
1068 addd #$0003 | |
1069 std $02,s | |
1070 L06AB lda ,s | |
1071 cmpa $01,s | |
1072 bcc L06DD | |
1073 ldb $01,s | |
1074 bsr L06EB | |
1075 clra | |
1076 ldb $02,s | |
1077 bpl L06C5 | |
1078 ldb ,s | |
1079 IFNE H6309X | |
1080 lsld | |
1081 lsld | |
1082 ELSE | |
1083 lslb | |
1084 rola | |
1085 lslb | |
1086 rola | |
1087 ENDC | |
1088 addd #$0006 | |
1089 bra L06D5 | |
1090 L06C5 dec $01,s | |
1091 clra | |
1092 ldb ,s | |
1093 subb $01,s | |
1094 sbca #$00 | |
1095 IFNE H6309X | |
1096 lsld | |
1097 lsld | |
1098 ELSE | |
1099 lslb | |
1100 rola | |
1101 lslb | |
1102 rola | |
1103 ENDC | |
1104 addd #$000A | |
1105 L06D5 addd $02,s | |
1106 std $02,s | |
1107 inc ,s | |
1108 bra L06AB | |
1109 L06DD lda ,s | |
1110 cmpa $01,s | |
1111 bne L06E7 | |
1112 ldb $01,s | |
1113 bsr L06EB | |
1114 L06E7 leas $04,s | |
1115 bra L067C | |
1116 L06EB leas -$08,s | |
1117 sta ,s | |
1118 clra | |
1119 std $02,s | |
1120 IFNE H6309 | |
1121 negd | |
1122 ELSE | |
1123 nega | |
1124 negb | |
1125 sbca #$00 | |
1126 ENDC | |
1127 std $06,s | |
1128 ldb ,s | |
1129 clra | |
1130 std ,s | |
1131 IFNE H6309 | |
1132 negd | |
1133 ELSE | |
1134 nega | |
1135 negb | |
1136 sbca #$00 | |
1137 ENDC | |
1138 std $04,s | |
1139 ldx $06,s | |
1140 bsr L0734 | |
1141 ldd $04,s | |
1142 ldx $02,s | |
1143 bsr L0734 | |
1144 ldd ,s | |
1145 ldx $02,s | |
1146 bsr L0734 | |
1147 ldd ,s | |
1148 ldx $06,s | |
1149 bsr L0734 | |
1150 ldd $02,s | |
1151 ldx ,s | |
1152 bsr L0734 | |
1153 ldd $02,s | |
1154 ldx $04,s | |
1155 bsr L0734 | |
1156 ldd $06,s | |
1157 ldx $04,s | |
1158 bsr L0734 | |
1159 ldd $06,s | |
1160 ldx ,s | |
1161 bsr L0734 | |
1162 leas $08,s | |
1163 rts | |
1164 L0734 pshs b,a | |
1165 ldb <VD.GCrsY,u | |
1166 clra | |
1167 leax d,x | |
1168 cmpx #$0000 | |
1169 bmi L0746 | |
1170 cmpx #$00BF | |
1171 ble L0748 | |
1172 L0746 puls pc,b,a | |
1173 L0748 ldb <VD.GCrsX,u | |
1174 clra | |
1175 tst <VD.Mode,u which mode? | |
1176 bmi L0753 branch if 256x192 | |
1177 IFNE H6309X | |
1178 lsld | |
1179 ELSE | |
1180 lslb else multiply D by 2 | |
1181 rola | |
1182 ENDC | |
1183 L0753 addd ,s++ | |
1184 tsta | |
1185 beq L0759 | |
1186 rts | |
1187 L0759 pshs b | |
1188 tfr x,d | |
1189 puls a | |
1190 tst <VD.Mode,u which mode? | |
1191 lbmi DrwPt2 branch if 256x192 | |
1192 lsra else divide a by 2 | |
1193 lbra DrwPt2 | |
1194 | |
1195 * $1D - flood fill | |
1196 Do1D clr <VD.FF6,u | |
1197 leas -$07,s | |
1198 lbsr L08DD | |
1199 lbcs L0878 | |
1200 lda #$FF | |
1201 sta <VD.FFFlg,u | |
1202 ldd <VD.GCrsX,u | |
1203 lbsr L0883 | |
1204 lda <VD.FF1,u | |
1205 sta <VD.FF2,u | |
1206 tst <VD.Mode,u which mode? | |
1207 bpl L0793 branch if 128x192 | |
1208 tsta | |
1209 beq L0799 | |
1210 lda #$FF | |
1211 bra L0799 | |
1212 L0793 leax >Mode1Clr,pcr | |
1213 lda a,x | |
1214 L0799 sta <VD.FFMsk,u | |
1215 cmpa <VD.Msk1,u | |
1216 lbeq L0878 | |
1217 ldd <VD.GCrsX,u | |
1218 L07A6 suba #$01 | |
1219 bcs L07B1 | |
1220 lbsr L0883 | |
1221 bcs L07B1 | |
1222 beq L07A6 | |
1223 L07B1 inca | |
1224 std $01,s | |
1225 L07B4 lbsr L08B6 | |
1226 adda #$01 | |
1227 bcs L07C2 | |
1228 lbsr L0883 | |
1229 bcs L07C2 | |
1230 beq L07B4 | |
1231 L07C2 deca | |
1232 ldx $01,s | |
1233 lbsr L0905 | |
1234 neg <VD.FFFlg,u | |
1235 lbsr L0905 | |
1236 L07CE lbsr L092B | |
1237 lbcs L0878 | |
1238 tst <VD.FFFlg,u | |
1239 bpl L07E5 | |
1240 subb #$01 | |
1241 bcs L07CE | |
1242 std $03,s | |
1243 tfr x,d | |
1244 decb | |
1245 bra L07EF | |
1246 L07E5 incb | |
1247 cmpb #$BF | |
1248 bhi L07CE | |
1249 std $03,s | |
1250 tfr x,d | |
1251 incb | |
1252 L07EF std $01,s | |
1253 lbsr L0883 | |
1254 bcs L07CE | |
1255 L07F6 bne L0804 | |
1256 suba #$01 | |
1257 bcc L07FF | |
1258 inca | |
1259 bra L0808 | |
1260 L07FF lbsr L0883 | |
1261 bcc L07F6 | |
1262 L0804 adda #$01 | |
1263 bcs L07CE | |
1264 L0808 cmpd $03,s | |
1265 bhi L07CE | |
1266 bsr L0883 | |
1267 bcs L07CE | |
1268 bne L0804 | |
1269 std $05,s | |
1270 cmpd $01,s | |
1271 bcc L082D | |
1272 ldd $01,s | |
1273 decb | |
1274 cmpd $05,s | |
1275 beq L082D | |
1276 neg <VD.FFFlg,u | |
1277 ldx $05,s | |
1278 lbsr L0905 | |
1279 neg <VD.FFFlg,u | |
1280 L082D ldd $05,s | |
1281 L082F std $01,s | |
1282 L0831 bsr L0883 | |
1283 bcs L083D | |
1284 bne L083D | |
1285 bsr L08B6 | |
1286 adda #$01 | |
1287 bcc L0831 | |
1288 L083D deca | |
1289 ldx $01,s | |
1290 lbsr L0905 | |
1291 std $05,s | |
1292 adda #$01 | |
1293 bcs L0858 | |
1294 L0849 cmpd $03,s | |
1295 bcc L0858 | |
1296 adda #$01 | |
1297 bsr L0883 | |
1298 bcs L0858 | |
1299 bne L0849 | |
1300 bra L082F | |
1301 L0858 inc $03,s | |
1302 inc $03,s | |
1303 ldd $03,s | |
1304 cmpa #$02 | |
1305 lbcs L07CE | |
1306 ldd $05,s | |
1307 cmpd $03,s | |
1308 lbcs L07CE | |
1309 neg <VD.FFFlg,u | |
1310 ldx $03,s | |
1311 lbsr L0905 | |
1312 lbra L07CE | |
1313 L0878 leas $07,s | |
1314 clrb | |
1315 ldb <VD.FF6,u | |
1316 beq L0882 | |
1317 L0880 orcc #$01 | |
1318 L0882 rts | |
1319 L0883 pshs b,a | |
1320 cmpb #191 | |
1321 bhi L08B2 | |
1322 tst <VD.Mode,u which mode? | |
1323 bmi L0892 branch if 256x192 | |
1324 cmpa #$7F | |
1325 bhi L08B2 | |
1326 L0892 lbsr XY2Addr | |
1327 tfr a,b | |
1328 andb ,x | |
1329 L0899 bita #$01 | |
1330 bne L08A8 | |
1331 lsra | |
1332 lsrb | |
1333 tst <VD.Mode,u which mode? | |
1334 bmi L0899 branch if 256x192 | |
1335 lsra | |
1336 lsrb | |
1337 bra L0899 | |
1338 L08A8 stb <VD.FF1,u | |
1339 cmpb <VD.FF2,u | |
1340 andcc #^Carry | |
1341 puls pc,b,a | |
1342 L08B2 orcc #Carry | |
1343 puls pc,b,a | |
1344 L08B6 pshs b,a | |
1345 lbsr XY2Addr | |
1346 bita #$80 | |
1347 beq L08D8 | |
1348 ldb <VD.FFMsk,u | |
1349 cmpb ,x | |
1350 bne L08D8 | |
1351 ldb <VD.Msk1,u | |
1352 stb ,x | |
1353 puls b,a | |
1354 tst <VD.Mode,u which mode? | |
1355 bmi L08D5 branch if 256x192 | |
1356 adda #$03 | |
1357 rts | |
1358 L08D5 adda #$07 | |
1359 rts | |
1360 L08D8 lbsr L05B3 | |
1361 puls pc,b,a | |
1362 L08DD ldx <VD.FFSTp,u get top of flood fill stack | |
1363 beq AlcFFStk if zero, we need to allocate stack | |
1364 stx <VD.FFSPt,u else reset flood fill stack ptr | |
1365 L08E5 clrb | |
1366 rts | |
1367 | |
1368 * Allocate Flood Fill Stack | |
1369 AlcFFStk pshs u save U for now | |
1370 ldd #FFStSz get 512 bytes | |
1371 os9 F$SRqMem from system | |
1372 bcc AllocOk branch if ok | |
1373 puls pc,u else pull out with error | |
1374 AllocOk tfr u,d move pointer to alloced mem to D | |
1375 puls u get stat pointer we saved earlier | |
1376 std <VD.FFMem,u save pointer to alloc'ed mem | |
1377 addd #FFStSz point D to end of alloc'ed mem | |
1378 std <VD.FFSTp,u and save here as top of fill stack | |
1379 std <VD.FFSPt,u and here | |
1380 bra L08E5 do a clean return | |
1381 | |
1382 L0905 pshs b,a | |
1383 ldd <VD.FFSPt,u | |
1384 subd #$0004 | |
1385 cmpd <VD.FFMem,u | |
1386 bcs L0924 | |
1387 std <VD.FFSPt,u | |
1388 tfr d,y | |
1389 lda <VD.FFFlg,u | |
1390 sta ,y | |
1391 stx $01,y | |
1392 puls b,a | |
1393 sta $03,y | |
1394 rts | |
1395 L0924 ldb #$F5 | |
1396 stb <VD.FF6,u | |
1397 puls pc,b,a | |
1398 L092B ldd <VD.FFSPt,u | |
1399 cmpd <VD.FFSTp,u top of flood fill stack? | |
1400 lbcc L0880 | |
1401 tfr d,y | |
1402 addd #$0004 | |
1403 std <VD.FFSPt,u | |
1404 lda ,y | |
1405 sta <VD.FFFlg,u | |
1406 ldd $01,y | |
1407 tfr d,x | |
1408 lda $03,y | |
1409 andcc #^Carry | |
1410 rts | |
1411 ENDC | |
1412 | |
1413 GetStat ldx PD.RGS,y | |
1414 cmpa #SS.AlfaS | |
1415 beq Rt.AlfaS | |
1416 cmpa #SS.ScSiz | |
1417 beq Rt.ScSiz | |
1418 cmpa #SS.Cursr | |
1419 beq Rt.Cursr | |
1420 IFNE COCO2 | |
1421 cmpa #SS.DSTAT | |
1422 lbeq Rt.DSTAT | |
1423 ENDC | |
1424 cmpa #SS.Palet | |
1425 lbeq Rt.Palet | |
1426 comb | |
1427 ldb #E$UnkSvc | |
1428 rts | |
1429 | |
1430 * Returns window or screen size | |
1431 Rt.ScSiz equ * | |
1432 IFNE H6309 | |
1433 ldq #$00200010 a fast cheat | |
1434 stq R$X,x | |
1435 ELSE | |
1436 * ldb <VD.Col,u | |
1437 ldd #$0020 | |
1438 std R$X,x | |
1439 * ldb <VD.Row,u | |
1440 ldb #$10 | |
1441 std R$Y,x | |
1442 ENDC | |
1443 clrb | |
1444 rts | |
1445 | |
1446 * Get palette information | |
1447 Rt.Palet pshs u,y,x | |
1448 leay <VD.Palet,u point to palette data in proc desc | |
1449 ldu R$X,x pointer to 16 byte palette buffer | |
1450 ldx <D.Proc current proc desc | |
1451 ldb P$Task,x destination task number | |
1452 clra from task 0 | |
1453 tfr y,x | |
1454 ldy #16 move 16 bytes | |
1455 os9 F$Move | |
1456 puls pc,u,y,x | |
1457 | |
1458 * Return VDG alpha screen memory info | |
1459 Rt.AlfaS ldd <VD.ScrnA,u | |
1460 anda #$E0 keep bits 4-6 | |
1461 lsra | |
1462 lsra | |
1463 lsra | |
1464 lsra move to bits 0-2 | |
1465 ldy <D.SysDAT | |
1466 ldd a,y | |
1467 lbsr L06E1 map it in the process' memory area | |
1468 bcs L0521 | |
1469 pshs b,a offset to block address | |
1470 ldd <VD.ScrnA,u | |
1471 anda #$1F make sure it's within the block | |
1472 addd ,s | |
1473 std R$X,x memory address of the buffer | |
1474 ldd <VD.CrsrA,u | |
1475 anda #$1F | |
1476 addd ,s++ | |
1477 std R$Y,x memory address of the cursor | |
1478 lda <VD.Caps,u save caps lock status in A and exit | |
1479 bra L051E | |
1480 | |
1481 * Returns VDG alpha screen cursor info | |
1482 Rt.Cursr ldd <VD.CrsrA,u | |
1483 subd <VD.ScrnA,u | |
1484 pshs b,a | |
1485 clra | |
1486 andb #$1F | |
1487 addb #$20 | |
1488 std R$X,x save column position in ASCII | |
1489 puls b,a then divide by 32 | |
1490 lsra | |
1491 rolb | |
1492 rolb | |
1493 rolb | |
1494 rolb | |
1495 clra | |
1496 andb #$0F only 16 lines to a screen | |
1497 addb #$20 | |
1498 std R$Y,x | |
1499 ldb <VD.CFlag,u | |
1500 lda <VD.CChar,u | |
1501 bmi L051E | |
1502 cmpa #$60 | |
1503 bcc L0509 | |
1504 cmpa #$20 | |
1505 bcc L050D | |
1506 tstb | |
1507 beq L0507 | |
1508 cmpa #$00 | |
1509 bne L04FF | |
1510 lda #$5E | |
1511 bra L051E save it and exit | |
1512 | |
1513 L04FF cmpa #$1F | |
1514 bne L0507 | |
1515 lda #$5F | |
1516 bra L051E | |
1517 L0507 ora #$20 turn it into ASCII from VDG codes | |
1518 L0509 eora #$40 | |
1519 bra L051E | |
1520 L050D tstb | |
1521 bne L051E | |
1522 cmpa #$21 remap specific codes | |
1523 bne L0518 | |
1524 lda #$7C | |
1525 bra L051E | |
1526 L0518 cmpa #$2D | |
1527 bne L051E | |
1528 lda #$7E | |
1529 L051E sta R$A,x | |
1530 clrb | |
1531 L0521 rts | |
1532 | |
1533 IFNE COCO2 | |
1534 Rt.DSTAT bsr ChkDvRdy | |
1535 bcs L0A4F | |
1536 ldd <VD.GCrsX,u | |
1537 lbsr XY2Addr | |
1538 tfr a,b | |
1539 andb ,x | |
1540 L0A23 bita #$01 | |
1541 bne L0A32 | |
1542 lsra | |
1543 lsrb | |
1544 tst <VD.Mode,u which mode? | |
1545 bmi L0A23 branch if 256x192 | |
1546 lsra | |
1547 lsrb | |
1548 bra L0A23 | |
1549 L0A32 pshs b | |
1550 ldb <VD.PMask,u | |
1551 andb #$FC | |
1552 orb ,s+ | |
1553 ldx PD.RGS,y | |
1554 stb R$A,x | |
1555 ldd <VD.GCrsX,u | |
1556 std R$Y,x | |
1557 ldb <VD.Blk,u | |
1558 lbsr L06E1 | |
1559 bcs L0A4F | |
1560 std R$X,x | |
1561 L0A4E clrb | |
1562 L0A4F rts | |
1563 | |
1564 ChkDvRdy ldb <VD.Rdy,u is device ready? | |
1565 bne L0A4E branch if so | |
1566 lbra NotReady else return error | |
1567 | |
1568 * Entry: A = X coor, B = Y coor | |
1569 XY2Addr pshs y,b,a save off | |
1570 ldb <VD.Mode,u get video mode | |
1571 bpl L0A60 branch if 128x192 (divide A by 4) | |
1572 lsra else divide A by 8 | |
1573 L0A60 lsra | |
1574 lsra | |
1575 pshs a save on stack | |
1576 ldb #191 get max Y | |
1577 subb $02,s subtract from Y on stack | |
1578 lda #32 bytes per line | |
1579 mul | |
1580 addb ,s+ add offset on stack | |
1581 adca #$00 | |
1582 ldy <VD.SBAdd,u get base address | |
1583 leay d,y move D bytes into address | |
1584 lda ,s pick up original X coor | |
1585 sty ,s put offset addr on stack | |
1586 anda <VD.PixBt,u | |
1587 ldx <VD.MTabl,u | |
1588 lda a,x | |
1589 puls pc,y,x X = offset address, Y = base | |
1590 ENDC | |
1591 | |
1592 SetStat ldx PD.RGS,y | |
1593 cmpa #SS.ComSt | |
1594 beq Rt.ComSt | |
1595 IFNE COCO2 | |
1596 cmpa #SS.AAGBf | |
1597 beq Rt.AAGBf | |
1598 cmpa #SS.SLGBf | |
1599 beq Rt.SLGBf | |
1600 ENDC | |
1601 cmpa #SS.ScInf new NitrOS-9 call | |
1602 lbeq Rt.ScInf | |
1603 cmpa #SS.DScrn | |
1604 lbeq Rt.DScrn | |
1605 cmpa #SS.PScrn | |
1606 lbeq Rt.PScrn | |
1607 cmpa #SS.AScrn | |
1608 lbeq Rt.AScrn | |
1609 cmpa #SS.FScrn | |
1610 lbeq Rt.FScrn | |
1611 comb | |
1612 ldb #E$UnkSvc | |
1613 rts | |
1614 | |
1615 * Allow switch between true/fake lowercase | |
1616 Rt.ComSt ldd R$Y,x | |
1617 L054C ldb #$10 sets screen to lowercase | |
1618 bita #$01 Y = 0 = true lowercase, Y = 1 = fake lower | |
1619 bne L0553 | |
1620 clrb | |
1621 L0553 stb <VD.CFlag,u | |
1622 ldd #$2010 32x16 | |
1623 inc <VD.DFlag,u | |
1624 std <VD.Col,u | |
1625 rts | |
1626 | |
1627 IFNE COCO2 | |
1628 Rt.AAGBf ldb <VD.Rdy,u | |
1629 beq NotReady | |
1630 ldd #$0201 | |
1631 leay <VD.AGBuf,u | |
1632 lbsr L06C7 | |
1633 bcs L0AEB | |
1634 pshs a | |
1635 lbsr Get8KHi | |
1636 bcs L0AEC | |
1637 stb ,y | |
1638 lbsr L06E1 | |
1639 bcs L0AEC | |
1640 std R$X,x | |
1641 puls b | |
1642 clra | |
1643 std R$Y,x | |
1644 L0AEB rts | |
1645 L0AEC puls pc,a | |
1646 | |
1647 NotReady comb | |
1648 ldb #E$NotRdy | |
1649 rts | |
1650 | |
1651 Rt.SLGBf ldb <VD.Rdy,u | |
1652 beq NotReady | |
1653 ldd R$Y,x | |
1654 cmpd #$0002 | |
1655 lbhi IllArg | |
1656 leay <VD.GBuff,u | |
1657 ldb b,y | |
1658 lbeq IllArg | |
1659 pshs x | |
1660 stb <VD.Blk,u | |
1661 lda <VD.SBAdd,u | |
1662 anda #$E0 | |
1663 lsra | |
1664 lsra | |
1665 lsra | |
1666 lsra | |
1667 ldx <D.SysPrc | |
1668 leax <P$DATImg,x | |
1669 leax a,x | |
1670 clra | |
1671 std ,x | |
1672 ldx <D.SysPrc | |
1673 os9 F$SetTsk | |
1674 puls x | |
1675 ldd R$X,x | |
1676 beq L0B2B | |
1677 ldb #$01 | |
1678 L0B2B stb <VD.DFlag,u | |
1679 clrb | |
1680 rts | |
1681 ENDC | |
1682 | |
1683 * Display Table | |
1684 * 1st entry = display code | |
1685 * 2nd entry = # of 8K blocks | |
1686 DTabl fcb $14 0: 640x192, 2 color | |
1687 fcb $02 16K | |
1688 fcb $15 1: 320x192, 4 color | |
1689 fcb $02 16K | |
1690 fcb $16 2: 160x192, 16 color | |
1691 fcb $02 16K | |
1692 fcb $1D 3: 640x192, 4 color | |
1693 fcb $04 32K | |
1694 fcb $1E 4: 320x192, 16 color | |
1695 fcb $04 32K | |
1696 | |
1697 * Allocates and maps a hires screen into process address | |
1698 Rt.AScrn ldd R$X,x get screen type from caller's X | |
1699 cmpd #$0004 screen type 0-4 | |
1700 lbhi IllArg if higher than legal limit, return error | |
1701 pshs y,x,b,a else save off regs | |
1702 ldd #$0303 | |
1703 leay <VD.HiRes,u pointer to screen descriptor | |
1704 lbsr L06C7 gets next free screen descriptor | |
1705 bcs L05AF branch if none found | |
1706 sta ,s save screen descriptor on stack | |
1707 ldb $01,s get screen type | |
1708 * stb $02,y and store in VD.SType | |
1709 stb (VD.SType-VD.HiRes),y and store in VD.SType | |
1710 leax >DTabl,pcr point to display table | |
1711 lslb multiply index by 2 (word entries) | |
1712 abx point to display code, #blocks | |
1713 ldb $01,x get number of blocks | |
1714 * stb $01,y VD.NBlk | |
1715 stb (VD.NBlk-VD.HiRes),y VD.NBlk | |
1716 lda #$FF start off with zero screens allocated | |
1717 BA010 inca count up by one | |
1718 ldb (VD.NBlk-VD.HiRes),y get number of blocks | |
1719 pshs a needed to protect regA; RG. | |
1720 os9 F$AlHRAM allocate a screen | |
1721 puls a | |
1722 bcs DeAll de-allocate ALL allocated blocks on error | |
1723 pshs b save starting block number of the screen | |
1724 andb #$3F keep block BL= block MOD 63 | |
1725 pshs b | |
1726 addb (VD.NBlk-VD.HiRes),y add in the block size of the screen | |
1727 decb in case last block is $3F,$7F,$BF,$FF; RG. | |
1728 andb #$3F (BL+S) mod 63 < BL? (overlap 512k bank) | |
1729 cmpb ,s+ is all of it in this bank? | |
1730 blo BA010 if not, allocate another screen | |
1731 puls b restore the block number for this screen | |
1732 stb ,y VD.HiRes - save starting block number | |
1733 bsr DeMost deallocate all of the other screens | |
1734 leas a,s move from within DeMost; RG. | |
1735 ldb ,y restore the starting block number again | |
1736 | |
1737 lda $01,x number of blocks | |
1738 lbsr L06E3 | |
1739 bcs L05AF | |
1740 ldx $02,s | |
1741 std R$X,x | |
1742 ldb ,s | |
1743 clra | |
1744 std R$Y,x | |
1745 L05AF leas $02,s | |
1746 puls pc,y,x | |
1747 L05B3X leas $02,s | |
1748 | |
1749 IllArg comb | |
1750 ldb #E$IllArg | |
1751 rts | |
1752 | |
1753 * De-allocate the screens | |
1754 DeAll bsr DeMost de-allocate all of the screens | |
1755 bra L05AF restore stack and exit | |
1756 | |
1757 DeMost tsta | |
1758 beq DA020 quick exit if zero additional screens | |
1759 | |
1760 ldb (VD.NBlk-VD.HiRes),y get # blocks of screen to de-allocate | |
1761 pshs a save count of blocks for later | |
1762 pshs d,y,x save rest of regs | |
1763 leay 9,s account for d,y,x,a,calling PC | |
1764 clra | |
1765 DA010 ldb ,y+ get starting block number | |
1766 tfr d,x in X | |
1767 ldb 1,s get size of the screen to de-allocate | |
1768 pshs a needed to protect regA; RG. | |
1769 os9 F$DelRAM de-allocate the blocks *** IGNORING ERRORS *** | |
1770 puls a | |
1771 dec ,s count down | |
1772 bne DA010 | |
1773 puls d,y,x restore registers | |
1774 puls a and count of extra bytes on the stack | |
1775 * leas a,s removed because it yanks wrong data; RG. | |
1776 DA020 rts and exit | |
1777 | |
1778 * Get current screen info for direct writes - added in NitrOS-9 | |
1779 Rt.ScInf pshs x save caller's regs ptr | |
1780 ldd R$Y,x get screen | |
1781 bmi L05C8 | |
1782 bsr L05DE | |
1783 bcs L05DC | |
1784 lbsr L06FF | |
1785 bcs L05DC | |
1786 L05C8 ldx ,s get caller's regs ptr from stack | |
1787 ldb R$Y+1,x | |
1788 bmi L05DB | |
1789 bsr L05DE | |
1790 bcs L05DC | |
1791 lbsr L06E3 | |
1792 bcs L05DC | |
1793 ldx ,s | |
1794 std R$X,x | |
1795 L05DB clrb | |
1796 L05DC puls pc,x | |
1797 L05DE beq L05F1 | |
1798 cmpb #$03 | |
1799 bhi L05F1 | |
1800 bsr GetScrn | |
1801 beq L05F1 | |
1802 ldb ,x | |
1803 beq L05F1 | |
1804 lda $01,x | |
1805 andcc #^Carry | |
1806 rts | |
1807 L05F1 bra IllArg | |
1808 | |
1809 * Convert screen to a different type | |
1810 Rt.PScrn ldd R$X,x | |
1811 cmpd #$0004 | |
1812 bhi IllArg | |
1813 pshs b,a save screen type, and a zero | |
1814 leax >DTabl,pcr | |
1815 lslb | |
1816 incb | |
1817 lda b,x get number of blocks the screen requires | |
1818 sta ,s kill 'A' on the stack | |
1819 ldx PD.RGS,y | |
1820 bsr L061B | |
1821 bcs L05B3X | |
1822 lda ,s | |
1823 cmpa $01,x | |
1824 lbhi L05B3X if new one takes more blocks than old | |
1825 lda $01,s | |
1826 sta $02,x | |
1827 leas $02,s | |
1828 bra L0633 | |
1829 L061B ldd R$Y,x | |
1830 beq L0633 | |
1831 cmpd #$0003 | |
1832 lbgt IllArg | |
1833 bsr GetScrn point X to 3 byte screen descriptor | |
1834 lbeq IllArg | |
1835 clra | |
1836 rts | |
1837 | |
1838 * Displays screen | |
1839 Rt.DScrn bsr L061B | |
1840 bcs L063A | |
1841 L0633 stb <VD.DGBuf,u | |
1842 inc <VD.DFlag,u | |
1843 clrb | |
1844 L063A rts | |
1845 | |
1846 * Entry: B = screen 1-3 | |
1847 * Exit: X = ptr to screen entry | |
1848 *GetScrn pshs b,a | |
1849 * leax <VD.GBuff,u | |
1850 * lda #$03 | |
1851 * mul | |
1852 * leax b,x | |
1853 * puls pc,b,a | |
1854 GetScrn leax <VD.GBuff,U point X to screen descriptor table | |
1855 abx | |
1856 abx | |
1857 abx | |
1858 tst ,x is this screen valid? (0 = not) | |
1859 rts | |
1860 | |
1861 * Frees memory of screen allocated by SS.AScrn | |
1862 Rt.FScrn ldd R$Y,x | |
1863 lbeq IllArg | |
1864 cmpd #$03 | |
1865 lbhi IllArg | |
1866 cmpb <VD.DGBuf,u | |
1867 lbeq IllArg illegal arg if screen is being displayed | |
1868 bsr GetScrn point to buffer | |
1869 lbeq IllArg error if screen unallocated | |
1870 * Entry: X = pointer to screen table entry | |
1871 FreeBlks lda $01,x get number of blocks | |
1872 ldb ,x get starting block | |
1873 beq L066D branch if none | |
1874 pshs a else save count | |
1875 clra clear A | |
1876 sta ,x clear block # in entry | |
1877 tfr d,x put starting block # in X | |
1878 puls b get block numbers | |
1879 os9 F$DelRAM delete | |
1880 L066D rts and return | |
1881 | |
1882 ShowS cmpb #$03 no more than 3 graphics buffers | |
1883 bhi L066D | |
1884 bsr GetScrn point X to appropriate screen descriptor | |
1885 beq L066D branch if not allocated | |
1886 ldb $02,x VD.SType - screen type 0-4 | |
1887 cmpb #$04 | |
1888 bhi L066D | |
1889 lslb | |
1890 pshs x | |
1891 leax >DTabl,pcr | |
1892 lda b,x get proper display code | |
1893 puls x | |
1894 clrb | |
1895 std >$FF99 set border color, too | |
1896 std >D.VIDRS | |
1897 lda >D.HINIT | |
1898 anda #$7F make coco 3 only mode | |
1899 sta >D.HINIT | |
1900 sta >$FF90 | |
1901 lda >D.VIDMD | |
1902 ora #$80 graphics mode | |
1903 anda #$F8 1 line/character row | |
1904 sta >D.VIDMD | |
1905 sta >$FF98 | |
1906 * lda ,x get block # | |
1907 * lsla | |
1908 * lsla | |
1909 *** start of 2MB patch by RG | |
1910 ldb ,x get block # (2Meg patch) | |
1911 clra | |
1912 lslb | |
1913 rola | |
1914 lslb | |
1915 rola | |
1916 sta >$FF9B | |
1917 tfr b,a | |
1918 *** end of 2MB patch by RG | |
1919 clrb | |
1920 std <D.VOFF1 display it | |
1921 std >$FF9D | |
1922 clr >D.VOFF2 | |
1923 clr >$FF9C | |
1924 lbra SetPals | |
1925 | |
1926 * Get next free screen descriptor | |
1927 L06C7 clr ,-s clear an area on the stack | |
1928 inc ,s set to 1 | |
1929 L06CB tst ,y check block # | |
1930 beq L06D9 if not used yet | |
1931 leay b,y go to next screen descriptor | |
1932 inc ,s increment count on stack | |
1933 deca decrement A | |
1934 bne L06CB | |
1935 comb | |
1936 ldb #E$BMode | |
1937 L06D9 puls pc,a | |
1938 | |
1939 * Get B 8K blocks from high RAM | |
1940 Get8KHi ldb #$01 | |
1941 L06DDX os9 F$AlHRAM allocate a screen | |
1942 rts | |
1943 | |
1944 L06E1 lda #$01 map screen into memory | |
1945 L06E3 pshs u,x,b,a | |
1946 bsr L0710 | |
1947 bcc L06F9 | |
1948 clra | |
1949 ldb $01,s | |
1950 tfr d,x | |
1951 ldb ,s | |
1952 os9 F$MapBlk | |
1953 stb $01,s save error code if any | |
1954 tfr u,d | |
1955 bcs L06FD | |
1956 L06F9 leas $02,s destroy D on no error | |
1957 puls pc,u,x | |
1958 | |
1959 L06FD puls pc,u,x,b,a if error, then restore D | |
1960 | |
1961 L06FF pshs y,x,a deallocate screen | |
1962 bsr L0710 | |
1963 bcs L070E | |
1964 ldd #DAT.Free set memory to unused | |
1965 L0708 std ,x++ | |
1966 dec ,s | |
1967 bne L0708 | |
1968 L070E puls pc,y,x,a | |
1969 | |
1970 L0710 equ * | |
1971 IFNE H6309 | |
1972 pshs a | |
1973 lde #$08 | |
1974 ELSE | |
1975 pshs b,a | |
1976 lda #$08 number of blocks to check | |
1977 sta $01,s | |
1978 ENDC | |
1979 ldx <D.Proc | |
1980 leax <P$DATImg+$10,x to end of CoCo's DAT image map | |
1981 clra | |
1982 addb ,s | |
1983 decb | |
1984 L071F cmpd ,--x | |
1985 beq L072A | |
1986 IFNE H6309 | |
1987 dece | |
1988 ELSE | |
1989 dec $01,s | |
1990 ENDC | |
1991 bne L071F | |
1992 bra L0743 | |
1993 L072A equ * | |
1994 IFNE H6309 | |
1995 dece | |
1996 ELSE | |
1997 dec $01,s | |
1998 ENDC | |
1999 dec ,s | |
2000 beq L0738 | |
2001 decb | |
2002 cmpd ,--x | |
2003 beq L072A | |
2004 bra L0743 | |
2005 L0738 equ * | |
2006 IFNE H6309 | |
2007 tfr e,a | |
2008 ELSE | |
2009 lda $01,s get lowest block number found | |
2010 ENDC | |
2011 lsla | |
2012 lsla | |
2013 lsla | |
2014 lsla | |
2015 lsla multiply by 32 (convert to address) | |
2016 clrb clear carry | |
2017 IFNE H6309 | |
2018 puls b,pc | |
2019 L0743 puls a | |
2020 ELSE | |
2021 leas $02,s | |
2022 rts | |
2023 L0743 puls b,a | |
2024 ENDC | |
2025 comb | |
2026 ldb #E$BPAddr bad page address | |
2027 rts | |
2028 | |
2029 emod | |
2030 eom equ * | |
2031 end |