From 788cceaab9467b338328c06e2c5be20e4603d433 Mon Sep 17 00:00:00 2001 From: cassidoxa Date: Wed, 16 Nov 2022 21:38:28 -0500 Subject: [PATCH] Continue labeling and documentation in ram.asm, main rando block Deleted several unused modules and some commented code Reorganized some routines to clean up modules Moved some memory into mirrored WRAM Refactored NMI hook aux routine Removed old fake flipper fix --- LTTP_RND_GeneralBugfixes.asm | 9 +- bookofmudora.asm | 4 +- bugfixes.asm | 47 ++-- clock.asm | 248 ------------------- compression.asm | 2 +- contrib.asm | 182 -------------- controllerjank.asm | 2 +- crypto.asm | 80 ------ darkroomitems.asm | 16 +- darkworldspawn.asm | 14 +- decryption.asm | 2 +- dialog.asm | 108 ++++++++- doorframefixes.asm | 18 +- dungeondrops.asm | 6 +- endingsequence.asm | 4 +- enemy_adjustments.asm | 26 +- entrances.asm | 77 +++--- events.asm | 35 ++- fairyfixes.asm | 57 +++-- fileselect.asm | 20 +- firebarlayer.asm | 8 - flipperkill.asm | 58 +---- floodgatesoftlock.asm | 18 +- flute.asm | 54 ++--- framehook.asm | 19 +- glitched.asm | 30 +-- goalitem.asm | 4 +- halfmagicbat.asm | 6 +- hardmode.asm | 10 +- heartbeep.asm | 8 +- heartpieces.asm | 75 ++---- hooks.asm | 459 ++++++++++------------------------- init.asm | 36 +-- inventory.asm | 4 +- invertedstatic.asm | 6 +- lampmantlecone.asm | 2 +- maidencrystals.asm | 21 +- mantle.asm | 10 +- medallions.asm | 24 +- msu.asm | 100 ++++---- music.asm | 124 ++++------ npcitems.asm | 83 +++---- pendantcrystalhud.asm | 129 +++++----- playername.asm | 12 +- potions.asm | 4 +- quickswap.asm | 22 +- ram.asm | 302 +++++++++++------------ retro.asm | 2 +- rngfixes.asm | 2 +- roomloading.asm | 12 +- rupeelimit.asm | 20 -- sandbox.asm | 363 --------------------------- scratchpad.asm | 0 servicerequest.asm | 8 +- shopkeeper.asm | 10 +- sram.asm | 19 +- stats.asm | 6 +- stats/statConfig.asm | 2 +- swordswap.asm | 8 +- tables.asm | 4 +- tablets.asm | 5 +- textrenderer.asm | 6 +- treekid.asm | 2 +- utilities.asm | 20 +- vanillalabels.asm | 3 + zoraking.asm | 4 +- zsnes.asm | 8 +- 67 files changed, 962 insertions(+), 2127 deletions(-) delete mode 100644 clock.asm delete mode 100644 contrib.asm delete mode 100644 firebarlayer.asm delete mode 100644 rupeelimit.asm delete mode 100644 sandbox.asm delete mode 100644 scratchpad.asm diff --git a/LTTP_RND_GeneralBugfixes.asm b/LTTP_RND_GeneralBugfixes.asm index 6724bb6..32cb0b9 100644 --- a/LTTP_RND_GeneralBugfixes.asm +++ b/LTTP_RND_GeneralBugfixes.asm @@ -90,10 +90,8 @@ incsrc halfmagicbat.asm incsrc mantle.asm incsrc swordswap.asm incsrc stats.asm -incsrc scratchpad.asm incsrc dialog.asm incsrc entrances.asm -incsrc clock.asm incsrc accessibility.asm incsrc heartbeep.asm incsrc capacityupgrades.asm @@ -102,7 +100,6 @@ incsrc doorframefixes.asm incsrc music.asm incsrc roomloading.asm incsrc icepalacegraphics.asm -incsrc firebarlayer.asm warnpc $A18000 org $1C8000 ; text tables for translation @@ -169,9 +166,7 @@ if !FEATURE_NEW_TEXT endif warnpc $A58000 -;org $228000 ; contrib area -org $A28000 ; contrib area -incsrc contrib.asm +org $A28000 org $A38000 incsrc stats/main.asm @@ -287,7 +282,7 @@ warnpc $B08000 ;Bank Map ;$20 Code Bank ;$21 Reserved (Frame Hook & Init) -;$22 Contrib Code +;$22 Unused ;$23 Stats & Credits ;$24 Code Bank ;$29 External hooks (rest of bank not used) diff --git a/bookofmudora.asm b/bookofmudora.asm index f98df58..0c5954c 100644 --- a/bookofmudora.asm +++ b/bookofmudora.asm @@ -9,7 +9,7 @@ RTL ;-------------------------------------------------------------------------------- DrawLibraryItemGFX: PHA - LDA $0E80, X ; Retrieve stored item type + LDA.w $0E80, X ; Retrieve stored item type JSL.l DrawDynamicTile PLA RTL @@ -61,7 +61,7 @@ RTL RTL ;-------------------------------------------------------------------------------- LoadBonkItem: - LDA.b $A0 ; check room ID - only bonk keys in 2 rooms so we're just checking the lower byte + LDA.b RoomIndex ; check room ID - only bonk keys in 2 rooms so we're just checking the lower byte CMP.b #115 : BNE + ; Desert Bonk Key LDA.l BonkKey_Desert BRA ++ diff --git a/bugfixes.asm b/bugfixes.asm index 0226f39..7a6e912 100644 --- a/bugfixes.asm +++ b/bugfixes.asm @@ -46,9 +46,9 @@ RTL DecideIfBunnyByScreenIndex: ; If indoors we don't have a screen index. Return non-bunny to make mirror-based ; superbunny work - LDA $1B : BNE .done - LDA MoonPearlEquipment : BNE .done - LDA $8A : AND.b #$40 : PHA + LDA.b $1B : BNE .done + LDA.l MoonPearlEquipment : BNE .done + LDA.b $8A : AND.b #$40 : PHA LDA.l InvertedMode : BNE .inverted .normal PLA : EOR #$40 @@ -57,21 +57,12 @@ DecideIfBunnyByScreenIndex: PLA .done RTL -;-------------------------------------------------------------------------------- - -;-------------------------------------------------------------------------------- -;ReadInventoryPond: -; CPX.b #$1B : BNE + : LDA.b #$01 : RTL : + -; LDA EquipmentWRAM, X -;RTL -;-------------------------------------------------------------------------------- - ;-------------------------------------------------------------------------------- FixBunnyOnExitToLightWorld: LDA.w $02E0 : BEQ + JSL.l DecideIfBunny : BEQ + - STZ $5D ; set player mode to Normal - STZ $02E0 : STZ $56 ; return player graphics to normal + STZ.b $5D ; set player mode to Normal + STZ.w $02E0 : STZ.b $56 ; return player graphics to normal + RTS ;-------------------------------------------------------------------------------- @@ -82,10 +73,10 @@ RTS FixAga2Bunny: LDA.l FixFakeWorld : BEQ + ; Only use this fix is fakeworld fix is in use LDA.l InvertedMode : BEQ +++ - LDA.b #$00 : STA CurrentWorld ; Switch to light world + LDA.b #$00 : STA.l CurrentWorld ; Switch to light world BRA ++ +++ - LDA.b #$40 : STA CurrentWorld ; Switch to dark world + LDA.b #$40 : STA.l CurrentWorld ; Switch to dark world ++ JSL DecideIfBunny : BNE + JSR MakeBunny @@ -100,8 +91,8 @@ RTL ;-------------------------------------------------------------------------------- MakeBunny: PHX : PHY - LDA.b #$17 : STA $5D ; set player mode to permabunny - LDA.b #$01 : STA $02E0 : STA $56 ; make player look like bunny + LDA.b #$17 : STA.b $5D ; set player mode to permabunny + LDA.b #$01 : STA.w $02E0 : STA.b $56 ; make player look like bunny JSL LoadGearPalettes_bunny PLY : PLX RTS @@ -172,8 +163,8 @@ CMP.w #$070E : BEQ .new ; opening overworld map .original - LDA.b [Scrap00] - STA $7EC300, X - STA $7EC500, X + STA.l $7EC300, X + STA.l $7EC500, X INC.b Scrap00 : INC.b Scrap00 INX #2 DEY @@ -182,7 +173,7 @@ RTL .new - LDA.b [Scrap00] - STA $7EC500, X + STA.l $7EC500, X INC.b Scrap00 : INC.b Scrap00 INX #2 DEY @@ -192,10 +183,10 @@ RTL ;-------------------------------------------------------------------------------- ; Fix pedestal pull overlay PedestalPullOverlayFix: -LDA.b #$09 : STA $039F, X ; the thing we wrote over -LDA $1B : BNE + - LDA $8A : CMP.b #$80 : BNE + - LDA $8C : CMP.b #$97 +LDA.b #$09 : STA.w $039F, X ; the thing we wrote over +LDA.b $1B : BNE + + LDA.b $8A : CMP.b #$80 : BNE + + LDA.b $8C : CMP.b #$97 + RTL @@ -221,7 +212,7 @@ pushpc pullpc ;-------------------------------------------------------------------------------- SetOverworldTransitionFlags: - LDA #$01 - STA $0ABF ; used by witch - STA $021B ; used by race game + LDA.b #$01 + STA.w $0ABF ; used by witch + STA.w $021B ; used by race game RTL diff --git a/clock.asm b/clock.asm deleted file mode 100644 index 1f95a86..0000000 --- a/clock.asm +++ /dev/null @@ -1,248 +0,0 @@ -;-------------------------------------------------------------------------------- -; http://problemkaputt.de/fullsnes.htm -; 2800h-2801h S-RTC Real Time Clock I/O Ports -; cartridge type change from #$02 to #$55 to enable S-RTC -; SNES Cart S-RTC (Realtime Clock) (1 game) -; -; PCB "SHVC-LJ3R-01" with 24pin "Sharp S-RTC" chip. Used only by one japanese game: -; Dai Kaiju Monogatari 2 (1996) Birthday/Hudson Soft (JP) -; -; S-RTC I/O Ports -; 002800h S-RTC Read (R) -; 002801h S-RTC Write (W) -; Both registers are 4bits wide. When writing: Upper 4bit should be zero. When reading: Upper 4bit should be masked-off (they do possibly contain garbage, eg. open-bus). -; -; S-RTC Communication -; The sequence for setting, and then reading the time is: -; Send <0Eh,04h,0Dh,0Eh,00h,Timestamp(12 digits),0Dh> to [002801h] -; If ([002800h] AND 0F)=0Fh then read -; If ([002800h] AND 0F)=0Fh then read -; If ([002800h] AND 0F)=0Fh then read -; If ([002800h] AND 0F)=0Fh then read -; etc. -; The exact meaning of the bytes is unknown. 0Eh/0Dh seems to invoke/terminate commands, 04h might be some configuration stuff (like setting 24-hour mode). 00h is apparently the set-time command. There might be further commands (such like setting interrupts, alarm, 12-hour mode, reading battery low & error flags, etc.). When reading, 0Fh seems to indicate sth like "time available". -; The 12/13-digit "SSMMHHDDMYYY(D)" Timestamps are having the following format: -; Seconds.lo (BCD, 0..9) -; Seconds.hi (BCD, 0..5) -; Minutes.lo (BCD, 0..9) -; Minutes.hi (BCD, 0..5) -; Hours.lo (BCD, 0..9) -; Hours.hi (BCD, 0..2) -; Day.lo (BCD, 0..9) -; Day.hi (BCD, 0..3) -; Month (HEX, 01h..0Ch) -; Year.lo (BCD, 0..9) -; Year.hi (BCD, 0..9) -; Century (HEX, 09h..0Ah for 19xx..20xx) -; When READING the time, there is one final extra digit (the existing software doesn't transmit that extra digit on WRITING, though maybe it's possible to do writing, too): -; Day of Week? (0..6) (unknown if RTC assigns sth like 0=Sunday or 0=Monday) -;-------------------------------------------------------------------------------- - -;-------------------------------------------------------------------------------- -macro A_x10() - ASL #1 : PHA - ASL #2 : !ADD 1,s - STA 1,s : PLA -endmacro -;-------------------------------------------------------------------------------- -macro A_x24() - ASL #3 : PHA - ASL #1 : !ADD 1,s - STA 1,s : PLA -endmacro -;-------------------------------------------------------------------------------- -macro A_x60() - ASL #2 : PHA - ASL #4 : !SUB 1,s - STA 1,s : PLA -endmacro -;-------------------------------------------------------------------------------- -macro Clock_ReadBCD() - LDA $002800 : PHA - LDA $002800 : %A_x10() : !ADD 1,s - STA 1,s : PLA -endmacro -;-------------------------------------------------------------------------------- - -Clock_Test: - JSL.l Clock_Init - JML.l Clock_IsSupported - -;-------------------------------------------------------------------------------- -; Clock_Init -;-------------------------------------------------------------------------------- -Clock_Init: - LDA.b #$0E : STA $002801 - LDA.b #$04 : STA $002801 - LDA.b #$0D : STA $002801 - LDA.b #$0E : STA $002801 - LDA.b #$00 : STA $002801 - - LDA.b #$00 : STA $002801 - LDA.b #$00 : STA $002801 - LDA.b #$00 : STA $002801 - LDA.b #$00 : STA $002801 - LDA.b #$00 : STA $002801 - LDA.b #$00 : STA $002801 - LDA.b #$01 : STA $002801 - LDA.b #$00 : STA $002801 - LDA.b #$01 : STA $002801 - LDA.b #$00 : STA $002801 - LDA.b #$00 : STA $002801 - LDA.b #$0A : STA $002801 - - LDA.b #$0D : STA $002801 -RTL -;-------------------------------------------------------------------------------- - -;-------------------------------------------------------------------------------- -; Clock_IsSupported -;-------------------------------------------------------------------------------- -; Input: None (8-bit accumulator) -;-------------------------------------------------------------------------------- -; Output: -; Carry - unset if unsupported, set if supported -; Zero - Undefined -;-------------------------------------------------------------------------------- -; Side Effects: -; S-RTC is ready for reading upon exit if supported -;-------------------------------------------------------------------------------- -Clock_IsSupported: - PHA : PHX - LDX #$00; - - - LDA $002800 : AND.b #$0F : CMP #$0F : BEQ .done ; check for clock chip ready signal - CPX.b #$0E : BCC ++ : CLC : BRA .done ; if we've read 14 bytes with no success, unset carry and exit - ++ INX - BRA - - .done - PLX : PLA -RTL -;-------------------------------------------------------------------------------- - -;-------------------------------------------------------------------------------- -; Clock_QuickStamp -;-------------------------------------------------------------------------------- -; Input: None -;-------------------------------------------------------------------------------- -; Output: -; $00.b - 24-bit timestamp (low) -; $01.b - 24-bit timestamp (mid) -; $02.b - 24-bit timestamp (high) -; $03.b - zero -; Carry - Unset if error, Set if success -; Zero - Undefined -;-------------------------------------------------------------------------------- -; Side Effects: -; Requires Mode-7 Matrix Registers -;-------------------------------------------------------------------------------- -Clock_QuickStamp: - PHA : PHX : PHP - SEP #$30 ; set 8-bit accumulator and index registers - LDX #$00; - - - LDA $002800 : AND.b #$0F : CMP #$0F : BEQ .ready ; check for clock chip ready signal - CPX.b #$0E : !BLT ++ : CLC : JMP .done : ++ ; if we've read 14 bytes with no success, unset carry and exit - INX - BRA - - SEC ; indicate success - - .ready - %Clock_ReadBCD() : STA.b Scrap00 ; seconds - %Clock_ReadBCD() : STA.b Scrap01 ; minutes - %Clock_ReadBCD() : STA.b Scrap02 ; hours - %Clock_ReadBCD() : STA.b Scrap03 ; days - - REP $20 ; set 16-bit accumulator - LDA.b Scrap01 : AND.w #$00FF : %A_x60() ; convert minutes to seconds - STZ.b Scrap01 : !ADD Scrap00 : STA.b Scrap00 ; store running total seconds to $00 - - LDA.b Scrap03 : AND.w #$00FF : %A_x24() ; convert days to hours - STZ.b Scrap03 : !ADD Scrap02 ; get total hours - %A_x60() ; get total minutes - - LDY #$60 - JSL.l Multiply_A16Y8 - STY.b Scrap02 : STZ.b Scrap03 - !ADD Scrap00 : BCC + : INC.b Scrap02 : + - - .done - PLP : PLX : PLA -RTL -;-------------------------------------------------------------------------------- - -;-------------------------------------------------------------------------------- -; Multiply_A16Y8: -;-------------------------------------------------------------------------------- -; Expects: -; Accumulator - 16-bit -; Index Registers - 8-bit -;-------------------------------------------------------------------------------- -; Notes: -; Found a (wrong) version of this on wikibooks. This is cleaned up and fixed. -;-------------------------------------------------------------------------------- -Multiply_A16Y8: - SEP #$20 ; set 8-bit accumulator - STY.w WRMPYA - STA.w WRMPYB - NOP #4 - LDA.w RDMPYL - LDY.w RDMPYH - XBA - STA.w WRMPYB - NOP #2 - TYA - CLC - ADC.w RDMPYL - LDY.w RDMPYH - BCC .carry_bit - INY -.carry_bit: - XBA - REP #$20 ; set 16-bit accumulator -RTL -;-------------------------------------------------------------------------------- - -;-------------------------------------------------------------------------------- -; Clock_GetTime -;-------------------------------------------------------------------------------- -; Input: None -;-------------------------------------------------------------------------------- -; Output: -; $00.b - Seconds -; $01.b - Minutes -; $02.b - Hours -; $03.b - Days -; $04.b - Months -; $05.w - Years -; Carry - Unset if error, Set if success -; Zero - Undefined -;-------------------------------------------------------------------------------- -Clock_GetTime: - PHA : PHX : PHY : PHP - SEP #$30 ; set 8-bit accumulator and index registers - LDX #$00; - - - LDA $002800 : AND.b #$0F : CMP #$0F : BEQ .ready ; check for clock chip ready signal - CPX.b #$0E : !BLT ++ : CLC : JMP .done : ++ ; if we've read 14 bytes with no success, unset carry and exit - INX - BRA - - SEC ; indicate success - - .ready - %Clock_ReadBCD() : STA.b Scrap00 ; seconds - %Clock_ReadBCD() : STA.b Scrap01 ; minutes - %Clock_ReadBCD() : STA.b Scrap02 ; hours - %Clock_ReadBCD() : STA.b Scrap03 ; days - LDA $002800 : STA.b Scrap04 ; months - %Clock_ReadBCD() : STA.b Scrap05 ; years - LDA $002800 : STA.b Scrap06 ; century - - REP $20 ; set 16-bit accumulator - STA.b Scrap06 : AND #$00FF : %A_x10() : %A_x10() : !ADD #1000 ; multiply century digit by 100 and add 1000 - STZ.b Scrap06 : !ADD Scrap05 : STA.b Scrap05 ; add lower 2 digits of the year and store - - .done - PLP : PLY : PLX : PLA -RTL -;-------------------------------------------------------------------------------- diff --git a/compression.asm b/compression.asm index d5f44ba..32831d4 100644 --- a/compression.asm +++ b/compression.asm @@ -2,7 +2,7 @@ ParadoxCaveGfxFix: ; Always upload line unless you're moving into paradox cave (0x0FF) from above (0x0EF) LDA.b $1B : BEQ .uploadLine - LDX.b $A0 : CPX.w #$00FF : BNE .uploadLine + LDX.b RoomIndex : CPX.w #$00FF : BNE .uploadLine LDX.b $A2 : CPX.w #$00EF : BNE .uploadLine ;Ignore uploading four specific lines of tiles to VRAM diff --git a/contrib.asm b/contrib.asm deleted file mode 100644 index 52adbcd..0000000 --- a/contrib.asm +++ /dev/null @@ -1,182 +0,0 @@ -;================================================================ -; Contributor: Myramong -;================================================================ -;Sprite_ShowMessageFromPlayerContact_Edit: -;{ -; STZ $1CE8 -; JSL.l Sprite_CheckDamageToPlayerSameLayerLong : BCC .dont_show -; -; LDA $4D : CMP.b #$02 : BEQ .dont_show -; -; JSL.l Sprite_DirectionToFacePlayerLong : TYA : EOR.b #$03 -; SEC -;RTL -;.dont_show -; LDA $0DE0, X -; CLC -;RTL -;} -;================================================================ -;Sprite_ShowSolicitedMessageIfPlayerFacing_Edit: -;{ -; JSL.l Sprite_CheckDamageToPlayerSameLayerLong : BCC .alpha -; JSL.l Sprite_CheckIfPlayerPreoccupied : BCS .alpha -; LDA $F6 : BPL .alpha -; LDA $0F10, X : BNE .alpha -; -; LDA $4D : CMP.b #$02 : BEQ .alpha -; -; STZ $1CE8 ; set text choice to 1st option (usually yes/confirm/etc) -; JSL.l Sprite_DirectionToFacePlayerLong : PHX : TYX -; -; ; Make sure that the sprite is facing towards the player, otherwise -; ; talking can't happen. (What sprites actually use this???) -; LDA $05E1A3, X : PLX : CMP $2F : BNE .not_facing_each_other -; PHY -; LDA.b #$40 : STA $0F10, X -; PLA : EOR.b #$03 -; SEC -;RTL -;.not_facing_each_other -;.alpha -; LDA $0DE0, X -; CLC -;RTL -;} -;================================================================ -;OldMountainMan_TransitionFromTagalong_Edit: -;{ -; PHA -; -; LDA.b #$AD : JSL Sprite_SpawnDynamically -; -; PLA : PHX : TAX -; -; LDA $1A64, X : AND.b #$03 : STA $0EB0, Y -; STA $0DE0, Y -; -; LDA $1A00, X : CLC : ADC.b #$02 : STA $0D00, Y -; LDA $1A14, X : ADC.b #$00 : STA $0D20, Y -; -; LDA $1A28, X : CLC : ADC.b #$02 : STA $0D10, Y -; LDA $1A3C, X : ADC.b #$00 : STA $0D30, Y -; -; LDA $EE : STA $0F20, Y -; -; LDA.b #$01 : STA $0BA0, Y -; STA $0E80, Y -; -; LDA.b #$01 : STA $02E4 ; OldMountainMan_FreezePlayer -; STA $037B ; ^ -; -; PLX -; -; LDA.b #$00 : STA FollowerIndicator -; -; STZ $5E -; -; JML $09A6B6 ; <- 4A6B6 tagalong.asm:1194 (SEP #$30 : RTS) -;} -;================================================================ -Sprite_ShowSolicitedMessageIfPlayerFacing_Alt: -{ - STA $1CF0 - STY $1CF1 - - JSL Sprite_CheckDamageToPlayerSameLayerLong : BCC .alpha - JSL Sprite_CheckIfPlayerPreoccupied : BCS .alpha - - LDA $F6 : BPL .alpha - LDA $0F10, X : BNE .alpha - LDA $4D : CMP.b #$02 : BEQ .alpha - - JSL Sprite_DirectionToFacePlayerLong : PHX : TYX - - ; Make sure that the sprite is facing towards the player, otherwise - ; talking can't happen. (What sprites actually use this???) - LDA $05E1A3, X : PLX : CMP $2F : BNE .not_facing_each_other - - PHY - - LDA $1CF0 - LDY $1CF1 - - ; Check what room we're in so we know which npc we're talking to - LDA.b $A0 : CMP #$05 : BEQ .SahasrahlaDialogs - CMP #$1C : BEQ .BombShopGuyDialog - BRA .SayNothing - - .SahasrahlaDialogs - REP #$20 : LDA.l MapReveal_Sahasrahla : ORA MapOverlay : STA MapOverlay : SEP #$20 - JSL DialogSahasrahla : BRA .SayNothing - - .BombShopGuyDialog - REP #$20 : LDA.l MapReveal_BombShop : ORA MapOverlay : STA MapOverlay : SEP #$20 - JSL DialogBombShopGuy - - .SayNothing - - LDA.b #$40 : STA $0F10, X - - PLA : EOR.b #$03 - - SEC - - RTL - -.not_facing_each_other -.alpha - - LDA $0DE0, X - - CLC - - RTL -} -;================================================================ -Sprite_ShowSolicitedMessageIfPlayerFacing_PreserveMessage: -{ - PHY - PHA - - JSL Sprite_CheckDamageToPlayerSameLayerLong : BCC .alpha - JSL Sprite_CheckIfPlayerPreoccupied : BCS .alpha - - LDA $F6 : BPL .alpha - LDA $0F10, X : BNE .alpha - LDA $4D : CMP.b #$02 : BEQ .alpha - - JSL Sprite_DirectionToFacePlayerLong : PHX : TYX - - ; Make sure that the sprite is facing towards the player, otherwise - ; talking can't happen. (What sprites actually use this???) - LDA $05E1A3, X : PLX : CMP $2F : BNE .not_facing_each_other - - PLA : XBA : PLA - - PHY - - TAY : XBA - - JSL Sprite_ShowMessageUnconditional - - LDA.b #$40 : STA $0F10, X - - PLA : EOR.b #$03 - - SEC - - RTL - -.not_facing_each_other -.alpha - PLY - PLA - - LDA $0DE0, X - - CLC - - RTL -} -;================================================================ diff --git a/controllerjank.asm b/controllerjank.asm index 526b3fe..3aefc84 100644 --- a/controllerjank.asm +++ b/controllerjank.asm @@ -22,7 +22,7 @@ InvertDPad: JML.l InvertDPadReturn .crowd_control - LDA.l DPadInverter : BNE + + LDA.l ControllerInverter : BNE + LDA.w JOY1L : STA.b Scrap00 LDA.w JOY1H : STA.b Scrap01 diff --git a/crypto.asm b/crypto.asm index d1c65bb..4f0d5f0 100644 --- a/crypto.asm +++ b/crypto.asm @@ -20,20 +20,6 @@ macro ASL32Single(value) ; ROL handles the carry from the lower byte for us endmacro -;macro LSR32(value,k) -; LDX.b -; ?loop: -; %LSR32Single(,) -; DEX : CPX.b #$00 : BNE ?loop -;endmacro - -;macro ASL32(value,k) -; LDX.b -; ?loop: -; %LSR32Single(,) -; DEX : CPX.b #$00 : BNE ?loop -;endmacro - CryptoMX: PHX @@ -222,69 +208,3 @@ db 32 ; n is 2 ;dd (23*$9e3779b9)&$ffffffff ; n is 3 dd (32*$9e3779b9)&$ffffffff ; n is 2 -;void btea(uint32_t *v, int n, uint32_t const key[4]) { -; uint32_t y, z, sum; -; unsigned p, rounds, e; - -; } else if (n < -1) { /* Decoding Part */ -; n = -n; -; rounds = 6 + 52/n; -; sum = rounds*DELTA; -; y = v[0]; -; do { -; e = (sum >> 2) & 3; -; for (p=n-1; p>0; p--) { -; z = v[p-1]; -; y = v[p] -= MX; -; } -; z = v[n-1]; -; y = v[0] -= MX; -; sum -= DELTA; -; } while (--rounds); -; } - -;BTEA will encode or decode n words as a single block where n > 1 -; -;v is the n word data vector -;k is the 4 word key -;n is negative for decoding -;if n is zero result is 1 and no coding or decoding takes place, otherwise the result is zero -;assumes 32 bit 'long' and same endian coding and decoding -;#include -;#define DELTA 0x9e3779b9 -;#define MX ((((z>>5)^(y<<2)) + ((y>>3)^(z<<4))) ^ ((sum^y) + (key[(p&3)^e] ^ z))) -; -;void btea(uint32_t *v, int n, uint32_t const key[4]) { -; uint32_t y, z, sum; -; unsigned p, rounds, e; -; if (n > 1) { /* Coding Part */ -; rounds = 6 + 52/n; -; sum = 0; -; z = v[n-1]; -; do { -; sum += DELTA; -; e = (sum >> 2) & 3; -; for (p=0; p> 2) & 3; -; for (p=n-1; p>0; p--) { -; z = v[p-1]; -; y = v[p] -= MX; -; } -; z = v[n-1]; -; y = v[0] -= MX; -; sum -= DELTA; -; } while (--rounds); -; } -;} diff --git a/darkroomitems.asm b/darkroomitems.asm index a2d1474..0d7b9b7 100644 --- a/darkroomitems.asm +++ b/darkroomitems.asm @@ -1,6 +1,6 @@ CheckReceivedItemPropertiesBeforeLoad: - LDA $A0 : BEQ .normalCode - LDA $7EC005 : BNE .lightOff + LDA.b RoomIndex : BEQ .normalCode + LDA.l $7EC005 : BNE .lightOff .normalCode LDA.l AddReceivedItemExpanded_properties, X ;Restore Rando Code RTL @@ -10,18 +10,18 @@ CheckReceivedItemPropertiesBeforeLoad: LDA.l AddReceivedItemExpanded_properties, X ; get palette REP #$30 - AND #$0007 ; mask out palette + AND.w #$0007 ; mask out palette ASL #5 ; multiply by 32 - ADC #$C610 ; offset to latter half + ADC.w #$C610 ; offset to latter half TAX ; give to destination - LDY #$C610 ; target palette SP0 colors 8-F + LDY.w #$C610 ; target palette SP0 colors 8-F - LDA #$000F ; 16 bytes + LDA.w #$000F ; 16 bytes MVN $7E, $7E ; move palette SEP #$30 PLB : PLY : PLX - INC $15 - LDA #$00 + INC.b $15 + LDA.b #$00 RTL diff --git a/darkworldspawn.asm b/darkworldspawn.asm index 579444e..be2bfc1 100644 --- a/darkworldspawn.asm +++ b/darkworldspawn.asm @@ -28,8 +28,8 @@ SetDeathWorldChecked: JMP SetDeathWorldChecked_Inverted + LDA.b $1B : BEQ .outdoors - LDA.w $040C : CMP #$FF : BNE .dungeon - LDA.b $A0 : ORA.b $A1 : BNE ++ + LDA.w $040C : CMP.b #$FF : BNE .dungeon + LDA.b RoomIndex : ORA.b RoomIndex+1 : BNE ++ LDA.l GanonPyramidRespawn : BNE .pyramid ; if flag is set, force respawn at pyramid on death to ganon ++ .outdoors @@ -52,20 +52,20 @@ DoWorldFix_Inverted: .skip_mirror_check ; alt entrance point LDA.l ProgressIndicator : CMP.b #$03 : BCS .done ; check if agahnim 1 is alive .setDarkWorld - LDA.b #$40 : STA CurrentWorld ; set flag to dark world + LDA.b #$40 : STA.l CurrentWorld ; set flag to dark world LDA.l FollowerIndicator CMP.b #$07 : BEQ .clear ; clear frog CMP.b #$08 : BEQ .clear ; clear dwarf - consider flute implications BRA .done .clear - LDA.b #$00 : STA FollowerIndicator ; clear follower + LDA.b #$00 : STA.l FollowerIndicator ; clear follower .done RTL ;-------------------------------------------------------------------------------- SetDeathWorldChecked_Inverted: LDA.b $1B : BEQ .outdoors - LDA.w $040C : CMP #$FF : BNE .dungeon - LDA.b $A0 : ORA $A1 : BNE ++ + LDA.w $040C : CMP.b #$FF : BNE .dungeon + LDA.b RoomIndex : ORA.b RoomIndex+1 : BNE ++ LDA.l GanonPyramidRespawn : BNE .castle ; if flag is set, force respawn at pyramid on death to ganon ++ .outdoors @@ -77,7 +77,7 @@ JMP DoWorldFix_Inverted_skip_mirror_check .castle LDA.b #$00 : STA.l CurrentWorld ; set flag to dark world - LDA.l FollowerIndicator : CMP.b #$07 : BNE + : LDA.b #$08 : STA FollowerIndicator : + ; convert frog to dwarf + LDA.l FollowerIndicator : CMP.b #$07 : BNE + : LDA.b #$08 : STA.l FollowerIndicator : + ; convert frog to dwarf .done RTL ;================================================================================ diff --git a/decryption.asm b/decryption.asm index 2c590f5..3500c21 100644 --- a/decryption.asm +++ b/decryption.asm @@ -61,7 +61,7 @@ JML.l Dungeon_OpenKeyedObject_nextChest .nextChest INX #2 : CPX.w #$0150 : BEQ .couldntFindChest - LDA.l ChestData, X : AND.w #$7FFF : CMP.b $A0 : BNE .nextChest + LDA.l ChestData, X : AND.w #$7FFF : CMP.b RoomIndex : BNE .nextChest DEC.b Scrap0E : BNE .nextChest diff --git a/dialog.asm b/dialog.asm index fa3dec5..3b910c8 100644 --- a/dialog.asm +++ b/dialog.asm @@ -172,7 +172,7 @@ FreeDungeonItemNotice: STZ.w $1CF0 : STZ.w $1CF1 ; reset decompression buffer LDA.b #$01 : STA.l AltTextFlag ; set alternate dialog flag - STA.l $7F509F + STA.l TextBoxDefer ;-------------------------------- .skip @@ -415,6 +415,112 @@ CalculateSignIndex: .done RTL +;================================================================ +; Contributor: Myramong +;================================================================ +Sprite_ShowSolicitedMessageIfPlayerFacing_Alt: +{ + STA.w $1CF0 + STY.w $1CF1 + + JSL Sprite_CheckDamageToPlayerSameLayerLong : BCC .alpha + JSL Sprite_CheckIfPlayerPreoccupied : BCS .alpha + + LDA.b $F6 : BPL .alpha + LDA.w $0F10, X : BNE .alpha + LDA.b $4D : CMP.b #$02 : BEQ .alpha + + JSL Sprite_DirectionToFacePlayerLong : PHX : TYX + + ; Make sure that the sprite is facing towards the player, otherwise + ; talking can't happen. (What sprites actually use this???) + LDA.l $05E1A3, X : PLX : CMP.b $2F : BNE .not_facing_each_other + + PHY + + LDA.w $1CF0 + LDY.w $1CF1 + + ; Check what room we're in so we know which npc we're talking to + LDA.b RoomIndex + CMP.b #$05 : BEQ .SahasrahlaDialogs + CMP.b #$1C : BEQ .BombShopGuyDialog + BRA .SayNothing + + .SahasrahlaDialogs + REP #$20 : LDA.l MapReveal_Sahasrahla : ORA.l MapOverlay : STA.l MapOverlay : SEP #$20 + JSL DialogSahasrahla : BRA .SayNothing + + .BombShopGuyDialog + REP #$20 : LDA.l MapReveal_BombShop : ORA.l MapOverlay : STA.l MapOverlay : SEP #$20 + JSL DialogBombShopGuy + + .SayNothing + + LDA.b #$40 : STA.w $0F10, X + + PLA : EOR.b #$03 + + SEC + + RTL + +.not_facing_each_other +.alpha + + LDA.w $0DE0, X + + CLC + + RTL +} +;================================================================ +Sprite_ShowSolicitedMessageIfPlayerFacing_PreserveMessage: +{ + PHY + PHA + + JSL Sprite_CheckDamageToPlayerSameLayerLong : BCC .alpha + JSL Sprite_CheckIfPlayerPreoccupied : BCS .alpha + + LDA.b $F6 : BPL .alpha + LDA.w $0F10, X : BNE .alpha + LDA.b $4D : CMP.b #$02 : BEQ .alpha + + JSL Sprite_DirectionToFacePlayerLong : PHX : TYX + + ; Make sure that the sprite is facing towards the player, otherwise + ; talking can't happen. (What sprites actually use this???) + LDA.l $05E1A3, X : PLX : CMP.b $2F : BNE .not_facing_each_other + + PLA : XBA : PLA + + PHY + + TAY : XBA + + JSL Sprite_ShowMessageUnconditional + + LDA.b #$40 : STA.w $0F10, X + + PLA : EOR.b #$03 + + SEC + + RTL + +.not_facing_each_other +.alpha + PLY + PLA + + LDA.w $0DE0, X + + CLC + + RTL +} + ;-------------------------------------------------------------------------------- ; A0 - A9 - 0 - 9 ; AA - C3 - A - Z diff --git a/doorframefixes.asm b/doorframefixes.asm index 921dee5..270917f 100644 --- a/doorframefixes.asm +++ b/doorframefixes.asm @@ -7,8 +7,8 @@ ;-------------------------------------------------------------------------------- StoreLastOverworldDoorID: TXA : INC - STA $7F5099 - LDA $1BBB73, X : STA $010E + STA.l PreviousOverworldDoor + LDA.l $1BBB73, X : STA.w $010E RTL ;-------------------------------------------------------------------------------- @@ -16,14 +16,14 @@ RTL ; CacheDoorFrameData ;-------------------------------------------------------------------------------- CacheDoorFrameData: - LDA $7F5099 : BEQ .originalBehaviour + LDA.l PreviousOverworldDoor : BEQ .originalBehaviour DEC : ASL : TAX - LDA EntranceDoorFrameTable, X : STA $0696 - LDA EntranceAltDoorFrameTable, X : STA $0698 + LDA.l EntranceDoorFrameTable, X : STA.w $0696 + LDA.l EntranceAltDoorFrameTable, X : STA.w $0698 BRA .done .originalBehaviour - LDA $D724, X : STA $0696 - STZ $0698 + LDA.w $D724, X : STA.w $0696 + STZ.w $0698 .done RTL ;-------------------------------------------------------------------------------- @@ -32,8 +32,8 @@ RTL ; WalkDownIntoTavern ;-------------------------------------------------------------------------------- WalkDownIntoTavern: - LDA $7F5099 + LDA.l PreviousOverworldDoor ; tavern door has index 0x42 (saved off value is incremented by one) - CMP #$43 + CMP.b #$43 RTL ;-------------------------------------------------------------------------------- diff --git a/dungeondrops.asm b/dungeondrops.asm index c33e1cc..ad4d4a8 100644 --- a/dungeondrops.asm +++ b/dungeondrops.asm @@ -2,8 +2,8 @@ ; Dungeon & Boss Drop Fixes ;-------------------------------------------------------------------------------- DropSafeDungeon: - LDA $040C : CMP #$08 : BEQ + - LDA $01C6FC, X : JML Sprite_SpawnFallingItem + LDA.w $040C : CMP.b #$08 : BEQ + + LDA.l $01C6FC, X : JML Sprite_SpawnFallingItem + RTL -;-------------------------------------------------------------------------------- \ No newline at end of file +;-------------------------------------------------------------------------------- diff --git a/endingsequence.asm b/endingsequence.asm index 1603305..83f506b 100644 --- a/endingsequence.asm +++ b/endingsequence.asm @@ -7,7 +7,7 @@ EndingSequenceTableOverride: TYX LDA.l EndingSequenceText, X PLX - STA $1008, X + STA.w $1008, X PLY RTL ;-------------------------------------------------------------------------------- @@ -15,7 +15,7 @@ EndingSequenceTableLookupOverride: PHY PHX TYX - LDA.l EndingSequenceText, X : AND #$00FF + LDA.l EndingSequenceText, X : AND.w #$00FF PLX PLY RTL diff --git a/enemy_adjustments.asm b/enemy_adjustments.asm index ec0411f..8b96720 100644 --- a/enemy_adjustments.asm +++ b/enemy_adjustments.asm @@ -3,21 +3,25 @@ ; make sure bats always load LW stats ;-------------------------------------------------------------------------------- NewBatInit: - CPY #$00 : BEQ .light_world + CPY.b #$00 : BEQ .light_world ;check if map id == 240 or 241 - LDA $A0 : CMP #$F0 : BEQ .light_world ;oldman cave1 - CMP #$F1 : BEQ .light_world ;oldman cave2 - CMP #$B0 : BEQ .light_world ;agahnim statue keese - CMP #$D0 : BEQ .light_world ;agahnim darkmaze + LDA.b RoomIndex : CMP.b #$F0 : BEQ .light_world ;oldman cave1 + CMP.b #$F1 : BEQ .light_world ;oldman cave2 + CMP.b #$B0 : BEQ .light_world ;agahnim statue keese + CMP.b #$D0 : BEQ .light_world ;agahnim darkmaze - LDA.b #$85 : STA $0CD2, X - LDA.b #$04 : STA $0E50, X + LDA.b #$85 : STA.w $0CD2, X + LDA.b #$04 : STA.w $0E50, X RTL - .light_world - LDA.b #$80 : STA $0CD2, X - LDA.b #$01 : STA $0E50, X + LDA.b #$80 : STA.w $0CD2, X + LDA.b #$01 : STA.w $0E50, X RTL ;-------------------------------------------------------------------------------- - +NewFireBarDamage: + LDA.w $00EE : CMP.w $0F20, X : BNE .NotSameLayer + JSL Sprite_AttemptDamageToPlayerPlusRecoilLong + RTL +.NotSameLayer +RTL diff --git a/entrances.asm b/entrances.asm index b7ec86e..5e1d9e9 100644 --- a/entrances.asm +++ b/entrances.asm @@ -8,7 +8,7 @@ LockAgahnimDoors: ;#$0 = Never Locked LDA.w #$0000 : RTL + : CMP.w #$0001 : BNE + - LDA ProgressIndicator : AND.w #$000F : CMP.w #$0002 : !BGE .unlock ; if we rescued zelda, skip + LDA.l ProgressIndicator : AND.w #$000F : CMP.w #$0002 : !BGE .unlock ; if we rescued zelda, skip JSR.w LockAgahnimDoorsCore : RTL + : CMP.w #$0002 : BNE + JSR.w LockAgahnimDoorsCore : BEQ .unlock @@ -18,20 +18,20 @@ LockAgahnimDoors: REP #$30 PLY : PLX !BGE .crystalOrUnlock - LDA #$0001 : RTL + LDA.w #$0001 : RTL .crystalOrUnlock - LDA InvertedMode : AND.w #$00FF : BEQ .unlock + LDA.l InvertedMode : AND.w #$00FF : BEQ .unlock - LDA OverworldEventDataWRAM+$43 : AND.w #$0020 : BNE .unlock ; Check if GT overlay is already on or not - LDA $0308 : AND.w #$0080 : BEQ ++ ;If we are holding an item + 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 .locked - LDA #$0001 : RTL ;Keep the door locked + LDA.w #$0001 : RTL ;Keep the door locked ++ SEP #$30 JSL $099B6F ;Add tower break seal REP #$30 - LDA #$0001 ;Prevent door from opening that frame otherwise it glitchy + LDA.w #$0001 ;Prevent door from opening that frame otherwise it glitchy RTL + @@ -44,7 +44,7 @@ RTL FlagAgahnimDoor: LDA.l InvertedMode : BEQ .vanilla - LDA OverworldEventDataWRAM+$43 : ORA #$20 : STA OverworldEventDataWRAM+$43 ; activate GT overlay + LDA.l OverworldEventDataWRAM+$43 : ORA.b #$20 : STA.l OverworldEventDataWRAM+$43 ; activate GT overlay .vanilla LDA.b #$28 : STA.b $72 @@ -53,9 +53,9 @@ FlagAgahnimDoor: ;-------------------------------------------------------------------------------- LockAgahnimDoorsCore: - LDA $22 : CMP.w #1992 : !BLT + ; door too far left, skip + LDA.b $22 : CMP.w #1992 : !BLT + ; door too far left, skip CMP.w #2088 : !BGE + ; door too rat right, skip - LDA $20 : CMP.w #1720 : !BGE + ; door too low, skip + LDA.b $20 : CMP.w #1720 : !BGE + ; door too low, skip LDA.w #$0001 RTS + @@ -86,16 +86,15 @@ AllowStartFromSingleEntranceCave: BNE + JMP .done + - DEC STA.b Scrap00 ASL #2 : !ADD Scrap00 : ASL #2 ; mult by 20 TAX - LDA.w #$0016 : STA $7EC142 ; Cache the main screen designation + 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 $7EC148 ; Cache Link's Y coordinate + 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. @@ -113,19 +112,19 @@ AllowStartFromSingleEntranceCave: BIT.w #$0080 : BEQ + : ORA.w #$FF00 : + ; Sign extend STA.l $7EC16E - LDA.w #$0000 : !SUB.l $7EC16A : STA $7EC16C - LDA.w #$0000 : !SUB.l $7EC16E : STA $7EC170 + LDA.w #$0000 : !SUB.l $7EC16A : STA.l $7EC16C + LDA.w #$0000 : !SUB.l $7EC16E : STA.l $7EC170 LDA.l StartingAreaExitTable+$02, X : AND.w #$00FF - STA $7EC14C ; Cache the overworld area number - STA $7EC140 ; Cache the aux overworld area number + STA.l $7EC14C ; Cache the overworld area number + STA.l $7EC140 ; Cache the aux overworld area number - STZ $0698 ;zero out door overlays in case starting overworld door is not set - STZ $0699 ;zero out door overlays in case starting overworld door is not set + 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 SEP #$20 ; set 8-bit accumulator - LDA $7EF3C8 : TAX - LDA.l StartingAreaOverworldDoor, X : STA.l $7F5099 ;Load overworld door + LDA.l $7EF3C8 : TAX + LDA.l StartingAreaOverworldDoor, X : STA.l PreviousOverworldDoor ;Load overworld door REP #$20 ; reset 16-bit accumulator JSL.l CacheDoorFrameData @@ -135,7 +134,7 @@ RTL ;-------------------------------------------------------------------------------- AllowStartFromExit: - LDX $1CE8 + LDX.w $1CE8 LDA.l ShouldStartatExit, X : BNE .doStart LDA.l StartingEntrance ; what we wrote over @@ -146,21 +145,21 @@ JML.l AllowStartFromExitReturn LDA.l $028481, X ;Module_LocationMenu_starting_points ASL : TAX - LDA.l $02D8D2, X : STA $A0 - LDA.l $02D8D3, X : STA $A1 + LDA.l $02D8D2, X : STA.b RoomIndex + LDA.l $02D8D3, X : STA.b RoomIndex+1 ; Go to pre-overworld mode - LDA.b #$08 : STA $10 + LDA.b #$08 : STA.b $10 - STZ $11 - STZ $B0 + STZ.b $11 + STZ.b $B0 - STZ $010A + STZ.w $010A - STZ $04AA + STZ.w $04AA JSL Equipment_SearchForEquippedItemLong JSL HUD_RebuildLong2 - JSL $0DDD32 ; Equipment_UpdateEquippedItemLong + JSL Equipment_UpdateEquippedItemLong RTL ;-------------------------------------------------------------------------------- @@ -196,7 +195,7 @@ PreventEnterOnBonk: STA.b Scrap00 ; part of what we wrote over LDA.l InvertedMode : AND.w #$00FF : BEQ .done LDA.l $5D : AND.w #$00FF : CMP.w #$0014 : BNE .done ;in mirror mode? - LDA.b $8A : AND.w #$0040 : CMP $7B : BEQ .done ; Are we bonking, or doing the superbunny glitch? + LDA.b $8A : AND.w #$0040 : CMP.b $7B : 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 @@ -206,8 +205,8 @@ PreventEnterOnBonk: JML.l PreventEnterOnBonk_return ;-------------------------------------------------------------------------------- TurtleRockEntranceFix: - LDA TurtleRockAutoOpenFix : BEQ .done - LDA $8A : CMP.b #$47 : BNE .done + LDA.l TurtleRockAutoOpenFix : BEQ .done + LDA.b $8A : CMP.b #$47 : BNE .done ;If exiting to turtle rock ensure the entrance is open LDA.l OverworldEventDataWRAM+$47 : ORA.b #$20 : STA.l OverworldEventDataWRAM+$47 .done @@ -216,14 +215,14 @@ RTL AnimatedEntranceFix: ;when an entrance animation tries to start PHA LDA.l InvertedMode : BEQ + ;If we are in inverted mode - LDA $8A : AND.b #$40 : BNE + ;and in the light world + LDA.b $8A : AND.b #$40 : BNE + ;and in the light world PLA - STZ $04C6 ; skip it. - LDA #$00 + STZ.w $04C6 ; skip it. + LDA.b #$00 RTL + PLA - STA $02E4 ;what we wrote over - STA $0FC1 ;what we wrote over - STA $0710 ;what we wrote over + STA.w $02E4 ;what we wrote over + STA.w $0FC1 ;what we wrote over + STA.w $0710 ;what we wrote over RTL diff --git a/events.asm b/events.asm index 4738663..363524a 100644 --- a/events.asm +++ b/events.asm @@ -148,13 +148,13 @@ OnNewFile: PHX : PHP ; reset some values on new file that are otherwise only reset on hard reset SEP #$20 ; set 8-bit accumulator - STZ $03C4 ; ancilla slot index - STZ $047A ; EG - STZ $0B08 : STZ $0B09 ; arc variable - STZ $0CFB ; enemies killed (pull trees) - STZ $0CFC ; times taken damage (pull trees) - STZ $0FC7 : STZ $0FC8 : STZ $0FC9 : STZ $0FCA : STZ $0FCB : STZ $0FCC : STZ $0FCD ; prize packs - LDA #$00 : STA.l $7EC011 ; mosaic + 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 PLP : PLX RTL @@ -166,16 +166,12 @@ RTL ;-------------------------------------------------------------------------------- OnLinkDamaged: JSL.l IncrementDamageTakenCounter_Arb - ;JSL.l FlipperKill JML.l OHKOTimer ;-------------------------------------------------------------------------------- -OnEnterWater: - JSL.l RegisterWaterEntryScreen - - JSL.l MysteryWaterFunction - LDX.b #$04 -RTL +;OnEnterWater: +; JSL.l UnequipCapeQuiet ; what we wrote over +;RTL ;-------------------------------------------------------------------------------- OnLinkDamagedFromPit: JSL.l OHKOTimer @@ -197,7 +193,6 @@ OnLinkDamagedFromPitOutdoors: ;-------------------------------------------------------------------------------- OnOWTransition: JSL.l FloodGateReset - JSL.l FlipperFlag JSL.l StatTransitionCounter PHP SEP #$20 ; set 8-bit accumulator @@ -206,14 +201,14 @@ OnOWTransition: RTL ;-------------------------------------------------------------------------------- OnLoadDuckMap: - LDA.l ScratchBufferV + LDA.l DuckMapFlag BNE + - INC : STA.l ScratchBufferV + INC : STA.l DuckMapFlag JSL OverworldMap_InitGfx : DEC $0200 RTL + - LDA.b #$00 : STA.l ScratchBufferV + LDA.b #$00 : STA.l DuckMapFlag JML OverworldMap_DarkWorldTilemap ;-------------------------------------------------------------------------------- @@ -228,10 +223,10 @@ RTL PostItemAnimation: LDA.b #$00 : STA.l BusyItem ; mark item as finished - LDA.l $7F509F : BEQ + + LDA.l TextBoxDefer : BEQ + STZ.w $1CF0 : STZ.w $1CF1 ; reset decompression buffer JSL.l Main_ShowTextMessage_Alt - LDA.b #$00 : STA.l $7F509F + LDA.b #$00 : STA.l TextBoxDefer + LDA.w $02E9 : CMP.b #$01 : BNE + diff --git a/fairyfixes.asm b/fairyfixes.asm index 2305cd7..3d8e9e9 100644 --- a/fairyfixes.asm +++ b/fairyfixes.asm @@ -2,20 +2,20 @@ ; Fairy Changes & Fixes ;-------------------------------------------------------------------------------- RefillHealthPlusMagic: - LDA BigFairyHealth : STA HeartsFiller + LDA.l BigFairyHealth : STA.l HeartsFiller RTL ;-------------------------------------------------------------------------------- RefillHealthPlusMagic8bit: - LDA BigFairyHealth : STA HeartsFiller - LDA BigFairyMagic : STA MagicFiller + LDA.l BigFairyHealth : STA.l HeartsFiller + LDA.l BigFairyMagic : STA.l MagicFiller RTL ;-------------------------------------------------------------------------------- CheckFullHealth: - LDA BigFairyHealth : BEQ + - LDA CurrentHealth : CMP MaximumHealth : BNE .player_hp_not_full_yet + LDA.l BigFairyHealth : BEQ + + LDA.l CurrentHealth : CMP.l MaximumHealth : BNE .player_hp_not_full_yet + - LDA BigFairyMagic : BEQ + - LDA CurrentMagic : CMP.b #$80 : BNE .player_mp_not_full_yet + LDA.l BigFairyMagic : BEQ + + LDA.l CurrentMagic : CMP.b #$80 : BNE .player_mp_not_full_yet + LDA.b #$00 RTL @@ -30,57 +30,56 @@ FairyPond_Init: JML.l Sprite_ShowMessageFromPlayerContact + PHY : JSL.l Sprite_CheckDamageToPlayerSameLayerLong : BCC + - LDA BottleContentsOne : CMP.b #$02 : BNE ++ : LDA.b #$1C : PHA : BRA .emptyBottle : ++ - LDA BottleContentsTwo : CMP.b #$02 : BNE ++ : LDA.b #$1D : PHA : BRA .emptyBottle : ++ - LDA BottleContentsThree : CMP.b #$02 : BNE ++ : LDA.b #$1E : PHA : BRA .emptyBottle : ++ - LDA BottleContentsFour : CMP.b #$02 : BNE ++ : LDA.b #$1F : PHA : BRA .emptyBottle : ++ + LDA.l BottleContentsOne : CMP.b #$02 : BNE ++ : LDA.b #$1C : PHA : BRA .emptyBottle : ++ + LDA.l BottleContentsTwo : CMP.b #$02 : BNE ++ : LDA.b #$1D : PHA : BRA .emptyBottle : ++ + 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 $0D80, X + LDA.b #$0A : STA.w $0D80, X LDA.b #$51 LDY.b #$01 JSL.l Sprite_ShowMessageFromPlayerContact JMP .cleanup .emptyBottle - LDA.b #$02 : STA $0D80, X - ;JSL Player_ResetState ; If we continue to have issues, add this in too. (After determining the address for it) + LDA.b #$02 : STA.w $0D80, X STZ $2F - LDA.b #$01 : STA $02E4 - PLA : STA $1CE8 + LDA.b #$01 : STA.w $02E4 + PLA : STA.w $1CE8 .cleanup - STZ $0EB0, X ; Clear the sprite's item-given variable + STZ.w $0EB0, X ; Clear the sprite's item-given variable CLC ; skip rest of original function + : PLY RTL ;-------------------------------------------------------------------------------- HappinessPond_Check: - LDA $A0 : CMP.b #$15 ;what we wrote over + LDA.b RoomIndex : CMP.b #$15 ;what we wrote over BNE .done PHP LDA.b #$72 JSL Sprite_SpawnDynamically - LDA $0FD8 : STA $0D10, Y - LDA $0FD9 : STA $0D30, Y + LDA.w $0FD8 : STA.w $0D10, Y + LDA.w $0FD9 : STA.w $0D30, Y - LDA $0FDA : !SUB.b #$40 : STA $0D00, Y - LDA $0FDB : SBC.b #$00 : STA $0D20, Y + LDA.w $0FDA : !SUB.b #$40 : STA.w $0D00, Y + LDA.w $0FDB : SBC.b #$00 : STA.w $0D20, Y - LDA.b #$01 : STA $0DA0, Y + LDA.b #$01 : STA.w $0DA0, Y LDA.b #$BB JSL Sprite_SpawnDynamically - LDA.b #$08 : STA $0DD0, Y ; ensure we run prep for the shopkeeper + LDA.b #$08 : STA.w $0DD0, Y ; ensure we run prep for the shopkeeper - LDA $0FD8 : STA $0D10, Y - LDA $0FD9 : STA $0D30, Y + LDA.w $0FD8 : STA.w $0D10, Y + LDA.w $0FD9 : STA.w $0D30, Y - LDA $0FDA : !SUB.b #$20 : STA $0D00, Y - LDA $0FDB : SBC.b #$00 : STA $0D20, Y + LDA.w $0FDA : !SUB.b #$20 : STA.w $0D00, Y + LDA.w $0FDB : SBC.b #$00 : STA.w $0D20, Y - STZ $0DD0, X ; self terminate + STZ.w $0DD0, X ; self terminate PLP .done diff --git a/fileselect.asm b/fileselect.asm index 6c66c9a..0387cc7 100644 --- a/fileselect.asm +++ b/fileselect.asm @@ -328,8 +328,8 @@ DrawPlayerFileShared: LDA.l EquipmentSRAM+$0108 : AND.w #$00FF JSL.l HexToDec - LDA.l $7F5006 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(11,26) - LDA.l $7F5007 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(11,27) + LDA.l HexToDecDigit4 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(11,26) + LDA.l HexToDecDigit5 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(11,27) ; Boots %fs_drawItemBasic(EquipmentSRAM+$15,3,28,FileSelectItems_boots) @@ -560,16 +560,16 @@ FileSelectDrawHudBar: LDA.w #$029B|!FS_COLOR_GREEN : %fs_draw16x8(0,10) LDA.l DisplayRupeesSRAM JSL.l HexToDec - LDA.l $7F5004 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(1,9) - LDA.l $7F5005 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(1,10) - LDA.l $7F5006 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(1,11) - LDA.l $7F5007 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(1,12) + LDA.l HexToDecDigit2 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(1,9) + LDA.l HexToDecDigit3 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(1,10) + LDA.l HexToDecDigit4 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(1,11) + LDA.l HexToDecDigit5 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(1,12) LDA.w #$028B|!FS_COLOR_BLUE : %fs_draw16x8(0,14) LDA.l BombsEquipmentSRAM : AND.w #$00FF JSL.l HexToDec - LDA.l $7F5006 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(1,14) - LDA.l $7F5007 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(1,15) + LDA.l HexToDecDigit4 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(1,14) + LDA.l HexToDecDigit5 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(1,15) LDA.l BowTrackingSRAM : AND.w #$0040 : BEQ + LDA.w #$0299|!FS_COLOR_RED : %fs_draw16x8(0,17) @@ -579,8 +579,8 @@ FileSelectDrawHudBar: ++ LDA.l CurrentArrowsSRAM : AND.w #$00FF JSL.l HexToDec - LDA.l $7F5006 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(1,17) - LDA.l $7F5007 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(1,18) + LDA.l HexToDecDigit4 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(1,17) + LDA.l HexToDecDigit5 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(1,18) RTS ;-------------------------------------------------------------------------------- AltBufferTable: diff --git a/firebarlayer.asm b/firebarlayer.asm deleted file mode 100644 index f7118b2..0000000 --- a/firebarlayer.asm +++ /dev/null @@ -1,8 +0,0 @@ -NewFireBarDamage: -{ - LDA $00EE : CMP $0F20, X : BNE .NotSameLayer - JSL Sprite_AttemptDamageToPlayerPlusRecoilLong - RTL - .NotSameLayer - RTL -} \ No newline at end of file diff --git a/flipperkill.asm b/flipperkill.asm index 758f172..3072056 100644 --- a/flipperkill.asm +++ b/flipperkill.asm @@ -1,65 +1,13 @@ ;================================================================================ ; Fake Flippers Softlock Fix ;-------------------------------------------------------------------------------- -FlipperKill: - PHP - LDA.b $5D : CMP.b #$04 : BNE .done ; skip if we're not swimming - LDA.l FlippersEquipment : BNE .done ; skip if we have the flippers - LDA.l $7F5001 : BEQ .done ; skip if we're not marked in danger for softlock - LDA.b $8A : CMP.l $7F5098 : BEQ .done ; skip if we're on the same screen we entered the water on - LDA.l IgnoreFaeries : ORA.b #$04 : STA.l IgnoreFaeries - LDA.b #$00 : STA CurrentHealth ; kill link - LDA.b #$00 : STA $7F5001 ; mark fake flipper softlock as impossible - .done - PLP - LDA.l CurrentHealth ; thing we wrote over -RTL -;-------------------------------------------------------------------------------- -IgnoreFairyCheck: - LDX.b #$00 ; thing we wrote over - LDA.l IgnoreFaeries : BIT.b #$04 : BEQ .normal - - AND.b #$FB : STA.l IgnoreFaeries ; clear ignore fairy flag - LDA.b #$F0 ; set check to invalid entry -RTL - .normal - LDA.b #$06 ; set check to fairy -RTL -;-------------------------------------------------------------------------------- -FlipperReset: - JSL $0998E8 ; AddTransitionSplash - LDA.b #$00 : STA.l $7F5001 ; mark fake flipper softlock as impossible - .done -RTL -;-------------------------------------------------------------------------------- -FlipperFlag: - LDA.b $5D : CMP.b #$04 : BNE .done ; skip if we're not swimming - LDA.l FlippersEquipment : BNE .safe ; skip if we have the flippers - LDA.b #$01 : STA.l $7F5001 ; mark fake flipper softlock as possible - BRA .done - .safe - LDA.b #$00 : STA.l $7F5001 ; mark fake flipper softlock as impossible - .done -RTL -;-------------------------------------------------------------------------------- -RegisterWaterEntryScreen: - PHA - LDA.b $8A : STA.l $7F5098 ; store ow index - PLA -RTL -;-------------------------------------------------------------------------------- -MysteryWaterFunction: ; *$3AE54 ALTERNATE ENTRY POINT - LDA.b #$20 : STA $02E2 + +UnequipCapeQuiet: + LDA.b #$20 : STA.w $02E2 STZ.w $037B STZ.b $55 STZ.w $0360 RTL -;-------------------------------------------------------------------------------- - - -;=================================================================================================== -; More elegant solution -;=================================================================================================== protectff: LDA.l AllowAccidentalMajorGlitch diff --git a/floodgatesoftlock.asm b/floodgatesoftlock.asm index e593344..daefa04 100644 --- a/floodgatesoftlock.asm +++ b/floodgatesoftlock.asm @@ -5,21 +5,21 @@ FloodGateAndMasterSwordFollowerReset: JSL.l MasterSwordFollowerClear FloodGateReset: LDA.l PersistentFloodgate : BNE + - LDA OverworldEventDataWRAM+$3B : AND.b #$DF : STA OverworldEventDataWRAM+$3B ; reset water outside floodgate - LDA OverworldEventDataWRAM+$7B : AND.b #$DF : STA OverworldEventDataWRAM+$7B ; reset water outside swamp palace - LDA RoomDataWRAM[$010B].low : AND.b #$7F : STA RoomDataWRAM[$010B].low ; clear water inside floodgate - LDA RoomDataWRAM[$28].high : AND.b #$FE : STA RoomDataWRAM[$28].high ; clear water front room (room 40) + LDA.l OverworldEventDataWRAM+$3B : AND.b #$DF : STA.l OverworldEventDataWRAM+$3B ; reset water outside floodgate + LDA.l OverworldEventDataWRAM+$7B : AND.b #$DF : STA.l OverworldEventDataWRAM+$7B ; reset water outside swamp palace + LDA.l RoomDataWRAM[$010B].low : AND.b #$7F : STA.l RoomDataWRAM[$010B].low ; clear water inside floodgate + LDA.l RoomDataWRAM[$28].high : AND.b #$FE : STA.l RoomDataWRAM[$28].high ; clear water front room (room 40) + FloodGateResetInner: LDA.l Bugfix_SwampWaterLevel : BEQ +++ - LDA RoomDataWRAM[$37].low : AND.b #$04 : BEQ + ; Check if key in room 55 has been collected. - LDA FlippersEquipment : AND.b #$01 : BNE ++ ; Check for flippers. This can otherwise softlock doors if flooded without flippers and no way to reset. + LDA.l RoomDataWRAM[$37].low : AND.b #$04 : BEQ + ; Check if key in room 55 has been collected. + LDA.l FlippersEquipment : AND.b #$01 : BNE ++ ; Check for flippers. This can otherwise softlock doors if flooded without flippers and no way to reset. + - LDA RoomDataWRAM[$37].low : AND.b #$7F : STA RoomDataWRAM[$37].low ; clear water room 55 - outer room you shouldn't be able to softlock except in major glitches + LDA.l RoomDataWRAM[$37].low : AND.b #$7F : STA.l RoomDataWRAM[$37].low ; clear water room 55 - outer room you shouldn't be able to softlock except in major glitches ++ - LDA RoomDataWRAM[$35].high : AND.b #$04 : BNE +++ ; Check if key in room 53 has been collected. + LDA.l RoomDataWRAM[$35].high : AND.b #$04 : BNE +++ ; Check if key in room 53 has been collected. ; no need to check for flippers on the inner room, as you can't get to the west door no matter what, without flippers. - LDA RoomDataWRAM[$35].low : AND.b #$7F : STA RoomDataWRAM[$35].low ; clear water room 53 - inner room with the easy key flood softlock + LDA.l RoomDataWRAM[$35].low : AND.b #$7F : STA.l RoomDataWRAM[$35].low ; clear water room 53 - inner room with the easy key flood softlock +++ RTL ;================================================================================ diff --git a/flute.asm b/flute.asm index fe88520..6684953 100644 --- a/flute.asm +++ b/flute.asm @@ -2,38 +2,38 @@ ; Randomize Flute Dig Item ;-------------------------------------------------------------------------------- SpawnHauntedGroveItem: - LDA $8A : CMP.b #$2A : BEQ + : RTL : + ; Skip if not the haunted grove - LDA $1B : BEQ + : RTL : + ; Skip if indoors + LDA.b $8A : CMP.b #$2A : BEQ + : RTL : + ; Skip if not the haunted grove + LDA.b $1B : BEQ + : RTL : + ; Skip if indoors %GetPossiblyEncryptedItem(HauntedGroveItem, HeartPieceOutdoorValues) JSL.l PrepDynamicTile LDA.b #$EB - STA $7FFE00 + STA.l $7FFE00 JSL Sprite_SpawnDynamically LDX.b #$00 - LDA $2F : CMP.b #$04 : BEQ + : INX : + + LDA.b $2F : CMP.b #$04 : BEQ + : INX : + - LDA.l .x_speeds, X : STA $0D50, Y + LDA.l .x_speeds, X : STA.w $0D50, Y - LDA.b #$00 : STA $0D40, Y - LDA.b #$18 : STA $0F80, Y - LDA.b #$FF : STA $0B58, Y - LDA.b #$30 : STA $0F10, 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 $22 : !ADD.l .x_offsets, X - AND.b #$F0 : STA $0D10, Y - LDA $23 : ADC.b #$00 : STA $0D30, 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 $20 : !ADD.b #$16 : AND.b #$F0 : STA $0D00, Y - LDA $21 : ADC.b #$00 : STA $0D20, 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 #$00 : STA $0F20, Y + LDA.b #$00 : STA.w $0F20, Y TYX - LDX $8A ; haunted grove (208D0A) - LDA OverworldEventDataWRAM, X : AND.b #$40 : BNE + + LDX.b $8A ; haunted grove (208D0A) + LDA.l OverworldEventDataWRAM, X : AND.b #$40 : BNE + LDA.b #$1B : JSL Sound_SetSfx3PanLong + RTL @@ -52,30 +52,30 @@ RTL } ;-------------------------------------------------------------------------------- FluteBoy: - LDA $10 : CMP.b #$1A : BEQ + - LDA.b #$01 : STA $0FDD + LDA.b $10 : CMP.b #$1A : BEQ + + LDA.b #$01 : STA.w $0FDD JML.l FluteBoy_Abort + - LDA $0D80, X : CMP.b #$03 ; thing we wrote over + LDA.w $0D80, X : CMP.b #$03 ; thing we wrote over JML.l FluteBoy_Continue ;-------------------------------------------------------------------------------- FreeDuckCheck: LDA.l InvertedMode : BEQ .done - LDA FluteEquipment : CMP.b #$03 : BEQ .done ; flute is already active + LDA.l FluteEquipment : CMP.b #$03 : BEQ .done ; flute is already active ; check the area, is it #$18 = 30? - LDA $8A : CMP.b #$18 : BNE .done + LDA.b $8A : CMP.b #$18 : BNE .done REP #$20 ; Y coordinate boundaries for setting it off. - LDA $20 + LDA.b $20 CMP.w #$0760 : BCC .done CMP.w #$07E0 : BCS .done ; do if( (Ycoord >= 0x0760) && (Ycoord < 0x07e0 - LDA $22 + LDA.b $22 CMP.w #$01CF : BCC .done CMP.w #$0230 : BCS .done @@ -84,7 +84,7 @@ FreeDuckCheck: SEP #$20 ; Apparently a special Overworld mode for doing this? - LDA.b #$2D : STA $11 + LDA.b #$2D : STA.b $11 ; Trigger the sequence to start the weathervane explosion. LDY.b #$00 @@ -94,12 +94,12 @@ FreeDuckCheck: BRA .skipSong .done SEP #$20 - LDA.b #$80 : STA $03F0 ; thing we wrote over, load flute timer + LDA.b #$80 : STA.w $03F0 ; thing we wrote over, load flute timer LDA.b #$13 RTL .skipSong SEP #$20 - LDA.b #$80 : STA $03F0 ; thing we wrote over, load flute timer + LDA.b #$80 : STA.w $03F0 ; thing we wrote over, load flute timer LDA.b #$00 RTL ;-------------------------------------------------------------------------------- diff --git a/framehook.asm b/framehook.asm index 2f98e74..24434e6 100644 --- a/framehook.asm +++ b/framehook.asm @@ -33,24 +33,13 @@ NMIHookAction: JML.l NMIHookReturn ;-------------------------------------------------------------------------------- PostNMIHookAction: - LDA.l NMIAux : BEQ + - LDA.b Scrap00 : PHA ; preserve DP ram - LDA.b Scrap01 : PHA - LDA.b Scrap02 : PHA + LDA.w NMIAux : BEQ + - LDA.l NMIAux+2 : STA.b Scrap02 ; set up jump pointer - LDA.l NMIAux+1 : STA.b Scrap01 - LDA.l NMIAux+0 : STA.b Scrap00 - - PHK : PER .return-1 ; push stack for RTL return - JMP [$0000] + PHK : PEA .return-1 ; push stack for RTL return + JMP.w [NMIAux] .return - LDA.b #$00 : STA.l NMIAux ; zero bank byte of NMI hook pointer - - PLA : STA.b Scrap02 - PLA : STA.b Scrap01 - PLA : STA.b Scrap00 + STZ.w NMIAux ; zero bank byte of NMI hook pointer + LDA.b $13 : STA.w INIDISP ; thing we wrote over, turn screen back on diff --git a/glitched.asm b/glitched.asm index 76901b2..ce40b7e 100644 --- a/glitched.asm +++ b/glitched.asm @@ -2,7 +2,7 @@ ; Glitched Mode Fixes ;================================================================================ GetAgahnimPalette: - LDA $A0 ; get room id + LDA.b RoomIndex ; get room id CMP.b #13 : BNE + ; Agahnim 2 room LDA.b #$07 ; Use Agahnim 2 RTL @@ -11,25 +11,25 @@ GetAgahnimPalette: RTL ;-------------------------------------------------------------------------------- GetAgahnimDeath: - STA $0BA0, X ; thing we wrote over - LDA $A0 ; get room id + STA.w $0BA0, X ; thing we wrote over + LDA.b RoomIndex ; get room id CMP.b #13 : BNE + ; Agahnim 2 room LDA.l Bugfix_SetWorldOnAgahnimDeath : BEQ ++ LDA.l InvertedMode : BEQ +++ - LDA.b #$00 : STA CurrentWorld ; Switch to light world + LDA.b #$00 : STA.l CurrentWorld ; Switch to light world BRA ++ +++ - LDA.b #$40 : STA CurrentWorld ; Switch to dark world + LDA.b #$40 : STA.l CurrentWorld ; Switch to dark world ++ LDA.b #$01 ; Use Agahnim 2 RTL + ; Elsewhere LDA.l Bugfix_SetWorldOnAgahnimDeath : BEQ ++ LDA.l InvertedMode : BEQ +++ - LDA.b #$40 : STA CurrentWorld ; Switch to dark world + LDA.b #$40 : STA.l CurrentWorld ; Switch to dark world BRA ++ +++ - LDA.b #$00 : STA CurrentWorld ; Switch to light world + LDA.b #$00 : STA.l CurrentWorld ; Switch to light world ; (This will later get flipped to DW when Agahnim 1 ; warps us to the pyramid) ++ @@ -37,7 +37,7 @@ GetAgahnimDeath: RTL ;-------------------------------------------------------------------------------- GetAgahnimType: - LDA $A0 ; get room id + LDA.b RoomIndex ; get room id CMP.b #13 : BNE + ; Agahnim 2 room LDA.b #$0006 ; Use Agahnim 2 BRA .done @@ -48,7 +48,7 @@ RTL ;-------------------------------------------------------------------------------- GetAgahnimSlot: PHX ; thing we wrote over - LDA $A0 ; get room id + LDA.b RoomIndex ; get room id CMP.b #13 : BNE + ; Agahnim 2 room LDA.b #$01 ; Use Agahnim 2 JML.l GetAgahnimSlotReturn @@ -57,8 +57,8 @@ GetAgahnimSlot: JML.l GetAgahnimSlotReturn ;-------------------------------------------------------------------------------- GetAgahnimLightning: - INC $0E30, X ; thing we wrote over - LDA $A0 ; get room id + INC.w $0E30, X ; thing we wrote over + LDA.b RoomIndex ; get room id CMP.b #13 : BNE + ; Agahnim 2 room LDA.b #$01 ; Use Agahnim 2 RTL @@ -69,11 +69,11 @@ GetAgahnimLightning: ;0 = Allow ;1 = Forbid AllowJoypadInput: - LDA PermitSQFromBosses : BEQ .fullCheck - LDA $0403 : AND.b #$80 : BEQ .fullCheck - LDA $0112 : ORA $02E4 ; we have heart container, do short check + LDA.l PermitSQFromBosses : BEQ .fullCheck + LDA.w $0403 : AND.b #$80 : BEQ .fullCheck + LDA.w $0112 : ORA.w $02E4 ; we have heart container, do short check RTL .fullCheck - LDA $0112 : ORA $02E4 : ORA $0FFC + LDA.w $0112 : ORA.w $02E4 : ORA.w $0FFC RTL ;-------------------------------------------------------------------------------- diff --git a/goalitem.asm b/goalitem.asm index 2194c57..1de1e88 100644 --- a/goalitem.asm +++ b/goalitem.asm @@ -118,12 +118,12 @@ GetRequiredCrystalsInX: RTL ;-------------------------------------------------------------------------------- CheckEnoughCrystalsForGanon: - LDA CrystalCounter + LDA.l CrystalCounter CMP.l NumberOfCrystalsRequiredForGanon RTL ;-------------------------------------------------------------------------------- CheckEnoughCrystalsForTower: - LDA CrystalCounter + LDA.l CrystalCounter CMP.l NumberOfCrystalsRequiredForTower RTL diff --git a/halfmagicbat.asm b/halfmagicbat.asm index 19772fc..1de2b42 100644 --- a/halfmagicbat.asm +++ b/halfmagicbat.asm @@ -6,10 +6,10 @@ GetMagicBatItem: %GetPossiblyEncryptedItem(MagicBatItem, SpriteItemValues) CMP.b #$FF : BEQ .normalLogic TAY - STZ $02E9 ; 0 = Receiving item from an NPC or message + STZ.b $02E9 ; 0 = Receiving item from an NPC or message JML.l Link_ReceiveItem .normalLogic - LDA HalfMagic - STA MagicConsumption + LDA.l HalfMagic + STA.l MagicConsumption RTL ;-------------------------------------------------------------------------------- diff --git a/hardmode.asm b/hardmode.asm index e4d00b5..49b35e3 100644 --- a/hardmode.asm +++ b/hardmode.asm @@ -3,7 +3,7 @@ ;================================================================================ CalculateSpikeFloorDamage: REP #$20 ; set 16-bit accumulator - LDA.b $A0 ; these are all decimal because i got them that way + LDA.b RoomIndex ; these are all decimal because i got them that way CMP.w #279 SEP #$20 ; set 8-bit accumulator BNE + @@ -18,7 +18,7 @@ RTL CalculateByrnaUsage: LDA.b $1B : BEQ ++ REP #$20 ; set 16-bit accumulator - LDA.b $A0 ; these are all decimal because i got them that way + LDA.b RoomIndex ; these are all decimal because i got them that way CMP.w #95 : BEQ + ; Ice Palace Spike Room CMP.w #172 : BEQ + ; Blind Boss Room CMP.w #179 : BEQ + ; Room in Misery Mire @@ -38,7 +38,7 @@ CalculateByrnaUsage: CalculateCapeUsage: LDA.b $1B : BEQ ++ REP #$20 ; set 16-bit accumulator - LDA.b $A0 ; these are all decimal because i got them that way + LDA.b RoomIndex ; these are all decimal because i got them that way CMP.w #95 : BEQ + ; Ice Palace Spike Room CMP.w #179 : BEQ + ; Room in Misery Mire CMP.w #213 : BEQ + ; Laser Bridge @@ -56,7 +56,7 @@ CalculateCapeUsage: ActivateInvulnerabilityOrDont: LDA.b $1B : BEQ .nowhere_special REP #$20 ; set 16-bit accumulator - LDA.b $A0 ; these are all decimal because i got them that way + LDA.b RoomIndex ; these are all decimal because i got them that way CMP.w #95 : BEQ .somewhere_cool ; Ice Palace Spike Room CMP.w #179 : BEQ .somewhere_cool ; Room in Misery Mire CMP.w #213 : BEQ .somewhere_cool ; Laser Bridge @@ -81,7 +81,7 @@ GetItemDamageValue: CPX.b #$3d : BEQ .hookshot .normal - lda $0db8f1,x ;what we wrote over + LDA.l $0db8f1,x ;what we wrote over RTL .boomerang LDA.l StunItemAction : AND #$01 : BNE .normal diff --git a/heartbeep.asm b/heartbeep.asm index e8f9bd1..95429e1 100644 --- a/heartbeep.asm +++ b/heartbeep.asm @@ -3,10 +3,10 @@ ;================================================================================ BeepLogic: LDA.l HeartBeep : BEQ + - STA $04CA - LDA.b #$2B : STA $012E + STA.w $04CA + LDA.b #$2B : STA.w $012E RTL + - LDA.b #$FF : STA $04CA + LDA.b #$FF : STA.w $04CA RTL -;================================================================================ \ No newline at end of file +;================================================================================ diff --git a/heartpieces.asm b/heartpieces.asm index d9cba25..7d8b881 100644 --- a/heartpieces.asm +++ b/heartpieces.asm @@ -2,37 +2,35 @@ ; Randomize Heart Pieces ;-------------------------------------------------------------------------------- HeartPieceGet: - PHX : PHY - LDY $0E80, X ; load item value into Y register - BNE + - ; if for any reason the item value is 0 reload it, just in case - JSL.l LoadHeartPieceRoomValue : TAY - + - JSL.l MaybeMarkDigSpotCollected + PHX : PHY + LDY.w $0E80, X ; load item value into Y register + BNE + + ; if for any reason the item value is 0 reload it, just in case + JSL.l LoadHeartPieceRoomValue : TAY + + + JSL.l MaybeMarkDigSpotCollected - .skipLoad + .skipLoad - STZ.w $02E9 ; 0 = Receiving item from an NPC or message + STZ.w $02E9 ; 0 = Receiving item from an NPC or message - CPY.b #$26 : BNE .notHeart ; don't add a 1/4 heart if it's not a heart piece - LDA.l HeartPieceQuarter : INC A : AND.b #$03 : STA.l HeartPieceQuarter : BNE .unfinished_heart ; add up heart quarters - BRA .giveItem + CPY.b #$26 : BNE .notHeart ; don't add a 1/4 heart if it's not a heart piece + LDA.l HeartPieceQuarter : INC A : AND.b #$03 : STA.l HeartPieceQuarter : BNE .unfinished_heart ; add up heart quarters + BRA .giveItem - .notHeart + .notHeart + .giveItem + JSL.l $0791B3 ; Player_HaltDashAttackLong + JSL.l Link_ReceiveItem + CLC ; return false + JMP .done ; finished - .giveItem - JSL.l $0791B3 ; Player_HaltDashAttackLong - JSL.l Link_ReceiveItem - CLC ; return false - JMP .done ; finished + .unfinished_heart + SEC ; return true + .done + JSL MaybeUnlockTabletAnimation - .unfinished_heart - SEC ; return true - .done - - JSL MaybeUnlockTabletAnimation - - PLY : PLX + PLY : PLX RTL ;-------------------------------------------------------------------------------- HeartContainerGet: @@ -118,27 +116,6 @@ RTL CLC RTL ;-------------------------------------------------------------------------------- -HeartUpgradeSpawnDecision: ; this should return #$00 to make the hp spawn - LDA.l ForceHeartSpawn : BEQ .normal_behavior - - DEC : STA.l ForceHeartSpawn - LDA.b #$00 -RTL - - .normal_behavior - LDA.l OverworldEventDataWRAM, X -RTL -;-------------------------------------------------------------------------------- -SaveHeartCollectedStatus: - LDA.l SkipHeartSave : BEQ .normal_behavior - - DEC : STA.l SkipHeartSave -RTL - - .normal_behavior - LDA.l OverworldEventDataWRAM, X : ORA.b #$40 : STA.l OverworldEventDataWRAM, X -RTL -;-------------------------------------------------------------------------------- HeartPieceSpritePrep: PHA @@ -215,7 +192,7 @@ endmacro LoadIndoorValue: PHP REP #$20 ; set 16-bit accumulator - LDA.b $A0 ; these are all decimal because i got them that way + LDA.b RoomIndex ; these are all decimal because i got them that way CMP.w #225 : BNE + %GetPossiblyEncryptedItem(HeartPiece_Forest_Thieves, HeartPieceIndoorValues) JMP .done @@ -328,7 +305,7 @@ LoadHeartContainerRoomValue: LoadBossValue: PHP REP #$20 ; set 16-bit accumulator - LDA.b $A0 ; these are all decimal because i got them that way + LDA.b RoomIndex ; these are all decimal because i got them that way CMP.w #200 : BNE + %GetPossiblyEncryptedItem(HeartContainer_ArmosKnights, HeartContainerBossValues) JMP .done @@ -371,7 +348,7 @@ CheckIfBossRoom: ; Carry set if we're in a boss room, unset otherwise. ;-------------------------------------------------------------------------------- REP #$20 ; set 16-bit accumulator - LDA.b $A0 ; these are all decimal because i got them that way + LDA.b RoomIndex ; these are all decimal because i got them that way CMP.w #200 : BEQ .done CMP.w #51 : BEQ .done CMP.w #7 : BEQ .done diff --git a/hooks.asm b/hooks.asm index 8ea3609..2e0adb9 100755 --- a/hooks.asm +++ b/hooks.asm @@ -56,9 +56,12 @@ org $00FFB7 SoftwareInterrupt: JML Crashed -org $00FFE4 : dw SoftwareInterrupt -org $00FFE6 : dw SoftwareInterrupt -org $00FFF4 : dw SoftwareInterrupt +org $00FFE4 +dw SoftwareInterrupt +org $00FFE6 +dw SoftwareInterrupt +org $00FFF4 +dw SoftwareInterrupt ;================================================================================ ; Dungeon Entrance Hook (works, but not needed at the moment) @@ -197,8 +200,6 @@ org $00833A ; <- 0033A - Bank00.asm : 481 (LDA.w #$007F) LDA.w #$0180 ; change which character is used as the blank character for the select screen ;-------------------------------------------------------------------------------- org $0CD50C ; <- 6550C (Not in disassembly, would be in bank0c.asm if it were) Position table for Name and Hearts -;dw $0012, $0112, $0212 ; vanilla-ish positions of file names -;dw $0026, $0126, $0226 ; vanilla-ish positions of hearts names dw $00CC, $014A, $01CA ; repositioned, only the first value matters dw $002A, $0192, $0112 org $0CD53B ; <- 6553B : Bank0c.asm : 2919 (ADD.w #$0010 : STA $102C, Y) [... : STA $1034, Y] @@ -289,9 +290,7 @@ SKIP 7 : NOP #3 ; remove Clearing mirrored copy on file erase, instead clearing the extended save file too org $0CD4E3 ; <- Bank0C.asm : 2282 (STA $700400, X : STA $700F00, X : STA $701000, X : STA $701100, X) JSL.l ClearExtendedSaveFile -BRA + - NOP #18 -+ +BRA + : NOP #18 : + ;-------------------------------------------------------------------------------- ;================================================================================ @@ -305,7 +304,7 @@ JSL CopyExtendedWRAMSaveFileToSRAM ;-------------------------------------------------------------------------------- org $00899C ; <- bank_00.asm : #_00899C (CLC) JSL WriteSaveChecksumAndBackup -LDA.w #$01F3 : TCS : SEP #$30 : PLB : RTL ; Get the stack and data bank correct +PLA : SEP #$30 : PLB : RTL padbyte $FF : pad $0089C2 ; Fill adjacent free rom forward. See bank_00.asm: #_0089C2 ;-------------------------------------------------------------------------------- org $0CD7AB ; <- Bank0C.asm : 3342 (STA $700400, X) @@ -335,8 +334,7 @@ org $0CCE85 ; <- Bank0C.asm : 1953 (LDA $C8 : ASL A : INC #2 : STA $701FFE) NOP #4 ;-------------------------------------------------------------------------------- org $0CDB4C ; <- Bank0C.asm : 3655 (LDA $C8 : ASL A : INC #2 : STA $701FFE : TAX) -JML OnFileCreation -NOP +JML OnFileCreation : NOP ;-------------------------------------------------------------------------------- org $09F5EA ; <- module_death.asm : 510 (LDA $701FFE : TAX : DEX #2) LDA.w #$0002 : NOP @@ -351,7 +349,6 @@ LDA.w #$0002 : NOP org $068891 ; Sprite_Prep.asm : 378 //LDA .damage_class, Y : STA $0CD2, X nop #$08 JSL.l NewBatInit -;-------------------------------------------------------------------------------- ;================================================================================ ; Damage table Relocation from WRAM @@ -420,30 +417,25 @@ JML.l AllowStartFromExit AllowStartFromExitReturn: ;-------------------------------------------------------------------------------- org $1bc2a7 ; <- DC2A7 - Bank1B.asm : 1143 (Overworld_CreatePyramidHole:) -JSL.l Overworld_CreatePyramidHoleModified -RTL +JSL.l Overworld_CreatePyramidHoleModified : RTL C9DE_LONG: -JSR $C9DE ; surprisingly same address as US -RTL +JSR $C9DE : RTL ; surprisingly same address as US ;-------------------------------------------------------------------------------- org $07ff5f ; <- 3ff5f - Bank0E.asm : 5252 (LDA.w #$0E3F : STA $23BC) -JSL.l Draw_PyramidOverlay -RTS +JSL.l Draw_PyramidOverlay : RTS ;-------------------------------------------------------------------------------- ;Remove Electric Barrier Hook org $06891E ; <- sprite_prep.asm : 537 (LDA $7EF280, X : PLX : AND.b #$40 : BEQ .not_dead) JSL Electric_Barrier ;-------------------------------------------------------------------------------- org $08CDAC ; <- ancilla_break_tower_seal.asm : 117 (LDA.b #$05 : STA $04C6) -JSL GanonTowerAnimation -NOP #05 +JSL GanonTowerAnimation : NOP #05 ;-------------------------------------------------------------------------------- org $1AF5C1 ; <- sprite_waterfall.asm : 40 (LDA $8A : CMP.b #$43) JSL GanonTowerInvertedCheck ;-------------------------------------------------------------------------------- org $02EC8D ; <- bank02.asm : 11981 (LDA.w #$020F : LDX $8A : CPX.w #$0033 : BNE .noRock) -JSL HardcodedRocks -NOP #19 ;23 bytes removed with the JSL +JSL HardcodedRocks : NOP #19 ;23 bytes removed with the JSL ;-------------------------------------------------------------------------------- org $04E7AE ; <- bank0E.asm : 4230 (LDA $7EF287 : AND.w #$0020) JSL.l TurtleRockPegSolved @@ -463,9 +455,9 @@ PegProbability: db $00 ; Probability out of 255. 0 = Vanilla behavior TurtleRockTrollPegs: SEP #$20 - LDX.w $04C8 : CPX.w #$FFFF : BEQ .vanilla - JSL.l GetRandomInt - LDA.l PegProbability : BEQ .vanilla : CMP.l $7E0FA1 +LDX.w $04C8 : CPX.w #$FFFF : BEQ .vanilla +JSL.l GetRandomInt +LDA.l PegProbability : BEQ .vanilla : CMP.l $7E0FA1 REP #$20 : !BGE .succeed .fail JMP.w TurtleRockPegFail @@ -475,8 +467,7 @@ JMP.w TurtleRockPegSuccess REP #$20 : JMP.w TurtleRockPegCheck ;-------------------------------------------------------------------------------- org $1BBD05 ; <- bank1B.asm : 261 (TYA : STA $00) ; hook starts at the STA -JML.l PreventEnterOnBonk -NOP +JML.l PreventEnterOnBonk : NOP PreventEnterOnBonk_return: org $1BBD77 ; <- bank1B.asm : 308 (SEP #$30) PreventEnterOnBonk_BRANCH_IX: @@ -486,13 +477,11 @@ PreventEnterOnBonk_BRANCH_IX: ; Crystals Mode ;-------------------------------------------------------------------------------- org $099B7B ; <- ancilla_init.asm : 4136 (LDA $7EF37A : AND.b #$7F : CMP.b #$7F) -JSL.l CheckEnoughCrystalsForTower -NOP #4 +JSL.l CheckEnoughCrystalsForTower : NOP #4 db #$90 ; BCC ;-------------------------------------------------------------------------------- org $08CE0C ; <- 44E0C - ancilla_break_tower_seal.asm : 168 (BEQ #$03 : JSR BreakTowerSeal_ExecuteSparkles : LDX.b #$06) -JML.l GetRequiredCrystalsForTower -NOP #3 +JML.l GetRequiredCrystalsForTower : NOP #3 GetRequiredCrystalsForTower_continue: ;-------------------------------------------------------------------------------- org $08CF19 ; <- 44F19 - ancilla_break_tower_seal.asm : 336 (TXA : AND.b #$07 : TAX) @@ -507,12 +496,10 @@ db #$6B ;-------------------------------------------------------------------------------- org $0CCDB5 ; <- 64DB5 - Bank0C.asm : 1776 (LDA.b #$06 : STA $14) JSL.l OnPrepFileSelect -;-------------------------------------------------------------------------------- ;================================================================================ ; Light speed ;-------------------------------------------------------------------------------- - ; Message org $1ED4FF JSL AgahnimAsksAboutPed @@ -526,20 +513,11 @@ JSL CheckAgaForPed : NOP org $00F970 JSL KillGanon - - -;-------------------------------------------------------------------------------- - ;================================================================================ ; Zelda Sprite Fixes ;-------------------------------------------------------------------------------- org $05EBCF ; <- 2EBCF - sprite_zelda.asm : 23 (LDA $7EF359 : CMP.b #$02 : BCS .hasMasterSword) JSL.l SpawnZelda : NOP #2 -;NOP #8 -;-------------------------------------------------------------------------------- -;org $06C06F ; <- 3406F - Bank06.asm : 1794 (JSL Sprite_ZeldaLong) -;JSL.l SpawnZelda -;-------------------------------------------------------------------------------- ;================================================================================ ; Alternate Goal @@ -563,13 +541,7 @@ org $07A95B ; <- 3A95B - Bank07.asm : 6565 (JSL Dungeon_SaveRoomDataWRAM) JSL.l IncrementUWMirror ;-------------------------------------------------------------------------------- org $0288D1 ; <- 108D1 - Bank02.asm : 1690 (STZ $0646) -JSL.l IndoorSubtileTransitionCounter -NOP #2 -;-------------------------------------------------------------------------------- -;org $05FC7E ; <- 2FC7E - sprite_dash_item.asm : 118 (LDA $7EF36F : INC A : STA $7EF36F) -;JSL.l IncrementSmallKeys -;-------------------------------------------------------------------------------- -;org $06D18D ; <- 3518D - sprite_absorbable.asm : 274 (LDA $7EF36F : INC A : STA $7EF36F) +JSL.l IndoorSubtileTransitionCounter : NOP #2 org $06D192 ; <- 35192 - sprite_absorbable.asm : 274 (STA $7EF36F) JSL.l IncrementSmallKeysNoPrimary ;-------------------------------------------------------------------------------- @@ -607,10 +579,6 @@ JSL.l IncrementBigChestCounter ;================================================================================ ; Dialog Override ;-------------------------------------------------------------------------------- -;org $0EEE8D ; 0x76E8D <- vwf.asm : 152 (LDA $7F71C0, X : STA $04) -;JSL.l DialogOverride -;NOP #7 -;-------------------------------------------------------------------------------- org $0EF1FF ; 0x771FF <- vwf.asm : 1212 (LDA $7F1200, X : AND.w #$007F : SUB.w #$0066 : BPL .commandByte) JSL.l DialogOverride org $0EF2DC ; every other LDA $7F1200, X in vwf.asm @@ -641,20 +609,16 @@ org $0EFB11 JSL.l DialogOverride ;-------------------------------------------------------------------------------- org $0EFBC6 ; <- 77BC6 - vwf.asm : 2717 (LDA.b #$1C : STA $1CE9) -JSL.l ResetDialogPointer -RTS +JSL.l ResetDialogPointer : RTS ;-------------------------------------------------------------------------------- org $0EED0B ; <- PC 0x76D0B - Bank0E.asm : 3276 (LDA $E924, Y : STA $1008, X) -JSL.l EndingSequenceTableOverride -NOP #2 +JSL.l EndingSequenceTableOverride : NOP #2 ;-------------------------------------------------------------------------------- org $0EED15 ; <- PC 0x76D15 - Bank0E.asm : 3282 (LDA $E924, Y : STA $1008, X) -JSL.l EndingSequenceTableOverride -NOP #2 +JSL.l EndingSequenceTableOverride : NOP #2 ;-------------------------------------------------------------------------------- org $0EED2A ; <- PC 0x76D2A - Bank0E.asm : 3295 (LDA $E924, Y : AND.w #$00FF) -JSL.l EndingSequenceTableLookupOverride -NOP #2 +JSL.l EndingSequenceTableLookupOverride : NOP #2 ;-------------------------------------------------------------------------------- ;================================================================================ @@ -675,7 +639,6 @@ NOP #3 ;-------------------------------------------------------------------------------- org $0CCC89 ; <- 0x64C89 Bank0C.asm : 1598 (JSL EnableForceBlank) JSL.l OnInitFileSelect -;-------------------------------------------------------------------------------- ;================================================================================ ; Hyrule Castle Rain Sequence Guards (allowing Gloves in Link's house) @@ -692,15 +655,12 @@ db $06, $1F, $40, $12, $01, $3F, $14, $01, $3F, $13, $1F, $42, $1A, $1F, $4B, $1 ;-------------------------------------------------------------------------------- org $05DFB1 ; <- 2DFB1 - Bank05.asm : 2499 JSL.l SkipDrawEOR -;-------------------------------------------------------------------------------- ;================================================================================ ; Kiki Big Bomb Fix ;-------------------------------------------------------------------------------- org $1EE4AF ; <- f64af sprite_kiki.asm : 285 (LDA.b #$0A : STA $7EF3CC) -JSL.l AssignKiki -NOP #2 -;-------------------------------------------------------------------------------- +JSL.l AssignKiki : NOP #2 ;================================================================================ ; Wallmaster camera fix @@ -737,11 +697,7 @@ org $029E2E ; <- 11E2E - module_ganon_emerges.asm : 59 (JSL Dungeon_SaveRoomData JSL.l OnAga2Defeated ;-------------------------------------------------------------------------------- org $0DDBDE ; <- 6DBDE - headsup_display.asm : 105 (DEC A : BPL .subtractRupees) -JSL.l IncrementSpentRupees -NOP #6 -;org $0DDBF7 ; <- 6DBF7 - headsup_display.asm : 121 (STA $7EF362) -;RefillLogic_subtractRupees: -;-------------------------------------------------------------------------------- +JSL.l IncrementSpentRupees : NOP #6 ;================================================================================ ; Remove Item Menu Text @@ -751,24 +707,22 @@ JMP DrawItem_finished org $0DECE6 ; <- 6ECE6 - equipment.asm : 1934 (SEP #$30) DrawItem_finished: org $0DEB48 ; <- 6EB48 - equipment.asm : 1784 (LDA $0000) -LDA $0000, Y : STA $11F2 -LDA $0002, Y : STA $11F4 -LDA $0040, Y : STA $1232 -LDA $0042, Y : STA $1234 +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 ;--------------------------- org $0DE24B ; <- 6E24B - equipment.asm : 951 (LDA $0000) -LDA $0000, Y : STA $11F2 -LDA $0002, Y : STA $11F4 -LDA $0040, Y : STA $1232 -LDA $0042, Y : STA $1234 +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 ;-------------------------------------------------------------------------------- org $0DE2DC ; <- 6E2DC - equipment.asm : 989 (LDA $F449, X : STA $122C, Y) JMP UpdateBottleMenu_return org $0DE2F1 ; <- 6E2F1 - equipment.asm : 1000 (SEP #$30) UpdateBottleMenu_return: ;-------------------------------------------------------------------------------- -;org $0DDDC3 ; <- 6DDC3 - equipment.asm : 131 (JSR DrawAbilityText) -;NOP #3 org $0DE6F4 ; <- 6E6F4 - equipment.asm : 1474 (BCC .lacksAbility) db #$80 ; BRA org $0DE81A ; <- 6E81A - equipment.asm : 1597 (STA $00) @@ -781,28 +735,12 @@ org $0DE7E5 ; <- 6E7E5 - equipment.asm : 1560 (LDA.w #$16D8 : STA $00) JSL.l DrawFlippersInMenuLocation : NOP org $0DECEB ; <- 6ECEB - equipment.asm : 1946 (LDA.w #$16E0 : STA $00) JSL.l DrawMoonPearlInMenuLocation : NOP -;-------------------------------------------------------------------------------- -;org $0DE9D8 ; <- 6E9D8 - equipment.asm : 1635 (LDA $E860, X : STA $12EA, X) -;BRA DrawProgressIcons_initPendantDiagram_notext -;org $0DEA0E ; <- 6EA0E - equipment.asm : 1645 (INX #2) -;DrawProgressIcons_initPendantDiagram_notext: -;-------------------------------------------------------------------------------- - -;================================================================================ -; Map Always Zoomed -;-------------------------------------------------------------------------------- -;org $0ABA49 ; <- 53A49 - Bank0A.asm : 447 (LDA.b #$80 : STA $211A) -;JSL.l PrepMapZoom : RTL -;org $0ABB32 ; <- 53B32 - Bank0A.asm : 626 (LDA $F6 : AND.b #$70) -;JSL.l ForceMapZoom -;-------------------------------------------------------------------------------- ;================================================================================ ; Zelda S&Q Mirror Fix ;-------------------------------------------------------------------------------- org $02D9A4 ; <- 159A4 - Bank02.asm : 11077 (dw $0000, $0002, $0002, $0032, $0004, $0006, $0030) dw $0000, $0002, $0004, $0032, $0004, $0006, $0030 -;-------------------------------------------------------------------------------- ;================================================================================ ; Accessibility @@ -847,7 +785,6 @@ JSL.l LoadElectroPalette ;-------------------------------------------------------------------------------- org $07997C ; <- 03997C - Bank07.asm : 4015 (JSL LoadActualGearPalettes) JSL.l RestoreElectroPalette -;-------------------------------------------------------------------------------- ;================================================================================ ; Ice Floor Toggle @@ -857,7 +794,6 @@ JSL.l LoadModifiedIceFloorValue_a11 : NOP ;-------------------------------------------------------------------------------- org $07D26E ; <- 3D26E - Bank07.asm : 12786 (LDA $0348 : AND.b #$01 : BNE BRANCH_RESH) JSL.l LoadModifiedIceFloorValue_a01 : NOP -;-------------------------------------------------------------------------------- ;================================================================================ ; Sword Upgrade Randomization @@ -878,8 +814,7 @@ org $068A14 ; <- 30A14 - sprite_prep.asm : 716 NOP #8 ; fix bomb shop spawn for dwarfless big bomb ;-------------------------------------------------------------------------------- org $06B489 ; <- 33489 - sprite_smithy_bros.asm : 473 (LDA $7EF359 : CMP.b #$03 : BCS .tempered_sword_or_better) -JML.l GetSmithSword -NOP #4 +JML.l GetSmithSword : NOP #4 Smithy_DoesntHaveSword: org $06B49D ; <- 3349D - sprite_smithy_bros.asm : 485 (.tempered_sword_or_better) Smithy_AlreadyGotSword: @@ -892,10 +827,6 @@ NOP #5 ; remove spooky telepathy sound ;-------------------------------------------------------------------------------- org $08C431 ; <- 44431 - ancilla_receive_item.asm : 125 (LDA $0C5E, X : CMP.b #$01 : BNE .notMasterSword2) JSL.l MSMusicReset : NOP -;LDA $8A : CMP.b #$80 : NOP -; $22 = $0000 - $00FF - MS Pedestal -; $22 = $0100 - $00FF - Hobo -;-------------------------------------------------------------------------------- ;================================================================================ ; Temporary Nerfs and Buffs @@ -923,7 +854,6 @@ JSL.l LoadModifiedMagicLevel : !ADD.w LinkItem_MagicCostBaseIndices, X ;-------------------------------------------------------------------------------- org $07B0D5 ; <- 3B0D5 - Bank07.asm : 7783 (LDA LinkItem_MagicCostBaseIndices, X : CLC : ADC $7EF37B : TAX) JSL.l LoadModifiedMagicLevel : !ADD.w LinkItem_MagicCostBaseIndices, X -;-------------------------------------------------------------------------------- ;================================================================================ ; Faster Great Fairies @@ -935,14 +865,12 @@ org $06C896 ; <- sprite_ponds.asm : 844 ( LDA $1A : AND.b #$07 : BNE BRANCH_ALPH db $03 ; fade in speed. Should be power of 2 minus 1 org $06C985 ; <- sprite_ponds.asm : 1025 ( LDA $1A : AND.b #$07 : BNE BRANCH_ALPHA ) db $03 ; fade out speed. Should be power of 2 minus 1 -;-------------------------------------------------------------------------------- ;================================================================================ ; New Items ;-------------------------------------------------------------------------------- org $07B574 ; <- 3B574 - Bank07.asm : 8519 (LDA.b #$01 : STA $02E9) -JSL.l ChestPrep -NOP #3 +JSL.l ChestPrep : NOP #3 db $90 ; !BCC .cantOpen ;-------------------------------------------------------------------------------- org $00D531 ; 5531 - Bank00.asm:3451 (LDY.b #$5D) @@ -952,8 +880,7 @@ org $00D547 ; 5547 - Bank00.asm:3467 (JSR Decomp_spr_high) GetAnimatedSpriteGfxFile_return: org $00D557 ; 5557 - Bank00.asm:3486 (LDA $00 : ADC $D469, X) -JSL.l GetAnimatedSpriteBufferPointer -NOP +JSL.l GetAnimatedSpriteBufferPointer : NOP org $0799F7 ; 399F7 - Bank07.asm:4107 (JSL AddReceivedItem) JSL.l AddReceivedItemExpanded @@ -1004,12 +931,10 @@ org $08C70F ; 4470F - ancilla_receive_item.asm : 582 - (LDA.b #$00 : STA ($92), JSL.l LoadNarrowObject org $0985ED ; 485ED - ancilla_init.asm:693 (LDA $02E9 : CMP.b #$01) -JSL.l AddReceivedItemExpandedGetItem -NOP +JSL.l AddReceivedItemExpandedGetItem : NOP org $07B57D ; 3B57D - Bank07.asm:8527 (LDA Link_ReceiveItemAlternates, Y : STA $03) -JSL.l Link_ReceiveItemAlternatesExpanded_loadAlternate -NOP +JSL.l Link_ReceiveItemAlternatesExpanded_loadAlternate : NOP ;-------------------------------------------------------------------------------- org $09892E ; 4892E - ancilla_init.asm:1307 (LDA BottleList, X) LDA.w BottleListExpanded, X @@ -1019,7 +944,6 @@ LDA.w PotionListExpanded, X ;-------------------------------------------------------------------------------- org $06D1EB ; 351EB - sprite_absorbable.asm:364 (STA $7EF375) ; bugbug commented out until i figure out why it doesn't work JSL HandleBombAbsorbtion -;-------------------------------------------------------------------------------- ;================================================================================ ; Kholdstare Shell Fix @@ -1028,9 +952,7 @@ org $00EC88 ; <- 6C88 - Bank00.asm:6671 - (LDA $7EC380, X : STA $7EC580, X) LDA $7EC3A0, X : STA $7EC5A0, X ;-------------------------------------------------------------------------------- org $00ECEB ; <- 6CEB - Bank00.asm:6730 - (LDX.w #$0080) -LDX.w #$00A0 -LDA.w #$00B0 -;-------------------------------------------------------------------------------- +LDX.w #$00A0 : LDA.w #$00B0 ;================================================================================ ; Potion Refill Fixes @@ -1046,14 +968,12 @@ JSL.l RefillHealth ;-------------------------------------------------------------------------------- org $00F922 ; <- 7922 - Bank00.asm:8543 - (JSL HUD.RefillMagicPower : BCC .beta) JSL.l RefillMagic -;-------------------------------------------------------------------------------- ;================================================================================ ; Early Bottle Fix ;-------------------------------------------------------------------------------- org $09894C ; <- 4894C - ancilla_init.asm:1327 JSL.l InitializeBottles -;-------------------------------------------------------------------------------- ;================================================================================ ; Agahnim Doors Fix @@ -1069,8 +989,7 @@ Overworld_Entrance_BRANCH_EPSILON: ; go here to lock doors ;-------------------------------------------------------------------------------- ; -- HOOK THIS LATER TO FUCK WITH BOSS DROPS -- org $01C73E ; <- C73E - Bank01.asm : 10377 (LDA $01C6FC, X : JSL Sprite_SpawnFallingItem) -JSL.l DropSafeDungeon -NOP #4 +JSL.l DropSafeDungeon : NOP #4 ;-------------------------------------------------------------------------------- ;================================================================================ @@ -1097,17 +1016,13 @@ db #$1E ; Bomb & Arrow Capacity Updates ;-------------------------------------------------------------------------------- org $0DDC27 ; <- 6DC27 - headsup_display.asm:151 (LDA $7EF370 : TAY) -JSL.l IncrementBombs -NOP #15 +JSL.l IncrementBombs : NOP #15 ;-------------------------------------------------------------------------------- org $0DDC49 ; <- 6DC49 - headsup_display.asm:169 (LDA $7EF371 : TAY) -JSL.l IncrementArrows -NOP #15 +JSL.l IncrementArrows : NOP #15 ;-------------------------------------------------------------------------------- org $1EE199 ; <- F6199 - sprite_bomb_shop_entity.asm:102 (LDA $7EF370 : PHX : TAX) -JSL.l CompareBombsToMax -NOP #11 -;-------------------------------------------------------------------------------- +JSL.l CompareBombsToMax : NOP #11 ;================================================================================ ; Bonk Items @@ -1122,7 +1037,6 @@ JSL.l LoadBonkItemGFX ;-------------------------------------------------------------------------------- org $05FC04 ; <- 2FC04 - sprite_dash_item.asm : 38 - (JSL DashKey_Draw) JSL.l DrawBonkItemGFX -;-------------------------------------------------------------------------------- ;================================================================================ ; Library Item @@ -1138,7 +1052,6 @@ JSL.l DrawLibraryItemGFX ;-------------------------------------------------------------------------------- org $068D0E ; <- 30D0E - sprite_prep.asm : 1401 - (LDA $7EF34E : BEQ .book_of_mudora) JSL.l ItemCheck_Library -;-------------------------------------------------------------------------------- ;================================================================================ ; Inventory Updates @@ -1162,8 +1075,7 @@ org $0DEB98 ; <- 6EB98 - equipment.asm : 1803 LDA.w #$3C60 : STA $FFBE, Y ORA.w #$8000 : STA $007E, Y ORA.w #$4000 : STA $0084, Y -JSL.l AddYMarker -NOP #2 +JSL.l AddYMarker : NOP #2 ;-------------------------------------------------------------------------------- org $0DF789+6 ; <- 6F789+6 (not in disassembly) - red bottle hud tile, lower right dw #$2413 ; (Orig: #$24E3) @@ -1193,8 +1105,7 @@ org $0DDE3D ; <- 6DE3D equipment.asm:217 - BNE .equippedItemIsntBottle db $80 ; BRA ;-------------------------------------------------------------------------------- org $0DDF9A ; <- 6DF9A - equipment.asm : 554 -JSL.l OpenBottleMenu -NOP +JSL.l OpenBottleMenu : NOP ;-------------------------------------------------------------------------------- org $0DE12D ; <- 6E12D - equipment.asm : 828 JSL.l CloseBottleMenu @@ -1203,32 +1114,26 @@ org $0DDF1E ; <- 6DF1E - equipment.asm : 462 - LDA $F4 : AND.b #$10 : BEQ .dontL JSL.l CheckCloseItemMenu ;-------------------------------------------------------------------------------- org $0DEE70 ; <- 6EE70 - equipment.asm : 2137 -JSL.l PrepItemScreenBigKey -NOP +JSL.l PrepItemScreenBigKey : NOP ;-------------------------------------------------------------------------------- org $08D395 ; <- 45395 - ancilla_bird_travel_intro.asm : 253 -JSL.l UpgradeFlute -NOP #2 +JSL.l UpgradeFlute : NOP #2 ;-------------------------------------------------------------------------------- org $05E4D7 ; <- 2E4D7 - sprite_witch.asm : 213 -JSL.l RemoveMushroom -NOP #2 +JSL.l RemoveMushroom : NOP #2 ;-------------------------------------------------------------------------------- org $05F55F ; <- 2F55F - sprite_potion_shop.asm : 59 JSL.l LoadPowder ;-------------------------------------------------------------------------------- org $05F681 ; <- 2F681 - sprite_potion_shop.asm : 234 -JSL.l DrawPowder -RTS +JSL.l DrawPowder : RTS NOP #8 ;-------------------------------------------------------------------------------- org $05F65D ; <- 2F65D - sprite_potion_shop.asm : 198 -JSL.l CollectPowder -NOP #5 +JSL.l CollectPowder : NOP #5 ;-------------------------------------------------------------------------------- org $05EE5F ; <- 2EE5F - sprite_mushroom.asm : 30 -JSL.l LoadMushroom -NOP +JSL.l LoadMushroom : NOP ;-------------------------------------------------------------------------------- org $05EE78 ; <- 2EE78 - sprite_mushroom.asm : 58 JSL.l DrawMushroom @@ -1249,7 +1154,6 @@ _Bank07_5726: ;-------------------------------------------------------------------------------- org $079A0E ; 39A0E - Bank07.asm : 4117 - JSL HUD.RefreshIconLong JSL.l Link_ReceiveItem_HUDRefresh -;-------------------------------------------------------------------------------- ;================================================================================ ; Swordless Mode @@ -1271,7 +1175,6 @@ 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 @@ -1286,14 +1189,12 @@ org $07859F ; <- 3859F - Bank07.asm : 965 (JSL AddPendantOrCrystal) JSL SpawnTabletItem org $07862A ; <- 3862A - Bank07.asm : 1064 (JSL AddPendantOrCrystal) JSL SpawnTabletItem -;-------------------------------------------------------------------------------- ;================================================================================ ; Medallion Entrances ;-------------------------------------------------------------------------------- org $08B504 ; <- 43504 - ancilla_bombos_spell.asm : 671 -JSL.l MedallionTrigger_Bombos -NOP +JSL.l MedallionTrigger_Bombos : NOP ;-------------------------------------------------------------------------------- org $08ACC8 ; <- 42CC8 - ancilla_ether_spell.asm : 350 JSL.l MedallionTrigger_Ether @@ -1311,7 +1212,6 @@ RTL warnpc $08B708 org $08B708 ; <- 43708 - ancilla_quake_spell.asm : 83 _ancilla_quake_spell_83: -;-------------------------------------------------------------------------------- ;================================================================================ ; Animated Entrances @@ -1322,18 +1222,15 @@ BNE + RTL NOP #2 + -;-------------------------------------------------------------------------------- ;================================================================================ ; Big & Great Fairies ;-------------------------------------------------------------------------------- org $1DC475 ; <- EC475 - sprite_big_fairie.asm : 70 (LDA.w #$00A0 : ADD $7EF372 : STA $7EF372) -JSL.l RefillHealthPlusMagic -NOP #8 +JSL.l RefillHealthPlusMagic : NOP #8 org $1DC489 ; <- EC489 - sprite_big_fairie.asm : 88 (LDA $7EF36D : CMP $7EF36C : BNE .player_hp_not_full_yet) -NOP #4 -JSL.l CheckFullHealth +NOP #4 : JSL.l CheckFullHealth ;-------------------------------------------------------------------------------- ;================================================================================ @@ -1439,8 +1336,7 @@ JSL.l RNG_Enemy_Drops ; HUD Changes ;-------------------------------------------------------------------------------- org $0DFC4C ; <- 6FC4C - headsup_display.asm : 836 (LDA $7EF36E : AND.w #$00FF : ADD.w #$0007 : AND.w #$FFF8 : TAX) -JML.l OnDrawHud -NOP #197 +JML.l OnDrawHud : NOP #197 ReturnFromOnDrawHud: SEP #$30 LDX.b #$FF ; vanilla hud code ends with #$FF in X, and it's required for unknown reasons. @@ -1466,44 +1362,33 @@ LDX.w #HUD_TileMap org $0DFA9C ; <- 6FA9C - headsup_display.asm : 629 (MVN $0D, $7E ; $Transfer 0x014A bytes from $6FE77 -> $7EC700) MVN $217E ;-------------------------------------------------------------------------------- -;org $0DE48E ; <- 6E48E - equipment.asm : 1233 (LDA.w #$11CE : STA $00) - HOOK HERE TO DRAW ON THE ITEM SCREEN -;JSL.l DrawHUDDungeonItems -;NOP -;-------------------------------------------------------------------------------- org $0DFB1F ; 6FB1F - headsup_display.asm : 681 (LDA $7EF340 : BEQ .hastNoBow) JSL.l CheckHUDSilverArrows -;-------------------------------------------------------------------------------- ;================================================================================ ; 300 Rupee NPC ;-------------------------------------------------------------------------------- org $1EF060 ; <- F7060 - sprite_shopkeeper.asm:242 (INC $0D80, X) -JSL.l Set300RupeeNPCItem -NOP -;-------------------------------------------------------------------------------- +JSL.l Set300RupeeNPCItem : NOP ;================================================================================ ; Glitched Mode Fixes ;-------------------------------------------------------------------------------- org $0691AC ; <- 311AC - sprite_prep.asm:2453 (LDY $0FFF) -JSL.l GetAgahnimPalette -NOP #2 +JSL.l GetAgahnimPalette : NOP #2 ;-------------------------------------------------------------------------------- org $06F0DD ; <- 370DD - Bank06.asm:5399 (STA $0BA0, X) -JSL.l GetAgahnimDeath -NOP #2 +JSL.l GetAgahnimDeath : NOP #2 ;-------------------------------------------------------------------------------- org $1ED4E6 ; <- F54E6 - sprite_agahnim.asm:314 (LDY $0FFF) -JSL.l GetAgahnimType -NOP #2 +JSL.l GetAgahnimType : NOP #2 ;-------------------------------------------------------------------------------- org $1ED577 ; <- F5577 - sprite_agahnim.asm:418 (PHX) JML.l GetAgahnimSlot GetAgahnimSlotReturn: ;-------------------------------------------------------------------------------- org $1ED678 ; <- F5678 - sprite_agahnim.asm:587 (INC $0E30, X) -NOP #2 -JSL.l GetAgahnimLightning +NOP #2 : JSL.l GetAgahnimLightning ;-------------------------------------------------------------------------------- org $0287E0 ; <- 107E0 - Bnak02.asm:1507 (LDA $0112 : ORA $02E4 : ORA $0FFC : BEQ .allowJoypadInput) JSL.l AllowJoypadInput : NOP #5 @@ -1513,7 +1398,6 @@ JSL.l AllowJoypadInput : NOP #5 ;-------------------------------------------------------------------------------- org $05FBD3 ; <- 2FBD3 - sprite_mad_batter.asm:209 - (STA $7EF37B) JSL.l GetMagicBatItem -;-------------------------------------------------------------------------------- ;================================================================================ ; MSU Music @@ -1551,9 +1435,6 @@ JML FanfarePreload : NOP org $09F2A7 ; <- 8F27C27E - module_death.asm:56 (STA $7EC227) JSL.l StoreMusicOnDeath -org $0CC100 ; <- A511 C904 - Bank0C.asm:07 (LDA $11 : CMP.b #$04) -;JSL.l StartupWait - org $0EE6EC ; <- E220 A922 - Bank0E.asm:2892 (SEP #$20 : LDA.b #$22 : STA $012C) JSL.l EndingMusicWait @@ -1569,7 +1450,6 @@ dw MusicControl org $0CF05F dw MusicControl -;-------------------------------------------------------------------------------- ;================================================================================ ; Replacement Shopkeeper @@ -1581,28 +1461,24 @@ ShopkeeperFinishInit: org $1EEEE3 ; <- F6EE3 - sprite_shopkeeper.asm:7 - (LDA $0E80, X) JSL.l Sprite_ShopKeeper : RTS : NOP ShopkeeperJumpTable: -;-------------------------------------------------------------------------------- ;================================================================================ ; Tile Target Loader ;-------------------------------------------------------------------------------- org $00D55E ; <- 555E - Bank00.asm:3491 (LDX.w #$2D40) JSL.l LoadModifiedTileBufferAddress : NOP #2 -;-------------------------------------------------------------------------------- ;================================================================================ ; Permabunny Fix ;-------------------------------------------------------------------------------- org $078F32 ; <- 38F32 - Bank07.asm:2420 - (LDA $7EF357) JSL.l DecideIfBunny ; for bunny beams -;-------------------------------------------------------------------------------- ;================================================================================ ; Other bunny Fixes ;-------------------------------------------------------------------------------- org $029E7C; <- 11E7C - module_ganon_emerges.asm:127 - (LDA.b #$09 : STA $012C) JSL.l FixAga2Bunny : NOP -;-------------------------------------------------------------------------------- ;================================================================================ ; Open Mode Fixes @@ -1615,7 +1491,6 @@ JSL.l EndRainState : NOP #2 ;-------------------------------------------------------------------------------- org $05DF49 ; <- 2DF49 - sprite_uncle_and_priest.asm:984 - (JSL Link_ReceiveItem) JSL.l OnUncleItemGet -;-------------------------------------------------------------------------------- ;================================================================================ ; Generic Keys @@ -1643,21 +1518,18 @@ JSL.l HUDRebuildIndoor : NOP #4 ;-------------------------------------------------------------------------------- org $029A35 ; <- 11A35 : Bank02.asm:4789 - (JSL HUD.RebuildIndoor.palace) JSL.l HUDRebuildIndoorHole -;-------------------------------------------------------------------------------- ;================================================================================ ; Pendant / Crystal Fixes ;-------------------------------------------------------------------------------- ;================================================================================ org $098BB0 ; <- 048BB0 - ancilla_init.asm:1663 - (STX $02D8 : JSR AddAncilla) -JSL.l TryToSpawnCrystalUntilSuccess -NOP +JSL.l TryToSpawnCrystalUntilSuccess : NOP org $01C74B ; <- 00C74B - bank01.asm:10368 - (STZ $AE, X) NOP #2 ; this STZ is what makes the crystal never spawn if it fails to spawn on the first try ;================================================================================ org $0DE9C8 ; <- 6E9C8 - equipment.asm:1623 - (LDA $7EF3C5 : CMP.b #$03 : BCC .beforeAgahnim) JSL.l DrawPendantCrystalDiagram : RTS -;NOP #11 ;================================================================================ org $0DEDCC ; <- 6EDCC - equipment.asm:2043 - (LDA $040C : AND.w #$00FF : CMP.w #$00FF : BNE .inSpecificDungeon) JSL.l ShowDungeonItems : NOP #5 @@ -1676,8 +1548,7 @@ JSL.l FlipLWDWFlag : NOP #6 ;================================================================================ org $02B15C ; <- 1315C - Bank02.asm:7672 - (LDA $7EF3CA : EOR.b #$40 : STA $7EF3CA) JSL.l IncrementOWMirror -JSL.l FlipLWDWFlag -NOP #2 +JSL.l FlipLWDWFlag : NOP #2 ;================================================================================ ;Clear level to open doors org $01C50D ; 0xC50D - Bank01.asm:10032 - (LDA $7EF3CA : BNE .inDarkWorld) @@ -1766,12 +1637,12 @@ NOP #8 ;================================================================================ org $028B8F ; <- 10B8F - Bank02.asm:2236 (LDA $7EF374 : LSR A : BCS BRANCH_BETA) JSL CheckHeraBossDefeated : BNE + : NOP -LDX.b #$F1 : STX $012C +LDX.b #$F1 : STX.w $012C + ;================================================================================ org $029090 ; <- 11090 - Bank02.asm:3099 (LDA $7EF374 : LSR A : BCS BRANCH_GAMMA) JSL CheckHeraBossDefeated : BNE + : NOP -STX $012C ; DON'T MOVE THIS FORWARD OR MADNESS AWAITS +STX.w $012C ; DON'T MOVE THIS FORWARD OR MADNESS AWAITS + ;================================================================================ org $029798 ; <- 11798 - Bank02.asm:4287 (CMP $02895C, X : BNE BRANCH_ALPHA) @@ -1781,9 +1652,6 @@ NOP #6 ; remove crystal room cutscene check that causes softlocks ;================================================================================ ; Text Changes ;-------------------------------------------------------------------------------- -;org $06C7D3 ; <- 347D3 - sprite_ponds.asm:720 (LDA.b #$8A) -;JSL.l DialogFairyThrow -;-------------------------------------------------------------------------------- org $06C7BB ; <- 347BB - sprite_ponds.asm:702 (JSL Sprite_ShowMessageFromPlayerContact : BCC BRANCH_ALPHA) JSL.l FairyPond_Init ;-------------------------------------------------------------------------------- @@ -1841,10 +1709,6 @@ org $05FA8E Sprite_ShowMessageMinimal: JML.l Sprite_ShowMessageMinimal_Alt ;-------------------------------------------------------------------------------- -;org $1CFD69 -;Main_ShowTextMessage: -;JML.l Main_ShowTextMessage_Alt -;-------------------------------------------------------------------------------- org $07b0cc ; <- 3b0d0 - Bank 07.asm : 7767 (JSL Main_ShowTextMessage) JSL.l Main_ShowTextMessage_Alt ;-------------------------------------------------------------------------------- @@ -1870,7 +1734,7 @@ org $1ECD39 SkipCrystalPalette: ;-------------------------------------------------------------------------------- org $08C3FD ; <- 443FD - ancilla_receive_item.asm : 89 -LDA.b #$40 : STA.l MSReceived +BRA + : NOP #4 : + ;-------------------------------------------------------------------------------- org $08C5E5 ; <- 445ED - ancilla_receive_item.asm:395 (LDA .item_messages, Y : CMP.w #$FFFF : BEQ .handleGraphics) JSL.l DialogItemReceive : NOP #2 @@ -1888,12 +1752,10 @@ JSL.l DialogResetSelectionIndex ;-- Agahnim 1 Defeated org $068475 ; <- 30475 Bank06.asm : 762 - (JSL Sprite_ShowMessageMinimal) JSL.l AddInventory_incrementBossSwordLong -;NOP #4 ;---------------------------------------------------------- ;-- We'll take your sword org $06B4F3 ; <- 334F3 sprite_smithy_bros.asm : 556 (JSL Sprite_ShowMessageUnconditional) JSL ItemSet_SmithSword -;NOP #4 ;---------------------------------------------------------- ;=================================== @@ -1914,24 +1776,10 @@ dw $1BD8, $16FC, $0001, $0122, $00F0 ; Blind (maiden) "don't take me outside!" dw $1520, $167C, $0001, $0122, $00F0 ; Blind (maiden) "don't take me outside!" dw $05AC, $04FC, $0001, $0027, $00F0 ; Zelda in the water room ;---------------------------------------------------------- -;---------------------------------------------------------- -;-- Speed up Walls (Desert, Mire, and Palace of Darkness) -; org $01CA66 ; <- CA66 Bank01.asm : 10864 - (LDA.w #$2200 : ADD $041C : STA $041C) -; LDA.w #$4400 ; #$2200 is the normal speed, $#FF00 is max. -;---------------------------------------------------------- ;-- New Sign table offet calculation org $07b4fe ; <- 3b4fe - bank07.asm : 8454 (LDA $8A : ASL A : TAY) JSL CalculateSignIndex -;================================================================================ -; Ganon Fixes -;-------------------------------------------------------------------------------- -;org $1D91E3 ; <- E91E3 - sprite_ganon.asm : 778 -;JSL.l GanonWarpRNG -;NOP #2 -;LDA #$00 : NOP #4 -;-------------------------------------------------------------------------------- - ;================================================================================ ; Dark World Spawn Location Fix & Follower Fixes ;-------------------------------------------------------------------------------- @@ -1943,8 +1791,7 @@ JSL.l OnFileLoad ;-------------------------------------------------------------------------------- org $09F520 ; <- 4F520 - module_death.asm : 401 (LDA $7EF3C5 : CMP.b #$03 : BCS BRANCH_THETA) JSL.l OnPlayerDead -JSL.l IncrementDeathCounter -NOP #6 +JSL.l IncrementDeathCounter : NOP #6 ;-------------------------------------------------------------------------------- org $1ED379 ; <- F5379 - sprite_agahnim.asm:75 - JSL PrepDungeonExit JSL FixAgahnimFollowers @@ -1960,12 +1807,10 @@ org $08C45F ; <- 4445F - ancilla_recieve_item.asm:157 (STZ $02E9) JSL.l PostItemAnimation : NOP #2 ;-------------------------------------------------------------------------------- org $1EE90A ; <- F690A -JSL.l ItemCheck_OldMan -NOP #2 +JSL.l ItemCheck_OldMan : NOP #2 ;-------------------------------------------------------------------------------- org $0280F2 ; <- 100F2 -JSL.l ItemCheck_OldMan -NOP #2 +JSL.l ItemCheck_OldMan : NOP #2 ;-------------------------------------------------------------------------------- org $1EE9FE ; <- F69FE JSL.l ItemSet_OldMan @@ -1977,8 +1822,7 @@ org $059ACA ; <- 29ACA JSL $1DE1AA ; Sprite_SpawnFlippersItem ;-------------------------------------------------------------------------------- org $1DE1E4 ; <- EE1E4 - sprite_great_catfish.asm : 489 -JSL.l LoadZoraKingItemGFX -NOP #2 +JSL.l LoadZoraKingItemGFX : NOP #2 ;-------------------------------------------------------------------------------- org $068D86 ; <- 30D86 JSL.l ItemCheck_SickKid @@ -1990,25 +1834,20 @@ org $068BAC ; <- 30BAC - SpritePrep_FluteBoy : 1068 JSL.l ItemCheck_TreeKid2 org $06908D ; <- 3108D - SpritePrep_FluteBoy : 2175 -JSL.l ItemCheck_TreeKid -CMP.b #$08 -BEQ $0A +JSL.l ItemCheck_TreeKid : CMP.b #$08 : BEQ $0A org $069095 ; <- 31095 - SpritePrep_FluteBoy : 2177 -JSL.l ItemCheck_TreeKid -CMP.b #$08 +JSL.l ItemCheck_TreeKid : CMP.b #$08 org $0690BD ; <- 310BD - SpritePrep_FluteBoy : 2202 JSL.l ItemCheck_TreeKid2 org $06AF9B ; <- 32F9B - FluteBoy_Chillin : 73 : LDA $7EF34C : CMP.b #$02 : BCS .player_has_flute -;NOP #8 LDA HasGroveItem : AND.b #$01 db #$D0 ; BNE org $06B062 ; <- 33062 - FluteAardvark_InitialStateFromFluteState : 225 : LDA $7EF34C : AND.b #$03 : !BGE #$05 -JSL.l ItemCheck_TreeKid2 -NOP #$02 ; remove pointless AND +JSL.l ItemCheck_TreeKid2 : NOP #$02 ; remove pointless AND org $06B048 ; <- 33048 JSL.l ItemCheck_TreeKid3 @@ -2035,8 +1874,7 @@ org $1DE11C ; <- EE11C JSL.l ItemCheck_Catfish ;-------------------------------------------------------------------------------- org $1DE1A1 ; <- EE1A1 - sprite_great_catfish.asm : 445 -JSL.l LoadCatfishItemGFX -NOP #2 +JSL.l LoadCatfishItemGFX : NOP #2 ;-------------------------------------------------------------------------------- org $1DDF49 ; <- EDF49 - sprite_great_catfish.asm : 19 JML.l JumpToSplashItemTarget : NOP @@ -2051,16 +1889,13 @@ org $1DDF81 ; <- EDF81 - sprite_great_catfish.asm : 61 JSL.l DrawThrownItem ;-------------------------------------------------------------------------------- org $05EE53 ; <- 2EE53 - mushroom.asm : 22 -JSL.l ItemCheck_Mushroom -NOP #2 +JSL.l ItemCheck_Mushroom : NOP #2 ;-------------------------------------------------------------------------------- org $05EE8C ; <- 2EE8C - mushroom.asm : 69 -JSL.l ItemSet_Mushroom -NOP +JSL.l ItemSet_Mushroom : NOP ;-------------------------------------------------------------------------------- org $05F53E ; <- 2F53E - sprite_potion_shop.asm : 40 -JSL.l ItemCheck_Powder -CMP.b #$20 +JSL.l ItemCheck_Powder : CMP.b #$20 ;-------------------------------------------------------------------------------- ; the quake medallion AND FLIPPERS org $1DDF71 ; <- EDF71 - sprite_great_catfish.asm : 47 @@ -2080,21 +1915,16 @@ org $05EF79 ; <- 2EF79 - sprite_heart_upgrades.asm:128 (JSL Sprite_PrepAndDrawSi JSL.l DrawHeartContainerGFX ;-------------------------------------------------------------------------------- org $05EFCE ; <- 2EFCE - sprite_heart_upgrades.asm:176 (JSL Link_ReceiveItem) -;org $05EFEE ; <- 2EFEE - sprite_heart_upgrades.asm:202 (JSL Link_ReceiveItem) JSL.l HeartContainerGet ;-------------------------------------------------------------------------------- ;-------------------------------------------------------------------------------- org $0799B1 ; 399B1 - Bank07.asm:4063 (CPY.b #$3E : BNE .notHeartContainer) -JSL.l HeartContainerSound -BCC Link_ReceiveItem_notHeartContainer -; JSR Player_DoSfx3 +JSL.l HeartContainerSound : BCC Link_ReceiveItem_notHeartContainer org $0799BA ; 399BA - Bank07.asm:4070 (LDA.b #$60 : STA $02D9) Link_ReceiveItem_notHeartContainer: ;-------------------------------------------------------------------------------- org $09887F ; <- 4887F - ancilla_init.asm : 1163 (LDA $0C5E, X : CMP.b #$3E : BEQ .doneWithSoundEffects) -JSL NormalItemSkipSound -NOP -BCS AddReceivedItem_doneWithSoundEffects +JSL NormalItemSkipSound : NOP : BCS AddReceivedItem_doneWithSoundEffects org $0988AE ; <- 488AE - ancilla_init.asm : 1193 (LDA.b #$0A : STA $02) AddReceivedItem_doneWithSoundEffects: ;================================================================================ @@ -2105,21 +1935,15 @@ JSL.l DrawHeartPieceGFX ;-------------------------------------------------------------------------------- org $05F08A ; <- 2F08A - sprite_heart_upgrades.asm : 324 - (LDA $7EF36B : INC A : AND.b #$03 : STA $7EF36B : BNE .got_4_piecese) item determination JSL.l HeartPieceGet -BCS $18 ; reinsert the near branch that appears midway through what we overrode -NOP #22 +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 ;-------------------------------------------------------------------------------- org $06C0B0 ; <- 340B0 - sprite prep JSL.l HeartPieceSpritePrep ;-------------------------------------------------------------------------------- org $08C45B ; <- 4445B - ancilla_receive_item.asm : 152 JSL.l HPItemReset -;-------------------------------------------------------------------------------- -org $05EF1E ; <- 2EF1E - sprite_heart_upgrades.asm : 48 (LDA $7EF280, X : AND.b #$40 : BEQ .dont_self_terminate) -JSL.l HeartUpgradeSpawnDecision -;-------------------------------------------------------------------------------- -org $05EFFA ; <- 2EFFA - sprite_heart_upgrades.asm : 216 (LDA $7EF280, X : ORA.b #$40 : STA $7EF280, X) -JSL.l SaveHeartCollectedStatus -NOP #6 ;================================================================================ ;================================================================================ @@ -2141,26 +1965,17 @@ JSL.l OnLinkDamagedFromPit org $01FFE7 ; <- FFE7 - Bank01.asm:16375 (LDA $7EF36D) JSL.l OnLinkDamagedFromPitOutdoors ;-------------------------------------------------------------------------------- -org $078F27 ; <- 38F27 -JSL.l FlipperReset -;-------------------------------------------------------------------------------- org $02B468 - dw FakeFlipperProtection +dw FakeFlipperProtection org $02FFC7 FakeFlipperProtection: JSR.w $029485 JSL protectff RTS - ;-------------------------------------------------------------------------------- -;org $09F40B ; <- 4F40B - module_death.asm:222 (LDX.b #$00) -;JSL.l IgnoreFairyCheck -;-------------------------------------------------------------------------------- -org $078F51 ; <- 38F51 - Bank07.asm:2444 (JSR $AE54 ; $3AE54 IN ROM) -JSL.l OnEnterWater : NOP -;-------------------------------------------------------------------------------- - +;org $078F51 ; <- 38F51 - Bank07.asm:2444 (JSR $AE54 ; $3AE54 IN ROM) +;JSL.l OnEnterWater : NOP ;================================================================================ ; Floodgate Softlock Fix ;-------------------------------------------------------------------------------- @@ -2171,20 +1986,17 @@ STZ $1000 : STZ $1001 NOP #26 ;-------------------------------------------------------------------------------- org $02AA87 ; <- 12A87 -JSL.l OnOWTransition -NOP #36 +JSL.l OnOWTransition : NOP #36 ;================================================================================ ;Inverted mode tile map update (executed right after the original tile load) ;-------------------------------------------------------------------------------- org $02ED51 ; <- 16D51 -JSL.l Overworld_LoadNewTiles -NOP #$02 +JSL.l Overworld_LoadNewTiles : NOP #$02 ;-------------------------------------------------------------------------------- ;Same as above org $02EC2E ;<- 016C2E -JSL.l Overworld_LoadNewTiles -NOP #$02 +JSL.l Overworld_LoadNewTiles : NOP #$02 ;================================================================================ org $07A3E2 ;<- 3A3E2 Bank07.asm:5764 (LDA.b #$80 : STA $03F0) JSL.l FreeDuckCheck : BEQ + @@ -2205,7 +2017,6 @@ MirrorBonk_BranchGamma: org $1DFDA8 ; <- EFDA9 - sprite_digging_game_guy.asm:309 (STA $7FFE00) JSL.l SpawnShovelGamePrizeSFX ;-------------------------------------------------------------------------------- -;org $01EEB6 ; <- EEB6 - Bank01.asm:14138 (ORA.b #$40 : STA $0403) org $01EECD ; <- EECD - Bank01.asm:14160 (LDA.b #$0E : STA $012F) JSL.l SpawnChestGamePrizeSFX : NOP ;================================================================================ @@ -2214,8 +2025,7 @@ JSL.l SpawnChestGamePrizeSFX : NOP ; Heart Beep Timer ;-------------------------------------------------------------------------------- org $0DDC9B ; <- 6DC9B -JSL.l BeepLogic -NOP #6 +JSL.l BeepLogic : NOP #6 ;================================================================================ ;================================================================================ @@ -2256,16 +2066,13 @@ JSL.l SetOverlayIfLamp ; identify the tavern entrance to determine whether link should walk up or down. ;-------------------------------------------------------------------------------- org $1BBD5F ; <- Bank1b.asm:296 (LDA $1BBB73, X : STA $010E) -JSL.l StoreLastOverworldDoorID -NOP #3 +JSL.l StoreLastOverworldDoorID : NOP #3 ;-------------------------------------------------------------------------------- org $02D754 ; <- Bank02.asm:10847 (LDA $D724, X : STA $0696 : STZ $0698) -JSL.l CacheDoorFrameData -NOP #5 +JSL.l CacheDoorFrameData : NOP #5 ;-------------------------------------------------------------------------------- org $0298AD ; <- Bank02.asm:4495 (LDA $010E : CMP.b #$43) -JSL.l WalkDownIntoTavern -NOP #1 +JSL.l WalkDownIntoTavern : NOP #1 ;================================================================================ ;================================================================================ @@ -2280,8 +2087,6 @@ Overworld_Hole_matchedHole: org $1BB8BD ; <- DB8BD - Bank1B.asm:85 (PLB) Overworld_Hole_End: -;-------------------------------------------------------------------------------- - ;================================================================================ ; Replace pyramid hole check for killing aga2 ; @@ -2306,57 +2111,53 @@ org $02A9B0 ; (BCS $A9B7) NOP #2 org $02C1C8 ; (BCS $C1CC) NOP #2 -; org $02ADA0 ; (LDA.b #$F1 : STA $012C) JSL Overworld_MosaicDarkWorldChecks : NOP ;-------------------------------------------------------------------------------- org $05CC58 ; <- Bank05.asm:1307 (LDA $040A : CMP.b #$18) -JSL PsychoSolder_MusicCheck -NOP #1 +JSL PsychoSolder_MusicCheck : NOP #1 ;-------------------------------------------------------------------------------- org $02B13A ; <- Bank02.asm:7647 dl Overworld_FinishMirrorWarp ;-------------------------------------------------------------------------------- org $0AB949 ; <- Bank0A.asm:270 (Different from US ROM) -JSL BirdTravel_LoadTargetAreaMusic -NOP #16 +JSL BirdTravel_LoadTargetAreaMusic : NOP #16 ;================================================================================ ;================================================================================ ; Hooks for roomloading.asm ;-------------------------------------------------------------------------------- org $02895D ; <- Bank02.asm:1812 (JSL Dungeon_LoadRoom) - JSL LoadRoomHook +JSL LoadRoomHook ;-------------------------------------------------------------------------------- org $028BE7 ; <- Bank02.asm:2299 (JSL Dungeon_LoadRoom) - JSL LoadRoomHook_noStats +JSL LoadRoomHook_noStats ;-------------------------------------------------------------------------------- org $029309 ; <- Bank02.asm:3533 (JSL Dungeon_LoadRoom) - JSL LoadRoomHook_noStats +JSL LoadRoomHook_noStats ;-------------------------------------------------------------------------------- org $02C2F3 ; <- Bank02.asm:10391 (JSL Dungeon_LoadRoom) - JSL LoadRoomHook_noStats +JSL LoadRoomHook_noStats ;================================================================================ ;================================================================================ ; Hooks into the "Reloading all graphics" routine ;-------------------------------------------------------------------------------- org $00E64D ; <- Bank00.asm:5656 (STZ $00 : STX $01 : STA $02) - JML BgGraphicsLoading - BgGraphicsLoadingCancel: - RTS : NOP - BgGraphicsLoadingResume: +JML BgGraphicsLoading +BgGraphicsLoadingCancel: +RTS : NOP +BgGraphicsLoadingResume: ;================================================================================ ;================================================================================ ; Hook when updating the floor tileset in dungeons (such as between floors) ;-------------------------------------------------------------------------------- org $00DF62 ; <- Bank00.asm:4672 (LDX.w #$0000 : LDY.w #$0040) - JML ReloadingFloors - NOP : NOP - ReloadingFloorsResume: +JML ReloadingFloors : NOP #2 +ReloadingFloorsResume: org $00DF6E ; <- A few instructions later, right after JSR Do3To.high16Bit - ReloadingFloorsCancel: +ReloadingFloorsCancel: ;================================================================================ ;================================================================================ @@ -2404,8 +2205,7 @@ Overworld_Entrance_BRANCH_RHO: ; branch here to continue into door ; Paradox Cave Shopkeeper Fixes ;-------------------------------------------------------------------------------- org $008C19 ; Bank00.asm@1633 (LDA.b #$01 : STA MDMAEN) -JSL ParadoxCaveGfxFix -NOP +JSL ParadoxCaveGfxFix : NOP ;================================================================================ ;================================================================================ @@ -2419,8 +2219,7 @@ org $0DCBFE ; LDA.w $0ABF LDA.w $021B org $02BFE0 ; LDA.b #$01 : STA.w $0ABF -JSL SetOverworldTransitionFlags -NOP +JSL SetOverworldTransitionFlags : NOP ; For mirroring, the new flag is set in IncrementOWMirror in stats.asm ;================================================================================ @@ -2436,14 +2235,12 @@ LDA.b Scrap02 ; always zero! (this replaces the BCC) ADC.w #0000 ; put the carry bit into the accumulator instead of a hardcoded 1. ;------------------------------------------------------------------------------- org $02FD6F ; <- 017d6f - bank0E.asm: 3694 (LoadActualGearPalettes:) Note: Overflow of bank02 moved to 0e in US Rom -JSL LoadActualGearPalettesWithGloves -RTL +JSL LoadActualGearPalettesWithGloves : RTL ;-------------------------------------------------------------------------------- ; Bunny Palette/Overworld Map Bugfix ;-------------------------------------------------------------------------------- org $02FDF0 ; <- 017df0 - bank0E (LDA [$00] : STA $7EC300, X : STA $7EC500, X) -JSL LoadGearPalette_safe_for_bunny -RTS +JSL LoadGearPalette_safe_for_bunny : RTS ;================================================================================ ;================================================================================ @@ -2470,7 +2267,7 @@ JSL NewElderCode ; Add him to Castle Map post-rain, and post aga1 ;-------------------------------------------------------------------------------- org $09D0AC -db #$18, #$0F, #$43, #$FF;remove heart from tree adjancent map [LW1] +db #$18, #$0F, #$43, #$FF ;remove heart from tree adjancent map [LW1] db #$12, #$19, #$16 ;add sahasrala in castle Y, X, Sprite ID org $09C937 db #$B0, #$D0 ;change [LW1] map 01C pointers @@ -2493,7 +2290,7 @@ db #$3F ;-------------------------------------------------------------------------------- ; Updated evil barrier animation table ;-------------------------------------------------------------------------------- -org $1DF0E1;Evil Barrier new draw code +org $1DF0E1 ;Evil Barrier new draw code dw 0, 0 : db $CC, $00, $00, $02 dw -29, 3 : db $EA, $00, $00, $00 @@ -2563,8 +2360,8 @@ BunnyRead: org $07FFF4 CheckIfReading: JSR.w $07D36C ; check action - LDA #$80 : TRB $3B - CPX #$04 + LDA.b #$80 : TRB.b $3B + CPX.b #$04 RTS ;================================================================================ @@ -2589,7 +2386,6 @@ JSL NewFireBarDamage org $0DDB60 db $00, $00 - ;================================================================================ ; Fast credits @@ -2597,8 +2393,7 @@ org $02A096 JSL DumbFlagForMSU org $0EC3AF -JSL FastCreditsScrollOW -JMP.w $0EC3C7 +JSL FastCreditsScrollOW : JMP.w $0EC3C7 org $0EC41F JSL FastCreditsCutsceneUnderworldY @@ -2606,7 +2401,6 @@ JSL FastCreditsCutsceneUnderworldY org $0EC42C JSL FastCreditsCutsceneUnderworldX - org $0EC488 JSL FastCreditsCutsceneTimer @@ -2625,22 +2419,25 @@ org $0AEEDF : db $02 ; big icon org $0AEAFF : db $48 ; X position org $0AEED4 ; disable flashing - BRA ++ : NOP #6 : ++ +BRA ++ : NOP #6 : ++ org $0AEEF2 - SBC.b #$03 : STA.w $0801,X - LDA.b #$03 : STA.w $0802,X - LDA.b #$31 : STA.w $0803,X +SBC.b #$03 : STA.w $0801,X +LDA.b #$03 : STA.w $0802,X +LDA.b #$31 : STA.w $0803,X org $008BE5 ; hijack stripes for boss GFX transfer - JSL DoDungeonMapBossIcon +JSL DoDungeonMapBossIcon ;================================================================================ - -org $01C4B8 : JSL FixJingleGlitch -org $01C536 : JSL FixJingleGlitch -org $01C592 : JSL FixJingleGlitch -org $01C65F : JSL FixJingleGlitch +org $01C4B8 +JSL FixJingleGlitch +org $01C536 +JSL FixJingleGlitch +org $01C592 +JSL FixJingleGlitch +org $01C65F +JSL FixJingleGlitch ;================================================================================ ; Text Renderer diff --git a/init.asm b/init.asm index 33aff1d..3d7f30c 100644 --- a/init.asm +++ b/init.asm @@ -5,45 +5,45 @@ ; called and it only gets called once ever during RESET. ;-------------------------------------------------------------------------------- Init_Primary: - LDA #$00 + LDA.b #$00 - LDX #$00 ; initalize our ram + LDX.b #$00 ; initalize our ram - - STA $7EC025, X - STA $7F5000, X + STA.l $7EC025, X + STA.l $7F5000, X INX - CPX #$10 : !BLT - + CPX.b #$10 : !BLT - - LDX #$10 ; initalize more ram + LDX.b #$10 ; initalize more ram - - STA $7F5000, X + STA.l $7F5000, X INX - CPX #$FF : !BLT - + CPX.b #$FF : !BLT - LDX #$00 - - LDA RomNameSRAM, X : CMP $00FFC0, X : BNE .clear + LDA.l RomNameSRAM, X : CMP.w $FFC0, X : BNE .clear INX - CPX #$15 : !BLT - + CPX.b #$15 : !BLT - BRA .done .clear REP #$30 ; set 16-bit accumulator & index registers LDA.w #$0000 - - STA $700000, X + STA.l $700000, X INX - CPX #$2000 : !BLT - + CPX.w #$2000 : !BLT - SEP #$30 ; set 8-bit accumulator & index registers - LDX #$00 + LDX.b #$00 - - LDA $00FFC0, X : STA RomNameSRAM, X + LDA.w $FFC0, X : STA.l RomNameSRAM, X INX CPX #$15 : !BLT - - LDX #$00 + LDX.b #$00 - - LDA RomVersion, X : STA RomVersionSRAM, X + LDA.w RomVersion, X : STA.l RomVersionSRAM, X INX - CPX #$04 : !BLT - + CPX.b #$04 : !BLT - .done REP #$20 @@ -53,7 +53,7 @@ Init_Primary: LDA.b #$01 : STA.w MEMSEL ; enable fastrom access on upper banks STA.l OneMindId - LDA.b #$10 : STA $BC ; set default player sprite bank + LDA.b #$10 : STA.b $BC ; set default player sprite bank LDA.b #$81 : STA.w NMITIMEN ; thing we wrote over, turn on NMI & gamepad RTL diff --git a/inventory.asm b/inventory.asm index 4c02de3..0b17d4e 100644 --- a/inventory.asm +++ b/inventory.asm @@ -65,7 +65,7 @@ RTL INX : BRA -- : ++ PLX LDA.l SilverArrowsUseRestriction : BEQ ++ - LDA.b $A0 : ORA.b $A1 : BEQ ++ ; not in ganon's room in restricted mode + LDA.b RoomIndex : ORA.b RoomIndex+1 : BEQ ++ ; not in ganon's room in restricted mode LDA.l BowEquipment : CMP.b #$03 : !BLT .errorJump : !SUB #$02 : STA.l BowEquipment BRA .errorJump2 ++ @@ -993,7 +993,7 @@ RTL ;-------------------------------------------------------------------------------- SpawnChestGamePrizeSFX: CPX.b #$07 : BNE .normal - LDA.b $A0 : CMP.b #$06 : BNE .normal + LDA.b RoomIndex : CMP.b #$06 : BNE .normal .prize LDA.b #$1B : STA.w $012F : RTL ; play puzzle sound .normal diff --git a/invertedstatic.asm b/invertedstatic.asm index 01c4f52..88b125c 100644 --- a/invertedstatic.asm +++ b/invertedstatic.asm @@ -1,9 +1,9 @@ ;Statically mapped at $A1A000 Referenced by the front end. Do not move without coordination. InvertedTileAttributeLookup: SEP #$20 - LDA $8A : CMP.b #$47 : BEQ .turtleRock - LDA Overworld_TileAttr, X + LDA.b $8A : CMP.b #$47 : BEQ .turtleRock + LDA.l Overworld_TileAttr, X JML.l Overworld_GetTileAttrAtLocation_continue .turtleRock - LDA Inverted_TR_TileAttributes, X + LDA.l Inverted_TR_TileAttributes, X JML.l Overworld_GetTileAttrAtLocation_continue diff --git a/lampmantlecone.asm b/lampmantlecone.asm index 7c447b8..3eb5ee1 100644 --- a/lampmantlecone.asm +++ b/lampmantlecone.asm @@ -17,7 +17,7 @@ LampCheck: LDA.l LampConeLightWorld : BRA .done + .darkWorld - LDA LampConeDarkWorld + LDA.l LampConeDarkWorld .done RTL ;================================================================================ diff --git a/maidencrystals.asm b/maidencrystals.asm index b02ae1b..20ce70a 100644 --- a/maidencrystals.asm +++ b/maidencrystals.asm @@ -6,20 +6,13 @@ ; MaidenCrystalScript ;-------------------------------------------------------------------------------- MaidenCrystalScript: - LDA.b #$00 : STA $7F5091 - STZ $02D8 - STZ $02DA - STZ $2E - LDA #$02 : STA $2F - - ; Load the dungeon index. Is it the Dark Palace? - ;LDA $040C : !SUB.b #$0A : TAY : CPY.b #$02 : BNE + - ; LDA MapIcons : CMP.b #$07 : BCS ++ : LDA.b #$07 : STA MapIcons : ++ - ;+ - - LDA CrystalsField : AND.b #$7F : CMP.b #$7F : BNE + ; check if we have all crystals - LDA.b #$08 : STA MapIcons ; Update the map icon to just be Ganon's Tower + LDA.b #$00 : STA.l BusyItem + STZ.w $02D8 + STZ.w $02DA + STZ.b $2E + LDA.b #$02 : STA.w $2F + 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 + - JML.l $1ECF35 ; <- F4F35 - sprite_crystal_maiden.asm : 426 ;-------------------------------------------------------------------------------- diff --git a/mantle.asm b/mantle.asm index 5b60c1b..0e34340 100644 --- a/mantle.asm +++ b/mantle.asm @@ -2,11 +2,11 @@ ; Mantle Object Changes ;-------------------------------------------------------------------------------- Mantle_CorrectPosition: - LDA ProgressFlags : AND.b #$04 : BEQ + - LDA.b #$0A : STA $0D10, X ; just spawn it off to the side where we know it should be - LDA.b #$03 : STA $0D30, X - LDA.b #$90 : STA $0ED0, X + 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 $0D00, X : !ADD.b #$03 ; thing we did originally + LDA.w $0D00, X : !ADD.b #$03 ; thing we did originally RTL ;-------------------------------------------------------------------------------- diff --git a/medallions.asm b/medallions.asm index ef8da48..9c3bbd5 100644 --- a/medallions.asm +++ b/medallions.asm @@ -3,45 +3,45 @@ ;-------------------------------------------------------------------------------- TryOpenMire: ; Checks if we're in the Swamp of Evil. - LDA $8A : CMP.b #$70 : BNE .untriggered + LDA.b $8A : CMP.b #$70 : BNE .untriggered ; Checks whether the Misery Mire dungeon is already revealed. - LDA OverworldEventDataWRAM+$70 : AND.b #$20 : BNE .untriggered + LDA.l OverworldEventDataWRAM+$70 : AND.b #$20 : BNE .untriggered ; You have to be in the trigger window. LDY.b #$02 : JSL.l Ancilla_CheckIfEntranceTriggered : BCC .untriggered ; Do the 3rd animation for opening entrances - LDA.b #$03 : STA $04C6 + LDA.b #$03 : STA.w $04C6 - STZ $B0 ; reset the sub-submodule index - STZ $C8 ; reset this other index. + STZ.b $B0 ; reset the sub-submodule index + STZ.b $C8 ; reset this other index. .untriggered RTL ;-------------------------------------------------------------------------------- TryOpenTRock: ; Checks if we're at Turtle Rock. - LDA $8A : CMP.b #$47 : BNE .untriggered + LDA.b $8A : CMP.b #$47 : BNE .untriggered ; Checks whether the Turtle Rock dungeon is already revealed. - LDA OverworldEventDataWRAM+$47 : AND.b #$20 : BNE .untriggered + LDA.l OverworldEventDataWRAM+$47 : AND.b #$20 : BNE .untriggered ; You have to be in the trigger window. LDY.b #$03 : JSL.l Ancilla_CheckIfEntranceTriggered : BCC .untriggered ; Do the 4rd animation for opening entrances - LDA.b #$04 : STA $04C6 + LDA.b #$04 : STA.w $04C6 - STZ $B0 ; reset the sub-submodule index - STZ $C8 ; reset this other index. + STZ.b $B0 ; reset the sub-submodule index + STZ.b $C8 ; reset this other index. .untriggered RTL ;-------------------------------------------------------------------------------- MedallionTrigger_Bombos: - STZ $50 ; stuff we wrote over - STZ $0FC1 + STZ.b $50 ; stuff we wrote over + STZ.w $0FC1 PHA LDA.l MireRequiredMedallion : BNE + diff --git a/msu.asm b/msu.asm index 6f0040f..d42f647 100644 --- a/msu.asm +++ b/msu.asm @@ -164,27 +164,27 @@ CheckMusicLoadRequest: .continue LDA.l TournamentSeed : BNE +++ - LDA.l MSUPackRequest - CMP.l MSUPackCurrent : BEQ +++ - CMP.l MSUPackCount : !BLT ++ + LDA.w MSUPackRequest + CMP.w MSUPackCurrent : BEQ +++ + CMP.w MSUPackCount : !BLT ++ CMP.b #$FE : !BLT + - STA.l MSUPackCurrent + STA.w MSUPackCurrent SEP #$10 LDA.b #$00 LDX.b #$07 - - STA.l MSUFallbackTable,X + STA.w MSUFallbackTable,X DEX : BPL - REP #$10 BRA +++ - + : LDA.l MSUPackCurrent : STA.l MSUPackRequest - ++ : STA.l MSUPackCurrent + + : LDA.w MSUPackCurrent : STA.w MSUPackRequest + ++ : STA.w MSUPackCurrent JSL MSUInit_check_fallback +++ LDA.w MusicControlRequest : CMP.b #$08 : BEQ ++ ; Mirror SFX is not affected by NoBGM or pack $FE LDA.l NoBGM : BNE + - LDA.l MSUPackCurrent : CMP.b #$FE : BNE ++ + LDA.w MSUPackCurrent : CMP.b #$FE : BNE ++ + : JMP .mute ++ @@ -240,7 +240,7 @@ CheckMusicLoadRequest: LDA.l MusicShuffleTable-1,X : DEC : PHA AND.b #$07 : TAY PLA : LSR #3 : TAX - LDA.l MSUFallbackTable,X : BEQ .secondary_fallback : CMP.b #$FF : BEQ .mute + LDA.w MSUFallbackTable,X : BEQ .secondary_fallback : CMP.b #$FF : BEQ .mute - : CPY #$00 : BEQ + LSR : DEY : BRA - @@ -333,7 +333,7 @@ CheckMusicLoadRequest: ;-------------------------------------------------------------------------------- SpiralStairsPreCheck: REP #$20 ; thing we wrote over - LDA.b $A0 + LDA.b RoomIndex CMP.w #$000C : BNE + LDA.w CurrentMSUTrack : AND.w #$00FF : CMP.w #59 : BNE .done BRA .fade @@ -347,14 +347,14 @@ SpiralStairsPreCheck: LDA.w MSUID+4 : CMP.w #!VAL_MSU_ID_45 : BNE .done + - LDA.l BigKeyField : AND.w #$0004 : BEQ .done ; Check that we have the GT big key - LDA.l MSUFallbackTable+7 : AND.w #$0004 : BEQ .done ; Check that we have the extended track + LDA.l BigKeyField : AND.w #$0004 : BEQ .done ; Check that we have the GT big key + LDA.w MSUFallbackTable+7 : AND.w #$0004 : BEQ .done ; Check that we have the extended track .fade LDX.b #$F1 : STX.w MusicControlRequest .done - LDA.b $A0 ; thing we wrote over + LDA.b RoomIndex ; thing we wrote over RTL ;-------------------------------------------------------------------------------- @@ -362,7 +362,7 @@ SpiralStairsPreCheck: ; Change music on stair transition (ToH/GT) ;-------------------------------------------------------------------------------- SpiralStairsPostCheck: - LDA.b $A0 + 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 @@ -379,7 +379,7 @@ SpiralStairsPostCheck: LDX.b #59 : STX.w MusicControlRequest .done - LDX.b #$1C : LDA.b $A0 ; thing we wrote over + LDX.b #$1C : LDA.b RoomIndex ; thing we wrote over RTL ;-------------------------------------------------------------------------------- @@ -401,10 +401,10 @@ MSUInit: PHP LDA.b #$00 - STA.l MSULoadedTrack - STA.l MSUResumeTrack - STA.l MSUResumeTime : STA.l MSUResumeTime+1 : STA.l MSUResumeTime+2 : STA.l MSUResumeTime+3 - STA.l MSUResumeControl + STA.w MSULoadedTrack + STA.w MSUResumeTrack + STA.w MSUResumeTime : STA.w MSUResumeTime+1 : STA.w MSUResumeTime+2 : STA.w MSUResumeTime+3 + STA.w MSUResumeControl LDA.l NoBGM : BNE .done @@ -431,7 +431,7 @@ MSUInit: .wait_pack LDA.w MSUSTATUS : BIT.b #!FLAG_MSU_STATUS_AUDIO_BUSY : BNE .wait_pack LDA.w MSUSTATUS : BIT.b #!FLAG_MSU_STATUS_TRACK_MISSING : BEQ .check_pack - TXA : STA.l MSUPackCount + TXA : STA.w MSUPackCount BRA + ; Check the current MSU-1 pack for tracks that require SPC fallback @@ -453,7 +453,7 @@ MSUInit: LDA.w MSUSTATUS : BIT.b #!FLAG_MSU_STATUS_TRACK_MISSING : BNE + SEC + - LDA.l MSUFallbackTable,X : ROL : STA.l MSUFallbackTable,X + LDA.w MSUFallbackTable,X : ROL : STA.w MSUFallbackTable,X DEY : BPL .next_track DEX : BPL + @@ -474,11 +474,11 @@ MSUInit: ;-------------------------------------------------------------------------------- MSUStopPlaying: PHA : XBA : PHA - LDA.l MSULoadedTrack + LDA.w MSULoadedTrack JSR IsResumableTrack : BCC + ; dont save if we already saved recently REP #$20 - LDA.l MSUResumeTrack : AND #$00FF : BEQ ++ + LDA.w MSUResumeTrack : AND #$00FF : BEQ ++ LDA.l NMIFrames : !SUB MSUResumeTime : PHA LDA.l NMIFrames+2 : SBC MSUResumeTime+2 : BNE +++ PLA : CMP.l MSUResumeTimer : !BLT .too_early @@ -487,12 +487,12 @@ PHA : XBA : PHA PLA ++ ; saving - LDA.l NMIFrames : STA.l MSUResumeTime - LDA.l NMIFrames+2 : STA.l MSUResumeTime+2 + LDA.l NMIFrames : STA.w MSUResumeTime + LDA.l NMIFrames+2 : STA.w MSUResumeTime+2 SEP #$20 - LDA.l MSULoadedTrack : STA.l MSUResumeTrack - LDA.b #$00 : STA.l MSULoadedTrack ; dont take this path if we're calling again + LDA.w MSULoadedTrack : STA.w MSUResumeTrack + LDA.b #$00 : STA.w MSULoadedTrack ; dont take this path if we're calling again LDA.b #!FLAG_MSU_RESUME : STA.w MSUCTL ; save this track's position PLA : XBA : PLA RTS @@ -523,23 +523,23 @@ MSUMain: LDX.w MusicControl : BEQ + JMP .command_ff + - LDA.l MSUDelayedCommand : BEQ .do_fade + LDA.w MSUDelayedCommand : BEQ .do_fade .check_busy LDA.w MSUSTATUS : BIT.b #!FLAG_MSU_STATUS_AUDIO_BUSY : BNE - .ready LDA.w MSUSTATUS : BIT.b #!FLAG_MSU_STATUS_TRACK_MISSING : BNE - .start - LDA.l MSUResumeControl : BIT.b #!FLAG_RESUME_CANCEL : BEQ + - EOR.b #!FLAG_RESUME_CANCEL : STA.l MSUResumeControl - REP #$20 : LDA.l MSULoadedTrack : STA.w MSUTRACK : SEP #$20 + LDA.w MSUResumeControl : BIT.b #!FLAG_RESUME_CANCEL : BEQ + + EOR.b #!FLAG_RESUME_CANCEL : STA.w MSUResumeControl + REP #$20 : LDA.w MSULoadedTrack : STA.w MSUTRACK : SEP #$20 BRA - + LDA.b #!VAL_VOLUME_FULL STA.w TargetVolume - LDA.l MSUResumeControl : BIT.b #!FLAG_RESUME_FADEIN : BEQ + - EOR.b #!FLAG_RESUME_FADEIN : STA.l MSUResumeControl + LDA.w MSUResumeControl : BIT.b #!FLAG_RESUME_FADEIN : BEQ + + EOR.b #!FLAG_RESUME_FADEIN : STA.w MSUResumeControl LDA.b #$00 BRA ++ + @@ -551,17 +551,17 @@ MSUMain: LDA.w CurrentMSUTrack : DEC : PHA AND.b #$07 : TAY PLA : LSR #3 : TAX - LDA.l MSUFallbackTable,X : BEQ +++ : CMP.b #$FF : BEQ ++ + LDA.w MSUFallbackTable,X : BEQ +++ : CMP.b #$FF : BEQ ++ - : CPY #$00 : BEQ + LSR : DEY : BRA - + AND.b #$01 : BEQ +++ - ++ : LDA.l MSUDelayedCommand + ++ : LDA.w MSUDelayedCommand +++ : STA.w MSUCTL LDA.b #$00 - STA.l MSUDelayedCommand + STA.w MSUDelayedCommand JML SPCContinue .do_fade: @@ -624,9 +624,9 @@ MSUMain: + CPX.w CurrentControlRequest : BEQ - LDA.b #$00 : XBA - LDA.l MSUPackCurrent : BEQ + - - : CMP.l MSUPackCount : !BLT + - !SUB.l MSUPackCount : BRA - + LDA.w MSUPackCurrent : BEQ + + - : CMP.w MSUPackCount : !BLT + + !SUB.w MSUPackCount : BRA - + JSR MSUStopPlaying @@ -639,11 +639,11 @@ MSUMain: DEX : BNE - + STA.w MSUTRACK - STA.l MSULoadedTrack + STA.w MSULoadedTrack SEP #$20 PLX - TXA : CMP.l MSUResumeTrack : BNE + ; dont resume if too late + TXA : CMP.w MSUResumeTrack : BNE + ; dont resume if too late REP #$20 LDA.l NMIFrames : !SUB MSUResumeTime : PHA LDA.l NMIFrames+2 : SBC MSUResumeTime+2 : BNE ++ @@ -656,8 +656,8 @@ MSUMain: SEP #$20 LDA.b #!FLAG_RESUME_CANCEL .done_resume: - STA.l MSUResumeControl - LDA.b #$00 : STA.l MSUResumeTrack + STA.w MSUResumeControl + LDA.b #$00 : STA.w MSUResumeTrack + CPX #07 : BNE + ; Kakariko Village LDA.b $10 : CMP #$07 : BNE + @@ -667,12 +667,12 @@ MSUMain: + TXA ++ - STA.l MSULoadedTrack + STA.w MSULoadedTrack STX.w CurrentMSUTrack - LDA.l MSUPackCurrent : CMP #$FE : !BLT + + LDA.w MSUPackCurrent : CMP #$FE : !BLT + LDA.b #$00 : BRA ++ + : LDA.l MSUTrackList-1,X - ++ : STA.l MSUDelayedCommand + ++ : STA.w MSUDelayedCommand LDA.l MSUExtendedFallbackList-1,X CMP.b #17 : BEQ + CMP.b #22 : BEQ + @@ -722,9 +722,9 @@ PendantFanfareWait: LDA.w MSUID+2 : CMP.w #!VAL_MSU_ID_23 : BNE .spc LDA.w MSUID+4 : CMP.w #!VAL_MSU_ID_45 : BNE .spc SEP #$20 - LDA.l MSUPackCurrent : CMP #$FE : !BGE .spc + LDA.w MSUPackCurrent : CMP #$FE : !BGE .spc LDA.w MSUSTATUS : BIT.b #!FLAG_MSU_STATUS_TRACK_MISSING : BNE .spc - LDA.l MSUDelayedCommand : BNE .continue + LDA.w MSUDelayedCommand : BNE .continue LDA.w MSUSTATUS : BIT.b #!FLAG_MSU_STATUS_AUDIO_PLAYING : BEQ .done .continue jml PendantFanfareContinue @@ -746,9 +746,9 @@ CrystalFanfareWait: LDA.w MSUID+2 : CMP.w #!VAL_MSU_ID_23 : BNE .spc LDA.w MSUID+4 : CMP.w #!VAL_MSU_ID_45 : BNE .spc SEP #$20 - LDA.l MSUPackCurrent : CMP.b #$FE : !BGE .spc + LDA.w MSUPackCurrent : CMP.b #$FE : !BGE .spc LDA.w MSUSTATUS : BIT.b #!FLAG_MSU_STATUS_TRACK_MISSING : BNE .spc - LDA.l MSUDelayedCommand : BNE .continue + LDA.w MSUDelayedCommand : BNE .continue LDA.w MSUSTATUS : BIT.b #!FLAG_MSU_STATUS_AUDIO_PLAYING : BEQ .done .continue jml CrystalFanfareContinue diff --git a/music.asm b/music.asm index b8ae54d..e13df10 100644 --- a/music.asm +++ b/music.asm @@ -9,7 +9,7 @@ PreOverworld_LoadProperties_ChooseMusic: LDX.b #$02 ; Default light world theme - LDA $8A : ORA #$40 ; check both light and dark world DM at the same time + LDA.b $8A : ORA.b #$40 ; check both light and dark world DM at the same time CMP.b #$43 : BEQ .endOfLightWorldChecks CMP.b #$45 : BEQ .endOfLightWorldChecks CMP.b #$47 : BEQ .endOfLightWorldChecks @@ -17,47 +17,42 @@ PreOverworld_LoadProperties_ChooseMusic: LDY.b #$5A ; Main overworld animated tileset ; Skip village and lost woods checks if entering dark world or a special area - LDA $8A : CMP.b #$40 : !BGE .notVillageOrWoods + LDA.b $8A : CMP.b #$40 : !BGE .notVillageOrWoods LDX.b #$07 ; Default village theme - ; Check what phase we're in - ;LDA ProgressIndicator : CMP.b #$03 : !BLT + - ; LDX.b #$02 ; Default light world theme (phase >=3) - ;+ - ; Check if we're entering the village - LDA $8A : CMP.b #$18 : BEQ .endOfLightWorldChecks + LDA.b $8A : CMP.b #$18 : BEQ .endOfLightWorldChecks ; For NA release would we also branch on indexes #$22 #$28 #$29 LDX.b #$05 ; Lost woods theme ; check if we've pulled from the master sword pedestal - LDA OverworldEventDataWRAM+$80 : AND.b #$40 : BEQ + + LDA.b OverworldEventDataWRAM+$80 : AND.b #$40 : BEQ + LDX.b #$02 ; Default light world theme + ; check if we are entering lost woods - LDA $8A : BEQ .endOfLightWorldChecks + LDA.b $8A : BEQ .endOfLightWorldChecks .notVillageOrWoods ; Use the normal overworld (light world) music LDX.b #$02 ; Check phase ; In phase >= 2 - LDA ProgressIndicator : CMP.b #$02 : !BGE + + LDA.l ProgressIndicator : CMP.b #$02 : !BGE + ; If phase < 2, play the legend music LDX.b #$03 + .endOfLightWorldChecks ; if we are in the light world go ahead and set chosen selection - LDA CurrentWorld : BEQ .checkInverted+4 + LDA.l CurrentWorld : BEQ .checkInverted+4 LDX.b #$0F ; dark woods theme ; This music is used in dark woods - LDA $8A + LDA.b $8A CMP.b #$40 : BEQ + LDX.b #$0D ; dark death mountain theme @@ -68,16 +63,16 @@ PreOverworld_LoadProperties_ChooseMusic: ; if not inverted and light world, or inverted and dark world, skip moon pearl check .checkInverted - LDA CurrentWorld : CLC : ROL #$03 : CMP InvertedMode : BEQ .lastCheck + LDA.l CurrentWorld : CLC : ROL #$03 : CMP.l InvertedMode : BEQ .lastCheck ; Does Link have a moon pearl? - LDA MoonPearlEquipment : BNE + + LDA.l MoonPearlEquipment : BNE + LDX.b #$04 ; bunny theme + .lastCheck - LDA $0132 : CMP.b #$F2 : BNE + - CPX $0130 : BNE + + 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) ; then play the full volume command (#F3) instead of restarting the song @@ -99,37 +94,37 @@ Overworld_FinishMirrorWarp: .clear_hdma_table - STA $1B00, X : STA $1B40, X - STA $1B80, X : STA $1BC0, X - STA $1C00, X : STA $1C40, X - STA $1C80, X + 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 DEX #2 : BPL .clear_hdma_table - LDA.w #$0000 : STA $7EC007 : STA $7EC009 + LDA.w #$0000 : STA.l $7EC007 : STA.l $7EC009 SEP #$20 JSL $00D7C8 ; $57C8 IN ROM - LDA.b #$80 : STA $9B + LDA.b #$80 : STA.b $9B LDX.b #$04 ; bunny theme ; if not inverted and light world, or inverted and dark world, skip moon pearl check - LDA CurrentWorld : CLC : ROL #$03 : CMP InvertedMode : BEQ + - LDA MoonPearlEquipment : BEQ .endOfLightWorldChecks + LDA.l CurrentWorld : CLC : ROL #$03 : CMP.l InvertedMode : BEQ + + LDA.l MoonPearlEquipment : BEQ .endOfLightWorldChecks + LDX.b #$09 ; default dark world theme - LDA $8A : CMP.b #$40 : !BGE .endOfLightWorldChecks + LDA.b $8A : CMP.b #$40 : !BGE .endOfLightWorldChecks LDX.b #$02 ; hyrule field theme ; Check if we're entering the lost woods CMP.b #$00 : BNE + - LDA OverworldEventDataWRAM+$80 : AND.b #$40 : BNE .endOfLightWorldChecks + LDA.l OverworldEventDataWRAM+$80 : AND.b #$40 : BNE .endOfLightWorldChecks LDX.b #$05 ; lost woods theme BRA .endOfLightWorldChecks + @@ -138,14 +133,13 @@ Overworld_FinishMirrorWarp: CMP.b #$18 : BNE .endOfLightWorldChecks ; Check what phase we're in - ; LDA ProgressIndicator : CMP.b #$03 : !BGE .endOfLightWorldChecks LDX.b #$07 ; Default village theme (phase <3) .endOfLightWorldChecks - STX $012C + STX.w $012C - LDA $8A : CMP.b #$40 : BNE + - LDX #$0F ; dark woods theme + LDA.b $8A : CMP.b #$40 : BNE + + LDX.b #$0F ; dark woods theme BRA .bunny + @@ -154,24 +148,24 @@ Overworld_FinishMirrorWarp: CMP.b #$47 : BNE .notDarkMountain .darkMountain - LDA.b #$09 : STA $012D ; set storm ambient SFX + LDA.b #$09 : STA.w $012D ; set storm ambient SFX LDX.b #$0D ; dark mountain theme .bunny - LDA MoonPearlEquipment : ORA InvertedMode : BNE + - LDX #$04 ; bunny theme + LDA.l MoonPearlEquipment : ORA.l InvertedMode : BNE + + LDX.b #$04 ; bunny theme + - STX $012C + STX.w $012C .notDarkMountain - LDA $11 : STA $010C + LDA.b $11 : STA.w $010C - STZ $11 - STZ $B0 - STZ $0200 - STZ $0710 + STZ.b $11 + STZ.b $B0 + STZ.w $0200 + STZ.w $0710 RTL ;-------------------------------------------------------------------------------- @@ -179,73 +173,59 @@ Overworld_FinishMirrorWarp: ;-------------------------------------------------------------------------------- BirdTravel_LoadTargetAreaMusic: ; Skip village and lost woods checks if entering dark world or a special area - LDA $8A : CMP.b #$43 : BEQ .endOfLightWorldChecks + LDA.b $8A : CMP.b #$43 : BEQ .endOfLightWorldChecks CMP.b #$40 : !BGE .notVillageOrWoods LDX.b #$07 ; Default village theme - ; Check what phase we're in - ;LDA ProgressIndicator : CMP.b #$03 : !BLT + - ; LDX.b #$02 ; Default light world theme (phase >=3) - ;+ - ; Check if we're entering the village - LDA $8A : CMP.b #$18 : BEQ .endOfLightWorldChecks + LDA.b $8A : CMP.b #$18 : BEQ .endOfLightWorldChecks ; For NA release would we also branch on indexes #$22 #$28 #$29 - ;LDX.b #$05 ; Lost woods theme - - ; check if we've pulled from the master sword pedestal - ;LDA OverworldEventDataWRAM+$80 : AND.b #$40 : BEQ + - ; LDX.b #$02 ; Default light world theme - ;+ - ; check if we are entering lost woods - LDA $8A : BEQ .endOfLightWorldChecks + LDA.b $8A : BEQ .endOfLightWorldChecks .notVillageOrWoods ; Use the normal overworld (light world) music LDX.b #$02 ; Check phase ; In phase >= 2 - LDA ProgressIndicator : CMP.b #$02 : !BGE + + LDA.l ProgressIndicator : CMP.b #$02 : !BGE + ; If phase < 2, play the legend music LDX.b #$03 + .endOfLightWorldChecks ; if we are in the light world go ahead and set chosen selection - LDA CurrentWorld : BEQ .checkInverted+4 + LDA.l CurrentWorld : BEQ .checkInverted+4 LDX.b #$09 ; dark overworld theme - LDA $8A + LDA.b $8A ; Misery Mire rain SFX CMP.b #$70 : BNE ++ - LDA OverworldEventDataWRAM+$70 : AND.b #$20 : BNE ++ - LDA.b #$01 : CMP $0131 : BEQ + - STA $012D + LDA.l OverworldEventDataWRAM+$70 : AND.b #$20 : BNE ++ + LDA.b #$01 : CMP.w $0131 : BEQ + + STA.w $012D + : BRA .checkInverted ++ ; This music is used in dark death mountain CMP.b #$43 : BEQ .darkMountain - ; CMP.b #$45 : BEQ .darkMountain - ; CMP.b #$47 : BEQ .darkMountain - LDA.b #$05 : STA $012D + LDA.b #$05 : STA.w $012D BRA .checkInverted .darkMountain - LDA CrystalsField : CMP.b #$7F : BEQ + + LDA.l CrystalsField : CMP.b #$7F : BEQ + LDX.b #$0D ; dark death mountain theme - + : LDA.b #$09 : STA $012D + + : LDA.b #$09 : STA.w $012D ; if not inverted and light world, or inverted and dark world, skip moon pearl check .checkInverted - LDA CurrentWorld : CLC : ROL #$03 : CMP InvertedMode : BEQ .lastCheck + LDA.l CurrentWorld : CLC : ROL #$03 : CMP.l InvertedMode : BEQ .lastCheck ; Does Link have a moon pearl? - LDA MoonPearlEquipment : BNE + + LDA.l MoonPearlEquipment : BNE + LDX.b #$04 ; bunny theme + @@ -257,8 +237,8 @@ BirdTravel_LoadTargetAreaMusic: ;0 = Is Kakariko Overworld ;1 = Not Kakariko Overworld PsychoSolder_MusicCheck: - LDA $040A : CMP.b #$18 : BNE .done ; thing we overwrote - check if overworld location is Kakariko - LDA $1B ; Also check that we are outdoors + LDA.w $040A : CMP.b #$18 : BNE .done ; thing we overwrote - check if overworld location is Kakariko + LDA.b $1B ; Also check that we are outdoors .done RTL ;-------------------------------------------------------------------------------- @@ -275,10 +255,10 @@ Overworld_MosaicDarkWorldChecks: CMP.b #$51 : bne .doFade .checkCrystals - LDA CrystalsField : CMP.b #$7F : BEQ .done + LDA.l CrystalsField : CMP.b #$7F : BEQ .done .doFade - LDA.b #$F1 : STA $012C ; thing we wrote over, fade out music + LDA.b #$F1 : STA.w $012C ; thing we wrote over, fade out music .done RTL diff --git a/npcitems.asm b/npcitems.asm index 8aa788a..6cc435b 100644 --- a/npcitems.asm +++ b/npcitems.asm @@ -23,148 +23,127 @@ ;-------------------------------------------------------------------------------- ItemCheck_FairySword: - LDA NpcFlags+1 : AND.b #$08 + LDA.l NpcFlags+1 : AND.b #$08 RTL ItemCheck_SmithSword: - LDA NpcFlags+1 : AND.b #$04 + LDA.l NpcFlags+1 : AND.b #$04 RTL ItemCheck_MagicBat: - LDA NpcFlags+1 : AND.b #$80 + LDA.l NpcFlags+1 : AND.b #$80 RTL ItemCheck_OldMan: - LDA NpcFlags : AND.b #$01 : CMP #$01 + LDA.l NpcFlags : AND.b #$01 : CMP #$01 RTL ItemCheck_ZoraKing: - LDA NpcFlags : AND.b #$02 + LDA.l NpcFlags : AND.b #$02 RTL ItemCheck_SickKid: - LDA NpcFlags : AND.b #$04 + LDA.l NpcFlags : AND.b #$04 RTL ItemCheck_TreeKid: - LDA NpcFlags : AND.b #$08 ; FluteBoy_Chillin - 73: LDA FluteEquipment + LDA.l NpcFlags : AND.b #$08 ; FluteBoy_Chillin - 73: LDA FluteEquipment RTL ItemCheck_TreeKid2: - LDA NpcFlags : AND.b #$08 : LSR #$02 ; FluteAardvark_InitialStateFromFluteState - 225: LDA FluteEquipment : AND.b #$03 + LDA.l NpcFlags : AND.b #$08 : LSR #$02 ; FluteAardvark_InitialStateFromFluteState - 225: LDA FluteEquipment : AND.b #$03 RTL ItemCheck_TreeKid3: JSL $0DD030 ; FluteAardvark_Draw - thing we wrote over - LDA NpcFlags : AND.b #$08 + LDA.l NpcFlags : AND.b #$08 BEQ .normal BRA .done LDA.b #$05 .normal - LDA $0D80, X + LDA.w $0D80, X .done RTL ItemCheck_Sahasrala: - LDA NpcFlags : AND.b #$10 + LDA.l NpcFlags : AND.b #$10 RTL ItemCheck_Library: - LDA NpcFlags : AND.b #$80 + LDA.l NpcFlags : AND.b #$80 RTL ItemCheck_Mushroom: - LDA NpcFlags+1 : ROL #4 ; does the same thing as below -; LDA NpcFlags+1 : AND.b #$10 : BEQ .clear -; SEC -;RTL -; .clear -; CLC + LDA.l NpcFlags+1 : ROL #4 ; does the same thing as below RTL ItemCheck_Powder: - LDA NpcFlags+1 : AND.b #$20 + LDA.l NpcFlags+1 : AND.b #$20 RTL ItemCheck_Catfish: - ;LDA CatfishGoodItem : BEQ .junk - ;PHX - ; LDA CatfishGoodItem+1 : TAX - ; LDA BowEquipment-1, X - ;PLX - ;-- - ;CMP CatfishGoodItem : !BLT .oursNewer - ;.theirsNewer - ;LDA #$20 : RTL ; don't give item - ;.oursNewers - ;LDA #$00 : RTL ; give item - ;.junk - LDA NpcFlags : AND.b #$20 + LDA.l NpcFlags : AND.b #$20 RTL ;-------------------------------------------------------------------------------- ItemSet_FairySword: - PHA : LDA NpcFlags+1 : ORA.b #$08 : STA NpcFlags+1 : PLA + PHA : LDA.l NpcFlags+1 : ORA.b #$08 : STA.l NpcFlags+1 : PLA RTL ItemSet_SmithSword: - PHA : LDA NpcFlags+1 : ORA.b #$04 : STA NpcFlags+1 : PLA + PHA : LDA.l NpcFlags+1 : ORA.b #$04 : STA.l NpcFlags+1 : PLA RTL ItemSet_MagicBat: - PHA : LDA NpcFlags+1 : ORA.b #$80 : STA NpcFlags+1 : PLA + PHA : LDA.l NpcFlags+1 : ORA.b #$80 : STA.l NpcFlags+1 : PLA RTL ItemSet_OldMan: JSL.l Link_ReceiveItem ; thing we wrote over - PHA : LDA NpcFlags : ORA.b #$01 : STA NpcFlags : PLA + PHA : LDA.l NpcFlags : ORA.b #$01 : STA.l NpcFlags : PLA RTL ItemSet_ZoraKing: - ;JSL $1DE1AA ; Sprite_SpawnFlippersItem ; thing we wrote over - PHA : LDA NpcFlags : ORA.b #$02 : STA NpcFlags : PLA + PHA : LDA.l NpcFlags : ORA.b #$02 : STA.l NpcFlags : PLA RTL ItemSet_SickKid: JSL.l Link_ReceiveItem ; thing we wrote over - PHA : LDA NpcFlags : ORA.b #$04 : STA NpcFlags : PLA + PHA : LDA.l NpcFlags : ORA.b #$04 : STA.l NpcFlags : PLA RTL ItemSet_TreeKid: JSL.l Link_ReceiveItem ; thing we wrote over - PHA : LDA NpcFlags : ORA.b #$08 : STA NpcFlags : PLA + PHA : LDA.l NpcFlags : ORA.b #$08 : STA.l NpcFlags : PLA RTL ItemSet_Sahasrala: JSL.l Link_ReceiveItem ; thing we wrote over - PHA : LDA NpcFlags : ORA.b #$10 : STA NpcFlags : PLA + PHA : LDA.l NpcFlags : ORA.b #$10 : STA.l NpcFlags : PLA RTL ItemSet_Catfish: - ;JSL $00D52D ; GetAnimatedSpriteTile.variable ; thing we wrote over - ;JSL.l LoadCatfishItemGFX - PHA : LDA NpcFlags : ORA.b #$20 : STA NpcFlags : PLA + PHA : LDA.l NpcFlags : ORA.b #$20 : STA.l NpcFlags : PLA RTL ItemSet_Library: JSL.l Link_ReceiveItem ; thing we wrote over - PHA : LDA NpcFlags : ORA.b #$80 : STA NpcFlags : PLA + PHA : LDA.l NpcFlags : ORA.b #$80 : STA.l NpcFlags : PLA RTL ItemSet_Mushroom: PHA - LDA NpcFlags+1 : ORA.b #$10 : STA NpcFlags+1 - LDY $0E80, X ; Retrieve stored item type + LDA.l NpcFlags+1 : ORA.b #$10 : STA.l NpcFlags+1 + LDY.w $0E80, X ; Retrieve stored item type BNE + ; if for any reason the item value is 0 reload it, just in case %GetPossiblyEncryptedItem(MushroomItem, SpriteItemValues) : TAY + PLA - ;LDY.b #$29 - STZ $02E9 ; thing we wrote over - the mushroom is an npc for item purposes apparently + STZ.w $02E9 ; thing we wrote over - the mushroom is an npc for item purposes apparently RTL ItemSet_Powder: - PHA : LDA NpcFlags+1 : ORA.b #$20 : STA NpcFlags+1 : PLA + PHA : LDA.l NpcFlags+1 : ORA.b #$20 : STA.l NpcFlags+1 : PLA RTL ;================================================================================ @@ -172,11 +151,11 @@ RTL ; Randomize 300 Rupee NPC ;-------------------------------------------------------------------------------- Set300RupeeNPCItem: - INC $0D80, X ; thing we wrote over + INC.w $0D80, X ; thing we wrote over PHA : PHP REP #$20 ; set 16-bit accumulator - LDA $A0 ; these are all decimal because i got them that way + LDA.b RoomIndex ; these are all decimal because i got them that way CMP.w #291 : BNE + %GetPossiblyEncryptedItem(RupeeNPC_MoldormCave, SpriteItemValues) TAY ; load moldorm cave value into Y diff --git a/pendantcrystalhud.asm b/pendantcrystalhud.asm index b9809a5..f7cfbed 100644 --- a/pendantcrystalhud.asm +++ b/pendantcrystalhud.asm @@ -1,20 +1,17 @@ ;================================================================================ ; Pendant / Crystal HUD Fix ;-------------------------------------------------------------------------------- -;CheckPendantHUD: -; LDA HudFlag : CMP.b #$40 ; check for hud flag instead -;RTL ;================================================================================ FlipLWDWFlag: PHP SEP #$20 ; set 8-bit accumulator - LDA CurrentWorld : EOR.b #$40 : STA CurrentWorld + LDA.l CurrentWorld : EOR.b #$40 : STA.l CurrentWorld BEQ + LDA.b #07 : BRA ++ ; dark world - crystals + LDA.b #03 ; light world - pendants ++ - STA MapIcons + STA.l MapIcons PLP RTL ;================================================================================ @@ -23,7 +20,7 @@ HUDRebuildIndoorHole: LDA.l GenericKeys : BEQ .normal .generic PLA - LDA CurrentGenericKeys ; generic key count + LDA.l CurrentGenericKeys ; generic key count JSL.l HUD_RebuildIndoor_Palace RTL .normal @@ -34,18 +31,18 @@ RTL HUDRebuildIndoor: LDA.l GenericKeys : BEQ .normal .generic - LDA.b #$00 : STA $7EC017 - LDA CurrentGenericKeys ; generic key count + LDA.b #$00 : STA.l $7EC017 + LDA.l CurrentGenericKeys ; generic key count RTL .normal - LDA.b #$00 : STA $7EC017 + LDA.b #$00 : STA.l $7EC017 LDA.b #$FF ; don't show keys RTL ;================================================================================ GetCrystalNumber: PHX TXA : ASL : TAX - LDA CurrentWorld : EOR.b #$40 : BNE + + LDA.l CurrentWorld : EOR.b #$40 : BNE + INX + LDA.l CrystalNumberTable-16, X @@ -55,13 +52,13 @@ RTL OverworldMap_CheckObject: PHX ;CPX.b #$01 : BNE + : JMP ++ : + : JMP .fail - LDA CurrentWorld : AND.b #$40 : BNE + + LDA.l CurrentWorld : AND.b #$40 : BNE + ;LW Map LDA.l MapMode : BEQ +++ - LDA MapField : ORA MapOverlay : AND.b #$01 : BNE +++ + LDA.l MapField : ORA.l MapOverlay : AND.b #$01 : BNE +++ PHX LDA.l .lw_map_offsets, X : TAX ; put map offset into X - LDA MapField, X : ORA MapOverlay, X + LDA.l MapField, X : ORA.l MapOverlay, X PLX AND.l .lw_map_masks, X : BNE +++ JMP .fail @@ -72,7 +69,7 @@ OverworldMap_CheckObject: + ;DW Map LDA.l MapMode : BEQ +++ - LDA MapField : ORA MapOverlay : AND.b #$02 : BNE +++ + LDA.l MapField : ORA.l MapOverlay : AND.b #$02 : BNE +++ PHX LDA.l .dw_map_offsets, X : TAX ; put map offset into X LDA.l MapField, X : ORA MapOverlay, X @@ -90,11 +87,11 @@ RTL AND.b #$40 : BNE .checkCrystal .checkPendant - LDA PendantsField : AND.l CrystalPendantFlags, X : BNE .fail + LDA.l PendantsField : AND.l CrystalPendantFlags, X : BNE .fail CLC : BRA .done .checkCrystal - LDA CrystalsField : AND.l CrystalPendantFlags, X : BNE .fail + LDA.l CrystalsField : AND.l CrystalPendantFlags, X : BNE .fail CLC : BRA .done .fail @@ -119,33 +116,24 @@ db $02, $80, $08, $10, $01, $40, $04 SetLWDWMap: PHP SEP #$20 ; set 8-bit accumulator - LDA CurrentWorld : EOR.b #$40 + LDA.l CurrentWorld : EOR.b #$40 BNE + LDA.b #07 : BRA ++ ; dark world - crystals + LDA.b #03 ; light world - pendants ++ - STA MapIcons + STA.l MapIcons PLP RTL ;================================================================================ GetMapMode: - LDA CurrentWorld : AND.b #$40 : BEQ + + LDA.l CurrentWorld : AND.b #$40 : BEQ + LDA.b #07 ; dark world - crystals RTL + LDA.b #03 ; light world - pendants RTL ;================================================================================ -;GetPendantCrystalWorld: -; PHB : PHK : PLB -; PHX -; LDA $040C : LSR : TAX -; LDA .dungeon_worlds, X -; PLX : PLB -; CMP.b #$00 -;RTL -;================================================================================ BringMenuDownEnhanced: REP #$20 ; set 16-bit accumulator LDA.l TournamentSeed : AND.w #$00FF @@ -160,7 +148,7 @@ BringMenuDownEnhanced: !ADD $EA : CMP.w #$FF18 : !BGE .noOvershoot LDA.w #$FF18 ; if we went past the limit, go to the limit .noOvershoot - STA $EA : CMP.w #$FF18 + STA.b $EA : CMP.w #$FF18 SEP #$20 ; set 8-bit accumulator BNE .notDoneScrolling INC $0200 @@ -178,38 +166,37 @@ RaiseHudMenu: !ADD $EA : BMI .noOvershoot LDA.w #$0000 ; if we went past the limit, go to the limit .noOvershoot - STA $EA + STA.b $EA RTL ;================================================================================ CheckCloseItemMenu: LDA.l MenuCollapse : BNE + - LDA $F4 : AND.b #$10 : RTL + LDA.b $F4 : AND.b #$10 : RTL + - LDA $F0 : AND.b #$10 : EOR.b #$10 + LDA.b $F0 : AND.b #$10 : EOR.b #$10 RTL ;================================================================================ ShowDungeonItems: - LDA $040C : AND.w #$00FF : CMP.w #$00FF : BNE + : RTL : + ; return normal result if outdoors or in a cave - ;LDA $F0 : AND.w #$0020 ; check for select - LDA HudFlag : AND.w #$0020 ; check hud flag + LDA.w $040C : AND.w #$00FF : CMP.w #$00FF : BNE + : RTL : + ; return normal result if outdoors or in a cave + LDA.l HudFlag : AND.w #$0020 ; check hud flag BEQ + : LDA.w #$0000 : RTL : + ; if set, send the zero onwards - LDA $040C : AND.w #$00FF : CMP.w #$00FF ; original logic + LDA.w $040C : AND.w #$00FF : CMP.w #$00FF ; original logic RTL ;-------------------------------------------------------------------------------- UpdateKeys: PHX : PHP SEP #$30 ; set 8-bit accumulator & index registers - LDA $040C : CMP.b $1F : !BLT .skip + LDA.w $040C : CMP.b $1F : !BLT .skip LSR : TAX ; get dungeon index and store to X - LDA CurrentSmallKeys ; load current key count - STA DungeonKeys, X ; save to main counts + LDA.l CurrentSmallKeys ; load current key count + STA.l DungeonKeys, X ; save to main counts CPX.b #$00 : BNE + - STA HyruleCastleKeys ; copy HC to sewers + STA.l HyruleCastleKeys ; copy HC to sewers + : CPX.b #$01 : BNE + - STA SewerKeys ; copy sewers to HC + STA.l SewerKeys ; copy sewers to HC + .skip JSL.l PostItemGet @@ -232,34 +219,34 @@ RTL ;-------------------------------------------------------------------------------- DrawBootsInMenuLocation: LDA.l HUDDungeonItems : BNE + - LDA.w #$1608 : STA $00 + LDA.w #$1608 : STA.b $00 RTL + - LDA.w #$1588 : STA $00 + LDA.w #$1588 : STA.b $00 RTL ;-------------------------------------------------------------------------------- DrawGlovesInMenuLocation: LDA.l HUDDungeonItems : BNE + - LDA.w #$1610 : STA $00 + LDA.w #$1610 : STA.b $00 RTL + - LDA.w #$1590 : STA $00 + LDA.w #$1590 : STA.b $00 RTL ;-------------------------------------------------------------------------------- DrawFlippersInMenuLocation: LDA.l HUDDungeonItems : BNE + - LDA.w #$1618 : STA $00 + LDA.w #$1618 : STA.b $00 RTL + - LDA.w #$1598 : STA $00 + LDA.w #$1598 : STA.b $00 RTL ;-------------------------------------------------------------------------------- DrawMoonPearlInMenuLocation: LDA.l HUDDungeonItems : BNE + - LDA.w #$1620 : STA $00 + LDA.w #$1620 : STA.b $00 RTL + - LDA.w #$15A0 : STA $00 + LDA.w #$15A0 : STA.b $00 RTL ;-------------------------------------------------------------------------------- DrawHUDDungeonItems: @@ -371,10 +358,10 @@ DrawHUDDungeonItems: + ;------------------------------------------------------------------------------- - LDA HUDDungeonItems : AND.w #$0001 : BEQ .skip_small_keys + LDA.l HUDDungeonItems : AND.w #$0001 : BEQ .skip_small_keys .draw_small_keys - LDA.w #$2810 : STA $1684 ; small keys icon + LDA.w #$2810 : STA.w $1684 ; small keys icon LDY.w #0 @@ -399,10 +386,10 @@ DrawHUDDungeonItems: .skip_small_keys ; Big Keys - LDA HUDDungeonItems : AND.w #$0002 : BEQ .skip_big_keys + LDA.l HUDDungeonItems : AND.w #$0002 : BEQ .skip_big_keys - LDA.w #$2811 : STA $16C4 ; big key icon + LDA.w #$2811 : STA.w $16C4 ; big key icon ; use X so we can BIT LDX.w #0 @@ -429,10 +416,8 @@ DrawHUDDungeonItems: .skip_big_keys - LDA HUDDungeonItems : AND.w #$0010 : BEQ .skip_boss_kills - - LDA.w #$280F : STA $1704 ; skull icon - + LDA.l HUDDungeonItems : AND.w #$0010 : BEQ .skip_boss_kills + LDA.w #$280F : STA.w $1704 ; skull icon LDY.w #0 .next_boss_kill @@ -460,8 +445,8 @@ DrawHUDDungeonItems: .maps_and_compasses ; Maps - LDA HUDDungeonItems : AND.w #$0004 : BEQ .skip_maps - LDA.w #$2821 : STA $1684 ; map icon + LDA.l HUDDungeonItems : AND.w #$0004 : BEQ .skip_maps + LDA.w #$2821 : STA.w $1684 ; map icon ; use X so we can BIT LDX.w #0 @@ -489,8 +474,8 @@ DrawHUDDungeonItems: .skip_maps ; Compasses - LDA HUDDungeonItems : AND.w #$0008 : BEQ .skip_compasses - LDA.w #$2C20 : STA $16C4 ; compass icon + LDA.l HUDDungeonItems : AND.w #$0008 : BEQ .skip_compasses + LDA.w #$2C20 : STA.w $16C4 ; compass icon ; use X so we can BIT LDX.w #0 @@ -528,19 +513,19 @@ 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 $12EA, X - LDA.l .row1, X : STA $132A, X - LDA.l .row2, X : STA $136A, X - LDA.l .row3, X : STA $13AA, X - LDA.l .row4, X : STA $13EA, X - LDA.l .row5, X : STA $142A, X - LDA.l .row6, X : STA $146A, X - LDA.l .row7, X : STA $14AA, X - LDA.l .row8, X : STA $14EA, X + 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 INX #2 : CPX.w #$0014 : BCC - ; pendants - LDA PendantsField + LDA.l PendantsField LSR : BCC + ; pendant of wisdom (red) LDX.w #$252B @@ -567,7 +552,7 @@ DrawPendantCrystalDiagram: ; crystals - LDA CrystalsField + LDA.l CrystalsField LDX.w #$2D44 LDY.w #$2D45 diff --git a/playername.asm b/playername.asm index 2a820b6..b9f80bc 100644 --- a/playername.asm +++ b/playername.asm @@ -19,16 +19,16 @@ WriteBlanksToPlayerName: RTL WriteCharacterToPlayerName: - STA ExtendedFileNameSRAM, X + STA.l ExtendedFileNameSRAM, X CPX.w #$0008 : !BGE + - STA $7003D9, X ;what we wrote over + STA.l $7003D9, X ;what we wrote over + RTL ReadCharacterFromPlayerName: ;Only for use on Name Screen - LDA ExtendedFileNameSRAM, X + LDA.l ExtendedFileNameSRAM, X CPX.w #$0008 : !BGE + - LDA $7003D9, X ;what we wrote over + LDA.l $7003D9, X ;what we wrote over + RTL @@ -40,13 +40,13 @@ PLB RTL WrapCharacterPosition: - LDA $0B12 : BPL + + LDA.w $0B12 : BPL + LDA.b #$0B + CMP.b #$0C : !BLT + LDA.b #$00 + - STA $0B12 + STA.w $0B12 RTL CharacterPositions: diff --git a/potions.asm b/potions.asm index 57f3f26..7068c0f 100644 --- a/potions.asm +++ b/potions.asm @@ -4,7 +4,7 @@ ;-------------------------------------------------------------------------------- RefillHealth: REP #$20 ; set 16-bit accumulator - LDA.b $A0 ; these are all decimal because i got them that way + LDA.b RoomIndex ; these are all decimal because i got them that way CMP.w #279 : BNE + ; Spike Cave bottles work normally SEP #$20 ; set 8-bit accumulator LDA.b #$A0 @@ -50,7 +50,7 @@ RTL ;-------------------------------------------------------------------------------- RefillMagic: REP #$20 ; set 16-bit accumulator - LDA.b $A0 ; these are all decimal because i got them that way + LDA.b RoomIndex ; these are all decimal because i got them that way CMP.w #279 : BNE + ; Spike Cave bottles work normally SEP #$20 ; set 8-bit accumulator LDA.b #$80 diff --git a/quickswap.asm b/quickswap.asm index a69f7ce..3563a72 100644 --- a/quickswap.asm +++ b/quickswap.asm @@ -4,7 +4,7 @@ QuickSwap: ; We perform all other checks only if we are pushing L or R in order to have minimal ; perf impact, since this runs every frame - LDA.b $F6 : AND #$30 : BEQ .done + LDA.b $F6 : AND.b #$30 : BEQ .done XBA ; stash away the value for after the checks. @@ -18,9 +18,9 @@ QuickSwap: ; If prossing both L and R this frame, then go directly to the special swap code LDX.w $0202 : BRA .special_swap + - BIT #$10 : BEQ + ; Only pressed R + BIT.b #$10 : BEQ + ; Only pressed R JSR.w RCode - LDA.b $F2 : BIT #$20 : BNE .special_swap ; Still holding L from a previous frame + LDA.b $F2 : BIT.b #$20 : BNE .special_swap ; Still holding L from a previous frame BRA .store + ; Only pressed L @@ -29,18 +29,18 @@ QuickSwap: BRA .store .special_swap - LDA InventoryTracking+1 : ORA #$01 : STA InventoryTracking+1 + LDA.l InventoryTracking+1 : ORA.b #$01 : STA.l InventoryTracking+1 CPX.b #$02 : BEQ + ; boomerang CPX.b #$01 : BEQ + ; bow CPX.b #$05 : BEQ + ; powder CPX.b #$0D : BEQ + ; flute CPX.b #$10 : BEQ + ; bottle BRA .store - + STX $0202 : JSL ProcessMenuButtons_y_pressed + + STX.w $0202 : JSL ProcessMenuButtons_y_pressed .store LDA.b #$20 : STA.w $012F - STX $0202 + STX.w $0202 JSL HUD_RefreshIconLong PLX @@ -50,11 +50,11 @@ QuickSwap: RTL RCode: LDX.w $0202 - LDA.b $F2 : BIT #$20 : BNE ++ ; Still holding L from a previous frame - LDA InventoryTracking+1 : AND #$FE : STA InventoryTracking+1 + LDA.b $F2 : BIT.b #$20 : BNE ++ ; Still holding L from a previous frame + LDA.l InventoryTracking+1 : AND.b #$FE : STA.l InventoryTracking+1 BRA + ++ - LDA InventoryTracking+1 : BIT #$01 : BEQ + + LDA.l InventoryTracking+1 : BIT.b #$01 : BEQ + RTS - + CPX.b #$14 : BNE + : LDX.b #$00 ;will wrap around to 1 @@ -68,10 +68,10 @@ RTS LCode: LDX.w $0202 LDA.b $F2 : BIT #$10 : BNE ++ ; Still holding R from a previous frame - LDA InventoryTracking+1 : AND #$FE : STA InventoryTracking+1 + LDA.l InventoryTracking+1 : AND.b #$FE : STA.l InventoryTracking+1 BRA + ++ - LDA InventoryTracking+1 : BIT #$01 : BEQ + + LDA.l InventoryTracking+1 : BIT.b #$01 : BEQ + RTS - + CPX.b #$01 : BNE + : LDX.b #$15 ; will wrap around to $14 diff --git a/ram.asm b/ram.asm index a6a3269..98d131a 100644 --- a/ram.asm +++ b/ram.asm @@ -4,7 +4,7 @@ ; This module is primarily concerned with labeling WRAM addresses used by the ; randomizer and documenting their usage. ; -; See the JP 1.0 disassembly for reference as well +; See the JP 1.0 disassembly for reference ; (https://github.com/spannerisms/jpdasm/ - 31/10/2022) ;-------------------------------------------------------------------------------- pushpc @@ -36,6 +36,7 @@ Scrap0F: skip 1 ; LinkPosY = $7E0020 ; 2 bytes LinkPosX = $7E0022 ; 2 bytes +RoomIndex = $7E00A0 ; 2 bytes, UW room index ;================================================================================ ; Bank 7E @@ -55,6 +56,8 @@ MusicControlRequest = $7E012C ItemReceiptID = $7E02D8 +NMIAux = $7E0632 + SpritePosYLow = $7E0D00 ; all $10 bytes SpritePosXLow = $7E0D10 SpritePosYHigh = $7E0D20 @@ -69,8 +72,15 @@ SpriteDirectionTable = $7E0EB0 ToastBuffer = $7E1E0E ; 2 bytes DoToast -ScratchBufferNV = $7E1E70 ; Callee preserved, not ok to clobber -ScratchBufferV = $7E1E80 ; Caller preserved, okay to clobber +MSUResumeTime = $7E1E6B ; 4 bytes +MSUResumeControl = $7E1E6F +MSUFallbackTable = $7E1E70 ; 8 bytes +MSUDelayedCommand = $7E1E79 +MSUPackCount = $7E1E7A +MSUPackCurrent = $7E1E7B +MSUPackRequest = $7E1E7C +MSULoadedTrack = $7E1E7D ; 2 bytes +MSUResumeTrack = $7E1E7F ;1E90 ClockHours = $7E1E90 ; Clock Hours @@ -78,7 +88,9 @@ ClockMinutes = $7E1E94 ; Clock Minutes ClockSeconds = $7E1E98 ; Clock Seconds ClockBuffer = $7E1E9C ; Clock Temporary ;1EA0 +ScratchBufferNV = $7E1EA0 ; Callee preserved ;1EB0 +ScratchBufferV = $7E1EB0 ; Caller preserved ;1EC0 ;1ED0 ;1EE0 @@ -108,103 +120,111 @@ BigRAM = $7EC900 ; Big buffer of free ram (0x1F00) ;================================================================================ ; Bank 7F ;-------------------------------------------------------------------------------- -RedrawFlag = $7F5000 - -SpriteSkipEOR = $7F5008 - -MSReceived = $7F5031 -; GanonWarpChain = $7F5032 -ForceHeartSpawn = $7F5033 -SkipHeartSave = $7F5034 -AltTextFlag = $7F5035 ; two bytes, next must be zero. 0=disable -BossKills = $7F5037 -LagTime = $7F5038 -RupeesCollected = $7F503C ; 2 bytes -NonChestCounter = $7F503E - -TileUploadOffsetOverride = $7F5042 - -NMIAux = $7F5044 - -ShopId = $7F5050 -ShopType = $7F5051 -ShopInventory = $7F5052 ; 0x0C -ShopState = $7F505F -ShopCapacity = $7F5060 -ShopScratch = $7F5061 -ShopSRAMIndex = $7F5062 -ShopMerchant = $7F5063 -; ShopDMATimer = $7F5064 unused -ShopPriceColumn = $7F5066 ; two bytes - -OneMindId = $7F5072 -OneMindTimerRAM = $7F5073 - -ClockStatus = $7F507E ; 2 bytes - ; ---- --dn - ; d - dnf - ; n - negative - -RNGLockIn = $7F5090 ; RNG Item -BusyItem = $7F5091 -BusyHealth = $7F5092 -BusyMagic = $7F5093 -DialogOffsetPointer = $7F5094 ; 2 bytes -DialogReturnPointer = $7F5096 ; 2 bytes - -StalfosBombDamage = $7F509D -ValidKeyLoaded = $7F509E - -SwordModifier = $7F50C0 -ShieldModifier = $7F50C1 ; not implemented -ArmorModifier = $7F50C2 -MagicModifier = $7F50C3 -LightConeModifier = $7F50C4 -CuccoStormer = $7F50C5 ; non-zero write causes storm, needs to be zeroed -OldManDash = $7F50C6 -IceModifier = $7F50C7 -InfiniteArrows = $7F50C8 -InfiniteBombs = $7F50C9 -InfiniteMagic = $7F50CA -DPadInverter = $7F50CB ; fill in values -OHKOFlag = $7F50CC -SpriteSwapper = $7F50CD -BootsModifier = $7F50CE - -; $7F50D0 - $7F50FF - Block Cypher Parameters -; $7F5100 - $7F51FF - Block Cypher Buffer - -; Crypto buffer ($7F50D0 - $7F51FF) -KeyBase = $7F50D0 -y = $7F50E0 -z = $7F50E4 -Sum = $7F50E8 -p = $7F50EC -e = $7F50F0 -CryptoScratch = $7F50F2 -CryptoBuffer = $7F5100 -v = $7F5100 - -RNGPointers = $7F5200 ; $FF bytes - -RxBuffer = $7F5300 ; $00-$5F buffer $60-7E reserved -RxStatus = $7F537F ; 1 byte -TxBuffer = $7F5380 ; $80 - $EF buffer $F0 - $FE reserved -TxStatus = $7F53FF ; $F0 - $FE - -MSUFallbackTable = $7F5460 ; 8 bytes -MSUDelayedCommand = $7F5469 -MSUPackCount = $7F546A -MSUPackCurrent = $7F546B -MSUPackRequest = $7F546C -MSULoadedTrack = $7F546D ; 2 bytes -MSUResumeTrack = $7F546F -MSUResumeTime = $7F5470 ; 4 bytes -MSUResumeControl = $7F5474 - -CompassTotalsWRAM = $7F5410 - -DialogBuffer = $7F5700 ; $FF bytes +base $7F5000 +RedrawFlag: skip 1 ; +skip 2 ; +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 ; +HexToDecDigit4: skip 1 ; +HexToDecDigit5: skip 1 ; +SpriteSkipEOR: skip 2 ; Used in utilities.asm to determine when to skip drawing sprites. Zero-padded +skip $2B ; Unused +AltTextFlag: skip 2 ; dialog.asm: Determines whether to load from vanilla decompression buffer + ; or from a secondary buffer (used for things like free dungeon item text) +BossKills: skip 1 ; +LagTime: skip 4 ; Computed during stats preparation for display +RupeesCollected: skip 2 ; Computed during stats preparation for display +NonChestCounter: skip 2 ; Computed during stats preparation for display +skip 2 ; Unused +TileUploadOffsetOverride: skip 2 ; Offset override for loading sprite gfx +skip 3 ; +skip 9 ; + ; Shop Block $7F5050 - $7F506F +ShopId: skip 1 ; Shop ID. Used for indexing and loading inventory for custom shops +ShopType: skip 1 ; Shop type. $FF = vanilla shop + ; t - - - - - - - + ; t = Take-any +ShopInventory: skip $0D ; For three possible shop items, row major: + ; [Item ID][Price low][Price High][Purchase Count] +ShopState: skip 1 ; - - - - - l c r | Bitfield that determines whether to draw an item +ShopCapacity: skip 1 ; Four lower bits of shop_config in ShopTable, number of items 1-3 +ShopScratch: skip 1 ; Scratch byte used in shop drawing routines +ShopSRAMIndex: skip 1 ; SRAM index for purchase counts +ShopMerchant: skip 1 ; Loaded from ShopTable and used to jump to one of four drawing routines +skip 2 ; Unused +ShopPriceColumn: skip 3 ; Stores coordinates for drawing prices in shops +skip 7 ; +skip 2 ; Reserved for OneMind +OneMindId: skip 1 ; Current OneMind player +OneMindTimerRAM: skip 2 ; Frame counter for OneMind +skip 9 ; Unused +ClockStatus: skip 2 ; 2 bytes second always zero padding + ; ---- --dn + ; d - DNF mode + ; n - Negative +skip $10 ; Unused +RNGLockIn: skip 1 ; Used for RNG item (currently unused by rando) +BusyItem: skip 1 ; Flags for indicating when these things are "busy" +BusyHealth: skip 1 ; e.g. doing some animation +BusyMagic: skip 1 ; +DialogOffsetPointer: skip 2 ; Offset and return pointer into new dialog buffer used +DialogReturnPointer: skip 2 ; for e.g. free dungeon item text. +skip 1 ; Unused +PreviousOverworldDoor: skip 1 ; Previous overworld door is cached or initialized here +skip 1 ; Reserved +skip 1 ; Unused +DuckMapFlag: skip 1 ; Temporary flag used and reset by flute map drawing routine +StalfosBombDamage: skip 1 ; Relocated from damage table +ValidKeyLoaded: skip 1 ; +TextBoxDefer: skip 1 ; Flag used to defer post-item text boxes +skip $10 ; Unused +skip $10 ; Reserved for enemizer + ; Most of these modifiers are intended to be written to by + ; a 3rd party (e.g. Crowd Control.) Writer is responsible + ; for zeroing. +SwordModifier: skip 1 ; Adds level to current sword. Doesn't change graphics. +ShieldModifier: skip 1 ; Not implemented +ArmorModifier: skip 1 ; Adds level to current mail. Doesn't change graphics. +MagicModifier: skip 1 ; Adds level to magic consumption (1/2, 1/4.) +LightConeModifier: skip 1 ; Gives lamp cone when set to 1 +CuccoStormer: skip 1 ; Non-zero write causes storm. +OldManDash: skip 1 ; Unused +IceModifier: skip 1 ; - - - g - - - i | Flipping either sets ice physics +InfiniteArrows: skip 1 ; Setting these to $01 will give infinite ammo. Set by +InfiniteBombs: skip 1 ; EscapeAssist. +InfiniteMagic: skip 1 ; +ControllerInverter: skip 1 ; $01 = D-pad | $02 = Buttons | $03 = Buttons and D-Pad + ; >=$04 = Swap buttons and D-pad +OHKOFlag: skip 1 ; Any non-zero write sets OHKO mode +SpriteSwapper: skip 1 ; Loads new link sprite and glove/armor palette. No gfx or + ; code currently in base ROM for this. +BootsModifier: skip 1 ; $01 = Give dash ability +skip 1 ; Unused + ; Crypto Block ($7F50D0 - $7F51FF) +KeyBase: skip $10 ; +y: skip 4 ; +z: skip 4 ; +Sum: skip 4 ; +p: skip 4 ; +e: skip 2 ; +CryptoScratch: skip $0E ; +CryptoBuffer: ; +v: skip $100 ; +RNGPointers: skip $100 ; Pointers for static RNG + ; Network I/O block. See servicerequest.asm. Rx and Tx channels + ; also allocated 8 persistent bytes each in sram.asm. +RxBuffer: skip $7F ; +RxStatus: skip 1 ; +TxBuffer: skip $7F ; +TxStatus: skip 1 ; +skip $10 ; Unused +CompassTotalsWRAM: skip $10 ; skip $10 +skip $40 ; Reserved for general dungeon tracking data. May have over + ; allocated here. Feel free to reassign. +skip $40 ; Unused +skip $260 ; Unused +DialogBuffer: skip $100 ; Dialog Buffer ;================================================================================ ; RAM Assertions @@ -233,6 +253,7 @@ endmacro %assertRAM(LinkPosY, $7E0020) %assertRAM(LinkPosX, $7E0022) +%assertRAM(RoomIndex, $7E00A0) %assertRAM(CurrentMSUTrack, $7E010B) %assertRAM(CurrentVolume, $7E0127) %assertRAM(TargetVolume, $7E0129) @@ -240,6 +261,7 @@ endmacro %assertRAM(MusicControl, $7E012B) %assertRAM(MusicControlRequest, $7E012C) %assertRAM(ItemReceiptID, $7E02D8) +%assertRAM(NMIAux, $7E0632) %assertRAM(SpritePosYLow, $7E0D00) %assertRAM(SpritePosXLow, $7E0D10) %assertRAM(SpritePosYHigh, $7E0D20) @@ -249,12 +271,24 @@ endmacro %assertRAM(SpriteTypeTable, $7E0E20) %assertRAM(SpriteDirectionTable, $7E0EB0) %assertRAM(ToastBuffer, $7E1E0E) -%assertRAM(ScratchBufferNV, $7E1E70) -%assertRAM(ScratchBufferV, $7E1E80) + +%assertRAM(MSUResumeTime, $7E1E6B) +%assertRAM(MSUResumeControl, $7E1E6F) +%assertRAM(MSUFallbackTable, $7E1E70) +%assertRAM(MSUDelayedCommand, $7E1E79) +%assertRAM(MSUPackCount, $7E1E7A) +%assertRAM(MSUPackCurrent, $7E1E7B) +%assertRAM(MSUPackRequest, $7E1E7C) +%assertRAM(MSULoadedTrack, $7E1E7D) +%assertRAM(MSUResumeTrack, $7E1E7F) + + %assertRAM(ClockHours, $7E1E90) %assertRAM(ClockMinutes, $7E1E94) %assertRAM(ClockSeconds, $7E1E98) %assertRAM(ClockBuffer, $7E1E9C) +%assertRAM(ScratchBufferNV, $7E1EA0) +%assertRAM(ScratchBufferV, $7E1EB0) %assertRAM(TileUploadBuffer, $7EA180) %assertRAM(SpriteOAM, $7EC025) %assertRAM(HUDKeyIcon, $7EC726) @@ -266,17 +300,21 @@ endmacro %assertRAM(HUDKeyDigits, $7EC764) %assertRAM(BigRAM, $7EC900) %assertRAM(RedrawFlag, $7F5000) +%assertRAM(HexToDecDigit1, $7F5003) +%assertRAM(HexToDecDigit2, $7F5004) +%assertRAM(HexToDecDigit3, $7F5005) +%assertRAM(HexToDecDigit4, $7F5006) +%assertRAM(HexToDecDigit5, $7F5007) %assertRAM(SpriteSkipEOR, $7F5008) -%assertRAM(MSReceived, $7F5031) -%assertRAM(ForceHeartSpawn, $7F5033) -%assertRAM(SkipHeartSave, $7F5034) + + + %assertRAM(AltTextFlag, $7F5035) %assertRAM(BossKills, $7F5037) %assertRAM(LagTime, $7F5038) %assertRAM(RupeesCollected, $7F503C) %assertRAM(NonChestCounter, $7F503E) %assertRAM(TileUploadOffsetOverride, $7F5042) -%assertRAM(NMIAux, $7F5044) %assertRAM(ShopId, $7F5050) %assertRAM(ShopType, $7F5051) %assertRAM(ShopInventory, $7F5052) @@ -295,8 +333,11 @@ endmacro %assertRAM(BusyMagic, $7F5093) %assertRAM(DialogOffsetPointer, $7F5094) %assertRAM(DialogReturnPointer, $7F5096) +%assertRAM(PreviousOverworldDoor, $7F5099) +%assertRAM(DuckMapFlag, $7F509C) %assertRAM(StalfosBombDamage, $7F509D) %assertRAM(ValidKeyLoaded, $7F509E) +%assertRAM(TextBoxDefer, $7F509F) %assertRAM(SwordModifier, $7F50C0) %assertRAM(ShieldModifier, $7F50C1) %assertRAM(ArmorModifier, $7F50C2) @@ -308,7 +349,7 @@ endmacro %assertRAM(InfiniteArrows, $7F50C8) %assertRAM(InfiniteBombs, $7F50C9) %assertRAM(InfiniteMagic, $7F50CA) -%assertRAM(DPadInverter, $7F50CB) +%assertRAM(ControllerInverter, $7F50CB) %assertRAM(OHKOFlag, $7F50CC) %assertRAM(SpriteSwapper, $7F50CD) %assertRAM(BootsModifier, $7F50CE) @@ -326,15 +367,6 @@ endmacro %assertRAM(RxStatus, $7F537F) %assertRAM(TxBuffer, $7F5380) %assertRAM(TxStatus, $7F53FF) -%assertRAM(MSUFallbackTable, $7F5460) -%assertRAM(MSUDelayedCommand, $7F5469) -%assertRAM(MSUPackCount, $7F546A) -%assertRAM(MSUPackCurrent, $7F546B) -%assertRAM(MSUPackRequest, $7F546C) -%assertRAM(MSULoadedTrack, $7F546D) -%assertRAM(MSUResumeTrack, $7F546F) -%assertRAM(MSUResumeTime, $7F5470) -%assertRAM(MSUResumeControl, $7F5474) %assertRAM(CompassTotalsWRAM, $7F5410) %assertRAM(DialogBuffer, $7F5700) @@ -344,36 +376,7 @@ pullpc ; Bank 7F ;-------------------------------------------------------------------------------- -; $7F5000 - Redraw Flag -; $7F5001 - Flipper Softlock Possible -; $7F5002 - L/R Rotate -; $7F5003 - HexToDec 1st Digit -; $7F5004 - HexToDec 2nd Digit -; $7F5005 - HexToDec 3rd Digit -; $7F5006 - HexToDec 4th Digit -; $7F5007 - HexToDec 5th Digit -; $7F5008 - Skip Sprite_DrawMultiple EOR -; $7F5009 - Always Zero -; $7F5010 - Unused -; $7F5020 - Unused -; $7F5030 - Unused -; $7F5031 - HUD Master Sword Flag -; $7F5032 - Unused -; $7F5033 - Force Heart Spawn Counter -; $7F5034 - Skip Heart Collection Save Counter -; $7F5035 - Alternate Text Pointer Flag ; 0=Disable -; $7F5036 - Padding Byte (Must be Zero) -; $7F5037 - Stats Boss Kills -; $7F5038 - Stats Lag Time -; $7F5039 - Stats Lag Time -; $7F503A - Stats Lag Time -; $7F503B - Stats Lag Time -; $7F503C - Stats Rupee Total -; $7F503D - Stats Rupee Total -; $7F503E - Stats Item Total -; $7F503F - Unused -; $7F5040 - Free Item Dialog Temporary -; $7F5041 - Unused +;OLDSTUFF ; $7F5042 - Tile Upload Offset Override (Low) ; $7F5043 - Tile Upload Offset Override (High) ; $7F5044 - $7F5046 - NMI Auxiliary Function @@ -395,11 +398,11 @@ pullpc ; $7F5095 - Dialog Offset Pointer (High) ; $7F5096 - Dialog Offset Pointer Return (Low) ; $7F5097 - Dialog Offset Pointer Return (High) -; $7F5098 - Water Entry Index +; $7F5098 - Unused ; $7F5099 - Last Entered Overworld Door ID ; $7F509A - (Reserved) ; $7F509B - Unused -; $7F509C - Unused +; $7F509C - Duck Map Flag ; $7F509E - Valid Key Loaded ; $7F509F - Text Box Defer Flag ; $7F50A0 - $7F50AF - Unused @@ -427,8 +430,7 @@ pullpc ; $7F5300 - $7F53FF - Multiworld Block ; $7F5400 - $7F540F - Unused ; $7F5410 - $7F545F - Dungeon Tracking Block -; $7F5460 - $7F549F - MSU Block -; $7F54A0 - $7F56FF - Unused +; $7F5460 - $7F56FF - Unused ; $7F5700 - $7F57FF - Dialog Buffer diff --git a/retro.asm b/retro.asm index 062aafc..c68fab2 100644 --- a/retro.asm +++ b/retro.asm @@ -35,7 +35,7 @@ DecrementArrows: BRA .done .rupees REP #$20 - LDA.b $A0 : CMP.w #$0111 : SEP #$20 : BNE .not_archery_game + LDA.b RoomIndex : CMP.w #$0111 : SEP #$20 : BNE .not_archery_game LDA.b $1B : BEQ .not_archery_game ; in overworld LDA.w $0B9A : BEQ .shoot_arrow ; arrow game active LDA.b #$00 : BRA .done diff --git a/rngfixes.asm b/rngfixes.asm index 335884e..6ad59f6 100644 --- a/rngfixes.asm +++ b/rngfixes.asm @@ -44,7 +44,7 @@ RNG_Lanmolas1: RNG_Moldorm1: LDA.b #$01 : BRA _rng_done RNG_Agahnim1: - LDA.b $A0 : CMP.b #$20 : BNE RNG_Agahnim2 ; Agah 1 and 2 use the same code, check which agah we're fighting and branch + LDA.b RoomIndex : CMP.b #$20 : BNE RNG_Agahnim2 ; Agah 1 and 2 use the same code, check which agah we're fighting and branch LDA.b #$02 JSL.l GetStaticRNG : PHA LDA.l GanonAgahRNG : BEQ + ; check if blue balls are disabled diff --git a/roomloading.asm b/roomloading.asm index 90cf931..db4b709 100644 --- a/roomloading.asm +++ b/roomloading.asm @@ -4,7 +4,7 @@ LoadRoomHook: .noStats JSL Dungeon_LoadRoom REP #$10 ; 16 bit XY - LDX $A0 ; Room ID + LDX.b RoomIndex ; Room ID LDA.l RoomCallbackTable, X SEP #$10 ; 8 bit XY JSL UseImplicitRegIndexedLongJumpTable @@ -68,20 +68,20 @@ macro DrawBombosPlatform(roomX, roomY, quadX, quadY) endMacro IcePalaceBombosSE: - LDA AllowSwordlessMedallionUse : CMP #$01 : BEQ + : RTL : + + LDA.l AllowSwordlessMedallionUse : CMP.b #$01 : BEQ + : RTL : + %DrawBombosPlatform(14, 18, 1, 1) RTL IcePalaceBombosSW: - LDA AllowSwordlessMedallionUse : CMP #$01 : BEQ + : RTL : + + LDA.l AllowSwordlessMedallionUse : CMP.b #$01 : BEQ + : RTL : + %DrawBombosPlatform(14, 18, 0, 1) RTL IcePalaceBombosNE: - LDA AllowSwordlessMedallionUse : CMP #$01 : BEQ + : RTL : + + LDA.l AllowSwordlessMedallionUse : CMP.b #$01 : BEQ + : RTL : + %DrawBombosPlatform(14, 18, 1, 0) RTL CastleEastEntrance: - LDA ProgressIndicator : CMP.b #$02 : !BLT + : RTL : + ; only apply in rain states (0 or 1) + LDA.l ProgressIndicator : CMP.b #$02 : !BLT + : RTL : + ; only apply in rain states (0 or 1) LDA.l BlockCastleDoorsInRain : BNE + : RTL : + REP #$20 ; 16 A @@ -112,7 +112,7 @@ CastleEastEntrance: RTL CastleWestEntrance: - LDA ProgressIndicator : CMP.b #$02 : !BLT + : RTL : + ; only apply in rain states (0 or 1) + LDA.l ProgressIndicator : CMP.b #$02 : !BLT + : RTL : + ; only apply in rain states (0 or 1) LDA.l BlockCastleDoorsInRain : BNE + : RTL : + REP #$20 ; 16 A diff --git a/rupeelimit.asm b/rupeelimit.asm deleted file mode 100644 index aa31845..0000000 --- a/rupeelimit.asm +++ /dev/null @@ -1,20 +0,0 @@ -;================================================================================ -; Four Digit Rupees -;-------------------------------------------------------------------------------- -Draw4DigitRupees: - LDA $1B : AND.w #$00FF : BEQ .outdoors ; skip if outdoors - .indoors - LDA $A0 : BNE .normal ; skip except for ganon's room - LDA TotalItemCounter - BRA .print - .outdoors - .normal - LDA DisplayRupees - .print - JSL.l HexToDec - LDA $7F5004 : AND.w #$00FF : ORA.w #$2400 : STA $7EC750 - LDA $7F5005 : AND.w #$00FF : ORA.w #$2400 : STA $7EC752 - LDA $7F5006 : AND.w #$00FF : ORA.w #$2400 : STA $7EC754 - LDA $7F5007 : AND.w #$00FF : ORA.w #$2400 : STA $7EC756 -RTL -;================================================================================ diff --git a/sandbox.asm b/sandbox.asm deleted file mode 100644 index 29b3c37..0000000 --- a/sandbox.asm +++ /dev/null @@ -1,363 +0,0 @@ -;Spawn location table cryptic documentation -;$A0 |$15B6E - $15B7B (2) Starting room -;$0601 |$15B7C - $15BB3 (8) scroll ranges -;$E2 |$15BB4 - $15BC1 (2) Location X? Scroll Data -;$E8 |$15BC2 - $15BCF (2) Location Y? Scroll Data -;$20 |$15BD0 - $15BDD (2) link x? -;$22 |$15BDE - $15BEB (2) link y? -;$0618 |$15BEC - $15BF9 (2) camera y? -;$061c |$15BFA - $15C07 (2) camera x? -;$0AA1 |$15C08 - $15C0E (1) Starting Location Blockset Type -;$A4 |$15C0F - $15C15 (1) Starting Location Floor Type -;$040C |$15C16 - $15C1C (1) Dungeon Designation -;$EE,$0476|$15C1D - $15C23 (1) ladder and background -;$A6,$A7 |$15C24 - $15C2A (1) scroll properties -;$A9,$AA |$15C2B - $15C31 (1) Scroll Quandrant -;$0696 |$15C32 - $15C3F (2) overworld exit location -;$010E |$15C40 - $15C4D (2) starting location entrance value -;$0132 |$15C4E - $15C54 (1) music - -;----------------------------------------------- -; Sanc Spawn point at dark sanc -;----------------------------------------------- - -org $02D8D4 : dw $112 -org $02D8E8 : db $22, $22, $22, $23, $04, $04, $04, $05 -org $02D91A : dw $0400 -org $02D928 : dw $222e -org $02D936 : dw $229a -org $02D944 : dw $0480 -org $02D952 : dw $00a5 -org $02D960 : dw $007F -org $02D96D : db $14 -org $02D974 : db $00 -org $02D97B : db $FF -org $02D982 : db $00 -org $02D989 : db $02 -org $02D990 : db $00 -org $02D998 : dw $0000 -org $02D9A6 : dw $005A -org $02D9B3 : db $12 - -; Handle exit from this cave -org $308250 ;StartingAreaExitTable -dw $0112 : db $53 : dw $001e, $0400, $06e2, $0446, $0758, $046d, $075f : db $00, $00, $00 -org $308240 ;StartingAreaExitOffset -db $00, $01, $00, $00, $00, $00, $00 - - -;----------------------------------------------- -; Old man spawn point at End of Cave -;----------------------------------------------- -org $02D8DE : dw $00F1 -org $02D910 : db $1F, $1E, $1F, $1F, $03, $02, $03, $03 -org $02D924 : dw $0300 -org $02D932 : dw $1F10 -org $02D940 : dw $1FC0 -org $02D94E : dw $0378 -org $02D95C : dw $0187 -org $02D96A : dw $017F -org $02D972 : db $06 -org $02D979 : db $00 -org $02D980 : db $FF -org $02D987 : db $00 -org $02D98E : db $22 -org $02D995 : db $12 -org $02D9A2 : dw $0000 -org $02D9B0 : dw $0007 -org $02D9B8 : db $12 - - -;-------------------------------------------------------------- -; Make Houlihan exit at Pyramid -;-------------------------------------------------------------- -org $02DB68 : dw $0003 -org $02DBC9 : db $5b -org $02DC55 : dw $0b0e -org $02DCF3 : dw $075a -org $02DD91 : dw $0674 -org $02DE2F : dw $07a8 -org $02DECD : dw $06e8 -org $02DF6B : dw $07c7 -org $02E009 : dw $06f3 -org $02E06A : db $06 -org $02E0B9 : db $fa -org $02E145 : dw $0000 -org $02E1E3 : dw $0000 - -;-------------------------------------------------------------- -; Make Houlihan exit at C-Shaped House -;-------------------------------------------------------------- -;org $02DB68 : dw $0003 -;org $02DBC9 : db $58 -;org $02DC55 : dw $09d8 -;org $02DCF3 : dw $0744 -;org $02DD91 : dw $02ce -;org $02DE2F : dw $0797 -;org $02DECD : dw $0348 -;org $02DF6B : dw $07b3 -;org $02E009 : dw $0353 -;org $02E06A : db $0a -;org $02E0B9 : db $f6 -;org $02E145 : dw $0DE8 -;org $02E1E3 : dw $0000 - -;-------------------------------------------------------------- -; Inverted Exit Shuffles -;-------------------------------------------------------------- - -; swap bomb shop and links house -org $02DB8C+$00 : db $6C -org $1BBB73+$00 : db $53 -org $1BBB73+$52 : db $01 - -; swap AT and GT -org $1BBB73+$23 : db $37 -org $1BBB73+$36 : db $24 -org $02DAEE+$38+$38 : dw $00e0 -org $02DAEE+$25+$25 : dw $000c - -; Bumper Cave (Bottom) => Old Man Cave (West) -org $1BBB73+$15 : db $06 -org $02DAEE+$17+$17 : dw $00f0 - -; Old Man Cave (West) => Bumper Cave (Bottom) -org $1BBB73+$05 : db $16 -org $02DAEE+$07+$07 : dw $00fb - -; Death Mountain Return Cave (West) => Bumper Cave (Top) -org $1BBB73+$2d : db $17 -org $02DAEE+$2f+$2f : dw $00eb - -; Old Man Cave (East) => Death Mountain Return Cave (West) -org $1BBB73+$06 : db $2e -org $02DAEE+$08+$08 : dw $00e6 - -; Bumper Cave (Top) => Dark Death Mountain Fairy -org $1BBB73+$16 : db $5e - -; Dark Death Mountain Healer Fairy => Old Man Cave (East) -org $1BBB73+$6F : db $07 -org $02DAEE+$18+$18 : dw $00f1 -org $02DB8C+$18 : db $43 -org $02DBDB+$18+$18 : dw $1400 -org $02DC79+$18+$18 : dw $0294 -org $02DD17+$18+$18 : dw $0600 -org $02DDB5+$18+$18 : dw $02e8 -org $02DE53+$18+$18 : dw $0678 -org $02DEF1+$18+$18 : dw $0303 -org $02DF8F+$18+$18 : dw $0685 -org $02E02D+$18 : db $0a -org $02E07C+$18 : db $f6 -org $02E0CB+$18+$18 : dw $0000 -org $02E169+$18+$18 : dw $0000 - -;-------------------------------------------------------------- -; Other inverted -;-------------------------------------------------------------- -org $30804A : db $01 ; main toggle -org $0283E0 : db $F0 ; residual portal -org $02B34D : db $F0 ; residual portal -org $06DB78 : db $8B ; residual portal - -org $05AF79 : db $F0 ; vortex -org $0DB3C5 : db $C6 ; vortex -org $07A3F4 : db $F0 ; duck -org $07A3F4 : db $F0 ; duck -org $02E849 : dw $0043, $0056, $0058, $006C, $006F, $0070, $007B, $007F, $001B ; Dark World Flute Spots -org $02E8D5 : dw $07C8 ; nudge flute spot 3 out of gargoyle statue -org $02E8F7 : dw $01F8 ; nudge flute spot 3 out of gargoyle statue -org $07A943 : db $F0 ; Dark to light world mirror -org $07A96D : db $D0 ; residual portal? - -org $08D40C : db $D0 ; morph poof -org $308174 : db $01 ; ER's Fix fake worlds fix. Currently needed for inverted - -org $0280A6 : db $D0 ; Spawn logic - -org $1FED31 : db $0E ; pre-open open TR bomb door -org $1FED41 : db $0E ; pre-open open TR bomb door - -org $0ABFBB : db $90 ; Show portal on dark world map - -org $308089 : db $01 ; Open TR Entrance if exiting from it - -org $06B2AA : JSL Sprite_ShowMessageFromPlayerContact -; front end will actually do `org $06B2AB : dl $05E1F0` - -; Write to StartingAreaOverworldDoor table to indicate the overworld door being used for -; the single entrance spawn point -org $308247 ; PC 0x180247 -db $00, $5A, $00, $00, $00, $00, $00 - -org $1AF696 : db #$F0 ;Bat X position (sprite_retreat_bat.asm:130) -org $1AF6B2 : db #$33 ;Bat Delay (sprite_retreat_bat.asm:136) - -;New Hole Mask Position -org $1AF730 -db $6A, $9E, $0C, $00 -db $7A, $9E, $0C, $00 -db $8A, $9E, $0C, $00 -db $6A, $AE, $0C, $00 -db $7A, $AE, $0C, $00 -db $8A, $AE, $0C, $00 -db $67, $97, $0C, $00 -db $8D, $97, $0C, $00 - -;Cryptic documentation of flute/whirlpool table format (all value 16 bit) -;eae5 - Overworld area that the exit leads to -;eb07 $0084 - VRAM locations to place Link at. -;eb29 $e6/0122/0124 - Y Scroll Data -;eb4b $e0/011e/0120 - X Scroll Data -;eb6d $20 - Link's Y Coordinate -;eb8f $22 - Link's X Coordinate -;ebb1 $0618 - Camera Y Coordinate -;ebd3 $061c - Camera X Coordinate -;ebf5 $0624- Ukn1 in HM -;ec17 $0628- Ukn2 in HM - -;adjust flute spot 9 position -org $02E87B : dw $00ae -org $02E89D : dw $0610 -org $02E8BF : dw $077e -org $02E8E1 : dw $0672 -org $02E903 : dw $07f8 -org $02E925 : dw $067d -org $02E947 : dw $0803 -org $02E969 : dw $0000 -org $02E98B : dw $FFF2 - -; aga tower exit/ pyramid spawn (now hyrule castle ledge spawn) -org $02DAEE+$06+$06 : dw $0020 -org $02DB8C+$06 : db $1B -org $02DBDB+$06+$06 : dw $00ae -org $02DC79+$06+$06 : dw $0610 -org $02DD17+$06+$06 : dw $077e -org $02DDB5+$06+$06 : dw $0672 -org $02DE53+$06+$06 : dw $07f8 -org $02DEF1+$06+$06 : dw $067d -org $02DF8F+$06+$06 : dw $0803 -org $02E02D+$06 : db $00 -org $02E07C+$06 : db $f2 -org $02E0CB+$06+$06 : dw $0000 -org $02E169+$06+$06 : dw $0000 - - -org $308350 : db $00, $00, $01 ; Death mountain cave should start on overworld - -;(0x????,0x1B,0x0130,0x060a,0x0716,0x0672,0x07f8,0x0681,0x0803,0x0c,0x02,xx,xx) -; Exit table cryptic documentation: -;??|$15D8A-$15E27 - (0x4F entries, 2 bytes each) - Rooms that exit to overworld Areas ("Room" in HM) -;??|$15E28-$15E76 - (0x4F entries, 1 byte each) - Overworld area that the exit leads to. ("Map" in HM) -;84|$15E77-$15F14 - (0x4F entries, 2 bytes each) - VRAM locations to place Link at. Gets fed to $7E0084 (???? in HM) -;e6|$15F15-$15FB2 - (0x4F entries, 2 bytes each) - Y Scroll Data -;e0|$15FB3-$16050 - (0x4F entries, 2 bytes each) - X Scroll Data -;$20|$16051-$160EE - (0x4F entries, 2 bytes each) - Link's Y Coordinate -;$22|$160EF-$1618C - (0x4F entries, 2 bytes each) - Link's X Coordinate -;0618|$1618D-$1622A - (0x4F entries, 2 bytes each) - Camera Y Coordinate -;061c|$1622B-$162C8 - (0x4F entries, 2 bytes each) - Camera X Coordinate -;0624|$162C9-$16317 - (0x4F entries, 1 byte each) - Ukn1 in HM -;0628|$16318-$16366 - (0x4F entries, 1 byte each) - Ukn2 in HM - -; redefine some map16 tiles -org $0FF1C8 -dw #$190F, #$190F, #$190F, #$194C -dw #$190F, #$194B, #$190F, #$195C -dw #$594B, #$194C, #$19EE, #$19EE -dw #$194B, #$19EE, #$19EE, #$19EE -dw #$594B, #$190F, #$595C, #$190F -dw #$190F, #$195B, #$190F, #$190F -dw #$19EE, #$19EE, #$195C, #$19EE -dw #$19EE, #$19EE, #$19EE, #$595C -dw #$595B, #$190F, #$190F, #$190F - -; Redefine more map16 tiles -org $0FA480 -dw #$190F, #$196B, #$9D04, #$9D04 -dw #$196B, #$190F, #$9D04, #$9D04 - -; update pyramid hole entrances -org $1bb810 : dw $00BE, $00C0, $013E -org $1bb836 : dw $001B, $001B, $001B -; add an extra pyramid hole entrance -; ExtraHole_Map16: -org $308300 : dw $0140 -; ExtraHole_Area: -org $308320 : dw $001B -; ExtraHole_Entrance: -org $308340 : db $7B - -;prioritize retreat Bat and use 3rd sprite section -org $1af504 : dw $148B -org $1af50c : dw $149B -org $1af514 : dw $14A4 -org $1af51c : dw $1489 -org $1af524 : dw $14AC -org $1af52c : dw $54AC -org $1af534 : dw $148C -org $1af53c : dw $548C -org $1af544 : dw $1484 -org $1af54c : dw $5484 -org $1af554 : dw $14A2 -org $1af55c : dw $54A2 -org $1af564 : dw $14A0 -org $1af56c : dw $54A0 -org $1af574 : dw $148E -org $1af57c : dw $548E -org $1af584 : dw $14AE -org $1af58c : dw $54AE - -;Make retreat bat gfx available in Hyrule castle. -org $00DB9D : db $1A ;sprite set 1, section 3 -org $00DC09 : db $1A ;sprite set 27, section 3 - -;use new castle hole graphics (The values are the SNES address of the graphics: 31e000) -org $00D009 : db $31 -org $00D0e8 : db $E0 -org $00D1c7 : db $00 - -;add color for shading for castle hole -org $1BE8DA : dw $39AD - -; TR tail jump -org $00886e : db $5C, $00, $A0, $A1 - -;Remove Hyrule Castle Gate warp -org $09D436 : db $F3 ;replace whirlpool with (harmless) SpritePositionTarget Overlord - -;Add warps under rocks, etc. -org $1BC67A : db #$2E, #$0B, #$82 ; Replace a rupee under bush to add a warp on map 80 (top of kak) -org $1BC81E : db #$94, #$1D, #$82 ; Replace a heart under bush to add a warp on map 120 (mire) -org $1BC655 : db #$4A, #$1D, #$82 ; Replace a bomb :( under bush to add a warp on map 78 (DM) -org $1BC80D : db #$B2, #$0B, #$82 ; map 111 -org $1BC3DF : db #$D8, #$D1 ; new pointer for map 115 no items to replace -org $1BD1D8 : db #$A8, #$02, #$82, #$FF, #$FF ;new data for map115 -org $1BC85A : db #$50, #$0F, #$82 - -org $1BC387 : db #$DD, #$D1 ;New pointer for map 71 no items to replace -org $1BD1DD : db #$A4, #$06, #$82, #$9E, #$06, #$82, #$FF, #$FF ;new data for map 71 - - -;;move pyramid exit overworld door -org $1BB96F+$35+$35 : dw $001b -org $1BBA71+$35+$35 : dw $06a4 -org $1BBB73+$35 : db $36 - -org $02DAEE+$37+$37 : dw $0010 -org $02DB8C+$37 : db $1B -org $02DBDB+$37+$37 : dw $0418 -org $02DC79+$37+$37 : dw $0679 -org $02DD17+$37+$37 : dw $06b4 -org $02DDB5+$37+$37 : dw $06c6 -org $02DE53+$37+$37 : dw $0728 -org $02DEF1+$37+$37 : dw $06e6 -org $02DF8F+$37+$37 : dw $0733 -org $02E02D+$37 : db $07 -org $02E07C+$37 : db $f9 -org $02E0CB+$37+$37 : dw $0000 -org $02E169+$37+$37 : dw $0000 - - -;org $02E849 ; Fly 1 to Sanctuary -;db #$13, #$00, #$16, #$00, #$18, #$00, #$2C, #$00, #$2F, #$00, #$30, #$00, #$3B, #$00, #$3F, #$00, #$5B, #$00, #$35, #$00, #$0F, #$00, #$15, #$00, #$33, #$00, #$12, #$00, #$3F, #$00, #$55, #$00, #$7F, #$00, #$1A, #$00, #$88, #$08, #$30, #$0B, #$88, #$05, #$98, #$07, #$80, #$18, #$9E, #$06, #$10, #$08, #$2E, #$00, #$42, #$12, #$80, #$06, #$12, #$01, #$9E, #$05, #$8E, #$04, #$80, #$02, #$12, #$01, #$80, #$02, #$00, #$04, #$16, #$05, #$59, #$07, #$B9, #$0A, #$FA, #$0A, #$1E, #$0F, #$DF, #$0E, #$05, #$0F, #$00, #$06, #$46, #$0E, #$C6, #$02, #$2A, #$04, #$BA, #$0C, #$9A, #$04, #$56, #$0E, #$2A, #$04, #$56, #$0E, #$D6, #$06, #$4E, #$0C, #$7E, #$01, #$40, #$08, #$B2, #$0E, #$00, #$00, #$F2, #$06, #$75, #$0E, #$78, #$07, #$0A, #$0C, #$06, #$0E, #$8A, #$0A, #$EA, #$06, #$62, #$04, #$00, #$0E, #$8A, #$0A, #$00, #$0E, #$68, #$04, #$78, #$05, #$B7, #$07, #$17, #$0B, #$58, #$0B, #$A8, #$0F, #$3D, #$0F, #$67, #$0F, #$5C, #$06, #$A8, #$0E, #$28, #$03, #$88, #$04, #$18, #$0D, #$F8, #$04, #$B8, #$0E, #$88, #$04, #$B8, #$0E, #$56, #$07, #$C8, #$0C, #$00, #$02, #$B8, #$08, #$30, #$0F, #$78, #$00, #$78, #$07, #$F3, #$0E, #$F0, #$07, #$90, #$0C, #$80, #$0E, #$10, #$0B, #$70, #$07, #$E8, #$04, #$68, #$0E, #$10, #$0B, #$68, #$0E, #$70, #$04, #$83, #$05, #$C6, #$07, #$26, #$0B, #$67, #$0B, #$8D, #$0F, #$4C, #$0F, #$72, #$0F, #$6D, #$06, #$B3, #$0E, #$33, #$03, #$97, #$04, #$27, #$0D, #$07, #$05, #$C3, #$0E, #$97, #$04, #$C3, #$0E, #$56, #$07, #$D3, #$0C, #$0B, #$02, #$BF, #$08, #$37, #$0F, #$8D, #$00, #$7F, #$07, #$FA, #$0E, #$F7, #$07, #$97, #$0C, #$8B, #$0E, #$17, #$0B, #$77, #$07, #$EF, #$04, #$85, #$0E, #$17, #$0B, #$85, #$0E, #$F6, #$FF, #$FA, #$FF, #$07, #$00, #$F7, #$FF, #$F6, #$FF, #$00, #$00, #$F1, #$FF, #$FB, #$FF, #$00, #$00, #$FA, #$FF, #$0A, #$00, #$F6, #$FF, #$F6, #$FF, #$F6, #$FF, #$FA, #$FF, #$F6, #$FF, #$FA, #$FF, #$F2, #$FF, #$F2, #$FF, #$02, #$00, #$00, #$00, #$0E, #$00, #$00, #$00, #$FE, #$FF, #$0B, #$00, #$F8, #$FF, #$06, #$00, #$FA, #$FF, #$FA, #$FF, #$06, #$00, #$0E, #$00, #$00, #$00, #$FA, #$FF, #$00, #$00 -; diff --git a/scratchpad.asm b/scratchpad.asm deleted file mode 100644 index e69de29..0000000 diff --git a/servicerequest.asm b/servicerequest.asm index b2e3380..991a5af 100644 --- a/servicerequest.asm +++ b/servicerequest.asm @@ -60,8 +60,8 @@ macro ServiceRequestChest(type) LDA.l TxStatus : BEQ + : CLC : RTL : + ; return fail if we don't have the lock LDA.b $1B : STA.l TxBuffer+8 ; indoor/outdoor BEQ + - LDA.b $A0 : STA.l TxBuffer+9 ; roomid low - LDA.b $A1 : STA.l TxBuffer+10 ; roomid high + LDA.b RoomIndex : STA.l TxBuffer+9 ; roomid low + LDA.b RoomIndex+1 : STA.l TxBuffer+10 ; roomid high BRA ++ + LDA.w $040A : STA.l TxBuffer+9 ; area id @@ -78,8 +78,8 @@ macro ServiceRequest(type,index) LDA.l TxStatus : BEQ + : CLC : RTL : + ; return fail if we don't have the lock LDA.b $1B : STA.l TxBuffer+8 ; indoor/outdoor BEQ + - LDA.b $A0 : STA.l TxBuffer+9 ; roomid low - LDA.b $A1 : STA.l TxBuffer+10 ; roomid high + LDA.b RoomIndex : STA.l TxBuffer+9 ; roomid low + LDA.b RoomIndex+1 : STA.l TxBuffer+10 ; roomid high BRA ++ + LDA.w $040A : STA.l TxBuffer+9 ; area id diff --git a/shopkeeper.asm b/shopkeeper.asm index 2e9de97..bb365db 100644 --- a/shopkeeper.asm +++ b/shopkeeper.asm @@ -110,9 +110,9 @@ SpritePrep_ShopKeeper: REP #$30 ; set 16-bit accumulator & index registers LDX.w #$0000 - - LDA.l ShopTable+1, X : CMP.b $A0 : BNE + + LDA.l ShopTable+1, X : CMP.b RoomIndex : BNE + LDA.l ShopTable+5, X : AND.w #$0040 : BNE ++ - LDA.l $7F5099 : AND #$00FF : CMP.l ShopTable+3, X : BNE + + LDA.l PreviousOverworldDoor : AND #$00FF : CMP.l ShopTable+3, X : BNE + ++ SEP #$20 ; set 8-bit accumulator LDA.l ShopTable, X : STA.l ShopId @@ -174,9 +174,9 @@ SpritePrep_ShopKeeper: JMP - .stop - LDA.b #Shopkeeper_UploadVRAMTilesLong>>16 : STA.l NMIAux+2 - LDA.b #Shopkeeper_UploadVRAMTilesLong>>8 : STA.l NMIAux+1 - LDA.b #Shopkeeper_UploadVRAMTilesLong>>0 : STA.l NMIAux + LDA.b #Shopkeeper_UploadVRAMTilesLong>>16 : STA.w NMIAux+2 + LDA.b #Shopkeeper_UploadVRAMTilesLong>>8 : STA.w NMIAux+1 + LDA.b #Shopkeeper_UploadVRAMTilesLong>>0 : STA.w NMIAux .done LDA.l ShopType : BIT.b #$20 : BEQ .notTakeAll ; Take-all diff --git a/sram.asm b/sram.asm index 7061005..74fed05 100644 --- a/sram.asm +++ b/sram.asm @@ -312,10 +312,9 @@ CrystalCounter: skip 1 ; Total Number of crystals collected (integer) DungeonsCompleted: skip 2 ; Bitfield indicating whether a dungeon's prize has been collected. ; This has the same shape as the dungeon item bitfields. skip 44 ; Unused -ServiceSequenceRx: ; Service sequence receive -ServiceSequenceTx: ; Service sequence transmit -ServiceSequence: skip 8 ; Service request block. See servicerequest.asm -skip 8 ; Unused +ServiceSequence: ; See servicerequest.asm +ServiceSequenceRx: skip 8 ; Service sequence receive +ServiceSequenceTx: skip 8 ; Service sequence transmit DungeonAbsorbedKeys: ; \ Absorbed key counters (integers) SewerAbsorbedKeys: skip 1 ; | Sewer Passage HCAbsorbedKeys: skip 1 ; | Hyrule Castle @@ -395,11 +394,11 @@ RoomDataSRAM: ; skip $280 ; OverworldEventDataSRAM: ; skip $C0 ; -EquipmentSRAM: skip 3 ; skip 76 -BombsEquipmentSRAM: skip 31 ; 343 -DisplayRupeesSRAM: skip 21 ; 362 -CurrentArrowsSRAM: skip 21 ; 377 -InventoryTrackingSRAM: skip 2 ; 38C +EquipmentSRAM: skip 3 ; +BombsEquipmentSRAM: skip 31 ; +DisplayRupeesSRAM: skip 21 ; +CurrentArrowsSRAM: skip 21 ; +InventoryTrackingSRAM: skip 2 ; BowTrackingSRAM: skip 2 ; skip 53 ; ProgressIndicatorSRAM: skip 1 ; @@ -600,7 +599,7 @@ endmacro ;-------------------------------------------------------------------------------- %assertSRAM(ServiceSequence, $7EF4A0) %assertSRAM(ServiceSequenceRx, $7EF4A0) -%assertSRAM(ServiceSequenceTx, $7EF4A0) +%assertSRAM(ServiceSequenceTx, $7EF4A8) ;-------------------------------------------------------------------------------- %assertSRAM(DungeonAbsorbedKeys, $7EF4B0) %assertSRAM(SewerAbsorbedKeys, $7EF4B0) diff --git a/stats.asm b/stats.asm index 2697751..36b97dc 100644 --- a/stats.asm +++ b/stats.asm @@ -39,7 +39,7 @@ DungeonHoleEntranceTransition: JSL EnableForceBlank LDA.l SilverArrowsAutoEquip : AND.b #$02 : BEQ + - LDA $010E : CMP.b #$7B : BNE + ; skip unless falling to ganon's room + LDA.w $010E : 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 @@ -133,7 +133,7 @@ CountChestKey: ; called by neighbor functions RTS ;-------------------------------------------------------------------------------- CountBonkItem: ; called from GetBonkItem in bookofmudora.asm - LDA.b $A0 ; check room ID - only bonk keys in 2 rooms so we're just checking the lower byte + LDA.b RoomIndex ; check room ID - only bonk keys in 2 rooms so we're just checking the lower byte CMP.b #115 : BNE + ; Desert Bonk Key LDA.l BonkKey_Desert : BRA ++ + : CMP.b #140 : BNE + ; GTower Bonk Key @@ -289,7 +289,7 @@ IncrementUWMirror: PHA LDA.b #$00 : STA.l $7F5035 ; bandaid patch bug with mirroring away from text LDA.l StatsLocked : BNE + - LDA $040C : CMP #$FF : BEQ + ; skip if we're in a cave or house + LDA.w $040C : CMP.b #$FF : BEQ + ; skip if we're in a cave or house LDA.l UnderworldMirrors : INC : STA.l UnderworldMirrors JSL.l StatTransitionCounter + diff --git a/stats/statConfig.asm b/stats/statConfig.asm index 101e9aa..f100159 100755 --- a/stats/statConfig.asm +++ b/stats/statConfig.asm @@ -62,6 +62,6 @@ endmacro %AddStat(DeathCounter, 0, 0, 08, 2, !DEATHS_X, !DEATHS_Y) %AddStat(FaerieRevivalCounter, 0, 0, 08, 3, !FAERIE_REVIVALS_X, !FAERIE_REVIVALS_Y) %AddStat(MenuFrames, 1, 8, 32, 4, !TOTAL_MENU_TIME_X, !TOTAL_MENU_TIME_Y) -%AddStat($7F5038, 1, 0, 32, 4, !TOTAL_LAG_TIME_X, !TOTAL_LAG_TIME_Y) +%AddStat(LagTime, 1, 0, 32, 4, !TOTAL_LAG_TIME_X, !TOTAL_LAG_TIME_Y) %AddStat(TotalItemCounter, 0, 0, 16, 3, !COLLECTION_RATE_X, !COLLECTION_RATE_Y) %AddStat(NMIFrames, 1, 0, 32, 4, !TOTAL_TIME_X, !TOTAL_TIME_Y) diff --git a/swordswap.asm b/swordswap.asm index f773b55..1dfc790 100644 --- a/swordswap.asm +++ b/swordswap.asm @@ -65,7 +65,7 @@ RTL ;================================================================================ ; $7E0348 - Ice Value LoadModifiedIceFloorValue_a11: - LDA.b $A0 : CMP.b #$91 : BEQ + : CMP.b #$92 : BEQ + : CMP.b #$93 : BEQ + ; mire basement currently broken - not sure why + LDA.b RoomIndex : CMP.b #$91 : BEQ + : CMP.b #$92 : BEQ + : CMP.b #$93 : BEQ + ; mire basement currently broken - not sure why LDA.b $5D : CMP.b #$01 : BEQ + : CMP.b #$17 : BEQ + : CMP.b #$1C : BEQ + LDA.b $5E : CMP.b #$02 : BEQ + LDA.b $5B : BNE + @@ -73,7 +73,7 @@ LoadModifiedIceFloorValue_a11: + : LDA.w $0348 : AND.b #$11 RTL LoadModifiedIceFloorValue_a01: - LDA.b $A0 : CMP.b #$91 : BEQ + : CMP.b #$92 : BEQ + : CMP.b #$93 : BEQ + ; mire basement currently broken - not sure why + LDA.b RoomIndex : CMP.b #$91 : BEQ + : CMP.b #$92 : BEQ + : CMP.b #$93 : BEQ + ; mire basement currently broken - not sure why LDA.b $5D : CMP.b #$01 : BEQ + : CMP.b #$17 : BEQ + : CMP.b #$1C : BEQ + LDA.b $5E : CMP.b #$02 : BEQ + LDA.b $5B : BNE + @@ -116,7 +116,7 @@ GetSmithSword: LDA.b #$7A LDY.b #$01 JSL.l Sprite_ShowMessageUnconditional - LDA.b #$3C : STA $012E ; error sound + LDA.b #$3C : STA.w $012E ; error sound SEP #$10 BRA .done @@ -144,7 +144,7 @@ CheckMedallionSword: LDA.b $1B : BEQ .outdoors .indoors REP #$20 ; set 16-bit accumulator - LDA.b $A0 ; load room ID + LDA.b RoomIndex ; load room ID CMP.w #$000E : BNE + ; freezor1 LDA.b $22 : AND.w #$01FF ; check x-coord CMP.w #368-8 : !BLT .normal diff --git a/tables.asm b/tables.asm index eb75b77..aa2a38a 100644 --- a/tables.asm +++ b/tables.asm @@ -95,8 +95,6 @@ org $06B55C ; PC 0x3355C ; sprite_smithy_bros.asm : 634 SmithSword: db #$02 ; #$02 = Tempered Sword (default) -;org $05EBD4 ; PC 0x2EBD4 - sprite_zelda.asm:23 - (LDA $7EF359 : CMP.b #$02 : BCS .hasMasterSword) - Zelda Spawnpoint Sword Check -;db #$05 ; #$02 = Tempered Sword (default) - #$05 = All Swords ;-------------------------------------------------------------------------------- ; 0x18002B- 0x180030 (Unused) ;-------------------------------------------------------------------------------- @@ -1435,7 +1433,7 @@ db $04 ;JSL Sprite_ShowMessageFromPlayerContact ; Inverted uses Sprite_ShowMessageFromPlayerContact ;;--------------------------------------------------------------------------------- org $00886e ; <- Bank00.asm : 1050 (LDA Overworld_TileAttr, X) -LDA Overworld_TileAttr, X ; use "JML InvertedTileAttributeLookup" for inverted +LDA.l Overworld_TileAttr, X ; use "JML InvertedTileAttributeLookup" for inverted Overworld_GetTileAttrAtLocation_continue: ;================================================================================ org $0DDBEC ; <- 6DBEC diff --git a/tablets.asm b/tablets.asm index 2107a0c..cd45bb0 100644 --- a/tablets.asm +++ b/tablets.asm @@ -30,13 +30,10 @@ SetTabletItem: RTL ;-------------------------------------------------------------------------------- SpawnTabletItem: -; JSL.l HeartPieceGet -;RTL JSL.l LoadOutdoorValue PHA JSL.l PrepDynamicTile - LDA.b #$01 : STA.l ForceHeartSpawn : STA.l SkipHeartSave JSL.l SetTabletItem LDA.b #$EB @@ -61,7 +58,7 @@ MaybeUnlockTabletAnimation: STZ $0112 ; disable falling-medallion mode STZ $03EF ; release link from item-up pose LDA.b #$00 : STA.b $5D ; set link to ground state - + REP #$20 ; set 16-bit accumulator LDA.b $8A : CMP.w #$0030 : BNE ++ ; Desert SEP #$20 ; set 8-bit accumulator diff --git a/textrenderer.asm b/textrenderer.asm index 54de38d..3b8d07b 100644 --- a/textrenderer.asm +++ b/textrenderer.asm @@ -5,8 +5,8 @@ RenderCharSetColorExtended_init: RenderCharSetColorExtended_close: stz.b Scrap0C - lda $010c - sta $10 + lda.w $010c + sta.b $10 rtl RenderCharSetColorExtended: @@ -33,7 +33,7 @@ RenderCharToMapExtended: plx lda.w #$0000 sta.b Scrap00 - lda #$007f + lda.w #$007f sta.b Scrap02 lda.w #$0000 clc : adc.w #$0020 diff --git a/treekid.asm b/treekid.asm index 4b9f8bc..1197bfb 100644 --- a/treekid.asm +++ b/treekid.asm @@ -2,7 +2,7 @@ ; Tree Kid Fix ;-------------------------------------------------------------------------------- org $06B12B ; <- 3312B - tree status set - 418 - LDA NpcFlagsVanilla : ORA.b #$08 : STA NpcFlagsVanilla -LDA NpcFlagsVanilla : AND.b #$F7 : STA NpcFlagsVanilla ; unset arboration instead of setting it +LDA.l NpcFlagsVanilla : AND.b #$F7 : STA.l NpcFlagsVanilla ; unset arboration instead of setting it ;-------------------------------------------------------------------------------- org $06B072 ; <- 33072 - FluteAardvark_InitialStateFromFluteState - 418 : dw FluteAardvark_AlreadyArborated db #$8B diff --git a/utilities.asm b/utilities.asm index 775cb3e..36f2201 100644 --- a/utilities.asm +++ b/utilities.asm @@ -567,7 +567,7 @@ RTL ;-------------------------------------------------------------------------------- ; HexToDec ; in: A(w) - Word to Convert -; out: $7F5004 - $7F5007 (high - low) +; out: HexToDecDigit1 - HexToDecDigit5 (high - low) ;-------------------------------------------------------------------------------- HexToDec: PHA @@ -592,8 +592,8 @@ HexToDec: INC.b Scrap07 !SUB.w #1 : BRA - + - LDA.b Scrap04 : STA.l $7F5004 ; move to digit storage - LDA.b Scrap06 : STA.l $7F5006 + LDA.b Scrap04 : STA.l HexToDecDigit2 ; move to digit storage + LDA.b Scrap06 : STA.l HexToDecDigit4 PLA RTL @@ -626,33 +626,33 @@ db #00, #01, #01, #02, #01, #02, #02, #03, #01, #02, #02, #03, #02, #03, #03, #0 ;-------------------------------------------------------------------------------- ; HexToDec ; in: A(w) - Word to Convert -; out: $7F5003 - $7F5007 (high - low) +; out: HexToDecDigit1 - HexToDecDigit5 (high - low) ;-------------------------------------------------------------------------------- ;HexToDec: ; PHA ; PHA ; LDA.w #$9090 -; STA.l $7F5003 : STA.l $7F5005 : STA.l $7F5006 ; clear digit storage +; STA.l HexToDecDigit1 : STA.l HexToDecDigit3 : STA.l HexToDecDigit4 ; clear digit storage ; PLA ; - ; CMP.w #10000 : !BLT + -; PHA : SEP #$20 : LDA.l $7F5003 : INC : STA.l $7F5003 : REP #$20 : PLA +; PHA : SEP #$20 : LDA.l HexToDecDigit1 : INC : STA.l HexToDecDigit1 : REP #$20 : PLA ; !SUB.w #10000 : BRA - ; + - ; CMP.w #1000 : !BLT + -; PHA : SEP #$20 : LDA.l $7F5004 : INC : STA.l $7F5004 : REP #$20 : PLA +; PHA : SEP #$20 : LDA.l HexToDecDigit2 : INC : STA.l HexToDecDigit2 : REP #$20 : PLA ; !SUB.w #1000 : BRA - ; + - ; CMP.w #100 : !BLT + -; PHA : SEP #$20 : LDA.l $7F5005 : INC : STA.l $7F5005 : REP #$20 : PLA +; PHA : SEP #$20 : LDA.l HexToDecDigit3 : INC : STA.l HexToDecDigit3 : REP #$20 : PLA ; !SUB.w #100 : BRA - ; + - ; CMP.w #10 : !BLT + -; PHA : SEP #$20 : LDA.l $7F5006 : INC : STA.l $7F5006 : REP #$20 : PLA +; PHA : SEP #$20 : LDA.l HexToDecDigit4 : INC : STA.l HexToDecDigit4 : REP #$20 : PLA ; !SUB.w #10 : BRA - ; + - ; CMP.w #1 : !BLT + -; PHA : SEP #$20 : LDA.l $7F5007 : INC : STA.l $7F5007 : REP #$20 : PLA +; PHA : SEP #$20 : LDA.l HexToDecDigit5 : INC : STA.l HexToDecDigit5 : REP #$20 : PLA ; !SUB.w #1 : BRA - ; + ; PLA diff --git a/vanillalabels.asm b/vanillalabels.asm index 8d0129e..ff03684 100644 --- a/vanillalabels.asm +++ b/vanillalabels.asm @@ -94,6 +94,9 @@ Sprite_ShowMessageUnconditional: org $05EC96 Sprite_ZeldaLong: +org $05F0C0 +Sprite_EB_HeartPiece_handle_flags: + org $0680FA Player_ApplyRumbleToSprites: diff --git a/zoraking.asm b/zoraking.asm index 9ac1a1c..a2b309b 100644 --- a/zoraking.asm +++ b/zoraking.asm @@ -6,7 +6,7 @@ LoadZoraKingItemGFX: JML.l PrepDynamicTile ;-------------------------------------------------------------------------------- JumpToSplashItemTarget: - LDA $0D90, X + LDA.w $0D90, X CMP.b #$FF : BNE + : JML.l SplashItem_SpawnSplash : + CMP.b #$00 : JML.l SplashItem_SpawnOther -;-------------------------------------------------------------------------------- \ No newline at end of file +;-------------------------------------------------------------------------------- diff --git a/zsnes.asm b/zsnes.asm index 734defb..a6441bb 100644 --- a/zsnes.asm +++ b/zsnes.asm @@ -1,14 +1,14 @@ ;-------------------------------------------------------------------------------- CheckZSNES: SEP #$28 - LDA #$FF + LDA.b #$FF CLC - ADC #$FF - CMP #$64 + ADC.b #$FF + CMP.b #$64 CLD BEQ .zsnes REP #$20 - LDA #$01FF : TCS ; thing we wrote over - initialize stack + LDA.w #$01FF : TCS ; thing we wrote over - initialize stack JML.l ReturnCheckZSNES .zsnes JML DontUseZSNES