1933
|
1 ********************************************************************
|
|
2 * CoVDG - VDG Console Output Subroutine for VTIO
|
|
3 *
|
|
4 * $Id$
|
|
5 *
|
|
6 * Edt/Rev YYYY/MM/DD Modified by
|
|
7 * Comment
|
|
8 * ------------------------------------------------------------------
|
|
9 * 1 ????/??/??
|
|
10 * From Tandy OS-9 Level One VR 02.00.00
|
|
11 *
|
|
12 * 2003/09/22 Rodney Hamilton
|
|
13 * recoded dispatch table fcbs, fixed cursor color bug
|
|
14
|
|
15 nam CoVDG
|
|
16 ttl VDG Console Output Subroutine for VTIO
|
|
17
|
|
18 * Disassembled 98/08/23 17:47:40 by Disasm v1.6 (C) 1988 by RML
|
|
19
|
|
20 ifp1
|
|
21 use defsfile
|
2624
|
22 use cocovtio.d
|
1933
|
23 endc
|
|
24
|
|
25 tylg set Systm+Objct
|
|
26 atrv set ReEnt+rev
|
|
27 rev set $00
|
|
28 edition set 1
|
|
29
|
|
30 mod eom,name,tylg,atrv,start,size
|
|
31
|
|
32 u0000 rmb 0
|
|
33 size equ .
|
|
34 fcb $07
|
|
35
|
|
36 name fcs /CoVDG/
|
|
37 fcb edition
|
|
38
|
|
39 start equ *
|
|
40 lbra Init
|
|
41 lbra Write
|
|
42 lbra GetStat
|
|
43 lbra SetStat
|
|
44 Term pshs y,x
|
|
45 pshs u save U
|
|
46 ldd #512 32x16 VDG memory size
|
|
47 ldu <V.ScrnA,u get pointer to memory
|
|
48 os9 F$SRtMem return to system
|
|
49 puls u restore U
|
|
50 ldb <V.COLoad,u
|
|
51 andb #~ModCoVDG
|
|
52 bra L0086
|
|
53 * Init
|
|
54 Init pshs y,x save regs
|
|
55 lda #$AF
|
|
56 sta <V.CColr,u save default color cursor
|
|
57 pshs u save static ptr
|
|
58 ldd #768 allocate 768 bytes for now
|
|
59 os9 F$SRqMem get it
|
|
60 tfr u,d put ptr in D
|
|
61 tfr u,x and X
|
|
62 bita #$01 odd page?
|
|
63 beq L0052 branch if not
|
|
64 leax >256,x else move X up 256 bytes
|
|
65 bra L0056 and return first 256 bytes
|
|
66 L0052 leau >512,u else move X up 512 bytes
|
|
67 L0056 ldd #256 and return last 256 bytes
|
|
68 os9 F$SRtMem free it!
|
|
69 puls u restore static ptr
|
|
70 stx <V.ScrnA,u save VDG screen memory
|
|
71 pshs y
|
|
72 leay -$0E,y
|
|
73 clra
|
|
74 clrb
|
|
75 jsr [<V.DspVct,u] display screen (routine in VTIO)
|
|
76 puls y
|
|
77 stx <V.CrsrA,u save start cursor position
|
|
78 leax >512,x point to end of screen
|
|
79 stx <V.ScrnE,u save it
|
|
80 lda #$60 get default character
|
|
81 sta <V.CChar,u put character under the cursor
|
|
82 sta <V.Chr1,u only referenced here ??
|
|
83 lbsr ClrScrn clear the screen
|
|
84 ldb <V.COLoad,u
|
|
85 orb #ModCoVDG set to CoVDG found (?)
|
|
86 L0086 stb <V.COLoad,u
|
|
87 clrb
|
|
88 puls pc,y,x
|
|
89
|
|
90 * Write
|
|
91 * Entry: A = char to write
|
|
92 * Y = path desc ptr
|
|
93 Write tsta
|
|
94 bmi L00D0
|
|
95 cmpa #$1F byte $1F?
|
|
96 bls Dispatch branch if lower or same
|
|
97 ldb <V.CFlag,u
|
|
98 beq L00B0
|
|
99 cmpa #$5E
|
|
100 bne L00A0
|
|
101 lda #$00
|
|
102 bra L00D0
|
|
103 L00A0 cmpa #$5F
|
|
104 bne L00A8
|
|
105 lda #$1F
|
|
106 bra L00D0
|
|
107 L00A8 cmpa #$60
|
|
108 bne L00C0
|
|
109 lda #$67
|
|
110 bra L00D0
|
|
111 L00B0 cmpa #$7C
|
|
112 bne L00B8
|
|
113 lda #$21
|
|
114 bra L00D0
|
|
115 L00B8 cmpa #$7E
|
|
116 bne L00C0
|
|
117 lda #$2D
|
|
118 bra L00D0
|
|
119 L00C0 cmpa #$60
|
|
120 bcs L00C8
|
|
121 suba #$60
|
|
122 bra L00D0
|
|
123 L00C8 cmpa #$40
|
|
124 bcs L00CE
|
|
125 suba #$40
|
|
126 L00CE eora #$40
|
|
127 L00D0 ldx <V.CrsrA,u get cursor address in X
|
|
128 sta ,x+ store character at address
|
|
129 stx <V.CrsrA,u update cursor address
|
|
130 cmpx <V.ScrnE,u end of screen?
|
|
131 bcs L00DF branch if not
|
|
132 bsr SScrl else if at end of screen, scroll it
|
|
133 L00DF bsr ShowCrsr ends with a CLRB/RTS anyhow
|
|
134
|
|
135 * no operation entry point
|
|
136 NoOp clrb
|
|
137 rts
|
|
138
|
|
139 * Screen Scroll Routine
|
|
140 SScrl ldx <V.ScrnA,u get address of screen
|
|
141 leax <32,x move to 2nd line
|
|
142 L00E9 ldd ,x++ copy from this line
|
|
143 std <-34,x to prevous
|
|
144 cmpx <V.ScrnE,u at end of screen yet?
|
|
145 bcs L00E9 branch if not
|
|
146 leax <-32,x else back up one line
|
|
147 stx <V.CrsrA,u save address of cursor (first col of last row)
|
|
148 lda #32 clear out row...
|
|
149 ldb #$60 ...width spaces
|
|
150 L00FD stb ,x+ do it...
|
|
151 deca end of rope?
|
|
152 bne L00FD branch if not
|
|
153 L0102 rts
|
|
154
|
|
155 Dispatch cmpa #$1B escape code?
|
|
156 bcc bad@ branch if same or greater
|
|
157 cmpa #$0E $0E?
|
|
158 bhi L0102 branch if higher than
|
|
159 leax <DCodeTbl,pcr deal with screen codes
|
|
160 lsla adjust for table entry size
|
|
161 ldd a,x get address in D
|
|
162 jmp d,x and jump to routine
|
|
163 bad@ comb
|
|
164 ldb #E$Write
|
|
165 rts
|
|
166
|
|
167 * display functions dispatch table
|
|
168 DCodeTbl fdb NoOp-DCodeTbl $00:no-op (null)
|
|
169 fdb CurHome-DCodeTbl $01:HOME cursor
|
|
170 fdb CurXY-DCodeTbl $02:CURSOR XY
|
|
171 fdb DelLine-DCodeTbl $03:ERASE LINE
|
|
172 fdb ErEOLine-DCodeTbl $04:CLEAR TO EOL
|
|
173 fdb Do05-DCodeTbl $05:CURSOR ON/OFF
|
|
174 fdb CurRght-DCodeTbl $005e $06:CURSOR RIGHT
|
|
175 fdb NoOp-DCodeTbl $07:no-op (bel:handled in VTIO)
|
|
176 fdb CurLeft-DCodeTbl $0050 $08:CURSOR LEFT
|
|
177 fdb CurUp-DCodeTbl $0119 $09:CURSOR UP
|
|
178 fdb CurDown-DCodeTbl $0038 $0A:CURSOR DOWN
|
|
179 fdb ErEOScrn-DCodeTbl $006c $0B:ERASE TO EOS
|
|
180 fdb ClrScrn-DCodeTbl $0070 $0C:CLEAR SCREEN
|
|
181 fdb Retrn-DCodeTbl $001e $0D:RETURN
|
|
182 fdb DoAlpha-DCodeTbl $012a $0E:DISPLAY ALPHA
|
|
183
|
|
184 * $0D - move cursor to start of line (carriage return)
|
|
185 Retrn bsr HideCrsr hide cursor
|
|
186 tfr x,d put cursor address in D
|
|
187 andb #$E0 place at start of line
|
|
188 stb <V.CrsAL,u and save low cursor address
|
|
189 ShowCrsr ldx <V.CrsrA,u get cursor address
|
|
190 lda ,x get char at cursor position
|
|
191 sta <V.CChar,u save it
|
|
192 lda <V.CColr,u get cursor character
|
|
193 beq L014D branch if none
|
|
194 L014B sta ,x else turn on cursor
|
|
195 L014D clrb
|
|
196 rts
|
|
197
|
|
198 * $0A - cursor down (line feed)
|
|
199 CurDown bsr HideCrsr hide cursor
|
|
200 leax <32,x move X down one line
|
|
201 cmpx <V.ScrnE,u at end of screen?
|
|
202 bcs L0162 branch if not
|
|
203 leax <-32,x else go back up one line
|
|
204 pshs x save X
|
|
205 bsr SScrl and scroll the screen
|
|
206 puls x restore pointer
|
|
207 L0162 stx <V.CrsrA,u save cursor pointer
|
|
208 bra ShowCrsr show cursor
|
|
209
|
|
210 * $08 - cursor left
|
|
211 CurLeft bsr HideCrsr hide cursor
|
|
212 cmpx <V.ScrnA,u compare against start of screen
|
|
213 bls L0173 ignore it if at the screen start
|
|
214 leax -$01,x else back up one
|
|
215 stx <V.CrsrA,u save updated pointer
|
|
216 L0173 bra ShowCrsr and show cursor
|
|
217
|
|
218 * $06 - cursor right
|
|
219 CurRght bsr HideCrsr hide cursor
|
|
220 leax $01,x move to the right
|
|
221 cmpx <V.ScrnE,u compare against end of screen
|
|
222 bcc L0181 if past end, ignore it
|
|
223 stx <V.CrsrA,u else save updated pointer
|
|
224 L0181 bra ShowCrsr and show cursor
|
|
225
|
|
226 * $0B - erase to end of screen
|
|
227 ErEOScrn bsr HideCrsr kill the cusror
|
|
228 bra L0189 and clear rest of the screen
|
|
229
|
|
230 * $0C - clear screen
|
|
231 ClrScrn bsr CurHome home cursor
|
|
232 L0189 lda #$60 get default char
|
|
233 L018B sta ,x+ save at location
|
|
234 cmpx <V.ScrnE,u end of screen?
|
|
235 bcs L018B branch if not
|
|
236 bra ShowCrsr now show cursor
|
|
237
|
|
238 * $01 - home cursor
|
|
239 CurHome bsr HideCrsr hide cursor
|
|
240 ldx <V.ScrnA,u $1D get pointer to screen
|
|
241 stx <V.CrsrA,u $21 save as new cursor position
|
|
242 bra ShowCrsr and show it
|
|
243
|
|
244 * Hides the cursor from the screen
|
|
245 * Exit: X = address of cursor
|
|
246 HideCrsr ldx <V.CrsrA,u $21 get address of cursor in X
|
|
247 lda <V.CChar,u $23 get value of char under cursor
|
|
248 sta ,x put char in place of cursor
|
|
249 clrb must be here, in general, for [...] BRA HideCrsr
|
|
250 rts
|
|
251
|
|
252 * $05 XX - set cursor off/on/color per XX-32
|
|
253 Do05 ldb #$01 need additional byte
|
|
254 leax <CrsrSw,pcr
|
|
255 bra L01E5
|
|
256
|
|
257 CrsrSw lda <V.NChr2,u get next char
|
|
258 suba #C$SPAC take out ASCII space
|
|
259 bne L01BB branch if not zero
|
|
260 sta <V.CColr,u else save cursor color zero (no cursor)
|
|
261 bra HideCrsr and hide cursor
|
|
262 L01BB cmpa #$0B greater than $0B?
|
|
263 bge L014D yep, just ignore byte
|
|
264 cmpa #$01 is it one?
|
|
265 bgt L01C7 branch if greater
|
|
266 lda #$AF else get default blue cursor color
|
|
267 bra L01D7 and save cursor color
|
|
268 L01C7 cmpa #$02 is it two?
|
|
269 bgt L01CF branch if larger
|
|
270 lda #$A0 else get black cursor color
|
|
271 bra L01D7 and save it
|
|
272 ** BUG ** BUG ** BUG ** BUG
|
|
273 L01CF suba #$03 ** BUG FIXED! ** !!! Was SUBB
|
|
274 lsla shift into upper nibble
|
|
275 lsla
|
|
276 lsla
|
|
277 lsla
|
|
278 ora #$8F
|
|
279 L01D7 sta <V.CColr,u save new cursor
|
|
280 ldx <V.CrsrA,u get cursor address
|
|
281 lbra L014B branch to save cursor in X
|
|
282
|
|
283 * $02 XX YY - move cursor to col XX-32, row YY-32
|
|
284 CurXY ldb #$02 we want to claim next two chars
|
|
285 leax <DoCurXY,pcr point to processing routine
|
|
286 L01E5 stx <V.RTAdd,u store routine to return to
|
|
287 stb <V.NGChr,u get two more chars
|
|
288 clrb
|
|
289 rts
|
|
290
|
|
291 DoCurXY bsr HideCrsr hide cursor
|
|
292 ldb <V.NChr2,u get ASCII Y-pos
|
|
293 subb #C$SPAC take out ASCII space
|
|
294 lda #32 go down
|
|
295 mul multiply it
|
|
296 addb <V.NChar,u add in X-pos
|
|
297 adca #$00
|
|
298 subd #C$SPAC take out another ASCII space
|
|
299 addd <V.ScrnA,u add top of screen address
|
|
300 cmpd <V.ScrnE,u at end of the screen?
|
|
301 lbcc L014D exit if off the screen
|
|
302 std <V.CrsrA,u otherwise save new cursor address
|
|
303 lbra ShowCrsr and show cursor
|
|
304
|
|
305 * $04 - erase to end of line
|
|
306 ErEOLine bsr HideCrsr hide cursor
|
|
307 tfr x,d move current cursor position in D
|
|
308 andb #$1F number of characters put on this line
|
|
309 pshs b
|
|
310 ldb #32
|
|
311 subb ,s+
|
|
312 bra L0223 and clear one line
|
|
313
|
|
314 * $03 - erase line
|
|
315 DelLine lbsr Retrn do a CR
|
|
316 ldb #32 line length
|
|
317 L0223 lda #$60 get default character
|
|
318 ldx <V.CrsrA,u get cursor address
|
|
319 L0228 sta ,x+ fill screen line with 'space'
|
|
320 decb decrement
|
|
321 bne L0228 and branch if not end
|
|
322 lbra ShowCrsr else show cursor
|
|
323
|
|
324 * $09 - cursor up
|
|
325 CurUp lbsr HideCrsr hide cursor
|
|
326 leax <-32,x move X up one line
|
|
327 cmpx <V.ScrnA,u compare against start of screen
|
|
328 bcs L023E branch if we went beyond
|
|
329 stx <V.CrsrA,u else store updated X
|
|
330 L023E lbra ShowCrsr and show cursor
|
|
331
|
|
332 * $0E - switch screen to alphanumeric mode
|
|
333 DoAlpha clra
|
|
334 clrb
|
|
335 jmp [<V.DspVct,u] display screen (routine in VTIO)
|
|
336
|
|
337 * GetStat
|
|
338 GetStat ldx PD.RGS,y get caller's regs
|
|
339 cmpa #SS.AlfaS AlfaS?
|
|
340 beq Rt.AlfaS branch if so
|
|
341 cmpa #SS.Cursr Cursr?
|
|
342 beq Rt.Cursr branch if so
|
|
343
|
|
344 * SetStat
|
|
345 SetStat comb
|
|
346 ldb #E$UnkSvc
|
|
347 rts
|
|
348
|
|
349 * SS.AlfaS getstat
|
|
350 Rt.AlfaS ldd <V.ScrnA,u memory address of buffer
|
|
351 std R$X,x save in caller's X
|
|
352 ldd <V.CrsrA,u get cursor address
|
|
353 std R$Y,x save in caller's Y
|
|
354 lda <V.Caps,u save caps lock status in A and exit
|
|
355 bra SaveA
|
|
356
|
|
357 * SS.Cursr getstat
|
|
358 Rt.Cursr ldd <V.CrsrA,u get address of cursor
|
|
359 subd <V.ScrnA,u subtract screen address
|
|
360 pshs b,a D now holds cursor position relative to screen
|
|
361 clra
|
|
362 andb #$1F
|
|
363 addb #$20 compute column position
|
|
364 std R$X,x save column position to caller's X
|
|
365 puls b,a then divide by 32
|
|
366 lsra
|
|
367 rolb
|
|
368 rolb
|
|
369 rolb
|
|
370 rolb
|
|
371 clra
|
|
372 andb #$0F only 16 line to a screen
|
|
373 addb #$20
|
|
374 std R$Y,x and save column to caller's Y
|
|
375 ldb <V.CFlag,u
|
|
376 lda <V.CChar,u get character under cursor
|
|
377 bmi SaveA if hi bit set, go on
|
|
378 cmpa #$60 VDG space?
|
|
379 bcc L02A5 branch if greater than
|
|
380 cmpa #$20
|
|
381 bcc L02A9
|
|
382 tstb
|
|
383 beq L02A3
|
|
384 cmpa #$00
|
|
385 bne L029B
|
|
386 lda #$5E
|
|
387 bra SaveA save it and exit
|
|
388
|
|
389 L029B cmpa #$1F
|
|
390 bne L02A3
|
|
391 lda #$5F
|
|
392 bra SaveA
|
|
393 L02A3 ora #$20 turn it into ASCII from VDG codes
|
|
394 L02A5 eora #$40
|
|
395 bra SaveA
|
|
396 L02A9 tstb
|
|
397 bne SaveA
|
|
398 cmpa #$21 remap specific codes
|
|
399 bne L02B4
|
|
400 lda #$7C
|
|
401 bra SaveA
|
|
402 L02B4 cmpa #$2D
|
|
403 bne SaveA
|
|
404 lda #$7E
|
|
405 SaveA sta R$A,x
|
|
406 clrb
|
|
407 rts
|
|
408
|
|
409 emod
|
|
410 eom equ *
|
|
411 end
|
|
412
|