From 0d8fa4ea5ae15b11acc4dcbda86515cb4dad7bc3 Mon Sep 17 00:00:00 2001 From: Vince Weaver Date: Wed, 1 Aug 2018 23:35:23 -0400 Subject: [PATCH] space_bars: print some text --- space_bars/Makefile | 2 +- space_bars/instructions.s | 50 +++++++++++++++++++++++++++++++++ space_bars/space_bars.s | 6 ++++ space_bars/text_print.s | 59 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 116 insertions(+), 1 deletion(-) create mode 100644 space_bars/instructions.s create mode 100644 space_bars/text_print.s diff --git a/space_bars/Makefile b/space_bars/Makefile index daa5907c..8121e24f 100644 --- a/space_bars/Makefile +++ b/space_bars/Makefile @@ -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 diff --git a/space_bars/instructions.s b/space_bars/instructions.s new file mode 100644 index 00000000..7f83b58c --- /dev/null +++ b/space_bars/instructions.s @@ -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 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" + + diff --git a/space_bars/space_bars.s b/space_bars/space_bars.s index a9d16c9b..09ddee9f 100644 --- a/space_bars/space_bars.s +++ b/space_bars/space_bars.s @@ -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" diff --git a/space_bars/text_print.s b/space_bars/text_print.s new file mode 100644 index 00000000..a0a930ad --- /dev/null +++ b/space_bars/text_print.s @@ -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