mirror of
https://github.com/jeremysrand/BuGS.git
synced 2024-10-31 16:05:49 +00:00
Turn on optimizations on the C code to make it smaller. Ran out of code space in the main 64k bank. More changes to the sound register accesses.
This commit is contained in:
parent
25765e6975
commit
a7b404c676
@ -38,7 +38,7 @@ SRCDIRS+=sprites $(GENDIR)
|
||||
ROOTCFILE=main.c
|
||||
|
||||
# Add any arguments you want passed to the C compiler to this variable:
|
||||
CFLAGS+=
|
||||
CFLAGS+=+O
|
||||
|
||||
# Add any arguments you want passed to the resource compiler to this variable:
|
||||
REZFLAGS+=
|
||||
|
209
BuGS/gameSound.s
209
BuGS/gameSound.s
@ -1058,36 +1058,25 @@ stopScorpionSound_doIt anop
|
||||
sta scorpionSoundIsPlaying
|
||||
|
||||
short m
|
||||
_docWait
|
||||
lda >SOUND_SYSTEM_VOLUME
|
||||
and #$0f
|
||||
ora #$20
|
||||
sta >SOUND_CONTROL_REG
|
||||
|
||||
lda #SOUND_REG_VOLUME+SCORPION_OSC_NUM
|
||||
sta >SOUND_ADDR_LOW
|
||||
lda #0
|
||||
sta >SOUND_DATA_REG
|
||||
sta >SOUND_DATA_REG
|
||||
sta >SOUND_DATA_REG
|
||||
sta >SOUND_DATA_REG
|
||||
_writeReg #SOUND_REG_VOLUME+SCORPION_OSC_NUM,#0
|
||||
_writeReg #SOUND_REG_VOLUME+SCORPION_OSC_NUM+1,#0
|
||||
_writeReg #SOUND_REG_VOLUME+SCORPION_OSC_NUM+1,#0
|
||||
_writeReg #SOUND_REG_VOLUME+SCORPION_OSC_NUM+1,#0
|
||||
|
||||
lda #SOUND_REG_CONTROL+SCORPION_OSC_NUM
|
||||
sta >SOUND_ADDR_LOW
|
||||
lda #SOUND_ONE_SHOT_MODE+SOUND_RIGHT_SPEAKER
|
||||
sta >SOUND_DATA_REG
|
||||
sta >SOUND_DATA_REG
|
||||
lda #SOUND_ONE_SHOT_MODE+SOUND_LEFT_SPEAKER
|
||||
sta >SOUND_DATA_REG
|
||||
sta >SOUND_DATA_REG
|
||||
_writeReg #SOUND_REG_CONTROL+SCORPION_OSC_NUM,#SOUND_ONE_SHOT_MODE+SOUND_RIGHT_SPEAKER
|
||||
_writeReg #SOUND_REG_CONTROL+SCORPION_OSC_NUM+1,#SOUND_ONE_SHOT_MODE+SOUND_RIGHT_SPEAKER
|
||||
_writeReg #SOUND_REG_CONTROL+SCORPION_OSC_NUM+2,#SOUND_ONE_SHOT_MODE+SOUND_LEFT_SPEAKER
|
||||
_writeReg #SOUND_REG_CONTROL+SCORPION_OSC_NUM+3,#SOUND_ONE_SHOT_MODE+SOUND_LEFT_SPEAKER
|
||||
|
||||
lda #SOUND_REG_CONTROL+SCORPION_OSC_NUM
|
||||
sta >SOUND_ADDR_LOW
|
||||
lda #SOUND_ONE_SHOT_MODE+SOUND_HALTED+SOUND_RIGHT_SPEAKER
|
||||
sta >SOUND_DATA_REG
|
||||
sta >SOUND_DATA_REG
|
||||
lda #SOUND_ONE_SHOT_MODE+SOUND_HALTED+SOUND_LEFT_SPEAKER
|
||||
sta >SOUND_DATA_REG
|
||||
sta >SOUND_DATA_REG
|
||||
_writeReg #SOUND_REG_CONTROL+SCORPION_OSC_NUM,#SOUND_ONE_SHOT_MODE+SOUND_HALTED+SOUND_RIGHT_SPEAKER
|
||||
_writeReg #SOUND_REG_CONTROL+SCORPION_OSC_NUM+1,#SOUND_ONE_SHOT_MODE+SOUND_HALTED+SOUND_RIGHT_SPEAKER
|
||||
_writeReg #SOUND_REG_CONTROL+SCORPION_OSC_NUM+2,#SOUND_ONE_SHOT_MODE+SOUND_HALTED+SOUND_LEFT_SPEAKER
|
||||
_writeReg #SOUND_REG_CONTROL+SCORPION_OSC_NUM+3,#SOUND_ONE_SHOT_MODE+SOUND_HALTED+SOUND_LEFT_SPEAKER
|
||||
long m
|
||||
|
||||
rtl
|
||||
@ -1103,47 +1092,41 @@ startFleaSound_doIt anop
|
||||
stz fleaSoundFreqOffset
|
||||
|
||||
short m
|
||||
_docWait
|
||||
lda >SOUND_SYSTEM_VOLUME
|
||||
and #$0f
|
||||
ora #$20
|
||||
sta >SOUND_CONTROL_REG
|
||||
|
||||
lda #SOUND_REG_FREQ_LOW+FLEA_OSC_NUM
|
||||
sta >SOUND_ADDR_LOW
|
||||
lda fleaFreqs
|
||||
sta >SOUND_DATA_REG
|
||||
sta >SOUND_DATA_REG
|
||||
sta >SOUND_DATA_REG
|
||||
sta >SOUND_DATA_REG
|
||||
_writeReg #SOUND_REG_FREQ_LOW+FLEA_OSC_NUM,fleaFreqs
|
||||
_writeReg #SOUND_REG_FREQ_LOW+FLEA_OSC_NUM+1,fleaFreqs
|
||||
_writeReg #SOUND_REG_FREQ_LOW+FLEA_OSC_NUM+2,fleaFreqs
|
||||
_writeReg #SOUND_REG_FREQ_LOW+FLEA_OSC_NUM+3,fleaFreqs
|
||||
|
||||
lda #SOUND_REG_FREQ_HIGH+FLEA_OSC_NUM
|
||||
sta >SOUND_ADDR_LOW
|
||||
lda fleaFreqs+1
|
||||
sta >SOUND_DATA_REG
|
||||
sta >SOUND_DATA_REG
|
||||
sta >SOUND_DATA_REG
|
||||
sta >SOUND_DATA_REG
|
||||
_writeReg #SOUND_REG_FREQ_HIGH+FLEA_OSC_NUM,fleaFreqs+1
|
||||
_writeReg #SOUND_REG_FREQ_HIGH+FLEA_OSC_NUM+1,fleaFreqs+1
|
||||
_writeReg #SOUND_REG_FREQ_HIGH+FLEA_OSC_NUM+2,fleaFreqs+1
|
||||
_writeReg #SOUND_REG_FREQ_HIGH+FLEA_OSC_NUM+3,fleaFreqs+1
|
||||
|
||||
lda #SOUND_REG_CONTROL+FLEA_OSC_NUM
|
||||
sta >SOUND_ADDR_LOW
|
||||
lda #FLEA_CONTROL+SOUND_HALTED+SOUND_RIGHT_SPEAKER
|
||||
sta >SOUND_DATA_REG
|
||||
lda #FLEA_CONTROL+SOUND_RIGHT_SPEAKER
|
||||
sta >SOUND_DATA_REG
|
||||
lda #FLEA_CONTROL+SOUND_HALTED+SOUND_LEFT_SPEAKER
|
||||
sta >SOUND_DATA_REG
|
||||
lda #FLEA_CONTROL+SOUND_LEFT_SPEAKER
|
||||
sta >SOUND_DATA_REG
|
||||
_writeReg #SOUND_REG_CONTROL+FLEA_OSC_NUM,#FLEA_CONTROL+SOUND_HALTED+SOUND_RIGHT_SPEAKER
|
||||
_writeReg #SOUND_REG_CONTROL+FLEA_OSC_NUM+1,#FLEA_CONTROL+SOUND_RIGHT_SPEAKER
|
||||
_writeReg #SOUND_REG_CONTROL+FLEA_OSC_NUM+2,#FLEA_CONTROL+SOUND_HALTED+SOUND_LEFT_SPEAKER
|
||||
_writeReg #SOUND_REG_CONTROL+FLEA_OSC_NUM+3,#FLEA_CONTROL+SOUND_LEFT_SPEAKER
|
||||
|
||||
lda #SOUND_REG_VOLUME+FLEA_OSC_NUM
|
||||
sta >SOUND_ADDR_LOW
|
||||
ldy #SOUND_REG_VOLUME+FLEA_OSC_NUM
|
||||
lda tileRightVolume,x
|
||||
sta fleaVolume
|
||||
sta >SOUND_DATA_REG
|
||||
sta >SOUND_DATA_REG
|
||||
jsr writeReg
|
||||
iny
|
||||
lda fleaVolume
|
||||
jsr writeReg
|
||||
iny
|
||||
lda fleaVolume
|
||||
eor #$ff
|
||||
sta >SOUND_DATA_REG
|
||||
sta >SOUND_DATA_REG
|
||||
jsr writeReg
|
||||
iny
|
||||
lda fleaVolume
|
||||
eor #$ff
|
||||
jsr writeReg
|
||||
long m
|
||||
rtl
|
||||
|
||||
@ -1158,78 +1141,55 @@ stopFleaSound_doIt anop
|
||||
sta fleaSoundIsPlaying
|
||||
|
||||
short m
|
||||
_docWait
|
||||
lda >SOUND_SYSTEM_VOLUME
|
||||
and #$0f
|
||||
ora #$20
|
||||
sta >SOUND_CONTROL_REG
|
||||
|
||||
lda #SOUND_REG_VOLUME+FLEA_OSC_NUM
|
||||
sta >SOUND_ADDR_LOW
|
||||
lda #$0
|
||||
sta >SOUND_DATA_REG
|
||||
sta >SOUND_DATA_REG
|
||||
sta >SOUND_DATA_REG
|
||||
sta >SOUND_DATA_REG
|
||||
_writeReg #SOUND_REG_VOLUME+FLEA_OSC_NUM,#$0
|
||||
_writeReg #SOUND_REG_VOLUME+FLEA_OSC_NUM+1,#$0
|
||||
_writeReg #SOUND_REG_VOLUME+FLEA_OSC_NUM+2,#$0
|
||||
_writeReg #SOUND_REG_VOLUME+FLEA_OSC_NUM+3,#$0
|
||||
|
||||
lda #SOUND_REG_CONTROL+FLEA_OSC_NUM
|
||||
sta >SOUND_ADDR_LOW
|
||||
lda #SOUND_ONE_SHOT_MODE+SOUND_RIGHT_SPEAKER
|
||||
sta >SOUND_DATA_REG
|
||||
sta >SOUND_DATA_REG
|
||||
lda #SOUND_ONE_SHOT_MODE+SOUND_LEFT_SPEAKER
|
||||
sta >SOUND_DATA_REG
|
||||
sta >SOUND_DATA_REG
|
||||
_writeReg #SOUND_REG_CONTROL+FLEA_OSC_NUM,#SOUND_ONE_SHOT_MODE+SOUND_RIGHT_SPEAKER
|
||||
_writeReg #SOUND_REG_CONTROL+FLEA_OSC_NUM+1,#SOUND_ONE_SHOT_MODE+SOUND_RIGHT_SPEAKER
|
||||
_writeReg #SOUND_REG_CONTROL+FLEA_OSC_NUM+2,#SOUND_ONE_SHOT_MODE+SOUND_LEFT_SPEAKER
|
||||
_writeReg #SOUND_REG_CONTROL+FLEA_OSC_NUM+3,#SOUND_ONE_SHOT_MODE+SOUND_LEFT_SPEAKER
|
||||
|
||||
lda #SOUND_REG_CONTROL+FLEA_OSC_NUM
|
||||
sta >SOUND_ADDR_LOW
|
||||
lda #SOUND_ONE_SHOT_MODE+SOUND_RIGHT_SPEAKER+SOUND_HALTED
|
||||
sta >SOUND_DATA_REG
|
||||
sta >SOUND_DATA_REG
|
||||
lda #SOUND_ONE_SHOT_MODE+SOUND_LEFT_SPEAKER+SOUND_HALTED
|
||||
sta >SOUND_DATA_REG
|
||||
sta >SOUND_DATA_REG
|
||||
_writeReg #SOUND_REG_CONTROL+FLEA_OSC_NUM,#SOUND_ONE_SHOT_MODE+SOUND_RIGHT_SPEAKER+SOUND_HALTED
|
||||
_writeReg #SOUND_REG_CONTROL+FLEA_OSC_NUM+1,#SOUND_ONE_SHOT_MODE+SOUND_RIGHT_SPEAKER+SOUND_HALTED
|
||||
_writeReg #SOUND_REG_CONTROL+FLEA_OSC_NUM+2,#SOUND_ONE_SHOT_MODE+SOUND_LEFT_SPEAKER+SOUND_HALTED
|
||||
_writeReg #SOUND_REG_CONTROL+FLEA_OSC_NUM+3,#SOUND_ONE_SHOT_MODE+SOUND_LEFT_SPEAKER+SOUND_HALTED
|
||||
long m
|
||||
rtl
|
||||
|
||||
|
||||
pauseSound entry
|
||||
short m
|
||||
_docWait
|
||||
lda >SOUND_SYSTEM_VOLUME
|
||||
and #$0f
|
||||
ora #$20
|
||||
sta >SOUND_CONTROL_REG
|
||||
|
||||
lda #SOUND_REG_VOLUME+SEGMENTS_OSC_NUM
|
||||
sta >SOUND_ADDR_LOW
|
||||
lda #0
|
||||
sta >SOUND_DATA_REG
|
||||
sta >SOUND_DATA_REG
|
||||
sta >SOUND_DATA_REG
|
||||
sta >SOUND_DATA_REG
|
||||
_writeReg #SOUND_REG_VOLUME+SEGMENTS_OSC_NUM,#0
|
||||
_writeReg #SOUND_REG_VOLUME+SEGMENTS_OSC_NUM+1,#0
|
||||
_writeReg #SOUND_REG_VOLUME+SEGMENTS_OSC_NUM+2,#0
|
||||
_writeReg #SOUND_REG_VOLUME+SEGMENTS_OSC_NUM+3,#0
|
||||
|
||||
lda #SOUND_REG_VOLUME+SPIDER_OSC_NUM
|
||||
sta >SOUND_ADDR_LOW
|
||||
lda #$0
|
||||
sta >SOUND_DATA_REG
|
||||
sta >SOUND_DATA_REG
|
||||
sta >SOUND_DATA_REG
|
||||
sta >SOUND_DATA_REG
|
||||
_writeReg #SOUND_REG_VOLUME+SPIDER_OSC_NUM,#$0
|
||||
_writeReg #SOUND_REG_VOLUME+SPIDER_OSC_NUM+1,#$0
|
||||
_writeReg #SOUND_REG_VOLUME+SPIDER_OSC_NUM+2,#$0
|
||||
_writeReg #SOUND_REG_VOLUME+SPIDER_OSC_NUM+3,#$0
|
||||
|
||||
lda #SOUND_REG_VOLUME+SCORPION_OSC_NUM
|
||||
sta >SOUND_ADDR_LOW
|
||||
lda #0
|
||||
sta >SOUND_DATA_REG
|
||||
sta >SOUND_DATA_REG
|
||||
sta >SOUND_DATA_REG
|
||||
sta >SOUND_DATA_REG
|
||||
_writeReg #SOUND_REG_VOLUME+SCORPION_OSC_NUM,#0
|
||||
_writeReg #SOUND_REG_VOLUME+SCORPION_OSC_NUM+1,#0
|
||||
_writeReg #SOUND_REG_VOLUME+SCORPION_OSC_NUM+2,#0
|
||||
_writeReg #SOUND_REG_VOLUME+SCORPION_OSC_NUM+3,#0
|
||||
|
||||
lda #SOUND_REG_VOLUME+FLEA_OSC_NUM
|
||||
sta >SOUND_ADDR_LOW
|
||||
lda #$0
|
||||
sta >SOUND_DATA_REG
|
||||
sta >SOUND_DATA_REG
|
||||
sta >SOUND_DATA_REG
|
||||
sta >SOUND_DATA_REG
|
||||
_writeReg #SOUND_REG_VOLUME+FLEA_OSC_NUM,#$0
|
||||
_writeReg #SOUND_REG_VOLUME+FLEA_OSC_NUM+1,#$0
|
||||
_writeReg #SOUND_REG_VOLUME+FLEA_OSC_NUM+2,#$0
|
||||
_writeReg #SOUND_REG_VOLUME+FLEA_OSC_NUM+3,#$0
|
||||
|
||||
long m
|
||||
rtl
|
||||
@ -1240,18 +1200,15 @@ unpauseSound entry
|
||||
bne unpauseSound_skipSegment
|
||||
|
||||
short m
|
||||
_docWait
|
||||
lda >SOUND_SYSTEM_VOLUME
|
||||
and #$0f
|
||||
ora #$20
|
||||
sta >SOUND_CONTROL_REG
|
||||
|
||||
lda #SOUND_REG_VOLUME+SEGMENTS_OSC_NUM
|
||||
sta >SOUND_ADDR_LOW
|
||||
lda #SEGMENTS_VOLUME
|
||||
sta >SOUND_DATA_REG
|
||||
sta >SOUND_DATA_REG
|
||||
sta >SOUND_DATA_REG
|
||||
sta >SOUND_DATA_REG
|
||||
_writeReg #SOUND_REG_VOLUME+SEGMENTS_OSC_NUM,#SEGMENTS_VOLUME
|
||||
_writeReg #SOUND_REG_VOLUME+SEGMENTS_OSC_NUM+1,#SEGMENTS_VOLUME
|
||||
_writeReg #SOUND_REG_VOLUME+SEGMENTS_OSC_NUM+2,#SEGMENTS_VOLUME
|
||||
_writeReg #SOUND_REG_VOLUME+SEGMENTS_OSC_NUM+3,#SEGMENTS_VOLUME
|
||||
long m
|
||||
|
||||
unpauseSound_skipSegment anop
|
||||
@ -1259,19 +1216,25 @@ unpauseSound_skipSegment anop
|
||||
bne unpauseSound_skipFlea
|
||||
|
||||
short m
|
||||
_docWait
|
||||
lda >SOUND_SYSTEM_VOLUME
|
||||
and #$0f
|
||||
ora #$20
|
||||
sta >SOUND_CONTROL_REG
|
||||
|
||||
lda #SOUND_REG_VOLUME+FLEA_OSC_NUM
|
||||
sta >SOUND_ADDR_LOW
|
||||
ldy #SOUND_REG_VOLUME+FLEA_OSC_NUM
|
||||
lda fleaVolume
|
||||
jsr writeReg
|
||||
iny
|
||||
lda fleaVolume
|
||||
jsr writeReg
|
||||
iny
|
||||
lda fleaVolume
|
||||
sta >SOUND_DATA_REG
|
||||
sta >SOUND_DATA_REG
|
||||
eor #$ff
|
||||
sta >SOUND_DATA_REG
|
||||
sta >SOUND_DATA_REG
|
||||
jsr writeReg
|
||||
iny
|
||||
lda fleaVolume
|
||||
eor #$ff
|
||||
jsr writeReg
|
||||
long m
|
||||
|
||||
unpauseSound_skipFlea anop
|
||||
|
Loading…
Reference in New Issue
Block a user