diff --git a/events.asm b/events.asm index 1a729eb..e2988ff 100644 --- a/events.asm +++ b/events.asm @@ -89,16 +89,17 @@ OnAga2Defeated: ;-------------------------------------------------------------------------------- OnFileCreation: ; Copy initial SRAM state from ROM to cart SRAM + ; If the inital SRAM table is move these addresses must be changed PHB - LDA.w #$03D7 ; \ - LDX.w #$B000 ; | Copies from beginning of inital sram table up to file name - LDY.w #$0000 ; | (exclusively) - MVN $70, $30 ; / - ; Skip file name and validity value - LDA.w #$010C ; \ - LDX.w #$B3E3 ; | Rando-Specific Assignments & Game Stats block - LDY.w #$03E3 ; | - MVN $70, $30 ; / + LDA.w #$03D7 ; \ + LDX.w #$B000 ; | Copies from beginning of inital sram table up to file name + LDY.w #$0000 ; | (exclusively) + MVN SRAMBank, SRAMTableBank ; / + ; Skip file name and validity value + LDA.w #$010C ; \ + LDX.w #$B3E3 ; | Rando-Specific Assignments & Game Stats block + LDY.w #$03E3 ; | + MVN SRAMBank, SRAMTableBank ; / PLB ; resolve instant post-aga if standard diff --git a/initsramtable.asm b/initsramtable.asm index a93d0c1..00e80d7 100644 --- a/initsramtable.asm +++ b/initsramtable.asm @@ -15,6 +15,7 @@ fillword $0000 ; Zero out the table fill $500 ; org $30B000 ; PC 0x183000 +InitSRAMTable: InitRoomDataWRAM: org $30B060 ; PC 0x183060 InitATAltarRoom: dw $0000 ; aga curtains diff --git a/save.asm b/save.asm index f2723be..5dd1285 100644 --- a/save.asm +++ b/save.asm @@ -14,10 +14,10 @@ WriteSaveChecksumAndBackup: STA.l InverseChecksumSRAM PHB - LDA.w #$14FF ; \ - LDX.w #$0000 ; | Copies $1500 bytes from beginning of cart SRAM to - LDY.w #$4000 ; | $704000 - MVN $70, $70 ; / + LDA.w #$14FF ; \ + LDX.w #CartridgeSRAM&$FFFF ; | Copies $1500 bytes from beginning of cart SRAM to + LDY.w #SaveBackupSRAM&$FFFF ; | $704000 + MVN SRAMBank, SRAMBank ; / PLB RTL @@ -51,10 +51,10 @@ ValidateSRAM: TDC : STA.l FileValiditySRAM ; Delete save by way of zeroing validity marker BRA .goodchecksum : + PHB - LDA.w #$14FF ; \ - LDX.w #$4000 ; | Copies $1500 bytes from backup on cart SRAM to - LDY.w #$0000 ; | main save location at $700000 - MVN $70, $70 ; / + LDA.w #$14FF ; \ + LDX.w #SaveBackupSRAM&$FFFF ; | Copies $1500 bytes from backup on cart SRAM to + LDY.w #CartridgeSRAM&$FFFF ; | main save location at $700000 + MVN SRAMBank, SRAMBank ; / PLB .goodchecksum diff --git a/sram.asm b/sram.asm index 54ec69f..26f2171 100644 --- a/sram.asm +++ b/sram.asm @@ -417,6 +417,15 @@ SaveBackupSRAM: ; Backup copy of save ram. Game will attempt to ; checksum on file select screen load fails. base off +;================================================================================ +; Bank Definitions +;-------------------------------------------------------------------------------- +; If these move (most likely by placing initsramtable.asm somewhere else) these +; bank definitions need to be changed as well. +;================================================================================ +SRAMBank = $70 +SRAMTableBank = $30|$80 + ;================================================================================ ; Assertions ;================================================================================