Simplify defines/constants

refactor
Christophe Parent 2024-07-08 23:06:43 -07:00
parent 6b19efaa2c
commit 3f9725dba5
1 changed files with 52 additions and 59 deletions

View File

@ -6,7 +6,6 @@ PPU_CTRL_REG1 = $2000
PPU_CTRL_REG2 = $2001 PPU_CTRL_REG2 = $2001
PPU_STATUS = $2002 PPU_STATUS = $2002
PPU_SPR_ADDR = $2003 PPU_SPR_ADDR = $2003
PPU_SPR_DATA = $2004
PPU_SCROLL_REG = $2005 PPU_SCROLL_REG = $2005
PPU_ADDRESS = $2006 PPU_ADDRESS = $2006
PPU_DATA = $2007 PPU_DATA = $2007
@ -21,7 +20,6 @@ SND_MASTERCTRL_REG = $4015
SPR_DMA = $4014 SPR_DMA = $4014
JOYPAD_PORT = $4016 JOYPAD_PORT = $4016
JOYPAD_PORT1 = $4016
JOYPAD_PORT2 = $4017 JOYPAD_PORT2 = $4017
; game specific defines ; game specific defines
@ -219,10 +217,7 @@ CoinTallyFor1Ups = $0748
OffscreenPlayerInfo = $0761 OffscreenPlayerInfo = $0761
OffScr_NumberofLives = $0761 ; used by offscreen player OffScr_NumberofLives = $0761 ; used by offscreen player
OffScr_HalfwayPage = $0762
OffScr_LevelNumber = $0763
OffScr_Hidden1UpFlag = $0764 OffScr_Hidden1UpFlag = $0764
OffScr_CoinTally = $0765
OffScr_WorldNumber = $0766 OffScr_WorldNumber = $0766
OffScr_AreaNumber = $0767 OffScr_AreaNumber = $0767
@ -325,7 +320,6 @@ Bubble_Rel_YPos = $03bb
Block_Rel_YPos = $03bc Block_Rel_YPos = $03bc
Misc_Rel_YPos = $03be Misc_Rel_YPos = $03be
SprObject_SprAttrib = $03c4
Player_SprAttrib = $03c4 Player_SprAttrib = $03c4
Enemy_SprAttrib = $03c5 Enemy_SprAttrib = $03c5
@ -538,7 +532,6 @@ XStore = $43 ; To store the X
; sound effects constants ; sound effects constants
Sfx_SmallJump = %10000000 Sfx_SmallJump = %10000000
Sfx_Flagpole = %01000000
Sfx_Fireball = %00100000 Sfx_Fireball = %00100000
Sfx_PipeDown_Injury = %00010000 Sfx_PipeDown_Injury = %00010000
Sfx_EnemySmack = %00001000 Sfx_EnemySmack = %00001000
@ -572,7 +565,6 @@ GroundMusic = %00000001
TimeRunningOutMusic = %01000000 TimeRunningOutMusic = %01000000
EndOfLevelMusic = %00100000 EndOfLevelMusic = %00100000
AltGameOverMusic = %00010000
EndOfCastleMusic = %00001000 EndOfCastleMusic = %00001000
VictoryMusic = %00000100 VictoryMusic = %00000100
GameOverMusic = %00000010 GameOverMusic = %00000010
@ -592,8 +584,6 @@ RedCheepCheep = $0b
Podoboo = $0c Podoboo = $0c
PiranhaPlant = $0d PiranhaPlant = $0d
GreenParatroopaJump = $0e GreenParatroopaJump = $0e
RedParatroopa = $0f
GreenParatroopaFly = $10
Lakitu = $11 Lakitu = $11
Spiny = $12 Spiny = $12
FlyCheepCheepFrenzy = $14 FlyCheepCheepFrenzy = $14
@ -614,37 +604,24 @@ TallEnemy = $09
; other constants ; other constants
World1 = 0
World2 = 1 World2 = 1
World3 = 2
World4 = 3
World5 = 4 World5 = 4
World6 = 5 World6 = 5
World7 = 6 World7 = 6
World8 = 7 World8 = 7
Level1 = 0
Level2 = 1
Level3 = 2 Level3 = 2
Level4 = 3
WarmBootOffset = <$07d6 WarmBootOffset = <$07d6
ColdBootOffset = <$07fe ColdBootOffset = <$07fe
TitleScreenDataOffset = $1ec0 TitleScreenDataOffset = $1ec0
SoundMemory = $07b0 SoundMemory = $07b0
SwimTileRepOffset = PlayerGraphicsTable + $9e
MusicHeaderOffsetData = MusicHeaderData - 1
MHD = MusicHeaderData
A_Button = %10000000 A_Button = %10000000
B_Button = %01000000 B_Button = %01000000
Select_Button = %00100000 Select_Button = %00100000
Start_Button = %00010000 Start_Button = %00010000
Up_Dir = %00001000
Down_Dir = %00000100
Left_Dir = %00000010
Right_Dir = %00000001
GameModeValue = 1 ; TitleScreenModeValue = 0 is not needed GameModeValue = 1
VictoryModeValue = 2 VictoryModeValue = 2
GameOverModeValue = 3 GameOverModeValue = 3
@ -15150,7 +15127,7 @@ SwimKT:
lda PlayerSize ; check player's size lda PlayerSize ; check player's size
beq BigKTS ; if big, use first tile beq BigKTS ; if big, use first tile
lda Sprite_Tilenumber+24,y ; check tile number of seventh/eighth sprite lda Sprite_Tilenumber+24,y ; check tile number of seventh/eighth sprite
cmp SwimTileRepOffset ; against tile number in player graphics table cmp PlayerGraphicsTable+$9e ; against tile number in player graphics table
beq ExPGH ; if spr7/spr8 tile number = value, branch to leave beq ExPGH ; if spr7/spr8 tile number = value, branch to leave
inx ; otherwise increment X for second tile inx ; otherwise increment X for second tile
BigKTS: BigKTS:
@ -16400,7 +16377,7 @@ FindEventMusicHeader:
bcc FindEventMusicHeader bcc FindEventMusicHeader
LoadHeader: LoadHeader:
lda MusicHeaderOffsetData,y ; load offset for header lda MusicHeaderData-1,y ; load offset for header
tay tay
lda MusicHeaderData,y ; now load the header lda MusicHeaderData,y ; now load the header
sta NoteLenLookupTblOfs sta NoteLenLookupTblOfs
@ -16712,41 +16689,57 @@ LoadWaterEventMusEnvData:
; music header offsets ; music header offsets
MusicHeaderData: MusicHeaderData:
.byte DeathMusHdr-MHD ; event music .byte DeathMusHdr-MusicHeaderData ; event music
.byte GameOverMusHdr-MHD .byte GameOverMusHdr-MusicHeaderData
.byte VictoryMusHdr-MHD .byte VictoryMusHdr-MusicHeaderData
.byte WinCastleMusHdr-MHD .byte WinCastleMusHdr-MusicHeaderData
.byte GameOverMusHdr-MHD .byte GameOverMusHdr-MusicHeaderData
.byte EndOfLevelMusHdr-MHD .byte EndOfLevelMusHdr-MusicHeaderData
.byte TimeRunningOutHdr-MHD .byte TimeRunningOutHdr-MusicHeaderData
.byte SilenceHdr-MHD .byte SilenceHdr-MusicHeaderData
.byte GroundLevelPart1Hdr-MHD ; area music .byte GroundLevelPart1Hdr-MusicHeaderData ; area music
.byte WaterMusHdr-MHD .byte WaterMusHdr-MusicHeaderData
.byte UndergroundMusHdr-MHD .byte UndergroundMusHdr-MusicHeaderData
.byte CastleMusHdr-MHD .byte CastleMusHdr-MusicHeaderData
.byte Star_CloudHdr-MHD .byte Star_CloudHdr-MusicHeaderData
.byte GroundLevelLeadInHdr-MHD .byte GroundLevelLeadInHdr-MusicHeaderData
.byte Star_CloudHdr-MHD .byte Star_CloudHdr-MusicHeaderData
.byte SilenceHdr-MHD .byte SilenceHdr-MusicHeaderData
.byte GroundLevelLeadInHdr-MHD ; ground level music layout .byte GroundLevelLeadInHdr-MusicHeaderData ; ground level music layout
.byte GroundLevelPart1Hdr-MHD, GroundLevelPart1Hdr-MHD .byte GroundLevelPart1Hdr-MusicHeaderData
.byte GroundLevelPart2AHdr-MHD, GroundLevelPart2BHdr-MHD .byte GroundLevelPart1Hdr-MusicHeaderData
.byte GroundLevelPart2AHdr-MHD, GroundLevelPart2CHdr-MHD .byte GroundLevelPart2AHdr-MusicHeaderData
.byte GroundLevelPart2AHdr-MHD, GroundLevelPart2BHdr-MHD .byte GroundLevelPart2BHdr-MusicHeaderData
.byte GroundLevelPart2AHdr-MHD, GroundLevelPart2CHdr-MHD .byte GroundLevelPart2AHdr-MusicHeaderData
.byte GroundLevelPart3AHdr-MHD, GroundLevelPart3BHdr-MHD .byte GroundLevelPart2CHdr-MusicHeaderData
.byte GroundLevelPart3AHdr-MHD, GroundLevelLeadInHdr-MHD .byte GroundLevelPart2AHdr-MusicHeaderData
.byte GroundLevelPart1Hdr-MHD, GroundLevelPart1Hdr-MHD .byte GroundLevelPart2BHdr-MusicHeaderData
.byte GroundLevelPart4AHdr-MHD, GroundLevelPart4BHdr-MHD .byte GroundLevelPart2AHdr-MusicHeaderData
.byte GroundLevelPart4AHdr-MHD, GroundLevelPart4CHdr-MHD .byte GroundLevelPart2CHdr-MusicHeaderData
.byte GroundLevelPart4AHdr-MHD, GroundLevelPart4BHdr-MHD .byte GroundLevelPart3AHdr-MusicHeaderData
.byte GroundLevelPart4AHdr-MHD, GroundLevelPart4CHdr-MHD .byte GroundLevelPart3BHdr-MusicHeaderData
.byte GroundLevelPart3AHdr-MHD, GroundLevelPart3BHdr-MHD .byte GroundLevelPart3AHdr-MusicHeaderData
.byte GroundLevelPart3AHdr-MHD, GroundLevelLeadInHdr-MHD .byte GroundLevelLeadInHdr-MusicHeaderData
.byte GroundLevelPart4AHdr-MHD, GroundLevelPart4BHdr-MHD .byte GroundLevelPart1Hdr-MusicHeaderData
.byte GroundLevelPart4AHdr-MHD, GroundLevelPart4CHdr-MHD .byte GroundLevelPart1Hdr-MusicHeaderData
.byte GroundLevelPart4AHdr-MusicHeaderData
.byte GroundLevelPart4BHdr-MusicHeaderData
.byte GroundLevelPart4AHdr-MusicHeaderData
.byte GroundLevelPart4CHdr-MusicHeaderData
.byte GroundLevelPart4AHdr-MusicHeaderData
.byte GroundLevelPart4BHdr-MusicHeaderData
.byte GroundLevelPart4AHdr-MusicHeaderData
.byte GroundLevelPart4CHdr-MusicHeaderData
.byte GroundLevelPart3AHdr-MusicHeaderData
.byte GroundLevelPart3BHdr-MusicHeaderData
.byte GroundLevelPart3AHdr-MusicHeaderData
.byte GroundLevelLeadInHdr-MusicHeaderData
.byte GroundLevelPart4AHdr-MusicHeaderData
.byte GroundLevelPart4BHdr-MusicHeaderData
.byte GroundLevelPart4AHdr-MusicHeaderData
.byte GroundLevelPart4CHdr-MusicHeaderData
; music headers ; music headers
; header format is as follows: ; header format is as follows: