From 7426ce5945f059ef25022183e2b4bd714c141100 Mon Sep 17 00:00:00 2001 From: cassidoxa Date: Thu, 24 Nov 2022 18:34:35 -0500 Subject: [PATCH] More RAM labels Fixed tablets checking for item collected, uses NpcFlags+1 Deleted mantle.asm, moved to lampmantlecone.asm --- LTTP_RND_GeneralBugfixes.asm | 4 +- accessibility.asm | 190 ++++++++--------- bookofmudora.asm | 2 +- bugfixes.asm | 34 ++-- compasses.asm | 10 +- controllerjank.asm | 5 +- darkroomitems.asm | 4 +- dialog.asm | 30 +-- doorframefixes.asm | 10 +- dungeonmap.asm | 2 +- elder.asm | 2 +- enemy_adjustments.asm | 10 +- entrances.asm | 53 +++-- events.asm | 39 ++-- failure.asm | 6 - fairyfixes.asm | 8 +- fileselect.asm | 132 ++++++------ flipperkill.asm | 17 +- flute.asm | 32 +-- framehook.asm | 64 +++--- glitched.asm | 2 +- goalitem.asm | 4 +- hardmode.asm | 12 +- heartpieces.asm | 10 +- hooks.asm | 32 +-- icepalacegraphics.asm | 2 +- initsramtable.asm | 2 +- inventory.asm | 42 ++-- inverted.asm | 42 ++-- lampmantlecone.asm | 46 +++-- maidencrystals.asm | 6 +- mantle.asm | 12 -- medallions.asm | 2 +- msu.asm | 10 +- music.asm | 28 ++- newhud.asm | 67 ++---- newitems.asm | 24 +-- npcitems.asm | 4 +- password.asm | 6 +- pendantcrystalhud.asm | 126 ++++++------ playername.asm | 10 +- ram.asm | 385 +++++++++++++++++++++++++++++++++-- shopkeeper.asm | 34 ++-- spriteswap.asm | 4 +- stats.asm | 18 +- stats/main.asm | 4 +- swordswap.asm | 10 +- tables.asm | 8 +- tablets.asm | 80 +++----- timer.asm | 62 +++--- utilities.asm | 76 +++---- zoraking.asm | 2 +- 52 files changed, 1048 insertions(+), 778 deletions(-) delete mode 100644 mantle.asm diff --git a/LTTP_RND_GeneralBugfixes.asm b/LTTP_RND_GeneralBugfixes.asm index 8eb4d4a..c323bc2 100644 --- a/LTTP_RND_GeneralBugfixes.asm +++ b/LTTP_RND_GeneralBugfixes.asm @@ -87,7 +87,6 @@ incsrc catfish.asm incsrc flute.asm incsrc dungeondrops.asm incsrc halfmagicbat.asm -incsrc mantle.asm incsrc swordswap.asm incsrc stats.asm incsrc dialog.asm @@ -298,12 +297,11 @@ warnpc $B08000 ;================================================================================ ;RAM ;See ram.asm for label assignments -;$7E021B[0x1]: Used by race game instead of $0ABF to avoid witch item conflict ;$7EC900[0x1F00]: BigRAM buffer ;$7EF000[0x500]: SRAM mirror First 0x500 bytes of SRAM ; See sram.asm for labels and assignments ;$7F5000[0x800]: Rando's main free ram region -; See tables.asm for specific assignments +; See ram.asm for specific assignments ;$7F6000[0x1000]: SRAM buffer mapped to vanilla save slots 1 and 2 ; See sram.asm for labels and assignments ;$7F7667[0x6719] - free ram diff --git a/accessibility.asm b/accessibility.asm index 85df32e..d02de7e 100644 --- a/accessibility.asm +++ b/accessibility.asm @@ -6,17 +6,17 @@ ConditionalLightning: CMP.b #$2C : BEQ ++ CMP.b #$5A : BEQ ++ LDA.l DisableFlashing : BNE ++ - LDA.b #$32 : STA.w $9A + LDA.b #$32 : STA.w CGADSUBQ RTL ++ LDA.b #$72 - STA.b $9A + STA.b CGADSUBQ RTL ;================================================================================ ConditionalWhitenBg: LDX.b #$00 LDA.l DisableFlashing : REP #$20 : BNE + - LDA.b $00,X + LDA.b Scrap00,X JSR WhitenLoopReal RTL + @@ -26,93 +26,93 @@ ConditionalWhitenBg: ;================================================================================ WhitenLoopReal: - - LDA.l $7EC340, X : JSL Filter_Majorly_Whiten_Color : STA.l $7EC540, X - LDA.l $7EC350, X : JSL Filter_Majorly_Whiten_Color : STA.l $7EC550, X - LDA.l $7EC360, X : JSL Filter_Majorly_Whiten_Color : STA.l $7EC560, X - LDA.l $7EC370, X : JSL Filter_Majorly_Whiten_Color : STA.l $7EC570, X - LDA.l $7EC380, X : JSL Filter_Majorly_Whiten_Color : STA.l $7EC580, X - LDA.l $7EC390, X : JSL Filter_Majorly_Whiten_Color : STA.l $7EC590, X - LDA.l $7EC3A0, X : JSL Filter_Majorly_Whiten_Color : STA.l $7EC5A0, X - LDA.l $7EC3B0, X : JSL Filter_Majorly_Whiten_Color : STA.l $7EC5B0, X - LDA.l $7EC3C0, X : JSL Filter_Majorly_Whiten_Color : STA.l $7EC5C0, X - LDA.l $7EC3D0, X : JSL Filter_Majorly_Whiten_Color : STA.l $7EC5D0, X - LDA.l $7EC3E0, X : JSL Filter_Majorly_Whiten_Color : STA.l $7EC5E0, X + LDA.l PaletteBufferAux+$40, X : JSL Filter_Majorly_Whiten_Color : STA.l PaletteBuffer+$40, X + LDA.l PaletteBufferAux+$50, X : JSL Filter_Majorly_Whiten_Color : STA.l PaletteBuffer+$50, X + LDA.l PaletteBufferAux+$60, X : JSL Filter_Majorly_Whiten_Color : STA.l PaletteBuffer+$60, X + LDA.l PaletteBufferAux+$70, X : JSL Filter_Majorly_Whiten_Color : STA.l PaletteBuffer+$70, X + LDA.l PaletteBufferAux+$80, X : JSL Filter_Majorly_Whiten_Color : STA.l PaletteBuffer+$80, X + LDA.l PaletteBufferAux+$90, X : JSL Filter_Majorly_Whiten_Color : STA.l PaletteBuffer+$90, X + LDA.l PaletteBufferAux+$A0, X : JSL Filter_Majorly_Whiten_Color : STA.l PaletteBuffer+$A0, X + LDA.l PaletteBufferAux+$B0, X : JSL Filter_Majorly_Whiten_Color : STA.l PaletteBuffer+$B0, X + LDA.l PaletteBufferAux+$C0, X : JSL Filter_Majorly_Whiten_Color : STA.l PaletteBuffer+$C0, X + LDA.l PaletteBufferAux+$D0, X : JSL Filter_Majorly_Whiten_Color : STA.l PaletteBuffer+$D0, X + LDA.l PaletteBufferAux+$E0, X : JSL Filter_Majorly_Whiten_Color : STA.l PaletteBuffer+$E0, X INX #2 : CPX.b #$10 : BEQ + JMP - + - LDA.l $7EC3F0 : JSL Filter_Majorly_Whiten_Color : STA.l $7EC5F0 - LDA.l $7EC3F2 : JSL Filter_Majorly_Whiten_Color : STA.l $7EC5F2 - LDA.l $7EC3F4 : JSL Filter_Majorly_Whiten_Color : STA.l $7EC5F4 + LDA.l PaletteBufferAux+$F0 : JSL Filter_Majorly_Whiten_Color : STA.l PaletteBuffer+$F0 + LDA.l PaletteBufferAux+$F2 : JSL Filter_Majorly_Whiten_Color : STA.l PaletteBuffer+$F2 + LDA.l PaletteBufferAux+$F4 : JSL Filter_Majorly_Whiten_Color : STA.l PaletteBuffer+$F4 LDA.b GameMode : CMP.w #$0007 : BNE + - LDA.w $048E + LDA.b RoomIndex CMP.w #$003C : BEQ ++ CMP.w #$009D : BEQ ++ CMP.w #$009C : BEQ ++ CMP.w #$00A5 : BEQ ++ + - LDA.l $7EC3F6 : JSL Filter_Majorly_Whiten_Color : STA.l $7EC5F6 - LDA.l $7EC3F8 : JSL Filter_Majorly_Whiten_Color : STA.l $7EC5F8 + LDA.l PaletteBufferAux+$F6 : JSL Filter_Majorly_Whiten_Color : STA.l PaletteBuffer+$F6 + LDA.l PaletteBufferAux+$F8 : JSL Filter_Majorly_Whiten_Color : STA.l PaletteBuffer+$F8 BRA +++ ++ - LDA.l $7EC3F6 : JSL Filter_Majorly_Whiten_Color : STA.l $7EC5F6 - LDA.l $7EC3F8 : JSL Filter_Majorly_Whiten_Color : STA.l $7EC5F8 + LDA.l PaletteBuffer+$F6 : JSL Filter_Majorly_Whiten_Color : STA.l PaletteBuffer+$F6 + LDA.l PaletteBuffer+$F8 : JSL Filter_Majorly_Whiten_Color : STA.l PaletteBuffer+$F8 BRA +++ +++ - LDA.l $7EC3FA : JSL Filter_Majorly_Whiten_Color : STA.l $7EC5FA - LDA.l $7EC3FC : JSL Filter_Majorly_Whiten_Color : STA.l $7EC5FC - LDA.l $7EC3FE : JSL Filter_Majorly_Whiten_Color : STA.l $7EC5FE + LDA.l PaletteBufferAux+$FA : JSL Filter_Majorly_Whiten_Color : STA.l PaletteBuffer+$FA + LDA.l PaletteBufferAux+$FC : JSL Filter_Majorly_Whiten_Color : STA.l PaletteBuffer+$FC + LDA.l PaletteBufferAux+$FE : JSL Filter_Majorly_Whiten_Color : STA.l PaletteBuffer+$FE REP #$10 - LDA.l $7EC540 : TAY - LDA.l $7EC300 : BNE + + LDA.l PaletteBuffer+$40 : TAY + LDA.l PaletteBufferAux : BNE + TAY + - TYA : STA.l $7EC500 + TYA : STA.l PaletteBuffer SEP #$30 RTS ;================================================================================ WhitenLoopDummy: - - LDA.l $7EC340, X : JSL Filter_Majorly_Whiten_Color : LDA.l $7EC540, X - LDA.l $7EC350, X : JSL Filter_Majorly_Whiten_Color : LDA.l $7EC550, X - LDA.l $7EC360, X : JSL Filter_Majorly_Whiten_Color : LDA.l $7EC560, X - LDA.l $7EC370, X : JSL Filter_Majorly_Whiten_Color : LDA.l $7EC570, X - LDA.l $7EC380, X : JSL Filter_Majorly_Whiten_Color : LDA.l $7EC580, X - LDA.l $7EC390, X : JSL Filter_Majorly_Whiten_Color : LDA.l $7EC590, X - LDA.l $7EC3A0, X : JSL Filter_Majorly_Whiten_Color : LDA.l $7EC5A0, X - LDA.l $7EC3B0, X : JSL Filter_Majorly_Whiten_Color : LDA.l $7EC5B0, X - LDA.l $7EC3C0, X : JSL Filter_Majorly_Whiten_Color : LDA.l $7EC5C0, X - LDA.l $7EC3D0, X : JSL Filter_Majorly_Whiten_Color : LDA.l $7EC5D0, X - LDA.l $7EC3E0, X : JSL Filter_Majorly_Whiten_Color : LDA.l $7EC5E0, X + LDA.l PaletteBufferAux+$40, X : JSL Filter_Majorly_Whiten_Color : LDA.l PaletteBuffer+$40, X + LDA.l PaletteBufferAux+$50, X : JSL Filter_Majorly_Whiten_Color : LDA.l PaletteBuffer+$50, X + LDA.l PaletteBufferAux+$60, X : JSL Filter_Majorly_Whiten_Color : LDA.l PaletteBuffer+$60, X + LDA.l PaletteBufferAux+$70, X : JSL Filter_Majorly_Whiten_Color : LDA.l PaletteBuffer+$70, X + LDA.l PaletteBufferAux+$80, X : JSL Filter_Majorly_Whiten_Color : LDA.l PaletteBuffer+$80, X + LDA.l PaletteBufferAux+$90, X : JSL Filter_Majorly_Whiten_Color : LDA.l PaletteBuffer+$90, X + LDA.l PaletteBufferAux+$A0, X : JSL Filter_Majorly_Whiten_Color : LDA.l PaletteBuffer+$A0, X + LDA.l PaletteBufferAux+$B0, X : JSL Filter_Majorly_Whiten_Color : LDA.l PaletteBuffer+$B0, X + LDA.l PaletteBufferAux+$C0, X : JSL Filter_Majorly_Whiten_Color : LDA.l PaletteBuffer+$C0, X + LDA.l PaletteBufferAux+$D0, X : JSL Filter_Majorly_Whiten_Color : LDA.l PaletteBuffer+$D0, X + LDA.l PaletteBufferAux+$E0, X : JSL Filter_Majorly_Whiten_Color : LDA.l PaletteBuffer+$E0, X INX #2 : CPX.b #$10 : BEQ + JMP - + - LDA.l $7EC3F0 : JSL Filter_Majorly_Whiten_Color : LDA.l $7EC5F0 - LDA.l $7EC3F2 : JSL Filter_Majorly_Whiten_Color : LDA.l $7EC5F2 - LDA.l $7EC3F4 : JSL Filter_Majorly_Whiten_Color : LDA.l $7EC5F4 + LDA.l PaletteBufferAux+$F0 : JSL Filter_Majorly_Whiten_Color : LDA.l PaletteBuffer+$F0 + LDA.l PaletteBufferAux+$F2 : JSL Filter_Majorly_Whiten_Color : LDA.l PaletteBuffer+$F2 + LDA.l PaletteBufferAux+$F4 : JSL Filter_Majorly_Whiten_Color : LDA.l PaletteBuffer+$F4 LDA.b GameMode : CMP.w #$0007 : BNE + ; only light invisifloor if we're in dungeon submodule - LDA.w $048E + LDA.b RoomIndex CMP.w #$003C : BEQ ++ ; hookshot cave CMP.w #$009D : BEQ ++ ; gt right CMP.w #$009C : BEQ ++ ; gt big room CMP.w #$00A5 : BEQ ++ ; wizzrobes 1 + - LDA.l $7EC3F6 : JSL Filter_Majorly_Whiten_Color : LDA.l $7EC5F6 - LDA.l $7EC3F8 : JSL Filter_Majorly_Whiten_Color : LDA.l $7EC5F8 + LDA.l PaletteBufferAux+$F6 : JSL Filter_Majorly_Whiten_Color : LDA.l PaletteBuffer+$F6 + LDA.l PaletteBufferAux+$F8 : JSL Filter_Majorly_Whiten_Color : LDA.l PaletteBuffer+$F8 BRA +++ ++ - LDA.l $7EC3F6 : JSL Filter_Majorly_Whiten_Color : STA.l $7EC5F6 - LDA.l $7EC3F8 : JSL Filter_Majorly_Whiten_Color : STA.l $7EC5F8 + LDA.l PaletteBufferAux+$F6 : JSL Filter_Majorly_Whiten_Color : STA.l PaletteBuffer+$F6 + LDA.l PaletteBufferAux+$F8 : JSL Filter_Majorly_Whiten_Color : STA.l PaletteBuffer+$F8 BRA +++ +++ - LDA.l $7EC3FA : JSL Filter_Majorly_Whiten_Color : LDA.l $7EC5FA - LDA.l $7EC3FC : JSL Filter_Majorly_Whiten_Color : LDA.l $7EC5FC - LDA.l $7EC3FE : JSL Filter_Majorly_Whiten_Color : LDA.l $7EC5FE + LDA.l PaletteBufferAux+$FA : JSL Filter_Majorly_Whiten_Color : LDA.l PaletteBuffer+$FA + LDA.l PaletteBufferAux+$FC : JSL Filter_Majorly_Whiten_Color : LDA.l PaletteBuffer+$FC + LDA.l PaletteBufferAux+$FE : JSL Filter_Majorly_Whiten_Color : LDA.l PaletteBuffer+$FE REP #$10 - LDA.l $7EC540 : TAY - LDA.l $7EC300 : BNE + + LDA.l PaletteBuffer+$40 : TAY + LDA.l PaletteBufferAux : BNE + TAY + - TYA : STA.l $7EC500 + TYA : STA.l PaletteBuffer SEP #$30 RTS ;================================================================================ @@ -120,36 +120,36 @@ RestoreBgEther: LDX.b #$00 LDA.l DisableFlashing : REP #$20 : BNE + - - LDA.b $00,X - LDA.l $7EC340, X : STA.l $7EC540, X - LDA.l $7EC350, X : STA.l $7EC550, X - LDA.l $7EC360, X : STA.l $7EC560, X - LDA.l $7EC370, X : STA.l $7EC570, X - LDA.l $7EC380, X : STA.l $7EC580, X - LDA.l $7EC390, X : STA.l $7EC590, X - LDA.l $7EC3A0, X : STA.l $7EC5A0, X - LDA.l $7EC3B0, X : STA.l $7EC5B0, X - LDA.l $7EC3C0, X : STA.l $7EC5C0, X - LDA.l $7EC3D0, X : STA.l $7EC5D0, X - LDA.l $7EC3E0, X : STA.l $7EC5E0, X - LDA.l $7EC3F0, X : STA.l $7EC5F0, X + LDA.b Scrap00,X + LDA.l PaletteBufferAux+$40, X : STA.l PaletteBuffer+$40, X + LDA.l PaletteBufferAux+$50, X : STA.l PaletteBuffer+$50, X + LDA.l PaletteBufferAux+$60, X : STA.l PaletteBuffer+$60, X + LDA.l PaletteBufferAux+$70, X : STA.l PaletteBuffer+$70, X + LDA.l PaletteBufferAux+$80, X : STA.l PaletteBuffer+$80, X + LDA.l PaletteBufferAux+$90, X : STA.l PaletteBuffer+$90, X + LDA.l PaletteBufferAux+$A0, X : STA.l PaletteBuffer+$A0, X + LDA.l PaletteBufferAux+$B0, X : STA.l PaletteBuffer+$B0, X + LDA.l PaletteBufferAux+$C0, X : STA.l PaletteBuffer+$C0, X + LDA.l PaletteBufferAux+$D0, X : STA.l PaletteBuffer+$D0, X + LDA.l PaletteBufferAux+$E0, X : STA.l PaletteBuffer+$E0, X + LDA.l PaletteBufferAux+$F0, X : STA.l PaletteBuffer+$F0, X INX #2 : CPX.b #$10 : BNE - BRA ++ + - LDA.b Scrap00 - LDA.l $7EC340, X : LDA.l $7EC540, X - LDA.l $7EC350, X : LDA.l $7EC550, X - LDA.l $7EC360, X : LDA.l $7EC560, X - LDA.l $7EC370, X : LDA.l $7EC570, X - LDA.l $7EC380, X : LDA.l $7EC580, X - LDA.l $7EC390, X : LDA.l $7EC590, X - LDA.l $7EC3A0, X : LDA.l $7EC5A0, X - LDA.l $7EC3B0, X : LDA.l $7EC5B0, X - LDA.l $7EC3C0, X : LDA.l $7EC5C0, X - LDA.l $7EC3D0, X : LDA.l $7EC5D0, X - LDA.l $7EC3E0, X : LDA.l $7EC5E0, X - LDA.l $7EC3F0, X : LDA.l $7EC5F0, X + LDA.l PaletteBufferAux+$40, X : LDA.l PaletteBuffer+$40, X + LDA.l PaletteBufferAux+$50, X : LDA.l PaletteBuffer+$50, X + LDA.l PaletteBufferAux+$60, X : LDA.l PaletteBuffer+$60, X + LDA.l PaletteBufferAux+$70, X : LDA.l PaletteBuffer+$70, X + LDA.l PaletteBufferAux+$80, X : LDA.l PaletteBuffer+$80, X + LDA.l PaletteBufferAux+$90, X : LDA.l PaletteBuffer+$90, X + LDA.l PaletteBufferAux+$A0, X : LDA.l PaletteBuffer+$A0, X + LDA.l PaletteBufferAux+$B0, X : LDA.l PaletteBuffer+$B0, X + LDA.l PaletteBufferAux+$C0, X : LDA.l PaletteBuffer+$C0, X + LDA.l PaletteBufferAux+$D0, X : LDA.l PaletteBuffer+$D0, X + LDA.l PaletteBufferAux+$E0, X : LDA.l PaletteBuffer+$E0, X + LDA.l PaletteBufferAux+$F0, X : LDA.l PaletteBuffer+$F0, X INX #2 : CPX.b #$10 : BNE - BRA ++ ++ @@ -165,11 +165,11 @@ DDMConditionalLightning: + LDA.b Scrap00 : LDX.b #$02 : LDY.b #$00 - - LDA.w $F4EB, Y : LDA.l $7EC560, X - LDA.w $F4F9, Y : LDA.l $7EC570, X - LDA.w $F507, Y : LDA.l $7EC590, X - LDA.w $F515, Y : LDA.l $7EC5E0, X - LDA.w $F523, Y : LDA.l $7EC5F0, X + LDA.w $F4EB, Y : LDA.l PaletteBuffer+$60, X + LDA.w $F4F9, Y : LDA.l PaletteBuffer+$70, X + LDA.w $F507, Y : LDA.l PaletteBuffer+$90, X + LDA.w $F515, Y : LDA.l PaletteBuffer+$E0, X + LDA.w $F523, Y : LDA.l PaletteBuffer+$F0, X INY #2 INX #2 : CPX.b #$10 : BNE - JML $07FAAC ; Bank0E.asm : 4754 both branches converge here @@ -178,14 +178,14 @@ ConditionalGTFlash: LDA.l DisableFlashing : REP #$20 : BNE + LDA.w Scrap - - LDA.w $F9C1, Y : STA.l $7EC5D0, X + LDA.w $F9C1, Y : STA.l PaletteBuffer+$D0, X INY #2 INX #2 : CPX.b #$10 : BNE - RTL + LDA.b Scrap00 - - LDA.w $F9C1, Y : LDA.l $7EC5D0, X + LDA.w $F9C1, Y : LDA.l PaletteBuffer+$D0, X INY #2 INX #2 : CPX.b #$10 : BNE - RTL @@ -193,14 +193,14 @@ ConditionalGTFlash: ConditionalRedFlash: LDA.l DisableFlashing : REP #$20 : BNE + LDA.b Scrap,X - LDA.w #$1D59 : STA.l $7EC5DA - LDA.w #$25FF : STA.l $7EC5DC + LDA.w #$1D59 : STA.l PaletteBuffer+$DA + LDA.w #$25FF : STA.l PaletteBuffer+$DC LDA.w #$001A RTL + LDA.b Scrap00 - LDA.w #$1D59 : LDA.l $7EC5DA - LDA.w #$25FF : LDA.l $7EC5DC + LDA.w #$1D59 : LDA.l PaletteBuffer+$DA + LDA.w #$25FF : LDA.l PaletteBuffer+$DC LDA.w #$0000 RTL ;================================================================================ @@ -236,7 +236,7 @@ LoadElectroPalette: REP #$10 : LDX.w #$01E2 : LDY.w #$000E JSR ConditionalLoadGearPalette SEP #$30 - INC.b $15 + INC.b NMICGRAM RTL ;================================================================================ ConditionalLoadGearPalette: @@ -246,7 +246,7 @@ ConditionalLoadGearPalette: LDA.b Scrap,X - LDA.b [Scrap00] - STA.l $7EC500, X + STA.l PaletteBuffer, X INC.b Scrap00 : INC.b Scrap00 INX #2 DEY @@ -256,7 +256,7 @@ ConditionalLoadGearPalette: LDA.b Scrap - LDA.b [Scrap00] - LDA.l $7EC500, X + LDA.l PaletteBuffer, X INC.b Scrap00 : INC.b Scrap00 INX #2 DEY @@ -272,13 +272,13 @@ RestoreElectroPalette: LDX.w #$01E2 : LDY.w #$000E JSR FillPaletteBufferFromAux SEP #$30 - INC.b $15 + INC.b NMICGRAM RTL ;================================================================================ FillPaletteBufferFromAux: - - LDA.l $7EC300, X - STA.l $7EC500, X + LDA.l PaletteBufferAux, X + STA.l PaletteBuffer, X INX #2 DEY BPL - diff --git a/bookofmudora.asm b/bookofmudora.asm index 7cd0796..399b98a 100644 --- a/bookofmudora.asm +++ b/bookofmudora.asm @@ -25,7 +25,7 @@ RTL ; Randomize Bonk Keys ;-------------------------------------------------------------------------------- LoadBonkItemGFX: - LDA.b #$08 : STA.w $0F50, X ; thing we wrote over + LDA.b #$08 : STA.w SpriteOAMProp, X ; thing we wrote over LoadBonkItemGFX_inner: LDA.b #$00 : STA.l RedrawFlag JSR LoadBonkItem diff --git a/bugfixes.asm b/bugfixes.asm index 26f18cc..e8a6b88 100644 --- a/bugfixes.asm +++ b/bugfixes.asm @@ -23,7 +23,7 @@ RTL ;1 = Don't Reset Music MSMusicReset: LDA.b OverworldIndex : CMP.b #$80 : BNE + - LDA.b $23 + LDA.b LinkPosX+1 + RTL ;-------------------------------------------------------------------------------- @@ -120,27 +120,27 @@ RTS ; Fix for SQ jumping causing accidental Exploration Glitch SQEGFix: LDA.l Bugfix_PodEG : BEQ ++ - STZ.w $047A ; disarm exploration glitch + STZ.w LayerAdjustment ; disarm exploration glitch ++ RTL ;-------------------------------------------------------------------------------- ; Fix crystal not spawning when using somaria vs boss TryToSpawnCrystalUntilSuccess: - STX.w $02D8 ; what we overwrote + STX.w ItemReceiptID ; what we overwrote JSL AddAncillaLong : BCS .failed ; a clear carry flag indicates success .spawned - STZ.b $AE ; the "trying to spawn crystal" flag - STZ.b $AF ; the "trying to spawn pendant" flag + STZ.b RoomTag ; the "trying to spawn crystal" flag + STZ.b RoomTag+1 ; the "trying to spawn pendant" flag .failed RTL ;-------------------------------------------------------------------------------- ; Fix crystal not spawning when using somaria vs boss WallmasterCameraFix: - STZ.b $A7 ; disable vertical camera scrolling for current room + STZ.b CameraBoundV ; disable vertical camera scrolling for current room REP #$20 - STZ.w $0618 ; something about scrolling, setting these to 0 tricks the game - STZ.w $061A ; into thinking we're at the edge of the room so it doesn't scroll. + STZ.w CameraScrollN ; something about scrolling, setting these to 0 tricks the game + STZ.w CameraScrollS ; into thinking we're at the edge of the room so it doesn't scroll. SEP #$20 JML Sound_SetSfx3PanLong ; what we wrote over, also this will RTL @@ -163,8 +163,8 @@ CMP.w #$070E : BEQ .new ; opening overworld map .original - LDA.b [Scrap00] - STA.l $7EC300, X - STA.l $7EC500, X + STA.l PaletteBufferAux, X + STA.l PaletteBuffer, X INC.b Scrap00 : INC.b Scrap00 INX #2 DEY @@ -173,7 +173,7 @@ RTL .new - LDA.b [Scrap00] - STA.l $7EC500, X + STA.l PaletteBuffer, X INC.b Scrap00 : INC.b Scrap00 INX #2 DEY @@ -183,10 +183,10 @@ RTL ;-------------------------------------------------------------------------------- ; Fix pedestal pull overlay PedestalPullOverlayFix: -LDA.b #$09 : STA.w $039F, X ; the thing we wrote over +LDA.b #$09 : STA.w AncillaGeneral, X ; the thing we wrote over LDA.b IndoorsFlag : BNE + - LDA.b OverworldIndex : CMP.b #$80 : BNE + - LDA.b OverlayID : CMP.b #$97 + LDA.b OverworldIndex : CMP.b #$80 : BNE + + LDA.b OverlayID : CMP.b #$97 + RTL @@ -213,8 +213,8 @@ pullpc ;-------------------------------------------------------------------------------- SetOverworldTransitionFlags: LDA.b #$01 - STA.w $0ABF ; used by witch - STA.w $021B ; used by race game + STA.w OWTransitionFlag + STA.w RaceGameFlag RTL ;-------------------------------------------------------------------------------- ParadoxCaveGfxFix: @@ -224,7 +224,7 @@ ParadoxCaveGfxFix: LDX.b PreviousRoom : CPX.w #$00EF : BNE .uploadLine ;Ignore uploading four specific lines of tiles to VRAM - LDX.w $0118 + LDX.w VRAMUploadAddress ; Line 1 CPX.w #$1800 : BEQ .skipMostOfLine ; Line 2 diff --git a/compasses.asm b/compasses.asm index 56502b0..b9b418a 100644 --- a/compasses.asm +++ b/compasses.asm @@ -22,18 +22,18 @@ DrawDungeonCompassCounts: JSR HudHexToDec2Digit REP #$20 PHX - LDX.b Scrap06 : TXA : ORA.w #$2400 : STA.l $7EC79A - LDX.b Scrap07 : TXA : ORA.w #$2400 : STA.l $7EC79C + LDX.b Scrap06 : TXA : ORA.w #$2400 : STA.l HUDTileMapBuffer+$9A + LDX.b Scrap07 : TXA : ORA.w #$2400 : STA.l HUDTileMapBuffer+$9C PLX LDA.l DungeonLocationsChecked, X : AND.w #$00FF SEP #$20 JSR HudHexToDec2Digit REP #$20 - LDX.b Scrap06 : TXA : ORA.w #$2400 : STA.l $7EC794 ; Draw the item count - LDX.b Scrap07 : TXA : ORA.w #$2400 : STA.l $7EC796 + LDX.b Scrap06 : TXA : ORA.w #$2400 : STA.l HUDTileMapBuffer+$94 ; Draw the item count + LDX.b Scrap07 : TXA : ORA.w #$2400 : STA.l HUDTileMapBuffer+$96 - LDA.w #$2830 : STA.l $7EC798 ; draw the slash + LDA.w #$2830 : STA.l HUDTileMapBuffer+$98 ; draw the slash .done RTL diff --git a/controllerjank.asm b/controllerjank.asm index 3aefc84..5ff3da7 100644 --- a/controllerjank.asm +++ b/controllerjank.asm @@ -117,10 +117,7 @@ HandleOneMindController: .no_multitap_switch .no_onemind - STZ.b $12 + STZ.b NMIDoneFlag JML $008034 ; reset frame loop - - - diff --git a/darkroomitems.asm b/darkroomitems.asm index 0d7b9b7..41be787 100644 --- a/darkroomitems.asm +++ b/darkroomitems.asm @@ -1,6 +1,6 @@ CheckReceivedItemPropertiesBeforeLoad: LDA.b RoomIndex : BEQ .normalCode - LDA.l $7EC005 : BNE .lightOff + LDA.l RoomFade : BNE .lightOff .normalCode LDA.l AddReceivedItemExpanded_properties, X ;Restore Rando Code RTL @@ -22,6 +22,6 @@ CheckReceivedItemPropertiesBeforeLoad: SEP #$30 PLB : PLY : PLX - INC.b $15 + INC.b NMICGRAM LDA.b #$00 RTL diff --git a/dialog.asm b/dialog.asm index f07f9f1..9055101 100644 --- a/dialog.asm +++ b/dialog.asm @@ -12,7 +12,7 @@ RTL ResetDialogPointer: STZ.w TextID : STZ.w TextID+1 ; reset decompression buffer LDA.b #$00 : STA.l AltTextFlag ; zero out the alternate flag - LDA.b #$1C : STA.w $1CE9 ; thing we wrote over + LDA.b #$1C : STA.w DelayTimer ; thing we wrote over RTL macro LoadDialogAddress(address) @@ -188,7 +188,7 @@ RTL ;-------------------------------------------------------------------------------- DialogResetSelectionIndex: JSL.l Attract_DecompressStoryGfx ; what we wrote over - STZ $1CE8 + STZ.w MessageCursor RTL ;-------------------------------------------------------------------------------- DialogItemReceive: @@ -210,7 +210,7 @@ DialogFairyThrow: ORA.l BottleContentsTwo : ORA.l BottleContentsThree : ORA.l BottleContentsFour : BNE .normal .noInventory - LDA.w SpriteUnknown, X : !ADD #$08 : STA.w SpriteUnknown, X + LDA.w SpriteActivity, X : !ADD #$08 : STA.w SpriteActivity, X LDA.b #$51 LDY.b #$01 RTL @@ -367,12 +367,12 @@ Sprite_ShowMessageMinimal_Alt: INY : LDA.b [Scrap00], Y : CMP.b #$FE : BNE + INY : LDA.b [Scrap00], Y : CMP.b #$6B : BNE + INY : LDA.b [Scrap00], Y : CMP.b #$04 : BNE + - STZ.w $1CE8 + STZ.w MessageCursor JMP .end + - STZ.w $0223 ; Otherwise set it so we are in text mode. - STZ.w $1CD8 ; Initialize the step in the submodule + STZ.w MessageJunk ; Otherwise set it so we are in text mode. + STZ.w MessageSubModule ; Go to text display mode (as opposed to maps, etc) LDA.b #$02 : STA.b GameSubMode @@ -399,13 +399,13 @@ CalculateSignIndex: LDA.b OverworldIndex : ASL A : TAY ;what we wrote over - LDA.w $0712 : BEQ .done ; If a small map, we can skip these calculations. + LDA.w OWScreenSize : BEQ .done ; If a small map, we can skip these calculations. - LDA.b $21 : AND.w #$0002 : ASL #2 : EOR.b OverworldIndex : AND.w #$0008 : BEQ + + LDA.b LinkPosY+1 : AND.w #$0002 : ASL #2 : EOR.b OverworldIndex : AND.w #$0008 : BEQ + TYA : !ADD.w #$0010 : TAY ;add 16 if we are in lower half of big screen. + - LDA.b $23 : AND.w #$0002 : LSR : EOR.b OverworldIndex : AND.w #$0001 : BEQ + + LDA.b LinkPosX+1 : AND.w #$0002 : LSR : EOR.b OverworldIndex : AND.w #$0001 : BEQ + TYA : INC #2 : TAY ;add 16 if we are in lower half of big screen. + ; ensure even if things go horribly wrong, we don't read the sign out of bounds and crash: @@ -426,7 +426,7 @@ Sprite_ShowSolicitedMessageIfPlayerFacing_Alt: JSL Sprite_CheckIfPlayerPreoccupied : BCS .alpha LDA.b Joy1B_New : BPL .alpha - LDA.w $0F10, X : BNE .alpha + LDA.w SpriteTimerE, X : BNE .alpha LDA.b LinkJumping : CMP.b #$02 : BEQ .alpha JSL Sprite_DirectionToFacePlayerLong : PHX : TYX @@ -456,7 +456,7 @@ Sprite_ShowSolicitedMessageIfPlayerFacing_Alt: .SayNothing - LDA.b #$40 : STA.w $0F10, X + LDA.b #$40 : STA.w SpriteTimerE, X PLA : EOR.b #$03 @@ -467,7 +467,7 @@ Sprite_ShowSolicitedMessageIfPlayerFacing_Alt: .not_facing_each_other .alpha - LDA.w $0DE0, X + LDA.w SpriteMoveDirection, X CLC @@ -483,7 +483,7 @@ Sprite_ShowSolicitedMessageIfPlayerFacing_PreserveMessage: JSL Sprite_CheckIfPlayerPreoccupied : BCS .alpha LDA.b Joy1B_New : BPL .alpha - LDA.w $0F10, X : BNE .alpha + LDA.w SpriteTimerE, X : BNE .alpha LDA.b LinkJumping : CMP.b #$02 : BEQ .alpha JSL Sprite_DirectionToFacePlayerLong : PHX : TYX @@ -500,7 +500,7 @@ Sprite_ShowSolicitedMessageIfPlayerFacing_PreserveMessage: JSL Sprite_ShowMessageUnconditional - LDA.b #$40 : STA.w $0F10, X + LDA.b #$40 : STA.w SpriteTimerE, X PLA : EOR.b #$03 @@ -513,7 +513,7 @@ Sprite_ShowSolicitedMessageIfPlayerFacing_PreserveMessage: PLY PLA - LDA.w $0DE0, X + LDA.w SpriteMoveDirection, X CLC diff --git a/doorframefixes.asm b/doorframefixes.asm index 270917f..4e73ab2 100644 --- a/doorframefixes.asm +++ b/doorframefixes.asm @@ -8,7 +8,7 @@ StoreLastOverworldDoorID: TXA : INC STA.l PreviousOverworldDoor - LDA.l $1BBB73, X : STA.w $010E + LDA.l $1BBB73, X : STA.w EntranceIndex RTL ;-------------------------------------------------------------------------------- @@ -18,12 +18,12 @@ RTL CacheDoorFrameData: LDA.l PreviousOverworldDoor : BEQ .originalBehaviour DEC : ASL : TAX - LDA.l EntranceDoorFrameTable, X : STA.w $0696 - LDA.l EntranceAltDoorFrameTable, X : STA.w $0698 + LDA.l EntranceDoorFrameTable, X : STA.w TileMapEntranceDoors + LDA.l EntranceAltDoorFrameTable, X : STA.w TileMapTile32 BRA .done .originalBehaviour - LDA.w $D724, X : STA.w $0696 - STZ.w $0698 + LDA.w $D724, X : STA.w TileMapEntranceDoors + STZ.w TileMapTile32 .done RTL ;-------------------------------------------------------------------------------- diff --git a/dungeonmap.asm b/dungeonmap.asm index 43c7d73..275c76a 100644 --- a/dungeonmap.asm +++ b/dungeonmap.asm @@ -1,5 +1,5 @@ DoDungeonMapBossIcon: - LDA.b $14 + LDA.b NMISTRIPES CMP.b #$09 BEQ .dungeonmap diff --git a/elder.asm b/elder.asm index 3f5993e..f66817d 100644 --- a/elder.asm +++ b/elder.asm @@ -5,7 +5,7 @@ LDA.b OverworldIndex : CMP.b #$1B : BEQ .newCodeContinue JML $05F0CD .newCodeContinue PHB : PHK : PLB -LDA.b #$07 : STA.w $0F50, X ;Palette +LDA.b #$07 : STA.w SpriteOAMProp, X ; Palette JSR Elder_Draw JSL Sprite_PlayerCantPassThrough JSR Elder_Code diff --git a/enemy_adjustments.asm b/enemy_adjustments.asm index 8b96720..ee33204 100644 --- a/enemy_adjustments.asm +++ b/enemy_adjustments.asm @@ -11,16 +11,16 @@ NewBatInit: CMP.b #$D0 : BEQ .light_world ;agahnim darkmaze - LDA.b #$85 : STA.w $0CD2, X - LDA.b #$04 : STA.w $0E50, X + LDA.b #$85 : STA.w SpriteBump, X + LDA.b #$04 : STA.w SpriteHitPoints, X RTL .light_world - LDA.b #$80 : STA.w $0CD2, X - LDA.b #$01 : STA.w $0E50, X + LDA.b #$80 : STA.w SpriteBump, X + LDA.b #$01 : STA.w SpriteHitPoints, X RTL ;-------------------------------------------------------------------------------- NewFireBarDamage: - LDA.w $00EE : CMP.w $0F20, X : BNE .NotSameLayer + LDA.w $00EE : CMP.w SpriteLayer, X : BNE .NotSameLayer JSL Sprite_AttemptDamageToPlayerPlusRecoilLong RTL .NotSameLayer diff --git a/entrances.asm b/entrances.asm index 32bc8c6..8bd634b 100644 --- a/entrances.asm +++ b/entrances.asm @@ -23,7 +23,7 @@ LockAgahnimDoors: LDA.l InvertedMode : AND.w #$00FF : BEQ .unlock LDA.l OverworldEventDataWRAM+$43 : AND.w #$0020 : BNE .unlock ; Check if GT overlay is already on or not - LDA.w $0308 : AND.w #$0080 : BEQ ++ ;If we are holding an item + LDA.w AButtonAct : AND.w #$0080 : BEQ ++ ;If we are holding an item .locked LDA.w #$0001 : RTL ;Keep the door locked @@ -47,15 +47,15 @@ FlagAgahnimDoor: LDA.l OverworldEventDataWRAM+$43 : ORA.b #$20 : STA.l OverworldEventDataWRAM+$43 ; activate GT overlay .vanilla - LDA.b #$28 : STA.b $72 + LDA.b #$28 : STA.b ScrapBuffer72 RTL ;-------------------------------------------------------------------------------- LockAgahnimDoorsCore: - LDA.b $22 : CMP.w #1992 : !BLT + ; door too far left, skip + LDA.b LinkPosX : CMP.w #1992 : !BLT + ; door too far left, skip CMP.w #2088 : !BGE + ; door too rat right, skip - LDA.b $20 : CMP.w #1720 : !BGE + ; door too low, skip + LDA.b LinkPosY : CMP.w #1720 : !BGE + ; door too low, skip LDA.w #$0001 RTS + @@ -91,14 +91,14 @@ AllowStartFromSingleEntranceCave: ASL #2 : !ADD Scrap00 : ASL #2 ; mult by 20 TAX - LDA.w #$0016 : STA.l $7EC142 ; Cache the main screen designation - LDA.l StartingAreaExitTable+$05, X : STA.l $7EC144 ; Cache BG1 V scroll - LDA.l StartingAreaExitTable+$07, X : STA.l $7EC146 ; Cache BG1 H scroll - LDA.l StartingAreaExitTable+$09, X : !ADD.w #$0010 : STA.l $7EC148 ; Cache Link's Y coordinate - LDA.l StartingAreaExitTable+$0B, X : STA.l $7EC14A ; Cache Link's X coordinate - LDA.l StartingAreaExitTable+$0D, X : STA.l $7EC150 ; Cache Camera Y coord lower bound. - LDA.l StartingAreaExitTable+$0F, X : STA.l $7EC152 ; Cache Camera X coord lower bound. - LDA.l StartingAreaExitTable+$03, X : STA.l $7EC14E ; Cache Link VRAM Location + LDA.w #$0016 : STA.l EN_MAINDESQ ; Cache the main screen designation + LDA.l StartingAreaExitTable+$05, X : STA.l EN_BG2VERT ; Cache BG1 V scroll + LDA.l StartingAreaExitTable+$07, X : STA.l EN_BG2HORZ ; Cache BG1 H scroll + LDA.l StartingAreaExitTable+$09, X : !ADD.w #$0010 : STA.l EN_POSY ; Cache Link's Y coordinate + LDA.l StartingAreaExitTable+$0B, X : STA.l EN_POSX ; Cache Link's X coordinate + LDA.l StartingAreaExitTable+$0D, X : STA.l EN_SCROLLATN ; Cache Camera Y coord lower bound. + LDA.l StartingAreaExitTable+$0F, X : STA.l EN_SCROLLATW ; Cache Camera X coord lower bound. + LDA.l StartingAreaExitTable+$03, X : STA.l EN_OWTMAPI ; Cache Link VRAM Location ; Handle the 2 "unknown" bytes, which control what area of the backgound ; relative to the camera? gets loaded with new tile data as the player moves around @@ -106,24 +106,24 @@ AllowStartFromSingleEntranceCave: LDA.l StartingAreaExitTable+$11, X : AND.w #$00FF BIT.w #$0080 : BEQ + : ORA.w #$FF00 : + ; Sign extend - STA.l $7EC16A + STA.l EN_SCRMODYA LDA.l StartingAreaExitTable+$12, X : AND.w #$00FF BIT.w #$0080 : BEQ + : ORA.w #$FF00 : + ; Sign extend - STA.l $7EC16E + STA.l EN_SCRMODXA - LDA.w #$0000 : !SUB.l $7EC16A : STA.l $7EC16C - LDA.w #$0000 : !SUB.l $7EC16E : STA.l $7EC170 + LDA.w #$0000 : !SUB.l EN_SCRMODYA : STA.l EN_SCRMODYB + LDA.w #$0000 : !SUB.l EN_SCRMODXA : STA.l EN_SCRMODXB LDA.l StartingAreaExitTable+$02, X : AND.w #$00FF - STA.l $7EC14C ; Cache the overworld area number - STA.l $7EC140 ; Cache the aux overworld area number + STA.l EN_OWSCR ; Cache the overworld area number + STA.l EN_OWSCR2 ; Cache the aux overworld area number - STZ.w $0698 ;zero out door overlays in case starting overworld door is not set - STZ.w $0699 ;zero out door overlays in case starting overworld door is not set + STZ.w TileMapTile32 ;zero out door overlays in case starting overworld door is not set + STZ.w TileMapTile32+1 ;zero out door overlays in case starting overworld door is not set SEP #$20 ; set 8-bit accumulator - LDA.l $7EF3C8 : TAX + LDA.l StartingEntrance : TAX LDA.l StartingAreaOverworldDoor, X : STA.l PreviousOverworldDoor ;Load overworld door REP #$20 ; reset 16-bit accumulator JSL.l CacheDoorFrameData @@ -134,7 +134,7 @@ RTL ;-------------------------------------------------------------------------------- AllowStartFromExit: - LDX.w $1CE8 + LDX.w MessageCursor LDA.l ShouldStartatExit, X : BNE .doStart LDA.l StartingEntrance ; what we wrote over @@ -153,10 +153,9 @@ JML.l AllowStartFromExitReturn STZ.b GameSubMode STZ.b SubSubModule + STZ.w DeathReloadFlag + STZ.w RespawnFlag - STZ.w $010A - - STZ.w $04AA JSL Equipment_SearchForEquippedItemLong JSL HUD_RebuildLong2 JSL Equipment_UpdateEquippedItemLong @@ -188,14 +187,14 @@ CheckHole: .matchedHoleExtra SEP #$30 TXA : LSR A : TAX - LDA.l ExtraHole_Entrance, X : STA.w $010E : STZ.w $010F + LDA.l ExtraHole_Entrance, X : STA.w EntranceIndex : STZ.w EntranceIndex+1 JML Overworld_Hole_End ;-------------------------------------------------------------------------------- PreventEnterOnBonk: STA.b Scrap00 ; part of what we wrote over LDA.l InvertedMode : AND.w #$00FF : BEQ .done LDA.b LinkState : AND.w #$00FF : CMP.w #$0014 : BNE .done ;in mirror mode? - LDA.b OverworldIndex : AND.w #$0040 : CMP.b $7B : BEQ .done ; Are we bonking, or doing the superbunny glitch? + LDA.b OverworldIndex : AND.w #$0040 : CMP.b WorldCache : BEQ .done ; Are we bonking, or doing the superbunny glitch? ; If in inverted, are in mirror mode, and are bonking then do not enter JML.l PreventEnterOnBonk_BRANCH_IX diff --git a/events.asm b/events.asm index 1ac3159..0380d1c 100644 --- a/events.asm +++ b/events.asm @@ -1,6 +1,6 @@ OnPrepFileSelect: LDA.b GameSubMode : CMP.b #$03 : BNE + - LDA.b #$06 : STA.b $14 ; thing we wrote over + LDA.b #$06 : STA.b NMISTRIPES ; thing we wrote over RTL + JSL.l LoadAlphabetTilemap @@ -15,7 +15,7 @@ OnDrawHud: JML.l ReturnFromOnDrawHud ;-------------------------------------------------------------------------------- OnDungeonEntrance: - STA.l $7EC172 ; thing we wrote over + STA.l PegColor ; thing we wrote over JSL MaybeFlagCompassTotalEntrance RTL ;-------------------------------------------------------------------------------- @@ -33,7 +33,7 @@ OnDungeonExit: JSL.l SQEGFix PLP : PLA - STA.w DungeonID : STZ.w $04AC ; thing we wrote over + STA.w DungeonID : STZ.w Map16ChangeIndex ; thing we wrote over PHA : PHP JSL.l HUD_RebuildLong @@ -44,8 +44,8 @@ RTL ;-------------------------------------------------------------------------------- OnQuit: JSL.l SQEGFix - LDA.b #$00 : STA.l $7F5035 ; bandaid patch bug with mirroring away from text - LDA.b #$10 : STA.b $1C ; thing we wrote over + LDA.b #$00 : STA.l AltTextFlag ; bandaid patch bug with mirroring away from text + LDA.b #$10 : STA.b MAINDESQ ; thing we wrote over RTL ;-------------------------------------------------------------------------------- OnUncleItemGet: @@ -123,13 +123,12 @@ OnFileLoad: JSL.l OnNewFile LDA.b #$FF : STA.l FileMarker + - LDA.w $010A : BNE + ; don't adjust the worlds for "continue" or "save-continue" - LDA.l $7EC011 : BNE + ; don't adjust worlds if mosiac is enabled (Read: mirroring in dungeon) + LDA.w DeathReloadFlag : BNE + ; don't adjust the worlds for "continue" or "save-continue" + LDA.l MosaicLevel : BNE + ; don't adjust worlds if mosiac is enabled (Read: mirroring in dungeon) JSL.l DoWorldFix + JSL.l MasterSwordFollowerClear LDA.b #$FF : STA.l RNGLockIn ; reset rng item lock-in - LDA.b #$00 : STA.l $7F5001 ; mark fake flipper softlock as impossible LDA.l GenericKeys : BEQ + LDA.l CurrentGenericKeys : STA.l CurrentSmallKeys ; copy generic keys to key counter + @@ -148,14 +147,20 @@ OnNewFile: PHX : PHP ; reset some values on new file that are otherwise only reset on hard reset SEP #$20 ; set 8-bit accumulator - STZ.w $03C4 ; ancilla slot index - STZ.w $047A ; EG - STZ.w $0B08 : STZ $0B09 ; arc variable - STZ.w $0CFB ; enemies killed (pull trees) - STZ.w $0CFC ; times taken damage (pull trees) - STZ.w $0FC7 : STZ.w $0FC8 : STZ.w $0FC9 : STZ.w $0FCA : STZ.w $0FCB : STZ.w $0FCC : STZ.w $0FCD ; prize packs - LDA.b #$00 : STA.l $7EC011 ; mosaic - JSL InitRNGPointerTable ; boss RNG + STZ.w AncillaSearch + STZ.w LayerAdjustment ; EG + STZ.w ArcVariable : STZ.w ArcVariable+1 + STZ.w TreePullKills + STZ.w TreePullHits + STZ.w PrizePackIndexes + STZ.w PrizePackIndexes+1 + STZ.w PrizePackIndexes+2 + STZ.w PrizePackIndexes+3 + STZ.w PrizePackIndexes+4 + STZ.w PrizePackIndexes+5 + STZ.w PrizePackIndexes+6 + LDA.b #$00 : STA.l MosaicLevel + JSL InitRNGPointerTable PLP : PLX RTL ;-------------------------------------------------------------------------------- @@ -230,6 +235,6 @@ PostItemAnimation: JSL.l IncrementChestTurnCounter + - STZ.w ItemReceiptMethod : LDA.w $0C5E, X ; thing we wrote over to get here + STZ.w ItemReceiptMethod : LDA.w AncillaGet, X ; thing we wrote over to get here RTL ;-------------------------------------------------------------------------------- diff --git a/failure.asm b/failure.asm index 1ae00ca..d5e07b8 100644 --- a/failure.asm +++ b/failure.asm @@ -239,12 +239,6 @@ Crashed: -- BRA -- -; LDA.w #$0000 -; TCD -; -; TSC - - BSODMessage: db "A fatal error has occurred and resulted in an", $80 db "unrecoverable crash. ?", $80 diff --git a/fairyfixes.asm b/fairyfixes.asm index 2043796..8057bdb 100644 --- a/fairyfixes.asm +++ b/fairyfixes.asm @@ -35,19 +35,19 @@ FairyPond_Init: LDA.l BottleContentsThree : CMP.b #$02 : BNE ++ : LDA.b #$1E : PHA : BRA .emptyBottle : ++ LDA.l BottleContentsFour : CMP.b #$02 : BNE ++ : LDA.b #$1F : PHA : BRA .emptyBottle : ++ .noInventory - LDA.b #$0A : STA.w SpriteUnknown, X + LDA.b #$0A : STA.w SpriteActivity, X LDA.b #$51 LDY.b #$01 JSL.l Sprite_ShowMessageFromPlayerContact JMP .cleanup .emptyBottle - LDA.b #$02 : STA.w SpriteUnknown, X + LDA.b #$02 : STA.w SpriteActivity, X STZ.b LinkDirection LDA.b #$01 : STA.w CutsceneFlag - PLA : STA.w $1CE8 + PLA : STA.w MessageCursor .cleanup - STZ.w $0EB0, X ; Clear the sprite's item-given variable + STZ.w SpriteDirectionTable, X ; Clear the sprite's item-given variable CLC ; skip rest of original function + : PLY RTL diff --git a/fileselect.asm b/fileselect.asm index 0eca417..31bc974 100644 --- a/fileselect.asm +++ b/fileselect.asm @@ -114,11 +114,11 @@ DrawPlayerFile: ; re-enable Stripe Image format upload on this frame ; Value loaded must match what gets set by AltBufferTable - LDA.w #$0161 : STA.w $1002 + LDA.w #$0161 : STA.w GFXStripes+2 BRA .done .normal STZ.w SkipOAM ; ensure core animated tile updates are not suppressed - LDA.w #$FFFF : STA.w $1002 ; Suppress Stripe Image format upload on this frame + LDA.w #$FFFF : STA.w GFXStripes+2 ; Suppress Stripe Image format upload on this frame .done LDA.w #$0004 : STA.b Scrap02 ; thing we wrote over RTL @@ -591,55 +591,55 @@ AltBufferTable: ;fill with the blank character LDA.w #$0188 - - STA.w $1000, X + STA.w GFXStripes, X DEX : DEX : BNE - ; set vram offsets - LDA.w #$0161 : STA.w $1002 ;file 1 top row - LDA.w #$2161 : STA.w $1042 ;file 1 bottom row - - LDA.w #$4161 : STA.w $1082 ;gap row top - LDA.w #$6161 : STA.w $10C2 ;gap row bottom - - LDA.w #$8161 : STA.w $1102 ;file 2 top row - LDA.w #$A161 : STA.w $1142 ;file 2 bottom row - - LDA.w #$C161 : STA.w $1182 ;gap row top - LDA.w #$E161 : STA.w $11c2 ;gap row bottom - - LDA.w #$0162 : STA.w $1202 ;file 3 top row - LDA.w #$2162 : STA.w $1242 ;file 3 bottom row - - LDA.w #$4162 : STA.w $1282 ;extra gap row top - LDA.w #$6162 : STA.w $12c2 ;extra gap row bottom + LDA.w #$0161 : STA.w GFXStripes+$02 ;file 1 top row + LDA.w #$2161 : STA.w GFXStripes+$42 ;file 1 bottom row - LDA.w #$8162 : STA.w $1302 ;extra gap row top - LDA.w #$A162 : STA.w $1342 ;extra gap row bottom - - LDA.w #$C162 : STA.w $1382 ;extra gap row top - LDA.w #$E162 : STA.w $13C2 ;extra gap row bottom + LDA.w #$4161 : STA.w GFXStripes+$82 ;gap row top + LDA.w #$6161 : STA.w GFXStripes+$C2 ;gap row bottom + + LDA.w #$8161 : STA.w GFXStripes+$0102 ;file 2 top row + LDA.w #$A161 : STA.w GFXStripes+$0142 ;file 2 bottom row + + LDA.w #$C161 : STA.w GFXStripes+$0182 ;gap row top + LDA.w #$E161 : STA.w GFXStripes+$01C2 ;gap row bottom + + LDA.w #$0162 : STA.w GFXStripes+$0202 ;file 3 top row + LDA.w #$2162 : STA.w GFXStripes+$0242 ;file 3 bottom row + + LDA.w #$4162 : STA.w GFXStripes+$0282 ;extra gap row top + LDA.w #$6162 : STA.w GFXStripes+$02C2 ;extra gap row bottom + + LDA.w #$8162 : STA.w GFXStripes+$0302 ;extra gap row top + LDA.w #$A162 : STA.w GFXStripes+$0342 ;extra gap row bottom + + LDA.w #$C162 : STA.w GFXStripes+$0382 ;extra gap row top + LDA.w #$E162 : STA.w GFXStripes+$03C2 ;extra gap row bottom ; set lengths LDA.w #$3B00 - STA.w $1004 ;file 1 top row - STA.w $1044 ;file 1 bottom row - STA.w $1084 ;gap row top - STA.w $10C4 ;gap row bottom - STA.w $1104 ;file 2 top row - STA.w $1144 ;file 2 bottom row - STA.w $1184 ;gap row top - STA.w $11C4 ;gap row bottom - STA.w $1204 ;file 3 top row - STA.w $1244 ;file 3 bottom row - STA.w $1284 ;extra gap row top - STA.w $12C4 ;extra gap row bottom - STA.w $1304 ;extra gap row top - STA.w $1344 ;extra gap row bottom - STA.w $1384 ;extra gap row top - STA.w $13C4 ;extra gap row bottom + STA.w GFXStripes+$04 ;file 1 top row + STA.w GFXStripes+$44 ;file 1 bottom row + STA.w GFXStripes+$84 ;gap row top + STA.w GFXStripes+$C4 ;gap row bottom + STA.w GFXStripes+$0104 ;file 2 top row + STA.w GFXStripes+$0144 ;file 2 bottom row + STA.w GFXStripes+$0184 ;gap row top + STA.w GFXStripes+$01C4 ;gap row bottom + STA.w GFXStripes+$0204 ;file 3 top row + STA.w GFXStripes+$0244 ;file 3 bottom row + STA.w GFXStripes+$0284 ;extra gap row top + STA.w GFXStripes+$02C4 ;extra gap row bottom + STA.w GFXStripes+$0304 ;extra gap row top + STA.w GFXStripes+$0344 ;extra gap row bottom + STA.w GFXStripes+$0384 ;extra gap row top + STA.w GFXStripes+$03C4 ;extra gap row bottom ; Set last packet marker - LDA.w #$00FF : STA.w $1402 + LDA.w #$00FF : STA.w GFXStripes+$0402 ; Draw Unlock option if applicable LDA.b GameMode : AND.w #$00FF : CMP.w #$0001 : BNE + @@ -661,29 +661,29 @@ AltBufferTable_credits: JSL AltBufferTable_noScreen3Change REP #$20 - LDA.w #$6168 : STA.w $1002 ;file 1 top row - LDA.w #$8168 : STA.w $1042 ;file 1 bottom row - - LDA.w #$A168 : STA.w $1082 ;gap row top - LDA.w #$C168 : STA.w $10C2 ;gap row bottom - - LDA.w #$E168 : STA.w $1102 ;file 2 top row - LDA.w #$0169 : STA.w $1142 ;file 2 bottom row - - LDA.w #$2169 : STA.w $1182 ;gap row top - LDA.w #$4169 : STA.w $11c2 ;gap row bottom - - LDA.w #$6169 : STA.w $1202 ;file 3 top row - LDA.w #$8169 : STA.w $1242 ;file 3 bottom row - - LDA.w #$A169 : STA.w $1282 ;extra gap row top - LDA.w #$C169 : STA.w $12c2 ;extra gap row bottom + LDA.w #$6168 : STA.w GFXStripes+$02 ;file 1 top row + LDA.w #$8168 : STA.w GFXStripes+$42 ;file 1 bottom row - LDA.w #$E169 : STA.w $1302 ;extra gap row top - LDA.w #$016A : STA.w $1342 ;extra gap row bottom - - LDA.w #$216A : STA.w $1382 ;extra gap row top - LDA.w #$416A : STA.w $13C2 ;extra gap row bottom + LDA.w #$A168 : STA.w GFXStripes+$82 ;gap row top + LDA.w #$C168 : STA.w GFXStripes+$C2 ;gap row bottom + + LDA.w #$E168 : STA.w GFXStripes+$0102 ;file 2 top row + LDA.w #$0169 : STA.w GFXStripes+$0142 ;file 2 bottom row + + LDA.w #$2169 : STA.w GFXStripes+$0182 ;gap row top + LDA.w #$4169 : STA.w GFXStripes+$01c2 ;gap row bottom + + LDA.w #$6169 : STA.w GFXStripes+$0202 ;file 3 top row + LDA.w #$8169 : STA.w GFXStripes+$0242 ;file 3 bottom row + + LDA.w #$A169 : STA.w GFXStripes+$0282 ;extra gap row top + LDA.w #$C169 : STA.w GFXStripes+$02C2 ;extra gap row bottom + + LDA.w #$E169 : STA.w GFXStripes+$0302 ;extra gap row top + LDA.w #$016A : STA.w GFXStripes+$0342 ;extra gap row bottom + + LDA.w #$216A : STA.w GFXStripes+$0382 ;extra gap row top + LDA.w #$416A : STA.w GFXStripes+$03C2 ;extra gap row bottom SEP #$20 RTL @@ -772,12 +772,12 @@ LoadCustomHudPalette: LDX.b #$40 - LDA.l GFX_HUD_Palette, X - STA.l $7EC500, X + STA.l PaletteBuffer, X DEX : DEX BPL - SEP #$20 - INC $15 ; ensure CGRAM gets updated + INC.b NMICGRAM ; ensure CGRAM gets updated PLX : PLA RTL ;-------------------------------------------------------------------------------- diff --git a/flipperkill.asm b/flipperkill.asm index 1d0debf..e32b5a5 100644 --- a/flipperkill.asm +++ b/flipperkill.asm @@ -2,11 +2,12 @@ ; Fake Flippers Softlock Fix ;-------------------------------------------------------------------------------- +; Written over and used by OnEnterWater hook. UnequipCapeQuiet: - LDA.b #$20 : STA.w $02E2 - STZ.w $037B - STZ.b $55 - STZ.w $0360 + LDA.b #$20 : STA.w PoofTimer + STZ.w NoDamage + STZ.b CapeOn + STZ.w LinkZap RTL protectff: @@ -18,14 +19,14 @@ protectff: .yes_protect REP #$30 - LDA.b $20 + LDA.b LinkPosY AND.w #$1E00 ASL ASL ASL STA.b Scrap06 - LDA.b $22 + LDA.b LinkPosX AND.w #$1E00 ORA.b Scrap06 @@ -49,8 +50,8 @@ protectff: LDA.b #$15 STA.b LinkState - STZ.b $2E - STZ.b $67 + STZ.b LinkAnimationStep + STZ.b LinkWalkDirection LDA.b #$02 STA.b LinkDirection diff --git a/flute.asm b/flute.asm index faf10e3..46b171e 100644 --- a/flute.asm +++ b/flute.asm @@ -15,21 +15,21 @@ SpawnHauntedGroveItem: LDX.b #$00 LDA.b LinkDirection : CMP.b #$04 : BEQ + : INX : + - LDA.l .x_speeds, X : STA.w $0D50, Y + LDA.l .x_speeds, X : STA.w SpriteVelocityX, Y - LDA.b #$00 : STA.w $0D40, Y - LDA.b #$18 : STA.w $0F80, Y - LDA.b #$FF : STA.w $0B58, Y - LDA.b #$30 : STA.w $0F10, Y + LDA.b #$00 : STA.w SpriteVelocityY, Y + LDA.b #$18 : STA.w SpriteVelocityZ, Y + LDA.b #$FF : STA.w EnemyStunTimer, Y + LDA.b #$30 : STA.w SpriteTimerE, Y - LDA.b $22 : !ADD.l .x_offsets, X - AND.b #$F0 : STA.w $0D10, Y - LDA.b $23 : ADC.b #$00 : STA.w $0D30, Y + LDA.b LinkPosX : !ADD.l .x_offsets, X + AND.b #$F0 : STA.w SpritePosXLow, Y + LDA.b LinkPosX+1 : ADC.b #$00 : STA.w SpritePosXHigh, Y - LDA.b $20 : !ADD.b #$16 : AND.b #$F0 : STA.w $0D00, Y - LDA.b $21 : ADC.b #$00 : STA.w $0D20, Y + LDA.b LinkPosY : !ADD.b #$16 : AND.b #$F0 : STA.w SpritePosYLow, Y + LDA.b LinkPosY+1 : ADC.b #$00 : STA.w SpritePosYHigh, Y - LDA.b #$00 : STA.w $0F20, Y + LDA.b #$00 : STA.w SpriteLayer, Y TYX LDX.b OverworldIndex ; haunted grove (208D0A) @@ -56,7 +56,7 @@ FluteBoy: LDA.b #$01 : STA.w $0FDD JML.l FluteBoy_Abort + - LDA.w SpriteUnknown, X : CMP.b #$03 ; thing we wrote over + LDA.w SpriteActivity, X : CMP.b #$03 ; thing we wrote over JML.l FluteBoy_Continue ;-------------------------------------------------------------------------------- FreeDuckCheck: @@ -69,13 +69,13 @@ FreeDuckCheck: REP #$20 ; Y coordinate boundaries for setting it off. - LDA.b $20 + LDA.b LinkPosY CMP.w #$0760 : BCC .done CMP.w #$07E0 : BCS .done ; do if( (Ycoord >= 0x0760) && (Ycoord < 0x07e0 - LDA.b $22 + LDA.b LinkPosX CMP.w #$01CF : BCC .done CMP.w #$0230 : BCS .done @@ -94,12 +94,12 @@ FreeDuckCheck: BRA .skipSong .done SEP #$20 - LDA.b #$80 : STA.w $03F0 ; thing we wrote over, load flute timer + LDA.b #$80 : STA.w FluteTimer ; thing we wrote over LDA.b #$13 RTL .skipSong SEP #$20 - LDA.b #$80 : STA.w $03F0 ; thing we wrote over, load flute timer + LDA.b #$80 : STA.w FluteTimer ; thing we wrote over LDA.b #$00 RTL ;-------------------------------------------------------------------------------- diff --git a/framehook.asm b/framehook.asm index 129cd35..dc7751c 100644 --- a/framehook.asm +++ b/framehook.asm @@ -2,46 +2,40 @@ ; Frame Hook ;-------------------------------------------------------------------------------- FrameHookAction: - JSL $0080B5 ; Module_MainRouting - JSL CheckMusicLoadRequest - PHP : REP #$30 : PHA - - SEP #$20 - - LDA.l StatsLocked : BNE ++ - REP #$20 ; set 16-bit accumulator - LDA.l LoopFrames : INC : STA.l LoopFrames : BNE + - LDA.l LoopFrames+2 : INC : STA.l LoopFrames+2 - + - LDA.l GameMode : CMP.w #$010E : BNE + ; move this to nmi hook? - LDA.l MenuFrames : INC : STA.l MenuFrames : BNE + - LDA.l MenuFrames+2 : INC : STA.l MenuFrames+2 - + - ++ - REP #$30 : PLA : PLP + JSL $0080B5 ; Module_MainRouting + JSL CheckMusicLoadRequest + PHP : REP #$30 : PHA + SEP #$20 + LDA.l StatsLocked : BNE ++ + REP #$20 ; set 16-bit accumulator + LDA.l LoopFrames : INC : STA.l LoopFrames : BNE + + LDA.l LoopFrames+2 : INC : STA.l LoopFrames+2 + + + LDA.l GameMode : CMP.w #$010E : BNE ++ ; move this to nmi hook? + LDA.l MenuFrames : INC : STA.l MenuFrames : BNE ++ + LDA.l MenuFrames+2 : INC : STA.l MenuFrames+2 + ++ + REP #$30 : PLA : PLP + RTL ;-------------------------------------------------------------------------------- NMIHookAction: - PHA : PHX : PHY : PHD ; thing we wrote over, push stuff - - LDA.l StatsLocked : AND.w #$00FF : BNE ++ - LDA.l NMIFrames : INC : STA.l NMIFrames : BNE + - LDA.l NMIFrames+2 : INC : STA.l NMIFrames+2 - + - ++ - + PHA : PHX : PHY : PHD ; thing we wrote over, push stuff + LDA.l StatsLocked : AND.w #$00FF : BNE + + LDA.l NMIFrames : INC : STA.l NMIFrames : BNE + + LDA.l NMIFrames+2 : INC : STA.l NMIFrames+2 + + + JML.l NMIHookReturn ;-------------------------------------------------------------------------------- PostNMIHookAction: - LDA.w NMIAux : BEQ + - - PHK : PEA .return-1 ; push stack for RTL return - JMP.w [NMIAux] - - .return - STZ.w NMIAux ; zero bank byte of NMI hook pointer - + - - LDA.b $13 : STA.w INIDISP ; thing we wrote over, turn screen back on + LDA.w NMIAux : BEQ + + PHK : PEA .return-1 ; push stack for RTL return + JMP.w [NMIAux] + .return + STZ.w NMIAux ; zero bank byte of NMI hook pointer + + + LDA.b INIDISPQ : STA.w INIDISP ; thing we wrote over, turn screen back on + JML.l PostNMIHookReturn ;-------------------------------------------------------------------------------- diff --git a/glitched.asm b/glitched.asm index cfbe597..82eaf42 100644 --- a/glitched.asm +++ b/glitched.asm @@ -57,7 +57,7 @@ GetAgahnimSlot: JML.l GetAgahnimSlotReturn ;-------------------------------------------------------------------------------- GetAgahnimLightning: - INC.w $0E30, X ; thing we wrote over + INC.w SpriteAux, X ; thing we wrote over LDA.b RoomIndex ; get room id CMP.b #13 : BNE + ; Agahnim 2 room LDA.b #$01 ; Use Agahnim 2 diff --git a/goalitem.asm b/goalitem.asm index 2fca733..50f62cd 100644 --- a/goalitem.asm +++ b/goalitem.asm @@ -4,7 +4,7 @@ GoalItemGanonCheck: BCS .success .fail - LDA.w SpriteUnknown, X : CMP.b #17 : !BLT .success ; decmial 17 because Acmlm's chart is decimal + LDA.w SpriteActivity, X : CMP.b #17 : !BLT .success ; decmial 17 because Acmlm's chart is decimal LDA.b #$00 RTL .success @@ -138,7 +138,7 @@ CheckAgaForPed: BEQ .force_blue_ball .vanilla ; run vanilla check for phase - LDA.w $0E30, X + LDA.w SpriteAux, X CMP.b #$02 RTL diff --git a/hardmode.asm b/hardmode.asm index fe04a02..e8177f9 100644 --- a/hardmode.asm +++ b/hardmode.asm @@ -8,11 +8,11 @@ CalculateSpikeFloorDamage: SEP #$20 ; set 8-bit accumulator BNE + LDA.l ByrnaCaveSpikeDamage - STA.w $0373 + STA.w DamageReceived RTL + LDA.w $D055, Y - STA.w $0373 + STA.w DamageReceived RTL ;-------------------------------------------------------------------------------- CalculateByrnaUsage: @@ -48,7 +48,7 @@ CalculateCapeUsage: + SEP #$20 ; set 8-bit accumulator PHX : TYX - LDA.l HardModeExclusionCapeUsage, X : STA.b $4C ; set cape decrement timer + LDA.l HardModeExclusionCapeUsage, X : STA.b CapeTimer ; set cape decrement timer PLX ++ JML IncrementMagicUseCounterOne @@ -66,9 +66,9 @@ ActivateInvulnerabilityOrDont: BRA .nowhere_special .somewhere_cool SEP #$20 ; set 8-bit accumulator - LDA.b #$01 : STA.w $037B : RTL + LDA.b #$01 : STA.w NoDamage : RTL .nowhere_special - LDA.l ByrnaInvulnerability : STA.w $037B + LDA.l ByrnaInvulnerability : STA.w NoDamage RTL ;-------------------------------------------------------------------------------- GetItemDamageValue: @@ -99,7 +99,7 @@ SearchAncilla: PHX LDX #$00 .loop - LDA.w $0C4A, X + LDA.w AncillaID, X INX : CPX #$0A : BEQ .notFound CMP Scrap05 : BNE .loop LDA.b #$01 diff --git a/heartpieces.asm b/heartpieces.asm index 6bcbc72..79924b2 100644 --- a/heartpieces.asm +++ b/heartpieces.asm @@ -60,7 +60,7 @@ DrawHeartPieceGFX: PHA JSL.l IsNarrowSprite : BCC + - LDA.w $0E60, X : ORA.b #$20 : STA.w $0E60, X + LDA.w SpriteControl, X : ORA.b #$20 : STA.w SpriteControl, X + PLA @@ -101,7 +101,7 @@ HeartContainerSound: RTL ;-------------------------------------------------------------------------------- NormalItemSkipSound: - LDA.w $0C5E, X ; thing we wrote over + LDA.w AncillaGet, X ; thing we wrote over CPY.b #$20 : BEQ + ; Skip for Crystal CPY.b #$37 : BEQ + ; Skip for Pendants @@ -203,7 +203,7 @@ LoadIndoorValue: %GetPossiblyEncryptedItem(HeartPiece_Spectacle_Cave, HeartPieceIndoorValues) JMP .done + CMP.w #283 : BNE + - LDA.b $22 : XBA : AND.w #$0001 ; figure out where link is + LDA.b LinkPosX : XBA : AND.w #$0001 ; figure out where link is BNE ++ %GetPossiblyEncryptedItem(HeartPiece_Circle_Bushes, HeartPieceIndoorValues) JMP .done @@ -239,7 +239,7 @@ LoadOutdoorValue: REP #$20 ; set 16-bit accumulator LDA.b OverworldIndex CMP.w #$03 : BNE + - LDA.b $22 : CMP.w #1890 : !BLT ++ + LDA.b LinkPosX : CMP.w #1890 : !BLT ++ %GetPossiblyEncryptedItem(HeartPiece_Spectacle, HeartPieceOutdoorValues) JMP .done ++ @@ -255,7 +255,7 @@ LoadOutdoorValue: %GetPossiblyEncryptedItem(HauntedGroveItem, HeartPieceOutdoorValues) JMP .done + CMP.w #$30 : BNE + - LDA.b $22 : CMP.w #512 : !BGE ++ + LDA.b LinkPosX : CMP.w #512 : !BGE ++ %GetPossiblyEncryptedItem(HeartPiece_Desert, HeartPieceOutdoorValues) JMP .done ++ diff --git a/hooks.asm b/hooks.asm index e68f1be..14b3568 100755 --- a/hooks.asm +++ b/hooks.asm @@ -707,16 +707,16 @@ JMP DrawItem_finished org $0DECE6 ; <- 6ECE6 - equipment.asm : 1934 (SEP #$30) DrawItem_finished: org $0DEB48 ; <- 6EB48 - equipment.asm : 1784 (LDA $0000) -LDA.w $0000, Y : STA.w $11F2 -LDA.w $0002, Y : STA.w $11F4 -LDA.w $0040, Y : STA.w $1232 -LDA.w $0042, Y : STA.w $1234 +LDA.w $0000, Y : STA.w GFXStripes+$01F2 +LDA.w $0002, Y : STA.w GFXStripes+$01F4 +LDA.w $0040, Y : STA.w GFXStripes+$0232 +LDA.w $0042, Y : STA.w GFXStripes+$0234 ;--------------------------- org $0DE24B ; <- 6E24B - equipment.asm : 951 (LDA $0000) -LDA.w $0000, Y : STA.w $11F2 -LDA.w $0002, Y : STA.w $11F4 -LDA.w $0040, Y : STA.w $1232 -LDA.w $0042, Y : STA.w $1234 +LDA.w $0000, Y : STA.w GFXStripes+$01F2 +LDA.w $0002, Y : STA.w GFXStripes+$01F4 +LDA.w $0040, Y : STA.w GFXStripes+$0232 +LDA.w $0042, Y : STA.w GFXStripes+$0234 ;-------------------------------------------------------------------------------- org $0DE2DC ; <- 6E2DC - equipment.asm : 989 (LDA $F449, X : STA $122C, Y) JMP UpdateBottleMenu_return @@ -1175,6 +1175,7 @@ JSL.l CheckTabletSword ;-------------------------------------------------------------------------------- org $1DF086 ; <- EF086 - sprite_evil_barrier.asm:303 (LDA $7EF359 : CMP.b #$02 : BCS .anozap_from_player_attack) JSL.l GetSwordLevelForEvilBarrier +;-------------------------------------------------------------------------------- ;================================================================================ ; Medallion Tablets @@ -1189,6 +1190,9 @@ org $07859F ; <- 3859F - Bank07.asm : 965 (JSL AddPendantOrCrystal) JSL SpawnTabletItem org $07862A ; <- 3862A - Bank07.asm : 1064 (JSL AddPendantOrCrystal) JSL SpawnTabletItem +;-------------------------------------------------------------------------------- +org $05EF1E ; LDA.l $7EF280,X : AND #$40 +JSL CheckTabletItem : NOP #2 ;================================================================================ ; Medallion Entrances @@ -1937,7 +1941,7 @@ org $05F08A ; <- 2F08A - sprite_heart_upgrades.asm : 324 - (LDA $7EF36B : INC A JSL.l HeartPieceGet JSL.l IsMedallion BCS + : BRA Sprite_EB_HeartPiece_handle_flags : + ; Don't change OW flags if we're -STZ.w $0DD0,X : RTS ; getting a tablet item +STZ.w SpriteAITable, X : RTS ; getting a tablet item ;-------------------------------------------------------------------------------- org $06C0B0 ; <- 340B0 - sprite prep JSL.l HeartPieceSpritePrep @@ -1950,8 +1954,8 @@ JSL.l HPItemReset ; Fake Flippers Softlock Fix + General Damage Hooks ;-------------------------------------------------------------------------------- org $078091 ; <- 38091 - Bank07.asm:138 (LDA $037B : BNE .linkNotDamaged) -LDA.w $0373 : STA.b Scrap00 : STZ.w $0373 ; store and zero damage -LDA.w $037B : BNE LinkDamaged_linkNotDamaged ; skip if immune +LDA.w DamageReceived : STA.b Scrap00 : STZ.w DamageReceived ; store and zero damage +LDA.w NoDamage : BNE LinkDamaged_linkNotDamaged ; skip if immune ;-------------------------------------------------------------------------------- org $0780C6 ; <- 380C6 - Bank07.asm:174 (LDA $7EF36D) JSL.l OnLinkDamaged @@ -1982,7 +1986,7 @@ FakeFlipperProtection: org $0AB8E5 ; <- 538E5 JSL.l FloodGateAndMasterSwordFollowerReset JSL.l IncrementFlute -STZ $1000 : STZ $1001 +STZ.w GFXStripes : STZ.w GFXStripes+1 NOP #26 ;-------------------------------------------------------------------------------- org $02AA87 ; <- 12A87 @@ -2213,10 +2217,10 @@ JSL ParadoxCaveGfxFix : NOP ;-------------------------------------------------------------------------------- ; Change race game to use $021B instead of $0ABF for detecting cheating org $0DCB9D ; STZ.w $0ABF -STZ.w $021B +STZ.w RaceGameFlag org $0DCBFE ; LDA.w $0ABF -LDA.w $021B +LDA.w RaceGameFlag org $02BFE0 ; LDA.b #$01 : STA.w $0ABF JSL SetOverworldTransitionFlags : NOP diff --git a/icepalacegraphics.asm b/icepalacegraphics.asm index 987c803..193e36d 100644 --- a/icepalacegraphics.asm +++ b/icepalacegraphics.asm @@ -49,7 +49,7 @@ BgGraphicsLoading: ReloadingFloors: SEP #$30 ; 8 AXY - LDA.l $7EC2F8 ; Floor file that has been decompressed + LDA.l LastBGSet ; Floor file that has been decompressed TAY JSR ShouldOverrideFileLoad REP #$30 ; 16 AXY diff --git a/initsramtable.asm b/initsramtable.asm index db09b08..68d27ec 100644 --- a/initsramtable.asm +++ b/initsramtable.asm @@ -20,7 +20,7 @@ InitRoomDataWRAM: org $30B060 ; PC 0x183060 InitATAltarRoom: dw $0000 ; aga curtains org $30B092 ; PC 0x183092 -InitSWBackEntryRoom: dw $0000 ; skull woods curtains (?) +InitSWBackEntryRoom: dw $0000 ; skull woods curtains org $30B20C dw $F000, $F000 ; Pre-open kak bomb hut & brewery diff --git a/inventory.asm b/inventory.asm index b7935f6..c8e2a45 100644 --- a/inventory.asm +++ b/inventory.asm @@ -59,7 +59,7 @@ RTL LDA.l BowTracking : AND.b #$C0 : CMP.b #$C0 : BNE .errorJump ; make sure we have both bows PHX : LDX.b #$00 ; scan ancilla table for arrows -- : CPX.b #$0A : !BGE ++ - LDA.w $0C4A, X : CMP.b #$09 : BNE +++ + LDA.w AncillaID, X : CMP.b #$09 : BNE +++ PLX : BRA .errorJump2 ; found an arrow, don't allow the swap +++ INX : BRA -- : ++ @@ -84,7 +84,7 @@ RTL .errorJump2 BRA .error + CMP #$0D : BNE + ; flute - LDA.w $037A : CMP.b #$01 : BEQ .midShovel ; inside a shovel animation, force the shovel & make error sound + LDA.w UseY2 : CMP.b #$01 : BEQ .midShovel ; inside a shovel animation, force the shovel & make error sound LDA.l InventoryTracking : BIT.b #$04 : BEQ .error ; make sure we have shovel AND.b #$03 : BEQ .error ; make sure we have one of the flutes LDA.l FluteEquipment : CMP.b #01 : BNE .toShovel ; not shovel @@ -250,7 +250,7 @@ AddInventory: LDA.b IndoorsFlag : BEQ ++ ; skip shop check if outdoors LDA.w ItemReceiptMethod : CMP.b #$01 : BEQ ++ ; skip shop check for chests PHP : REP #$20 ; set 16-bit accumulator - LDA.w $048E + LDA.b RoomIndex CMP.w #274 : BNE + : JMP .shop : + ; dark world death mountain shop, ornamental shield shop CMP.w #271 : BNE + : JMP .shop : + ; villiage of outcasts shop, lumberjack shop, lake hylia shop, dark world magic shop CMP.w #272 : BNE + : JMP .shop : + ; red shield shop @@ -787,8 +787,8 @@ RTL ; DrawKeyIcon: ;-------------------------------------------------------------------------------- DrawKeyIcon: - LDA.b Scrap04 : AND.w #$00FF : CMP.w #$0090 : BNE + : LDA.w #$007F : + : ORA.w #$2400 : STA.l $7EC764 - LDA.b Scrap05 : AND.w #$00FF : ORA.w #$2400 : STA.l $7EC766 + LDA.b Scrap04 : AND.w #$00FF : CMP.w #$0090 : BNE + : LDA.w #$007F : + : ORA.w #$2400 : STA.l HUDKeyDigits + LDA.b Scrap05 : AND.w #$00FF : ORA.w #$2400 : STA.l HUDTileMapBuffer+$66 RTL ;-------------------------------------------------------------------------------- @@ -872,7 +872,7 @@ RTL ; DrawPowder: ;-------------------------------------------------------------------------------- DrawPowder: - LDA.w $02DA : BNE .defer ; defer if link is buying a potion + LDA.w ItemReceiptPose : BNE .defer ; defer if link is buying a potion LDA.l RedrawFlag : BEQ + LDA.w SpriteAuxTable, X ; Retrieve stored item type JSL.l PrepDynamicTile @@ -960,14 +960,14 @@ RTL DrawMagicHeader: LDA.l MagicConsumption : AND.w #$00FF : CMP.w #$0002 : BEQ .quarterMagic .halfMagic - LDA.w #$28F7 : STA.l $7EC704 - LDA.w #$2851 : STA.l $7EC706 - LDA.w #$28FA : STA.l $7EC708 + LDA.w #$28F7 : STA.l HUDTileMapBuffer+$04 + LDA.w #$2851 : STA.l HUDTileMapBuffer+$06 + LDA.w #$28FA : STA.l HUDTileMapBuffer+$08 RTL .quarterMagic - LDA.w #$28F7 : STA.l $7EC704 - LDA.w #$2800 : STA.l $7EC706 - LDA.w #$2801 : STA.l $7EC708 + LDA.w #$28F7 : STA.l HUDTileMapBuffer+$04 + LDA.w #$2800 : STA.l HUDTileMapBuffer+$06 + LDA.w #$2801 : STA.l HUDTileMapBuffer+$08 RTL ;-------------------------------------------------------------------------------- @@ -1001,7 +1001,7 @@ RTL SpawnShovelItem: LDA.b #$01 : STA.l RedrawFlag - LDA.w $03FC : BEQ + + LDA.w YButtonOverride : BEQ + JSL DiggingGameGuy_AttemptPrizeSpawn JMP .skip + @@ -1034,18 +1034,18 @@ SpawnShovelItem: LDA.l .x_speeds, X : STA.w SpriteVelocityX, Y LDA.b #$00 : STA.w SpriteVelocityY, Y - LDA.b #$18 : STA.w $0F80, Y - LDA.b #$FF : STA.w $0B58, Y - LDA.b #$30 : STA.w $0F10, Y + LDA.b #$18 : STA.w SpriteVelocityZ, Y + LDA.b #$FF : STA.w EnemyStunTimer, Y + LDA.b #$30 : STA.w SpriteTimerE, Y - LDA.b $22 : !ADD.l .x_offsets, X + LDA.b LinkPosX : !ADD.l .x_offsets, X AND.b #$F0 : STA.w SpritePosXLow, Y - LDA.b $23 : ADC.b #$00 : STA.w SpritePosXHigh, Y + LDA.b LinkPosX+1 : ADC.b #$00 : STA.w SpritePosXHigh, Y - LDA.b $20 : !ADD.b #$16 : AND.b #$F0 : STA.w SpritePosYLow, Y - LDA.b $21 : ADC.b #$00 : STA.w SpritePosYHigh, Y + LDA.b LinkPosY : !ADD.b #$16 : AND.b #$F0 : STA.w SpritePosYLow, Y + LDA.b LinkPosY+1 : ADC.b #$00 : STA.w SpritePosYHigh, Y - LDA.b #$00 : STA.w $0F20, Y + LDA.b #$00 : STA.w SpriteLayer, Y TYX LDA.b #$30 : JSL Sound_SetSfx3PanLong diff --git a/inverted.asm b/inverted.asm index 4880a1b..fdc9970 100644 --- a/inverted.asm +++ b/inverted.asm @@ -35,7 +35,7 @@ Overworld_CreatePyramidHoleModified: JSL C9DE_LONG JSL C9DE_LONG - LDA.w #$FFFF : STA.w $1012, Y + LDA.w #$FFFF : STA.w GFXStripes+$12, Y JMP .ending .originalBehaviour @@ -64,7 +64,7 @@ Overworld_CreatePyramidHoleModified: JSL C9DE_LONG JSL C9DE_LONG - LDA.w #$FFFF : STA.w $1012, Y + LDA.w #$FFFF : STA.w GFXStripes+$12, Y .ending LDA.w #$3515 : STA.w SFX1 @@ -75,7 +75,7 @@ Overworld_CreatePyramidHoleModified: LDA.b #$03 : STA.w SFX3 - LDA.b #$01 : STA.b $14 + LDA.b #$01 : STA.b NMISTRIPES RTL ;------------------------------------------------------------------------------ @@ -195,12 +195,12 @@ TurtleRockPegSolved: RTL MirrorBonk: - ; must preserve X/Y, and must preserve $00-$0F - LDA.l InvertedMode : BEQ .normal + ; must preserve X/Y, and must preserve $00-$0F + LDA.l InvertedMode : BEQ .normal - ; Goal: use $20 and $22 to decide to force a bonk - ; if we want to bonk branch to .forceBonk - ; otherwise fall through to .normal + ; Goal: use $20 and $22 to decide to force a bonk + ; if we want to bonk branch to .forceBonk + ; otherwise fall through to .normal PHX : PHP PHB : PHK : PLB LDA.b OverworldIndex : AND.b #$40 : BEQ .endLoop ;World we're in? branch if we are in LW we don't want bonks @@ -208,31 +208,31 @@ MirrorBonk: LDX.w #$0000 .loop LDA.l .bonkRectanglesTable, X ;Load X1 - CMP $22 : !BGE ++ + CMP LinkPosX : !BGE ++ ;IF X > X1 LDA.l .bonkRectanglesTable+2, X ; Load X2 - CMP $22 : !BLT ++ + CMP LinkPosX : !BLT ++ ;IF X < X2 LDA.l .bonkRectanglesTable+4, X ;Load Y1 - CMP $20 : !BGE ++ + CMP LinkPosY : !BGE ++ ;IF Y > Y1 LDA.l .bonkRectanglesTable+6, X ; Load Y2 - CMP $20 : !BLT ++ + CMP LinkPosY : !BLT ++ ;IF Y < Y2 ;Bonk Here PLB : PLP : PLX BRA .forceBonk - ++ - TXA : !ADD #$0008 : CMP #.tableEnd-.bonkRectanglesTable : BEQ .endLoop - TAX - BRA .loop - .endbonkRectanglesTable + ++ + TXA : !ADD #$0008 : CMP #.tableEnd-.bonkRectanglesTable : BEQ .endLoop + TAX + BRA .loop + .endbonkRectanglesTable - .endLoop - PLB : PLP : PLX + .endLoop + PLB : PLP : PLX .normal - ;Not forcing a bonk, so the vanilla bonk detection run. - LDA.b Scrap0C : ORA.b Scrap0E + ;Not forcing a bonk, so the vanilla bonk detection run. + LDA.b Scrap0C : ORA.b Scrap0E JML.l MirrorBonk_NormalReturn .forceBonk JML.l MirrorBonk_BranchGamma diff --git a/lampmantlecone.asm b/lampmantlecone.asm index 8c4243a..f897b97 100644 --- a/lampmantlecone.asm +++ b/lampmantlecone.asm @@ -5,36 +5,38 @@ ;-------------------------------------------------------------------------------- LampCheck: LDA.l LightConeModifier : CMP.b #$01 : BNE + : RTL : + - CMP.b #$FF : BNE + : INC : RTL : + - - LDA.l LampEquipment : BNE .done ; skip if we already have lantern - - LDA.l CurrentWorld : BNE + - .lightWorld - LDA.w DungeonID : BNE ++ ; check if we're in sewers - LDA.l LampConeSewers : BRA .done - ++ - LDA.l LampConeLightWorld : BRA .done - + - .darkWorld - LDA.l LampConeDarkWorld - .done + CMP.b #$FF : BNE + : INC : RTL : + + LDA.l LampEquipment : BNE .lamp ; skip if we already have lantern + LDA.w DungeonID : BNE + ; check if we're in sewers + LDA.l LampConeSewers : RTL + + : TDC + .lamp RTL ;================================================================================ ;-------------------------------------------------------------------------------- ; Output: 0 locked, 1 open ;-------------------------------------------------------------------------------- CheckForZelda: - LDA.l ProgressIndicator : CMP.b #$02 : !BLT + ; Skip if rain is falling - LDA.b #$01 ; pretend we have zelda anyway - RTL - + - LDA.l FollowerIndicator + LDA.l ProgressIndicator : CMP.b #$02 : !BLT + ; Skip if rain is falling + LDA.b #$01 ; pretend we have zelda anyway + RTL + + + LDA.l FollowerIndicator RTL ;================================================================================ -;-------------------------------------------------------------------------------- SetOverlayIfLamp: - JSL.l LampCheck - STA.b $1D ; write it directly to the overlay, this isn't a terrible idea at all + JSL.l LampCheck + STA.b SUBDESQ ; write it directly to the overlay, this isn't a terrible idea at all RTL ;================================================================================ +; Mantle Object Changes +;-------------------------------------------------------------------------------- +Mantle_CorrectPosition: + LDA.l ProgressFlags : AND.b #$04 : BEQ + + LDA.b #$0A : STA.w SpritePosXLow, X ; just spawn it off to the side where we know it should be + LDA.b #$03 : STA.w SpritePosXHigh, X + LDA.b #$90 : STA.w SpriteSpawnStep, X + + + LDA.w SpritePosYLow, X : !ADD.b #$03 ; thing we did originally +RTL +;-------------------------------------------------------------------------------- diff --git a/maidencrystals.asm b/maidencrystals.asm index 7dcd6df..1ee421d 100644 --- a/maidencrystals.asm +++ b/maidencrystals.asm @@ -7,9 +7,9 @@ ;-------------------------------------------------------------------------------- MaidenCrystalScript: LDA.b #$00 : STA.l BusyItem - STZ.w $02D8 - STZ.w $02DA - STZ.b $2E + STZ.w ItemReceiptID + STZ.w ItemReceiptPose + STZ.b LinkAnimationStep LDA.b #$02 : STA.w LinkDirection LDA.l CrystalsField : AND.b #$7F : CMP.b #$7F : BNE + ; check if we have all crystals LDA.b #$08 : STA.l MapIcons ; Update the map icon to just be Ganon's Tower diff --git a/mantle.asm b/mantle.asm deleted file mode 100644 index 0e34340..0000000 --- a/mantle.asm +++ /dev/null @@ -1,12 +0,0 @@ -;================================================================================ -; Mantle Object Changes -;-------------------------------------------------------------------------------- -Mantle_CorrectPosition: - LDA.l ProgressFlags : AND.b #$04 : BEQ + - LDA.b #$0A : STA.w $0D10, X ; just spawn it off to the side where we know it should be - LDA.b #$03 : STA.w $0D30, X - LDA.b #$90 : STA.w $0ED0, X - + - LDA.w $0D00, X : !ADD.b #$03 ; thing we did originally -RTL -;-------------------------------------------------------------------------------- diff --git a/medallions.asm b/medallions.asm index fcfe259..cd3ceb3 100644 --- a/medallions.asm +++ b/medallions.asm @@ -40,7 +40,7 @@ TryOpenTRock: RTL ;-------------------------------------------------------------------------------- MedallionTrigger_Bombos: - STZ.b $50 ; stuff we wrote over + STZ.b Strafe ; stuff we wrote over STZ.w FreezeSprites PHA diff --git a/msu.asm b/msu.asm index 0b46d28..43a7617 100644 --- a/msu.asm +++ b/msu.asm @@ -365,7 +365,7 @@ SpiralStairsPostCheck: LDA.b RoomIndex CMP.w #$000C : BNE + ; Ganon's tower entrance - LDX.w $0130 : CPX.b #$F1 : BNE .done ; Check that we were fading out + LDX.w LastAPUCommand : CPX.b #$F1 : BNE .done ; Check that we were fading out LDX.b #22 : STX.w MusicControlRequest BRA .done @@ -374,7 +374,7 @@ SpiralStairsPostCheck: CMP.w #$006B : BNE .done ; Ganon's tower upstairs (with big key) - LDX.w $0130 : CPX.b #$F1 : BNE .done ; Check that we were fading out + LDX.w LastAPUCommand : CPX.b #$F1 : BNE .done ; Check that we were fading out LDX.b #59 : STX.w MusicControlRequest @@ -387,9 +387,9 @@ SpiralStairsPostCheck: ; Make sure expanded OST tracks load properly after death/fairy revival ;-------------------------------------------------------------------------------- StoreMusicOnDeath: - STA.l $7EC227 ; thing we wrote over + STA.l GameOverSongCache ; thing we wrote over LDA.w MSUSTATUS : BIT.b #!FLAG_MSU_STATUS_AUDIO_PLAYING : BEQ .done - LDA.w CurrentMSUTrack : STA.l $7EC227 + LDA.w CurrentMSUTrack : STA.l GameOverSongCache .done RTL ;-------------------------------------------------------------------------------- @@ -781,7 +781,7 @@ EndingMusicWait: LDA.w MSUID+4 : CMP.w #!VAL_MSU_ID_45 : BNE .done SEP #$20 .wait - LDA.b $50 : BNE .done + LDA.b Strafe : BNE .done LDA.w MSUSTATUS : BIT.b #!FLAG_MSU_STATUS_AUDIO_PLAYING : BNE .wait .done SEP #$20 diff --git a/music.asm b/music.asm index b536dd7..9cfb061 100644 --- a/music.asm +++ b/music.asm @@ -71,10 +71,10 @@ PreOverworld_LoadProperties_ChooseMusic: + .lastCheck - LDA.w $0132 : CMP.b #$F2 : BNE + - CPX.w $0130 : BNE + - ; If the last played command ($0132) was half volume (#$F2) - ; and the actual song playing ($0130) is same as the one for this area (X) + LDA.w MusicControlQueue : CMP.b #$F2 : BNE + + CPX.w LastAPUCommand : BNE + + ; If the last played command (MusicControlQueue) was half volume (#$F2) + ; and the actual song playing (LastAPUCommand) is same as the one for this area (X) ; then play the full volume command (#F3) instead of restarting the song LDX.b #$F3 + @@ -94,21 +94,17 @@ Overworld_FinishMirrorWarp: .clear_hdma_table - STA.w $1B00, X : STA.w $1B40, X - STA.w $1B80, X : STA.w $1BC0, X - STA.w $1C00, X : STA.w $1C40, X - STA.w $1C80, X + STA.w IrisPtr+$0000, X : STA.w IrisPtr+$0040, X + STA.w IrisPtr+$0080, X : STA.w IrisPtr+$00C0, X + STA.w IrisPtr+$0100, X : STA.w IrisPtr+$0140, X + STA.w IrisPtr+$0180, X DEX #2 : BPL .clear_hdma_table - - LDA.w #$0000 : STA.l $7EC007 : STA.l $7EC009 + LDA.w #$0000 : STA.l FadeTimer : STA.l FadeDirection SEP #$20 - - JSL $00D7C8 ; $57C8 IN ROM - - LDA.b #$80 : STA.b $9B - + JSL $00D7C8 + LDA.b #$80 : STA.b HDMAENQ LDX.b #$04 ; bunny theme ; if not inverted and light world, or inverted and dark world, skip moon pearl check @@ -205,7 +201,7 @@ BirdTravel_LoadTargetAreaMusic: ; Misery Mire rain SFX CMP.b #$70 : BNE ++ LDA.l OverworldEventDataWRAM+$70 : AND.b #$20 : BNE ++ - LDA.b #$01 : CMP.w $0131 : BEQ + + LDA.b #$01 : CMP.w LastSFX1 : BEQ + STA.w SFX1 + : BRA .checkInverted ++ diff --git a/newhud.asm b/newhud.asm index 6fd9b9c..c3553e9 100644 --- a/newhud.asm +++ b/newhud.asm @@ -179,34 +179,34 @@ DrawMagicMeter_mp_tilemap = $0DFE0F CMP.w #0001 : BEQ .yellow CMP.w #0002 : BNE + : JMP .green : + .blue - LDA.l DrawMagicMeter_mp_tilemap+0, X : AND.w #$EFFF : STA.l $7EC746 - LDA.l DrawMagicMeter_mp_tilemap+2, X : AND.w #$EFFF : STA.l $7EC786 - LDA.l DrawMagicMeter_mp_tilemap+4, X : AND.w #$EFFF : STA.l $7EC7C6 - LDA.l DrawMagicMeter_mp_tilemap+6, X : AND.w #$EFFF : STA.l $7EC806 + LDA.l DrawMagicMeter_mp_tilemap+0, X : AND.w #$EFFF : STA.l HUDTileMapBuffer+$46 + LDA.l DrawMagicMeter_mp_tilemap+2, X : AND.w #$EFFF : STA.l HUDTileMapBuffer+$86 + LDA.l DrawMagicMeter_mp_tilemap+4, X : AND.w #$EFFF : STA.l HUDTileMapBuffer+$C6 + LDA.l DrawMagicMeter_mp_tilemap+6, X : AND.w #$EFFF : STA.l HUDTileMapBuffer+$06 RTL .red - LDA.l DrawMagicMeter_mp_tilemap+0, X : AND.w #$E7FF : STA.l $7EC746 - LDA.l DrawMagicMeter_mp_tilemap+2, X : AND.w #$E7FF : STA.l $7EC786 - LDA.l DrawMagicMeter_mp_tilemap+4, X : AND.w #$E7FF : STA.l $7EC7C6 - LDA.l DrawMagicMeter_mp_tilemap+6, X : AND.w #$E7FF : STA.l $7EC806 + LDA.l DrawMagicMeter_mp_tilemap+0, X : AND.w #$E7FF : STA.l HUDTileMapBuffer+$46 + LDA.l DrawMagicMeter_mp_tilemap+2, X : AND.w #$E7FF : STA.l HUDTileMapBuffer+$86 + LDA.l DrawMagicMeter_mp_tilemap+4, X : AND.w #$E7FF : STA.l HUDTileMapBuffer+$C6 + LDA.l DrawMagicMeter_mp_tilemap+6, X : AND.w #$E7FF : STA.l HUDTileMapBuffer+$06 RTL .yellow - LDA.l DrawMagicMeter_mp_tilemap+0, X : AND.w #$EBFF : STA.l $7EC746 - LDA.l DrawMagicMeter_mp_tilemap+2, X : AND.w #$EBFF : STA.l $7EC786 - LDA.l DrawMagicMeter_mp_tilemap+4, X : AND.w #$EBFF : STA.l $7EC7C6 - LDA.l DrawMagicMeter_mp_tilemap+6, X : AND.w #$EBFF : STA.l $7EC806 + LDA.l DrawMagicMeter_mp_tilemap+0, X : AND.w #$EBFF : STA.l HUDTileMapBuffer+$46 + LDA.l DrawMagicMeter_mp_tilemap+2, X : AND.w #$EBFF : STA.l HUDTileMapBuffer+$86 + LDA.l DrawMagicMeter_mp_tilemap+4, X : AND.w #$EBFF : STA.l HUDTileMapBuffer+$C6 + LDA.l DrawMagicMeter_mp_tilemap+6, X : AND.w #$EBFF : STA.l HUDTileMapBuffer+$0106 RTL .orange - LDA.l DrawMagicMeter_mp_tilemap+0, X : AND.w #$E3FF : STA.l $7EC746 - LDA.l DrawMagicMeter_mp_tilemap+2, X : AND.w #$E3FF : STA.l $7EC786 - LDA.l DrawMagicMeter_mp_tilemap+4, X : AND.w #$E3FF : STA.l $7EC7C6 - LDA.l DrawMagicMeter_mp_tilemap+6, X : AND.w #$E3FF : STA.l $7EC806 + LDA.l DrawMagicMeter_mp_tilemap+0, X : AND.w #$E3FF : STA.l HUDTileMapBuffer+$46 + LDA.l DrawMagicMeter_mp_tilemap+2, X : AND.w #$E3FF : STA.l HUDTileMapBuffer+$86 + LDA.l DrawMagicMeter_mp_tilemap+4, X : AND.w #$E3FF : STA.l HUDTileMapBuffer+$C6 + LDA.l DrawMagicMeter_mp_tilemap+6, X : AND.w #$E3FF : STA.l HUDTileMapBuffer+$0106 RTL .green - LDA.l DrawMagicMeter_mp_tilemap+0, X : STA.l $7EC746 - LDA.l DrawMagicMeter_mp_tilemap+2, X : STA.l $7EC786 - LDA.l DrawMagicMeter_mp_tilemap+4, X : STA.l $7EC7C6 - LDA.l DrawMagicMeter_mp_tilemap+6, X : STA.l $7EC806 + LDA.l DrawMagicMeter_mp_tilemap+0, X : STA.l HUDTileMapBuffer+$46 + LDA.l DrawMagicMeter_mp_tilemap+2, X : STA.l HUDTileMapBuffer+$86 + LDA.l DrawMagicMeter_mp_tilemap+4, X : STA.l HUDTileMapBuffer+$C6 + LDA.l DrawMagicMeter_mp_tilemap+6, X : STA.l HUDTileMapBuffer+$0106 RTL ;================================================================================ @@ -242,33 +242,6 @@ HudHexToDec4Digit: STY.b Scrap07 ; Store 1s digit RTS -;================================================================================ -; 8-bit registers -; in: A(b) - Byte to Convert -; out: $05 - $07 (high - low) -;================================================================================ -;HudHexToDec3Digit: ; this may be overkill, could have used the 4 digit one... -; LDY.b #$90 -; - -; CMP.b #100 : !BLT + -; INY -; SBC.b #100 : BRA - -; + -; STY $05 : LDY.b #$90 ; Store 100s digit and reset Y -; - -; CMP.b #10 : !BLT + -; INY -; SBC.b #10 : BRA - -; + -; STY $06 : LDY #$90 ; Store 10s digit and reset Y -; CMP.b #1 : !BLT + -; - -; INY -; DEC : BNE - -; + -; STY $07 ; Store 1s digit -;RTS - ;================================================================================ ; 8-bit registers ; in: A(b) - Byte to Convert diff --git a/newitems.asm b/newitems.asm index 2545f9e..6d53808 100755 --- a/newitems.asm +++ b/newitems.asm @@ -898,23 +898,23 @@ LDA.l ArrowMode : BEQ .normal + CMP.b #03 : !BGE .silver .wooden - LDA.b #$A7 : STA.l $7EC720 ; draw wooden arrow marker - LDA.b #$20 : STA.l $7EC721 - LDA.b #$A9 : STA.l $7EC722 - LDA.b #$20 : STA.l $7EC723 + LDA.b #$A7 : STA.l HUDTileMapBuffer+$20 ; draw wooden arrow marker + LDA.b #$20 : STA.l HUDTileMapBuffer+$21 + LDA.b #$A9 : STA.l HUDTileMapBuffer+$22 + LDA.b #$20 : STA.l HUDTileMapBuffer+$23 RTL .normal ; in normal arrow mode this function is only ever called for silvers .silver - LDA.b #$86 : STA.l $7EC720 ; draw silver arrow marker - LDA.b #$24 : STA.l $7EC721 - LDA.b #$87 : STA.l $7EC722 - LDA.b #$24 : STA.l $7EC723 + LDA.b #$86 : STA.l HUDTileMapBuffer+$20 ; draw silver arrow marker + LDA.b #$24 : STA.l HUDTileMapBuffer+$21 + LDA.b #$87 : STA.l HUDTileMapBuffer+$22 + LDA.b #$24 : STA.l HUDTileMapBuffer+$23 RTL .none - LDA.b #$7F : STA.l $7EC720 ; draw no arrow marker - LDA.b #$24 : STA.l $7EC721 - LDA.b #$7F : STA.l $7EC722 - LDA.b #$24 : STA.l $7EC723 + LDA.b #$7F : STA.l HUDTileMapBuffer+$20 ; draw no arrow marker + LDA.b #$24 : STA.l HUDTileMapBuffer+$21 + LDA.b #$7F : STA.l HUDTileMapBuffer+$22 + LDA.b #$24 : STA.l HUDTileMapBuffer+$23 RTL ;-------------------------------------------------------------------------------- GetRNGItemSingle: diff --git a/npcitems.asm b/npcitems.asm index df48a9d..8ed60fb 100644 --- a/npcitems.asm +++ b/npcitems.asm @@ -61,7 +61,7 @@ ItemCheck_TreeKid3: BRA .done LDA.b #$05 .normal - LDA.w SpriteUnknown, X + LDA.w SpriteActivity, X .done RTL @@ -151,7 +151,7 @@ RTL ; Randomize 300 Rupee NPC ;-------------------------------------------------------------------------------- Set300RupeeNPCItem: - INC.w SpriteUnknown, X ; thing we wrote over + INC.w SpriteActivity, X ; thing we wrote over PHA : PHP REP #$20 ; set 16-bit accumulator diff --git a/password.asm b/password.asm index a1b52be..edf77c7 100644 --- a/password.asm +++ b/password.asm @@ -16,7 +16,7 @@ Password_BeginInit: JSL Vram_EraseTilemaps_triforce JSL LoadCustomHudPalette ; replace the 2bpp palettes, and trigger upload - LDA.b #$07 : STA.b $14 ; have NMI load up the initial tilemap from Password_Tilemap + LDA.b #$07 : STA.b NMISTRIPES ; have NMI load up the initial tilemap from Password_Tilemap INC.b GameSubMode RTL @@ -37,7 +37,7 @@ Password_EndInit: DEX : BPL - + - LDA.b #$0F : STA.b $13 + LDA.b #$0F : STA.b INIDISPQ INC.b GameSubMode RTL @@ -119,7 +119,7 @@ Password_Main: JSR UpdatePasswordTiles JSR PasswordSetNewCursors - LDA.b #$01 : STA.b $14 + LDA.b #$01 : STA.b NMISTRIPES PLB RTL .selectionValues diff --git a/pendantcrystalhud.asm b/pendantcrystalhud.asm index 0f86c2d..6aabf1c 100644 --- a/pendantcrystalhud.asm +++ b/pendantcrystalhud.asm @@ -31,11 +31,11 @@ RTL HUDRebuildIndoor: LDA.l GenericKeys : BEQ .normal .generic - LDA.b #$00 : STA.l $7EC017 + LDA.b #$00 : STA.l RoomDarkness LDA.l CurrentGenericKeys ; generic key count RTL .normal - LDA.b #$00 : STA.l $7EC017 + LDA.b #$00 : STA.l RoomDarkness LDA.b #$FF ; don't show keys RTL ;================================================================================ @@ -186,7 +186,7 @@ RTL UpdateKeys: PHX : PHP SEP #$30 ; set 8-bit accumulator & index registers - LDA.w DungeonID : CMP.b $1F : !BLT .skip + LDA.w DungeonID : CMP.b TSWQ : !BLT .skip LSR : TAX ; get dungeon index and store to X @@ -219,39 +219,38 @@ RTL ;-------------------------------------------------------------------------------- DrawBootsInMenuLocation: LDA.l HUDDungeonItems : BNE + - LDA.w #$1608 : STA.b $00 + LDA.w #$1608 : STA.b Scrap00 RTL + - LDA.w #$1588 : STA.b $00 + LDA.w #$1588 : STA.b Scrap00 RTL ;-------------------------------------------------------------------------------- DrawGlovesInMenuLocation: LDA.l HUDDungeonItems : BNE + - LDA.w #$1610 : STA.b $00 + LDA.w #$1610 : STA.b Scrap00 RTL + - LDA.w #$1590 : STA.b $00 + LDA.w #$1590 : STA.b Scrap00 RTL ;-------------------------------------------------------------------------------- DrawFlippersInMenuLocation: LDA.l HUDDungeonItems : BNE + - LDA.w #$1618 : STA.b $00 + LDA.w #$1618 : STA.b Scrap00 RTL + - LDA.w #$1598 : STA.b $00 + LDA.w #$1598 : STA.b Scrap00 RTL ;-------------------------------------------------------------------------------- DrawMoonPearlInMenuLocation: LDA.l HUDDungeonItems : BNE + - LDA.w #$1620 : STA.b $00 + LDA.w #$1620 : STA.b Scrap00 RTL + - LDA.w #$15A0 : STA.b $00 + LDA.w #$15A0 : STA.b Scrap00 RTL ;-------------------------------------------------------------------------------- DrawHUDDungeonItems: LDA.l HUDDungeonItems : BNE .continue - RTL .dungeon_positions @@ -328,12 +327,12 @@ DrawHUDDungeonItems: ; dungeon names LDA.w #$2D50 - LDY.w #0 + LDY.w #00 .next_dungeon_name LDX.w .dungeon_positions,Y - STA.w $1646,X + STA.w GFXStripes+$0646,X INC @@ -344,9 +343,9 @@ DrawHUDDungeonItems: LDX.w #$001E LDA.w #$24F5 --- STA.w $1686,X - STA.w $16C6,X - STA.w $1706,X +-- STA.w GFXStripes+$0686,X + STA.w GFXStripes+$06C6,X + STA.w GFXStripes+$0706,X DEX : DEX : BPL -- @@ -361,7 +360,7 @@ DrawHUDDungeonItems: LDA.l HUDDungeonItems : AND.w #$0001 : BEQ .skip_small_keys .draw_small_keys - LDA.w #$2810 : STA.w $1684 ; small keys icon + LDA.w #$2810 : STA.w GFXStripes+$0684 ; small keys icon LDY.w #0 @@ -376,7 +375,7 @@ DrawHUDDungeonItems: LDX.w .dungeon_positions,Y ADC.w #$2816 - STA.w $1686,X + STA.w GFXStripes+$0686,X INY : INY CPY.w #26 : BCC .next_small_key @@ -389,7 +388,7 @@ DrawHUDDungeonItems: LDA.l HUDDungeonItems : AND.w #$0002 : BEQ .skip_big_keys - LDA.w #$2811 : STA.w $16C4 ; big key icon + LDA.w #$2811 : STA.w GFXStripes+$06C4 ; big key icon ; use X so we can BIT LDX.w #0 @@ -403,7 +402,7 @@ DrawHUDDungeonItems: LDY.w .dungeon_positions,X LDA.w #$2826 - STA.w $16C6,Y + STA.w GFXStripes+$06C6,Y ; reload LDA.l BigKeyField @@ -417,7 +416,7 @@ DrawHUDDungeonItems: .skip_big_keys LDA.l HUDDungeonItems : AND.w #$0010 : BEQ .skip_boss_kills - LDA.w #$280F : STA.w $1704 ; skull icon + LDA.w #$280F : STA.w GFXStripes+$0704 ; skull icon LDY.w #0 .next_boss_kill @@ -428,7 +427,7 @@ DrawHUDDungeonItems: LDA.w #$2826 LDX.w .dungeon_positions,Y - STA.w $1706,X + STA.w GFXStripes+$0706,X ..skip_boss_kill INY : INY @@ -446,7 +445,7 @@ DrawHUDDungeonItems: ; Maps LDA.l HUDDungeonItems : AND.w #$0004 : BEQ .skip_maps - LDA.w #$2821 : STA.w $1684 ; map icon + LDA.w #$2821 : STA.w GFXStripes+$0684 ; map icon ; use X so we can BIT LDX.w #0 @@ -460,7 +459,7 @@ DrawHUDDungeonItems: LDY.w .dungeon_positions,X LDA.w #$2826 - STA.w $1686,Y + STA.w GFXStripes+$0686,Y ; reload LDA.l MapField @@ -475,7 +474,7 @@ DrawHUDDungeonItems: ; Compasses LDA.l HUDDungeonItems : AND.w #$0008 : BEQ .skip_compasses - LDA.w #$2C20 : STA.w $16C4 ; compass icon + LDA.w #$2C20 : STA.w GFXStripes+$06C4 ; compass icon ; use X so we can BIT LDX.w #0 @@ -489,7 +488,7 @@ DrawHUDDungeonItems: LDY.w .dungeon_positions,X LDA.w #$2826 - STA.w $16C6,Y + STA.w GFXStripes+$06C6,Y ; reload LDA.l CompassField @@ -513,15 +512,15 @@ DrawPendantCrystalDiagram: REP #$30 ; Set 16-bit accumulator & index registers LDX.w #$0000 ; Paint entire box black & draw empty pendants and crystals - - LDA.l .row0, X : STA.w $12EA, X - LDA.l .row1, X : STA.w $132A, X - LDA.l .row2, X : STA.w $136A, X - LDA.l .row3, X : STA.w $13AA, X - LDA.l .row4, X : STA.w $13EA, X - LDA.l .row5, X : STA.w $142A, X - LDA.l .row6, X : STA.w $146A, X - LDA.l .row7, X : STA.w $14AA, X - LDA.l .row8, X : STA.w $14EA, X + LDA.l .row0, X : STA.w GFXStripes+$02EA, X + LDA.l .row1, X : STA.w GFXStripes+$032A, X + LDA.l .row2, X : STA.w GFXStripes+$036A, X + LDA.l .row3, X : STA.w GFXStripes+$03AA, X + LDA.l .row4, X : STA.w GFXStripes+$03EA, X + LDA.l .row5, X : STA.w GFXStripes+$042A, X + LDA.l .row6, X : STA.w GFXStripes+$046A, X + LDA.l .row7, X : STA.w GFXStripes+$04AA, X + LDA.l .row8, X : STA.w GFXStripes+$04EA, X INX #2 : CPX.w #$0014 : BCC - ; pendants @@ -529,59 +528,56 @@ DrawPendantCrystalDiagram: LSR : BCC + ; pendant of wisdom (red) LDX.w #$252B - STX.w $13B6 - INX : STX.w $13B8 - INX : STX.w $13F6 - INX : STX.w $13F8 + STX.w GFXStripes+$03B6 + INX : STX.w GFXStripes+$03B8 + INX : STX.w GFXStripes+$03F6 + INX : STX.w GFXStripes+$03F8 + LSR : BCC + ; pendant of power (blue) LDX.w #$2D2B - STX.w $13AE - INX : STX.w $13B0 - INX : STX.w $13EE - INX : STX.w $13F0 + STX.w GFXStripes+$03AE + INX : STX.w GFXStripes+$03B0 + INX : STX.w GFXStripes+$03EE + INX : STX.w GFXStripes+$03F0 + LSR : BCC + ; pendant of courage (green) LDX.w #$3D2B - STX.w $1332 - INX : STX.w $1334 - INX : STX.w $1372 - INX : STX.w $1374 + STX.w GFXStripes+$0332 + INX : STX.w GFXStripes+$0334 + INX : STX.w GFXStripes+$0372 + INX : STX.w GFXStripes+$0374 + - - - ; crystals LDA.l CrystalsField LDX.w #$2D44 LDY.w #$2D45 BIT.w #$0002 : BEQ + ; crystal 1 - STX.w $14AC - STY.w $14AE + STX.w GFXStripes+$04AC + STY.w GFXStripes+$04AE + BIT.w #$0010 : BEQ + ; crystal 2 - STX.w $146E - STY.w $1470 + STX.w GFXStripes+$046E + STY.w GFXStripes+$0470 + BIT.w #$0040 : BEQ + ; crystal 3 - STX.w $14B0 - STY.w $14B2 + STX.w GFXStripes+$04B0 + STY.w GFXStripes+$04B2 + BIT.w #$0020 : BEQ + ; crystal 4 - STX.w $1472 - STY.w $1474 + STX.w GFXStripes+$0472 + STY.w GFXStripes+$0474 + BIT.w #$0008 : BEQ + ; crystal 7 - STX.w $14B8 - STY.w $14BA + STX.w GFXStripes+$04B8 + STY.w GFXStripes+$04BA + LDX.w #$2544 LDY.w #$2545 BIT.w #$0004 : BEQ + ; crystal 5 - STX.w $14B4 - STY.w $14B6 + STX.w GFXStripes+$04B4 + STY.w GFXStripes+$04B6 + BIT.w #$0001 : BEQ + ; crystal 6 - STX.w $1476 - STY.w $1478 + STX.w GFXStripes+$0476 + STY.w GFXStripes+$0478 + PLB : PLP diff --git a/playername.asm b/playername.asm index b9f80bc..fe4c5be 100644 --- a/playername.asm +++ b/playername.asm @@ -15,20 +15,20 @@ WriteBlanksToPlayerName: STA.l ExtendedFileNameSRAM+20 STA.l ExtendedFileNameSRAM+22 - STA.l $7003D9, X ;What we wrote over (clear first byte of vanilla name slot) + STA.l FileNameVanillaSRAM, X ;What we wrote over (clear first byte of vanilla name slot) RTL WriteCharacterToPlayerName: STA.l ExtendedFileNameSRAM, X CPX.w #$0008 : !BGE + - STA.l $7003D9, X ;what we wrote over + STA.l FileNameVanillaSRAM, X ;what we wrote over + RTL ReadCharacterFromPlayerName: ;Only for use on Name Screen LDA.l ExtendedFileNameSRAM, X CPX.w #$0008 : !BGE + - LDA.l $7003D9, X ;what we wrote over + LDA.l FileNameVanillaSRAM, X ;what we wrote over + RTL @@ -40,13 +40,13 @@ PLB RTL WrapCharacterPosition: - LDA.w $0B12 : BPL + + LDA.w PlayerNameCursor : BPL + LDA.b #$0B + CMP.b #$0C : !BLT + LDA.b #$00 + - STA.w $0B12 + STA.w PlayerNameCursor RTL CharacterPositions: diff --git a/ram.asm b/ram.asm index 23a65b7..be87595 100644 --- a/ram.asm +++ b/ram.asm @@ -4,9 +4,9 @@ ; This module is primarily concerned with labeling WRAM addresses used by the ; randomizer and documenting their usage. We use a combination of base $[address] ; and WRAMLabel = $[address] here, favoring the former when we have larger blocks -; of contiguous ram labeled. In some cases the label name can be descriptive enough -; without documentation, you may want to consult more in-depth reference materials, -; or I just don't understand what they are. +; of contiguous ram labeled. A line is skipped when the next address is non-cotiguous, +; but comments will go in the empty space if multi-line. In some cases the label +; name can be descriptive enough without documentation. Or I just didn't know what it was. ; ; See the JP 1.0 disassembly for reference, specifically symbols_wram.asm ; (https://github.com/spannerisms/jpdasm/ - 19/11/2022) @@ -38,28 +38,42 @@ Scrap0C: skip 1 ; Scrap0D: skip 1 ; Scrap0E: skip 1 ; Scrap0F: skip 1 ; - ; GameMode = $7E0010 ; Game mode & submode. Refer to disassembly. GameSubMode = $7E0011 ; - ; +NMIDoneFlag = $7E0012 ; $00 = Main loop done | $01 = Not done (lag) +INIDISPQ = $7E0013 ; Queue for INIDISP updates. Written during NMI. +NMISTRIPES = $7E0014 ; NMI update flags. +NMICGRAM = $7E0015 ; When non-zero, will trigger a specific gfx update +NMIHUD = $7E0016 ; during NMI. +NMIINCR = $7E0017 ; +NMIUP1100 = $7E0018 ; +UPINCVH = $7E0019 ; Incremental upload VRAM high byte FrameCounter = $7E001A ; Increments every frame that the game isn't lagging IndoorsFlag = $7E001B ; $00 = Outdoors | $01 = Indoors - ; +MAINDESQ = $7E001C ; PPU register queues written during NMI +SUBDESQ = $7E001D ; +TMWQ = $7E001E ; +TSWQ = $7E001F ; LinkPosY = $7E0020 ; Link's absolute x/y coordinates. Both are word length. LinkPosX = $7E0022 ; LinkPosZ = $7E0024 ; $FFFF when on ground - ; +LinkPushDirection = $7E0026 ; - - - - u d l r LinkRecoilY = $7E0027 ; LinkRecoilX = $7E0028 ; LinkRecoilZ = $7E0029 ; - ; +LinkSubPixelVelocty = $7E002A ; Word length +LinkAnimationStep = $7E002E ; LinkDirection = $7E002F ; $00 = Up | $02 = Down | $04 = Left | $06 = Right ; OAMOffsetY = $7E0044 ; OAMOffsetX = $7E0045 ; ; +CapeTimer = $7E004C ; Countdown for cape sapping magic Countdown for cape sapping magic.. LinkJumping = $7E004D ; $00 = None | $01 = Bonk/damage/water | $02 = Ledge ; +Strafe = $7E0050 ; ??? + ; +CapeOn = $7E0055 ; Link invisible and untouchable when set. BunnyFlagDP = $7E0056 ; $00 = Link | $01 = Bunny ; LinkSlipping = $7E005B ; $00 = None | $01 = Near pit @@ -68,14 +82,35 @@ FallTimer = $7E005C ; Timer for falling animation LinkState = $7E005D ; Main Link state handler LinkSpeed = $7E005E ; Main Link speed handler ; +LinkWalkDirection = $7E0067 ; - - - - u d l r + ; +ScrapBuffer72 = $7E0072 ; Volatile scrap buffer. 5 bytes. + ; +WorldCache = $7E007B ; $00 = Light world | $40 bit set for dark world. + ; OverworldIndex = $7E008A ; Overworld screen index. Word length. Dark world is OR $40 of ; light world screen in same position. Zeroed on UW entry. OverlayID = $7E008C ; Overworld overlay ID. One Byte. ; +OAMPtr = $7E0090 ; Pointer used to indirectly address OAM buffer. 4 bytes. +BGMODEQ = $7E0094 ; Various PPU queues handled during NMI +MOSAICQ = $7E0095 ; +W12SELQ = $7E0096 ; +W34SELQ = $7E0097 ; +WOBJSELQ = $7E0098 ; +CGWSELQ = $7E0099 ; +CGADSUBQ = $7E009A ; +HDMAENQ = $7E009B ; HDMA enable flags + ; RoomIndex = $7E00A0 ; Underworld room index. Word length. High byte: $00 = EG1 | $01 = EG2 ; Not zeroed on exit to overworld. PreviousRoom = $7E00A2 ; Stores previous value of RoomIndex ; +CameraBoundH = $7E00A6 ; Which set of camera boundaries to use. +CameraBoundV = $7E00A7 ; + ; +RoomTag = $7E00AE ; Room effects; e.g. kill room, shutter switch, etc. Word length. + ; SubSubModule = $7E00B0 ; Often used as a submodule, such as for transitions ; ObjPtr = $7E00B7 ; Pointer for drawing room objects. Three bytes. @@ -114,23 +149,31 @@ Joy2B_Old = $7E00FB ; ; Pages 0x00–0x1F of Bank7E are mirrored to every program bank ALTTP uses. ;-------------------------------------------------------------------------------- +DeathReloadFlag = $7E010A ; Flag set on death for dungeon reload CurrentMSUTrack = $7E010B ; GameModeCache = $7E010C ; GameSubModeCache = $7E010D ; +EntranceIndex = $7E010E ; Entrance ID into underworld. Word length. ; MedallionFlag = $7E0112 ; Medallion cutscene flag. $01 = Cutscene active. ; +VRAMUploadAddress = $7E0118 ; Incremental VRAM upload address. Low byte always 0. Word length. + ; BG1ShakeV = $7E011A ; Applied to BG Scroll. Word Length. BG1ShakeH = $7E011C ; ; CurrentVolume = $7E0127 ; TargetVolume = $7E0129 ; -CurrentControlRequest = $7E0133 ; Last thing written to MusicControlRequest MusicControl = $7E012B ; MusicControlRequest = $7E012C ; SFX1 = $7E012D ; SFX2 = $7E012E ; SFX3 = $7E012F ; +LastAPUCommand = $7E0130 ; Last non-zero command given to SPC. +LastSFX1 = $7E0131 ; Last non-zero SFX1 +MusicControlQueue = $7E0132 ; Used to queue up writes to MusicControlRequest +CurrentControlRequest = $7E0133 ; Last thing written to MusicControlRequest +LastAPU = $7E0134 ; Stores last anything written to MusicControlRequest ; SubModuleInterface = $7E0200 ; Word length. High byte expected to be $00. ItemCursor = $7E0202 ; Current location of the item menu cursor. @@ -139,22 +182,51 @@ BottleMenuCounter = $7E0205 ; Step counter for opening bottle menu MenuFrameCounter = $7E0206 ; Incremented every menu frame. Never read. MenuBlink = $7E0207 ; Incremented every frame and masked with $10 to blink cursor ; +RaceGameFlag = $7E021B ; + ; +MessageJunk = $7E0223 ; Zeroed but never used (?) + ; ItemReceiptID = $7E02D8 ; +ItemReceiptPose = $7E02DA ; $00 = No pose | $01 = One hand up | $02 = Two hands up ; BunnyFlag = $7E02E0 ; $00 = Link | $01 = Bunny - ; +Poofing = $7E02E1 ; Flags cape and bunny poof. +PoofTimer = $7E02E2 ; Countdown timer for poofing. +SwordCooldown = $7E02E3 ; Cooldown for sword after dashing through an enemy. CutsceneFlag = $7E02E4 ; Flags various cutscenes. All non-zero behave the same. ; ItemReceiptMethod = $7E02E9 ; ; TileActBE = $7E02EF ; Bitfield used by breakables and entrances. b b b b d d d d ; b = Breakables | d = Entrances +UseY1 = $7E0301 ; Bitfield for Y-item usage: b p - a x z h r + ; b = Boomerang | p = Powder | a = Bow | x = Hammer (tested, never set) + ; z = Rods (tested, never set) | h = Hammer | r = Rods CurrentYItem = $7E0303 ; ; +AButtonAct = $7E0308 ; Bitfield for A-actions. $80 = Carry/toss | $02 Prayer | $01 = Tree pull +CarryAct = $7E0309 ; Bitfield for carrying. $02 = Tossing | $01 = Lifting + ; +TileActIce = $7E0348 ; Bitfield used by ice. Word length. ; TileActDig = $7E035B ; Bitfield used by diggable ground. Word length. High byte unused. ; +LinkZap = $7E0360 ; When set, recoil zaps Link. + ; +DamageReceived = $7E0373 ; Damage to deal to Link. + ; +UseY2 = $7E037A ; - - b n c h - s + ; b = Book | n = Net | c = Canes | h = Hookshot | s = Shovel +NoDamage = $7E037B ; Prevents Link from receiving damage. + ; +AncillaGeneral = $7E039F ; General use buffer for front slot ancillae. $0F bytes. + ; +AncillaSearch = $7E03C4 ; Used to search through ancilla when every front slot is occupied. + ; ForceSwordUp = $7E03EF ; $01 = Force sword up pose. +FluteTimer = $7E03F0 ; Countdown timer for being able to use the flute + ; +YButtonOverride = $7E03FC ; Y override for minigames. $00 = Selected item | $01 = Shovel | $02 = Bow ; ItemsTaken = $7E0403 ; Items taken in a room: b k u t s e h c ; b = boss kill/item | k = key/heart piece (prevents crystals) @@ -162,46 +234,124 @@ ItemsTaken = $7E0403 ; Items taken in a room: b k u t s e h c ; s = chest 3/pod or dp wall | e, h, c = chest 2, 1, 0 DungeonID = $7E040C ; High byte mostly unused but sometimes read. Word length. ; +LayerAdjustment = $7E047A ; Flags layer adjustments. Arms EG. + ; +RoomIndexMirror = $7E048E ; Mirrors RoomIndex + ; +RespawnFlag = $7E04AA ; If set, entrance loading is treated as a respawn. Word length. +Map16ChangeIndex = $7E04AC ; Word length. + ; OWEntranceCutscene = $7E04C6 ; ; HeartBeepTimer = $7E04CA ; ; +CameraScrollN = $7E0618 ; Camera scroll trigger areas for directions NSEW +CameraScrollS = $7E061A ; The higher boundary should always be +2 from the lower in +CameraScrollW = $7E061C ; underworld and -2 in overworld. +CameraScrollE = $7E061E ; + ; NMIAux = $7E0632 ; Stores long address of NMI jump. Currently only used by shops. ; +SpriteRoomTag = $7E0642 ; Set high by sprites triggering room tags. + ; +SomariaSwitchFlag = $7E0646 ; Set by Somaria when on a switch. + ; +TileMapEntranceDoors = $7E0696 ; Tilemap location of entrance doors. Word length. +TileMapTile32 = $7E0698 ; Tilemap location of new tile32 objects, such as from graves/rocks. Word length. + ; SkipOAM = $7E0710 ; Set to skip OAM updates. High byte written $FF with exploding walls +OWScreenSize = $7E0712 ; Flags overworld screen size. + ; +OWTransitionFlag = $7E0ABF ; Used for certain transitions like smith, witch, etc. + ; +ArcVariable = $7E0B08 ; Arc variable. Word length. +OverlordXLow = $7E0B08 ; $08 bytes. +OverlordXHigh = $7E0B10 ; $08 bytes. +PlayerNameCursor = $7E0B12 ; Player name screen. +OverlordYLow = $7E0B18 ; $08 bytes. +OverlordYHigh = $7E0B20 ; $08 bytes. + ; +EnemyStunTimer = $7E0B58 ; Auto-decrementing timer for stunned enemies. $10 bytes. ; BowDryFire = $7E0B9A ; If set, arrows are deleted immediately ; SaveFileIndex = $7E0B9D ; ; -SpritePosYLow = $7E0D00 ; Sprite slot data. Each label has $10 bytes. -SpritePosXLow = $7E0D10 ; -SpritePosYHigh = $7E0D20 ; +SpriteAncillaInteract = $7E0BA0 ; If nonzero, ancillae do not interact with the sprite. $10 bytes. + ; +AncillaVelocityY = $7E0C22 ; $0A bytes. +AncillaVelocityX = $7E0C2C ; $0A bytes. + ; +AncillaID = $7E0C4A ; $0A bytes. + ; +AncillaGet = $7E0C5E ; Used by varius ancilla in various ways. $0F bytes. + ; +SpriteBump = $7E0CD2 ; See symbols_wram.asm. $10 bytes. + ; +TreePullKills = $7E0CFB ; Kills for tree pulls. +TreePullHits = $7E0CFC ; Hits taken for tree pulls. + ; +SpritePosYLow = $7E0D00 ; Sprite slot data. Each label has $10 bytes unless otherwise +SpritePosXLow = $7E0D10 ; specified. Some of these I'm not sure what they are. May +SpritePosYHigh = $7E0D20 ; have taken a guess or just made something up. SpritePosXHigh = $7E0D30 ; SpriteVelocityY = $7E0D40 ; SpriteVelocityX = $7E0D50 ; - ; -SpriteUnknown = $7E0D80 ; Don't know what this is +SpriteSubPixelY = $7E0D60 ; +SpriteSubPixelX = $7E0D70 ; +SpriteActivity = $7E0D80 ; Not sure what this is. +SpriteMovement = $7E0D90 ; Not sure what this is. ; SpriteAuxTable = $7E0DA0 ; $20 bytes. SpriteGFXControl = $7E0DC0 ; SpriteAITable = $7E0DD0 ; AI state of sprites. $10 bytes. +SpriteMoveDirection = $7E0DE0 ; $00 = Right | $01 = Left | $02 = Down | $03 = Up ; SpriteTimer = $7E0DF0 ; ; SpriteTypeTable = $7E0E20 ; Which sprite occupies this slot. $10 bytes. - ; +SpriteAux = $7E0E30 ; +SpriteOAMProperties = $7E0E40 ; h m w o o o o o | h = Harmless | m = master sword? | w = walls? + ; | o = OAM allocation +SpriteHitPoints = $7E0E50 ; Set from $0DB173 +SpriteControl = $7E0E60 ; n i o s p p p t | n = Death animation? | i = Immune to attack/collion? + ; o = Shadow | p = OAM prop palette | t = OAM prop name table SpriteItemType = $7E0E80 ; Sprite Item Type. $10 bytes. ; +SpriteSpawnStep = $7E0ED0 ; Related to enemies spawning other sprites (eg pikit, zirro) + ; SpriteDirectionTable = $7E0EB0 ; Sprite direction. $10 bytes. ; +SpriteHalt = $7E0F00 ; +SpriteTimerE = $7E0F10 ; ? + ; +SpriteLayer = $7E0F20 ; + ; +SpriteOAMProp = $7E0F50 ; + ; +SpriteZCoord = $7E0F70 ; +SpriteVelocityZ = $7E0F80 ; +SpriteSubPixelZ = $7E0F90 ; + ; FreezeSprites = $7E0FC1 ; "Seems to freeze sprites" ; +PrizePackIndexes = $7E0FC7 ; $07 bytes. One for each prize pack. + ; SpriteCoordCacheX = $7E0FD8 ; SpriteCoordCacheY = $7E0FDA ; ; NoMenu = $7E0FFC ; When set prevents menu, mirror, medallions ; +GFXStripes = $7E1000 ; Used by stripes for arbitrary VRAM transfers. $100 bytes. +RoomStripes = $7E1100 ; Used for room drawing. + ; +IrisPtr = $7E1B00 ; Spotlight pointers for HDMA. $1C0 bytes (?). + ; +MessageSubModule = $7E1CD8 ; + ; +MessageCursor = $7E1CE8 ; Chosen option in message. +DelayTimer = $7E1CE9 ; + ; TextID = $7E1CF0 ; Message ID and page. Word length. ; ToastBuffer = $7E1E0E ; Multiworld buffer. Word length. @@ -230,8 +380,56 @@ ScratchBufferV = $7E1EB0 ; Volatile scratch buffer. Can clobber at will ;-------------------------------------------------------------------------------- TileUploadBuffer = $7EA180 ; 0x300 bytes + ; +RoomFade = $7EC005 ; Flags fade to black on room transitions. Word length. +FadeTimer = $7EC007 ; Timer for transition fading and mosaics. Word length. +FadeDirection = $7EC009 ; Word length +FadeLevel = $7EC00B ; Target fade level. Word length. + ; + ; +MosaicLevel = $7EC011 ; Word length. High byte unused + ; +RoomDarkness = $7EC017 ; Darkness level of a room. High byte unused. Word length. + ; SpriteOAM = $7EC025 ; - ; $7EC700 - Tile map buffer for HUD + ; +EN_OWSCR2 = $7EC140 ; $7EC140-$7EC171 Used for caching with entrances. +EN_MAINDESQ = $7EC142 ; Copied from the JP disassembly. +EN_SUBDESQ = $7EC143 ; +EN_BG2VERT = $7EC144 ; +EN_BG2HORZ = $7EC146 ; +EN_POSY = $7EC148 ; +EN_POSX = $7EC14A ; +EN_OWSCR = $7EC14C ; +EN_OWTMAPI = $7EC14E ; +EN_SCROLLATN = $7EC150 ; +EN_SCROLLATW = $7EC152 ; +EN_SCROLLAN = $7EC154 ; +EN_SCROLLBN = $7EC156 ; +EN_SCROLLAS = $7EC158 ; +EN_SCROLLBS = $7EC15A ; +EN_OWTARGN = $7EC15C ; +EN_OWTARGS = $7EC15E ; +EN_OWTARGW = $7EC160 ; +EN_OWTARGE = $7EC162 ; +EN_AA0 = $7EC164 ; +EN_BGSET1 = $7EC165 ; +EN_BGSET2 = $7EC166 ; +EN_SPRSET1 = $7EC167 ; + ; 2 bytes free RAM. +EN_SCRMODYA = $7EC16A ; +EN_SCRMODYB = $7EC16C ; +EN_SCRMODXA = $7EC16E ; +EN_SCRMODXB = $7EC170 ; +PegColor = $7EC172 ; + ; +GameOverSongCache = $7EC227 ; + ; +LastBGSet = $7EC2F8 ; Lists loaded sheets to check for decompression. 4 bytes. + ; +PaletteBufferAux = $7EC300 ; Secondary and main palette buffer. See symbols_wram.asm +PaletteBuffer = $7EC500 ; in the disassembly. +HUDTileMapBuffer = $7EC700 ; HUD tile map buffer. $100 bytes (?) HUDKeyIcon = $7EC726 ; HUDGoalIndicator = $7EC72A ; HUDPrizeIcon = $7EC742 ; @@ -239,7 +437,7 @@ HUDRupees = $7EC750 ; HUDBombCount = $7EC75A ; HUDArrowCount = $7EC760 ; HUDKeyDigits = $7EC764 ; - + ; BigRAM = $7EC900 ; Big buffer of free ram (0x1F00) ;================================================================================ @@ -249,7 +447,7 @@ DecompressionBuffer = $7F0000 ; Decompression Buffer. $2000 bytes. base $7F5000 RedrawFlag: skip 1 ; -skip 2 ; +skip 2 ; Unused HexToDecDigit1: skip 1 ; Space for storing the result of hex to decimal conversion. HexToDecDigit2: skip 1 ; Digits are stored from high to low. HexToDecDigit3: skip 1 ; @@ -381,27 +579,59 @@ endmacro %assertRAM(Scrap0F, $7E000F) %assertRAM(GameMode, $7E0010) %assertRAM(GameSubMode, $7E0011) +%assertRAM(NMIDoneFlag, $7E0012) +%assertRAM(INIDISPQ, $7E0013) +%assertRAM(NMISTRIPES, $7E0014) +%assertRAM(NMICGRAM, $7E0015) +%assertRAM(NMIHUD, $7E0016) +%assertRAM(NMIINCR, $7E0017) +%assertRAM(NMIUP1100, $7E0018) +%assertRAM(UPINCVH, $7E0019) %assertRAM(FrameCounter, $7E001A) %assertRAM(IndoorsFlag, $7E001B) +%assertRAM(MAINDESQ, $7E001C) +%assertRAM(SUBDESQ, $7E001D) +%assertRAM(TMWQ, $7E001E) +%assertRAM(TSWQ, $7E001F) %assertRAM(LinkPosY, $7E0020) %assertRAM(LinkPosX, $7E0022) %assertRAM(LinkPosZ, $7E0024) +%assertRAM(LinkPushDirection, $7E0026) %assertRAM(LinkRecoilY, $7E0027) %assertRAM(LinkRecoilX, $7E0028) %assertRAM(LinkRecoilZ, $7E0029) %assertRAM(LinkDirection, $7E002F) +%assertRAM(LinkAnimationStep, $7E002E) %assertRAM(OAMOffsetY, $7E0044) %assertRAM(OAMOffsetX, $7E0045) +%assertRAM(CapeTimer, $7E004C) %assertRAM(LinkJumping, $7E004D) +%assertRAM(Strafe, $7E0050) +%assertRAM(CapeOn, $7E0055) %assertRAM(BunnyFlagDP, $7E0056) %assertRAM(LinkSlipping, $7E005B) %assertRAM(FallTimer, $7E005C) %assertRAM(LinkState, $7E005D) %assertRAM(LinkSpeed, $7E005E) +%assertRAM(LinkWalkDirection, $7E0067) +%assertRAM(ScrapBuffer72, $7E0072) +%assertRAM(WorldCache, $7E007B) %assertRAM(OverworldIndex, $7E008A) %assertRAM(OverlayID, $7E008C) +%assertRAM(OAMPtr, $7E0090) +%assertRAM(BGMODEQ, $7E0094) +%assertRAM(MOSAICQ, $7E0095) +%assertRAM(W12SELQ, $7E0096) +%assertRAM(W34SELQ, $7E0097) +%assertRAM(WOBJSELQ, $7E0098) +%assertRAM(CGWSELQ, $7E0099) +%assertRAM(CGADSUBQ, $7E009A) +%assertRAM(HDMAENQ, $7E009B) %assertRAM(RoomIndex, $7E00A0) %assertRAM(PreviousRoom, $7E00A2) +%assertRAM(CameraBoundH, $7E00A6) +%assertRAM(CameraBoundV, $7E00A7) +%assertRAM(RoomTag, $7E00AE) %assertRAM(SubSubModule, $7E00B0) %assertRAM(ObjPtr, $7E00B7) %assertRAM(ObjPtrOffset, $7E00BA) @@ -417,10 +647,13 @@ endmacro %assertRAM(BG2V, $7E00E8) %assertRAM(BG3VOFSQL, $7E00EA) %assertRAM(LinkLayer, $7E00EE) +%assertRAM(DeathReloadFlag, $7E010A) %assertRAM(CurrentMSUTrack, $7E010B) %assertRAM(GameModeCache, $7E010C) %assertRAM(GameSubModeCache, $7E010D) +%assertRAM(EntranceIndex, $7E010E) %assertRAM(MedallionFlag, $7E0112) +%assertRAM(VRAMUploadAddress, $7E0118) %assertRAM(BG1ShakeV, $7E011A) %assertRAM(BG1ShakeH, $7E011C) %assertRAM(CurrentVolume, $7E0127) @@ -431,44 +664,144 @@ endmacro %assertRAM(SFX1, $7E012D) %assertRAM(SFX2, $7E012E) %assertRAM(SFX3, $7E012F) +%assertRAM(LastAPUCommand, $7E0130) +%assertRAM(LastSFX1, $7E0131) +%assertRAM(MusicControlQueue, $7E0132) +%assertRAM(CurrentControlRequest, $7E0133) +%assertRAM(LastAPU, $7E0134) %assertRAM(SubModuleInterface, $7E0200) %assertRAM(ItemCursor, $7E0202) %assertRAM(BottleMenuCounter, $7E0205) %assertRAM(MenuBlink, $7E0207) +%assertRAM(RaceGameFlag, $7E021B) +%assertRAM(MessageJunk, $7E0223) %assertRAM(ItemReceiptID, $7E02D8) +%assertRAM(ItemReceiptPose, $7E02DA) %assertRAM(BunnyFlag, $7E02E0) +%assertRAM(Poofing, $7E02E1) +%assertRAM(PoofTimer, $7E02E2) +%assertRAM(SwordCooldown, $7E02E3) %assertRAM(CutsceneFlag, $7E02E4) %assertRAM(ItemReceiptMethod, $7E02E9) %assertRAM(TileActBE, $7E02EF) +%assertRAM(UseY1, $7E0301) %assertRAM(CurrentYItem, $7E0303) +%assertRAM(AButtonAct, $7E0308) +%assertRAM(TileActIce, $7E0348) %assertRAM(TileActDig, $7E035B) +%assertRAM(LinkZap, $7E0360) +%assertRAM(DamageReceived, $7E0373) +%assertRAM(UseY2, $7E037A) +%assertRAM(NoDamage, $7E037B) +%assertRAM(AncillaGeneral, $7E039F) +%assertRAM(AncillaSearch, $7E03C4) %assertRAM(ForceSwordUp, $7E03EF) +%assertRAM(FluteTimer, $7E03F0) +%assertRAM(YButtonOverride, $7E03FC) %assertRAM(ItemsTaken, $7E0403) %assertRAM(DungeonID, $7E040C) +%assertRAM(LayerAdjustment, $7E047A) +%assertRAM(RoomIndexMirror, $7E048E) +%assertRAM(RespawnFlag, $7E04AA) +%assertRAM(Map16ChangeIndex, $7E04AC) %assertRAM(OWEntranceCutscene, $7E04C6) %assertRAM(HeartBeepTimer, $7E04CA) +%assertRAM(CameraScrollN, $7E0618) +%assertRAM(CameraScrollS, $7E061A) +%assertRAM(CameraScrollW, $7E061C) +%assertRAM(CameraScrollE, $7E061E) %assertRAM(NMIAux, $7E0632) +%assertRAM(SpriteRoomTag, $7E0642) +%assertRAM(SomariaSwitchFlag, $7E0646) +%assertRAM(TileMapEntranceDoors, $7E0696) +%assertRAM(TileMapTile32, $7E0698) %assertRAM(SkipOAM, $7E0710) +%assertRAM(OWScreenSize, $7E0712) +%assertRAM(OWTransitionFlag, $7E0ABF) +%assertRAM(TreePullKills, $7E0CFB) +%assertRAM(TreePullHits, $7E0CFC) +%assertRAM(ArcVariable, $7E0B08) +%assertRAM(OverlordXLow, $7E0B08) +%assertRAM(OverlordXHigh, $7E0B10) +%assertRAM(OverlordYLow, $7E0B18) +%assertRAM(OverlordYHigh, $7E0B20) +%assertRAM(EnemyStunTimer, $7E0B58) %assertRAM(BowDryFire, $7E0B9A) %assertRAM(SaveFileIndex, $7E0B9D) +%assertRAM(SpriteAncillaInteract, $7E0BA0) +%assertRAM(AncillaVelocityY, $7E0C22) +%assertRAM(AncillaVelocityX, $7E0C2C) +%assertRAM(AncillaID, $7E0C4A) +%assertRAM(AncillaGet, $7E0C5E) +%assertRAM(SpriteBump, $7E0CD2) %assertRAM(SpritePosYLow, $7E0D00) %assertRAM(SpritePosXLow, $7E0D10) %assertRAM(SpritePosYHigh, $7E0D20) %assertRAM(SpritePosXHigh, $7E0D30) %assertRAM(SpriteVelocityY, $7E0D40) %assertRAM(SpriteVelocityX, $7E0D50) -%assertRAM(SpriteUnknown, $7E0D80) +%assertRAM(SpriteSubPixelY, $7E0D60) +%assertRAM(SpriteSubPixelX, $7E0D70) +%assertRAM(SpriteActivity, $7E0D80) +%assertRAM(SpriteMovement, $7E0D90) %assertRAM(SpriteAuxTable, $7E0DA0) %assertRAM(SpriteGFXControl, $7E0DC0) %assertRAM(SpriteAITable, $7E0DD0) +%assertRAM(SpriteMoveDirection, $7E0DE0) %assertRAM(SpriteTimer, $7E0DF0) %assertRAM(SpriteTypeTable, $7E0E20) +%assertRAM(SpriteAux, $7E0E30) +%assertRAM(SpriteOAMProperties, $7E0E40) +%assertRAM(SpriteHitPoints, $7E0E50) +%assertRAM(SpriteControl, $7E0E60) %assertRAM(SpriteItemType, $7E0E80) +%assertRAM(SpriteSpawnStep, $7E0ED0) %assertRAM(SpriteDirectionTable, $7E0EB0) +%assertRAM(SpriteHalt, $7E0F00) +%assertRAM(SpriteTimerE, $7E0F10) +%assertRAM(SpriteLayer, $7E0F20) +%assertRAM(SpriteOAMProp, $7E0F50) +%assertRAM(EN_OWSCR2, $7EC140) +%assertRAM(EN_MAINDESQ, $7EC142) +%assertRAM(EN_SUBDESQ, $7EC143) +%assertRAM(EN_BG2VERT, $7EC144) +%assertRAM(EN_BG2HORZ, $7EC146) +%assertRAM(EN_POSY, $7EC148) +%assertRAM(EN_POSX, $7EC14A) +%assertRAM(EN_OWSCR, $7EC14C) +%assertRAM(EN_OWTMAPI, $7EC14E) +%assertRAM(EN_SCROLLATN, $7EC150) +%assertRAM(EN_SCROLLATW, $7EC152) +%assertRAM(EN_SCROLLAN, $7EC154) +%assertRAM(EN_SCROLLBN, $7EC156) +%assertRAM(EN_SCROLLAS, $7EC158) +%assertRAM(EN_SCROLLBS, $7EC15A) +%assertRAM(EN_OWTARGN, $7EC15C) +%assertRAM(EN_OWTARGS, $7EC15E) +%assertRAM(EN_OWTARGW, $7EC160) +%assertRAM(EN_OWTARGE, $7EC162) +%assertRAM(EN_AA0, $7EC164) +%assertRAM(EN_BGSET1, $7EC165) +%assertRAM(EN_BGSET2, $7EC166) +%assertRAM(EN_SPRSET1, $7EC167) +%assertRAM(EN_SCRMODYA, $7EC16A) +%assertRAM(EN_SCRMODYB, $7EC16C) +%assertRAM(EN_SCRMODXA, $7EC16E) +%assertRAM(EN_SCRMODXB, $7EC170) +%assertRAM(SpriteZCoord, $7E0F70) +%assertRAM(SpriteVelocityZ, $7E0F80) +%assertRAM(SpriteSubPixelZ, $7E0F90) %assertRAM(FreezeSprites, $7E0FC1) +%assertRAM(PrizePackIndexes, $7E0FC7) %assertRAM(SpriteCoordCacheX, $7E0FD8) %assertRAM(SpriteCoordCacheY, $7E0FDA) %assertRAM(NoMenu, $7E0FFC) +%assertRAM(GFXStripes, $7E1000) +%assertRAM(RoomStripes, $7E1100) +%assertRAM(IrisPtr, $7E1B00) +%assertRAM(MessageSubModule, $7E1CD8) +%assertRAM(MessageCursor, $7E1CE8) +%assertRAM(DelayTimer, $7E1CE9) %assertRAM(TextID, $7E1CF0) %assertRAM(ToastBuffer, $7E1E0E) %assertRAM(MSUResumeTime, $7E1E6B) @@ -487,7 +820,19 @@ endmacro %assertRAM(ScratchBufferNV, $7E1EA0) %assertRAM(ScratchBufferV, $7E1EB0) %assertRAM(TileUploadBuffer, $7EA180) +%assertRAM(RoomFade, $7EC005) +%assertRAM(FadeTimer, $7EC007) +%assertRAM(FadeDirection, $7EC009) +%assertRAM(FadeLevel, $7EC00B) +%assertRAM(MosaicLevel, $7EC011) +%assertRAM(RoomDarkness, $7EC017) %assertRAM(SpriteOAM, $7EC025) +%assertRAM(PegColor, $7EC172) +%assertRAM(GameOverSongCache, $7EC227) +%assertRAM(LastBGSet, $7EC2F8) +%assertRAM(PaletteBufferAux, $7EC300) +%assertRAM(PaletteBuffer, $7EC500) +%assertRAM(HUDTileMapBuffer, $7EC700) %assertRAM(HUDKeyIcon, $7EC726) %assertRAM(HUDGoalIndicator, $7EC72A) %assertRAM(HUDPrizeIcon, $7EC742) diff --git a/shopkeeper.asm b/shopkeeper.asm index 6731ab6..931c9a5 100644 --- a/shopkeeper.asm +++ b/shopkeeper.asm @@ -87,7 +87,7 @@ DrawPrice: TXA : LSR #3 : STA.b Scrap06 ; request 1-4 OAM slots ASL #2 PHA - LDA.b $22 : CMP.l ShopPriceColumn : !BLT .off + LDA.b LinkPosX : CMP.l ShopPriceColumn : !BLT .off CMP.l ShopPriceColumn+1 : !BGE .off .on PLA : JSL.l OAM_AllocateFromRegionB : BRA + ; request 4-16 bytes @@ -205,8 +205,8 @@ SpritePrep_ShopKeeper: LDA.l ShopType : CMP.b #$FF : BNE + PLA : PLA : PLA - INC.w $0BA0, X - LDA.w $0E40, X + INC.w SpriteAncillaInteract, X + LDA.w SpriteOAMProperties, X JML.l ShopkeeperFinishInit + RTL @@ -393,8 +393,8 @@ macro DrawMerchant(head,body,speed) LDA.b #BigRAM>>8 : STA.b Scrap09 LDA.b #$7E : PHA : PLB ; set data bank to $7E JSL.l Sprite_DrawMultiple_quantity_preset - LDA.b $90 : !ADD.b #$04*2 : STA.b $90 ; increment oam pointer - LDA.b $92 : INC #2 : STA.b $92 + LDA.b OAMPtr : !ADD.b #$04*2 : STA.b OAMPtr ; increment oam pointer + LDA.b OAMPtr+2 : INC #2 : STA.b OAMPtr+2 PLB RTS .oam_shopkeeper_f1 @@ -429,8 +429,8 @@ Shopkeeper_DrawMerchant_Type1: LDA.b #.oam_shopkeeper_f2>>8 : STA.b Scrap09 ++ JSL.l Sprite_DrawMultiple_quantity_preset - LDA.b $90 : !ADD.b #$04 : STA.b $90 ; increment oam pointer - LDA.b $92 : INC : STA.b $92 + LDA.b OAMPtr : !ADD.b #$04 : STA.b OAMPtr ; increment oam pointer + LDA.b OAMPtr+2 : INC : STA.b OAMPtr+2 RTS .oam_shopkeeper_f1 dw 0, 0 : db $46, $0A, $00, $02 @@ -453,7 +453,7 @@ Shopkeeper_SetupHitboxes: PLY : BRA .no_interaction + PLY - LDA.w $00EE : CMP.w $0F20, X : BNE .no_interaction + LDA.b LinkLayer : CMP.w SpriteLayer, X : BNE .no_interaction JSR.w Setup_LinksHitbox JSR.w Setup_ShopItemCollisionHitbox @@ -612,11 +612,11 @@ Setup_LinksHitbox: LDA.b #$08 : STA.b Scrap02 STA.b Scrap03 - LDA.b $22 : !ADD.b #$04 : STA.b Scrap00 - LDA.b $23 : ADC.b #$00 : STA.b Scrap08 + LDA.b LinkPosX : !ADD.b #$04 : STA.b Scrap00 + LDA.b LinkPosX+1 : ADC.b #$00 : STA.b Scrap08 - LDA.b $20 : ADC.b #$08 : STA.b Scrap01 - LDA.b $21 : ADC.b #$00 : STA.b Scrap09 + LDA.b LinkPosY : ADC.b #$08 : STA.b Scrap01 + LDA.b LinkPosY+1 : ADC.b #$00 : STA.b Scrap09 RTS ;-------------------------------------------------------------------------------- ; The following is a copy of procedure Sprite_HaltSpecialPlayerMovement (Bank1E.asm line 255) @@ -759,9 +759,9 @@ Shopkeeper_DrawNextPrice: PHX : PHA : LDA.l ShopScratch : TAX : PLA : JSL.l Sprite_DrawMultiple_quantity_preset : PLX LDA.b 1,s - ASL #2 : !ADD $90 : STA.b $90 ; increment oam pointer + ASL #2 : !ADD OAMPtr : STA.b OAMPtr ; increment oam pointer PLA - !ADD $92 : STA.b $92 + !ADD OAMPtr+2 : STA.b OAMPtr+2 .free PLP : PLY : PLX PLB @@ -780,7 +780,7 @@ db #$00, #$60, #$60, #$90, #$90, $FF RequestItemOAM: PHX : PHY : PHA STA.b Scrap06 ; request A OAM slots - LDA.b $20 : CMP.b #$62 : !BGE .below + LDA.b LinkPosY : CMP.b #$62 : !BGE .below .above LDA.b 1,s : ASL #2 : JSL.l OAM_AllocateFromRegionA ; request 4A bytes BRA + @@ -794,8 +794,8 @@ RequestItemOAM: LDA.b #$7E : PHB : PHA : PLB JSL Sprite_DrawMultiple_quantity_preset PLB - LDA.b 1,s : ASL #2 : !ADD $90 : STA.b $90 ; increment oam pointer - LDA.b $92 : !ADD 1,s : STA.b $92 + LDA.b 1,s : ASL #2 : !ADD.b OAMPtr : STA.b OAMPtr ; increment oam pointer + LDA.b OAMPtr+2 : !ADD 1,s : STA.b OAMPtr+2 PLA : PLY : PLX RTS ;-------------------------------------------------------------------------------- diff --git a/spriteswap.asm b/spriteswap.asm index c5e34f8..f122af4 100644 --- a/spriteswap.asm +++ b/spriteswap.asm @@ -64,7 +64,7 @@ SpriteSwap_Palette_ArmorAndGloves: .loop - LDA.b [Scrap00] : STA.l $7EC300, X : STA.l $7EC500, X + LDA.b [Scrap00] : STA.l PaletteBufferAux, X : STA.l PaletteBuffer, X INC.b Scrap00 : INC.b Scrap00 @@ -76,7 +76,7 @@ SpriteSwap_Palette_ArmorAndGloves: PLB - INC $15 + INC.b NMICGRAM PLA : PLY : PLX RTL } diff --git a/stats.asm b/stats.asm index b4405cf..5f68128 100644 --- a/stats.asm +++ b/stats.asm @@ -39,7 +39,7 @@ DungeonHoleEntranceTransition: JSL EnableForceBlank LDA.l SilverArrowsAutoEquip : AND.b #$02 : BEQ + - LDA.w $010E : CMP.b #$7B : BNE + ; skip unless falling to ganon's room + LDA.w EntranceIndex : CMP.b #$7B : BNE + ; skip unless falling to ganon's room LDA.l BowTracking : AND.b #$40 : BEQ + ; skip if we don't have silvers LDA.l BowEquipment : BEQ + ; skip if we have no bow CMP.b #$03 : !BGE + ; skip if the bow is already silver @@ -53,7 +53,7 @@ DungeonStairsTransition: DungeonExitTransition: LDA.l IceModifier : BEQ + ; ice physics JSL Player_HaltDashAttackLong - LDA.b #$00 : STA.w $0301 ; stop item dashing + LDA.b #$00 : STA.w UseY1 ; stop item dashing + LDA.b #$0F : STA.b GameMode ; stop running through the transition StatTransitionCounter: @@ -95,7 +95,7 @@ IncrementSmallKeysNoPrimary: JSL.l UpdateKeys LDA.b IndoorsFlag : BEQ + ; skip room check if outdoors PHP : REP #$20 ; set 16-bit accumulator - LDA.w $048E : CMP.w #$0087 : BNE ++ ; hera basement + LDA.b RoomIndex : CMP.w #$0087 : BNE ++ ; hera basement PLP : PHY : LDY.b #$24 : JSL.l FullInventoryExternal JSR CountChestKey : PLY : BRA + ++ @@ -235,7 +235,7 @@ IncrementDamageTakenCounter_Arb: PHP LDA.l StatsLocked : BNE + REP #$21 - LDA.b $00 + LDA.b Scrap00 AND.w #$00FF ADC.l DamageCounter BCC ++ @@ -253,7 +253,7 @@ IncrementMagicUseCounterByrna: PHA : PHP LDA.l StatsLocked : BNE + REP #$21 - LDA.b $00 + LDA.b Scrap00 AND.w #$00FF ADC.l MagicCounter BCC ++ @@ -277,7 +277,7 @@ IncrementMagicUseCounterOne: ;-------------------------------------------------------------------------------- IncrementOWMirror: PHA - LDA.b #$08 : STA.w $021B ; fail race game + LDA.b #$08 : STA.w RaceGameFlag ; fail race game LDA.l StatsLocked : BNE + LDA.l CurrentWorld : BEQ + ; only do this for DW->LW LDA.l OverworldMirrors : INC : STA.l OverworldMirrors @@ -287,7 +287,7 @@ JMP StatTransitionCounter ;-------------------------------------------------------------------------------- IncrementUWMirror: PHA - LDA.b #$00 : STA.l $7F5035 ; bandaid patch bug with mirroring away from text + LDA.b #$00 : STA.l AltTextFlag ; bandaid patch bug with mirroring away from text LDA.l StatsLocked : BNE + LDA.w DungeonID : CMP.b #$FF : BEQ + ; skip if we're in a cave or house LDA.l UnderworldMirrors : INC : STA.l UnderworldMirrors @@ -316,8 +316,8 @@ JMP StatTransitionCounter ;-------------------------------------------------------------------------------- IndoorSubtileTransitionCounter: LDA.b #$01 : STA.l RedrawFlag ; set redraw flag for items - STZ.w $0646 ; stuff we wrote over - STZ.w $0642 + STZ.w SomariaSwitchFlag ; stuff we wrote over + STZ.w SpriteRoomTag JMP StatTransitionCounter ;-------------------------------------------------------------------------------- StatsFinalPrep: diff --git a/stats/main.asm b/stats/main.asm index 5d7da64..9142def 100755 --- a/stats/main.asm +++ b/stats/main.asm @@ -610,14 +610,14 @@ EndingItems: REP #$10 JSR DrawEndingItems REP #$20 - LDX.b #$0e + LDX.b #$0E RTL DrawEndingItems: JSL DrawPlayerFile_credits JSL SetItemLayoutPriority SEP #$30 - LDA.b #$01 : STA.b $14 + LDA.b #$01 : STA.b NMISTRIPES RTS FontTable: diff --git a/swordswap.asm b/swordswap.asm index bdc315c..a977fad 100644 --- a/swordswap.asm +++ b/swordswap.asm @@ -69,16 +69,16 @@ LoadModifiedIceFloorValue_a11: LDA.b LinkState : CMP.b #$01 : BEQ + : CMP.b #$17 : BEQ + : CMP.b #$1C : BEQ + LDA.b LinkSpeed : CMP.b #$02 : BEQ + LDA.b LinkSlipping : BNE + - LDA.w $0348 : ORA.l IceModifier : AND.b #$11 : RTL - + : LDA.w $0348 : AND.b #$11 + LDA.w TileActIce : ORA.l IceModifier : AND.b #$11 : RTL + + : LDA.w TileActIce : AND.b #$11 RTL LoadModifiedIceFloorValue_a01: LDA.b RoomIndex : CMP.b #$91 : BEQ + : CMP.b #$92 : BEQ + : CMP.b #$93 : BEQ + ; mire basement currently broken - not sure why LDA.b LinkState : CMP.b #$01 : BEQ + : CMP.b #$17 : BEQ + : CMP.b #$1C : BEQ + LDA.b LinkSpeed : CMP.b #$02 : BEQ + LDA.b LinkSlipping : BNE + - LDA.w $0348 : ORA.l IceModifier : AND.b #$01 : RTL - + : LDA.w $0348 : AND.b #$01 + LDA.w TileActIce : ORA.l IceModifier : AND.b #$01 : RTL + + : LDA.w TileActIce : AND.b #$01 RTL ;================================================================================ CheckTabletSword: @@ -116,7 +116,7 @@ GetSmithSword: LDA.b #$7A LDY.b #$01 JSL.l Sprite_ShowMessageUnconditional - LDA.b #$3C : STA.w $012E ; error sound + LDA.b #$3C : STA.w SFX2 ; error sound SEP #$10 BRA .done diff --git a/tables.asm b/tables.asm index aa2a38a..8fbc02b 100644 --- a/tables.asm +++ b/tables.asm @@ -114,13 +114,11 @@ org $308036 ; PC 0x180036 - 0x180037 RupoorDeduction: dw #$000A ; #$0A - Default (10 decimal) ;-------------------------------------------------------------------------------- -org $308038 ; PC 0x180038 -0x18003A +org $308038 ; PC 0x180038 LampConeSewers: db #$01 ; #$00 = Off - #$01 = On (default) -LampConeLightWorld: -db #$01 ; #$00 = Off (default) - #$01 = On -LampConeDarkWorld: -db #$00 ; #$00 = Off (default) - #$01 = On +;-------------------------------------------------------------------------------- +; 0x180039 - 0x18003A (Unused) ;-------------------------------------------------------------------------------- org $30803B ; PC 0x18003B - PC 0x18003C MapMode: diff --git a/tablets.asm b/tablets.asm index 2a088ee..818d3c8 100644 --- a/tablets.asm +++ b/tablets.asm @@ -3,11 +3,11 @@ ;-------------------------------------------------------------------------------- ItemSet_EtherTablet: PHA : LDA.l NpcFlags+1 : ORA.b #$01 : STA.l NpcFlags+1 : PLA -RTL +RTS ;-------------------------------------------------------------------------------- ItemSet_BombosTablet: PHA : LDA.l NpcFlags+1 : ORA.b #$02 : STA.l NpcFlags+1 : PLA -RTL +RTS ;-------------------------------------------------------------------------------- ItemCheck_EtherTablet: LDA.l NpcFlags+1 : AND.b #$01 @@ -17,24 +17,23 @@ ItemCheck_BombosTablet: LDA.l NpcFlags+1 : AND.b #$02 RTL ;-------------------------------------------------------------------------------- -SetTabletItem: - JSL.l GetSpriteID - PHA - LDA.b OverworldIndex : CMP.b #$03 : BEQ .ether ; if we're on the map where ether is, we're the ether tablet - .bombos - JSL.l ItemSet_BombosTablet : BRA .done - .ether - JSL.l ItemSet_EtherTablet - .done - PLA -RTL +SetTabletItemFlag: + PHA + LDA.b OverworldIndex : CMP.b #$03 : BEQ .ether ; if we're on the map where ether is, we're the ether tablet + .bombos + JSR ItemSet_BombosTablet : BRA .done + .ether + JSR ItemSet_EtherTablet + .done + PLA +RTS ;-------------------------------------------------------------------------------- SpawnTabletItem: JSL.l LoadOutdoorValue PHA JSL.l PrepDynamicTile - JSL.l SetTabletItem + JSL.l GetSpriteID LDA.b #$EB STA.l MiniGameTime @@ -47,14 +46,15 @@ SpawnTabletItem: LDA.b LinkPosY : STA.w SpritePosYLow, Y LDA.b LinkPosY+1 : STA.w SpritePosYHigh, Y - LDA.b #$00 : STA.w $0F20, Y + LDA.b #$00 : STA.w SpriteLayer, Y - LDA.b #$7F : STA.w $0F70, Y ; spawn WAY up high + LDA.b #$7F : STA.w SpriteZCoord, Y ; spawn WAY up high RTL ;-------------------------------------------------------------------------------- MaybeUnlockTabletAnimation: PHA : PHP JSL.l IsMedallion : BCC + + JSR SetTabletItemFlag STZ.w MedallionFlag ; disable falling-medallion mode STZ.w ForceSwordUp ; release link from item-up pose LDA.b #$00 : STA.b LinkState ; set link to ground state @@ -95,38 +95,18 @@ LoadNarrowObject: LDA.l AddReceivedItemExpanded_wide_item_flag, X : STA.b ($92), Y ; AddReceiveItem.wide_item_flag? RTL ;-------------------------------------------------------------------------------- -DrawNarrowDroppedObject: - ; If it's a 16x16 sprite, we'll only draw one, otherwise we'll end up drawing - ; two 8x8 sprites stack on top of each other - CMP.b #$02 : BEQ .large_sprite - - REP #$20 - - ; Shift Y coordinate 8 pixels down - LDA.b Scrap08 : STA.b Scrap00 - - SEP #$20 - - JSL.l Ancilla_SetOam_XY_Long - - ; always use the same character graphic (0x34) - LDA.b #$34 : STA.b ($90), Y : INY - - LDA.l AddReceivedItemExpanded_properties, X : BPL .valid_lower_properties - - LDA.b $74 - -.valid_lower_properties - - ASL A : ORA.b #$30 : STA.b ($90), Y - - INY : PHY - - TYA : !SUB.b #$04 : LSR #2 : TAY - - LDA.b #$00 : STA.b ($92), Y - - PLY -.large_sprite -RTL +CheckTabletItem: ;-------------------------------------------------------------------------------- +; Zero flag set = Item not collected +; Zero flag clear = Item collected +;-------------------------------------------------------------------------------- + JSL.l IsMedallion : BCS .tablet + LDA.l OverworldEventDataWRAM, X : AND.b #$40 ; What we wrote over + RTL + .tablet + LDA.b OverworldIndex : CMP.b #$03 : BEQ .ether + LDA.l NpcFlags+1 : AND.b #$02 : BNE .done + .ether + LDA.l NpcFlags+1 : AND.b #$01 + .done +RTL diff --git a/timer.asm b/timer.asm index d2bc2ba..3139ca1 100644 --- a/timer.asm +++ b/timer.asm @@ -111,51 +111,51 @@ dw #$FFFF, #$7FFF ;-------------------------------------------------------------------------------- DrawChallengeTimer: LDA.l OHKOFlag : AND.w #$00FF : BEQ + - LDA.w #$2807 : STA.l $7EC790 - LDA.w #$280A : STA.l $7EC792 - LDA.w #$280B : STA.l $7EC794 - LDA.w #$280C : STA.l $7EC796 + LDA.w #$2807 : STA.l HUDTileMapBuffer+$90 + LDA.w #$280A : STA.l HUDTileMapBuffer+$92 + LDA.w #$280B : STA.l HUDTileMapBuffer+$94 + LDA.w #$280C : STA.l HUDTileMapBuffer+$96 RTL + - LDA.w #$247F : STA.l $7EC790 - STA.l $7EC792 - STA.l $7EC794 - STA.l $7EC796 + LDA.w #$247F : STA.l HUDTileMapBuffer+$90 + STA.l HUDTileMapBuffer+$92 + STA.l HUDTileMapBuffer+$94 + STA.l HUDTileMapBuffer+$96 ++ LDA.l TimerStyle : BNE + : RTL : + ; Hud Timer - LDA.w #$2807 : STA.l $7EC792 + LDA.w #$2807 : STA.l HUDTileMapBuffer+$92 LDA.l ClockStatus : AND.w #$0002 : BEQ + ; DNF / OKHO LDA.l TimeoutBehavior : AND.w #$00FF : BNE ++ ; DNF - LDA.w #$2808 : STA.l $7EC794 - LDA.w #$2809 : STA.l $7EC796 - LDA.w #$247F : STA.l $7EC798 - STA.l $7EC79A + LDA.w #$2808 : STA.l HUDTileMapBuffer+$94 + LDA.w #$2809 : STA.l HUDTileMapBuffer+$96 + LDA.w #$247F : STA.l HUDTileMapBuffer+$98 + STA.l HUDTileMapBuffer+$9A BRA +++ ++ ; OHKO - LDA.w #$280A : STA.l $7EC794 - LDA.w #$280B : STA.l $7EC796 - LDA.w #$280C : STA.l $7EC798 - LDA.w #$247F : STA.l $7EC79A + LDA.w #$280A : STA.l HUDTileMapBuffer+$94 + LDA.w #$280B : STA.l HUDTileMapBuffer+$96 + LDA.w #$280C : STA.l HUDTileMapBuffer+$98 + LDA.w #$247F : STA.l HUDTileMapBuffer+$9A +++ - STA.l $7EC79C - STA.l $7EC79E - STA.l $7EC7A0 - STA.l $7EC7A2 - STA.l $7EC7A4 + STA.l HUDTileMapBuffer+$9C + STA.l HUDTileMapBuffer+$9E + STA.l HUDTileMapBuffer+$A0 + STA.l HUDTileMapBuffer+$A2 + STA.l HUDTileMapBuffer+$A4 LDA.l TimerRestart : BNE +++ : RTL : +++ BRA ++ + ; Show Timer - LDA.l ClockStatus : AND.w #$0001 : !ADD.w #$2804 : STA.l $7EC794 - LDA.w ClockHours+2 : STA.l $7EC796 - LDA.w ClockHours : STA.l $7EC798 - LDA.w #$2806 : STA.l $7EC79A - LDA.w ClockMinutes+2 : STA.l $7EC79C - LDA.w ClockMinutes : STA.l $7EC79E - LDA.w #$2806 : STA.l $7EC7A0 - LDA.w ClockSeconds+2 : STA.l $7EC7A2 - LDA.w ClockSeconds : STA.l $7EC7A4 + LDA.l ClockStatus : AND.w #$0001 : !ADD.w #$2804 : STA.l HUDTileMapBuffer+$94 + LDA.w ClockHours+2 : STA.l HUDTileMapBuffer+$96 + LDA.w ClockHours : STA.l HUDTileMapBuffer+$98 + LDA.w #$2806 : STA.l HUDTileMapBuffer+$9A + LDA.w ClockMinutes+2 : STA.l HUDTileMapBuffer+$9C + LDA.w ClockMinutes : STA.l HUDTileMapBuffer+$9E + LDA.w #$2806 : STA.l HUDTileMapBuffer+$A0 + LDA.w ClockSeconds+2 : STA.l HUDTileMapBuffer+$A2 + LDA.w ClockSeconds : STA.l HUDTileMapBuffer+$A4 ++ LDA.b FrameCounter : AND.w #$001F : BNE + : JSR CalculateTimer : + diff --git a/utilities.asm b/utilities.asm index eac5297..82f1076 100644 --- a/utilities.asm +++ b/utilities.asm @@ -447,8 +447,8 @@ DrawDynamicTile: LDA.b #$00 : STA.l SpriteSkipEOR PLB - LDA.b $90 : !ADD.b #$08 : STA.b $90 ; leave the pointer in the right spot to draw the shadow, if desired - LDA.b $92 : INC #2 : STA.b $92 + LDA.b OAMPtr : !ADD.b #$08 : STA.b OAMPtr ; leave the pointer in the right spot to draw the shadow, if desired + LDA.b OAMPtr+2 : INC #2 : STA.b OAMPtr+2 PLA RTL ;-------------------------------------------------------------------------------- @@ -465,8 +465,8 @@ DrawDynamicTileNoShadow: LDA.b #$08 : JSL.l OAM_AllocateFromRegionC .draw - LDA.b #SpriteOAM>>0 : STA.b Scrap06 - LDA.b #SpriteOAM>>8 : STA.b Scrap06 + LDA.b #SpriteOAM>>0 : STA.b Scrap08 + LDA.b #SpriteOAM>>8 : STA.b Scrap09 STZ.b Scrap07 LDA.b #$7E : PHB : PHA : PLB LDA.b #$01 : STA.l SpriteSkipEOR @@ -474,8 +474,8 @@ DrawDynamicTileNoShadow: LDA.l Bob : BNE + : LDA.b #$00 : STA.l SpriteSkipEOR : + ; Bob fix is conditional PLB - LDA.b $90 : !ADD.b #$08 : STA.b $90 - LDA.b $92 : INC #2 : STA.b $92 + LDA.b OAMPtr : !ADD.b #$08 : STA.b OAMPtr + LDA.b OAMPtr+2 : INC #2 : STA.b OAMPtr+2 RTL ;-------------------------------------------------------------------------------- @@ -501,30 +501,30 @@ RTL ; out: Carry - 1 = On Screen, 0 = Off Screen ;-------------------------------------------------------------------------------- Sprite_IsOnscreen: - JSR _Sprite_IsOnscreen_DoWork - BCS + - REP #$20 - LDA.b BG2H : PHA : !SUB.w #$0F : STA.b BG2H - LDA.b BG2V : PHA : !SUB.w #$0F : STA.b BG2V - SEP #$20 - JSR _Sprite_IsOnscreen_DoWork - REP #$20 - PLA : STA.b BG2V - PLA : STA.b BG2H - SEP #$20 - + + JSR _Sprite_IsOnscreen_DoWork + BCS + + REP #$20 + LDA.b BG2H : PHA : !SUB.w #$0F : STA.b BG2H + LDA.b BG2V : PHA : !SUB.w #$0F : STA.b BG2V + SEP #$20 + JSR _Sprite_IsOnscreen_DoWork + REP #$20 + PLA : STA.b BG2V + PLA : STA.b BG2H + SEP #$20 + + RTL _Sprite_IsOnscreen_DoWork: - LDA.w SpritePosXLow, X : CMP.b BG2H - LDA.w SpritePosXHigh, X : SBC.b $E3 : BNE .offscreen + LDA.w SpritePosXLow, X : CMP.b BG2H + LDA.w SpritePosXHigh, X : SBC.b BG2H+1 : BNE .offscreen - LDA.w SpritePosYLow, X : CMP.b BG2V - LDA.w SpritePosYHigh, X : SBC.b $E9 : BNE .offscreen - SEC + LDA.w SpritePosYLow, X : CMP.b BG2V + LDA.w SpritePosYHigh, X : SBC.b BG2V+1 : BNE .offscreen + SEC RTS - .offscreen - CLC + .offscreen + CLC RTS ;-------------------------------------------------------------------------------- @@ -667,14 +667,14 @@ db #00, #01, #01, #02, #01, #02, #02, #03, #01, #02, #02, #03, #02, #03, #03, #0 ;-------------------------------------------------------------------------------- WriteVRAMStripe: PHX - LDX $1000 ; get pointer - AND.w #$7F : STA.w $1002, X : INX #2 ; set destination - PLA : ASL : AND.w #$7FFF : ORA.w #$7000 : STA.w $1002, X : INX #2 ; set length and enable RLE - TYA : STA.w $1002, X : INX #2 ; set tile + LDX.w GFXStripes ; get pointer + AND.w #$7F : STA.w GFXStripes+2, X : INX #2 ; set destination + PLA : ASL : AND.w #$7FFF : ORA.w #$7000 : STA.w GFXStripes+2, X : INX #2 ; set length and enable RLE + TYA : STA.w GFXStripes+2, X : INX #2 ; set tile SEP #$20 ; set 8-bit accumulator - LDA.b #$FF : STA.w $1002, X - STX.w $1000 - LDA.b #01 : STA.b $14 + LDA.b #$FF : STA.w GFXStripes+2, X + STX.w GFXStripes + LDA.b #01 : STA.b NMISTRIPES REP #$20 ; set 16-bit accumulator RTL ;-------------------------------------------------------------------------------- @@ -687,9 +687,9 @@ RTL ;-------------------------------------------------------------------------------- WriteVRAMBlock: PHX - LDX.w $1000 ; get pointer - AND.w #$7F : STA.w $1002, X : INX #2 ; set destination - PLA : ASL : AND.w #$3FFF : STA.w $1002, X : INX #2 ; set length + LDX.w GFXStripes ; get pointer + AND.w #$7F : STA.w GFXStripes+2, X : INX #2 ; set destination + PLA : ASL : AND.w #$3FFF : STA.w GFXStripes+2, X : INX #2 ; set length PHX TYX ; set X to source @@ -703,9 +703,9 @@ WriteVRAMBlock: PLX : TAX ; pull and promptly ignore, copying the value we just got over it SEP #$20 ; set 8-bit accumulator - LDA.b #$FF : STA.w $1002, X - STX.w $1000 - LDA.b #01 : STA.w $14 + LDA.b #$FF : STA.w GFXStripes+$02, X + STX.w GFXStripes + LDA.b #01 : STA.w NMISTRIPES REP #$20 ; set 16-bit accumulator RTL ;-------------------------------------------------------------------------------- diff --git a/zoraking.asm b/zoraking.asm index a2b309b..e3f44c3 100644 --- a/zoraking.asm +++ b/zoraking.asm @@ -6,7 +6,7 @@ LoadZoraKingItemGFX: JML.l PrepDynamicTile ;-------------------------------------------------------------------------------- JumpToSplashItemTarget: - LDA.w $0D90, X + LDA.w SpriteMovement, X CMP.b #$FF : BNE + : JML.l SplashItem_SpawnSplash : + CMP.b #$00 : JML.l SplashItem_SpawnOther ;--------------------------------------------------------------------------------