annotate level1/modules/vtio.asm @ 3109:118cd9951d24

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