diff --git a/bookofmudora.asm b/bookofmudora.asm index 3030d34..e26c7fa 100644 --- a/bookofmudora.asm +++ b/bookofmudora.asm @@ -15,9 +15,7 @@ DrawLibraryItemGFX: RTL ;-------------------------------------------------------------------------------- SetLibraryItem: - PHA LDY $0E80, X ; Retrieve stored item type - PLA JSL.l ItemSet_Library ; contains thing we wrote over RTL ;-------------------------------------------------------------------------------- diff --git a/bugfixes.asm b/bugfixes.asm index 4b55a67..5e7a6be 100644 --- a/bugfixes.asm +++ b/bugfixes.asm @@ -32,7 +32,7 @@ RTL ;-------------------------------------------------------------------------------- ;0 = Become (Perma)bunny DecideIfBunny: - LDA $7EF357 : BEQ + : RTL : + + LDA $7EF357 : BNE .done LDA $7EF3CA : AND.b #$40 PHA : LDA.l InvertedMode : BNE .inverted .normal @@ -47,8 +47,8 @@ RTL DecideIfBunnyByScreenIndex: ; If indoors we don't have a screen index. Return non-bunny to make mirror-based ; superbunny work - LDA $1B : BEQ + : RTL : + - LDA $7EF357 : BEQ + : RTL : + + LDA $1B : BNE .done + LDA $7EF357 : BNE .done LDA $8A : AND.b #$40 : PHA LDA.l InvertedMode : BNE .inverted .normal @@ -114,12 +114,13 @@ RTS FixFrogSmith: LDA.l $7EF3CA : BNE .darkWorld LDA.l $7EF3CC : CMP.b #$07 : BNE .done - LDA.b #$08 : STA.l $7EF3CC ; make frog into smith in light world + LDA.b #$08 : ; make frog into smith in light world BRA .loadgfx .darkWorld LDA.l $7EF3CC : CMP.b #$08 : BNE .done - LDA.b #$07 : STA.l $7EF3CC ; make smith into frog in dark world + LDA.b #$07 ; make smith into frog in dark world .loadgfx + STA.l $7EF3CC JSL Tagalong_LoadGfx .done RTS @@ -137,12 +138,11 @@ RTL ; Fix crystal not spawning when using somaria vs boss TryToSpawnCrystalUntilSuccess: STX $02D8 ; what we overwrote - JSL AddAncillaLong : BCC .spawned ; a clear carry flag indicates success - .failed - RTL - .spawned + JSL AddAncillaLong : BCS .failed ; a clear carry flag indicates success +.spawned STZ $AE ; the "trying to spawn crystal" flag STZ $AF ; the "trying to spawn pendant" flag +.failed RTL ;-------------------------------------------------------------------------------- @@ -173,22 +173,22 @@ CMP.w #$030E : BEQ .new ; opening dungeon map CMP.w #$070E : BEQ .new ; opening overworld map .original - - lda [$00] - sta $7ec300, x - sta $7ec500, x - inc $00 : inc $00 - inx #2 - dey - bpl - + LDA [$00] + STA $7EC300, X + STA $7EC500, X + INC $00 : INC $00 + INX #2 + DEY + BPL - RTL .new - - lda [$00] - sta $7ec500, x - inc $00 : inc $00 - inx #2 - dey - bpl - + LDA [$00] + STA $7EC500, X + INC $00 : INC $00 + INX #2 + DEY + BPL - RTL ;-------------------------------------------------------------------------------- diff --git a/catfish.asm b/catfish.asm index 908a31f..4754600 100644 --- a/catfish.asm +++ b/catfish.asm @@ -4,8 +4,7 @@ !HEART_REDRAW = "$7F5000" LoadCatfishItemGFX: LDA.l $1DE185 ; location randomizer writes catfish item to - JSL.l PrepDynamicTile -RTL + JML PrepDynamicTile ;-------------------------------------------------------------------------------- DrawThrownItem: LDA $8A : CMP.b #$81 : BNE .catfish @@ -19,8 +18,7 @@ DrawThrownItem: LDA.l $1DE185 ; location randomizer writes catfish item to .draw - JSL.l DrawDynamicTile -RTL + JML DrawDynamicTile ;-------------------------------------------------------------------------------- MarkThrownItem: JSL Link_ReceiveItem ; thing we wrote over @@ -28,12 +26,9 @@ MarkThrownItem: LDA $8A : CMP.b #$81 : BNE .catfish .zora - JSL.l ItemSet_ZoraKing - BRA .done - + JML ItemSet_ZoraKing + .catfish - JSL.l ItemSet_Catfish - - .done -RTL + JML ItemSet_Catfish + ;-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/clock.asm b/clock.asm index c0eebd1..4e853d1 100644 --- a/clock.asm +++ b/clock.asm @@ -66,8 +66,7 @@ endmacro Clock_Test: JSL.l Clock_Init - JSL.l Clock_IsSupported -RTL + JML.l Clock_IsSupported ;-------------------------------------------------------------------------------- ; Clock_Init @@ -112,11 +111,10 @@ Clock_IsSupported: PHA : PHX LDX #$00; - - LDA $002800 : AND.b #$0F : CMP #$0F : BEQ + ; check for clock chip ready signal - CPX.b #$0E : !BLT ++ : CLC : BRA .done : ++ ; if we've read 14 bytes with no success, unset carry and exit - INX - BRA - : + - SEC ; found a clock chip + 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 @@ -197,9 +195,9 @@ Multiply_A16Y8: CLC ADC $4216 LDY $4217 - BCC carry_bit + BCC .carry_bit INY - carry_bit: +.carry_bit: XBA REP #$20 ; set 16-bit accumulator RTL diff --git a/compasses.asm b/compasses.asm index 11a9a59..5c1acb5 100644 --- a/compasses.asm +++ b/compasses.asm @@ -8,16 +8,17 @@ macro DrawConstantNumber(digit1,digit2) LDA.w #$2490+ : STA $7EC79A LDA.w #$2490+ : STA $7EC79C + SEP #$20 endmacro ;-------------------------------------------------------------------------------- DrawDungeonCompassCounts: LDX $1B : BNE + : RTL : + ; Skip if outdoors - LDX $040C : CPX.b #$FF : BNE + : RTL : + ; Skip if not in a dungeon + LDX $040C : CPX.b #$FF : BEQ .done ; Skip if not in a dungeon CMP.w #$0002 : BEQ ++ ; if CompassMode==2, we don't check for the compass LDA $7EF364 : AND.l .item_masks, X ; Load compass values to A, mask with dungeon item masks - BNE + : RTL : + ; skip if we don't have compass + BEQ .done ; skip if we don't have compass ++ JMP (CompassCountDungeonHandlers, X) : .return_spot @@ -48,79 +49,66 @@ CompassCountDungeonHandlers: ; pointers to functions that handle dungeon-specifi CompassCount_Escape: %DrawConstantNumber(0,8) - SEP #$20 LDA $7EF434 : LSR #4 JMP DrawDungeonCompassCounts_return_spot CompassCount_Eastern: %DrawConstantNumber(0,6) - SEP #$20 LDA $7EF436 : AND.b #$07 JMP DrawDungeonCompassCounts_return_spot CompassCount_Desert: %DrawConstantNumber(0,6) - SEP #$20 LDA $7EF435 : LSR #5 JMP DrawDungeonCompassCounts_return_spot CompassCount_Agah: %DrawConstantNumber(0,2) - SEP #$20 LDA $7EF435 : AND.b #$03 JMP DrawDungeonCompassCounts_return_spot CompassCount_Swamp: %DrawConstantNumber(1,0) - SEP #$20 LDA $7EF439 : AND.b #$0F JMP DrawDungeonCompassCounts_return_spot CompassCount_PoD: %DrawConstantNumber(1,4) - SEP #$20 LDA $7EF434 : AND.b #$0F JMP DrawDungeonCompassCounts_return_spot CompassCount_Mire: %DrawConstantNumber(0,8) - SEP #$20 LDA $7EF438 : AND.b #$0F JMP DrawDungeonCompassCounts_return_spot CompassCount_Skull: %DrawConstantNumber(0,8) - SEP #$20 LDA $7EF437 : LSR #4 JMP DrawDungeonCompassCounts_return_spot CompassCount_Ice: %DrawConstantNumber(0,8) - SEP #$20 LDA $7EF438 : LSR #4 JMP DrawDungeonCompassCounts_return_spot CompassCount_Hera: %DrawConstantNumber(0,6) - SEP #$20 LDA $7EF435 : AND.b #$1C : LSR #2 JMP DrawDungeonCompassCounts_return_spot CompassCount_Thieves: %DrawConstantNumber(0,8) - SEP #$20 LDA $7EF437 : AND.b #$0F JMP DrawDungeonCompassCounts_return_spot CompassCount_Trock: %DrawConstantNumber(1,2) - SEP #$20 LDA $7EF439 : LSR #4 JMP DrawDungeonCompassCounts_return_spot CompassCount_Gt: %DrawConstantNumber(2,7) - SEP #$20 LDA $7EF436 : LSR #3 JMP DrawDungeonCompassCounts_return_spot diff --git a/darkworldspawn.asm b/darkworldspawn.asm index e38e652..43a55ae 100644 --- a/darkworldspawn.asm +++ b/darkworldspawn.asm @@ -4,8 +4,7 @@ DarkWorldSaveFix: LDA.b #$70 : PHA : PLB ; thing we wrote over - data bank change JSL.l MasterSwordFollowerClear - JSL.l StatSaveCounter -RTL + JML.l StatSaveCounter ;-------------------------------------------------------------------------------- DoWorldFix: LDA InvertedMode : BEQ + @@ -14,12 +13,12 @@ DoWorldFix: LDA.l Bugfix_MirrorlessSQToLW : BEQ .skip_mirror_check LDA $7EF353 : BEQ .noMirror ; check if we have the mirror .skip_mirror_check ; alt entrance point - LDA $7EF3C5 : CMP.b #$03 : !BLT .aga1Alive ; check if agahnim 1 is alive - BRA .done - .noMirror + LDA $7EF3C5 : CMP.b #$03 : BCS .done ; check if agahnim 1 is alive .aga1Alive - LDA #$00 : STA $7EF3CA ; set flag to light world - LDA $7EF3CC : CMP #$07 : BNE + : LDA.b #$08 : STA $7EF3CC : + ; convert frog to dwarf + LDA #$00 + .noMirror + STA $7EF3CA ; set flag to light world + LDA $7EF3CC : CMP #$07 : BNE .done : INC : STA $7EF3CC ; convert frog to dwarf .done RTL ;-------------------------------------------------------------------------------- @@ -29,8 +28,7 @@ SetDeathWorldChecked: + LDA $1B : BEQ .outdoors LDA $040C : CMP #$FF : BNE .dungeon - LDA $A0 : BNE ++ - LDA $A1 : BNE ++ + LDA $A0 : ORA $A1 : BNE ++ LDA GanonPyramidRespawn : BNE .pyramid ; if flag is set, force respawn at pyramid on death to ganon ++ .outdoors @@ -42,7 +40,7 @@ JMP DoWorldFix_skip_mirror_check .pyramid LDA #$40 : STA $7EF3CA ; set flag to dark world - LDA $7EF3CC : CMP #$08 : BNE + : LDA.b #$07 : STA $7EF3CC : + ; convert dwarf to frog + LDA $7EF3CC : CMP #$08 : BNE .done : DEC : STA $7EF3CC : + ; convert dwarf to frog .done RTL ;================================================================================ @@ -50,15 +48,13 @@ DoWorldFix_Inverted: LDA.l Bugfix_MirrorlessSQToLW : BEQ .skip_mirror_check LDA $7EF353 : BEQ .noMirror ; check if we have the mirror .skip_mirror_check ; alt entrance point - LDA $7EF3C5 : CMP.b #$03 : !BLT .aga1Alive ; check if agahnim 1 is alive - BRA .done + LDA $7EF3C5 : CMP.b #$03 : BCS .done ; check if agahnim 1 is alive .noMirror .aga1Alive LDA #$40 : STA $7EF3CA ; set flag to dark world LDA $7EF3CC - CMP #$07 : BEQ .clear ; clear frog - CMP #$08 : BEQ .clear ; clear dwarf - consider flute implications - BRA .done + CMP #$07 : BNE .done ; clear frog + CMP #$08 : BNE .done ; clear dwarf - consider flute implications .clear LDA.b #$00 : STA $7EF3CC ; clear follower .done @@ -67,8 +63,7 @@ RTL SetDeathWorldChecked_Inverted: LDA $1B : BEQ .outdoors LDA $040C : CMP #$FF : BNE .dungeon - LDA $A0 : BNE ++ - LDA $A1 : BNE ++ + LDA $A0 : ORA $A1 : BNE ++ LDA GanonPyramidRespawn : BNE .castle ; if flag is set, force respawn at pyramid on death to ganon ++ .outdoors @@ -95,16 +90,15 @@ RTL ;-------------------------------------------------------------------------------- MasterSwordFollowerClear: LDA $7EF3CC - CMP #$0E : BEQ .clear ; clear master sword follower -RTL - .clear + CMP #$0E : BNE .exit ; clear master sword follower LDA.b #$00 : STA $7EF3CC ; clear follower -RTL +.exit + RTL ;-------------------------------------------------------------------------------- FixAgahnimFollowers: LDA.b #$00 : STA $7EF3CC ; clear follower - JSL PrepDungeonExit ; thing we wrote over -RTL + JML PrepDungeonExit ; thing we wrote over + ;-------------------------------------------------------------------------------- macro SetMinimum(base,filler,compare) LDA.l : !SUB.l : !BLT ?done @@ -112,7 +106,7 @@ macro SetMinimum(base,filler,compare) ?done: endmacro RefreshRainAmmo: - LDA $7EF3C5 : CMP.b #$01 : BEQ + : RTL : + ; check if we're in rain state + LDA $7EF3C5 : CMP.b #$01 : BNE .done ; check if we're in rain state .rain LDA $7EF3C8 + CMP.b #$03 : BNE + ; Uncle @@ -137,14 +131,14 @@ RTL !INFINITE_BOMBS = "$7F50C9" !INFINITE_MAGIC = "$7F50CA" SetEscapeAssist: - LDA $7EF3C5 : CMP.b #$01 : BNE .notrain ; check if we're in rain state + LDA $7EF3C5 : CMP.b #$01 : BNE .no_train ; check if we're in rain state .rain LDA.l EscapeAssist BIT.b #$04 : BEQ + : STA !INFINITE_MAGIC : + BIT.b #$02 : BEQ + : STA !INFINITE_BOMBS : + BIT.b #$01 : BEQ + : STA !INFINITE_ARROWS : + BRA ++ - .notrain + .no_train ; choo choo LDA.l EscapeAssist : BIT.b #$04 : BEQ + : LDA.b #$00 : STA !INFINITE_MAGIC : + LDA.l EscapeAssist : BIT.b #$02 : BEQ + : LDA.b #$00 : STA !INFINITE_BOMBS : + LDA.l EscapeAssist : BIT.b #$01 : BEQ + : LDA.b #$00 : STA !INFINITE_ARROWS : + @@ -153,8 +147,8 @@ RTL ;-------------------------------------------------------------------------------- SetSilverBowMode: LDA SilverArrowsUseRestriction : BEQ + ; fix bow type for restricted arrow mode - LDA $7EF340 : CMP.b #$3 : !BLT + - !SUB.b #$02 : STA $7EF340 + LDA $7EF340 : CMP.b #$3 : BCC + + SBC.b #$02 : STA $7EF340 + RTL ;================================================================================ diff --git a/dialog.asm b/dialog.asm index 720f7b1..5e1a835 100644 --- a/dialog.asm +++ b/dialog.asm @@ -82,14 +82,13 @@ macro LoadDialogAddress(address) PHB : PHK : PLB SEP #$20 ; set 8-bit accumulator REP #$10 ; set 16-bit index registers - LDA $00 : PHA - LDA $01 : PHA + PEI ($00) LDA $02 : PHA STZ $1CF0 : STZ $1CF1 ; reset decompression buffer LDA.b #$01 : STA $7F5035 ; set flag %CopyDialog(
) PLA : STA $02 - PLA : STA $01 + REP #$20 PLA : STA $00 PLB PLP @@ -132,53 +131,52 @@ FreeDungeonItemNotice: PHB : PHK : PLB SEP #$20 ; set 8-bit accumulator REP #$10 ; set 16-bit index registers - LDA $00 : PHA - LDA $01 : PHA + PEI ($00) LDA $02 : PHA ;-------------------------------- LDA.l FreeItemText : BNE + : JMP .skip : + LDA #$00 : STA $7F5010 ; initialize scratch - LDA.l FreeItemText : AND.b #$01 : CMP.b #$01 : BNE + ; show message for general small key + LDA.l FreeItemText : AND.b #$01 : BEQ + ; show message for general small key LDA !ITEM_TEMPORARY : CMP.b #$24 : BNE + ; general small key %CopyDialog(Notice_SmallKeyOf) LDA !OFFSET_RETURN : DEC #2 : STA !OFFSET_POINTER %CopyDialog(Notice_Self) JMP .done - + : LDA.l FreeItemText : AND.b #$02 : CMP.b #$02 : BNE + ; show message for general compass + + : LDA.l FreeItemText : AND.b #$02 : BEQ + ; show message for general compass LDA !ITEM_TEMPORARY : CMP.b #$25 : BNE + ; general compass %CopyDialog(Notice_CompassOf) LDA !OFFSET_RETURN : DEC #2 : STA !OFFSET_POINTER %CopyDialog(Notice_Self) JMP .done - + : LDA.l FreeItemText : AND.b #$04 : CMP.b #$04 : BNE + ; show message for general map + + : LDA.l FreeItemText : AND.b #$04 : BEQ + ; show message for general map LDA !ITEM_TEMPORARY : CMP.b #$33 : BNE + ; general map %CopyDialog(Notice_MapOf) LDA !OFFSET_RETURN : DEC #2 : STA !OFFSET_POINTER %CopyDialog(Notice_Self) JMP .done - + : LDA.l FreeItemText : AND.b #$08 : CMP.b #$08 : BNE + ; show message for general big key + + : LDA.l FreeItemText : AND.b #$08 : BEQ + ; show message for general big key LDA !ITEM_TEMPORARY : CMP.b #$32 : BNE + ; general big key %CopyDialog(Notice_BigKeyOf) LDA !OFFSET_RETURN : DEC #2 : STA !OFFSET_POINTER %CopyDialog(Notice_Self) JMP .done + - LDA.l FreeItemText : AND.b #$04 : CMP.b #$04 : BNE + ; show message for dungeon map + LDA.l FreeItemText : AND.b #$04 : BEQ + ; show message for dungeon map LDA !ITEM_TEMPORARY : AND.b #$F0 ; looking at high bits only CMP.b #$70 : BNE + ; map of... %CopyDialog(Notice_MapOf) JMP .dungeon - + : LDA.l FreeItemText : AND.b #$02 : CMP.b #$02 : BNE + ; show message for dungeon compass + + : LDA.l FreeItemText : AND.b #$02 : BEQ + ; show message for dungeon compass LDA !ITEM_TEMPORARY : AND.b #$F0 : CMP.b #$80 : BNE + ; compass of... %CopyDialog(Notice_CompassOf) JMP .dungeon - + : LDA.l FreeItemText : AND.b #$08 : CMP.b #$08 : BNE + ; show message for dungeon big key + + : LDA.l FreeItemText : AND.b #$08 : BEQ + ; show message for dungeon big key LDA !ITEM_TEMPORARY : AND.b #$F0 : CMP.b #$90 : BNE + ; big key of... %CopyDialog(Notice_BigKeyOf) BRA .dungeon - + : LDA.l FreeItemText : AND.b #$01 : CMP.b #$01 : BNE + ; show message for dungeon small key + + : LDA.l FreeItemText : AND.b #$01 : BEQ + ; show message for dungeon small key LDA !ITEM_TEMPORARY : AND.b #$F0 : CMP.b #$A0 : BNE + ; small key of... LDA !ITEM_TEMPORARY : CMP.b #$AF : BNE ++ : JMP .skip : ++ %CopyDialog(Notice_SmallKeyOf) @@ -235,27 +233,19 @@ FreeDungeonItemNotice: STZ $1CF0 : STZ $1CF1 ; reset decompression buffer LDA.b #$01 : STA $7F5035 ; set alternate dialog flag - LDA.b #$01 : STA $7F509F + STA $7F509F ;-------------------------------- - PLA : STA $02 - PLA : STA $01 - PLA : STA $00 - PLB - PLP - PLY : PLX : PLA - ;JSL.l Main_ShowTextMessage_Alt -RTL - .skip - ;-------------------------------- PLA : STA $02 - PLA : STA $01 + REP #$20 PLA : STA $00 PLB PLP PLY : PLX : PLA + ;JSL.l Main_ShowTextMessage_Alt ; .skip can be here so long as this line remains commented out RTL + ;-------------------------------------------------------------------------------- DialogResetSelectionIndex: JSL.l Attract_DecompressStoryGfx ; what we wrote over @@ -264,11 +254,9 @@ RTL ;-------------------------------------------------------------------------------- DialogItemReceive: BCS .noMessage ; if doubling the item value overflowed it must be a rando item - CPY #$98 : !BLT + ;if the item is $4C or greater it must be a rando item - .noMessage - LDA.w #$FFFF - BRA .done - + + LDA.w #$FFFF + CPY #$98 : BCS .done ;if the item is $4C or greater it must be a rando item + LDA.w Ancilla_ReceiveItem_item_messages, Y .done CMP.w #$FFFF @@ -289,12 +277,13 @@ RTL RTL ;-------------------------------------------------------------------------------- DialogGanon1: - JSL.l CheckGanonVulnerability : BCS + - REP #$20 : LDA.w #$018C : STA $1CF0 : SEP #$20 - BRA ++ - + - REP #$20 : LDA.w #$016D : STA $1CF0 : SEP #$20 - ++ + JSL.l CheckGanonVulnerability + REP #$20 + LDA.w #$018C + BCC + + LDA.w #$016D ++ STA $1CF0 + SEP #$20 JSL.l Sprite_ShowMessageMinimal_Alt RTL ;-------------------------------------------------------------------------------- @@ -307,28 +296,30 @@ RTL ; s = silver arrow bow ; p = 2nd progressive bow DialogGanon2: - JSL.l CheckGanonVulnerability : BCS + - REP #$20 : LDA.w #$018D : STA $1CF0 : SEP #$20 - BRA ++ + JSL.l CheckGanonVulnerability + + REP #$20 + BCS + + LDA.w #$018D : BRA ++ + - LDA.l $7EF38E : AND #$80 : BNE + ; branch if bow - REP #$20 : LDA.w #$0192 : STA $1CF0 : SEP #$20 ; no bow - BRA ++ + LDA.l $7EF38E + + BIT.w #$0080 : BNE + ; branch if bow + LDA.w #$0192 : BRA ++ + - LDA.l $7EF38E : AND #$40 : BEQ + ; branch if no silvers - REP #$20 : LDA.w #$0195 : STA $1CF0 : SEP #$20 ;has silvers - BRA ++ + BIT.w #$0040 : BEQ + ; branch if no silvers + LDA.w #$0195 : BRA ++ + - LDA.l $7EF38E : AND #$20 : BNE + ; branch if p bow - REP #$20 : LDA.w #$0194 : STA $1CF0 : SEP #$20 ; bow, no-silvers, no-p-bow - BRA ++ + BIT.w #$0020 : BNE + ; branch if p bow + LDA.w #$0194 : BRA ++ + - LDA.l $7EF38E : AND #$80 : BEQ + ; branch if no bow - REP #$20 : LDA.w #$0193 : STA $1CF0 : SEP #$20 ; bow, no-silvers, p-bow - BRA ++ + BIT.w #$0080 : BEQ + ; branch if no bow + LDA.w #$0193 : BRA ++ + - REP #$20 : LDA.w #$016E : STA $1CF0 : SEP #$20 ; both bow and no bow. impossible. + LDA.w #$016E ++ + STA $1CF0 + SEP #$20 JSL.l Sprite_ShowMessageMinimal_Alt RTL ;-------------------------------------------------------------------------------- @@ -336,21 +327,20 @@ DialogEtherTablet: PHA LDA $0202 : CMP.b #$0F : BEQ + ; Show normal text if book is not equipped - - PLA : JSL Sprite_ShowMessageUnconditional ; Wacky Hylian Text -RTL + PLA : JML Sprite_ShowMessageUnconditional ; Wacky Hylian Text + BIT $F4 : BVC - ; Show normal text if Y is not pressed LDA.l AllowHammerTablets : BEQ ++ LDA $7EF34B : BEQ .yesText : BRA .noText ++ - LDA $7EF359 : CMP.b #$FF : BEQ .yesText : CMP.b #$02 : !BGE .noText + LDA $7EF359 : CMP.b #$FF : BEQ .yesText : CMP.b #$02 : BCS .noText ;++ .yesText PLA - LDA.b #$0c + LDA.b #$0C LDY.b #$01 - JSL Sprite_ShowMessageUnconditional ; Text From MSPedestalText (tables.asm) -RTL + JML Sprite_ShowMessageUnconditional ; Text From MSPedestalText (tables.asm) + .noText PLA RTL @@ -359,8 +349,7 @@ DialogBombosTablet: PHA LDA $0202 : CMP.b #$0F : BEQ + ; Show normal text if book is not equipped - - PLA : JSL Sprite_ShowMessageUnconditional ; Wacky Hylian Text -RTL + PLA : JML Sprite_ShowMessageUnconditional ; Wacky Hylian Text + BIT $F4 : BVC - ; Show normal text if Y is not pressed LDA.l AllowHammerTablets : BEQ ++ @@ -372,8 +361,8 @@ RTL PLA LDA.b #$0D LDY.b #$01 - JSL Sprite_ShowMessageUnconditional ; Text From MSPedestalText (tables.asm) -RTL + JML Sprite_ShowMessageUnconditional ; Text From MSPedestalText (tables.asm) + .noText PLA RTL @@ -382,19 +371,17 @@ DialogSahasrahla: LDA.l $7EF374 : AND #$04 : BEQ + ;Check if player has green pendant LDA.b #$2F LDY.b #$00 - JSL.l Sprite_ShowMessageUnconditional + JML Sprite_ShowMessageUnconditional + RTL ;-------------------------------------------------------------------------------- DialogBombShopGuy: - LDA.l $7EF37A : AND #$05 : CMP #$05 : BEQ + ;Check if player has crystals 5 & 6 - LDA.b #$15 - LDY.b #$01 - JSL.l Sprite_ShowMessageUnconditional - RTL + LDY.b #$15 + LDA.l $7EF37A : AND #$05 : CMP #$05 : BNE + ;Check if player has crystals 5 & 6 + INY ; from 15 to 16 + - LDA.b #$16 - LDY.b #$01 + TYA + LDY.b #$01 JSL.l Sprite_ShowMessageUnconditional RTL ;-------------------------------------------------------------------------------- @@ -405,23 +392,22 @@ Sprite_ShowMessageMinimal_Alt: STZ $11 PHX : PHY - LDA.b $00 : PHA - LDA.b $01 : PHA + PEA ($00) LDA.b $02 : PHA LDA.b #$1C : STA.b $02 REP #$30 LDA.w $1CF0 : ASL : TAX - LDA.l $7f71c0, X + LDA.l $7F71C0, X STA.b $00 SEP #$30 LDY.b #$00 - LDA [$00], Y : CMP.b #$fe : BNE + - INY : LDA [$00], Y : CMP.b #$6e : BNE + + LDA [$00], Y : CMP.b #$FE : BNE + + INY : LDA [$00], Y : CMP.b #$6E : BNE + INY : LDA [$00], Y : : BNE + - INY : LDA [$00], Y : CMP.b #$fe : BNE + - INY : LDA [$00], Y : CMP.b #$6b : BNE + + INY : LDA [$00], Y : CMP.b #$FE : BNE + + INY : LDA [$00], Y : CMP.b #$6B : BNE + INY : LDA [$00], Y : CMP.b #$04 : BNE + STZ $1CE8 JMP .end diff --git a/dungeondrops.asm b/dungeondrops.asm index ac40e11..c33e1cc 100644 --- a/dungeondrops.asm +++ b/dungeondrops.asm @@ -3,7 +3,7 @@ ;-------------------------------------------------------------------------------- DropSafeDungeon: LDA $040C : CMP #$08 : BEQ + - LDA $01C6FC, X : JSL Sprite_SpawnFallingItem + LDA $01C6FC, X : JML Sprite_SpawnFallingItem + RTL ;-------------------------------------------------------------------------------- \ No newline at end of file diff --git a/enemy_adjustments.asm b/enemy_adjustments.asm index a0206f2..ec0411f 100644 --- a/enemy_adjustments.asm +++ b/enemy_adjustments.asm @@ -3,21 +3,14 @@ ; make sure bats always load LW stats ;-------------------------------------------------------------------------------- NewBatInit: - ;check if map id == 240 or 241 - LDA $A0 : CMP #$F0 : BNE + ;oldman cave1 - BRA .light_world - + - CMP #$F1 : BNE + ;oldman cave2 - BRA .light_world - + - CMP #$B0 : BNE + ;agahnim statue keese - BRA .light_world - + - CMP #$D0 : BNE + ;agahnim darkmaze - BRA .light_world - + - CPY #$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 #$85 : STA $0CD2, X LDA.b #$04 : STA $0E50, X RTL diff --git a/entrances.asm b/entrances.asm index 2b2f171..a76ae17 100644 --- a/entrances.asm +++ b/entrances.asm @@ -4,9 +4,7 @@ ;-------------------------------------------------------------------------------- LockAgahnimDoors: LDA.l AgahnimDoorStyle : AND.w #$00FF - BNE + - ;#$0 = Never Locked - LDA.w #$0000 : RTL + BEQ .exit ; don't need to load 0, because we'd have it if we reached here + : CMP.w #$0001 : BNE + LDA $7EF3C5 : AND.w #$000F : CMP.w #$0002 : !BGE .unlock ; if we rescued zelda, skip JSR.w LockAgahnimDoorsCore : RTL @@ -37,7 +35,7 @@ LockAgahnimDoors: .unlock LDA.w #$0000 ; fallback to never locked - +.exit RTL ;-------------------------------------------------------------------------------- LockAgahnimDoorsCore: @@ -204,14 +202,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 - PLA + PLA + BIT $8A : BVS ++ ; and in the light world STZ $04C6 ; skip it. LDA #$00 RTL + PLA - STA $02E4 ;what we wrote over +++ STA $02E4 ;what we wrote over STA $0FC1 ;what we wrote over STA $0710 ;what we wrote over RTL diff --git a/events.asm b/events.asm index 412f1af..7713938 100644 --- a/events.asm +++ b/events.asm @@ -11,8 +11,7 @@ OnPrepFileSelect: RTL + JSL.l LoadAlphabetTilemap - JSL.l LoadFullItemTiles -RTL + JML.l LoadFullItemTiles ;-------------------------------------------------------------------------------- OnDrawHud: JSL.l DrawChallengeTimer ; this has to come before NewDrawHud because the timer overwrites the compass counter @@ -77,8 +76,7 @@ RTL ;-------------------------------------------------------------------------------- OnAga2Defeated: JSL.l Dungeon_SaveRoomData_justKeys ; thing we wrote over, make sure this is first - JSL.l IncrementAgahnim2Sword -RTL + JML.l IncrementAgahnim2Sword ;-------------------------------------------------------------------------------- OnFileCreation: TAX ; what we wrote over @@ -91,7 +89,7 @@ OnFileLoad: REP #$10 ; set 16 bit index registers JSL.l EnableForceBlank ; what we wrote over - LDA.b #$07 : STA $210c ; Restore screen 3 to normal tile area + LDA.b #$07 : STA $210C ; Restore screen 3 to normal tile area LDA !FRESH_FILE_MARKER : BNE + JSL.l OnNewFile @@ -175,8 +173,8 @@ RTL ;-------------------------------------------------------------------------------- OnLinkDamaged: JSL.l FlipperKill - JSL.l OHKOTimer -RTL + JML.l OHKOTimer + ;-------------------------------------------------------------------------------- OnEnterWater: JSL.l RegisterWaterEntryScreen @@ -191,8 +189,8 @@ OnLinkDamagedFromPit: RTL ;-------------------------------------------------------------------------------- OnLinkDamagedFromPitOutdoors: - JSL.l OHKOTimer ; make sure this is last -RTL + JML.l OHKOTimer ; make sure this is last + ;-------------------------------------------------------------------------------- !RNG_ITEM_LOCK_IN = "$7F5090" OnOWTransition: @@ -215,16 +213,16 @@ OnLoadDuckMap: RTL + LDA.b #$00 : STA !DARK_DUCK_TEMP - JSL OverworldMap_DarkWorldTilemap -RTL + JML OverworldMap_DarkWorldTilemap + ;-------------------------------------------------------------------------------- PreItemGet: LDA.b #$01 : STA !ITEM_BUSY ; mark item as busy RTL ;-------------------------------------------------------------------------------- PostItemGet: - JSL.l MaybeWriteSRAMTrace -RTL + JML.l MaybeWriteSRAMTrace + ;-------------------------------------------------------------------------------- PostItemAnimation: LDA.b #$00 : STA !ITEM_BUSY ; mark item as finished diff --git a/fairyfixes.asm b/fairyfixes.asm index c62ea3a..5364376 100644 --- a/fairyfixes.asm +++ b/fairyfixes.asm @@ -27,8 +27,7 @@ RTL FairyPond_Init: LDA.l Restrict_Ponds : BNE + LDA.b #$48 - JSL.l Sprite_ShowMessageFromPlayerContact - RTL + JML.l Sprite_ShowMessageFromPlayerContact + PHY : JSL.l Sprite_CheckDamageToPlayerSameLayerLong : BCC + LDA $7EF35C : CMP.b #$02 : BNE ++ : LDA.b #$1C : PHA : BRA .emptyBottle : ++ @@ -56,8 +55,8 @@ RTL ;-------------------------------------------------------------------------------- HappinessPond_Check: LDA $A0 : CMP.b #$15 ;what we wrote over - PHP BNE .done + PHP LDA.b #$72 JSL Sprite_SpawnDynamically @@ -83,6 +82,6 @@ HappinessPond_Check: STZ $0DD0, X ; self terminate - .done PLP + .done RTL diff --git a/fileselect.asm b/fileselect.asm index 3d9f551..a494226 100644 --- a/fileselect.asm +++ b/fileselect.asm @@ -113,7 +113,7 @@ JMP DrawItem DrawPlayerFile: - LDA $1A : AND.w #$0001 : BEQ + : BRA .normal : + + LDA $1A : AND.w #$0001 : BNE .normal JSR DrawPlayerFileShared INC $0710 ; Suppress animated tile updates for this frame @@ -633,15 +633,15 @@ AltBufferTable: STA $1104 ;file 2 top row STA $1144 ;file 2 bottom row STA $1184 ;gap row top - STA $11c4 ;gap row bottom + STA $11C4 ;gap row bottom STA $1204 ;file 3 top row STA $1244 ;file 3 bottom row STA $1284 ;extra gap row top - STA $12c4 ;extra gap row bottom + STA $12C4 ;extra gap row bottom STA $1304 ;extra gap row top STA $1344 ;extra gap row bottom STA $1384 ;extra gap row top - STA $13c4 ;extra gap row bottom + STA $13C4 ;extra gap row bottom ; Set last packet marker LDA.w #$00FF : STA $1402 diff --git a/halfmagicbat.asm b/halfmagicbat.asm index deb4cb6..56ba087 100644 --- a/halfmagicbat.asm +++ b/halfmagicbat.asm @@ -7,8 +7,7 @@ GetMagicBatItem: CMP.b #$FF : BEQ .normalLogic TAY STZ $02E9 ; 0 = Receiving item from an NPC or message - JSL.l Link_ReceiveItem -RTL + JML.l Link_ReceiveItem .normalLogic LDA HalfMagic STA $7EF37B diff --git a/heartpieces.asm b/heartpieces.asm index 5c20ebd..6a4c3fe 100644 --- a/heartpieces.asm +++ b/heartpieces.asm @@ -379,30 +379,19 @@ CheckIfBossRoom: ;-------------------------------------------------------------------------------- REP #$20 ; set 16-bit accumulator LDA $A0 ; these are all decimal because i got them that way - CMP.w #200 : BNE + - SEC : JMP .done - + CMP.w #51 : BNE + - SEC : JMP .done - + CMP.w #7 : BNE + - SEC : JMP .done - + CMP.w #90 : BNE + - SEC : JMP .done - + CMP.w #6 : BNE + - SEC : JMP .done - + CMP.w #41 : BNE + - SEC : JMP .done - + CMP.w #172 : BNE + - SEC : JMP .done - + CMP.w #222 : BNE + - SEC : JMP .done - + CMP.w #144 : BNE + - SEC : JMP .done - + CMP.w #164 : BNE + - SEC : JMP .done - + + CMP.w #200 : BEQ .done + CMP.w #51 : BEQ .done + CMP.w #7 : BEQ .done + CMP.w #90 : BEQ .done + CMP.w #6 : BEQ .done + CMP.w #41 : BEQ .done + CMP.w #172 : BEQ .done + CMP.w #222 : BEQ .done + CMP.w #144 : BEQ .done + CMP.w #164 : BEQ .done CLC .done - SEP #$20 ; set 8-bit accumulator ++ SEP #$20 ; set 8-bit accumulator RTL ;-------------------------------------------------------------------------------- ;#200 - Eastern Palace - Armos Knights diff --git a/hooks.asm b/hooks.asm index db94577..91cf308 100755 --- a/hooks.asm +++ b/hooks.asm @@ -2550,3 +2550,8 @@ CheckIfReading: CPX #$04 RTS ;================================================================================ +org $0DB4CA : db $40, $40 ; fire bar statis +org $0DB4A9 : db $50, $50, $6E, $6E ; roller statis +org $0DB4B2 : db $40, $40, $40, $40 ; cannon statis +org $0DB4C3 : db $C0 ; anti fairy statis +org $0DB516 : db $40 ; chain chomp statis \ No newline at end of file diff --git a/icepalacegraphics.asm b/icepalacegraphics.asm index 8d2677f..22d5903 100644 --- a/icepalacegraphics.asm +++ b/icepalacegraphics.asm @@ -9,7 +9,7 @@ ShouldOverrideFileLoad: .no CLC : RTS .yes - SEC : RTS + RTS BgGraphicsLoading: ; Instructions overwritten diff --git a/zelda.asm b/zelda.asm index 6b17d1d..358d7e8 100644 --- a/zelda.asm +++ b/zelda.asm @@ -5,10 +5,8 @@ SpawnZelda: LDA.l $7EF3CC : CMP #$08 : BEQ + ; don't spawn if dwarf is present CMP #$07 : BEQ + ; don't spawn if frog is present CMP #$0C : BEQ + ; don't spawn if purple chest is present - CLC : RTL - + - SEC -RTL + CLC + + RTL ;-------------------------------------------------------------------------------- EndRainState: LDA $7EF3C5 : CMP.b #$02 : !BGE + ; skip if past escape already diff --git a/zoraking.asm b/zoraking.asm index 91d8437..9ac1a1c 100644 --- a/zoraking.asm +++ b/zoraking.asm @@ -3,8 +3,7 @@ ;-------------------------------------------------------------------------------- LoadZoraKingItemGFX: LDA.l $1DE1C3 ; location randomizer writes zora item to - JSL.l PrepDynamicTile -RTL + JML.l PrepDynamicTile ;-------------------------------------------------------------------------------- JumpToSplashItemTarget: LDA $0D90, X