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
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