diff options
-rwxr-xr-x | engine/save.asm | 48 | ||||
-rw-r--r-- | sram.asm | 32 | ||||
-rwxr-xr-x | wram.asm | 19 |
3 files changed, 58 insertions, 41 deletions
diff --git a/engine/save.asm b/engine/save.asm index dfc50616..717b316a 100755 --- a/engine/save.asm +++ b/engine/save.asm @@ -60,20 +60,20 @@ LoadSAV0: ; 73623 (1c:7623) ld bc, 11 call CopyData ld hl, sMainData - ld de, wPokedexOwned - ld bc, sSpriteData - sMainData + ld de, wMainDataStart + ld bc, wMainDataEnd - wMainDataStart call CopyData ld hl, W_CURMAPTILESET set 7, [hl] ld hl, sSpriteData - ld de, wSpriteStateData1 - ld bc, sPartyData - sSpriteData + ld de, wSpriteDataStart + ld bc, wSpriteDataEnd - wSpriteDataStart call CopyData ld a, [sTilesetType] ld [hTilesetType], a ld hl, sCurBoxData - ld de, W_NUMINBOX - ld bc, wBoxMonNicksEnd - W_NUMINBOX + ld de, wBoxDataStart + ld bc, wBoxDataEnd - wBoxDataStart call CopyData and a jp SAVGoodChecksum @@ -92,8 +92,8 @@ LoadSAV1: ; 73690 (1c:7690) cp c jr nz, SAVBadCheckSum ld hl, sCurBoxData - ld de, W_NUMINBOX - ld bc, wBoxMonNicksEnd - W_NUMINBOX + ld de, wBoxDataStart + ld bc, wBoxDataEnd - wBoxDataStart call CopyData and a jp SAVGoodChecksum @@ -112,8 +112,8 @@ LoadSAV2: ; 736bd (1c:76bd) cp c jp nz, SAVBadCheckSum ld hl, sPartyData - ld de, wPartyCount - ld bc, wPokedexOwned - wPartyCount + ld de, wPartyDataStart + ld bc, wPartyDataEnd - wPartyDataStart call CopyData ld hl, sMainData ld de, wPokedexOwned @@ -205,17 +205,17 @@ SaveSAVtoSRAM0: ; 7378c (1c:778c) ld de, sPlayerName ld bc, 11 call CopyData - ld hl, wPokedexOwned + ld hl, wMainDataStart ld de, sMainData - ld bc, W_NUMINBOX - wPokedexOwned + ld bc, wMainDataEnd - wMainDataStart call CopyData - ld hl, wSpriteStateData1 + ld hl, wSpriteDataStart ld de, sSpriteData - ld bc, sPartyData - sSpriteData + ld bc, wSpriteDataEnd - wSpriteDataStart call CopyData - ld hl, W_NUMINBOX + ld hl, wBoxDataStart ld de, sCurBoxData - ld bc, wBoxMonNicksEnd - W_NUMINBOX + ld bc, wBoxDataEnd - wBoxDataStart call CopyData ld a, [hTilesetType] ld [sTilesetType], a @@ -235,9 +235,9 @@ SaveSAVtoSRAM1: ; 737e2 (1c:77e2) ld a, $1 ld [MBC1SRamBankingMode], a ld [MBC1SRamBank], a - ld hl, W_NUMINBOX + ld hl, wBoxDataStart ld de, sCurBoxData - ld bc, wBoxMonNicksEnd - W_NUMINBOX + ld bc, wBoxDataEnd - wBoxDataStart call CopyData ld hl, sPlayerName ld bc, sMainDataCheckSum - sPlayerName @@ -254,9 +254,9 @@ SaveSAVtoSRAM2: ; 7380f (1c:780f) ld a, $1 ld [MBC1SRamBankingMode], a ld [MBC1SRamBank], a - ld hl, wPartyCount + ld hl, wPartyDataStart ld de, sPartyData - ld bc, wPokedexOwned - wPartyCount + ld bc, wPartyDataEnd - wPartyDataStart call CopyData ld hl, wPokedexOwned ; pokédex only ld de, sMainData @@ -300,7 +300,7 @@ CalcIndividualBoxCheckSums: ; 73863 (1c:7863) .loop push bc push de - ld bc, wBoxMonNicksEnd - W_NUMINBOX + ld bc, wBoxDataEnd - wBoxDataStart call SAVCheckSum pop de ld [de], a @@ -361,13 +361,13 @@ ChangeBox:: ; 738a1 (1c:78a1) call GetBoxSRAMLocation ld e, l ld d, h - ld hl, W_NUMINBOX + ld hl, wBoxDataStart call CopyBoxToOrFromSRAM ; copy old box from WRAM to SRAM ld a, [wCurrentMenuItem] set 7, a ld [wCurrentBoxNum], a call GetBoxSRAMLocation - ld de, W_NUMINBOX + ld de, wBoxDataStart call CopyBoxToOrFromSRAM ; copy new box from SRAM to WRAM ld hl, W_MAPTEXTPTR ld de, wChangeBoxSavedMapTextPointer @@ -398,7 +398,7 @@ CopyBoxToOrFromSRAM: ; 7390e (1c:790e) ld [MBC1SRamBankingMode], a ld a, b ld [MBC1SRamBank], a - ld bc, wBoxMonNicksEnd - W_NUMINBOX + ld bc, wBoxDataEnd - wBoxDataStart call CopyData pop hl @@ -13,33 +13,33 @@ SECTION "Save Data", SRAM, BANK[1] ds $598 sPlayerName:: ds 11 ; a598 -sMainData:: ds W_NUMINBOX - wPokedexOwned ; a5a3 -sSpriteData:: ds $200 ; wOAMBuffer - wSpriteStateData1 ; ad2c -sPartyData:: ds wPokedexOwned - wPartyCount ; af2c -sCurBoxData:: ds wBoxMonNicksEnd - W_NUMINBOX ; b0c0 +sMainData:: ds wMainDataEnd - wMainDataStart ; a5a3 +sSpriteData:: ds wSpriteDataEnd - wSpriteDataStart ; ad2c +sPartyData:: ds wPartyDataEnd - wPartyDataStart ; af2c +sCurBoxData:: ds wBoxDataEnd - wBoxDataStart ; b0c0 sTilesetType:: ds 1 ; b522 sMainDataCheckSum:: ds 1 ; b523 SECTION "Saved Boxes 1", SRAM, BANK[2] -sBox1:: ds wBoxMonNicksEnd - W_NUMINBOX ; a000 -sBox2:: ds wBoxMonNicksEnd - W_NUMINBOX ; a462 -sBox3:: ds wBoxMonNicksEnd - W_NUMINBOX ; a8c4 -sBox4:: ds wBoxMonNicksEnd - W_NUMINBOX ; ad26 -sBox5:: ds wBoxMonNicksEnd - W_NUMINBOX ; b188 -sBox6:: ds wBoxMonNicksEnd - W_NUMINBOX ; b5ea +sBox1:: ds wBoxDataEnd - wBoxDataStart ; a000 +sBox2:: ds wBoxDataEnd - wBoxDataStart ; a462 +sBox3:: ds wBoxDataEnd - wBoxDataStart ; a8c4 +sBox4:: ds wBoxDataEnd - wBoxDataStart ; ad26 +sBox5:: ds wBoxDataEnd - wBoxDataStart ; b188 +sBox6:: ds wBoxDataEnd - wBoxDataStart ; b5ea sBank2AllBoxesChecksum:: ds 1 ; ba4c sBank2IndividualBoxChecksums:: ds 6 ; ba4d SECTION "Saved Boxes 2", SRAM, BANK[3] -sBox7:: ds wBoxMonNicksEnd - W_NUMINBOX ; a000 -sBox8:: ds wBoxMonNicksEnd - W_NUMINBOX ; a462 -sBox9:: ds wBoxMonNicksEnd - W_NUMINBOX ; a8c4 -sBox10:: ds wBoxMonNicksEnd - W_NUMINBOX ; ad26 -sBox11:: ds wBoxMonNicksEnd - W_NUMINBOX ; b188 -sBox12:: ds wBoxMonNicksEnd - W_NUMINBOX ; b5ea +sBox7:: ds wBoxDataEnd - wBoxDataStart ; a000 +sBox8:: ds wBoxDataEnd - wBoxDataStart ; a462 +sBox9:: ds wBoxDataEnd - wBoxDataStart ; a8c4 +sBox10:: ds wBoxDataEnd - wBoxDataStart ; ad26 +sBox11:: ds wBoxDataEnd - wBoxDataStart ; b188 +sBox12:: ds wBoxDataEnd - wBoxDataStart ; b5ea sBank3AllBoxesChecksum:: ds 1 ; ba4c sBank3IndividualBoxChecksums:: ds 6 ; ba4d @@ -205,6 +205,8 @@ wTempoModifier:: ; c0f2 SECTION "Sprite State Data", WRAM0[$c100] +wSpriteDataStart:: + wSpriteStateData1:: ; c100 ; data for all sprites on the current map ; holds info for 16 sprites with $10 bytes each @@ -228,7 +230,7 @@ wSpriteStateData1:: ; c100 ds $10 * $10 -SECTION "Sprite State Data 2", WRAM0[$c200] +;SECTION "Sprite State Data 2", WRAM0[$c200] wSpriteStateData2:: ; c200 ; more data for all sprites on the current map @@ -252,6 +254,8 @@ wSpriteStateData2:: ; c200 ; C2xF ds $10 * $10 +wSpriteDataEnd:: + SECTION "OAM Buffer", WRAM0[$c300] @@ -2162,6 +2166,9 @@ wSavedNPCMovementDirections2Index:: ; d157 wPlayerName:: ; d158 ds 11 + +wPartyDataStart:: + wPartyCount:: ds 1 ; d163 wPartySpecies:: ds PARTY_LENGTH ; d164 wPartyEnd:: ds 1 ; d16a @@ -2177,6 +2184,10 @@ wPartyMon6:: party_struct wPartyMon6 ; d247 wPartyMonOT:: ds 11 * PARTY_LENGTH ; d273 wPartyMonNicks:: ds 11 * PARTY_LENGTH ; d2b5 +wPartyDataEnd:: + + +wMainDataStart:: wPokedexOwned:: ; d2f7 flag_array NUM_POKEMON @@ -3000,6 +3011,10 @@ W_DAYCAREMONOT:: ds 11 ; da54 wDayCareMon:: box_struct wDayCareMon ; da5f +wMainDataEnd:: + + +wBoxDataStart:: W_NUMINBOX:: ds 1 ; da80 wBoxSpecies:: ds MONS_PER_BOX + 1 @@ -3012,6 +3027,8 @@ wBoxMonOT:: ds 11 * MONS_PER_BOX ; dd2a wBoxMonNicks:: ds 11 * MONS_PER_BOX ; de06 wBoxMonNicksEnd:: ; dee2 +wBoxDataEnd:: + SECTION "Stack", WRAMX[$dfff], BANK[1] wStack:: ; dfff |