fish: add help text

This commit is contained in:
Vince Weaver 2024-06-08 16:31:22 -04:00
parent 7bc9935dfe
commit a788cbdd99
4 changed files with 369 additions and 34 deletions

View File

@ -110,12 +110,70 @@ wait_at_tile:
;===================
; print directions
;===================
; in the actual game this is overlay ontop of the faded gameplay
; that would be a pain so we're not going to do it
lda #$0
sta DRAW_PAGE
jsr clear_all
bit LORES
bit FULLGR
bit SET_TEXT
bit PAGE1
lda #<help_text
sta OUTL
lda #>help_text
sta OUTH
jsr set_normal ; normal text
ldx #9
print_help:
jsr move_and_print
dex
bne print_help
wait_at_directions:
lda KEYPRESS
bpl wait_at_directions
bit KEYRESET
;===================
; setup game
;===================
; lda #0
; sta DRAW_PAGE
jmp skip_ahead
help_text:
.byte 0,0,"INSTRUCTIONS:",0
.byte 5,3,"- PRESS 'J' TO JIG",0
.byte 5,4,"- PRESS 'L' TO LURE",0
.byte 5,7,"SOME FISH RESPOND TO LURES,",0
.byte 5,8,"OTHERS TO JIGS.",0
.byte 5,11,"CATCH MORE FISH FOR MAXIMUM",0
.byte 5,12,"FUNTIME!",0
.byte 13,20,"PRESS SPACEBAR!",0 ; note, flash?
sound_data_fish:
.incbin "sounds/fish.btc.zx02"
sound_data_boat:
.incbin "sounds/get_in_boat.btc.zx02"
title_data:
.incbin "graphics/fish_title.hgr.zx02"
skip_ahead:
;==========================
; Load Background
;===========================
@ -140,43 +198,18 @@ load_background:
;===================
; set up variables
.if 0
lda #16
sta STRONGBAD_X
sta PLAYER_X
lda #1
sta STRONGBAD_DIR
sta BULLET_YDIR
lda #SHIELD_DOWN
sta SHIELD_POSITION
sta SHIELD_COUNT
bit HIRES
bit FULLGR
bit SET_GR
bit PAGE1
lda #0
sta BULLET_X_L
sta BULLET_X_VEL
sta HEAD_DAMAGE
; re-set up hgr tables
lda #$80
sta BULLET_X_VEL_L
lda #20
sta BULLET_X
lda #0
sta BULLET_Y
.endif
jmp main_loop
sound_data_fish:
.incbin "sounds/fish.btc.zx02"
sound_data_boat:
.incbin "sounds/get_in_boat.btc.zx02"
title_data:
.incbin "graphics/fish_title.hgr.zx02"
lda #$20
sta HGR_PAGE
jsr hgr_make_tables
@ -468,12 +501,15 @@ bg_data:
.include "zx02_optim.s"
.include "gr_fast_clear.s"
.include "hgr_tables.s"
.include "hgr_sprite_big.s"
.include "hgr_copy_fast.s"
; .include "hgr_copy_fast.s"
.include "audio.s"
.include "play_sounds.s"
.include "text_print.s"
.include "gr_offsets.s"
.include "graphics/boat_sprites.inc"
.include "graphics/strongbad_sprites.inc"

View File

@ -0,0 +1,201 @@
;clear_screens:
; ;===================================
; ; Clear top/bottom of page 0
; ;===================================
;
; lda #$0
; sta DRAW_PAGE
; jsr clear_top
; jsr clear_bottom
; ;===================================
; ; Clear top/bottom of page 1
; ;===================================
;
; lda #$4
; sta DRAW_PAGE
; jsr clear_top
; jsr clear_bottom
;
; rts
;=========================================================
; clear_top
;=========================================================
; clear DRAW_PAGE
; original = 14,558 cycles(?) 15ms, 70Hz
; OPTIMIZED MAX (page0,48rows): 45*120+4+6 = 5410 = 5.4ms 185Hz
; (pageX,40rows): 50*120+4+6 = 6010 = 6.0ms 166Hz
; 50*120+4+6+37 = 6055 = 6.0ms 166Hz
clear_top:
lda #0 ; 2
clear_top_a:
sta COLOR ; 3
clc ; 2
lda DRAW_PAGE ; 3
adc #4 ; 2
sta __ctf+2 ; 3
sta __ctf+5 ; 3
adc #1 ; 2
sta __ctf+8 ; 3
sta __ctf+11 ; 3
adc #1 ; 2
sta __ctf2+2 ; 3
sta __ctf2+5 ; 3
adc #1 ; 2
sta __ctf2+8 ; 3
sta __ctf2+11 ; 3
ldy #120 ; 2
lda COLOR ; 3
clear_top_fast_loop:
__ctf:
sta $400,Y ; 5
sta $480,Y ; 5
sta $500,Y ; 5
sta $580,Y ; 5
cpy #80 ; 2
bpl no_draw_bottom ; 2nt/3
__ctf2:
sta $600,Y ; 5
sta $680,Y ; 5
sta $700,Y ; 5
sta $780,Y ; 5
no_draw_bottom:
dey ; 2
bpl clear_top_fast_loop ; 2nt/3
rts ; 6
;=========================================================
; clear_bottom
;=========================================================
; clear bottom of draw page
clear_bottom:
clc ; 2
lda DRAW_PAGE ; 3
adc #6 ; 2
sta __cbf2+2 ; 3
sta __cbf2+5 ; 3
adc #1 ; 2
sta __cbf2+8 ; 3
sta __cbf2+11 ; 3
ldy #120 ; 2
lda #$a0 ; Normal Space ; 2
clear_bottom_fast_loop:
__cbf2:
sta $600,Y ; 5
sta $680,Y ; 5
sta $700,Y ; 5
sta $780,Y ; 5
dey ; 2
cpy #80 ; 2
bpl clear_bottom_fast_loop ; 2nt/3
rts ; 6
;clear_screens_notext:
;===================================
; Clear top/bottom of page 0
;===================================
; lda #$0
; sta DRAW_PAGE
; jsr clear_all
;===================================
; Clear top/bottom of page 1
;===================================
; lda #$4
; sta DRAW_PAGE
; jsr clear_all
; rts
clear_bottoms:
lda DRAW_PAGE
pha
;===================================
; Clear bottom of page 0
;===================================
lda #$0
sta DRAW_PAGE
jsr clear_bottom
;===================================
; Clear bottom of page 1
;===================================
lda #$4
sta DRAW_PAGE
jsr clear_bottom
pla
sta DRAW_PAGE
rts
;=========================================================
; clear_all
;=========================================================
; clear 48 rows
clear_all:
clc ; 2
lda DRAW_PAGE ; 3
adc #4 ; 2
sta __caf+2 ; 3
sta __caf+5 ; 3
adc #1 ; 2
sta __caf+8 ; 3
sta __caf+11 ; 3
adc #1 ; 2
sta __caf2+2 ; 3
sta __caf2+5 ; 3
adc #1 ; 2
sta __caf2+8 ; 3
sta __caf2+11 ; 3
ldy #120 ; 2
clear_all_color:
lda #' '|$80 ; 2
clear_all_fast_loop:
__caf:
sta $400,Y ; 5
sta $480,Y ; 5
sta $500,Y ; 5
sta $580,Y ; 5
__caf2:
sta $600,Y ; 5
sta $680,Y ; 5
sta $700,Y ; 5
sta $780,Y ; 5
dey ; 2
bpl clear_all_fast_loop ; 2nt/3
rts ; 6

View File

@ -0,0 +1,5 @@
gr_offsets:
.word $400,$480,$500,$580,$600,$680,$700,$780
.word $428,$4a8,$528,$5a8,$628,$6a8,$728,$7a8
.word $450,$4d0,$550,$5d0,$650,$6d0,$750,$7d0

View File

@ -0,0 +1,93 @@
;================================
; 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
ps_smc1:
and #$3f ; make sure we are inverse
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
; set normal text
set_normal:
lda #$80
sta ps_smc1+1
lda #09 ; ora
sta ps_smc1
rts
; restore inverse text
set_inverse:
lda #$29
sta ps_smc1
lda #$3f
sta ps_smc1+1
rts
;================================
; move and print a list of lines
;================================
; look for negative X meaning done
move_and_print_list:
jsr move_and_print
ldy #0
lda (OUTL),Y
bpl move_and_print_list
rts