space_bars: more infrastructure

This commit is contained in:
Vince Weaver 2018-08-02 00:13:40 -04:00
parent 0d8fa4ea5a
commit a46ab96d51
5 changed files with 72 additions and 3 deletions

View File

@ -14,7 +14,8 @@ 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 instructions.s gr_copy.s text_print.s title.s \
space_bars.o: space_bars.s instructions.s game.s \
game_over.s gr_copy.s text_print.s title.s \
spacebars_title.inc
ca65 -o space_bars.o space_bars.s -l space_bars.lst

27
space_bars/game.s Normal file
View File

@ -0,0 +1,27 @@
;================================
; Show some instructions
; return when a key is pressed
;================================
game:
;===================
; init screen
bit LORES
bit SET_GR
bit FULLGR
bit KEYRESET
;===================
; init vars
lda #0
sta DRAW_PAGE
lda #0
jsr clear_gr
jsr wait_until_keypressed ; tail call?
rts

35
space_bars/game_over.s Normal file
View File

@ -0,0 +1,35 @@
;================================
; Print Game Over
;================================
game_over:
;===================
; init screen
jsr TEXT
jsr HOME
bit KEYRESET
;===================
; init vars
lda #0
sta DRAW_PAGE
lda #<game_over_text
sta OUTL
lda #>game_over_text
sta OUTH
jsr move_and_print
jsr wait_until_keypressed ; tail call?
rts
; 0 1 2 3
; 0123456789012345678901234567890123456789
game_over_text:
.byte 11, 10, "*** GAME OVER ***",0

Binary file not shown.

View File

@ -65,12 +65,16 @@ WAIT = $FCA8 ;; delay 1/2(26+27A+5A^2) us
; Rasterbars
;==================
jsr game
;==================
; Game Over
;==================
game_over:
jmp game_over
jsr game_over
loop_forever:
jmp loop_forever
@ -122,7 +126,9 @@ gr_offsets:
.include "gr_copy.s"
.include "title.s"
.include "instructions.s"
.include "game.s"
.include "text_print.s"
.include "game_over.s"
.include "spacebars_title.inc"