Mercurial > hg > Members > kono > nitros9-code
annotate level1/modules/ccio.asm @ 1587:5f18094d961d
kernel modules renamed to krn, updated makefiles, clock2_tc3 now clock2_cloud9...
author | boisy |
---|---|
date | Mon, 24 May 2004 14:51:21 +0000 |
parents | e26f7d2e40df |
children | 11f38ece79ef |
rev | line source |
---|---|
0 | 1 ******************************************************************** |
2 * CCIO - OS-9 Level One V2 CoCo I/O driver | |
3 * | |
4 * $Id$ | |
5 * | |
1340
63bfe1e5c5f4
Rodney added several additional codes that can be generated from the
boisy
parents:
1287
diff
changeset
|
6 * Edt/Rev YYYY/MM/DD Modified by |
63bfe1e5c5f4
Rodney added several additional codes that can be generated from the
boisy
parents:
1287
diff
changeset
|
7 * Comment |
0 | 8 * ------------------------------------------------------------------ |
1340
63bfe1e5c5f4
Rodney added several additional codes that can be generated from the
boisy
parents:
1287
diff
changeset
|
9 * 12 ????/??/?? ??? |
63bfe1e5c5f4
Rodney added several additional codes that can be generated from the
boisy
parents:
1287
diff
changeset
|
10 * From Tandy OS-9 Level One VR 02.00.00. |
63bfe1e5c5f4
Rodney added several additional codes that can be generated from the
boisy
parents:
1287
diff
changeset
|
11 * |
63bfe1e5c5f4
Rodney added several additional codes that can be generated from the
boisy
parents:
1287
diff
changeset
|
12 * 12r1 2003/09/11 Rodney V. Hamilton |
63bfe1e5c5f4
Rodney added several additional codes that can be generated from the
boisy
parents:
1287
diff
changeset
|
13 * Modified key table to include $7F, $1D, $1E and $1F codes. |
0 | 14 |
15 nam CCIO | |
16 ttl OS-9 Level One V2 CoCo I/O driver | |
17 | |
18 ifp1 | |
19 use defsfile | |
20 use scfdefs | |
1583 | 21 use cciodefs |
0 | 22 endc |
23 | |
24 tylg set Drivr+Objct | |
25 atrv set ReEnt+rev | |
1340
63bfe1e5c5f4
Rodney added several additional codes that can be generated from the
boisy
parents:
1287
diff
changeset
|
26 rev set $01 |
201 | 27 edition set 12 |
0 | 28 |
29 mod eom,name,tylg,atrv,start,size | |
30 | |
1585 | 31 size equ V.Last |
0 | 32 |
256 | 33 fcb UPDAT.+EXEC. |
0 | 34 |
35 name fcs /CCIO/ | |
36 fcb edition | |
37 | |
38 start lbra Init | |
39 lbra Read | |
40 lbra Write | |
41 lbra GetStat | |
42 lbra SetStat | |
43 lbra Term | |
44 | |
45 * Init | |
46 * | |
47 * Entry: | |
48 * Y = address of device descriptor | |
49 * U = address of device memory area | |
50 * | |
51 * Exit: | |
52 * CC = carry set on error | |
53 * B = error code | |
54 * | |
1586 | 55 Init stu >D.KbdSta store devmem ptr |
56 clra clear A | |
57 leax <V.SCF,u point to memory after V.SCF | |
58 ldb #$5D get counter | |
59 L002E sta ,x+ clear mem | |
60 decb decrement counter | |
61 bne L002E continue if more | |
62 coma A = $FF | |
63 comb B = $FF | |
1585 | 64 stb <V.Caps,u |
65 std <V.LKeyCd,u | |
66 std <V.2Key2,u | |
1583 | 67 lda #60 |
1585 | 68 sta <V.ClkCnt,u |
1586 | 69 leax >AltIRQ,pcr get IRQ routine ptr |
70 stx >D.AltIRQ store in AltIRQ | |
71 leax >SetDsply,pcr get display vector | |
72 stx <V.DspVct,u store in vector address | |
73 leax >XY2Addr,pcr get address of XY2Addr | |
1585 | 74 stx <V.CnvVct,u |
1586 | 75 ldd <IT.PAR,y get parity and baud |
76 lbra L05CE process them | |
0 | 77 |
78 * Term | |
79 * | |
80 * Entry: | |
81 * U = address of device memory area | |
82 * | |
83 * Exit: | |
84 * CC = carry set on error | |
85 * B = error code | |
86 * | |
87 Term pshs cc | |
307 | 88 orcc #IRQMask mask interrupts |
89 ldx >D.Clock get clock vector | |
90 stx >D.AltIRQ and put back in AltIRQ | |
0 | 91 puls pc,cc |
92 | |
93 * Read | |
94 * | |
95 * Entry: | |
96 * Y = address of path descriptor | |
97 * U = address of device memory area | |
98 * | |
99 * Exit: | |
100 * A = character read | |
101 * CC = carry set on error | |
102 * B = error code | |
103 * | |
1585 | 104 Read leax <V.InBuf,u point X to input buffer |
105 ldb <V.IBufT,u get tail pointer | |
307 | 106 orcc #IRQMask mask IRQ |
1585 | 107 cmpb <V.IBufH,u same as head pointer |
307 | 108 beq Put2Bed if so, buffer is empty, branch to sleep |
109 abx X now points to curr char | |
110 lda ,x get char | |
1582 | 111 bsr L009D check for tail wrap |
1585 | 112 stb <V.IBufT,u store updated tail |
307 | 113 andcc #^(IRQMask+Carry) unmask IRQ |
0 | 114 rts |
307 | 115 |
116 Put2Bed lda V.BUSY,u get calling process ID | |
117 sta V.WAKE,u store in V.WAKE | |
118 andcc #^IRQMask clear interrupts | |
0 | 119 ldx #$0000 |
307 | 120 os9 F$Sleep sleep forever |
121 clr V.WAKE,u clear wake | |
122 ldx <D.Proc get pointer to current proc desc | |
123 ldb <P$Signal,x get signal recvd | |
124 beq Read branch if no signal | |
125 cmpb #S$Window window signal? | |
126 bcc Read branch if so | |
0 | 127 coma |
128 rts | |
1582 | 129 * Check if we need to wrap around tail pointer to zero |
1584 | 130 L009D incb increment pointer |
131 cmpb #$7F at end? | |
132 bls L00A3 branch if not | |
133 clrb else clear pointer (wrap to head) | |
0 | 134 L00A3 rts |
135 | |
1583 | 136 * |
307 | 137 * IRQ routine for keyboard |
1583 | 138 * |
307 | 139 AltIRQ ldu >D.KbdSta get keyboard static |
1585 | 140 ldb <V.CFlg1,u graphics screen currently being displayed? |
1584 | 141 beq L00B7 branch if not |
1585 | 142 ldb <V.Alpha,u alpha mode? |
1584 | 143 beq L00B7 branch if so |
1585 | 144 lda <V.PIA1,u |
1584 | 145 lbsr SetDsply set up display |
146 L00B7 ldx #PIA0Base point to PIA base | |
0 | 147 clra |
148 clrb | |
1585 | 149 std <V.KySns,u clear keysense byte |
150 bsr L00E8 get bits | |
0 | 151 bne L00CC |
1585 | 152 clr $02,x clear PIA0Base+2 |
307 | 153 lda ,x get byte from PIA |
154 coma complement | |
155 anda #$7F strip off hi bit | |
156 bne L00F1 branch if any bit set | |
0 | 157 L00CC clra |
158 clrb | |
1585 | 159 std <V.KTblLC,u clear |
307 | 160 coma A = $FF |
1585 | 161 tst <V.Spcl,u special key? |
162 bne l@ branch if so | |
163 sta <V.LKeyCd,u | |
164 l@ stb <V.Spcl,u clear for next time | |
0 | 165 comb |
1585 | 166 sta <V.2Key1,u |
167 std <V.2Key2,u | |
1583 | 168 L00E4 jmp [>D.Clock] jump into clock module |
1585 | 169 |
0 | 170 L00E8 comb |
1585 | 171 stb $02,x strobe one column |
172 ldb ,x read PIA #0 row states | |
173 comb invert bits so 1=key pressed | |
174 andb #$03 mask out all but lower 2 bits | |
0 | 175 rts |
307 | 176 |
0 | 177 L00F1 bsr L015C |
178 bmi L00CC | |
179 clrb | |
180 bsr L00E8 | |
181 bne L00CC | |
1585 | 182 cmpa <V.6F,u |
0 | 183 bne L010E |
1585 | 184 ldb <V.ClkCnt,u |
0 | 185 beq L010A |
186 decb | |
1585 | 187 L0105 stb <V.ClkCnt,u |
0 | 188 bra L00E4 |
189 L010A ldb #$05 | |
190 bra L011A | |
1585 | 191 L010E sta <V.6F,u |
0 | 192 ldb #$05 |
1585 | 193 tst <V.KySame,u |
0 | 194 bne L0105 |
1583 | 195 ldb #60 |
1585 | 196 L011A stb <V.ClkCnt,u |
197 ldb <V.IBufH,u get head pointer in B | |
198 leax <V.InBuf,u point X to input buffer | |
1584 | 199 abx X now holds address of head |
1582 | 200 lbsr L009D check for tail wrap |
1585 | 201 cmpb <V.IBufT,u B at tail? |
1584 | 202 beq L012F branch if so |
1585 | 203 stb <V.IBufH,u |
1584 | 204 L012F sta ,x store our char at ,X |
205 beq WakeIt if nul, do wake-up | |
206 cmpa V.PCHR,u pause character? | |
207 bne L013F branch if not | |
208 ldx V.DEV2,u else get dev2 statics | |
209 beq WakeIt branch if none | |
210 sta V.PAUS,x else set pause request | |
211 bra WakeIt | |
212 L013F ldb #S$Intrpt get interrupt signal | |
213 cmpa V.INTR,u our char same as intr? | |
214 beq L014B branch if same | |
215 ldb #S$Abort get abort signal | |
216 cmpa V.QUIT,u our char same as QUIT? | |
217 bne WakeIt branch if not | |
218 L014B lda V.LPRC,u get ID of last process to get this device | |
219 bra L0153 go for it | |
220 WakeIt ldb #S$Wake get wake signal | |
221 lda V.WAKE,u get process to wake | |
222 L0153 beq L0158 branch if none | |
223 os9 F$Send else send wakeup signal | |
224 L0158 clr V.WAKE,u clear process to wake flag | |
225 bra L00E4 and move along | |
226 | |
0 | 227 L015C clra |
228 clrb | |
1586 | 229 std <V.ShftDn,u SHIFT/CTRL flag; 0=NO $FF=YES |
1585 | 230 std <V.KeyFlg,u |
231 * %00000111-Column # (Output, 0-7) | |
232 * %00111000-Row # (Input, 0-6) | |
0 | 233 coma |
234 comb | |
1585 | 235 std <V.Key1,u key 1&2 flags $FF=none |
236 sta <V.Key3,u key 3 " | |
237 deca lda #%11111110 | |
238 sta $02,x write column strobe | |
239 L016F lda ,x read row from PIA0Base | |
240 coma invert so 1=key pressed | |
241 anda #$7F keep only keys, bit 0=off 1=on | |
242 beq L0183 no keys pressed, try next column | |
243 ldb #$FF preset counter to -1 | |
0 | 244 L0178 incb |
1585 | 245 lsra bit test regA |
246 bcc L017F no key, brach | |
247 lbsr L0221 convert column/row to matrix value and store | |
248 L017F cmpb #$06 max counter | |
249 bcs L0178 loop if more bits to test | |
250 L0183 inc <V.KeyFlg,u counter; used here for column | |
251 orcc #Carry bit marker; disable strobe | |
252 rol $02,x shift to next column | |
253 bcs L016F not finished with columns so loop | |
254 lbsr L0289 simultaneous check; recover key matrix value | |
255 bmi L020A invalid so go | |
256 cmpa <V.LKeyCd,u last keyboard code | |
0 | 257 bne L0199 |
1585 | 258 inc <V.KySame,u same key flag ?counter? |
259 L0199 sta <V.LKeyCd,u setup for last key pressed | |
260 beq L01B9 if @ key, use lookup table | |
261 suba #$1A the key value (matrix) of Z | |
262 bhi L01B9 not a letter, so go | |
263 adda #$1A restore regA | |
264 ldb <V.CtrlDn,u CTRL flag | |
265 bne L01E9 CTRL is down so go | |
266 adda #$40 convert to ASCII value; all caps | |
267 ldb <V.ShftDn,u shift key flag | |
268 eorb <V.Caps,u get current device static memory pointer | |
269 andb #$01 tet caps flag | |
270 bne L01E9 not shifted so go | |
271 adda #$20 convert to ASCII lowercase | |
0 | 272 bra L01E9 |
1585 | 273 * Not a letter key, use the special keycode lookup table |
274 * Entry: A = table idnex (matrix scancode-26) | |
275 L01B9 ldb #$03 three entries per key (normal, SHIFT, CTRL) | |
276 mul convert index to table offset | |
277 lda <V.ShftDn,u shift key flag | |
278 beq L01C4 not shifted so go | |
279 incb else adjust offset for SHIFTed entry | |
280 bra L01CB and do it | |
281 L01C4 lda <V.CtrlDn,u CTRL flag? | |
282 beq L01CB adjust offset for CTRL key | |
0 | 283 addb #$02 |
1585 | 284 L01CB lda <V.KySnsF,u key sense flag? |
285 beq L01D4 not set, so go | |
286 cmpb #$11 spacebar? | |
287 ble L0208 must be an arrow so go | |
288 L01D4 cmpb #$4C ALT key? (SHOULD BE $4C???) | |
289 blt L01DD not ALT, CTRL, F1, F2 or SHIFT so go | |
290 inc <V.AltDwn,u flag special keys (ALT, CTRL) | |
291 subb #$06 adjust offset to skip them | |
292 L01DD pshs x save X | |
293 leax >KeyTbl,pcr point to keyboard table | |
0 | 294 lda b,x |
295 puls x | |
1585 | 296 bmi L01FD if A = $81 - $84, special key |
297 * several entries to this routine from any key press; A is already ASCII | |
298 L01E9 ldb <V.AltDwn,u was ALT flagged? | |
299 beq L01FA no, so go | |
300 cmpa #$3F ? | |
301 bls L01F8 # or code | |
302 cmpa #$5B [ | |
303 bcc L01F8 capital letter so go | |
304 ora #$20 convert to lower case | |
305 L01F8 ora #$80 set for ALT characters | |
306 L01FA andcc #^Negative not negative | |
0 | 307 rts |
1585 | 308 * Flag that special key was hit |
309 L01FD inc <V.Spcl,u | |
310 ldb <V.KySame,u | |
0 | 311 bne L0208 |
1585 | 312 com <V.Caps,u |
313 L0208 orcc #Negative set negative | |
0 | 314 L020A rts |
1584 | 315 |
1585 | 316 * Calculate arrow keys for key sense byte |
317 L020B pshs b,a convert column into power of 2 | |
0 | 318 clrb |
319 orcc #Carry | |
320 inca | |
321 L0211 rolb | |
322 deca | |
323 bne L0211 | |
324 bra L0219 | |
325 L0217 pshs b,a | |
1585 | 326 L0219 orb <V.KySns,u previous value of column |
327 stb <V.KySns,u | |
0 | 328 puls pc,b,a |
1585 | 329 * Check special keys (SHIFT, CTRL, ALT) |
0 | 330 L0221 pshs b,a |
1585 | 331 cmpb #$03 is it row 3? |
0 | 332 bne L0230 |
1585 | 333 lda <V.KeyFlg,u get column # |
334 cmpa #$03 is it column 3?; ie up arrow | |
335 blt L0230 if lt it must be a letter | |
336 bsr L020B its a non letter so bsr | |
337 L0230 lslb B*8 8 keys per row | |
0 | 338 lslb |
339 lslb | |
1585 | 340 addb <V.KeyFlg,u add in the column # |
0 | 341 beq L025D |
1585 | 342 cmpb #$33 ALT |
0 | 343 bne L0243 |
1585 | 344 inc <V.AltDwn,u ALT down flag |
0 | 345 ldb #$04 |
346 bra L0219 | |
1585 | 347 L0243 cmpb #$31 CLEAR? |
0 | 348 beq L024B |
1585 | 349 cmpb #$34 CTRL? |
0 | 350 bne L0252 |
1585 | 351 L024B inc <V.CtrlDn,u CTRL down flag |
0 | 352 ldb #$02 |
353 bra L0219 | |
1585 | 354 L0252 cmpb #$37 SHIFT key |
0 | 355 bne L0262 |
1585 | 356 com <V.ShftDn,u SHIFT down flag |
0 | 357 ldb #$01 |
358 bra L0219 | |
359 L025D ldb #$04 | |
360 bsr L0217 | |
361 clrb | |
1585 | 362 * Check how many key (1-3) are currently being pressed |
0 | 363 L0262 pshs x |
1585 | 364 leax <V.Key1,u 1st key table |
0 | 365 bsr L026D |
366 puls x | |
367 puls pc,b,a | |
368 L026D pshs a | |
369 lda ,x | |
370 bpl L0279 | |
371 stb ,x | |
372 ldb #$01 | |
373 puls pc,a | |
374 L0279 lda $01,x | |
375 bpl L0283 | |
376 stb $01,x | |
377 ldb #$02 | |
378 puls pc,a | |
379 L0283 stb $02,x | |
380 ldb #$03 | |
381 puls pc,a | |
1585 | 382 * simultaneous key test |
0 | 383 L0289 pshs y,x,b |
384 bsr L02EE | |
1585 | 385 ldb <V.KTblLC,u key table entry # |
0 | 386 beq L02C5 |
1585 | 387 leax <V.2Key1,u point to 2nd key table |
0 | 388 pshs b |
1585 | 389 L0297 leay <V.Key1,u 1st key table |
0 | 390 ldb #$03 |
1585 | 391 lda ,x get key #1 |
392 bmi L02B6 go if invalid? (no key) | |
393 L02A0 cmpa ,y is it a match? | |
394 bne L02AA go if not a matched key | |
0 | 395 clr ,y |
1585 | 396 com ,y set value to $FF |
0 | 397 bra L02B6 |
398 L02AA leay $01,y | |
399 decb | |
400 bne L02A0 | |
401 lda #$FF | |
402 sta ,x | |
1585 | 403 dec <V.KTblLC,u key table entry # |
0 | 404 L02B6 leax $01,x |
1585 | 405 dec ,s column counter |
0 | 406 bne L0297 |
407 leas $01,s | |
1585 | 408 ldb <V.KTblLC,u key table entry (can test for 3 simul keys) |
0 | 409 beq L02C5 |
410 bsr L0309 | |
1585 | 411 L02C5 leax <V.Key1,u 1st key table |
0 | 412 lda #$03 |
413 L02CA ldb ,x+ | |
414 bpl L02DE | |
415 deca | |
416 bne L02CA | |
1585 | 417 ldb <V.KTblLC,u key table entry (can test for 3 simul keys) |
0 | 418 beq L02EA |
419 decb | |
1585 | 420 leax <V.2Key1,u 2nd key table |
0 | 421 lda b,x |
422 bra L02E8 | |
423 L02DE tfr b,a | |
1585 | 424 leax <V.2Key1,u 2nd key table |
0 | 425 bsr L026D |
1585 | 426 stb <V.KTblLC,u |
0 | 427 L02E8 puls pc,y,x,b |
1585 | 428 L02EA orcc #Negative flag negative |
0 | 429 puls pc,y,x,b |
1585 | 430 |
431 L02EE ldd <V.ShftDn,u | |
0 | 432 bne L0301 |
433 lda #$03 | |
1585 | 434 leax <V.Key1,u |
0 | 435 L02F8 ldb ,x |
436 beq L0302 | |
437 leax $01,x | |
438 deca | |
439 bne L02F8 | |
440 L0301 rts | |
441 L0302 comb | |
442 stb ,x | |
1585 | 443 inc <V.AltDwn,u |
0 | 444 rts |
1585 | 445 |
446 * Sort 3 byte packet @ G.2Key1 according to sign of each byte | |
447 * so that positive #'s are at beginning & negative #'s at end | |
448 L0309 leax <V.2Key1,u 2nd key table | |
449 bsr L0314 sort bytes 1 & 2 | |
0 | 450 leax $01,x |
1585 | 451 bsr L0314 sort bytes 2 & 3 |
452 leax -$01,x sort 1 & 2 again (fall thru for third pass) | |
453 L0314 lda ,x get current byte | |
454 bpl L0320 positive - no swap | |
455 ldb $01,x get next byte | |
456 bmi L0320 negative - no swap | |
457 sta $01,x swap the bytes | |
0 | 458 stb ,x |
459 L0320 rts | |
460 | |
1584 | 461 * Key Table |
462 * 1st column = key (no modifier) | |
463 * 2nd column = SHIFT+key | |
464 * 3rd column = CTRL+key | |
465 KeyTbl fcb $00,$40,$60 ALT @ ` | |
1340
63bfe1e5c5f4
Rodney added several additional codes that can be generated from the
boisy
parents:
1287
diff
changeset
|
466 fcb $0c,$1c,$13 UP |
63bfe1e5c5f4
Rodney added several additional codes that can be generated from the
boisy
parents:
1287
diff
changeset
|
467 fcb $0a,$1a,$12 DOWN |
63bfe1e5c5f4
Rodney added several additional codes that can be generated from the
boisy
parents:
1287
diff
changeset
|
468 fcb $08,$18,$10 LEFT |
63bfe1e5c5f4
Rodney added several additional codes that can be generated from the
boisy
parents:
1287
diff
changeset
|
469 fcb $09,$19,$11 RIGHT |
63bfe1e5c5f4
Rodney added several additional codes that can be generated from the
boisy
parents:
1287
diff
changeset
|
470 fcb $20,$20,$20 SPACEBAR |
63bfe1e5c5f4
Rodney added several additional codes that can be generated from the
boisy
parents:
1287
diff
changeset
|
471 fcb $30,$30,$81 0 0 capslock |
63bfe1e5c5f4
Rodney added several additional codes that can be generated from the
boisy
parents:
1287
diff
changeset
|
472 fcb $31,$21,$7c 1 ! | |
63bfe1e5c5f4
Rodney added several additional codes that can be generated from the
boisy
parents:
1287
diff
changeset
|
473 fcb $32,$22,$00 2 " null |
63bfe1e5c5f4
Rodney added several additional codes that can be generated from the
boisy
parents:
1287
diff
changeset
|
474 fcb $33,$23,$7e 3 # ~ |
63bfe1e5c5f4
Rodney added several additional codes that can be generated from the
boisy
parents:
1287
diff
changeset
|
475 fcb $34,$24,$1d 4 $ RS (was null) |
63bfe1e5c5f4
Rodney added several additional codes that can be generated from the
boisy
parents:
1287
diff
changeset
|
476 fcb $35,$25,$1e 5 % GS (was null) |
63bfe1e5c5f4
Rodney added several additional codes that can be generated from the
boisy
parents:
1287
diff
changeset
|
477 fcb $36,$26,$1f 6 & US (was null) |
63bfe1e5c5f4
Rodney added several additional codes that can be generated from the
boisy
parents:
1287
diff
changeset
|
478 fcb $37,$27,$5e 7 ' ^ |
63bfe1e5c5f4
Rodney added several additional codes that can be generated from the
boisy
parents:
1287
diff
changeset
|
479 fcb $38,$28,$5b 8 ( [ |
63bfe1e5c5f4
Rodney added several additional codes that can be generated from the
boisy
parents:
1287
diff
changeset
|
480 fcb $39,$29,$5d 9 ) ] |
63bfe1e5c5f4
Rodney added several additional codes that can be generated from the
boisy
parents:
1287
diff
changeset
|
481 fcb $3a,$2a,$00 : * null |
63bfe1e5c5f4
Rodney added several additional codes that can be generated from the
boisy
parents:
1287
diff
changeset
|
482 fcb $3b,$2b,$7f ; + del (was null) |
63bfe1e5c5f4
Rodney added several additional codes that can be generated from the
boisy
parents:
1287
diff
changeset
|
483 fcb $2c,$3c,$7b , < { |
63bfe1e5c5f4
Rodney added several additional codes that can be generated from the
boisy
parents:
1287
diff
changeset
|
484 fcb $2d,$3d,$5f - = _ |
63bfe1e5c5f4
Rodney added several additional codes that can be generated from the
boisy
parents:
1287
diff
changeset
|
485 fcb $2e,$3e,$7d . > } |
63bfe1e5c5f4
Rodney added several additional codes that can be generated from the
boisy
parents:
1287
diff
changeset
|
486 fcb $2f,$3f,$5c / ? \ |
63bfe1e5c5f4
Rodney added several additional codes that can be generated from the
boisy
parents:
1287
diff
changeset
|
487 fcb $0d,$0d,$0d ENTER key |
63bfe1e5c5f4
Rodney added several additional codes that can be generated from the
boisy
parents:
1287
diff
changeset
|
488 fcb $00,$00,$00 CLEAR key |
63bfe1e5c5f4
Rodney added several additional codes that can be generated from the
boisy
parents:
1287
diff
changeset
|
489 fcb $05,$03,$1b BREAK key |
63bfe1e5c5f4
Rodney added several additional codes that can be generated from the
boisy
parents:
1287
diff
changeset
|
490 fcb $31,$33,$35 F1 key |
63bfe1e5c5f4
Rodney added several additional codes that can be generated from the
boisy
parents:
1287
diff
changeset
|
491 fcb $32,$34,$36 F2 key |
0 | 492 |
493 * Write | |
494 * | |
495 * Entry: | |
496 * A = character to write | |
497 * Y = address of path descriptor | |
498 * U = address of device memory area | |
499 * | |
500 * Exit: | |
501 * CC = carry set on error | |
502 * B = error code | |
503 * | |
1585 | 504 Write ldb <V.NGChr,u are we in the process of getting parameters? |
1583 | 505 bne PrmHandl yes, go process |
1585 | 506 sta <V.WrChr,u save character to write |
1582 | 507 cmpa #C$SPAC space or higher? |
508 bcc GoCo yes, normal write | |
509 cmpa #$1E escape sequence $1E or $1F? | |
1583 | 510 bcc Escape yes, go process |
511 cmpa #$0F GFX codes? | |
512 lbcc GfxDispatch branch if so | |
1582 | 513 cmpa #C$BELL bell? |
514 lbeq Ding if so, ring bell | |
1583 | 515 * Here we call the CO-module to write the character |
1585 | 516 GoCo lda <V.CurCo,u get CO32/CO80 flag |
1582 | 517 CoWrite ldb #$03 we want to write |
1585 | 518 CallCO leax <V.GRFOE,u get base pointer to CO-entries |
1582 | 519 ldx a,x get pointer to CO32/CO80 |
307 | 520 beq NoIOMod branch if no module |
1585 | 521 lda <V.WrChr,u get character to write |
307 | 522 L039D jmp b,x call i/o subroutine |
523 NoIOMod comb | |
524 ldb #E$MNF | |
0 | 525 rts |
307 | 526 |
1582 | 527 * Parameter handler |
1583 | 528 PrmHandl cmpb #$02 two parameters left? |
1582 | 529 beq L03B0 branch if so |
1585 | 530 sta <V.NChr2,u else store in V.NChr2 |
531 clr <V.NGChr,u clear parameter counter | |
532 jmp [<V.RTAdd,u] jump to return address | |
533 L03B0 sta <V.NChar,u store in V.NChar | |
534 dec <V.NGChr,u decrement parameter counter | |
0 | 535 clrb |
536 rts | |
1582 | 537 |
1583 | 538 Escape beq L03C5 if $1E, we conveniently ignore it |
539 leax <COEscape,pcr else it's $1F... set up to get next char | |
0 | 540 L03BD ldb #$01 |
1585 | 541 L03BF stx <V.RTAdd,u |
542 stb <V.NGChr,u | |
0 | 543 L03C5 clrb |
544 rts | |
1582 | 545 |
1583 | 546 COEscape ldb #$03 write offset into CO-module |
547 lbra JmpCO | |
1582 | 548 |
1584 | 549 * Show VDG or Graphics screen |
550 * Entry: B = 0 for VDG, 1 for Graphics | |
551 SetDsply pshs x,a | |
1585 | 552 stb <V.Alpha,u save passed flag in B |
1213
4e235f213651
Lots of changes: bootscripts and bootlists added, sources massaged...
boisy
parents:
317
diff
changeset
|
553 lda >PIA1Base+2 |
1584 | 554 anda #$07 mask out all but lower 3 bits |
555 ora ,s+ OR in passed A | |
556 tstb display graphics? | |
557 bne L03DE branch if so | |
1585 | 558 ora <V.CFlag,u |
1213
4e235f213651
Lots of changes: bootscripts and bootlists added, sources massaged...
boisy
parents:
317
diff
changeset
|
559 L03DE sta >PIA1Base+2 |
1585 | 560 sta <V.PIA1,u |
1584 | 561 tstb display graphics? |
562 bne DoGfx branch if so | |
563 * Set up VDG screen for text | |
564 DoVDG | |
0 | 565 stb >$FFC0 |
566 stb >$FFC2 | |
567 stb >$FFC4 | |
1586 | 568 lda <V.ScrnA,u get pointer to alpha screen |
0 | 569 bra L0401 |
1583 | 570 |
1584 | 571 * Set up VDG screen for graphics |
572 DoGfx stb >$FFC0 | |
0 | 573 stb >$FFC3 |
574 stb >$FFC5 | |
1586 | 575 lda <V.SBAdd,u get pointer to graphics screen |
1584 | 576 |
0 | 577 L0401 ldb #$07 |
578 ldx #$FFC6 | |
579 lsra | |
580 L0407 lsra | |
581 bcs L0410 | |
582 sta ,x+ | |
583 leax $01,x | |
584 bra L0414 | |
585 L0410 leax $01,x | |
586 sta ,x+ | |
587 L0414 decb | |
588 bne L0407 | |
589 clrb | |
590 puls pc,x | |
164 | 591 |
592 GRFO fcs /GRFO/ | |
593 CO32 fcs /CO32/ | |
594 CO80 fcs /CO80/ | |
0 | 595 |
596 * GetStat | |
597 * | |
598 * Entry: | |
599 * A = function code | |
600 * Y = address of path descriptor | |
601 * U = address of device memory area | |
602 * | |
603 * Exit: | |
604 * CC = carry set on error | |
605 * B = error code | |
606 * | |
1585 | 607 GetStat sta <V.WrChr,u save off stat code |
608 cmpa #SS.Ready ready call? | |
609 bne L0439 branch if not | |
610 lda <V.IBufT,u get buff tail ptr | |
611 suba <V.IBufH,u num of chars ready in A | |
612 lbeq NotReady branch if empty | |
307 | 613 SSEOF clrb |
0 | 614 rts |
1585 | 615 L0439 cmpa #SS.EOF EOF? |
616 beq SSEOF branch if so | |
617 ldx PD.RGS,y get caller's regs | |
618 cmpa #SS.Joy joystick? | |
619 beq SSJOY branch if so | |
620 cmpa #SS.ScSiz screen size? | |
621 beq SSSCSIZ branch if so | |
622 cmpa #SS.KySns keyboard sense? | |
623 beq SSKYSNS branch if so | |
624 cmpa #SS.DStat display status? | |
625 lbeq SSDSTAT branch if so | |
1583 | 626 ldb #$06 getstat entry into CO-module |
627 lbra JmpCO | |
164 | 628 |
1585 | 629 * Return key sense information |
1586 | 630 SSKYSNS ldb <V.KySns,u get key sense info |
307 | 631 stb R$A,x put in caller's A |
0 | 632 clrb |
633 rts | |
164 | 634 |
1585 | 635 * Return screen size |
636 SSSCSIZ clra clear upper 8 bits of D | |
637 ldb <V.Col,u get column count | |
638 std R$X,x save in X | |
639 ldb <V.Row,u get row count | |
640 std R$Y,x save in Y | |
641 clrb no error | |
0 | 642 rts |
164 | 643 |
307 | 644 * Get joytsick values |
164 | 645 SSJOY pshs y,cc |
307 | 646 orcc #IRQMask mask interrupts |
0 | 647 lda #$FF |
1213
4e235f213651
Lots of changes: bootscripts and bootlists added, sources massaged...
boisy
parents:
317
diff
changeset
|
648 sta >PIA0Base+2 |
4e235f213651
Lots of changes: bootscripts and bootlists added, sources massaged...
boisy
parents:
317
diff
changeset
|
649 ldb >PIA0Base |
307 | 650 ldy R$X,x get joystick number to poll |
0 | 651 bne L0481 |
652 andb #$01 | |
653 bne L0485 | |
654 bra L0486 | |
655 L0481 andb #$02 | |
656 beq L0486 | |
657 L0485 clra | |
307 | 658 L0486 sta R$A,x |
1213
4e235f213651
Lots of changes: bootscripts and bootlists added, sources massaged...
boisy
parents:
317
diff
changeset
|
659 lda >PIA0Base+3 |
0 | 660 ora #$08 |
307 | 661 ldy R$X,x |
0 | 662 bne L0494 |
663 anda #$F7 | |
1213
4e235f213651
Lots of changes: bootscripts and bootlists added, sources massaged...
boisy
parents:
317
diff
changeset
|
664 L0494 sta >PIA0Base+3 |
4e235f213651
Lots of changes: bootscripts and bootlists added, sources massaged...
boisy
parents:
317
diff
changeset
|
665 lda >PIA0Base+1 |
0 | 666 anda #$F7 |
667 bsr L04B3 | |
307 | 668 std R$X,x |
1213
4e235f213651
Lots of changes: bootscripts and bootlists added, sources massaged...
boisy
parents:
317
diff
changeset
|
669 lda >PIA0Base+1 |
0 | 670 ora #$08 |
671 bsr L04B3 | |
672 pshs b,a | |
1585 | 673 ldd #63 |
0 | 674 subd ,s++ |
307 | 675 std R$Y,x |
0 | 676 clrb |
677 puls pc,y,cc | |
307 | 678 |
1213
4e235f213651
Lots of changes: bootscripts and bootlists added, sources massaged...
boisy
parents:
317
diff
changeset
|
679 L04B3 sta >PIA0Base+1 |
0 | 680 lda #$7F |
681 ldb #$40 | |
682 bra L04C7 | |
683 L04BC lsrb | |
684 cmpb #$01 | |
685 bhi L04C7 | |
686 lsra | |
687 lsra | |
688 tfr a,b | |
689 clra | |
690 rts | |
691 L04C7 pshs b | |
1213
4e235f213651
Lots of changes: bootscripts and bootlists added, sources massaged...
boisy
parents:
317
diff
changeset
|
692 sta >PIA1Base |
4e235f213651
Lots of changes: bootscripts and bootlists added, sources massaged...
boisy
parents:
317
diff
changeset
|
693 tst >PIA0Base |
0 | 694 bpl L04D5 |
695 adda ,s+ | |
696 bra L04BC | |
697 L04D5 suba ,s+ | |
698 bra L04BC | |
164 | 699 |
1585 | 700 * Return display status |
701 * Entry: A = path | |
702 * Exit: A = color code of pixel at cursor address | |
703 * X = address of graphics display memory | |
704 * Y = graphics cursor address; X = MSB, Y = LSB | |
705 SSDSTAT lbsr GfxActv gfx screen allocated? | |
706 bcs L050E branch if not | |
707 ldd <V.GCrsX,u else get X/Y gfx cursor position | |
708 bsr XY2Addr | |
0 | 709 tfr a,b |
710 andb ,x | |
711 L04E7 bita #$01 | |
712 bne L04F6 | |
1585 | 713 lsra divide D by 2 |
0 | 714 lsrb |
1585 | 715 tst <V.Mode,u which mode? |
716 bmi L04E7 branch if 256x192 | |
717 lsra else divide D by 2 again | |
0 | 718 lsrb |
719 bra L04E7 | |
720 L04F6 pshs b | |
1585 | 721 ldb <V.PMask,u get pixel color mask in B |
0 | 722 andb #$FC |
723 orb ,s+ | |
1585 | 724 ldx PD.RGS,y get caller's regs |
725 stb R$A,x place pixel color in A | |
726 ldd <V.GCrsX,u | |
727 std R$Y,x cursor X/Y pos in Y, | |
728 ldd <V.SBAdd,u | |
729 std R$X,x and screen addr in X | |
0 | 730 clrb |
731 L050E rts | |
1585 | 732 |
733 * Entry: A = X coor, B = Y coor | |
734 XY2Addr pshs y,b,a save off regs | |
735 ldb <V.Mode,u get video mode | |
736 bpl L0517 branch if 128x192 (divide A by 4) | |
737 lsra else divide by 8 | |
0 | 738 L0517 lsra |
739 lsra | |
1585 | 740 pshs a save on stack |
741 ldb #191 get max Y | |
742 subb $02,s sutract from Y on stack | |
743 lda #32 byte sper line | |
0 | 744 mul |
1585 | 745 addb ,s+ add offset on stack |
0 | 746 adca #$00 |
1585 | 747 ldy <V.SBAdd,u get base address |
748 leay d,y move D bytes into address | |
749 lda ,s pick up original X coor | |
750 sty ,s put offset addr on stack | |
751 anda <V.PixBt,u | |
752 ldx <V.MTabl,u | |
0 | 753 lda a,x |
1585 | 754 puls pc,y,x X = offset address, Y = base |
0 | 755 |
756 * SetStat | |
757 * | |
758 * Entry: | |
759 * A = function code | |
760 * Y = address of path descriptor | |
761 * U = address of device memory area | |
762 * | |
763 * Exit: | |
764 * CC = carry set on error | |
765 * B = error code | |
766 * | |
1586 | 767 SetStat sta <V.WrChr,u save function code |
768 ldx PD.RGS,y get caller's regs | |
164 | 769 cmpa #SS.ComSt |
770 lbeq SSCOMST | |
771 cmpa #SS.AAGBf | |
772 beq SSAAGBF | |
773 cmpa #SS.SLGBf | |
774 beq SSSLGBF | |
775 cmpa #SS.KySns | |
1582 | 776 bne CoGetStt |
1585 | 777 ldd R$X,x get caller's key sense set data |
778 beq L0558 branch if zero | |
779 ldb #$FF else set all bits | |
780 L0558 stb <V.KySnsF,u store value in KySnsFlag | |
0 | 781 L055B clrb |
782 L055C rts | |
1582 | 783 |
1585 | 784 CoGetStt ldb #$09 CO-module setstat |
1583 | 785 JmpCO pshs b |
1585 | 786 lda <V.CurCo,u get CO-module in use |
1583 | 787 lbsr CallCO |
0 | 788 puls a |
789 bcc L055B | |
1585 | 790 tst <V.GRFOE,u GRFO linked? |
0 | 791 beq L055C |
792 tfr a,b | |
1585 | 793 clra GRFO address offset in statics |
794 lbra CallCO call it | |
164 | 795 |
317
e6dcf1ac92b2
Modified ccio.asm for better comments, init.asm simplified
boisy
parents:
307
diff
changeset
|
796 * Reserve an additional graphics buffer (up to 2) |
1585 | 797 SSAAGBF ldb <V.Rdy,u was initial buffer allocated with $0F? |
1583 | 798 lbeq NotReady branch if not |
799 pshs b save buffer number | |
1585 | 800 leay <V.AGBuf,u point to additional graphics buffers |
1583 | 801 ldd ,y first entry empty? |
802 beq L058E branch if so | |
803 leay $02,y else move to next entry | |
804 inc ,s increment B on stack | |
805 ldd ,y second entry empty? | |
806 bne L059E if not, no room for more... error out | |
807 L058E lbsr GetMem allocate graphics buffer memory | |
808 bcs L05A1 branch if error | |
809 std ,y save new buffer pointer at ,Y | |
810 std R$X,x and in caller's X | |
317
e6dcf1ac92b2
Modified ccio.asm for better comments, init.asm simplified
boisy
parents:
307
diff
changeset
|
811 puls b get buffer number off stack |
e6dcf1ac92b2
Modified ccio.asm for better comments, init.asm simplified
boisy
parents:
307
diff
changeset
|
812 clra clear hi byte of D |
1583 | 813 std R$Y,x and put in caller's Y (buffer number) |
317
e6dcf1ac92b2
Modified ccio.asm for better comments, init.asm simplified
boisy
parents:
307
diff
changeset
|
814 clrb call is ok |
e6dcf1ac92b2
Modified ccio.asm for better comments, init.asm simplified
boisy
parents:
307
diff
changeset
|
815 rts and return |
0 | 816 L059E ldb #E$BMode |
817 coma | |
818 L05A1 puls pc,a | |
164 | 819 |
317
e6dcf1ac92b2
Modified ccio.asm for better comments, init.asm simplified
boisy
parents:
307
diff
changeset
|
820 * Select a graphics buffer |
1585 | 821 SSSLGBF ldb <V.Rdy,u was initial buffer allocated with $0F? |
1583 | 822 lbeq NotReady branch if not |
823 ldd R$Y,x else get buffer number from caller | |
317
e6dcf1ac92b2
Modified ccio.asm for better comments, init.asm simplified
boisy
parents:
307
diff
changeset
|
824 cmpd #$0002 compare against high |
e6dcf1ac92b2
Modified ccio.asm for better comments, init.asm simplified
boisy
parents:
307
diff
changeset
|
825 bhi BadMode branch if error |
1585 | 826 leay <V.GBuff,u point to base graphics buffer address |
317
e6dcf1ac92b2
Modified ccio.asm for better comments, init.asm simplified
boisy
parents:
307
diff
changeset
|
827 lslb multiply by 2 |
e6dcf1ac92b2
Modified ccio.asm for better comments, init.asm simplified
boisy
parents:
307
diff
changeset
|
828 ldd b,y get pointer |
e6dcf1ac92b2
Modified ccio.asm for better comments, init.asm simplified
boisy
parents:
307
diff
changeset
|
829 beq BadMode branch if error |
1585 | 830 std <V.SBAdd,u else save in current |
317
e6dcf1ac92b2
Modified ccio.asm for better comments, init.asm simplified
boisy
parents:
307
diff
changeset
|
831 ldd R$X,x get select flag |
e6dcf1ac92b2
Modified ccio.asm for better comments, init.asm simplified
boisy
parents:
307
diff
changeset
|
832 beq L05C3 if zero, do nothing |
e6dcf1ac92b2
Modified ccio.asm for better comments, init.asm simplified
boisy
parents:
307
diff
changeset
|
833 ldb #$01 else set display flag |
1585 | 834 L05C3 stb <V.CFlg1,u save display flag |
0 | 835 clrb |
836 rts | |
317
e6dcf1ac92b2
Modified ccio.asm for better comments, init.asm simplified
boisy
parents:
307
diff
changeset
|
837 BadMode comb |
0 | 838 ldb #E$BMode |
839 rts | |
840 | |
307 | 841 SSCOMST ldd R$Y,x Get caller's Y |
842 L05CE bita #$02 CO80? | |
843 bne GoCO80 branch if so | |
844 ldb #$10 assume true lower case TRUE | |
845 bita #$01 true lowercase bit set? | |
846 bne GoCO32 branch if so | |
847 clrb true lower case FALSE | |
1585 | 848 GoCO32 stb <V.CFlag,u save flag for later |
1582 | 849 lda #$02 CO32 is loaded bit |
307 | 850 ldx #$2010 32x16 |
0 | 851 pshs u,y,x,a |
164 | 852 leax >CO32,pcr |
0 | 853 bra L05F4 |
1582 | 854 GoCO80 lda #$04 'CO80 is loaded' bit |
307 | 855 ldx #$5018 80x24 |
0 | 856 pshs u,y,x,a |
164 | 857 leax >CO80,pcr |
1583 | 858 L05F4 bsr L0601 load CO-module if not already loaded |
0 | 859 puls u,y,x,a |
860 bcs L0600 | |
1585 | 861 stx <V.Col,u save screen size |
862 sta <V.CurCo,u current module in use? ($02=CO32, $04=C080) | |
0 | 863 L0600 rts |
1585 | 864 L0601 bita <V.COLoad,u module loaded? |
1582 | 865 beq L0608 branch if not |
866 L0606 clrb else clear carry | |
867 rts and return | |
0 | 868 L0608 pshs y,x,a |
307 | 869 lbsr LinkSub |
870 bcc L061F branch if link was successful | |
871 ldx $01,s get pointer to name on stack | |
0 | 872 pshs u |
307 | 873 os9 F$Load try to load subroutine I/O module |
0 | 874 puls u |
875 bcc L061F | |
876 puls y,x,a | |
307 | 877 lbra NoIOMod |
1585 | 878 L061F leax <V.GRFOE,u get base pointer to CO-entries |
307 | 879 lda ,s get A off stack |
1582 | 880 sty a,x save off CO32/CO80 entry point |
0 | 881 puls y,x,a |
1583 | 882 ldb #$00 CO-module init offset |
883 lbra CallCO call it | |
307 | 884 |
885 * Link to subroutine | |
886 LinkSub pshs u | |
0 | 887 lda #Systm+Objct |
888 os9 F$Link | |
889 puls pc,u | |
890 | |
1585 | 891 * 128x192 4 color pixel table |
892 Mode1Clr fdb $0055,$aaff | |
0 | 893 |
1583 | 894 GfxDispatch |
895 cmpa #$15 GRFO-handled code? | |
1582 | 896 bcc GoGrfo branch if so |
897 cmpa #$0F display graphics code? | |
898 beq Do0F branch if so | |
0 | 899 suba #$10 |
1585 | 900 bsr GfxActv check if first gfx screen was alloc'ed |
1583 | 901 bcs L0663 if not, return with error |
902 leax <gfxtbl,pcr else point to jump table | |
903 lsla multiply by two | |
904 ldd a,x get address of routine | |
905 jmp d,x jump to it | |
0 | 906 |
1583 | 907 * Jump table for graphics codes $10-$14 |
908 gfxtbl fdb Do10-gfxtbl $10 - Preset Screen | |
909 fdb Do11-gfxtbl $11 - Set Color | |
910 fdb Do12-gfxtbl $12 - End Graphics | |
911 fdb Do13-gfxtbl $13 - Erase Graphics | |
912 fdb Do14-gfxtbl $14 - Home Graphics Cursor | |
0 | 913 |
1585 | 914 GfxActv ldb <V.Rdy,u gfx screen allocated? |
915 bne L0606 branch if so | |
1583 | 916 NotReady comb |
0 | 917 ldb #E$NotRdy |
918 L0663 rts | |
1582 | 919 |
1585 | 920 GoGrfo bsr GfxActv |
0 | 921 bcs L0663 |
1585 | 922 ldx <V.GRFOE,u get GRFO entry point |
923 bne L0681 branch if not zero | |
924 pshs y,a else preserve regs | |
0 | 925 bne L067F |
1585 | 926 leax >GRFO,pcr get pointer to name string |
927 bsr LinkSub link to GRFO | |
928 bcc L067B branch if ok | |
929 puls pc,y,a else exit with error | |
930 L067B sty <V.GRFOE,u save module entry pointer | |
931 L067F puls y,a restore regs | |
932 L0681 clra A = GRFO address offset in statics | |
1582 | 933 lbra CoWrite |
934 | |
1583 | 935 * Allocate GFX mem -- we must allocate on a 512 byte page boundary |
1585 | 936 GetMem pshs u save static pointer |
937 ldd #6144+256 allocate graphics memory + 1 page | |
938 os9 F$SRqMem do it | |
939 bcc L0691 branch if ok | |
940 puls pc,u else return with error | |
941 L0691 tfr u,d move mem ptr to D | |
942 puls u restore statics | |
943 tfr a,b move high 8 bits to lower | |
944 bita #$01 odd page? | |
945 beq L069F branch if not | |
0 | 946 adda #$01 |
947 bra L06A1 | |
948 L069F addb #$18 | |
949 L06A1 pshs u,a | |
950 tfr b,a | |
951 clrb | |
952 tfr d,u | |
317
e6dcf1ac92b2
Modified ccio.asm for better comments, init.asm simplified
boisy
parents:
307
diff
changeset
|
953 ldd #256 |
1585 | 954 os9 F$SRtMem return page |
0 | 955 puls u,a |
1585 | 956 bcs L06B3 branch if error |
0 | 957 clrb |
958 L06B3 rts | |
1582 | 959 |
1583 | 960 * $0F - display graphics |
1582 | 961 Do0F leax <DispGfx,pcr |
0 | 962 ldb #$02 |
963 lbra L03BF | |
307 | 964 |
1585 | 965 DispGfx ldb <V.Rdy,u already allocated initial buffer? |
966 bne L06D1 branch if so | |
967 bsr GetMem else get graphics memory | |
968 bcs L06EF branch if error | |
969 std <V.SBAdd,u save memory | |
970 std <V.GBuff,u and GBuff | |
971 inc <V.Rdy,u ok, we're ready | |
972 lbsr EraseGfx clear gfx mem | |
973 L06D1 lda <V.NChr2,u get character after next | |
974 sta <V.PMask,u save color set (0-3) | |
975 anda #$03 mask out all but lower 2 bits | |
976 leax >Mode1Clr,pcr point to mask byte table | |
977 lda a,x get byte | |
978 sta <V.Msk1,u save mask byte here | |
979 sta <V.Msk2,u and here | |
980 lda <V.NChar,u get next char, mode byte (0-1) | |
981 cmpa #$01 compare against max | |
982 bls L06F0 branch if valid | |
0 | 983 comb |
1585 | 984 ldb #E$BMode else invalid mode specified, send error |
0 | 985 L06EF rts |
1582 | 986 |
1585 | 987 L06F0 tsta test user supplied mode byte |
988 beq L0710 branch if 256x192 | |
0 | 989 ldd #$C003 |
1585 | 990 std <V.MCol,u |
0 | 991 lda #$01 |
1585 | 992 sta <V.Mode,u 128x192 mode |
0 | 993 lda #$E0 |
1585 | 994 ldb <V.NChr2,u |
0 | 995 andb #$08 |
996 beq L0709 | |
997 lda #$F0 | |
998 L0709 ldb #$03 | |
999 leax <L0742,pcr | |
1000 bra L072D | |
1001 L0710 ldd #$8001 | |
1585 | 1002 std <V.MCol,u |
0 | 1003 lda #$FF |
1585 | 1004 tst <V.Msk1,u |
0 | 1005 beq L0723 |
1585 | 1006 sta <V.Msk1,u |
1007 sta <V.Msk2,u | |
1008 L0723 sta <V.Mode,u 256x192 mode | |
0 | 1009 lda #$F0 |
1010 ldb #$07 | |
1011 leax <L0746,pcr | |
1585 | 1012 L072D stb <V.PixBt,u |
1013 stx <V.MTabl,u | |
1014 ldb <V.NChr2,u | |
0 | 1015 andb #$04 |
1016 lslb | |
1017 pshs b | |
1018 ora ,s+ | |
1019 ldb #$01 | |
1585 | 1020 * Indicate screen is current |
1584 | 1021 lbra SetDsply |
0 | 1022 |
1023 L0742 fcb $c0,$30,$0c,$03 | |
1024 L0746 fcb $80,$40,$20,$10,$08,$04,$02,$01 | |
1582 | 1025 |
1585 | 1026 * $11 - set color |
1583 | 1027 Do11 leax <SetColor,pcr set up return address |
1028 lbra L03BD | |
0 | 1029 |
1585 | 1030 SetColor clr <V.NChar,u get next char |
1031 lda <V.Mode,u which mode? | |
1032 bmi L075F branch if 256x192 | |
1033 inc <V.NChar,u | |
1583 | 1034 L075F lbra L06D1 |
1035 | |
1585 | 1036 * $12 - end graphics |
1037 Do12 leax <V.GBuff,u point to first buffer | |
1583 | 1038 ldy #$0000 Y = 0 |
1039 ldb #$03 free 3 gfx screens max | |
1040 pshs u,b | |
317
e6dcf1ac92b2
Modified ccio.asm for better comments, init.asm simplified
boisy
parents:
307
diff
changeset
|
1041 L076D ldd #6144 size of graphics screen |
1583 | 1042 ldu ,x++ get address of graphics screen |
1043 beq L077A branch if zero | |
1044 sty -$02,x else clear entry | |
1045 os9 F$SRtMem and return memory | |
1046 L077A dec ,s decrement counter | |
1047 bgt L076D keep going if not end | |
1048 ldu ,x flood fill buffer? | |
1049 beq L0788 branch if not allocated | |
1050 ldd #512 else get size | |
1051 os9 F$SRtMem and free memory | |
1052 L0788 puls u,b restore regs | |
0 | 1053 clra |
1585 | 1054 sta <V.Rdy,u gfx mem no longer alloced |
1584 | 1055 lbra SetDsply |
1583 | 1056 |
1057 Do10 leax <Preset,pcr set up return address | |
0 | 1058 lbra L03BD |
1583 | 1059 |
1585 | 1060 * NOTE! Shouldn't this be lda <V.NChar,u ?? |
1061 Preset lda <V.NChr2,u get next char | |
1062 tst <V.Mode,u which mode? | |
1063 bpl L07A7 branch if 128x192 4 color | |
1064 ldb #$FF assume we will clear with $FF | |
1065 anda #$01 mask out all but 1 bit (2 colors) | |
1066 beq EraseGfx erase graphic screen with color $00 | |
1067 bra L07B2 else erase screen with color $FF | |
1068 L07A7 anda #$03 mask out all but 2 bits (4 colors) | |
1069 leax >Mode1Clr,pcr point to color table | |
1070 ldb a,x get appropriate byte | |
1071 bra L07B2 and start the clearing | |
1583 | 1072 |
1073 * Erase graphics screen | |
1074 Do13 | |
1586 | 1075 EraseGfx clrb value to clear screen with |
1585 | 1076 L07B2 ldx <V.SBAdd,u |
1586 | 1077 leax >6144+1,x point to end of gfx mem + 1 |
1078 L07B9 stb ,-x clear | |
1079 cmpx <V.SBAdd,u X = to start? | |
1080 bhi L07B9 if not, continue | |
1583 | 1081 * Home Graphics cursor |
1082 Do14 clra | |
0 | 1083 clrb |
1585 | 1084 std <V.GCrsX,u |
0 | 1085 rts |
307 | 1086 |
1582 | 1087 * |
307 | 1088 * Ding - tickle CoCo's PIA to emit a sound |
1582 | 1089 * |
307 | 1090 Ding pshs b,a |
1213
4e235f213651
Lots of changes: bootscripts and bootlists added, sources massaged...
boisy
parents:
317
diff
changeset
|
1091 lda >PIA0Base+1 |
4e235f213651
Lots of changes: bootscripts and bootlists added, sources massaged...
boisy
parents:
317
diff
changeset
|
1092 ldb >PIA0Base+3 |
0 | 1093 pshs b,a |
1094 anda #$F7 | |
1095 andb #$F7 | |
1213
4e235f213651
Lots of changes: bootscripts and bootlists added, sources massaged...
boisy
parents:
317
diff
changeset
|
1096 sta >PIA0Base+1 |
4e235f213651
Lots of changes: bootscripts and bootlists added, sources massaged...
boisy
parents:
317
diff
changeset
|
1097 stb >PIA0Base+3 |
4e235f213651
Lots of changes: bootscripts and bootlists added, sources massaged...
boisy
parents:
317
diff
changeset
|
1098 lda >PIA1Base+3 |
0 | 1099 pshs a |
1100 ora #$08 | |
1213
4e235f213651
Lots of changes: bootscripts and bootlists added, sources massaged...
boisy
parents:
317
diff
changeset
|
1101 sta >PIA1Base+3 |
0 | 1102 ldb #$0A |
1103 L07E6 lda #$FE | |
1582 | 1104 bsr DingDuration |
0 | 1105 lda #$02 |
1582 | 1106 bsr DingDuration |
0 | 1107 decb |
1108 bne L07E6 | |
1109 puls a | |
1213
4e235f213651
Lots of changes: bootscripts and bootlists added, sources massaged...
boisy
parents:
317
diff
changeset
|
1110 sta >PIA1Base+3 |
0 | 1111 puls b,a |
1213
4e235f213651
Lots of changes: bootscripts and bootlists added, sources massaged...
boisy
parents:
317
diff
changeset
|
1112 sta >PIA0Base+1 |
4e235f213651
Lots of changes: bootscripts and bootlists added, sources massaged...
boisy
parents:
317
diff
changeset
|
1113 stb >PIA0Base+3 |
0 | 1114 puls pc,b,a |
307 | 1115 |
1582 | 1116 DingDuration |
1117 sta >PIA1Base | |
317
e6dcf1ac92b2
Modified ccio.asm for better comments, init.asm simplified
boisy
parents:
307
diff
changeset
|
1118 lda #128 |
0 | 1119 L0805 inca |
1120 bne L0805 | |
1121 rts | |
1122 | |
1123 emod | |
1124 eom equ * | |
1125 end |