4cade/src/ui.credits.a

88 lines
2.0 KiB
Plaintext
Raw Normal View History

2019-07-10 17:37:59 +00:00
;license:MIT
;(c) 2018-9 by 4am
;
; credits page
;
; Public functions
; - Credits
!zone {
Credits
; clobbers all
2019-09-10 02:38:17 +00:00
jsr LoadFile ; load credits text into $8000
!word kRootDirectory
!word .CreditsFile
!word $8000
2019-07-10 17:37:59 +00:00
jsr ClearOffscreen
lda OffscreenPage
ror ; draw on offscreen page
+LDADDR $8000
jsr .DrawPage
jsr ShowOtherPage
jsr WaitForKeyFor30Seconds
jsr ShowOtherPage
bit CLEARKBD
clc
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
}