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 ROCK_SLIDE ; $F8
add_tm TRI_ATTACK ; $F9 add_tm TRI_ATTACK ; $F9
add_tm SUBSTITUTE ; $FA 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 NUM_TM_HM EQU NUM_TMS + NUM_HMS

View file

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

View file

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

View file

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

View file

@ -20,11 +20,11 @@ GetName::
; TM names are separate from item names. ; TM names are separate from item names.
; BUG: This applies to all names instead of just items. ; 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}." "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}." "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}." "A bug in GetName will get TM/HM names for trainers above ${x:HM01}."
cp HM01 cp HM01
jp nc, GetMachineName jp nc, GetMachineName

View file

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

View file

@ -118,10 +118,10 @@ ENDM
end_grass_wildmons: MACRO end_grass_wildmons: MACRO
IF CURRENT_GRASS_WILDMONS_RATE == 0 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" "def_grass_wildmons {d:CURRENT_GRASS_WILDMONS_RATE}: expected 1 byte"
ELSE 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" "def_grass_wildmons {d:CURRENT_GRASS_WILDMONS_RATE}: expected {d:WILDDATA_LENGTH} bytes"
ENDC ENDC
ENDM ENDM
@ -136,10 +136,10 @@ ENDM
end_water_wildmons: MACRO end_water_wildmons: MACRO
IF CURRENT_WATER_WILDMONS_RATE == 0 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" "def_water_wildmons {d:CURRENT_WATER_WILDMONS_RATE}: expected 1 byte"
ELSE 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" "def_water_wildmons {d:CURRENT_WATER_WILDMONS_RATE}: expected {d:WILDDATA_LENGTH} bytes"
ENDC ENDC
ENDM ENDM

View file

@ -61,19 +61,19 @@ battle_struct: MACRO
ENDM ENDM
spritestatedata1: MACRO spritestatedata1: MACRO
\1PictureID:: db \1PictureID:: db
\1MovementStatus:: db \1MovementStatus:: db
\1ImageIndex:: db \1ImageIndex:: db
\1YStepVector:: db \1YStepVector:: db
\1YPixels:: db \1YPixels:: db
\1XStepVector:: db \1XStepVector:: db
\1XPixels:: db \1XPixels:: db
\1IntraAnimFrameCounter:: db \1IntraAnimFrameCounter:: db
\1AnimFrameCounter:: db \1AnimFrameCounter:: db
\1FacingDirection:: db \1FacingDirection:: db
\1YAdjusted:: db \1YAdjusted:: db
\1XAdjusted:: db \1XAdjusted:: db
\1CollisionData:: db \1CollisionData:: db
ds 3 ds 3
\1End:: \1End::
ENDM ENDM
@ -81,17 +81,24 @@ ENDM
spritestatedata2: MACRO spritestatedata2: MACRO
\1WalkAnimationCounter:: db \1WalkAnimationCounter:: db
ds 1 ds 1
\1YDisplacement:: db \1YDisplacement:: db
\1XDisplacement:: db \1XDisplacement:: db
\1MapY:: db \1MapY:: db
\1MapX:: db \1MapX:: db
\1MovementByte1:: db \1MovementByte1:: db
\1GrassPriority:: db \1GrassPriority:: db
\1MovementDelay:: db \1MovementDelay:: db
\1OrigFacingDirection:: db \1OrigFacingDirection:: db
ds 3 ds 3
\1PictureID:: db \1PictureID:: db
\1ImageBaseOffset:: db \1ImageBaseOffset:: db
ds 1 ds 1
\1End:: \1End::
ENDM 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 sSpriteBuffer0:: ds SPRITEBUFFERSIZE
sSpriteBuffer1:: ds SPRITEBUFFERSIZE sSpriteBuffer1:: ds SPRITEBUFFERSIZE
@ -9,42 +9,43 @@ sSpriteBuffer2:: ds SPRITEBUFFERSIZE
sHallOfFame:: ds HOF_TEAM * HOF_TEAM_CAPACITY sHallOfFame:: ds HOF_TEAM * HOF_TEAM_CAPACITY
SECTION "Save Data", SRAM ; BANK 1 SECTION "Save Data", SRAM
ds $598 ds $598
sPlayerName:: ds NAME_LENGTH sPlayerName:: ds NAME_LENGTH
sMainData:: ds wMainDataEnd - wMainDataStart sMainData:: ds wMainDataEnd - wMainDataStart
sSpriteData:: ds wSpriteDataEnd - wSpriteDataStart sSpriteData:: ds wSpriteDataEnd - wSpriteDataStart
sPartyData:: ds wPartyDataEnd - wPartyDataStart sPartyData:: ds wPartyDataEnd - wPartyDataStart
sCurBoxData:: ds wBoxDataEnd - wBoxDataStart sCurBoxData:: ds wBoxDataEnd - wBoxDataStart
sTileAnimations:: ds 1 sTileAnimations:: db
sMainDataCheckSum:: ds 1 sMainDataCheckSum:: db
; The PC boxes will not fit into one SRAM bank, ; The PC boxes will not fit into one SRAM bank,
; so they use multiple SECTIONs ; so they use multiple SECTIONs
box_n = 0 box_n = 0
boxes: MACRO boxes: MACRO
rept \1 REPT \1
box_n = box_n + 1 box_n = box_n + 1
sBox{d:box_n}:: ds wBoxDataEnd - wBoxDataStart sBox{d:box_n}:: ds wBoxDataEnd - wBoxDataStart
endr ENDR
ENDM ENDM
SECTION "Saved Boxes 1", SRAM ; BANK 2 SECTION "Saved Boxes 1", SRAM
; sBox1 - sBox6 ; sBox1 - sBox6
boxes 6 boxes 6
sBank2AllBoxesChecksum:: ds 1 sBank2AllBoxesChecksum:: db
sBank2IndividualBoxChecksums:: ds 6 sBank2IndividualBoxChecksums:: ds 6
SECTION "Saved Boxes 2", SRAM ; BANK 3 SECTION "Saved Boxes 2", SRAM
; sBox7 - sBox12 ; sBox7 - sBox12
boxes 6 boxes 6
sBank3AllBoxesChecksum:: ds 1 sBank3AllBoxesChecksum:: db
sBank3IndividualBoxChecksums:: ds 6 sBank3IndividualBoxChecksums:: ds 6
; All 12 boxes fit within 2 SRAM banks ; 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}" "boxes: Expected {d:NUM_BOXES} total boxes, got {d:box_n}"

1145
wram.asm

File diff suppressed because it is too large Load diff