mirror of
https://github.com/deater/dos33fsprogs.git
synced 2025-01-13 22:30:49 +00:00
duke: hook up more sound effects
This commit is contained in:
parent
a149ade121
commit
d8b012a749
@ -48,7 +48,7 @@ duke.o: duke.s zp.inc hardware.inc duke.s \
|
||||
maps/level1_map.lzsa \
|
||||
status_bar.s draw_duke.s move_duke.s gr_putsprite_crop.s \
|
||||
draw_tilemap.s \
|
||||
sound_effects.s \
|
||||
sound_effects.s speaker_tone.s \
|
||||
keyboard.s handle_laser.s
|
||||
ca65 -o duke.o duke.s -l duke.lst
|
||||
|
||||
|
@ -83,6 +83,8 @@ not_red_tile:
|
||||
|
||||
jsr copy_tilemap_subset
|
||||
|
||||
jsr rumble_noise
|
||||
|
||||
jmp done_up_action
|
||||
|
||||
|
||||
|
@ -228,6 +228,7 @@ done_with_duke:
|
||||
.include "actions.s"
|
||||
|
||||
.include "sound_effects.s"
|
||||
.include "speaker_tone.s"
|
||||
|
||||
level1_data_lzsa:
|
||||
.incbin "maps/level1_map.lzsa"
|
||||
|
@ -129,6 +129,8 @@ duke_collide:
|
||||
lda #1
|
||||
sta DUKE_FALLING
|
||||
|
||||
jsr head_noise
|
||||
|
||||
collide_left_right:
|
||||
;===================
|
||||
; collide left/right
|
||||
@ -327,6 +329,8 @@ feet_on_ground:
|
||||
lda #0
|
||||
sta DUKE_WALKING
|
||||
|
||||
jsr land_noise
|
||||
|
||||
was_not_falling:
|
||||
; check to see if Y still hi, if so scroll back down
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
|
||||
;======================
|
||||
; noise when jump
|
||||
jump_noise:
|
||||
|
||||
lda SOUND_STATUS
|
||||
@ -9,3 +9,76 @@ jump_noise:
|
||||
|
||||
done_jump_noise:
|
||||
rts
|
||||
|
||||
|
||||
;======================
|
||||
; noise when bump head
|
||||
head_noise:
|
||||
|
||||
lda SOUND_STATUS
|
||||
bmi done_head_noise
|
||||
|
||||
bit $C030
|
||||
bit $C030
|
||||
|
||||
done_head_noise:
|
||||
rts
|
||||
|
||||
|
||||
;======================
|
||||
; noise when land after jump
|
||||
land_noise:
|
||||
|
||||
lda SOUND_STATUS
|
||||
bmi done_land_noise
|
||||
|
||||
bit $C030
|
||||
|
||||
done_land_noise:
|
||||
rts
|
||||
|
||||
|
||||
;======================
|
||||
; rumble noise
|
||||
rumble_noise:
|
||||
|
||||
lda SOUND_STATUS
|
||||
bmi done_rumble_noise
|
||||
|
||||
ldx #50
|
||||
rumble_red:
|
||||
bit $C030
|
||||
lda #100
|
||||
jsr WAIT
|
||||
dex
|
||||
bne rumble_red
|
||||
|
||||
done_rumble_noise:
|
||||
rts
|
||||
|
||||
|
||||
;======================
|
||||
; pickup noise
|
||||
; C, two octaves+C?
|
||||
pickup_noise:
|
||||
|
||||
lda SOUND_STATUS
|
||||
bmi done_pickup_noise
|
||||
|
||||
lda #NOTE_C3
|
||||
sta speaker_frequency
|
||||
lda #25
|
||||
sta speaker_duration
|
||||
jsr speaker_tone
|
||||
|
||||
lda #NOTE_C5
|
||||
sta speaker_frequency
|
||||
lda #20
|
||||
sta speaker_duration
|
||||
jsr speaker_tone
|
||||
|
||||
done_pickup_noise:
|
||||
rts
|
||||
|
||||
|
||||
|
||||
|
67
duke/speaker_tone.s
Normal file
67
duke/speaker_tone.s
Normal file
@ -0,0 +1,67 @@
|
||||
; based on code from here
|
||||
; http://eightbitsoundandfury.ld8.org/programming.html
|
||||
|
||||
; A,X,Y trashed
|
||||
; duration also trashed
|
||||
|
||||
NOTE_C3 = 255
|
||||
NOTE_CSHARP3 = 241
|
||||
NOTE_D3 = 227
|
||||
NOTE_DSHARP3 = 214
|
||||
NOTE_E3 = 202
|
||||
NOTE_F3 = 191
|
||||
NOTE_FSHARP3 = 180
|
||||
NOTE_G3 = 170
|
||||
NOTE_GSHARP3 = 161
|
||||
NOTE_A3 = 152
|
||||
NOTE_ASHARP3 = 143
|
||||
NOTE_B3 = 135
|
||||
|
||||
NOTE_C4 = 128
|
||||
NOTE_CSHARP4 = 121
|
||||
NOTE_D4 = 114
|
||||
NOTE_DSHARP4 = 108
|
||||
NOTE_E4 = 102
|
||||
NOTE_F4 = 96
|
||||
NOTE_FSHARP4 = 91
|
||||
NOTE_G4 = 85
|
||||
NOTE_GSHARP4 = 81
|
||||
NOTE_A4 = 76
|
||||
NOTE_ASHARP4 = 72
|
||||
NOTE_B4 = 68
|
||||
|
||||
NOTE_C5 = 64
|
||||
NOTE_CSHARP5 = 60
|
||||
NOTE_D5 = 57
|
||||
NOTE_DSHARP5 = 54
|
||||
NOTE_E5 = 51
|
||||
NOTE_F5 = 48
|
||||
NOTE_FSHARP5 = 45
|
||||
NOTE_G5 = 43
|
||||
NOTE_GSHARP5 = 40
|
||||
NOTE_A5 = 38
|
||||
NOTE_ASHARP5 = 36
|
||||
NOTE_B5 = 34
|
||||
|
||||
|
||||
|
||||
speaker_tone:
|
||||
lda $C030 ; click speaker
|
||||
speaker_loop:
|
||||
dey ; y never set?
|
||||
bne slabel1 ; duration roughly 256*?
|
||||
dec speaker_duration ; (Duration)
|
||||
beq done_tone
|
||||
slabel1:
|
||||
dex
|
||||
bne speaker_loop
|
||||
ldx speaker_frequency ; (Frequency)
|
||||
jmp speaker_tone
|
||||
done_tone:
|
||||
rts
|
||||
|
||||
speaker_duration:
|
||||
.byte $00
|
||||
speaker_frequency:
|
||||
.byte $00
|
||||
|
Loading…
x
Reference in New Issue
Block a user