dating: hook up sounds

This commit is contained in:
Vince Weaver 2024-09-30 21:51:00 -04:00
parent 79a8176457
commit 7b229c0bdb
13 changed files with 218 additions and 259 deletions

View File

@ -22,13 +22,13 @@ sb.dsk: QBOOT QLOAD TITLE DUCK_POND ROOF ASPLODE BACK_OFF \
$(DOS33_RAW) sb.dsk 2 0 TITLE 0 0
$(DOS33_RAW) sb.dsk 5 0 DUCK_POND 0 0
$(DOS33_RAW) sb.dsk 8 0 ROOF 0 0
$(DOS33_RAW) sb.dsk 11 0 ASPLODE 0 0
$(DOS33_RAW) sb.dsk 9 0 ASPLODE 0 0
# $(DOS33_RAW) sb.dsk 20 0 TARGET 0 0
$(DOS33_RAW) sb.dsk 16 0 ./fish/FISH 0 0
$(DOS33_RAW) sb.dsk 22 0 RAT 0 0
$(DOS33_RAW) sb.dsk 24 0 BACK_OFF 0 0
$(DOS33_RAW) sb.dsk 26 0 ../peasant_mini/cliff/CLIMB 0 0
$(DOS33_RAW) sb.dsk 30 0 ./dating/DATING_XR 0 0
$(DOS33_RAW) sb.dsk 14 0 ./fish/FISH 0 0
$(DOS33_RAW) sb.dsk 20 0 RAT 0 0
$(DOS33_RAW) sb.dsk 22 0 BACK_OFF 0 0
$(DOS33_RAW) sb.dsk 24 0 ../peasant_mini/cliff/CLIMB 0 0
$(DOS33_RAW) sb.dsk 28 0 ./dating/DATING_XR 0 0
####

View File

@ -6,13 +6,13 @@ T 0 = Qboot
T 1 = QLOAD 99 bytes = 1T (4096) 4k free
T 2 = TITLE 9280 bytes = 3T (12288) 3k free
T 5 = DUCK_POND 3474 bytes = 3T (12288) 9k free
T 8 = ROOF 865 bytes = 3T (12288) 11k free
T 11 = ASPLODE 17042 bytes = 5T (20480) 3k free
T 16 = FISH 23287 bytes = 6T (24576) 1k free
T 22 = RAT 7581 bytes = 2T ( 8192) 1k free
T 24 = BACK_OFF 6072 bytes = 2T ( 8192) 2k free
T 26 = CLIMB 13013 bytes = 4T (16384) 3k free
T 30 = DATING = 4T (16384) ?k free
T 8 = ROOF 865 bytes = 1T (12288) 3k free
T 9 = ASPLODE 17042 bytes = 5T (20480) 3k free
T 14 = FISH 23287 bytes = 6T (24576) 1k free
T 20 = RAT 7581 bytes = 2T ( 8192) 1k free
T 22 = BACK_OFF 6072 bytes = 2T ( 8192) 2k free
T 24 = CLIMB 13013 bytes = 4T (16384) 3k free
T 28 = DATING 24576 bytes = 6T (24576) 4k free

View File

@ -13,7 +13,7 @@ DATING_XR: dating_xr.o
dating_xr.o: dating_xr.s zx02_optim.s \
graphics/a2_dating.hgr.zx02 \
audio.s play_sounds.s \
audio.s \
zp.inc hardware.inc
ca65 -o dating_xr.o dating_xr.s -l dating_xr.lst

View File

@ -33,6 +33,12 @@ dating_start:
sta HGR_PAGE
jsr hgr_make_tables
lda #$0
sta TEXT_COL
sta TEXT_ROW
.if 0
;==========================
; Load Sound
@ -94,38 +100,6 @@ wait_at_tile:
bit KEYRESET
;===================
; 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
; ldx #7
;print_help:
; jsr move_and_print
; dex
; bne print_help
; jsr set_flash ; have the "press spacebar" flash
; jsr move_and_print
;wait_at_directions:
; lda KEYPRESS
; bpl wait_at_directions
; bit KEYRESET
;===================
; setup game
;===================
@ -151,13 +125,6 @@ load_background:
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
bit PAGE1
bit HIRES
bit TEXTGR
@ -176,15 +143,9 @@ load_background:
jsr move_and_print_list
jsr set_inverse
lda #$20
sta DRAW_PAGE
; re-set up hgr tables
; lda #$20
; sta HGR_PAGE
; jsr hgr_make_tables
jsr update_text
;==========================
@ -194,60 +155,10 @@ main_loop:
; jsr flip_page
;========================
;========================
; draw the scene
;========================
;========================
;==================================
; copy over (erase) old background
.if 0
; 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
sta bg_copy_in_smc+2
clc
lda DRAW_PAGE
adc #$20
sta bg_copy_out_smc+2
ldy #0
bg_copy_loop:
bg_copy_in_smc:
lda $A000,Y
bg_copy_out_smc:
sta $2000,Y
dey
bne bg_copy_loop
inc bg_copy_in_smc+2
inc bg_copy_out_smc+2
lda bg_copy_in_smc+2
cmp #$C0
bne bg_copy_loop
.endif
inc FRAME
;============================
; play sound
;============================
; ldy #5
; jsr play_asplode
;===========================
; check keypress
;===========================
@ -265,12 +176,70 @@ check_keypress:
bne not_done_game
jmp done_game
not_done_game:
; do this after or else '/' counts as escape
and #$df ; convert lowercase to upper
cmp #$96 ; see if need to convert
bcc no_upper_convert
and #$5f ; convert lowercase to upper
no_upper_convert:
;========================
; check left
;========================
check_left:
cmp #$8
beq left_pressed
cmp #'A'
bne check_right
left_pressed:
jsr erase_current
lda #0
sta TEXT_COL
beq done_movement ; bra
check_right:
cmp #$15
beq right_pressed
cmp #'D'
bne check_up
right_pressed:
jsr erase_current
lda #1
sta TEXT_COL
bne done_movement ; bra
check_up:
cmp #$0b
beq up_pressed
cmp #'W'
bne check_down
up_pressed:
jsr erase_current
lda TEXT_ROW
beq no_up_move
dec TEXT_ROW
no_up_move:
jmp done_movement
check_down:
cmp #$0a
beq down_pressed
cmp #'S'
bne check_enter
down_pressed:
jsr erase_current
lda TEXT_ROW
cmp #3
bcs no_down_move
inc TEXT_ROW
no_down_move:
jmp done_movement
check_enter:
cmp #' '
beq do_sound
cmp #13 ; return/enter
@ -279,10 +248,42 @@ not_done_game:
done_keyboard_check:
jmp main_loop
done_movement:
jsr set_inverse
jsr update_text
jmp main_loop
do_sound:
lda #<marzipan_sounds
lda TEXT_COL
bne homestar_sound
marzipan_sound:
lda TEXT_ROW
tax
lda m_sounds_len,X
sta SOUND_LEN
lda m_sounds_l,X
sta ZX0_src
lda #>marzipan_sounds
lda m_sounds_h,X
jmp sound_common
homestar_sound:
lda TEXT_ROW
cmp #3
beq done_keyboard_check
tax
lda h_sounds_len
sta SOUND_LEN
lda h_sounds_l,X
sta ZX0_src
lda h_sounds_h,X
sound_common:
sta ZX0_src+1
lda #$A0
@ -296,10 +297,10 @@ do_sound:
sta BTC_L
lda #$A0
sta BTC_H
ldx #16
ldx SOUND_LEN
jsr play_audio
sound_done:
jmp done_keyboard_check
@ -320,24 +321,55 @@ wait_until_keypress:
bit KEYRESET ; clear the keyboard buffer
rts
;=======================
; erase current
erase_current:
jsr set_normal
update_text:
lda #0
sta DRAW_PAGE
lda TEXT_COL
asl
asl
clc
adc TEXT_ROW
tax
lda game_text_l,X
sta OUTL
lda game_text_h,X
sta OUTH
jsr move_and_print
lda #$20
sta DRAW_PAGE
rts
game_text_l:
.byte <text_m_duh,<text_m_buh,<text_m_fuh,<text_m_ques
.byte <text_h_duh,<text_h_buh,<text_h_fuh,<text_h_ques
game_text_h:
.byte >text_m_duh,>text_m_buh,>text_m_fuh,>text_m_ques
.byte >text_h_duh,>text_h_buh,>text_h_fuh,>text_h_ques
game_text:
.byte 8,20,"DUH!",0
.byte 8,21,"BUH!",0
.byte 8,22,"FUH!",0
.byte 8,23,"???",0
.byte 28,20,"DUH!",0
.byte 28,21,"BUH!",0
.byte 28,22,"FUH!",0
.byte 28,23,"???",0
text_m_duh: .byte 8,20,"DUH!",0
text_m_buh: .byte 8,21,"BUH!",0
text_m_fuh: .byte 8,22,"FUH!",0
text_m_ques: .byte 8,23,"???",0
text_h_duh: .byte 28,20,"DUH!",0
text_h_buh: .byte 28,21,"BUH!",0
text_h_fuh: .byte 28,22,"FUH!",0
text_h_ques: .byte 28,23,"???",0
.byte $FF
;sound_data_fish:
; .incbin "sounds/fish.btc.zx02"
;sound_data_boat:
; .incbin "sounds/get_in_boat.btc.zx02"
title_data:
.incbin "graphics/dating_title.hgr.zx02"
@ -347,25 +379,44 @@ bg_data:
.include "zx02_optim.s"
; .include "gr_fast_clear.s"
.include "hgr_tables.s"
; .include "hgr_sprite_big.s"
; .include "hgr_sprite_mask.s"
; .include "hgr_sprite.s"
; .include "hgr_copy_fast.s"
.include "audio.s"
.include "play_sounds.s"
.include "text_print.s"
.include "gr_offsets.s"
; .include "random16.s"
marzipan_sounds:
m_sounds_l:
.byte <marzipan_duh,<marzipan_buh,<marzipan_fuh,<marzipan_on_point
m_sounds_h:
.byte >marzipan_duh,>marzipan_buh,>marzipan_fuh,>marzipan_on_point
m_sounds_len:
.byte 15,15,15,31
marzipan_duh:
.incbin "sounds/m_duh.btc.zx02"
marzipan_buh:
.incbin "sounds/m_buh.btc.zx02"
marzipan_fuh:
.incbin "sounds/m_fuh.btc.zx02"
marzipan_on_point:
.incbin "sounds/m_sb_on_point.btc.zx02"
h_sounds_l:
.byte <homestar_duh,<homestar_buh,<homestar_fuh
h_sounds_h:
.byte >homestar_duh,>homestar_buh,>homestar_fuh
h_sounds_len:
.byte 15,15,15
homestar_duh:
.incbin "sounds/h_duh.btc.zx02"
homestar_buh:
.incbin "sounds/h_buh.btc.zx02"
homestar_fuh:
.incbin "sounds/h_fuh.btc.zx02"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 21 KiB

View File

@ -1,67 +0,0 @@
FISH_SAMPLE = $D000
FISH_LENGTH = 17 ; $11
BOAT_SAMPLE = $E100
BOAT_LENGTH = 20 ; $14
play_fish:
; only avail if language card
lda SOUND_STATUS
and #SOUND_IN_LC
beq done_play_fish
; switch in language card
; read/write RAM $d000 bank 1
bit $C083
bit $C083
; call the btc player
lda #<FISH_SAMPLE
sta BTC_L
lda #>FISH_SAMPLE
sta BTC_H
ldx #FISH_LENGTH
jsr play_audio
; read ROM/no-write
bit $c082
done_play_fish:
rts
play_boat:
; only avail if language card
lda SOUND_STATUS
and #SOUND_IN_LC
beq done_play_boat
; switch in language card
; read/write RAM $d000 bank 1
bit $C083
bit $C083
; call the btc player
lda #<BOAT_SAMPLE
sta BTC_L
lda #>BOAT_SAMPLE
sta BTC_H
ldx #BOAT_LENGTH
jsr play_audio
; read ROM/no-write
bit $c082
done_play_boat:
rts

View File

@ -1,6 +1,8 @@
ZX02 = ~/research/6502_compression/zx02.git/build/zx02 -f
all: m_buh.btc.zx02 m_duh.btc.zx02 m_fuh.btc.zx02
all: m_buh.btc.zx02 m_duh.btc.zx02 m_fuh.btc.zx02 \
h_buh.btc.zx02 h_duh.btc.zx02 h_fuh.btc.zx02 \
m_sb_on_point.btc.zx02
####
@ -13,6 +15,20 @@ m_duh.btc.zx02: m_duh.btc
m_fuh.btc.zx02: m_fuh.btc
$(ZX02) m_fuh.btc m_fuh.btc.zx02
####
h_buh.btc.zx02: h_buh.btc
$(ZX02) h_buh.btc h_buh.btc.zx02
h_duh.btc.zx02: h_duh.btc
$(ZX02) h_duh.btc h_duh.btc.zx02
h_fuh.btc.zx02: h_fuh.btc
$(ZX02) h_fuh.btc h_fuh.btc.zx02
m_sb_on_point.btc.zx02: m_sb_on_point.btc
$(ZX02) m_sb_on_point.btc m_sb_on_point.btc.zx02
clean:

File diff suppressed because one or more lines are too long

View File

@ -144,51 +144,10 @@ BUBBLE_Y = $D2
CURRENT_DISK = $DC
SCORE_L = $E0
SCORE_H = $E1
RED_FISH_STATE_PTR = $E2
GREY_FISH_STATE_PTR = $E3
GREEN_FISH_STATE_PTR = $E4
FISH_NONE = $FF
FISH_PAUSE = $00
FISH_UP = $01
FISH_BUBBLE = $02
FISH_RIGHT = $03
FISH_LEFT = $04
FISH_LEFT_UP = $05
FISH_LEFT_DOWN = $06
FISH_FLIP = $07
FISH_DONE = $08
FISH_RIGHT_UP = $09
FISH_RIGHT_DOWN = $0A
FISH_FAST_UP = $0B
FISH_FAST_DOWN = $0C
FISH_CATCH_UP = $0D
FISH_CATCH_DOWN = $0E
RED_FISH_X = $E5
GREY_FISH_X = $E6
GREEN_FISH_X = $E7
RED_FISH_Y = $E8
GREY_FISH_Y = $E9
GREEN_FISH_Y = $EA
RED_FISH_SPRITE = $EB
GREY_FISH_SPRITE= $EC
GREEN_FISH_SPRITE= $ED
FISH_SPRITE_LONG = $00
FISH_SPRITE_LEFT = $01
FISH_SPRITE_RIGHT = $02
FISH_SPRITE_RED = $03
FISH_SPRITE_GREY = $04
FISH_SPRITE_GREEN = $05
DISP_PAGE = $EE
DRAW_PAGE = $EF
TEXT_COL = $E0
TEXT_ROW = $E1
DRAW_PAGE = $E2
SOUND_LEN = $E3
XPOS = $F0
YPOS = $F1

View File

@ -176,9 +176,9 @@ load_address_array:
.byte $60 ; BACK_OFF
track_array:
.byte 2, 5, 8,11 ; TITLE, DUCK, ROOF, ASPLODE
.byte 26,16,22,30 ; CLIMB, FISH, RAT, DATING
.byte 24 ; BACK_OFF
.byte 2, 5, 8, 9 ; TITLE, DUCK, ROOF, ASPLODE
.byte 24,14,20,28 ; CLIMB, FISH, RAT, DATING
.byte 22 ; BACK_OFF
sector_array:
.byte 0, 0, 0, 0 ; TITLE, DUCK, ROOF, ASPLODE
@ -187,7 +187,7 @@ sector_array:
length_array:
.byte 40, 16, 16, 70 ; TITLE, DUCK, ROOF, ASPLODE
.byte 64, 92, 32, 64 ; CLIMB, FISH, RAT, DATING
.byte 64, 92, 32, 96 ; CLIMB, FISH, RAT, DATING
.byte 32 ; BACK_OFF
qload_end:

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.8 KiB

After

Width:  |  Height:  |  Size: 22 KiB