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