space_bars: print some text

This commit is contained in:
Vince Weaver 2018-08-01 23:35:23 -04:00
parent af0cdc4a61
commit 0d8fa4ea5a
4 changed files with 116 additions and 1 deletions

View File

@ -14,7 +14,7 @@ space_bars.dsk: SPACE_BARS
SPACE_BARS: space_bars.o
ld65 -o SPACE_BARS space_bars.o -C ../linker_scripts/apple2_1000.inc
space_bars.o: space_bars.s gr_copy.s title.s \
space_bars.o: space_bars.s instructions.s gr_copy.s text_print.s title.s \
spacebars_title.inc
ca65 -o space_bars.o space_bars.s -l space_bars.lst

50
space_bars/instructions.s Normal file
View File

@ -0,0 +1,50 @@
;================================
; Show some instructions
; return when a key is pressed
;================================
instructions:
;===================
; init screen
jsr TEXT
jsr HOME
bit KEYRESET
;===================
; init vars
lda #0
sta DRAW_PAGE
lda #<inst_text
sta OUTL
lda #>inst_text
sta OUTH
jsr move_and_print
jsr move_and_print
jsr wait_until_keypressed ; tail call?
rts
; 0 1 2 3
; 0123456789012345678901234567890123456789
inst_text:
.byte 6, 0, "*** RASTERBARS IN SPACE ***",0
.byte 8, 3, "BY VINCE 'DEATER' WEAVER",0
.asciiz "WWW.DEATER.NET/WEAVE/VMWPROD"
.asciiz "======================================="
.asciiz "ARROWS, WASD: STEER"
.asciiz "Z: ACCELERATE"
.asciiz "SPACE: FIRE"
.asciiz "ESC: QUITS"
.asciiz "M: TOGGLE SOUND, CURRENTLY ON"

View File

@ -22,6 +22,8 @@ DRAW_PAGE = $EE
LASTKEY = $F1
PADDLE_STATUS = $F2
TEMP = $FA
OUTL = $FE
OUTH = $FF
; Soft Switches
KEYPRESS= $C000
@ -53,6 +55,8 @@ WAIT = $FCA8 ;; delay 1/2(26+27A+5A^2) us
; Display Text
;==================
jsr instructions
;==================
; Mode7
;==================
@ -117,6 +121,8 @@ gr_offsets:
.include "../asm_routines/keypress.s"
.include "gr_copy.s"
.include "title.s"
.include "instructions.s"
.include "text_print.s"
.include "spacebars_title.inc"

59
space_bars/text_print.s Normal file
View File

@ -0,0 +1,59 @@
;================================
; move_and_print
;================================
; get X,Y from OUTL/OUTH
; then print following string to that address
; stop at NUL
; convert to APPLE ASCII (or with 0x80)
; leave OUTL/OUTH pointing to next string
move_and_print:
ldy #0
lda (OUTL),Y
sta CH
iny
lda (OUTL),Y
asl
tay
lda gr_offsets,Y ; lookup low-res memory address
clc
adc CH ; add in xpos
sta BASL ; store out low byte of addy
lda gr_offsets+1,Y ; look up high byte
adc DRAW_PAGE ;
sta BASH ; and store it out
; BASH:BASL now points at right place
clc
lda OUTL
adc #2
sta OUTL
lda OUTH
adc #0
sta OUTH
;================================
; print_string
;================================
print_string:
ldy #0
print_string_loop:
lda (OUTL),Y
beq done_print_string
ora #$80
sta (BASL),Y
iny
bne print_string_loop
done_print_string:
iny
clc
tya
adc OUTL
sta OUTL
lda OUTH
adc #0
sta OUTH
rts