Add the scorpion sounds.

This commit is contained in:
Jeremy Rand 2020-12-23 14:54:17 -05:00
parent b952d42427
commit ea49a5d11c
9 changed files with 122 additions and 20 deletions

View File

@ -11,6 +11,7 @@ This is a list of the software bugs (as opposed to the bugs in the game that you
* In order to get the wrong value in Y, I noticed that the segmentSpriteOffset was overwritten with the pattern 70 02 70 02, etc.
* Something is trashing memory.
* A spider moving left to right went off screen and left garbage on the RHS as it exited. I have only seen this once. I think it coincided with the player dying.
* Sometimes at the end of the flea sound, there is a short high pitched tone.

View File

@ -95,6 +95,7 @@
9D62AF3F2499CD1E00348F45 /* LICENSE */ = {isa = PBXFileReference; lastKnownFileType = text; path = LICENSE; sourceTree = "<group>"; };
9D62AF402499CD3A00348F45 /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; };
9D6DB0AE2591A67700CDBF05 /* flea.raw */ = {isa = PBXFileReference; lastKnownFileType = file; path = flea.raw; sourceTree = "<group>"; };
9D6DB0B825932CA600CDBF05 /* scorpion.raw */ = {isa = PBXFileReference; lastKnownFileType = text; path = scorpion.raw; sourceTree = "<group>"; };
9D8AF0B72535542400C10E3C /* level.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = level.s; sourceTree = "<group>"; };
9D8AF0B82535543000C10E3C /* score.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = score.s; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.asm.orcam; };
9D8FFC602491CA28005C9327 /* game.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = game.s; sourceTree = "<group>"; };
@ -128,6 +129,7 @@
9D6DB0AE2591A67700CDBF05 /* flea.raw */,
9D0DC8EF258C715E00DE9E87 /* extralife.raw */,
9D1553EB257F3E5200657188 /* death.raw */,
9D6DB0B825932CA600CDBF05 /* scorpion.raw */,
9D1553E9257F3E5200657188 /* fire.raw */,
9D1553EC257F3E5200657188 /* kill.raw */,
9D1553ED257F3E5200657188 /* segments.raw */,

View File

@ -170,6 +170,8 @@ updateScorpionLeft_nextTile anop
stx scorpionTileOffsets+2
lda tileLeft,x
sta scorpionTileOffsets
jsl updateScorpionSound
ldx scorpionTileOffsets+2
bra updateScorpion_maybePoison
updateScorpionRight_notOffScreen anop
@ -178,6 +180,8 @@ updateScorpionRight_notOffScreen anop
stx scorpionTileOffsets+2
lda tileRight,x
sta scorpionTileOffsets
jsl updateScorpionSound
ldx scorpionTileOffsets+2
updateScorpion_maybePoison anop
lda tileType,x
@ -192,6 +196,7 @@ updateScorpion_done anop
updateScorpion_offScreen anop
stz scorpionState
jsl stopScorpionSound
rtl
updateScorpion_exploding anop
@ -328,6 +333,9 @@ addScorpion_common anop
lda scorpionSpriteLastOffset
sta scorpionSprite
ldx scorpionTileOffsets
jsl startScorpionSound
addScorpion_done anop
rtl
@ -372,6 +380,7 @@ shootScorpion entry
inc a
sta scorpionScreenOffset
ldx scorpionTileOffsets+2
jsl stopScorpionSound
jsl playKillSound
jmp scoreAddOneThousand

View File

@ -38,7 +38,6 @@ SPIDER_SOUND_ADDR equ $0000
SPIDER_OSC_NUM equ 16
SPIDER_FREQ_HIGH equ 0
SPIDER_FREQ_LOW equ 214
SPIDER_VOLUME equ 128
SPIDER_CONTROL equ 6
SPIDER_SIZE equ $36
@ -47,16 +46,15 @@ DEATH_SOUND_ADDR equ $4000
DEATH_OSC_NUM equ 10
DEATH_FREQ_HIGH equ 0
DEATH_FREQ_LOW equ 214
DEATH_VOLUME equ 80
DEATH_CONTROL equ 2
DEATH_SIZE equ $36
DEATH_SIZE equ $2d
; OSC 12 - 15 for L/R channels in swap mode
SEGMENTS_SOUND_ADDR equ $7000
SEGMENTS_OSC_NUM equ 12
SEGMENTS_FREQ_HIGH equ 0
SEGMENTS_FREQ_LOW equ 214
SEGMENTS_VOLUME equ 80
SEGMENTS_VOLUME equ 128
SEGMENTS_CONTROL equ 6
SEGMENTS_SIZE equ $24
@ -99,6 +97,14 @@ FLEA_OSC_NUM equ 22
FLEA_CONTROL equ 6
FLEA_SIZE equ $00
; OSC 26 - 30 for L/R channels in swap mode
SCORPION_SOUND_ADDR equ $e000
SCORPION_OSC_NUM equ 26
SCORPION_FREQ_HIGH equ 0
SCORPION_FREQ_LOW equ 214
SCORPION_CONTROL equ 6
SCORPION_SIZE equ $2d
; X register has the address of the register to read
; Accumulator contains the result of the read
@ -200,10 +206,6 @@ soundInit_writeRegLow anop
ldx #SOUND_REG_FREQ_HIGH+SPIDER_OSC_NUM
jsl writeConsecSoundReg
lda #SPIDER_VOLUME
ldx #SOUND_REG_VOLUME+SPIDER_OSC_NUM
jsl writeConsecSoundReg
lda #SPIDER_SIZE
ldx #SOUND_REG_SIZE+SPIDER_OSC_NUM
jsl writeConsecSoundReg
@ -224,10 +226,6 @@ soundInit_writeRegLow anop
ldx #SOUND_REG_FREQ_HIGH+SPIDER_OSC_NUM+2
jsl writeConsecSoundReg
lda #SPIDER_VOLUME
ldx #SOUND_REG_VOLUME+SPIDER_OSC_NUM+2
jsl writeConsecSoundReg
lda #SPIDER_SIZE
ldx #SOUND_REG_SIZE+SPIDER_OSC_NUM+2
jsl writeConsecSoundReg
@ -253,10 +251,6 @@ soundInit_writeRegLow anop
ldx #SOUND_REG_FREQ_HIGH+DEATH_OSC_NUM
jsl writeConsecSoundReg
lda #DEATH_VOLUME
ldx #SOUND_REG_VOLUME+DEATH_OSC_NUM
jsl writeConsecSoundReg
lda #DEATH_SIZE
ldx #SOUND_REG_SIZE+DEATH_OSC_NUM
jsl writeConsecSoundReg
@ -520,6 +514,51 @@ soundInit_writeRegLow anop
ldx #SOUND_REG_CONTROL+FLEA_OSC_NUM+2
jsl writeConsecSoundReg
; Scorpion sound
pea SCORPION_SOUND_ADDR
jsl loadScorpionSound
lda #SCORPION_FREQ_LOW
ldx #SOUND_REG_FREQ_LOW+SCORPION_OSC_NUM
jsl writeConsecSoundReg
lda #SCORPION_FREQ_HIGH
ldx #SOUND_REG_FREQ_HIGH+SCORPION_OSC_NUM
jsl writeConsecSoundReg
lda #SCORPION_SIZE
ldx #SOUND_REG_SIZE+SCORPION_OSC_NUM
jsl writeConsecSoundReg
lda #SCORPION_SOUND_ADDR/256
ldx #SOUND_REG_POINTER+SCORPION_OSC_NUM
jsl writeConsecSoundReg
lda #SCORPION_CONTROL+SOUND_HALTED+SOUND_RIGHT_SPEAKER
ldx #SOUND_REG_CONTROL+SCORPION_OSC_NUM
jsl writeConsecSoundReg
lda #SCORPION_FREQ_LOW
ldx #SOUND_REG_FREQ_LOW+SCORPION_OSC_NUM+2
jsl writeConsecSoundReg
lda #SCORPION_FREQ_HIGH
ldx #SOUND_REG_FREQ_HIGH+SCORPION_OSC_NUM+2
jsl writeConsecSoundReg
lda #SCORPION_SIZE
ldx #SOUND_REG_SIZE+SCORPION_OSC_NUM+2
jsl writeConsecSoundReg
lda #SCORPION_SOUND_ADDR/256
ldx #SOUND_REG_POINTER+SCORPION_OSC_NUM+2
jsl writeConsecSoundReg
lda #SCORPION_CONTROL+SOUND_HALTED+SOUND_LEFT_SPEAKER
ldx #SOUND_REG_CONTROL+SCORPION_OSC_NUM+2
jsl writeConsecSoundReg
rtl
@ -811,12 +850,52 @@ stopSpiderSound entry
startScorpionSound entry
; Write this code...
lda tileRightVolume,x
pha
jsl stopSpiderSound
pla
pha
ldx #SOUND_REG_VOLUME+SCORPION_OSC_NUM
jsl writeConsecSoundReg
pla
eor #$ff
ldx #SOUND_REG_VOLUME+SCORPION_OSC_NUM+2
jsl writeConsecSoundReg
lda #SCORPION_CONTROL+SOUND_RIGHT_SPEAKER
ldx #SOUND_REG_CONTROL+SCORPION_OSC_NUM
jsl writeSoundReg
lda #SCORPION_CONTROL+SOUND_LEFT_SPEAKER
ldx #SOUND_REG_CONTROL+SCORPION_OSC_NUM+2
jsl writeSoundReg
rtl
updateScorpionSound entry
lda tileRightVolume,x
pha
ldx #SOUND_REG_VOLUME+SCORPION_OSC_NUM
jsl writeConsecSoundReg
pla
eor #$ff
ldx #SOUND_REG_VOLUME+SCORPION_OSC_NUM+2
jsl writeConsecSoundReg
rtl
stopScorpionSound entry
; Write this code...
lda #SCORPION_CONTROL+SOUND_HALTED+SOUND_RIGHT_SPEAKER
ldx #SOUND_REG_CONTROL+SCORPION_OSC_NUM
jsl writeConsecSoundReg
lda #SCORPION_CONTROL+SOUND_HALTED+SOUND_LEFT_SPEAKER
ldx #SOUND_REG_CONTROL+SCORPION_OSC_NUM+2
jsl writeConsecSoundReg
rtl

View File

@ -118,6 +118,15 @@ void loadFleaSound(word addr)
}
void loadScorpionSound(word addr)
{
Handle handle = LoadResource(rRawSound, SCORPION_SOUND);
HLock(handle);
WriteRamBlock(*handle, addr, GetHandleSize(handle));
HUnlock(handle);
}
int main(void)
{
int event;

View File

@ -25,6 +25,7 @@
#define SPIDER_SOUND 6
#define EXTRA_LIFE_SOUND 7
#define FLEA_SOUND 8
#define SCORPION_SOUND 9
#endif /* defined(_GUARD_PROJECTBuGS_FILEmain_) */

View File

@ -56,3 +56,4 @@ read rRawSound (SEGMENTS_SOUND) "sound/segments.raw";
read rRawSound (SPIDER_SOUND) "sound/spider.raw";
read rRawSound (EXTRA_LIFE_SOUND) "sound/extralife.raw";
read rRawSound (FLEA_SOUND) "sound/flea.raw";
read rRawSound (SCORPION_SOUND) "sound/scorpion.raw";

View File

@ -27,7 +27,7 @@ sed -i "" "s:^s7d1 *=.*$:s7d1 = $DISKIMAGE:" config.txt
# This magic ensure that clicking stop in Xcode results in the emulator terminating.
if true
if false
then
$EMULATORPATH -fullscreen -mem 1572864 &
PID=$!

BIN
BuGS/sound/scorpion.raw Normal file

Binary file not shown.