1933
|
1 ********************************************************************
|
|
2 * CoHR - Hi-Res 51x24 Graphics Console Output Subroutine for VTIO
|
|
3 *
|
|
4 * $Id$
|
|
5 *
|
|
6 * Edt/Rev YYYY/MM/DD Modified by
|
|
7 * Comment
|
|
8 * ------------------------------------------------------------------
|
|
9 * 1 ????/??/??
|
|
10 * Original Dragon distribution version
|
|
11 *
|
|
12 * 2003/09/22 Rodney Hamilton
|
|
13 * Recoded fcb arrays, added labels & some comments
|
|
14 *
|
|
15 * 2004/11/15 P.Harvey-Smith
|
|
16 * Added code to turn off the drives on the Dragon Alpha.
|
|
17 *
|
|
18 * 2004/12/01 P.Harvey-Smith
|
|
19 * Began converting drvr51 to CoHR, removed all keyboard
|
|
20 * related code, added symbolic defines for a lot of things.
|
|
21 *
|
|
22 * 2004/12/02 P.Harvey-Smith
|
|
23 * Finished converting to c051 driver, moved all variable
|
|
24 * storage into ccio module (defined in cciodefs).
|
|
25 *
|
|
26 * 2005/04/09 P.Harvey-Smith
|
|
27 * Replaced all ; comment chars with * for benefit of native
|
|
28 * asm. Re-implemented (hopefully) non-destructive cursor which
|
|
29 * is XORed onto the screen. Commented character drawing routines
|
|
30 * and replaced the V51xx names with more meaningful ones.
|
|
31 *
|
|
32 * 2005/04/24 P.Harvey-Smith
|
|
33 * Addded routines to flash the cursor, this is as it was in the
|
|
34 * Dragon Data 51 column driver.
|
|
35 *
|
|
36 nam CoHR
|
|
37 ttl Hi-Res 51x24 Graphics Console Output Subroutine for VTIO
|
|
38
|
|
39 ifp1
|
2032
|
40 use defsfile
|
1933
|
41 use vtiodefs
|
|
42 endc
|
|
43
|
|
44 tylg set Systm+Objct
|
|
45 atrv set ReEnt+rev
|
|
46 rev set $00
|
|
47 edition set 1
|
|
48
|
|
49 mod eom,name,tylg,atrv,start,size
|
|
50
|
|
51 size equ .
|
|
52
|
|
53 fcb UPDAT.
|
|
54
|
|
55
|
|
56 ScreenSize equ $1800 * Screen Size in Bytes
|
|
57
|
|
58 name fcs /CoHR/
|
|
59 fcb edition
|
|
60
|
|
61 start lbra Init
|
|
62 lbra Write
|
|
63 lbra GetStat
|
|
64 lbra SetStat
|
|
65 lbra Term
|
|
66
|
|
67 Init
|
|
68 pshs u,a
|
|
69 ldd #ScreenSize+$100 * Request a screenful of ram + $100 bytes
|
|
70 os9 F$SRqMem
|
|
71 bcs InitExit * Error : exit
|
|
72 tfr u,d
|
|
73 ldu $01,s * Restore saved u
|
|
74 tfr d,x
|
|
75 bita #$01 * Check that memory block starts at even page
|
|
76 beq L0066 * Yes base of screen = base of memory block
|
|
77 leax >$0100,x * no Move to next page
|
|
78 bra L0068
|
|
79 L0066 adda #$18
|
|
80 L0068 stx V.51ScrnA,u
|
|
81 tfr d,u
|
|
82 ldd #$0100
|
|
83 os9 F$SRtMem * Return unneeded page to OS
|
|
84 ldu $01,s
|
|
85
|
|
86 clr V.51CursorOn,u * Flag cursor off
|
|
87 lbsr DoHome
|
|
88 lbsr DoReverseOff
|
|
89 lbsr DoCLS
|
|
90 ldb V.COLoad,u
|
|
91 orb #ModCoHR * set to CoHR found (?)
|
|
92
|
|
93 leax FlashCursor,pcr * Get address of cursor flash routine
|
|
94 stx V.Flash,u
|
|
95
|
|
96 InitSaveExit
|
|
97 stb V.COLoad,u
|
|
98 clrb
|
|
99
|
|
100 InitExit
|
|
101 puls pc,u,a
|
|
102
|
|
103 InitFlag fcb $00
|
|
104
|
|
105 Term pshs y,x
|
|
106 pshs u * save U
|
|
107 ldd #ScreenSize * Graphics memory size
|
|
108 ldu V.51ScrnA,u * get pointer to memory
|
|
109 os9 F$SRtMem * return to system
|
|
110 puls u * restore U
|
|
111 ldb V.COLoad,u
|
|
112 andb #~ModCoHR * Set CoHR unot loaded
|
|
113 bra InitSaveExit
|
|
114
|
|
115 * Write
|
|
116 * Entry: A = char to write
|
|
117 * Y = path desc ptr
|
|
118
|
|
119 Write
|
|
120
|
|
121 L012C inc V.Noflash,u * Flag do not flash cursor
|
|
122 ldb V.51EscSeq,u
|
|
123 bne L0165
|
|
124 cmpa #$1B * escape?
|
|
125 bne CheckForNormal
|
|
126 inc V.51EscSeq,u * flag ESC seq
|
|
127
|
|
128 WriteExit2
|
|
129 clr V.NoFlash,u * Allow cursor to flash
|
|
130 clrb
|
|
131 L0139 rts
|
|
132
|
|
133
|
|
134 CheckForNormal
|
|
135 cmpa #$20
|
|
136 bcs DoCtrlChar * Control charater ?
|
|
137 cmpa #$7F
|
|
138 bcc DoCtrlChar * or upper bit set
|
|
139 bra DoNormalChar
|
|
140
|
|
141 DoCtrlChar
|
|
142 leax >CtrlCharDispatch,pcr
|
|
143 L0148 tst ,x
|
|
144 bne L0150
|
|
145 CancelEscSequence
|
|
146 clr V.51EscSeq,u
|
|
147 WriteExit
|
|
148 clr V.NoFlash,u
|
|
149 rts
|
|
150
|
|
151 L0150 cmpa ,x+
|
|
152 bne L0161
|
|
153 ldd ,x
|
|
154 leax >CtrlCharDispatch,pcr
|
|
155 leax d,x
|
|
156 stx V.51CtrlDispatch,u
|
|
157 jsr ,x
|
|
158 bra WriteExit
|
|
159
|
|
160 L0161 leax $02,x
|
|
161 bra L0148
|
|
162
|
|
163 L0165 inc V.51EscSeq,u
|
|
164 leax >EscCharDispatch,pcr
|
|
165 cmpb #$01
|
|
166 beq L0148
|
|
167 jmp [V.51CtrlDispatch,u]
|
|
168
|
|
169 DoNormalChar
|
|
170 pshs y,a
|
|
171 lbsr DoEraseCursor
|
|
172 puls y,a
|
|
173 inc V.51CursorChanged,u
|
|
174 bsr DrawCharacter
|
|
175 tst V.51UnderlineFlag,u * Are we underlining ?
|
|
176 beq L0185 * no : update cursor
|
|
177 lda #$F8 * Yes : do underline, then update cursor
|
|
178 leay <-$40,y
|
|
179 lbsr L0236
|
|
180
|
|
181 L0185 lda V.51XPos,u * Get current X pos
|
|
182 inca * increment it
|
|
183 cmpa #$33 * past end of line ?
|
|
184 bcs L01A2 * no : continue
|
|
185 clr V.51XPos,u * Yes reset x=0
|
|
186 lda V.51YPos,u * increment y pos
|
|
187 inca
|
|
188 cmpa #$18 * Past last line ?
|
|
189 bcs L019D * No : continue
|
|
190 lbsr SoScrollScreen * Yes : scroll screen one line
|
|
191 bra L01A5
|
|
192 L019D sta V.51YPos,u * Ypdate Y pos
|
|
193 bra L01A5
|
|
194
|
|
195 L01A2 sta V.51XPos,u * Update X pos
|
|
196 L01A5
|
|
197 ldd V.51XPos,u * Update old Cursor pos
|
|
198 std V.51OldCursorPosX,u
|
|
199 dec V.51CursorChanged,u
|
|
200 lbsr DoDisplayCursor * Display cursor
|
|
201
|
|
202 lbra WriteExit2
|
|
203 clrb * Flag no error
|
|
204 rts * Return to caller
|
|
205
|
|
206 *
|
|
207 * Draw the normal character $20..$7f, in the a register
|
|
208 * at position stored in V.51Xpos,V.51Ypos
|
|
209 *
|
|
210
|
|
211 DrawCharacter
|
|
212 tfr a,b
|
|
213 subb #$20 * Make b an offset into table
|
|
214 clra
|
|
215 leax >CharacterShapes,pcr * point to character shape table
|
|
216 lslb * Multiply b by 4 into d (4 bytes/character)
|
|
217 rola
|
|
218 lslb
|
|
219 rola
|
|
220 leax d,x * Point X at required character's bitmap
|
|
221 ldb #$05 * Work out pixel X co-ordinate of current cursor
|
|
222 lda V.51XPos,u
|
|
223 mul
|
|
224 pshs b * Save pixel x
|
|
225 lsra * Divide pixel-x by 8, to get byte offset into line
|
|
226 rorb
|
|
227 lsra
|
|
228 rorb
|
|
229 lsra
|
|
230 rorb
|
|
231 puls a * restore pixel X
|
|
232 anda #$07 * Calculate offset within byte where character begins
|
|
233 pshs b
|
|
234 sta V.51BytePixOffset,u
|
|
235 tst V.51XORFlag,u
|
|
236 bne L01FF
|
|
237 tfr a,b * Calculate a mask for character data
|
|
238 lda #$F8 * shifts $f8 right b times
|
|
239 tstb
|
|
240 beq L01FA * Done all bits ?
|
|
241 L01E5 lsra * shift mask right
|
|
242 decb * decrement count
|
|
243 bhi L01E5 * done all ?
|
|
244 bne L01EE * have we shifted any mask bits off right hand end ?
|
|
245 rorb
|
|
246 bra L01FA
|
|
247
|
|
248 L01EE pshs b * Save count on stack
|
|
249 ldb #$80 * start to build mask for second byte as well
|
|
250 L01F2 lsra * shift bits from bottom of a to top of b
|
|
251 rorb
|
|
252 dec ,s * decrement count
|
|
253 bne L01F2 * if any shifts left loop again
|
|
254 leas $01,s * drop count
|
|
255
|
|
256 * When we reach here we should have a pair of bytes in d which indicate where exactly the
|
|
257 * character should be drawn, this may be partly in each
|
|
258
|
|
259 L01FA coma
|
|
260 comb
|
|
261 std V.51ScreenMask1,u * Save screen mask
|
|
262
|
|
263 * The code below works out the offset of the character cell to be updated, this works because
|
|
264 * the y co ordinate is loaded into the high byte of d, effectivley multiplying it by 256, since
|
|
265 * each screen line is 32 bytes wide, and each character is 8 pixels tall this works out as 8x32=256
|
|
266
|
|
267 L01FF ldy V.51ScrnA,u * Point y at screen memory address
|
|
268 lda V.51YPos,u
|
|
269 ldb ,s+ * Retrieve byte offset from stack
|
|
270 leay d,y * calculate screen address.
|
|
271 lda #$04 * get character data byte count, 4 bytes of 8 nibbles
|
|
272 pshs a
|
|
273 inc V.51CursorChanged,u * flag character at cursor being changed
|
|
274
|
|
275 L0211 lda ,x * get a byte from character data
|
|
276 anda #$F0 * mask out even line
|
|
277 bsr L0236 * update screen
|
|
278 lda ,x+ * Get again
|
|
279 anda #$0F * mask out odd line
|
|
280 bsr L0227 * update screen
|
|
281 dec ,s * Decrement character data byte counter
|
|
282 bne L0211 * all done ?
|
|
283 dec V.51CursorChanged,u * Flag character update finished
|
|
284 clrb * flag no error
|
|
285 puls pc,b * return to caller
|
|
286
|
|
287
|
|
288 L0227 ldb V.51BytePixOffset,u
|
|
289 subb #$04
|
|
290 bhi L023B
|
|
291 beq L0250
|
|
292 L0230 lsla
|
|
293 incb
|
|
294 bne L0230
|
|
295 bra L0250
|
|
296
|
|
297 L0236 ldb V.51BytePixOffset,u * Retrieve byte pixel offset
|
|
298 beq L0250
|
|
299
|
|
300 L023B lsra * manipulate character data into correct position
|
|
301 decb * in a similar way to the mask above
|
|
302 bhi L023B
|
|
303 bne L0244
|
|
304 rorb
|
|
305 bra L0250
|
|
306 L0244 pshs b
|
|
307 ldb #$80
|
|
308 L0248 lsra
|
|
309 rorb
|
|
310 dec ,s
|
|
311 bne L0248
|
|
312 leas $01,s
|
|
313
|
|
314 L0250 tst V.51XORFlag,u * are we XORing data direct to screen ?
|
|
315 bne L0273 * Yes : just do it
|
|
316 tst V.51ReverseFlag,u * are we in reverse mode ?
|
|
317 beq L0262 * no : just output data
|
|
318 coma * set mask up for reverse mode
|
|
319 comb
|
|
320 eora V.51ScreenMask1,u
|
|
321 eorb V.51ScreenMask2,u
|
|
322
|
|
323 L0262 pshs b,a * combine mask and screen data
|
|
324 ldd V.51ScreenMask1,u
|
|
325 anda ,y
|
|
326 andb $01,y
|
|
327 addd ,s++
|
|
328
|
|
329 L026D std ,y * screen update
|
|
330 leay <$20,y
|
|
331 rts
|
|
332
|
|
333 L0273 eora ,y * XOR onto screen
|
|
334 eorb $01,y
|
|
335 bra L026D
|
|
336
|
|
337 *
|
|
338 * $07 - BEL (ding!)
|
|
339 *
|
|
340
|
|
341 DoBell
|
|
342 ldx #$FF20
|
|
343 ldb #$64
|
|
344 L027E lda ,x
|
|
345 eora #$C0
|
|
346 sta ,x
|
|
347 lda #$19
|
|
348 L0286 deca
|
|
349 nop
|
|
350 nop
|
|
351 bne L0286
|
|
352 decb
|
|
353 bne L027E
|
|
354 lbra CancelEscSequence
|
|
355 *
|
|
356 * $08 - BS (left arrow)
|
|
357 *
|
|
358 DoBackspace
|
|
359 lbsr DoEraseCursor
|
|
360 dec V.51XPos,u
|
|
361 bpl DoBSUpdateCursor
|
|
362 lda #$32
|
|
363 sta V.51XPos,u
|
|
364 bra DoCursorUp1
|
|
365 *
|
|
366 * $1b44 - (cursor up)
|
|
367 *
|
|
368 DoCursorUp
|
|
369 lbsr DoEraseCursor
|
|
370 DoCursorUp1
|
|
371 dec V.51YPos,u
|
|
372 bpl L02A6
|
|
373 clr V.51YPos,u
|
|
374 lbsr L035E
|
|
375 L02A6 lbsr L0484
|
|
376 lbra CancelEscSequence
|
|
377
|
|
378 DoBSUpdateCursor
|
|
379 lbsr L0484
|
|
380 lbsr DoDisplayCursor
|
|
381 rts
|
|
382
|
|
383 *
|
|
384 * $0a, $1b45 - LF, (cursor down)
|
|
385 *
|
|
386
|
|
387 DoLineFeed
|
|
388 lbsr DoEraseCursor
|
|
389 lda V.51YPos,u
|
|
390 inca
|
|
391 cmpa #$18
|
|
392 bcs L02B9
|
|
393 lbsr SoScrollScreen
|
|
394 bra L02BC
|
|
395 L02B9 sta V.51YPos,u
|
|
396 L02BC lbsr DoDisplayCursor
|
|
397 bra L02A6
|
|
398
|
|
399 *
|
|
400 * $0d - CR (return)
|
|
401 *
|
|
402
|
|
403 DoCarrageReturn
|
|
404 lbsr DoEraseCursor
|
|
405 clr V.51XPos,u
|
|
406 bra L02A6
|
|
407
|
|
408 *
|
|
409 * $0c - FF (clear screen)
|
|
410 *
|
|
411 DoCLS
|
|
412 ldy V.51ScrnA,u
|
|
413 leay >$0080,y
|
|
414 lda #$18
|
|
415 pshs a
|
|
416 inc V.51CursorChanged,u
|
|
417 L02D2 bsr L0314
|
|
418 dec ,s
|
|
419 bne L02D2
|
|
420 leas $01,s
|
|
421 clra
|
|
422 clrb
|
|
423 std V.51OldCursorPosX,u
|
|
424 std V.51XPos,u
|
|
425 dec V.51CursorChanged,u
|
|
426 ldx #$FF20
|
|
427 lda $02,x
|
|
428 ora #$F0
|
|
429 sta $02,x
|
|
430 ldx #$FFC0
|
|
431 lda #$06
|
|
432 ldb #$03
|
|
433 bsr L0305
|
|
434 lda V.51ScrnA,u
|
|
435 lsra
|
|
436 ldb #$07
|
|
437 bsr L0305
|
|
438 clr V.51CursorOn,u * Flag cursor is off
|
|
439 lbsr DoDisplayCursor * Display cursor
|
|
440 lbra CancelEscSequence
|
|
441
|
|
442 L0305 lsra
|
|
443 bcc L030E
|
|
444 leax $01,x
|
|
445 sta ,x+
|
|
446 bra L0310
|
|
447 L030E sta ,x++
|
|
448 L0310 decb
|
|
449 bne L0305
|
|
450 rts
|
|
451
|
|
452 L0314 lda #$10
|
|
453 L0316 pshs a
|
|
454 lda V.51ReverseFlag,u
|
|
455 tfr a,b
|
|
456 L031D std <-$80,y
|
|
457 std <-$60,y
|
|
458 std <-$40,y
|
|
459 std <-$20,y
|
|
460 std <$20,y
|
|
461 std <$40,y
|
|
462 std <$60,y
|
|
463 std ,y++
|
|
464 dec ,s
|
|
465 bne L031D
|
|
466 leay >$00E0,y
|
|
467 puls pc,b
|
|
468
|
|
469 SoScrollScreen
|
|
470 ldy V.51ScrnA,u
|
|
471 inc V.51CursorChanged,u
|
|
472 pshs u
|
|
473 leau >$0100,y
|
|
474 lda #$10
|
|
475 bsr L037C
|
|
476 puls u
|
|
477 dec V.51OldCursorPosY,u
|
|
478
|
|
479 L0354 leay >$0080,y
|
|
480 bsr L0314
|
|
481 dec V.51CursorChanged,u
|
|
482 rts
|
|
483
|
|
484 L035E ldy V.51ScrnA,u
|
|
485 leay >$17F0,y
|
|
486 inc V.51CursorChanged,u
|
|
487 pshs u
|
|
488 leau >-$0100,y
|
|
489 lda #$F0
|
|
490 bsr L037C
|
|
491 leay ,u
|
|
492 puls u
|
|
493 inc V.51OldCursorPosY,u
|
|
494 bra L0354
|
|
495
|
|
496 L037C ldb #$17
|
|
497 pshs b
|
|
498 L0380 ldb #$10
|
|
499
|
|
500 L0382 ldx ,u
|
|
501 stx ,y
|
|
502 ldx $02,u
|
|
503 stx $02,y
|
|
504 ldx $04,u
|
|
505 stx $04,y
|
|
506 ldx $06,u
|
|
507 stx $06,y
|
|
508 ldx $08,u
|
|
509 stx $08,y
|
|
510 ldx $0A,u
|
|
511 stx $0A,y
|
|
512 ldx $0C,u
|
|
513 stx $0C,y
|
|
514 ldx $0E,u
|
|
515 stx $0E,y
|
|
516 leay a,y
|
|
517 leau a,u
|
|
518 decb
|
|
519 bne L0382
|
|
520 dec ,s
|
|
521 bne L0380
|
|
522 puls pc,b
|
|
523
|
|
524 *
|
|
525 * $1b42 - clear to end of line
|
|
526 *
|
|
527
|
|
528 DoClrEOL
|
|
529 inc V.51CursorChanged,u
|
|
530 bsr L03BA
|
|
531 dec V.51CursorChanged,u
|
|
532 lbra CancelEscSequence
|
|
533 L03BA
|
|
534 ldb V.51XPos,u
|
|
535 pshs b
|
|
536 bitb #$07
|
|
537 bne L03CB
|
|
538 lda #$05
|
|
539 mul
|
|
540 bra L03F3
|
|
541 L03CB lda #$01
|
|
542 pshs a
|
|
543 L03CF lda #$20
|
|
544 lbsr DrawCharacter
|
|
545 lda V.51XPos,u
|
|
546 inca
|
|
547 sta V.51XPos,u
|
|
548 cmpa #$33
|
|
549 bcs L03E3
|
|
550 leas $01,s
|
|
551 bra L040D
|
|
552 L03E3 dec ,s
|
|
553 bpl L03CF
|
|
554 lda V.51XPos,u
|
|
555 ldb #$05
|
|
556 mul
|
|
557 bitb #$08
|
|
558 bne L03CF
|
|
559 leas $01,s
|
|
560 L03F3 lsrb
|
|
561 lsrb
|
|
562 lsrb
|
|
563 ldy V.51ScrnA,u
|
|
564 lda V.51YPos,u
|
|
565 leay d,y
|
|
566 leay >$0080,y
|
|
567 lda #$20
|
|
568 pshs b
|
|
569 suba ,s+
|
|
570 lsra
|
|
571 lbsr L0316
|
|
572 L040D puls a
|
|
573 sta V.51XPos,u
|
|
574 lbsr DoDisplayCursor
|
|
575 rts
|
|
576 *
|
|
577 * $1b4A - clear to end of screen
|
|
578 *
|
|
579 DoClearEOS
|
|
580 inc V.51CursorChanged,u
|
|
581 bsr L03BA
|
|
582 lda #$17
|
|
583 suba V.51YPos,u
|
|
584 bls L042A
|
|
585 pshs a
|
|
586 L0421 lbsr L0314
|
|
587 dec ,s
|
|
588 bne L0421
|
|
589 leas $01,s
|
|
590 L042A dec V.51CursorChanged,u
|
|
591 lbsr DoDisplayCursor
|
|
592 lbra CancelEscSequence
|
|
593
|
|
594 *
|
|
595 *$0b - (cursor home)
|
|
596 *
|
|
597 DoHome
|
|
598 lbsr DoEraseCursor
|
|
599 clr V.51XPos,u
|
|
600 clr V.51YPos,u
|
|
601 lbsr DoDisplayCursor
|
|
602 lbra L02A6
|
|
603
|
|
604 *
|
|
605 * $1b41xxyy - move cursor to col xx (0-50) row yy (0-23)
|
|
606 *
|
|
607 DoGotoXY
|
|
608 lbsr DoEraseCursor
|
|
609 ldb V.51EscSeq,u
|
|
610 subb #$02
|
|
611 bne L0442
|
|
612 clrb
|
|
613 rts
|
|
614 L0442 decb
|
|
615 bne L0450
|
|
616 cmpa #51
|
|
617 bcs L044B
|
|
618 lda #50
|
|
619 L044B sta V.51XPos,u
|
|
620 L044D clrb
|
|
621 rts
|
|
622 L0450 cmpa #24
|
|
623 bcs L0456
|
|
624 lda #23
|
|
625 L0456 sta V.51YPos,u
|
|
626 L0459 lbsr DoDisplayCursor
|
|
627 lbra L02A6
|
|
628
|
|
629 *
|
|
630 * $1b43 - (cursor right)
|
|
631 *
|
|
632 DoCursorRight
|
|
633 lbsr DoEraseCursor
|
|
634 inc V.51XPos,u
|
|
635 lda V.51XPos,u
|
|
636 cmpa #$33
|
|
637 bcs L0459
|
|
638 clr V.51XPos,u
|
|
639 lbra DoLineFeed
|
|
640 *
|
|
641 * $1b46 - reverse on
|
|
642 *
|
|
643 DoReverseOn
|
|
644 lda #$FF
|
|
645 coma
|
|
646 L046F sta V.51ReverseFlag,u
|
|
647 lbra CancelEscSequence
|
|
648
|
|
649 *
|
|
650 * $1b47 - reverse off
|
|
651 *
|
|
652 DoReverseOff
|
|
653 lda #$FF
|
|
654 bra L046F
|
|
655
|
|
656 *
|
|
657 * $1b48 - underline on
|
|
658 *
|
|
659 DoUnderlineOn
|
|
660 lda #$FF
|
|
661 L047B sta V.51UnderlineFlag,u
|
|
662 lbra CancelEscSequence
|
|
663
|
|
664 *
|
|
665 * $1b49 - underline off
|
|
666 *
|
|
667 DoUnderlineOff
|
|
668 clra
|
|
669 bra L047B
|
|
670
|
|
671
|
|
672 L0484 ldd V.51XPos,u
|
|
673 inc V.51CursorChanged,u
|
|
674 std V.51OldCursorPosX,u
|
|
675 bra L04B9
|
|
676
|
|
677 L0494 pshs b,a
|
|
678 ldd V.51OldCursorPosX,u
|
|
679 inc V.51XORFlag,u
|
|
680 tstb
|
|
681 bmi L04AB
|
|
682 cmpb #$18
|
|
683 bcc L04AB
|
|
684 std V.51XPos,u
|
|
685 lda #$7F
|
|
686 lbsr DrawCharacter
|
|
687
|
|
688 L04AB puls b,a
|
|
689 std V.51XPos,u
|
|
690 std V.51OldCursorPosX,u
|
|
691 dec V.51XORFlag,u
|
|
692 L04B9 dec V.51CursorChanged,u
|
|
693 clrb
|
|
694 rts
|
|
695
|
|
696 *
|
|
697 * Display and Erase cursor routines, work by xoring cursor character onto the
|
|
698 * screen, the variable V.51CursorOn, is implemented such that it prevents
|
|
699 * multiple calls to these routines from acting as an inverse, so that they
|
|
700 * may be called from any code, irispective of if the cursor is already on/off.
|
|
701 *
|
|
702
|
|
703 *
|
|
704 * Display Cursor.
|
|
705 *
|
|
706 DoDisplayCursor
|
|
707 inc V.NoFlash,u * Flag in flash
|
|
708 tst V.51CursorOn,u * Get cursor on flag
|
|
709 bne DoCursorOnEnd * Yes : don't re-display
|
|
710 bsr DoCursorCommon * Display cursor
|
|
711 inc V.51CursorOn,u * Flag cursor on
|
|
712 DoCursorOnEnd
|
|
713 dec V.NoFlash,u * Flag flash done
|
|
714 rts
|
|
715 *
|
|
716 * Erase cursor
|
|
717 *
|
|
718 DoEraseCursor
|
|
719 inc V.NoFlash,u * Flag in Flash
|
|
720 tst V.51Cursoron,u * Get cursor on flag
|
|
721 beq DoEraseCursorEnd * no : don't atempt to turn off
|
|
722 bsr DoCursorCommon * Hide cursor
|
|
723 clr V.51CursorOn,u * Flag cursor off
|
|
724 DoEraseCursorEnd
|
|
725 dec V.NoFlash,u * Flag Flash done
|
|
726 rts
|
|
727
|
|
728 DoCursorCommon
|
|
729 lda #$7f * Cursor character $7f = block
|
|
730 inc V.51XORFlag,u * Flag xor on screen
|
|
731 lbsr DrawCharacter * Draw it
|
|
732 dec V.51XORFlag,u * Flag no xor on screen
|
|
733 rts
|
|
734
|
|
735 L04CA clrb
|
|
736 rts
|
|
737 GetStat
|
|
738 cmpa #$06
|
|
739 beq L04CA
|
|
740 cmpa #$02
|
|
741 bne SetStat
|
|
742 ldx $06,y
|
|
743 ldd V.51ScrnA,u
|
|
744 std $04,x
|
|
745 clrb
|
|
746 rts
|
|
747
|
|
748 SetStat comb
|
|
749 ldb #E$UnkSvc
|
|
750 rts
|
|
751
|
|
752 *
|
|
753 * Flash cursor, called by IRQ routine from VTIO
|
|
754 *
|
|
755
|
|
756 FlashCursor
|
|
757 tst V.NoFlash,u * Should we flash ?
|
|
758 bne FlashExit * No: just return
|
|
759 tst V.51CursorOn,u * Is cursor on ?
|
|
760 bne FlashOff * Yep : turn off
|
|
761 bra DoDisplayCursor * Else turn it on
|
|
762 FlashOff
|
|
763 bra DoEraseCursor
|
|
764 FlashExit
|
|
765 rts
|
|
766
|
|
767
|
|
768 * control characters dispatch table
|
|
769 CtrlCharDispatch
|
|
770 fcb $07 BEL * (beep)
|
|
771 fdb DoBell-CtrlCharDispatch $FC0B
|
|
772 fcb $08 BS * (left arrow)
|
|
773 fdb DoBackspace-CtrlCharDispatch * $FC23
|
|
774 fcb $0A LF * (down arrow)
|
|
775 fdb DoLineFeed-CtrlCharDispatch * $FC3E
|
|
776 fcb $0D CR * (return)
|
|
777 fdb DoCarrageReturn-CtrlCharDispatch *$FC50
|
|
778 fcb $0C FF * (clear screen)
|
|
779 fdb DoCLS-CtrlCharDispatch $FC55
|
|
780 fcb $0B * (cursor home)
|
|
781 fdb DoHome-CtrlCharDispatch $FDC2
|
|
782 fcb $00
|
|
783
|
|
784 * escape sequences dispatch table
|
|
785 EscCharDispatch
|
|
786 fcb $41 * cursor xy
|
|
787 fdb DoGotoXY-CtrlCharDispatch * $FDCB
|
|
788 fcb $42 * clear EOL
|
|
789 fdb DoClrEOL-CtrlCharDispatch * $FD41
|
|
790 fcb $43 * cursor right
|
|
791 fdb DoCursorRight-CtrlCharDispatch * $FDEE
|
|
792 fcb $44 * cursor up
|
|
793 fdb DoCursorUp-CtrlCharDispatch * $FC2D
|
|
794 fcb $45 * cursor down
|
|
795 fdb DoLineFeed-CtrlCharDispatch * $FC3E
|
|
796 fcb $46 * reverse on
|
|
797 fdb DoReverseOn-CtrlCharDispatch * $FDFE
|
|
798 fcb $47 * reverse off
|
|
799 fdb DoReverseOff-CtrlCharDispatch * $FE07
|
|
800 fcb $48 * underline on
|
|
801 fdb DoUnderlineOn-CtrlCharDispatch * $FE0B
|
|
802 fcb $49 * underline off
|
|
803 fdb DoUnderlineOff-CtrlCharDispatch * $FE13
|
|
804 fcb $4A * clear EOS
|
|
805 fdb DoClearEOS-CtrlCharDispatch * $FDA5
|
|
806 fcb $00
|
|
807
|
|
808 CharacterShapes
|
|
809 * 4x8 bitmap table for characters $20-$7f
|
|
810 * each nibble represents a row of 4 dots
|
|
811 * chars 20-27
|
|
812 fcb $00,$00,$00,$00 .... .@.. .@.@ .@@. ..@. @..@ .@.. .@..
|
|
813 fcb $44,$40,$40,$00 .... .@.. .@.@ @@@@ .@@@ ...@ @.@. .@..
|
|
814 fcb $55,$00,$00,$00 .... .@.. .... .@@. @... ..@. .@.. ....
|
|
815 fcb $6F,$6F,$60,$00 .... .... .... @@@@ .@@. .@.. @.@. ....
|
|
816 fcb $27,$86,$1E,$20 .... .@.. .... .@@. ...@ @... @@.@ ....
|
|
817 fcb $91,$24,$89,$00 .... .... .... .... @@@. @..@ .... ....
|
|
818 fcb $4A,$4A,$D0,$00 .... .... .... .... ..@. .... .... ....
|
|
819 fcb $44,$00,$00,$00 .... .... .... .... .... .... .... ....
|
|
820 * chars 29-2f
|
|
821 fcb $24,$44,$20,$00 ..@. .@.. @..@ .@.. .... .... .... ....
|
|
822 fcb $42,$22,$40,$00 .@.. ..@. .@@. .@.. .... .... .... ...@
|
|
823 fcb $96,$F6,$90,$00 .@.. ..@. @@@@ @@@. .... @@@@ .... ..@.
|
|
824 fcb $44,$E4,$40,$00 .@.. ..@. .@@. .@.. ..@. .... .@@. .@..
|
|
825 fcb $00,$02,$24,$00 ..@. .@.. @..@ .@.. ..@. .... .@@. @...
|
|
826 fcb $00,$F0,$00,$00 .... .... .... .... .@.. .... .... ....
|
|
827 fcb $00,$06,$60,$00 .... .... .... .... .... .... .... ....
|
|
828 fcb $01,$24,$80,$00 .... .... .... .... .... .... .... ....
|
|
829 * chars 30-37
|
|
830 fcb $69,$BD,$60,$00 .@@. ..@. .@@. @@@. ..@. @@@@ .@@@ @@@@
|
|
831 fcb $26,$22,$70,$00 @..@ .@@. @..@ ...@ .@@. @... @... ...@
|
|
832 fcb $69,$2C,$F0,$00 @.@@ ..@. ..@. .@@. @.@. @@@. @@@. ..@.
|
|
833 fcb $E1,$61,$E0,$00 @@.@ ..@. @@.. ...@ @@@@ ...@ @..@ .@..
|
|
834 fcb $26,$AF,$20,$00 .@@. .@@@ @@@@ @@@. ..@. @@@. .@@. .@..
|
|
835 fcb $F8,$E1,$E0,$00 .... .... .... .... .... .... .... ....
|
|
836 fcb $78,$E9,$60,$00 .... .... .... .... .... .... .... ....
|
|
837 fcb $F1,$24,$40,$00 .... .... .... .... .... .... .... ....
|
|
838 * chars 38-3f
|
|
839 fcb $69,$69,$60,$00 .@@. .@@. .... .... ..@. .... .@.. .@@.
|
|
840 fcb $69,$71,$60,$00 @..@ @..@ .... .... .@.. @@@@ ..@. @..@
|
|
841 fcb $00,$40,$40,$00 .@@. .@@@ .@.. ..@. @... .... ...@ ..@.
|
|
842 fcb $00,$20,$24,$00 @..@ ...@ .... .... .@.. @@@@ ..@. ..@.
|
|
843 fcb $24,$84,$20,$00 .@@. .@@. .@.. ..@. ..@. .... .@.. ....
|
|
844 fcb $0F,$0F,$00,$00 .... .... .... .@.. .... .... .... ..@.
|
|
845 fcb $42,$12,$40,$00 .... .... .... .... .... .... .... ....
|
|
846 fcb $69,$22,$02,$00 .... .... .... .... .... .... .... ....
|
|
847 * chars 40-47
|
|
848 fcb $69,$BB,$87,$00 .@@. .@@. @@@. .@@@ @@@. @@@@ @@@@ .@@@
|
|
849 fcb $69,$F9,$90,$00 @..@ @..@ @..@ @... @..@ @... @... @...
|
|
850 fcb $E9,$E9,$E0,$00 @.@@ @@@@ @@@. @... @..@ @@@. @@@. @.@@
|
|
851 fcb $78,$88,$70,$00 @.@@ @..@ @..@ @... @..@ @... @... @..@
|
|
852 fcb $E9,$99,$E0,$00 @... @..@ @@@. .@@@ @@@. @@@@ @... .@@@
|
|
853 fcb $F8,$E8,$F0,$00 .@@@ .... .... .... .... .... .... ....
|
|
854 fcb $F8,$E8,$80,$00 .... .... .... .... .... .... .... ....
|
|
855 fcb $78,$B9,$70,$00 .... .... .... .... .... .... .... ....
|
|
856 * chars 48-4f
|
|
857 fcb $99,$F9,$90,$00 @..@ @@@. @@@@ @..@ @... @@@@ @..@ .@@.
|
|
858 fcb $E4,$44,$E0,$00 @..@ .@.. ..@. @.@. @... @@.@ @@.@ @..@
|
|
859 fcb $F2,$2A,$40,$00 @@@@ .@.. ..@. @@.. @... @@.@ @.@@ @..@
|
|
860 fcb $9A,$CA,$90,$00 @..@ .@.. @.@. @.@. @... @..@ @..@ @..@
|
|
861 fcb $88,$88,$F0,$00 @..@ @@@. .@.. @..@ @@@@ @..@ @..@ .@@.
|
|
862 fcb $FD,$D9,$90,$00 .... .... .... .... .... .... .... ....
|
|
863 fcb $9D,$B9,$90,$00 .... .... .... .... .... .... .... ....
|
|
864 fcb $69,$99,$60,$00 .... .... .... .... .... .... .... ....
|
|
865 * chars 50-57
|
|
866 fcb $E9,$E8,$80,$00 @@@. .@@. @@@. .@@@ @@@. @..@ @..@ @..@
|
|
867 fcb $69,$9B,$70,$00 @..@ @..@ @..@ @... .@.. @..@ @..@ @..@
|
|
868 fcb $E9,$EA,$90,$00 @@@. @..@ @@@. .@@. .@.. @..@ @..@ @@.@
|
|
869 fcb $78,$61,$E0,$00 @... @.@@ @.@. ...@ .@.. @..@ .@@. @@.@
|
|
870 fcb $E4,$44,$40,$00 @... .@@@ @..@ @@@. .@.. .@@. .@@. @@@@
|
|
871 fcb $99,$99,$60,$00 .... .... .... .... .... .... .... ....
|
|
872 fcb $99,$96,$60,$00 .... .... .... .... .... .... .... ....
|
|
873 fcb $99,$DD,$F0,$00 .... .... .... .... .... .... .... ....
|
|
874 * chars 58-5f
|
|
875 fcb $99,$69,$90,$00 @..@ @..@ @@@@ @@@. .... .@@@ .@@. ....
|
|
876 fcb $99,$71,$E0,$00 @..@ @..@ ...@ @... @... ...@ @..@ ....
|
|
877 fcb $F1,$68,$F0,$00 .@@. .@@@ .@@. @... .@.. ...@ .... ....
|
|
878 fcb $E8,$88,$E0,$00 @..@ ...@ @... @... ..@. ...@ .... ....
|
|
879 fcb $08,$42,$10,$00 @..@ @@@. @@@@ @@@. ...@ .@@@ .... ....
|
|
880 fcb $71,$11,$70,$00 .... .... .... .... .... .... .... @@@@
|
|
881 fcb $69,$00,$00,$00 .... .... .... .... .... .... .... ....
|
|
882 fcb $00,$00,$0F,$00 .... .... .... .... .... .... .... ....
|
|
883 * chars 60-67
|
|
884 fcb $22,$00,$00,$00 ..@. .... @... .... ...@ .... ..@@ ....
|
|
885 fcb $07,$99,$70,$00 ..@. .@@@ @@@. .@@@ .@@@ .@@@ .@.. .@@.
|
|
886 fcb $8E,$99,$E0,$00 .... @..@ @..@ @... @..@ @.@. @@@@ @..@
|
|
887 fcb $07,$88,$70,$00 .... @..@ @..@ @... @..@ @@.. .@.. @..@
|
|
888 fcb $17,$99,$70,$00 .... .@@@ @@@. .@@@ .@@@ .@@@ .@.. .@@@
|
|
889 fcb $07,$AC,$70,$00 .... .... .... .... .... .... .... ...@
|
|
890 fcb $34,$F4,$40,$00 .... .... .... .... .... .... .... @@@.
|
|
891 fcb $06,$99,$71,$E0 .... .... .... .... .... .... .... ....
|
|
892 * chars 68-6f
|
|
893 fcb $8E,$99,$90,$00 @... .@.. ..@. @... .@.. .... .... ....
|
|
894 fcb $40,$44,$40,$00 @@@. .... .... @.@. .@.. .@@@ .@@@ .@@.
|
|
895 fcb $20,$22,$22,$C0 @..@ .@.. ..@. @@.. .@.. @@.@ @..@ @..@
|
|
896 fcb $8A,$CA,$90,$00 @..@ .@.. ..@. @.@. .@.. @@.@ @..@ @..@
|
|
897 fcb $44,$44,$40,$00 @..@ .@.. ..@. @..@ .@.. @..@ @..@ .@@.
|
|
898 fcb $0E,$DD,$90,$00 .... .... ..@. .... .... .... .... ....
|
|
899 fcb $0E,$99,$90,$00 .... .... @@.. .... .... .... .... ....
|
|
900 fcb $06,$99,$60,$00 .... .... .... .... .... .... .... ....
|
|
901 * chars 70-77
|
|
902 fcb $0E,$99,$E8,$80 .... .... .... .... .@.. .... .... ....
|
|
903 fcb $07,$99,$71,$10 @@@. .@@@ .@@@ .@@@ @@@@ @..@ @..@ @..@
|
|
904 fcb $07,$88,$80,$00 @..@ @..@ @... @@.. .@.. @..@ @..@ @@.@
|
|
905 fcb $07,$C3,$E0,$00 @..@ @..@ @... ..@@ .@.. @..@ .@@. @@.@
|
|
906 fcb $4F,$44,$30,$00 @@@. .@@@ @... @@@. ..@@ .@@@ .@@. .@@.
|
|
907 fcb $09,$99,$70,$00 @... ...@ .... .... .... .... .... ....
|
|
908 fcb $09,$96,$60,$00 @... ...@ .... .... .... .... .... ....
|
|
909 fcb $09,$DD,$60,$00 .... .... .... .... .... .... .... ....
|
|
910 * chars 78-7f
|
|
911 fcb $09,$66,$90,$00 .... .... .... ..@@ .@.. @@.. .... @@@@
|
|
912 fcb $09,$99,$71,$E0 @..@ @..@ @@@@ .@.. .@.. ..@. .@.@ @@@@
|
|
913 fcb $0F,$24,$F0,$00 .@@. @..@ ..@. @@.. .... ..@@ @.@. @@@@
|
|
914 fcb $34,$C4,$30,$00 .@@. @..@ .@.. .@.. .@.. ..@. .... @@@@
|
|
915 fcb $44,$04,$40,$00 @..@ .@@@ @@@@ ..@@ .@.. @@.. .... @@@@
|
|
916 fcb $C2,$32,$C0,$00 .... ...@ .... .... .... .... .... @@@@
|
|
917 fcb $05,$A0,$00,$00 .... @@@. .... .... .... .... .... @@@@
|
|
918 fcb $FF,$FF,$FF,$F0 .... .... .... .... .... .... .... ....
|
|
919
|
|
920 emod
|
|
921 eom equ *
|
|
922 end
|