Merge pull request #183 from cassidoxa/sram_checksum
Compute and write save checksum on new file creation
This commit is contained in:
@@ -105,13 +105,11 @@ OnFileCreation:
|
|||||||
|
|
||||||
; Set validity value and do some cleanup. Jump to checksum.
|
; Set validity value and do some cleanup. Jump to checksum.
|
||||||
LDA.w #$55AA : STA.l FileValiditySRAM
|
LDA.w #$55AA : STA.l FileValiditySRAM
|
||||||
|
JSL.l WriteNewFileChecksum
|
||||||
STZ.b Scrap00
|
STZ.b Scrap00
|
||||||
STZ.b Scrap01
|
STZ.b Scrap01
|
||||||
LDX.b Scrap00
|
|
||||||
LDY.w #$0000
|
|
||||||
TYA
|
|
||||||
|
|
||||||
JML.l InitializeSaveFile_build_checksum
|
JML.l InitializeSaveFile_done
|
||||||
;--------------------------------------------------------------------------------
|
;--------------------------------------------------------------------------------
|
||||||
OnFileLoad:
|
OnFileLoad:
|
||||||
REP #$10 ; set 16 bit index registers
|
REP #$10 ; set 16 bit index registers
|
||||||
|
|||||||
@@ -175,7 +175,6 @@ macro BottomHalf(address)
|
|||||||
endmacro
|
endmacro
|
||||||
;--------------------------------------------------------------------------------
|
;--------------------------------------------------------------------------------
|
||||||
FullInventoryExternal:
|
FullInventoryExternal:
|
||||||
LDA.l StatsLocked : BEQ + : RTL : +
|
|
||||||
PHA : PHX : PHP : JMP AddInventory_incrementCounts
|
PHA : PHX : PHP : JMP AddInventory_incrementCounts
|
||||||
;--------------------------------------------------------------------------------
|
;--------------------------------------------------------------------------------
|
||||||
AddInventory:
|
AddInventory:
|
||||||
@@ -225,8 +224,6 @@ AddInventory:
|
|||||||
+
|
+
|
||||||
|
|
||||||
.incrementCounts
|
.incrementCounts
|
||||||
LDA.l StatsLocked : BEQ + : JMP .done : +
|
|
||||||
|
|
||||||
; don't count any of this stuff
|
; don't count any of this stuff
|
||||||
CPY.b #$20 : BNE + : JMP .itemCounts : + ; Crystal
|
CPY.b #$20 : BNE + : JMP .itemCounts : + ; Crystal
|
||||||
CPY.b #$26 : BNE + : JMP .itemCounts : + ; Heart Piece Completion Heart
|
CPY.b #$26 : BNE + : JMP .itemCounts : + ; Heart Piece Completion Heart
|
||||||
|
|||||||
15
save.asm
15
save.asm
@@ -67,6 +67,21 @@ ValidateSRAM:
|
|||||||
SEP #$30
|
SEP #$30
|
||||||
RTL
|
RTL
|
||||||
;--------------------------------------------------------------------------------
|
;--------------------------------------------------------------------------------
|
||||||
|
WriteNewFileChecksum:
|
||||||
|
LDX.w #$0000 : TXA : - ; Checksum first $04FE bytes
|
||||||
|
CLC : ADC.l CartridgeSRAM, X
|
||||||
|
INX #2
|
||||||
|
CPX.w #$04FE : BNE -
|
||||||
|
LDX.w #$0000 : - ; Checksum extended save data
|
||||||
|
CLC : ADC.l ExtendedFileNameSRAM, X
|
||||||
|
INX #2
|
||||||
|
CPX.w #$0FFE : BNE -
|
||||||
|
STA.b Scrap00
|
||||||
|
LDA.w #$5A5A
|
||||||
|
SEC : SBC.b Scrap00
|
||||||
|
STA.l InverseChecksumSRAM
|
||||||
|
RTL
|
||||||
|
;--------------------------------------------------------------------------------
|
||||||
ClearExtendedSaveFile:
|
ClearExtendedSaveFile:
|
||||||
STA.l $700400, X ; what we wrote over
|
STA.l $700400, X ; what we wrote over
|
||||||
STA.l $700500, X
|
STA.l $700500, X
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ Vram_EraseTilemaps_triforce = 008333
|
|||||||
Sound_LoadLightWorldSongBank = $008913
|
Sound_LoadLightWorldSongBank = $008913
|
||||||
Sound_LoadLightWorldSongBank_do_load = $00891D
|
Sound_LoadLightWorldSongBank_do_load = $00891D
|
||||||
EnableForceBlank = $00893D
|
EnableForceBlank = $00893D
|
||||||
|
SaveGameFile = $00894A ; long
|
||||||
DungeonMask = $0098C0
|
DungeonMask = $0098C0
|
||||||
DecompSwordGfx = $00D308
|
DecompSwordGfx = $00D308
|
||||||
DecompShieldGfx = $00D348
|
DecompShieldGfx = $00D348
|
||||||
@@ -75,6 +76,7 @@ OverworldMap_LoadSprGfx = $0ABAB9
|
|||||||
NameFile_MakeScreenVisible = $0CD7D1
|
NameFile_MakeScreenVisible = $0CD7D1
|
||||||
InitializeSaveFile = $0CDB3E
|
InitializeSaveFile = $0CDB3E
|
||||||
InitializeSaveFile_build_checksum = $0CDBC0
|
InitializeSaveFile_build_checksum = $0CDBC0
|
||||||
|
InitializeSaveFile_done = $0CDBDB
|
||||||
GetRandomInt = $0DBA71
|
GetRandomInt = $0DBA71
|
||||||
OAM_AllocateFromRegionA = $0DBA80
|
OAM_AllocateFromRegionA = $0DBA80
|
||||||
OAM_AllocateFromRegionB = $0DBA84
|
OAM_AllocateFromRegionB = $0DBA84
|
||||||
|
|||||||
Reference in New Issue
Block a user