diff --git a/BUGS.md b/BUGS.md index 4fe3aab..376b968 100644 --- a/BUGS.md +++ b/BUGS.md @@ -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. diff --git a/BuGS.xcodeproj/project.pbxproj b/BuGS.xcodeproj/project.pbxproj index a9b1068..620042b 100644 --- a/BuGS.xcodeproj/project.pbxproj +++ b/BuGS.xcodeproj/project.pbxproj @@ -95,6 +95,7 @@ 9D62AF3F2499CD1E00348F45 /* LICENSE */ = {isa = PBXFileReference; lastKnownFileType = text; path = LICENSE; sourceTree = ""; }; 9D62AF402499CD3A00348F45 /* README.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = ""; }; 9D6DB0AE2591A67700CDBF05 /* flea.raw */ = {isa = PBXFileReference; lastKnownFileType = file; path = flea.raw; sourceTree = ""; }; + 9D6DB0B825932CA600CDBF05 /* scorpion.raw */ = {isa = PBXFileReference; lastKnownFileType = text; path = scorpion.raw; sourceTree = ""; }; 9D8AF0B72535542400C10E3C /* level.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = level.s; sourceTree = ""; }; 9D8AF0B82535543000C10E3C /* score.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = score.s; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.asm.orcam; }; 9D8FFC602491CA28005C9327 /* game.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = game.s; sourceTree = ""; }; @@ -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 */, diff --git a/BuGS/gameScorpion.s b/BuGS/gameScorpion.s index 9747347..c3c29a0 100644 --- a/BuGS/gameScorpion.s +++ b/BuGS/gameScorpion.s @@ -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 @@ -327,6 +332,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 diff --git a/BuGS/gameSound.s b/BuGS/gameSound.s index b882151..c1ef28f 100644 --- a/BuGS/gameSound.s +++ b/BuGS/gameSound.s @@ -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 diff --git a/BuGS/main.c b/BuGS/main.c index 4c905cb..ad6db6e 100644 --- a/BuGS/main.c +++ b/BuGS/main.c @@ -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; diff --git a/BuGS/main.h b/BuGS/main.h index 38bf0f6..bdefce7 100644 --- a/BuGS/main.h +++ b/BuGS/main.h @@ -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_) */ diff --git a/BuGS/main.rez b/BuGS/main.rez index 2fe97bc..2a273ca 100644 --- a/BuGS/main.rez +++ b/BuGS/main.rez @@ -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"; diff --git a/BuGS/make/launchEmulator b/BuGS/make/launchEmulator index 2f4a9be..ba082a8 100755 --- a/BuGS/make/launchEmulator +++ b/BuGS/make/launchEmulator @@ -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=$! diff --git a/BuGS/sound/scorpion.raw b/BuGS/sound/scorpion.raw new file mode 100644 index 0000000..e1db2be Binary files /dev/null and b/BuGS/sound/scorpion.raw differ