1173 lines
20 KiB
ArmAsm
Raw Normal View History

2024-06-05 00:56:26 -04:00
; Fishing Challenge '91
;
2024-06-05 17:01:31 -04:00
; "Are you asking for some sort of early-90s fishing challenge????"
;
2024-06-05 00:56:26 -04:00
; Yet Another HR project
;
; by deater (Vince Weaver) <vince@deater.net>
.include "zp.inc"
.include "hardware.inc"
2024-06-06 01:19:31 -04:00
; NOTES FROM WIKI
; green fish 50 or 100
; grey fish 100 points
; red fish 400 or 500
; bubbles easier to catch?
; grey = lures, red green = jigs
2024-06-05 17:01:31 -04:00
; NOTES
; hgr page1= $2000-$3fff
; hgr page2= $4000-$5fff
2024-06-12 20:28:00 -04:00
; code = $4000-$9fff (24k) code
; saved bg = $a000-$bfff
; note we have to be done with the code in page2 before
; we over-write it by playing the game
2024-06-05 17:01:31 -04:00
2024-06-05 00:56:26 -04:00
div7_table = $400
mod7_table = $500
hposn_high = $600
hposn_low = $700
fish_start:
;===================
; set graphics mode
;===================
jsr HOME
bit HIRES
bit FULLGR
bit SET_GR
bit PAGE1
;====================
; set up tables
;====================
lda #$20
sta HGR_PAGE
jsr hgr_make_tables
;==========================
; Load Sound
;===========================
lda SOUND_STATUS
and #SOUND_IN_LC
beq done_load_sound
; read/write RAM, use $d000 bank1
bit $C083
bit $C083
2024-06-05 17:01:31 -04:00
; fish = 4225 bytes load at $D000 - $E0FF
; boat = 4966 bytes load at $E100 - $F4FF
lda #<sound_data_fish
2024-06-05 00:56:26 -04:00
sta ZX0_src
2024-06-05 17:01:31 -04:00
lda #>sound_data_fish
2024-06-05 00:56:26 -04:00
sta ZX0_src+1
lda #$D0
jsr full_decomp
2024-06-05 17:01:31 -04:00
lda #<sound_data_boat
sta ZX0_src
lda #>sound_data_boat
sta ZX0_src+1
lda #$E1
jsr full_decomp
2024-06-05 00:56:26 -04:00
; read ROM/no-write
bit $C082
done_load_sound:
;==========================
; Load Title
;===========================
load_title:
lda #<title_data
sta ZX0_src
lda #>title_data
sta ZX0_src+1
lda #$20
jsr full_decomp
wait_at_tile:
lda KEYPRESS
bpl wait_at_tile
bit KEYRESET
2024-06-05 17:01:31 -04:00
;===================
; print directions
;===================
2024-06-08 16:31:22 -04:00
; 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
2024-06-05 17:01:31 -04:00
2024-06-08 16:31:22 -04:00
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 #7
2024-06-08 16:31:22 -04:00
print_help:
jsr move_and_print
dex
bne print_help
jsr set_flash ; have the "press spacebar" flash
jsr move_and_print
2024-06-08 16:31:22 -04:00
wait_at_directions:
lda KEYPRESS
bpl wait_at_directions
bit KEYRESET
2024-06-05 17:01:31 -04:00
2024-06-05 00:56:26 -04:00
;===================
; setup game
;===================
2024-06-08 16:31:22 -04:00
; 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:
2024-06-05 00:56:26 -04:00
;==========================
2024-06-05 17:01:31 -04:00
; Load Background
2024-06-05 00:56:26 -04:00
;===========================
2024-06-05 17:01:31 -04:00
load_background:
2024-06-05 00:56:26 -04:00
2024-06-05 17:01:31 -04:00
lda #<bg_data
2024-06-05 00:56:26 -04:00
sta ZX0_src
2024-06-05 17:01:31 -04:00
lda #>bg_data
2024-06-05 00:56:26 -04:00
sta ZX0_src+1
2024-06-12 20:28:00 -04:00
lda #$a0 ; background copy at $a000
2024-06-05 00:56:26 -04:00
jsr full_decomp
;===================
; set up variables
; have it show garbage on page2 briefly
; this is better than re-showing title
; ideally we'd just clear the screen I guess
2024-06-05 00:56:26 -04:00
bit PAGE2
2024-06-08 16:31:22 -04:00
bit HIRES
bit FULLGR
bit SET_GR
lda #$20
sta DRAW_PAGE
2024-06-05 00:56:26 -04:00
2024-06-08 16:31:22 -04:00
; re-set up hgr tables
2024-06-05 17:01:31 -04:00
2024-06-08 16:31:22 -04:00
lda #$20
sta HGR_PAGE
jsr hgr_make_tables
2024-06-08 00:59:56 -04:00
2024-06-12 12:45:58 -04:00
; init score
lda #$00
sta SCORE_L
sta SCORE_H
2024-06-12 12:45:58 -04:00
; init fish
2024-06-12 13:23:35 -04:00
lda #FISH_NONE
sta RED_FISH_STATE_PTR
sta GREY_FISH_STATE_PTR
sta GREEN_FISH_STATE_PTR
2024-06-12 15:41:46 -04:00
sta BUBBLE_STATE_PTR ; init bubble too
2024-06-08 00:59:56 -04:00
2024-06-05 17:01:31 -04:00
2024-06-05 00:56:26 -04:00
; start at least 8k in?
;==========================
; main loop
;===========================
main_loop:
2024-06-05 17:01:31 -04:00
2024-06-05 00:56:26 -04:00
2024-06-08 00:59:56 -04:00
jsr flip_page
2024-06-05 17:01:31 -04:00
2024-06-05 00:56:26 -04:00
;========================
;========================
; draw the scene
;========================
;========================
2024-06-05 00:56:26 -04:00
;==================================
; copy over (erase) old background
2024-06-05 00:56:26 -04:00
2024-06-12 20:28:00 -04:00
; this isn't fast, but much faster than decompressing
; we could be faster if we unrolled, or only
; did part of the screen
lda #$a0
2024-06-12 20:58:37 -04:00
sta bg_copy_in_smc+2
2024-06-08 00:59:56 -04:00
clc
lda DRAW_PAGE
adc #$20
2024-06-12 20:58:37 -04:00
sta bg_copy_out_smc+2
2024-06-12 20:28:00 -04:00
ldy #0
bg_copy_loop:
2024-06-12 20:58:37 -04:00
bg_copy_in_smc:
lda $A000,Y
bg_copy_out_smc:
sta $2000,Y
2024-06-12 20:28:00 -04:00
dey
bne bg_copy_loop
2024-06-12 20:58:37 -04:00
inc bg_copy_in_smc+2
inc bg_copy_out_smc+2
lda bg_copy_in_smc+2
2024-06-12 20:28:00 -04:00
cmp #$C0
bne bg_copy_loop
2024-06-05 00:56:26 -04:00
inc FRAME
;==========================
; draw boat
2024-06-05 00:56:26 -04:00
2024-06-08 00:59:56 -04:00
lda FRAME
2024-06-12 20:58:37 -04:00
lsr ; half the frame rate of rest
2024-06-08 00:59:56 -04:00
; lsr
and #$3
tax
lda boat_offsets,X
sta BOAT_OFFSET
lda boat_sprites_l,X
sta INL
lda boat_sprites_h,X
sta INH
lda #8
sta SPRITE_X
lda #94
sta SPRITE_Y
jsr hgr_draw_sprite_big
2024-06-05 00:56:26 -04:00
;===========================
; draw ripples
2024-06-12 16:53:42 -04:00
; should we do this last?
lda FRAME
and #$3
tax
lda ripple_l_sprites_l,X
sta INL
lda ripple_l_sprites_h,X
sta INH
lda #8
sta SPRITE_X
lda #136
sta SPRITE_Y
jsr hgr_draw_sprite
lda FRAME
and #$3
tax
lda ripple_r_sprites_l,X
sta INL
lda ripple_r_sprites_h,X
sta INH
lda #32
sta SPRITE_X
lda #139
sta SPRITE_Y
jsr hgr_draw_sprite
2024-06-05 00:56:26 -04:00
;===========================
; draw strong bad
2024-06-05 00:56:26 -04:00
2024-06-08 00:59:56 -04:00
draw_strong_bad:
2024-06-05 00:56:26 -04:00
2024-06-08 00:59:56 -04:00
lda ANIMATION_TYPE
cmp #ANIMATION_LURE
beq draw_lure_animation
cmp #ANIMATION_JIG
beq draw_jig_animation
2024-06-05 00:56:26 -04:00
2024-06-08 00:59:56 -04:00
draw_regular_animation:
lda #<sb_sprite
sta INL
lda #>sb_sprite
sta INH
2024-06-05 00:56:26 -04:00
2024-06-08 00:59:56 -04:00
lda #23
sta SPRITE_X
lda #42
sta SPRITE_Y
2024-06-05 00:56:26 -04:00
2024-06-08 00:59:56 -04:00
jmp draw_common_animation
2024-06-05 00:56:26 -04:00
2024-06-08 00:59:56 -04:00
draw_lure_animation:
ldx ANIMATION_COUNT
lda lure_sprites_l,X
sta INL
lda lure_sprites_h,X
sta INH
lda #23
sta SPRITE_X
lda #42
sta SPRITE_Y
2024-06-12 20:58:37 -04:00
jmp update_animation
2024-06-05 00:56:26 -04:00
2024-06-08 00:59:56 -04:00
draw_jig_animation:
ldx ANIMATION_COUNT
lda jig_sprites_l,X
2024-06-05 00:56:26 -04:00
sta INL
2024-06-08 00:59:56 -04:00
lda jig_sprites_h,X
2024-06-05 00:56:26 -04:00
sta INH
2024-06-08 00:59:56 -04:00
lda #22
2024-06-05 00:56:26 -04:00
sta SPRITE_X
2024-06-08 00:59:56 -04:00
lda #27
sta SPRITE_Y
update_animation:
dec ANIMATION_COUNT
bpl draw_common_animation
; done
lda #ANIMATION_NONE
sta ANIMATION_TYPE
draw_common_animation:
lda SPRITE_Y
clc
adc BOAT_OFFSET
2024-06-05 00:56:26 -04:00
sta SPRITE_Y
2024-06-08 00:59:56 -04:00
2024-06-05 00:56:26 -04:00
jsr hgr_draw_sprite_big
2024-06-12 14:06:45 -04:00
;============================
2024-06-05 17:01:31 -04:00
;============================
2024-06-12 12:45:58 -04:00
; handle fish
;============================
2024-06-12 14:06:45 -04:00
;============================
2024-06-12 22:07:26 -04:00
handle_fish:
2024-06-12 12:45:58 -04:00
2024-06-12 14:06:45 -04:00
;============================
; deploy fish
;============================
2024-06-12 22:07:26 -04:00
; if fish not out, randomly start one
; not sure how the actual game does it
; we're going to only do this every 8th frame
; pick random number
; 0..79 try red
; 80..159 try green
; 160..240 try grey
deploy_fish:
lda FRAME
and #$f
bne done_deploy_fish
jsr random16
cmp #80
bcc deploy_red_fish
cmp #160
bcc deploy_green_fish
cmp #240
bcc deploy_grey_fish
bcs done_deploy_fish
deploy_red_fish:
2024-06-12 13:23:35 -04:00
lda RED_FISH_STATE_PTR
2024-06-12 19:35:39 -04:00
cmp #$ff
2024-06-12 22:07:26 -04:00
bne done_deploy_fish ; #$ff means fish is not active
2024-06-12 12:45:58 -04:00
2024-06-12 15:11:58 -04:00
; create new red/big fish
2024-06-12 19:35:39 -04:00
lda #0
sta RED_FISH_STATE_PTR
2024-06-12 13:23:35 -04:00
2024-06-12 14:06:45 -04:00
lda #FISH_SPRITE_LONG
; lda #FISH_SPRITE_RED
2024-06-12 14:06:45 -04:00
sta RED_FISH_SPRITE
2024-06-12 13:23:35 -04:00
lda #17
sta RED_FISH_X
lda #180
sta RED_FISH_Y
2024-06-12 12:45:58 -04:00
2024-06-12 22:07:26 -04:00
jmp done_deploy_fish
deploy_grey_fish:
2024-06-12 14:06:45 -04:00
lda GREY_FISH_STATE_PTR
2024-06-12 19:35:39 -04:00
cmp #$ff
2024-06-12 22:07:26 -04:00
bne done_deploy_fish ; $FF means fish is not active
2024-06-12 14:06:45 -04:00
2024-06-12 15:11:58 -04:00
; create new grey/left fish
2024-06-12 22:07:26 -04:00
lda #0
sta GREY_FISH_STATE_PTR
2024-06-12 14:06:45 -04:00
lda #FISH_SPRITE_LEFT
sta GREY_FISH_SPRITE
lda #31
sta GREY_FISH_X
2024-06-12 22:07:26 -04:00
lda #164
2024-06-12 14:06:45 -04:00
sta GREY_FISH_Y
2024-06-12 22:07:26 -04:00
jmp done_deploy_fish
deploy_green_fish:
2024-06-12 14:06:45 -04:00
lda GREEN_FISH_STATE_PTR
2024-06-12 19:35:39 -04:00
cmp #$FF
2024-06-12 22:07:26 -04:00
bne done_deploy_fish ; $FF means fish is not active
2024-06-12 14:06:45 -04:00
2024-06-12 15:11:58 -04:00
; create new green/right fish
2024-06-12 22:07:26 -04:00
lda #0
sta GREEN_FISH_STATE_PTR
2024-06-12 14:06:45 -04:00
lda #FISH_SPRITE_RIGHT
sta GREEN_FISH_SPRITE
lda #11
sta GREEN_FISH_X
lda #146
sta GREEN_FISH_Y
2024-06-12 22:07:26 -04:00
done_deploy_fish:
2024-06-12 12:45:58 -04:00
; draw red fish
draw_red_fish:
2024-06-12 13:23:35 -04:00
ldx RED_FISH_STATE_PTR
2024-06-12 19:35:39 -04:00
cpx #$FF
beq draw_grey_fish ; $FF means no fish
2024-06-12 12:45:58 -04:00
2024-06-12 13:23:35 -04:00
ldy red_fish_behavior,X
2024-06-12 12:45:58 -04:00
2024-06-12 13:23:35 -04:00
ldx #0 ; which fish
2024-06-12 12:45:58 -04:00
2024-06-12 13:23:35 -04:00
jsr draw_fish
2024-06-12 12:45:58 -04:00
draw_grey_fish:
2024-06-12 14:06:45 -04:00
ldx GREY_FISH_STATE_PTR ; negative means no fish
2024-06-12 19:35:39 -04:00
cpx #$FF
beq draw_green_fish
2024-06-12 14:06:45 -04:00
ldy grey_fish_behavior,X
2024-06-11 16:41:38 -04:00
2024-06-12 14:06:45 -04:00
ldx #1 ; which fish
2024-06-11 16:41:38 -04:00
2024-06-12 14:06:45 -04:00
jsr draw_fish
2024-06-11 16:41:38 -04:00
2024-06-12 14:06:45 -04:00
draw_green_fish:
2024-06-11 16:41:38 -04:00
2024-06-12 14:06:45 -04:00
ldx GREEN_FISH_STATE_PTR ; negative means no fish
2024-06-12 22:07:26 -04:00
cpx #$ff
2024-06-12 19:35:39 -04:00
beq done_draw_fish
2024-06-11 16:41:38 -04:00
2024-06-12 14:06:45 -04:00
ldy green_fish_behavior,X
ldx #2 ; which fish
jsr draw_fish
2024-06-11 16:41:38 -04:00
2024-06-12 14:06:45 -04:00
done_draw_fish:
2024-06-11 16:41:38 -04:00
2024-06-05 17:01:31 -04:00
;============================
2024-06-12 15:41:46 -04:00
; draw bubble
;============================
; yes there should be multiple bubbles possible at same time
; but I got lazy
draw_bubble:
ldx BUBBLE_STATE_PTR
bmi done_draw_bubble
cpx #6
bcc bubble_not_done
; disable bubble and don't draw
ldx #$FF
stx BUBBLE_STATE_PTR
bmi done_draw_bubble
bubble_not_done:
; set up co-ords
lda BUBBLE_X
sta SPRITE_X
lda BUBBLE_Y
sta SPRITE_Y
; set up sprite
lda bubble_sprite_table_l,X
sta INL
lda bubble_sprite_table_h,X
sta INH
; set up mask
lda bubble_mask_table_l,X
sta MASKL
lda bubble_mask_table_h,X
sta MASKH
jsr hgr_draw_sprite_mask
inc BUBBLE_STATE_PTR ; point to next state
dec BUBBLE_Y ; have bubble float up a bit
2024-06-12 22:07:26 -04:00
dec BUBBLE_Y
2024-06-12 15:41:46 -04:00
done_draw_bubble:
;==========================
; draw score
2024-06-12 15:41:46 -04:00
;==========================
jsr draw_score
2024-06-05 00:56:26 -04:00
2024-06-05 17:01:31 -04:00
;============================
2024-06-05 00:56:26 -04:00
; play sound
2024-06-05 17:01:31 -04:00
;============================
2024-06-05 00:56:26 -04:00
2024-06-05 17:01:31 -04:00
; ldy #5
; jsr play_asplode
2024-06-05 00:56:26 -04:00
;===========================
2024-06-05 17:01:31 -04:00
; check keypress
2024-06-05 00:56:26 -04:00
;===========================
check_keypress:
lda KEYPRESS
bpl done_keyboard_check
bit KEYRESET ; clear the keyboard strobe
; clear high bit
and #$7f
cmp #27 ; escape
beq done_game
; do this after or else '/' counts as escape
and #$df ; convert lowercase to upper
2024-06-05 17:01:31 -04:00
cmp #'J' ; jig
beq do_jig
cmp #'L' ; lure
beq do_lure
2024-06-05 00:56:26 -04:00
done_keyboard_check:
jmp main_loop
2024-06-12 17:07:34 -04:00
;======================
; "get in boat"/jig
2024-06-05 17:01:31 -04:00
do_jig:
jsr play_boat ; `come on and get in the boat'
2024-06-08 00:59:56 -04:00
lda #ANIMATION_JIG
sta ANIMATION_TYPE
lda #10
sta ANIMATION_COUNT
2024-06-12 17:07:34 -04:00
; FIXME: see if valid fish
; FIXME: make fish visible
2024-06-12 19:35:39 -04:00
ldx #FISH_SPRITE_RED
stx RED_FISH_SPRITE
2024-06-12 17:07:34 -04:00
; FIXME: start fish on catch path
2024-06-12 19:35:39 -04:00
lda #<(catch_fish_behavior-red_fish_behavior)
sta RED_FISH_STATE_PTR
2024-06-12 17:07:34 -04:00
; FIXME: update proper score
ldx #0
jsr update_score
2024-06-05 00:56:26 -04:00
jmp main_loop
2024-06-12 17:07:34 -04:00
;======================
; "fish fish"/lure
2024-06-05 17:01:31 -04:00
do_lure:
jsr play_fish ; 'fish'
2024-06-08 00:59:56 -04:00
lda #ANIMATION_LURE
sta ANIMATION_TYPE
lda #10
sta ANIMATION_COUNT
2024-06-05 00:56:26 -04:00
jmp main_loop
;==========================
; done game
;==========================
done_game:
lda #0
really_done_game:
sta WHICH_LOAD
rts
2024-06-05 17:01:31 -04:00
.if 0
2024-06-05 00:56:26 -04:00
wait_until_keypress:
lda KEYPRESS ; 4
bpl wait_until_keypress ; 3
bit KEYRESET ; clear the keyboard buffer
rts
2024-06-08 00:59:56 -04:00
.endif
2024-06-05 00:56:26 -04:00
;==========
; flip page
;==========
flip_page:
lda DRAW_PAGE
beq draw_page2
draw_page1:
bit PAGE2
lda #0
beq done_flip
draw_page2:
bit PAGE1
lda #$20
done_flip:
sta DRAW_PAGE
rts
2024-06-08 00:59:56 -04:00
;===================================
; draw score
;===================================
; score is at 6,7,8,9,10. 10 is always 0
draw_score:
lda SCORE_L
and #$f
tax
lda #9
jsr actual_draw_score
lda SCORE_L
lsr
lsr
lsr
lsr
tax
lda #8
jsr actual_draw_score
lda SCORE_H
and #$f
tax
lda #7
jsr actual_draw_score
lda SCORE_H
lsr
lsr
lsr
lsr
tax
lda #6
; jsr actual_draw_score
; rts
actual_draw_score:
sta SPRITE_X
lda numbers_l,X
sta INL
lda numbers_h,X
sta INH
lda #177
sta SPRITE_Y
jmp hgr_draw_sprite
; rts
;====================================
; update score
;====================================
; offset of update value in X
; score is BCD and in SCORE_H,SCORE_L
update_score:
sed
lda score_values,X
clc
adc SCORE_L
sta SCORE_L
lda #0
adc SCORE_H
sta SCORE_H
cld
rts
score_values:
; 50 100 400 500
.byte $05, $10, $40, $50
2024-06-12 13:23:35 -04:00
;============================
;============================
; draw_fish
;============================
;============================
; X=which fish
; Y=current fish behavior
draw_fish:
; update fish state, use jump table
update_fish:
lda fish_state_dest_h,Y
pha
lda fish_state_dest_l,Y
pha
rts
done_update_fish:
2024-06-12 14:06:45 -04:00
inc RED_FISH_STATE_PTR,X ; point to next state
; set up co-ords
lda RED_FISH_X,X
sta SPRITE_X
lda RED_FISH_Y,X
sta SPRITE_Y
2024-06-12 13:23:35 -04:00
; set up sprite
2024-06-12 15:11:58 -04:00
lda RED_FISH_SPRITE,X
tax
2024-06-12 14:06:45 -04:00
lda fish_sprite_table_l,X
2024-06-12 13:23:35 -04:00
sta INL
2024-06-12 14:06:45 -04:00
lda fish_sprite_table_h,X
2024-06-12 13:23:35 -04:00
sta INH
; set up mask
2024-06-12 14:06:45 -04:00
lda fish_mask_table_l,X
2024-06-12 13:23:35 -04:00
sta MASKL
2024-06-12 14:06:45 -04:00
lda fish_mask_table_h,X
2024-06-12 13:23:35 -04:00
sta MASKH
jsr hgr_draw_sprite_mask
no_draw_fish:
rts
fish_state_dest_l:
.byte <(move_fish_pause-1),<(move_fish_up-1),<(move_fish_bubble-1)
2024-06-12 22:07:26 -04:00
.byte <(move_fish_right-1),<(move_fish_left-1)
2024-06-12 13:23:35 -04:00
.byte <(move_fish_left_up-1),<(move_fish_left_down-1)
.byte <(move_fish_flip-1)
.byte <(move_fish_done-1)
2024-06-12 22:07:26 -04:00
.byte <(move_fish_right_up-1),<(move_fish_right_down-1)
2024-06-12 17:07:34 -04:00
.byte <(move_fish_catch_up-1),<(move_fish_catch_down-1)
2024-06-12 13:23:35 -04:00
fish_state_dest_h:
.byte >(move_fish_pause-1),>(move_fish_up-1),>(move_fish_bubble-1)
2024-06-12 22:07:26 -04:00
.byte >(move_fish_right-1),>(move_fish_left-1)
2024-06-12 13:23:35 -04:00
.byte >(move_fish_left_up-1),>(move_fish_left_down-1)
.byte >(move_fish_flip-1)
.byte >(move_fish_done-1)
2024-06-12 22:07:26 -04:00
.byte >(move_fish_right_up-1),>(move_fish_right_down-1)
2024-06-12 17:07:34 -04:00
.byte >(move_fish_catch_up-1),>(move_fish_catch_down-1)
2024-06-12 13:23:35 -04:00
move_fish_done:
lda #FISH_NONE ; disable fish
sta RED_FISH_STATE_PTR,X
jmp no_draw_fish
2024-06-12 17:07:34 -04:00
move_fish_catch_up:
inc RED_FISH_X,X ; move right
2024-06-12 13:23:35 -04:00
move_fish_up:
dec RED_FISH_Y,X ; move up by two
dec RED_FISH_Y,X
jmp done_update_fish
2024-06-12 17:07:34 -04:00
move_fish_catch_down:
inc RED_FISH_Y,X ; move down by two
inc RED_FISH_Y,X
2024-06-12 13:23:35 -04:00
move_fish_right:
2024-06-12 14:06:45 -04:00
inc RED_FISH_X,X ; move right
2024-06-12 13:23:35 -04:00
jmp done_update_fish
2024-06-12 22:07:26 -04:00
move_fish_right_up:
dec RED_FISH_Y,X ; move up by one
inc RED_FISH_X,X ; move right
jmp done_update_fish
move_fish_right_down:
inc RED_FISH_Y,X ; move down by one
inc RED_FISH_X,X ; move right
jmp done_update_fish
2024-06-12 13:23:35 -04:00
move_fish_left_up:
2024-06-12 14:06:45 -04:00
dec RED_FISH_Y,X ; move up by one
; dec RED_FISH_Y,X
2024-06-12 22:07:26 -04:00
move_fish_left:
2024-06-12 14:06:45 -04:00
dec RED_FISH_X,X ; move left
jmp done_update_fish
2024-06-12 22:07:26 -04:00
2024-06-12 13:23:35 -04:00
move_fish_left_down:
2024-06-12 14:06:45 -04:00
inc RED_FISH_Y,X ; move down by one
; inc RED_FISH_Y,X
dec RED_FISH_X,X ; move left
jmp done_update_fish
2024-06-12 13:23:35 -04:00
move_fish_flip:
2024-06-12 14:06:45 -04:00
lda #FISH_SPRITE_RIGHT
sta RED_FISH_SPRITE,X
2024-06-12 13:23:35 -04:00
jmp done_update_fish
2024-06-12 14:06:45 -04:00
move_fish_bubble:
2024-06-12 15:41:46 -04:00
lda #0
sta BUBBLE_STATE_PTR
lda RED_FISH_X,X
sta BUBBLE_X
2024-06-12 19:35:39 -04:00
inc BUBBLE_X ; more likely to be from head
2024-06-12 22:07:26 -04:00
inc BUBBLE_X ; more likely to be from head
2024-06-12 15:41:46 -04:00
lda RED_FISH_Y,X
sta BUBBLE_Y
jmp done_update_fish
2024-06-12 22:07:26 -04:00
2024-06-12 14:06:45 -04:00
move_fish_pause:
jmp done_update_fish
2024-06-12 13:23:35 -04:00
2024-06-12 14:06:45 -04:00
fish_sprite_table_l:
.byte <big_fish_sprite,<left_fish_sprite,<right_fish_sprite
.byte <red_fish_sprite,<grey_fish_sprite,<green_fish_sprite
fish_sprite_table_h:
.byte >big_fish_sprite,>left_fish_sprite,>right_fish_sprite
.byte >red_fish_sprite,>grey_fish_sprite,>green_fish_sprite
fish_mask_table_l:
2024-06-12 15:11:58 -04:00
.byte <big_fish_mask,<left_fish_mask,<right_fish_mask
2024-06-12 14:06:45 -04:00
.byte <red_fish_mask,<grey_fish_mask,<green_fish_mask
fish_mask_table_h:
2024-06-12 15:11:58 -04:00
.byte >big_fish_mask,>left_fish_mask,>right_fish_mask
2024-06-12 14:06:45 -04:00
.byte >red_fish_mask,>grey_fish_mask,>green_fish_mask
2024-06-12 13:23:35 -04:00
2024-06-08 00:59:56 -04:00
boat_sprites_l:
.byte <boat2_sprite,<boat1_sprite,<boat3_sprite,<boat1_sprite
boat_sprites_h:
.byte >boat2_sprite,>boat1_sprite,>boat3_sprite,>boat1_sprite
; add to Y to account for boat moving
; 1 2 3
; 18, 15, 19
boat_offsets:
.byte 0,3,4,3
; 2 3 2 1 2 3 2 1 2 3 2
; c r c l c r c l c r c
jig_sprites_l:
.byte <sb_boat2_sprite,<sb_boat3_sprite
.byte <sb_boat2_sprite,<sb_boat1_sprite
.byte <sb_boat2_sprite,<sb_boat3_sprite
.byte <sb_boat2_sprite,<sb_boat1_sprite
.byte <sb_boat2_sprite,<sb_boat3_sprite
.byte <sb_boat2_sprite
jig_sprites_h:
.byte >sb_boat2_sprite,>sb_boat3_sprite
.byte >sb_boat2_sprite,>sb_boat1_sprite
.byte >sb_boat2_sprite,>sb_boat3_sprite
.byte >sb_boat2_sprite,>sb_boat1_sprite
.byte >sb_boat2_sprite,>sb_boat3_sprite
.byte >sb_boat2_sprite
; 0 1 0 2 0 1 0 2 0 1 0
; m u m d m u m d m u m
lure_sprites_l:
.byte <sb_sprite,<sb_fish1_sprite
.byte <sb_sprite,<sb_fish2_sprite
.byte <sb_sprite,<sb_fish1_sprite
.byte <sb_sprite,<sb_fish2_sprite
.byte <sb_sprite,<sb_fish1_sprite
.byte <sb_sprite
lure_sprites_h:
.byte >sb_sprite,>sb_fish1_sprite
.byte >sb_sprite,>sb_fish2_sprite
.byte >sb_sprite,>sb_fish1_sprite
.byte >sb_sprite,>sb_fish2_sprite
.byte >sb_sprite,>sb_fish1_sprite
.byte >sb_sprite
2024-06-05 00:56:26 -04:00
numbers_l:
.byte <zero_sprite,<one_sprite,<two_sprite
.byte <three_sprite,<four_sprite,<five_sprite
.byte <six_sprite,<seven_sprite,<eight_sprite
.byte <nine_sprite
2024-06-12 12:45:58 -04:00
numbers_h:
.byte >zero_sprite,>one_sprite,>two_sprite
.byte >three_sprite,>four_sprite,>five_sprite
.byte >six_sprite,>seven_sprite,>eight_sprite
.byte >nine_sprite
2024-06-05 00:56:26 -04:00
2024-06-05 17:01:31 -04:00
bg_data:
2024-06-08 00:59:56 -04:00
.incbin "graphics/fish_bg.hgr.zx02"
2024-06-05 00:56:26 -04:00
.include "zx02_optim.s"
2024-06-08 16:31:22 -04:00
.include "gr_fast_clear.s"
2024-06-05 00:56:26 -04:00
2024-06-08 00:59:56 -04:00
.include "hgr_tables.s"
2024-06-05 00:56:26 -04:00
.include "hgr_sprite_big.s"
.include "hgr_sprite_mask.s"
.include "hgr_sprite.s"
2024-06-08 16:31:22 -04:00
; .include "hgr_copy_fast.s"
2024-06-05 17:01:31 -04:00
.include "audio.s"
.include "play_sounds.s"
2024-06-08 16:31:22 -04:00
.include "text_print.s"
.include "gr_offsets.s"
2024-06-12 16:53:42 -04:00
.include "random16.s"
2024-06-05 00:56:26 -04:00
2024-06-08 00:59:56 -04:00
.include "graphics/boat_sprites.inc"
.include "graphics/strongbad_sprites.inc"
2024-06-10 16:36:31 -04:00
.include "graphics/fish_sprites.inc"
2024-06-05 00:56:26 -04:00
2024-06-12 02:04:19 -04:00
; Fish behavior
; red fish
; 120,183? (bottom)
; u 14? to maybe 160? pause 5?
; r 8? blow bubble? pause 8?
; r quickly through reeds, off screen
;
2024-06-12 13:23:35 -04:00
red_fish_behavior:
; up 14
.byte FISH_UP,FISH_UP,FISH_UP,FISH_UP
.byte FISH_UP,FISH_UP,FISH_UP,FISH_UP
.byte FISH_UP,FISH_UP,FISH_UP,FISH_UP
.byte FISH_UP,FISH_UP,FISH_UP
; pause 5
.byte FISH_PAUSE,FISH_PAUSE,FISH_PAUSE,FISH_PAUSE,FISH_PAUSE
; slow right 4
.byte FISH_RIGHT,FISH_PAUSE,FISH_RIGHT,FISH_PAUSE
.byte FISH_RIGHT,FISH_PAUSE,FISH_RIGHT,FISH_PAUSE
; bubble
.byte FISH_BUBBLE
; pause 8
.byte FISH_PAUSE,FISH_PAUSE,FISH_PAUSE,FISH_PAUSE
.byte FISH_PAUSE,FISH_PAUSE,FISH_PAUSE,FISH_PAUSE
; fast right 12
.byte FISH_RIGHT,FISH_RIGHT,FISH_RIGHT,FISH_RIGHT
.byte FISH_RIGHT,FISH_RIGHT,FISH_RIGHT,FISH_RIGHT
.byte FISH_RIGHT,FISH_RIGHT,FISH_RIGHT,FISH_RIGHT
.byte FISH_DONE
2024-06-12 12:45:58 -04:00
2024-06-12 02:04:19 -04:00
; left fish, (grey) appears in reeds
; 218,170 or so
; left 8 to center of boat gradually up, blows bubble
; left 12, gradually down, blow bubble
; 3 frames to turn right
2024-06-12 22:07:26 -04:00
; 5 frames right up (center of boat) blows bubble
; 5 frames right down
2024-06-12 02:04:19 -04:00
; 15 frames to move off right side
2024-06-12 14:06:45 -04:00
grey_fish_behavior:
; LEFT UP 8, gradually
.byte FISH_LEFT_UP,FISH_PAUSE,FISH_LEFT_UP,FISH_PAUSE
.byte FISH_LEFT_UP,FISH_PAUSE,FISH_LEFT_UP,FISH_PAUSE
.byte FISH_LEFT_UP,FISH_PAUSE,FISH_LEFT_UP,FISH_PAUSE
.byte FISH_LEFT_UP,FISH_PAUSE,FISH_LEFT_UP,FISH_PAUSE
; bubble
.byte FISH_BUBBLE
2024-06-12 22:07:26 -04:00
; LEFT DOWN 10, gradually
.byte FISH_LEFT,FISH_PAUSE,FISH_LEFT_DOWN,FISH_PAUSE
.byte FISH_LEFT,FISH_PAUSE,FISH_LEFT_DOWN,FISH_PAUSE
.byte FISH_LEFT,FISH_PAUSE,FISH_LEFT_DOWN,FISH_PAUSE
.byte FISH_LEFT,FISH_PAUSE,FISH_LEFT_DOWN,FISH_PAUSE
.byte FISH_LEFT,FISH_PAUSE,FISH_LEFT_DOWN,FISH_PAUSE
.byte FISH_LEFT,FISH_PAUSE
2024-06-12 14:06:45 -04:00
; turn right
.byte FISH_PAUSE
.byte FISH_FLIP
.byte FISH_PAUSE
2024-06-12 22:07:26 -04:00
; slow right up 6
.byte FISH_CATCH_UP,FISH_PAUSE,FISH_CATCH_UP,FISH_PAUSE
.byte FISH_CATCH_UP,FISH_PAUSE,FISH_CATCH_UP,FISH_PAUSE
.byte FISH_CATCH_UP,FISH_PAUSE,FISH_CATCH_UP,FISH_PAUSE
2024-06-12 14:06:45 -04:00
; bubble
.byte FISH_BUBBLE
2024-06-12 22:07:26 -04:00
; slow right down 5
.byte FISH_RIGHT_DOWN,FISH_PAUSE,FISH_RIGHT_DOWN,FISH_PAUSE
.byte FISH_RIGHT_DOWN,FISH_PAUSE,FISH_RIGHT_DOWN,FISH_PAUSE
.byte FISH_RIGHT_DOWN,FISH_PAUSE
; fast right 12
2024-06-12 14:06:45 -04:00
.byte FISH_RIGHT,FISH_RIGHT,FISH_RIGHT,FISH_RIGHT
.byte FISH_RIGHT,FISH_RIGHT,FISH_RIGHT,FISH_RIGHT
.byte FISH_RIGHT,FISH_RIGHT,FISH_RIGHT,FISH_RIGHT
.byte FISH_DONE
2024-06-12 02:04:19 -04:00
; right fish (green) appears in left reeds approx 76, 146
; blows bubble
2024-06-12 22:07:26 -04:00
; right 18 off screen
2024-06-12 02:04:19 -04:00
2024-06-12 14:06:45 -04:00
green_fish_behavior:
; bubble
.byte FISH_BUBBLE
; fast right 15
.byte FISH_RIGHT,FISH_RIGHT,FISH_RIGHT,FISH_RIGHT
.byte FISH_RIGHT,FISH_RIGHT,FISH_RIGHT,FISH_RIGHT
.byte FISH_RIGHT,FISH_RIGHT,FISH_RIGHT,FISH_RIGHT
2024-06-12 22:07:26 -04:00
.byte FISH_RIGHT,FISH_RIGHT,FISH_RIGHT,FISH_RIGHT
.byte FISH_RIGHT,FISH_RIGHT
2024-06-12 14:06:45 -04:00
.byte FISH_DONE
2024-06-12 17:07:34 -04:00
catch_fish_behavior:
; up+to right 20 times?
; then down+right 5 times?
2024-06-12 19:35:39 -04:00
.byte FISH_UP,FISH_UP,FISH_UP,FISH_CATCH_UP
.byte FISH_UP,FISH_UP,FISH_UP,FISH_CATCH_UP
.byte FISH_UP,FISH_UP,FISH_UP,FISH_CATCH_UP
2024-06-12 17:07:34 -04:00
.byte FISH_CATCH_DOWN,FISH_CATCH_DOWN,FISH_CATCH_DOWN,FISH_CATCH_DOWN
.byte FISH_CATCH_DOWN,FISH_CATCH_DOWN,FISH_CATCH_DOWN,FISH_CATCH_DOWN
.byte FISH_DONE
2024-06-12 02:04:19 -04:00
; bubbles
; go medium/large/medium
; some go mostly up, some wiggle left right
2024-06-12 15:41:46 -04:00
bubble_sprite_table_l:
.byte <med1_bubble_sprite,<med1_bubble_sprite
.byte <big_bubble_sprite,<big_bubble_sprite
.byte <med2_bubble_sprite,<med2_bubble_sprite
bubble_sprite_table_h:
.byte >med1_bubble_sprite,>med1_bubble_sprite
.byte >big_bubble_sprite,>big_bubble_sprite
.byte >med2_bubble_sprite,>med2_bubble_sprite
bubble_mask_table_l:
.byte <med1_bubble_mask,<med1_bubble_mask
.byte <big_bubble_mask,<big_bubble_mask
.byte <med2_bubble_mask,<med2_bubble_mask
bubble_mask_table_h:
.byte >med1_bubble_mask,>med1_bubble_mask
.byte >big_bubble_mask,>big_bubble_mask
.byte >med2_bubble_mask,>med2_bubble_mask
2024-06-12 16:53:42 -04:00
ripple_l_sprites_l:
.byte <ripple_l1_sprite,<ripple_l2_sprite,<ripple_l3_sprite,<ripple_none_sprite
ripple_l_sprites_h:
.byte >ripple_l1_sprite,>ripple_l2_sprite,>ripple_l3_sprite,>ripple_none_sprite
ripple_r_sprites_l:
.byte <ripple_r1_sprite,<ripple_r2_sprite,<ripple_r3_sprite,<ripple_none_sprite
ripple_r_sprites_h:
.byte >ripple_r1_sprite,>ripple_r2_sprite,>ripple_r3_sprite,>ripple_none_sprite