Use better wram labels in sram

this way, sram doesn't have to refer to the actual content of wram
This commit is contained in:
dannye 2015-08-10 23:03:31 -05:00
parent dfc152d667
commit 1df1e9181e
3 changed files with 58 additions and 41 deletions

View file

@ -60,20 +60,20 @@ LoadSAV0: ; 73623 (1c:7623)
ld bc, 11 ld bc, 11
call CopyData call CopyData
ld hl, sMainData ld hl, sMainData
ld de, wPokedexOwned ld de, wMainDataStart
ld bc, sSpriteData - sMainData ld bc, wMainDataEnd - wMainDataStart
call CopyData call CopyData
ld hl, W_CURMAPTILESET ld hl, W_CURMAPTILESET
set 7, [hl] set 7, [hl]
ld hl, sSpriteData ld hl, sSpriteData
ld de, wSpriteStateData1 ld de, wSpriteDataStart
ld bc, sPartyData - sSpriteData ld bc, wSpriteDataEnd - wSpriteDataStart
call CopyData call CopyData
ld a, [sTilesetType] ld a, [sTilesetType]
ld [hTilesetType], a ld [hTilesetType], a
ld hl, sCurBoxData ld hl, sCurBoxData
ld de, W_NUMINBOX ld de, wBoxDataStart
ld bc, wBoxMonNicksEnd - W_NUMINBOX ld bc, wBoxDataEnd - wBoxDataStart
call CopyData call CopyData
and a and a
jp SAVGoodChecksum jp SAVGoodChecksum
@ -92,8 +92,8 @@ LoadSAV1: ; 73690 (1c:7690)
cp c cp c
jr nz, SAVBadCheckSum jr nz, SAVBadCheckSum
ld hl, sCurBoxData ld hl, sCurBoxData
ld de, W_NUMINBOX ld de, wBoxDataStart
ld bc, wBoxMonNicksEnd - W_NUMINBOX ld bc, wBoxDataEnd - wBoxDataStart
call CopyData call CopyData
and a and a
jp SAVGoodChecksum jp SAVGoodChecksum
@ -112,8 +112,8 @@ LoadSAV2: ; 736bd (1c:76bd)
cp c cp c
jp nz, SAVBadCheckSum jp nz, SAVBadCheckSum
ld hl, sPartyData ld hl, sPartyData
ld de, wPartyCount ld de, wPartyDataStart
ld bc, wPokedexOwned - wPartyCount ld bc, wPartyDataEnd - wPartyDataStart
call CopyData call CopyData
ld hl, sMainData ld hl, sMainData
ld de, wPokedexOwned ld de, wPokedexOwned
@ -205,17 +205,17 @@ SaveSAVtoSRAM0: ; 7378c (1c:778c)
ld de, sPlayerName ld de, sPlayerName
ld bc, 11 ld bc, 11
call CopyData call CopyData
ld hl, wPokedexOwned ld hl, wMainDataStart
ld de, sMainData ld de, sMainData
ld bc, W_NUMINBOX - wPokedexOwned ld bc, wMainDataEnd - wMainDataStart
call CopyData call CopyData
ld hl, wSpriteStateData1 ld hl, wSpriteDataStart
ld de, sSpriteData ld de, sSpriteData
ld bc, sPartyData - sSpriteData ld bc, wSpriteDataEnd - wSpriteDataStart
call CopyData call CopyData
ld hl, W_NUMINBOX ld hl, wBoxDataStart
ld de, sCurBoxData ld de, sCurBoxData
ld bc, wBoxMonNicksEnd - W_NUMINBOX ld bc, wBoxDataEnd - wBoxDataStart
call CopyData call CopyData
ld a, [hTilesetType] ld a, [hTilesetType]
ld [sTilesetType], a ld [sTilesetType], a
@ -235,9 +235,9 @@ SaveSAVtoSRAM1: ; 737e2 (1c:77e2)
ld a, $1 ld a, $1
ld [MBC1SRamBankingMode], a ld [MBC1SRamBankingMode], a
ld [MBC1SRamBank], a ld [MBC1SRamBank], a
ld hl, W_NUMINBOX ld hl, wBoxDataStart
ld de, sCurBoxData ld de, sCurBoxData
ld bc, wBoxMonNicksEnd - W_NUMINBOX ld bc, wBoxDataEnd - wBoxDataStart
call CopyData call CopyData
ld hl, sPlayerName ld hl, sPlayerName
ld bc, sMainDataCheckSum - sPlayerName ld bc, sMainDataCheckSum - sPlayerName
@ -254,9 +254,9 @@ SaveSAVtoSRAM2: ; 7380f (1c:780f)
ld a, $1 ld a, $1
ld [MBC1SRamBankingMode], a ld [MBC1SRamBankingMode], a
ld [MBC1SRamBank], a ld [MBC1SRamBank], a
ld hl, wPartyCount ld hl, wPartyDataStart
ld de, sPartyData ld de, sPartyData
ld bc, wPokedexOwned - wPartyCount ld bc, wPartyDataEnd - wPartyDataStart
call CopyData call CopyData
ld hl, wPokedexOwned ; pokédex only ld hl, wPokedexOwned ; pokédex only
ld de, sMainData ld de, sMainData
@ -300,7 +300,7 @@ CalcIndividualBoxCheckSums: ; 73863 (1c:7863)
.loop .loop
push bc push bc
push de push de
ld bc, wBoxMonNicksEnd - W_NUMINBOX ld bc, wBoxDataEnd - wBoxDataStart
call SAVCheckSum call SAVCheckSum
pop de pop de
ld [de], a ld [de], a
@ -361,13 +361,13 @@ ChangeBox:: ; 738a1 (1c:78a1)
call GetBoxSRAMLocation call GetBoxSRAMLocation
ld e, l ld e, l
ld d, h ld d, h
ld hl, W_NUMINBOX ld hl, wBoxDataStart
call CopyBoxToOrFromSRAM ; copy old box from WRAM to SRAM call CopyBoxToOrFromSRAM ; copy old box from WRAM to SRAM
ld a, [wCurrentMenuItem] ld a, [wCurrentMenuItem]
set 7, a set 7, a
ld [wCurrentBoxNum], a ld [wCurrentBoxNum], a
call GetBoxSRAMLocation call GetBoxSRAMLocation
ld de, W_NUMINBOX ld de, wBoxDataStart
call CopyBoxToOrFromSRAM ; copy new box from SRAM to WRAM call CopyBoxToOrFromSRAM ; copy new box from SRAM to WRAM
ld hl, W_MAPTEXTPTR ld hl, W_MAPTEXTPTR
ld de, wChangeBoxSavedMapTextPointer ld de, wChangeBoxSavedMapTextPointer
@ -398,7 +398,7 @@ CopyBoxToOrFromSRAM: ; 7390e (1c:790e)
ld [MBC1SRamBankingMode], a ld [MBC1SRamBankingMode], a
ld a, b ld a, b
ld [MBC1SRamBank], a ld [MBC1SRamBank], a
ld bc, wBoxMonNicksEnd - W_NUMINBOX ld bc, wBoxDataEnd - wBoxDataStart
call CopyData call CopyData
pop hl pop hl

View file

@ -13,33 +13,33 @@ SECTION "Save Data", SRAM, BANK[1]
ds $598 ds $598
sPlayerName:: ds 11 ; a598 sPlayerName:: ds 11 ; a598
sMainData:: ds W_NUMINBOX - wPokedexOwned ; a5a3 sMainData:: ds wMainDataEnd - wMainDataStart ; a5a3
sSpriteData:: ds $200 ; wOAMBuffer - wSpriteStateData1 ; ad2c sSpriteData:: ds wSpriteDataEnd - wSpriteDataStart ; ad2c
sPartyData:: ds wPokedexOwned - wPartyCount ; af2c sPartyData:: ds wPartyDataEnd - wPartyDataStart ; af2c
sCurBoxData:: ds wBoxMonNicksEnd - W_NUMINBOX ; b0c0 sCurBoxData:: ds wBoxDataEnd - wBoxDataStart ; b0c0
sTilesetType:: ds 1 ; b522 sTilesetType:: ds 1 ; b522
sMainDataCheckSum:: ds 1 ; b523 sMainDataCheckSum:: ds 1 ; b523
SECTION "Saved Boxes 1", SRAM, BANK[2] SECTION "Saved Boxes 1", SRAM, BANK[2]
sBox1:: ds wBoxMonNicksEnd - W_NUMINBOX ; a000 sBox1:: ds wBoxDataEnd - wBoxDataStart ; a000
sBox2:: ds wBoxMonNicksEnd - W_NUMINBOX ; a462 sBox2:: ds wBoxDataEnd - wBoxDataStart ; a462
sBox3:: ds wBoxMonNicksEnd - W_NUMINBOX ; a8c4 sBox3:: ds wBoxDataEnd - wBoxDataStart ; a8c4
sBox4:: ds wBoxMonNicksEnd - W_NUMINBOX ; ad26 sBox4:: ds wBoxDataEnd - wBoxDataStart ; ad26
sBox5:: ds wBoxMonNicksEnd - W_NUMINBOX ; b188 sBox5:: ds wBoxDataEnd - wBoxDataStart ; b188
sBox6:: ds wBoxMonNicksEnd - W_NUMINBOX ; b5ea sBox6:: ds wBoxDataEnd - wBoxDataStart ; b5ea
sBank2AllBoxesChecksum:: ds 1 ; ba4c sBank2AllBoxesChecksum:: ds 1 ; ba4c
sBank2IndividualBoxChecksums:: ds 6 ; ba4d sBank2IndividualBoxChecksums:: ds 6 ; ba4d
SECTION "Saved Boxes 2", SRAM, BANK[3] SECTION "Saved Boxes 2", SRAM, BANK[3]
sBox7:: ds wBoxMonNicksEnd - W_NUMINBOX ; a000 sBox7:: ds wBoxDataEnd - wBoxDataStart ; a000
sBox8:: ds wBoxMonNicksEnd - W_NUMINBOX ; a462 sBox8:: ds wBoxDataEnd - wBoxDataStart ; a462
sBox9:: ds wBoxMonNicksEnd - W_NUMINBOX ; a8c4 sBox9:: ds wBoxDataEnd - wBoxDataStart ; a8c4
sBox10:: ds wBoxMonNicksEnd - W_NUMINBOX ; ad26 sBox10:: ds wBoxDataEnd - wBoxDataStart ; ad26
sBox11:: ds wBoxMonNicksEnd - W_NUMINBOX ; b188 sBox11:: ds wBoxDataEnd - wBoxDataStart ; b188
sBox12:: ds wBoxMonNicksEnd - W_NUMINBOX ; b5ea sBox12:: ds wBoxDataEnd - wBoxDataStart ; b5ea
sBank3AllBoxesChecksum:: ds 1 ; ba4c sBank3AllBoxesChecksum:: ds 1 ; ba4c
sBank3IndividualBoxChecksums:: ds 6 ; ba4d sBank3IndividualBoxChecksums:: ds 6 ; ba4d

View file

@ -205,6 +205,8 @@ wTempoModifier:: ; c0f2
SECTION "Sprite State Data", WRAM0[$c100] SECTION "Sprite State Data", WRAM0[$c100]
wSpriteDataStart::
wSpriteStateData1:: ; c100 wSpriteStateData1:: ; c100
; data for all sprites on the current map ; data for all sprites on the current map
; holds info for 16 sprites with $10 bytes each ; holds info for 16 sprites with $10 bytes each
@ -228,7 +230,7 @@ wSpriteStateData1:: ; c100
ds $10 * $10 ds $10 * $10
SECTION "Sprite State Data 2", WRAM0[$c200] ;SECTION "Sprite State Data 2", WRAM0[$c200]
wSpriteStateData2:: ; c200 wSpriteStateData2:: ; c200
; more data for all sprites on the current map ; more data for all sprites on the current map
@ -252,6 +254,8 @@ wSpriteStateData2:: ; c200
; C2xF ; C2xF
ds $10 * $10 ds $10 * $10
wSpriteDataEnd::
SECTION "OAM Buffer", WRAM0[$c300] SECTION "OAM Buffer", WRAM0[$c300]
@ -2162,6 +2166,9 @@ wSavedNPCMovementDirections2Index:: ; d157
wPlayerName:: ; d158 wPlayerName:: ; d158
ds 11 ds 11
wPartyDataStart::
wPartyCount:: ds 1 ; d163 wPartyCount:: ds 1 ; d163
wPartySpecies:: ds PARTY_LENGTH ; d164 wPartySpecies:: ds PARTY_LENGTH ; d164
wPartyEnd:: ds 1 ; d16a wPartyEnd:: ds 1 ; d16a
@ -2177,6 +2184,10 @@ wPartyMon6:: party_struct wPartyMon6 ; d247
wPartyMonOT:: ds 11 * PARTY_LENGTH ; d273 wPartyMonOT:: ds 11 * PARTY_LENGTH ; d273
wPartyMonNicks:: ds 11 * PARTY_LENGTH ; d2b5 wPartyMonNicks:: ds 11 * PARTY_LENGTH ; d2b5
wPartyDataEnd::
wMainDataStart::
wPokedexOwned:: ; d2f7 wPokedexOwned:: ; d2f7
flag_array NUM_POKEMON flag_array NUM_POKEMON
@ -3000,6 +3011,10 @@ W_DAYCAREMONOT:: ds 11 ; da54
wDayCareMon:: box_struct wDayCareMon ; da5f wDayCareMon:: box_struct wDayCareMon ; da5f
wMainDataEnd::
wBoxDataStart::
W_NUMINBOX:: ds 1 ; da80 W_NUMINBOX:: ds 1 ; da80
wBoxSpecies:: ds MONS_PER_BOX + 1 wBoxSpecies:: ds MONS_PER_BOX + 1
@ -3012,6 +3027,8 @@ wBoxMonOT:: ds 11 * MONS_PER_BOX ; dd2a
wBoxMonNicks:: ds 11 * MONS_PER_BOX ; de06 wBoxMonNicks:: ds 11 * MONS_PER_BOX ; de06
wBoxMonNicksEnd:: ; dee2 wBoxMonNicksEnd:: ; dee2
wBoxDataEnd::
SECTION "Stack", WRAMX[$dfff], BANK[1] SECTION "Stack", WRAMX[$dfff], BANK[1]
wStack:: ; dfff wStack:: ; dfff