Improve some RAM formatting

This commit is contained in:
Rangi 2021-05-31 11:46:10 -04:00
parent ce62dca69b
commit 8701ef4d61
10 changed files with 450 additions and 799 deletions

View File

@ -207,7 +207,7 @@ TM01 EQU const_value
add_tm ROCK_SLIDE ; $F8
add_tm TRI_ATTACK ; $F9
add_tm SUBSTITUTE ; $FA
assert NUM_TMS == const_value - TM01, "NUM_TMS ({d:NUM_TMS}) does not match the number of add_tm definitions"
ASSERT NUM_TMS == const_value - TM01, "NUM_TMS ({d:NUM_TMS}) does not match the number of add_tm definitions"
NUM_TM_HM EQU NUM_TMS + NUM_HMS

View File

@ -92,7 +92,7 @@ SubanimationPointers:
; subanim type, count
; REPT count
; db frame block id, base coordinate id, frame block mode
; endr
; ENDR
subanim: MACRO
db (\1 << 5) | \2

View File

@ -6308,7 +6308,7 @@ LoadPlayerBackPic:
ld de, OldManPicBack
.next
ld a, BANK(RedPicBack)
assert BANK(RedPicBack) == BANK(OldManPicBack)
ASSERT BANK(RedPicBack) == BANK(OldManPicBack)
call UncompressSpriteFromDE
predef ScaleSpriteByTwo
ld hl, wOAMBuffer

View File

@ -2617,7 +2617,7 @@ IsKeyItem_::
ld hl, KeyItemFlags
ld de, wBuffer
ld bc, 15 ; only 11 bytes are actually used
assert 15 >= (NUM_ITEMS + 7) / 8
ASSERT 15 >= (NUM_ITEMS + 7) / 8
call CopyData
pop af
dec a

View File

@ -20,11 +20,11 @@ GetName::
; TM names are separate from item names.
; BUG: This applies to all names instead of just items.
assert NUM_POKEMON_INDEXES < HM01, \
ASSERT NUM_POKEMON_INDEXES < HM01, \
"A bug in GetName will get TM/HM names for Pokémon above ${x:HM01}."
assert NUM_ATTACKS < HM01, \
ASSERT NUM_ATTACKS < HM01, \
"A bug in GetName will get TM/HM names for moves above ${x:HM01}."
assert NUM_TRAINERS < HM01, \
ASSERT NUM_TRAINERS < HM01, \
"A bug in GetName will get TM/HM names for trainers above ${x:HM01}."
cp HM01
jp nc, GetMachineName

View File

@ -182,7 +182,7 @@ WRAM0
org $c100
"Sprite State Data"
"OAM Buffer"
org $dfff
org $df00
"Stack"
VRAM
"VRAM"

View File

@ -118,10 +118,10 @@ ENDM
end_grass_wildmons: MACRO
IF CURRENT_GRASS_WILDMONS_RATE == 0
assert 1 == @ - {CURRENT_GRASS_WILDMONS_LABEL}, \
ASSERT 1 == @ - {CURRENT_GRASS_WILDMONS_LABEL}, \
"def_grass_wildmons {d:CURRENT_GRASS_WILDMONS_RATE}: expected 1 byte"
ELSE
assert WILDDATA_LENGTH == @ - {CURRENT_GRASS_WILDMONS_LABEL}, \
ASSERT WILDDATA_LENGTH == @ - {CURRENT_GRASS_WILDMONS_LABEL}, \
"def_grass_wildmons {d:CURRENT_GRASS_WILDMONS_RATE}: expected {d:WILDDATA_LENGTH} bytes"
ENDC
ENDM
@ -136,10 +136,10 @@ ENDM
end_water_wildmons: MACRO
IF CURRENT_WATER_WILDMONS_RATE == 0
assert 1 == @ - {CURRENT_WATER_WILDMONS_LABEL}, \
ASSERT 1 == @ - {CURRENT_WATER_WILDMONS_LABEL}, \
"def_water_wildmons {d:CURRENT_WATER_WILDMONS_RATE}: expected 1 byte"
ELSE
assert WILDDATA_LENGTH == @ - {CURRENT_WATER_WILDMONS_LABEL}, \
ASSERT WILDDATA_LENGTH == @ - {CURRENT_WATER_WILDMONS_LABEL}, \
"def_water_wildmons {d:CURRENT_WATER_WILDMONS_RATE}: expected {d:WILDDATA_LENGTH} bytes"
ENDC
ENDM

View File

@ -61,19 +61,19 @@ battle_struct: MACRO
ENDM
spritestatedata1: MACRO
\1PictureID:: db
\1MovementStatus:: db
\1ImageIndex:: db
\1YStepVector:: db
\1YPixels:: db
\1XStepVector:: db
\1XPixels:: db
\1PictureID:: db
\1MovementStatus:: db
\1ImageIndex:: db
\1YStepVector:: db
\1YPixels:: db
\1XStepVector:: db
\1XPixels:: db
\1IntraAnimFrameCounter:: db
\1AnimFrameCounter:: db
\1FacingDirection:: db
\1YAdjusted:: db
\1XAdjusted:: db
\1CollisionData:: db
\1AnimFrameCounter:: db
\1FacingDirection:: db
\1YAdjusted:: db
\1XAdjusted:: db
\1CollisionData:: db
ds 3
\1End::
ENDM
@ -81,17 +81,24 @@ ENDM
spritestatedata2: MACRO
\1WalkAnimationCounter:: db
ds 1
\1YDisplacement:: db
\1XDisplacement:: db
\1MapY:: db
\1MapX:: db
\1MovementByte1:: db
\1GrassPriority:: db
\1MovementDelay:: db
\1OrigFacingDirection:: db
\1YDisplacement:: db
\1XDisplacement:: db
\1MapY:: db
\1MapX:: db
\1MovementByte1:: db
\1GrassPriority:: db
\1MovementDelay:: db
\1OrigFacingDirection:: db
ds 3
\1PictureID:: db
\1ImageBaseOffset:: db
\1PictureID:: db
\1ImageBaseOffset:: db
ds 1
\1End::
ENDM
sprite_oam_struct: MACRO
\1YCoord:: db
\1XCoord:: db
\1TileID:: db
\1Attributes:: db
ENDM

View File

@ -1,4 +1,4 @@
SECTION "Sprite Buffers", SRAM ; BANK 0
SECTION "Sprite Buffers", SRAM
sSpriteBuffer0:: ds SPRITEBUFFERSIZE
sSpriteBuffer1:: ds SPRITEBUFFERSIZE
@ -9,42 +9,43 @@ sSpriteBuffer2:: ds SPRITEBUFFERSIZE
sHallOfFame:: ds HOF_TEAM * HOF_TEAM_CAPACITY
SECTION "Save Data", SRAM ; BANK 1
SECTION "Save Data", SRAM
ds $598
sPlayerName:: ds NAME_LENGTH
sMainData:: ds wMainDataEnd - wMainDataStart
sMainData:: ds wMainDataEnd - wMainDataStart
sSpriteData:: ds wSpriteDataEnd - wSpriteDataStart
sPartyData:: ds wPartyDataEnd - wPartyDataStart
sCurBoxData:: ds wBoxDataEnd - wBoxDataStart
sTileAnimations:: ds 1
sMainDataCheckSum:: ds 1
sPartyData:: ds wPartyDataEnd - wPartyDataStart
sCurBoxData:: ds wBoxDataEnd - wBoxDataStart
sTileAnimations:: db
sMainDataCheckSum:: db
; The PC boxes will not fit into one SRAM bank,
; so they use multiple SECTIONs
box_n = 0
boxes: MACRO
rept \1
REPT \1
box_n = box_n + 1
sBox{d:box_n}:: ds wBoxDataEnd - wBoxDataStart
endr
ENDR
ENDM
SECTION "Saved Boxes 1", SRAM ; BANK 2
SECTION "Saved Boxes 1", SRAM
; sBox1 - sBox6
boxes 6
sBank2AllBoxesChecksum:: ds 1
sBank2AllBoxesChecksum:: db
sBank2IndividualBoxChecksums:: ds 6
SECTION "Saved Boxes 2", SRAM ; BANK 3
SECTION "Saved Boxes 2", SRAM
; sBox7 - sBox12
boxes 6
sBank3AllBoxesChecksum:: ds 1
sBank3AllBoxesChecksum:: db
sBank3IndividualBoxChecksums:: ds 6
; All 12 boxes fit within 2 SRAM banks
assert box_n == NUM_BOXES, \
ASSERT box_n == NUM_BOXES, \
"boxes: Expected {d:NUM_BOXES} total boxes, got {d:box_n}"

1145
wram.asm

File diff suppressed because it is too large Load Diff