Verify RAM table lengths

This commit is contained in:
Rangi 2021-03-09 20:43:24 -05:00
parent e791c5392b
commit 71073a5f3b
4 changed files with 35 additions and 6 deletions

View File

@ -112,6 +112,8 @@ MAPOBJECT_SCRIPT_POINTER rw ; a
MAPOBJECT_EVENT_FLAG rw ; c MAPOBJECT_EVENT_FLAG rw ; c
rb_skip 2 rb_skip 2
MAPOBJECT_LENGTH EQU _RS MAPOBJECT_LENGTH EQU _RS
NUM_OBJECTS EQU 16
PLAYER_OBJECT EQU 0
; SpriteMovementData struct members (see data/sprites/map_objects.asm) ; SpriteMovementData struct members (see data/sprites/map_objects.asm)
rsreset rsreset

View File

@ -184,10 +184,6 @@ SPAWN_RED EQU 2
const FRIDAY ; 5 const FRIDAY ; 5
const SATURDAY ; 6 const SATURDAY ; 6
; wMapObjects::
PLAYER_OBJECT EQU 0
NUM_OBJECTS EQU 16
; wStatusFlags:: ; wStatusFlags::
const_def const_def
const STATUSFLAGS_POKEDEX_F ; 0 const STATUSFLAGS_POKEDEX_F ; 0

View File

@ -6,23 +6,28 @@ sScratch:: ds $60 tiles
SECTION "SRAM Bank 0", SRAM SECTION "SRAM Bank 0", SRAM
sPartyMail:: sPartyMail::
table_width MAIL_STRUCT_LENGTH, sPartyMail
sPartyMon1Mail:: mailmsg sPartyMon1Mail sPartyMon1Mail:: mailmsg sPartyMon1Mail
sPartyMon2Mail:: mailmsg sPartyMon2Mail sPartyMon2Mail:: mailmsg sPartyMon2Mail
sPartyMon3Mail:: mailmsg sPartyMon3Mail sPartyMon3Mail:: mailmsg sPartyMon3Mail
sPartyMon4Mail:: mailmsg sPartyMon4Mail sPartyMon4Mail:: mailmsg sPartyMon4Mail
sPartyMon5Mail:: mailmsg sPartyMon5Mail sPartyMon5Mail:: mailmsg sPartyMon5Mail
sPartyMon6Mail:: mailmsg sPartyMon6Mail sPartyMon6Mail:: mailmsg sPartyMon6Mail
assert_table_length PARTY_LENGTH
sPartyMailBackup:: sPartyMailBackup::
table_width MAIL_STRUCT_LENGTH, sPartyMailBackup
sPartyMon1MailBackup:: mailmsg sPartyMon1MailBackup sPartyMon1MailBackup:: mailmsg sPartyMon1MailBackup
sPartyMon2MailBackup:: mailmsg sPartyMon2MailBackup sPartyMon2MailBackup:: mailmsg sPartyMon2MailBackup
sPartyMon3MailBackup:: mailmsg sPartyMon3MailBackup sPartyMon3MailBackup:: mailmsg sPartyMon3MailBackup
sPartyMon4MailBackup:: mailmsg sPartyMon4MailBackup sPartyMon4MailBackup:: mailmsg sPartyMon4MailBackup
sPartyMon5MailBackup:: mailmsg sPartyMon5MailBackup sPartyMon5MailBackup:: mailmsg sPartyMon5MailBackup
sPartyMon6MailBackup:: mailmsg sPartyMon6MailBackup sPartyMon6MailBackup:: mailmsg sPartyMon6MailBackup
assert_table_length PARTY_LENGTH
sMailboxCount:: db sMailboxCount:: db
sMailboxes:: sMailboxes::
table_width MAIL_STRUCT_LENGTH, sMailboxes
sMailbox1:: mailmsg sMailbox1 sMailbox1:: mailmsg sMailbox1
sMailbox2:: mailmsg sMailbox2 sMailbox2:: mailmsg sMailbox2
sMailbox3:: mailmsg sMailbox3 sMailbox3:: mailmsg sMailbox3
@ -33,9 +38,11 @@ sMailbox7:: mailmsg sMailbox7
sMailbox8:: mailmsg sMailbox8 sMailbox8:: mailmsg sMailbox8
sMailbox9:: mailmsg sMailbox9 sMailbox9:: mailmsg sMailbox9
sMailbox10:: mailmsg sMailbox10 sMailbox10:: mailmsg sMailbox10
assert_table_length MAILBOX_CAPACITY
sMailboxCountBackup:: db sMailboxCountBackup:: db
sMailboxesBackup:: sMailboxesBackup::
table_width MAIL_STRUCT_LENGTH, sMailboxesBackup
sMailbox1Backup:: mailmsg sMailbox1Backup sMailbox1Backup:: mailmsg sMailbox1Backup
sMailbox2Backup:: mailmsg sMailbox2Backup sMailbox2Backup:: mailmsg sMailbox2Backup
sMailbox3Backup:: mailmsg sMailbox3Backup sMailbox3Backup:: mailmsg sMailbox3Backup
@ -46,6 +53,7 @@ sMailbox7Backup:: mailmsg sMailbox7Backup
sMailbox8Backup:: mailmsg sMailbox8Backup sMailbox8Backup:: mailmsg sMailbox8Backup
sMailbox9Backup:: mailmsg sMailbox9Backup sMailbox9Backup:: mailmsg sMailbox9Backup
sMailbox10Backup:: mailmsg sMailbox10Backup sMailbox10Backup:: mailmsg sMailbox10Backup
assert_table_length MAILBOX_CAPACITY
sMysteryGiftData:: sMysteryGiftData::
sMysteryGiftItem:: db sMysteryGiftItem:: db
@ -145,6 +153,7 @@ sLinkBattleStatsEnd::
SECTION "SRAM Hall of Fame", SRAM SECTION "SRAM Hall of Fame", SRAM
sHallOfFame:: sHallOfFame::
table_width HOF_LENGTH, sHallOfFame
sHallOfFame01:: hall_of_fame sHallOfFame01 sHallOfFame01:: hall_of_fame sHallOfFame01
sHallOfFame02:: hall_of_fame sHallOfFame02 sHallOfFame02:: hall_of_fame sHallOfFame02
sHallOfFame03:: hall_of_fame sHallOfFame03 sHallOfFame03:: hall_of_fame sHallOfFame03
@ -175,6 +184,7 @@ sHallOfFame27:: hall_of_fame sHallOfFame27
sHallOfFame28:: hall_of_fame sHallOfFame28 sHallOfFame28:: hall_of_fame sHallOfFame28
sHallOfFame29:: hall_of_fame sHallOfFame29 sHallOfFame29:: hall_of_fame sHallOfFame29
sHallOfFame30:: hall_of_fame sHallOfFame30 sHallOfFame30:: hall_of_fame sHallOfFame30
assert_table_length NUM_HOF_TEAMS
sHallOfFameEnd:: sHallOfFameEnd::

View File

@ -20,16 +20,17 @@ SECTION "Audio RAM", WRAM0
wMusicPlaying:: db wMusicPlaying:: db
wAudio:: wAudio::
table_width CHANNEL_STRUCT_LENGTH, wAudio
wChannel1:: channel_struct wChannel1 wChannel1:: channel_struct wChannel1
wChannel2:: channel_struct wChannel2 wChannel2:: channel_struct wChannel2
wChannel3:: channel_struct wChannel3 wChannel3:: channel_struct wChannel3
wChannel4:: channel_struct wChannel4 wChannel4:: channel_struct wChannel4
assert_table_length NUM_MUSIC_CHANS
wChannel5:: channel_struct wChannel5 wChannel5:: channel_struct wChannel5
wChannel6:: channel_struct wChannel6 wChannel6:: channel_struct wChannel6
wChannel7:: channel_struct wChannel7 wChannel7:: channel_struct wChannel7
wChannel8:: channel_struct wChannel8 wChannel8:: channel_struct wChannel8
assert_table_length NUM_CHANNELS
ds 1 ds 1
@ -224,6 +225,7 @@ wSpriteAnimDict::
ds NUM_SPRITEANIMDICT_ENTRIES * 2 ds NUM_SPRITEANIMDICT_ENTRIES * 2
wSpriteAnimationStructs:: wSpriteAnimationStructs::
table_width SPRITEANIMSTRUCT_LENGTH, wSpriteAnimationStructs
; field 0: index ; field 0: index
; fields 1-3: loaded from SpriteAnimSeqData ; fields 1-3: loaded from SpriteAnimSeqData
wSpriteAnim1:: sprite_anim_struct wSpriteAnim1 wSpriteAnim1:: sprite_anim_struct wSpriteAnim1
@ -236,6 +238,7 @@ wSpriteAnim7:: sprite_anim_struct wSpriteAnim7
wSpriteAnim8:: sprite_anim_struct wSpriteAnim8 wSpriteAnim8:: sprite_anim_struct wSpriteAnim8
wSpriteAnim9:: sprite_anim_struct wSpriteAnim9 wSpriteAnim9:: sprite_anim_struct wSpriteAnim9
wSpriteAnim10:: sprite_anim_struct wSpriteAnim10 wSpriteAnim10:: sprite_anim_struct wSpriteAnim10
assert_table_length NUM_SPRITE_ANIM_STRUCTS
wSpriteAnimationStructsEnd:: wSpriteAnimationStructsEnd::
NEXTU NEXTU
@ -322,6 +325,7 @@ wMobileWRAMEnd::
SECTION "Sprites", WRAM0 SECTION "Sprites", WRAM0
wVirtualOAM:: wVirtualOAM::
table_width SPRITEOAMSTRUCT_LENGTH, wVirtualOAM
wVirtualOAMSprite00:: sprite_oam_struct wVirtualOAMSprite00 wVirtualOAMSprite00:: sprite_oam_struct wVirtualOAMSprite00
wVirtualOAMSprite01:: sprite_oam_struct wVirtualOAMSprite01 wVirtualOAMSprite01:: sprite_oam_struct wVirtualOAMSprite01
wVirtualOAMSprite02:: sprite_oam_struct wVirtualOAMSprite02 wVirtualOAMSprite02:: sprite_oam_struct wVirtualOAMSprite02
@ -362,6 +366,7 @@ wVirtualOAMSprite36:: sprite_oam_struct wVirtualOAMSprite36
wVirtualOAMSprite37:: sprite_oam_struct wVirtualOAMSprite37 wVirtualOAMSprite37:: sprite_oam_struct wVirtualOAMSprite37
wVirtualOAMSprite38:: sprite_oam_struct wVirtualOAMSprite38 wVirtualOAMSprite38:: sprite_oam_struct wVirtualOAMSprite38
wVirtualOAMSprite39:: sprite_oam_struct wVirtualOAMSprite39 wVirtualOAMSprite39:: sprite_oam_struct wVirtualOAMSprite39
assert_table_length NUM_SPRITE_OAM_STRUCTS
wVirtualOAMEnd:: wVirtualOAMEnd::
@ -981,24 +986,28 @@ wLinkPartyEnd:: db ; older code doesn't check PartyCount
UNION UNION
; link player data ; link player data
wLinkPlayerData:: wLinkPlayerData::
table_width PARTYMON_STRUCT_LENGTH, wLinkPlayerData
wLinkPlayerPartyMon1:: party_struct wLinkPlayerPartyMon1 wLinkPlayerPartyMon1:: party_struct wLinkPlayerPartyMon1
wLinkPlayerPartyMon2:: party_struct wLinkPlayerPartyMon2 wLinkPlayerPartyMon2:: party_struct wLinkPlayerPartyMon2
wLinkPlayerPartyMon3:: party_struct wLinkPlayerPartyMon3 wLinkPlayerPartyMon3:: party_struct wLinkPlayerPartyMon3
wLinkPlayerPartyMon4:: party_struct wLinkPlayerPartyMon4 wLinkPlayerPartyMon4:: party_struct wLinkPlayerPartyMon4
wLinkPlayerPartyMon5:: party_struct wLinkPlayerPartyMon5 wLinkPlayerPartyMon5:: party_struct wLinkPlayerPartyMon5
wLinkPlayerPartyMon6:: party_struct wLinkPlayerPartyMon6 wLinkPlayerPartyMon6:: party_struct wLinkPlayerPartyMon6
assert_table_length PARTY_LENGTH
wLinkPlayerPartyMonOTNames:: ds NAME_LENGTH * PARTY_LENGTH wLinkPlayerPartyMonOTNames:: ds NAME_LENGTH * PARTY_LENGTH
wLinkPlayerPartyMonNicks:: ds MON_NAME_LENGTH * PARTY_LENGTH wLinkPlayerPartyMonNicks:: ds MON_NAME_LENGTH * PARTY_LENGTH
NEXTU NEXTU
; time capsule party data ; time capsule party data
wTimeCapsulePlayerData:: wTimeCapsulePlayerData::
table_width REDMON_STRUCT_LENGTH, wTimeCapsulePlayerData
wTimeCapsulePartyMon1:: red_party_struct wTimeCapsulePartyMon1 wTimeCapsulePartyMon1:: red_party_struct wTimeCapsulePartyMon1
wTimeCapsulePartyMon2:: red_party_struct wTimeCapsulePartyMon2 wTimeCapsulePartyMon2:: red_party_struct wTimeCapsulePartyMon2
wTimeCapsulePartyMon3:: red_party_struct wTimeCapsulePartyMon3 wTimeCapsulePartyMon3:: red_party_struct wTimeCapsulePartyMon3
wTimeCapsulePartyMon4:: red_party_struct wTimeCapsulePartyMon4 wTimeCapsulePartyMon4:: red_party_struct wTimeCapsulePartyMon4
wTimeCapsulePartyMon5:: red_party_struct wTimeCapsulePartyMon5 wTimeCapsulePartyMon5:: red_party_struct wTimeCapsulePartyMon5
wTimeCapsulePartyMon6:: red_party_struct wTimeCapsulePartyMon6 wTimeCapsulePartyMon6:: red_party_struct wTimeCapsulePartyMon6
assert_table_length PARTY_LENGTH
wTimeCapsulePartyMonOTNames:: ds NAME_LENGTH * PARTY_LENGTH wTimeCapsulePartyMonOTNames:: ds NAME_LENGTH * PARTY_LENGTH
wTimeCapsulePartyMonNicks:: ds MON_NAME_LENGTH * PARTY_LENGTH wTimeCapsulePartyMonNicks:: ds MON_NAME_LENGTH * PARTY_LENGTH
@ -2558,12 +2567,14 @@ ENDU
UNION UNION
; ot party mons ; ot party mons
wOTPartyMons:: wOTPartyMons::
table_width PARTYMON_STRUCT_LENGTH, wOTPartyMons
wOTPartyMon1:: party_struct wOTPartyMon1 wOTPartyMon1:: party_struct wOTPartyMon1
wOTPartyMon2:: party_struct wOTPartyMon2 wOTPartyMon2:: party_struct wOTPartyMon2
wOTPartyMon3:: party_struct wOTPartyMon3 wOTPartyMon3:: party_struct wOTPartyMon3
wOTPartyMon4:: party_struct wOTPartyMon4 wOTPartyMon4:: party_struct wOTPartyMon4
wOTPartyMon5:: party_struct wOTPartyMon5 wOTPartyMon5:: party_struct wOTPartyMon5
wOTPartyMon6:: party_struct wOTPartyMon6 wOTPartyMon6:: party_struct wOTPartyMon6
assert_table_length PARTY_LENGTH
wOTPartyMonsEnd:: wOTPartyMonsEnd::
wOTPartyMonOT:: ds NAME_LENGTH * PARTY_LENGTH wOTPartyMonOT:: ds NAME_LENGTH * PARTY_LENGTH
@ -2719,6 +2730,7 @@ wFollowerMovementQueueLength:: db
wFollowMovementQueue:: ds 5 wFollowMovementQueue:: ds 5
wObjectStructs:: wObjectStructs::
table_width OBJECT_LENGTH, wObjectStructs
wPlayerStruct:: object_struct wPlayer wPlayerStruct:: object_struct wPlayer
wObject1Struct:: object_struct wObject1 wObject1Struct:: object_struct wObject1
wObject2Struct:: object_struct wObject2 wObject2Struct:: object_struct wObject2
@ -2732,12 +2744,14 @@ wObject9Struct:: object_struct wObject9
wObject10Struct:: object_struct wObject10 wObject10Struct:: object_struct wObject10
wObject11Struct:: object_struct wObject11 wObject11Struct:: object_struct wObject11
wObject12Struct:: object_struct wObject12 wObject12Struct:: object_struct wObject12
assert_table_length NUM_OBJECT_STRUCTS
wCmdQueue:: ds CMDQUEUE_CAPACITY * CMDQUEUE_ENTRY_SIZE wCmdQueue:: ds CMDQUEUE_CAPACITY * CMDQUEUE_ENTRY_SIZE
ds 40 ds 40
wMapObjects:: wMapObjects::
table_width MAPOBJECT_LENGTH, wMapObjects
wPlayerObject:: map_object wPlayer wPlayerObject:: map_object wPlayer
wMap1Object:: map_object wMap1 wMap1Object:: map_object wMap1
wMap2Object:: map_object wMap2 wMap2Object:: map_object wMap2
@ -2754,6 +2768,7 @@ wMap12Object:: map_object wMap12
wMap13Object:: map_object wMap13 wMap13Object:: map_object wMap13
wMap14Object:: map_object wMap14 wMap14Object:: map_object wMap14
wMap15Object:: map_object wMap15 wMap15Object:: map_object wMap15
assert_table_length NUM_OBJECTS
wObjectMasks:: ds NUM_OBJECTS wObjectMasks:: ds NUM_OBJECTS
@ -3117,12 +3132,14 @@ wPartySpecies:: ds PARTY_LENGTH
wPartyEnd:: db ; older code doesn't check wPartyCount wPartyEnd:: db ; older code doesn't check wPartyCount
wPartyMons:: wPartyMons::
table_width PARTYMON_STRUCT_LENGTH, wPartyMons
wPartyMon1:: party_struct wPartyMon1 wPartyMon1:: party_struct wPartyMon1
wPartyMon2:: party_struct wPartyMon2 wPartyMon2:: party_struct wPartyMon2
wPartyMon3:: party_struct wPartyMon3 wPartyMon3:: party_struct wPartyMon3
wPartyMon4:: party_struct wPartyMon4 wPartyMon4:: party_struct wPartyMon4
wPartyMon5:: party_struct wPartyMon5 wPartyMon5:: party_struct wPartyMon5
wPartyMon6:: party_struct wPartyMon6 wPartyMon6:: party_struct wPartyMon6
assert_table_length PARTY_LENGTH
wPartyMonOT:: ds NAME_LENGTH * PARTY_LENGTH wPartyMonOT:: ds NAME_LENGTH * PARTY_LENGTH
@ -3343,6 +3360,7 @@ wBattleAnimTileDict::
ds NUM_BATTLEANIMTILEDICT_ENTRIES * 2 ds NUM_BATTLEANIMTILEDICT_ENTRIES * 2
wActiveAnimObjects:: wActiveAnimObjects::
table_width BATTLEANIMSTRUCT_LENGTH, wActiveAnimObjects
wAnimObject01:: battle_anim_struct wAnimObject01 wAnimObject01:: battle_anim_struct wAnimObject01
wAnimObject02:: battle_anim_struct wAnimObject02 wAnimObject02:: battle_anim_struct wAnimObject02
wAnimObject03:: battle_anim_struct wAnimObject03 wAnimObject03:: battle_anim_struct wAnimObject03
@ -3353,13 +3371,16 @@ wAnimObject07:: battle_anim_struct wAnimObject07
wAnimObject08:: battle_anim_struct wAnimObject08 wAnimObject08:: battle_anim_struct wAnimObject08
wAnimObject09:: battle_anim_struct wAnimObject09 wAnimObject09:: battle_anim_struct wAnimObject09
wAnimObject10:: battle_anim_struct wAnimObject10 wAnimObject10:: battle_anim_struct wAnimObject10
assert_table_length NUM_ANIM_OBJECTS
wActiveBGEffects:: wActiveBGEffects::
table_width BG_EFFECT_STRUCT_LENGTH, wActiveBGEffects
wBGEffect1:: battle_bg_effect wBGEffect1 wBGEffect1:: battle_bg_effect wBGEffect1
wBGEffect2:: battle_bg_effect wBGEffect2 wBGEffect2:: battle_bg_effect wBGEffect2
wBGEffect3:: battle_bg_effect wBGEffect3 wBGEffect3:: battle_bg_effect wBGEffect3
wBGEffect4:: battle_bg_effect wBGEffect4 wBGEffect4:: battle_bg_effect wBGEffect4
wBGEffect5:: battle_bg_effect wBGEffect5 wBGEffect5:: battle_bg_effect wBGEffect5
assert_table_length NUM_BG_EFFECTS
wLastAnimObjectIndex:: db wLastAnimObjectIndex:: db