move DrawPage to ui.font with other drawing routines

This commit is contained in:
4am 2019-09-10 00:32:30 -04:00
parent 7ab4dd136e
commit d233ad6074
2 changed files with 62 additions and 62 deletions

View File

@ -18,70 +18,14 @@ Credits
lda OffscreenPage
ror ; draw on offscreen page
+LDADDR $8000
jsr .DrawPage
jsr ShowOtherPage
jsr WaitForKeyFor30Seconds
jsr ShowOtherPage
bit CLEARKBD
clc
jsr DrawPage ; draw credits
jsr ShowOtherPage ; show credits
jsr WaitForKeyFor30Seconds; wait
bit CLEARKBD ; don't care about key
jsr ShowOtherPage ; back to previous page
clc ; if called from search mode, tell caller not to refresh
rts
.CreditsFile
!byte 7
!text "CREDITS"
.DrawPage
; A/Y contains address of character buffer
; carry bit clear -> draw on page 1
; carry bit set -> draw on page 2
; drawing starts at VTAB 0, HTAB 0
; clobbers PTR
; clobbers A/X/Y
; preserves all flags, by a quirk of implementation
php
ldx #0
stx VTAB
+STAY PTR
@drawLine
ldy #0
sty HTAB
@parseLine
lda (PTR),y
cmp #$5B ; '[' at beginning on line
bne + ; ends the parsing
tya
beq @donePage
+ cmp #$0D
beq @doneParsingLine
cmp #$2A
bne +
lda #$10
sta (PTR),y ; asterisk -> dot, small
+ cmp #$7E
bne +
lda #$11
sta (PTR),y ; tilde -> dot, medium
+ iny
bne @parseLine
@doneParsingLine
sty SAVE
cpy #0
beq @skip
ldx SAVE
+LDAY PTR
plp
php
jsr DrawBuffer
@skip inc SAVE ; skip carriage return
lda SAVE ; advance PTR to start of next line
clc
adc PTR
sta PTR
bcc +
inc PTR+1
+ inc VTAB ; this will print 255 lines if you give it
bne @drawLine ; 255 lines, so don't do that
@donePage
plp
rts
}

View File

@ -4,11 +4,67 @@
; hi-res font drawing routines
;
; Public functions
; - DrawPage
; - Draw40Chars
; - DrawString
; - DrawBuffer
;
DrawPage
; A/Y contains address of character buffer
; carry bit clear -> draw on page 1
; carry bit set -> draw on page 2
; drawing starts at VTAB 0, HTAB 0
; clobbers PTR
; clobbers A/X/Y
; preserves all flags, by a quirk of implementation
php
ldx #0
stx VTAB
+STAY PTR
@drawLine
ldy #0
sty HTAB
@parseLine
lda (PTR),y
cmp #$5B ; '[' at beginning on line
bne + ; ends the parsing
tya
beq @donePage
+ cmp #$0D
beq @doneParsingLine
cmp #$2A
bne +
lda #$10
sta (PTR),y ; asterisk -> dot, small
+ cmp #$7E
bne +
lda #$11
sta (PTR),y ; tilde -> dot, medium
+ iny
bne @parseLine
@doneParsingLine
sty SAVE
cpy #0
beq @skip
ldx SAVE
+LDAY PTR
plp
php
jsr DrawBuffer
@skip inc SAVE ; skip carriage return
lda SAVE ; advance PTR to start of next line
clc
adc PTR
sta PTR
bcc +
inc PTR+1
+ inc VTAB ; this will print 255 lines if you give it
bne @drawLine ; 255 lines, so don't do that
@donePage
plp
rts
Draw40Chars
; A/Y contains address of character buffer
; carry bit clear -> draw on page 1