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
This commit is contained in:
cassidoxa
2022-11-16 21:38:28 -05:00
parent 43f753b517
commit 788cceaab9
67 changed files with 962 additions and 2127 deletions

View File

@@ -90,10 +90,8 @@ incsrc halfmagicbat.asm
incsrc mantle.asm incsrc mantle.asm
incsrc swordswap.asm incsrc swordswap.asm
incsrc stats.asm incsrc stats.asm
incsrc scratchpad.asm
incsrc dialog.asm incsrc dialog.asm
incsrc entrances.asm incsrc entrances.asm
incsrc clock.asm
incsrc accessibility.asm incsrc accessibility.asm
incsrc heartbeep.asm incsrc heartbeep.asm
incsrc capacityupgrades.asm incsrc capacityupgrades.asm
@@ -102,7 +100,6 @@ incsrc doorframefixes.asm
incsrc music.asm incsrc music.asm
incsrc roomloading.asm incsrc roomloading.asm
incsrc icepalacegraphics.asm incsrc icepalacegraphics.asm
incsrc firebarlayer.asm
warnpc $A18000 warnpc $A18000
org $1C8000 ; text tables for translation org $1C8000 ; text tables for translation
@@ -169,9 +166,7 @@ if !FEATURE_NEW_TEXT
endif endif
warnpc $A58000 warnpc $A58000
;org $228000 ; contrib area org $A28000
org $A28000 ; contrib area
incsrc contrib.asm
org $A38000 org $A38000
incsrc stats/main.asm incsrc stats/main.asm
@@ -287,7 +282,7 @@ warnpc $B08000
;Bank Map ;Bank Map
;$20 Code Bank ;$20 Code Bank
;$21 Reserved (Frame Hook & Init) ;$21 Reserved (Frame Hook & Init)
;$22 Contrib Code ;$22 Unused
;$23 Stats & Credits ;$23 Stats & Credits
;$24 Code Bank ;$24 Code Bank
;$29 External hooks (rest of bank not used) ;$29 External hooks (rest of bank not used)

View File

@@ -9,7 +9,7 @@ RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
DrawLibraryItemGFX: DrawLibraryItemGFX:
PHA PHA
LDA $0E80, X ; Retrieve stored item type LDA.w $0E80, X ; Retrieve stored item type
JSL.l DrawDynamicTile JSL.l DrawDynamicTile
PLA PLA
RTL RTL
@@ -61,7 +61,7 @@ RTL
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
LoadBonkItem: 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 CMP.b #115 : BNE + ; Desert Bonk Key
LDA.l BonkKey_Desert LDA.l BonkKey_Desert
BRA ++ BRA ++

View File

@@ -46,9 +46,9 @@ RTL
DecideIfBunnyByScreenIndex: DecideIfBunnyByScreenIndex:
; If indoors we don't have a screen index. Return non-bunny to make mirror-based ; If indoors we don't have a screen index. Return non-bunny to make mirror-based
; superbunny work ; superbunny work
LDA $1B : BNE .done LDA.b $1B : BNE .done
LDA MoonPearlEquipment : BNE .done LDA.l MoonPearlEquipment : BNE .done
LDA $8A : AND.b #$40 : PHA LDA.b $8A : AND.b #$40 : PHA
LDA.l InvertedMode : BNE .inverted LDA.l InvertedMode : BNE .inverted
.normal .normal
PLA : EOR #$40 PLA : EOR #$40
@@ -57,21 +57,12 @@ DecideIfBunnyByScreenIndex:
PLA PLA
.done .done
RTL RTL
;--------------------------------------------------------------------------------
;--------------------------------------------------------------------------------
;ReadInventoryPond:
; CPX.b #$1B : BNE + : LDA.b #$01 : RTL : +
; LDA EquipmentWRAM, X
;RTL
;--------------------------------------------------------------------------------
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
FixBunnyOnExitToLightWorld: FixBunnyOnExitToLightWorld:
LDA.w $02E0 : BEQ + LDA.w $02E0 : BEQ +
JSL.l DecideIfBunny : BEQ + JSL.l DecideIfBunny : BEQ +
STZ $5D ; set player mode to Normal STZ.b $5D ; set player mode to Normal
STZ $02E0 : STZ $56 ; return player graphics to normal STZ.w $02E0 : STZ.b $56 ; return player graphics to normal
+ +
RTS RTS
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
@@ -82,10 +73,10 @@ RTS
FixAga2Bunny: FixAga2Bunny:
LDA.l FixFakeWorld : BEQ + ; Only use this fix is fakeworld fix is in use LDA.l FixFakeWorld : BEQ + ; Only use this fix is fakeworld fix is in use
LDA.l InvertedMode : 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 ++ BRA ++
+++ +++
LDA.b #$40 : STA CurrentWorld ; Switch to dark world LDA.b #$40 : STA.l CurrentWorld ; Switch to dark world
++ ++
JSL DecideIfBunny : BNE + JSL DecideIfBunny : BNE +
JSR MakeBunny JSR MakeBunny
@@ -100,8 +91,8 @@ RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
MakeBunny: MakeBunny:
PHX : PHY PHX : PHY
LDA.b #$17 : STA $5D ; set player mode to permabunny LDA.b #$17 : STA.b $5D ; set player mode to permabunny
LDA.b #$01 : STA $02E0 : STA $56 ; make player look like bunny LDA.b #$01 : STA.w $02E0 : STA.b $56 ; make player look like bunny
JSL LoadGearPalettes_bunny JSL LoadGearPalettes_bunny
PLY : PLX PLY : PLX
RTS RTS
@@ -172,8 +163,8 @@ CMP.w #$070E : BEQ .new ; opening overworld map
.original .original
- -
LDA.b [Scrap00] LDA.b [Scrap00]
STA $7EC300, X STA.l $7EC300, X
STA $7EC500, X STA.l $7EC500, X
INC.b Scrap00 : INC.b Scrap00 INC.b Scrap00 : INC.b Scrap00
INX #2 INX #2
DEY DEY
@@ -182,7 +173,7 @@ RTL
.new .new
- -
LDA.b [Scrap00] LDA.b [Scrap00]
STA $7EC500, X STA.l $7EC500, X
INC.b Scrap00 : INC.b Scrap00 INC.b Scrap00 : INC.b Scrap00
INX #2 INX #2
DEY DEY
@@ -192,10 +183,10 @@ RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
; Fix pedestal pull overlay ; Fix pedestal pull overlay
PedestalPullOverlayFix: PedestalPullOverlayFix:
LDA.b #$09 : STA $039F, X ; the thing we wrote over LDA.b #$09 : STA.w $039F, X ; the thing we wrote over
LDA $1B : BNE + LDA.b $1B : BNE +
LDA $8A : CMP.b #$80 : BNE + LDA.b $8A : CMP.b #$80 : BNE +
LDA $8C : CMP.b #$97 LDA.b $8C : CMP.b #$97
+ +
RTL RTL
@@ -221,7 +212,7 @@ pushpc
pullpc pullpc
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
SetOverworldTransitionFlags: SetOverworldTransitionFlags:
LDA #$01 LDA.b #$01
STA $0ABF ; used by witch STA.w $0ABF ; used by witch
STA $021B ; used by race game STA.w $021B ; used by race game
RTL RTL

248
clock.asm
View File

@@ -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 <Timestamp(13 digits)>
; If ([002800h] AND 0F)=0Fh then read <Timestamp(13 digits)>
; If ([002800h] AND 0F)=0Fh then read <Timestamp(13 digits)>
; If ([002800h] AND 0F)=0Fh then read <Timestamp(13 digits)>
; 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
;--------------------------------------------------------------------------------

View File

@@ -2,7 +2,7 @@
ParadoxCaveGfxFix: ParadoxCaveGfxFix:
; Always upload line unless you're moving into paradox cave (0x0FF) from above (0x0EF) ; Always upload line unless you're moving into paradox cave (0x0FF) from above (0x0EF)
LDA.b $1B : BEQ .uploadLine 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 LDX.b $A2 : CPX.w #$00EF : BNE .uploadLine
;Ignore uploading four specific lines of tiles to VRAM ;Ignore uploading four specific lines of tiles to VRAM

View File

@@ -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
}
;================================================================

View File

@@ -22,7 +22,7 @@ InvertDPad:
JML.l InvertDPadReturn JML.l InvertDPadReturn
.crowd_control .crowd_control
LDA.l DPadInverter : BNE + LDA.l ControllerInverter : BNE +
LDA.w JOY1L : STA.b Scrap00 LDA.w JOY1L : STA.b Scrap00
LDA.w JOY1H : STA.b Scrap01 LDA.w JOY1H : STA.b Scrap01

View File

@@ -20,20 +20,6 @@ macro ASL32Single(value)
; ROL handles the carry from the lower byte for us ; ROL handles the carry from the lower byte for us
endmacro endmacro
;macro LSR32(value,k)
; LDX.b <k>
; ?loop:
; %LSR32Single(<value>,<k>)
; DEX : CPX.b #$00 : BNE ?loop
;endmacro
;macro ASL32(value,k)
; LDX.b <k>
; ?loop:
; %LSR32Single(<value>,<k>)
; DEX : CPX.b #$00 : BNE ?loop
;endmacro
CryptoMX: CryptoMX:
PHX PHX
@@ -222,69 +208,3 @@ db 32 ; n is 2
;dd (23*$9e3779b9)&$ffffffff ; n is 3 ;dd (23*$9e3779b9)&$ffffffff ; n is 3
dd (32*$9e3779b9)&$ffffffff ; n is 2 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 <stdint.h>
;#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<n-1; p++) {
; y = v[p+1];
; z = v[p] += MX;
; }
; y = v[0];
; z = v[n-1] += MX;
; } while (--rounds);
; } 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);
; }
;}

View File

@@ -1,6 +1,6 @@
CheckReceivedItemPropertiesBeforeLoad: CheckReceivedItemPropertiesBeforeLoad:
LDA $A0 : BEQ .normalCode LDA.b RoomIndex : BEQ .normalCode
LDA $7EC005 : BNE .lightOff LDA.l $7EC005 : BNE .lightOff
.normalCode .normalCode
LDA.l AddReceivedItemExpanded_properties, X ;Restore Rando Code LDA.l AddReceivedItemExpanded_properties, X ;Restore Rando Code
RTL RTL
@@ -10,18 +10,18 @@ CheckReceivedItemPropertiesBeforeLoad:
LDA.l AddReceivedItemExpanded_properties, X ; get palette LDA.l AddReceivedItemExpanded_properties, X ; get palette
REP #$30 REP #$30
AND #$0007 ; mask out palette AND.w #$0007 ; mask out palette
ASL #5 ; multiply by 32 ASL #5 ; multiply by 32
ADC #$C610 ; offset to latter half ADC.w #$C610 ; offset to latter half
TAX ; give to destination 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 MVN $7E, $7E ; move palette
SEP #$30 SEP #$30
PLB : PLY : PLX PLB : PLY : PLX
INC $15 INC.b $15
LDA #$00 LDA.b #$00
RTL RTL

View File

@@ -28,8 +28,8 @@ SetDeathWorldChecked:
JMP SetDeathWorldChecked_Inverted JMP SetDeathWorldChecked_Inverted
+ +
LDA.b $1B : BEQ .outdoors LDA.b $1B : BEQ .outdoors
LDA.w $040C : CMP #$FF : BNE .dungeon LDA.w $040C : CMP.b #$FF : BNE .dungeon
LDA.b $A0 : ORA.b $A1 : BNE ++ 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 LDA.l GanonPyramidRespawn : BNE .pyramid ; if flag is set, force respawn at pyramid on death to ganon
++ ++
.outdoors .outdoors
@@ -52,20 +52,20 @@ DoWorldFix_Inverted:
.skip_mirror_check ; alt entrance point .skip_mirror_check ; alt entrance point
LDA.l ProgressIndicator : CMP.b #$03 : BCS .done ; check if agahnim 1 is alive LDA.l ProgressIndicator : CMP.b #$03 : BCS .done ; check if agahnim 1 is alive
.setDarkWorld .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 LDA.l FollowerIndicator
CMP.b #$07 : BEQ .clear ; clear frog CMP.b #$07 : BEQ .clear ; clear frog
CMP.b #$08 : BEQ .clear ; clear dwarf - consider flute implications CMP.b #$08 : BEQ .clear ; clear dwarf - consider flute implications
BRA .done BRA .done
.clear .clear
LDA.b #$00 : STA FollowerIndicator ; clear follower LDA.b #$00 : STA.l FollowerIndicator ; clear follower
.done .done
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
SetDeathWorldChecked_Inverted: SetDeathWorldChecked_Inverted:
LDA.b $1B : BEQ .outdoors LDA.b $1B : BEQ .outdoors
LDA.w $040C : CMP #$FF : BNE .dungeon LDA.w $040C : CMP.b #$FF : BNE .dungeon
LDA.b $A0 : ORA $A1 : BNE ++ 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 LDA.l GanonPyramidRespawn : BNE .castle ; if flag is set, force respawn at pyramid on death to ganon
++ ++
.outdoors .outdoors
@@ -77,7 +77,7 @@ JMP DoWorldFix_Inverted_skip_mirror_check
.castle .castle
LDA.b #$00 : STA.l CurrentWorld ; set flag to dark world 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 .done
RTL RTL
;================================================================================ ;================================================================================

View File

@@ -61,7 +61,7 @@ JML.l Dungeon_OpenKeyedObject_nextChest
.nextChest .nextChest
INX #2 : CPX.w #$0150 : BEQ .couldntFindChest 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 DEC.b Scrap0E : BNE .nextChest

View File

@@ -172,7 +172,7 @@ FreeDungeonItemNotice:
STZ.w $1CF0 : STZ.w $1CF1 ; reset decompression buffer STZ.w $1CF0 : STZ.w $1CF1 ; reset decompression buffer
LDA.b #$01 : STA.l AltTextFlag ; set alternate dialog flag LDA.b #$01 : STA.l AltTextFlag ; set alternate dialog flag
STA.l $7F509F STA.l TextBoxDefer
;-------------------------------- ;--------------------------------
.skip .skip
@@ -415,6 +415,112 @@ CalculateSignIndex:
.done .done
RTL 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 ; A0 - A9 - 0 - 9
; AA - C3 - A - Z ; AA - C3 - A - Z

View File

@@ -7,8 +7,8 @@
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
StoreLastOverworldDoorID: StoreLastOverworldDoorID:
TXA : INC TXA : INC
STA $7F5099 STA.l PreviousOverworldDoor
LDA $1BBB73, X : STA $010E LDA.l $1BBB73, X : STA.w $010E
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
@@ -16,14 +16,14 @@ RTL
; CacheDoorFrameData ; CacheDoorFrameData
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
CacheDoorFrameData: CacheDoorFrameData:
LDA $7F5099 : BEQ .originalBehaviour LDA.l PreviousOverworldDoor : BEQ .originalBehaviour
DEC : ASL : TAX DEC : ASL : TAX
LDA EntranceDoorFrameTable, X : STA $0696 LDA.l EntranceDoorFrameTable, X : STA.w $0696
LDA EntranceAltDoorFrameTable, X : STA $0698 LDA.l EntranceAltDoorFrameTable, X : STA.w $0698
BRA .done BRA .done
.originalBehaviour .originalBehaviour
LDA $D724, X : STA $0696 LDA.w $D724, X : STA.w $0696
STZ $0698 STZ.w $0698
.done .done
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
@@ -32,8 +32,8 @@ RTL
; WalkDownIntoTavern ; WalkDownIntoTavern
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
WalkDownIntoTavern: WalkDownIntoTavern:
LDA $7F5099 LDA.l PreviousOverworldDoor
; tavern door has index 0x42 (saved off value is incremented by one) ; tavern door has index 0x42 (saved off value is incremented by one)
CMP #$43 CMP.b #$43
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------

View File

@@ -2,8 +2,8 @@
; Dungeon & Boss Drop Fixes ; Dungeon & Boss Drop Fixes
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
DropSafeDungeon: DropSafeDungeon:
LDA $040C : CMP #$08 : BEQ + LDA.w $040C : CMP.b #$08 : BEQ +
LDA $01C6FC, X : JML Sprite_SpawnFallingItem LDA.l $01C6FC, X : JML Sprite_SpawnFallingItem
+ +
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------

View File

@@ -7,7 +7,7 @@ EndingSequenceTableOverride:
TYX TYX
LDA.l EndingSequenceText, X LDA.l EndingSequenceText, X
PLX PLX
STA $1008, X STA.w $1008, X
PLY PLY
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
@@ -15,7 +15,7 @@ EndingSequenceTableLookupOverride:
PHY PHY
PHX PHX
TYX TYX
LDA.l EndingSequenceText, X : AND #$00FF LDA.l EndingSequenceText, X : AND.w #$00FF
PLX PLX
PLY PLY
RTL RTL

View File

@@ -3,21 +3,25 @@
; make sure bats always load LW stats ; make sure bats always load LW stats
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
NewBatInit: NewBatInit:
CPY #$00 : BEQ .light_world CPY.b #$00 : BEQ .light_world
;check if map id == 240 or 241 ;check if map id == 240 or 241
LDA $A0 : CMP #$F0 : BEQ .light_world ;oldman cave1 LDA.b RoomIndex : CMP.b #$F0 : BEQ .light_world ;oldman cave1
CMP #$F1 : BEQ .light_world ;oldman cave2 CMP.b #$F1 : BEQ .light_world ;oldman cave2
CMP #$B0 : BEQ .light_world ;agahnim statue keese CMP.b #$B0 : BEQ .light_world ;agahnim statue keese
CMP #$D0 : BEQ .light_world ;agahnim darkmaze CMP.b #$D0 : BEQ .light_world ;agahnim darkmaze
LDA.b #$85 : STA $0CD2, X LDA.b #$85 : STA.w $0CD2, X
LDA.b #$04 : STA $0E50, X LDA.b #$04 : STA.w $0E50, X
RTL RTL
.light_world .light_world
LDA.b #$80 : STA $0CD2, X LDA.b #$80 : STA.w $0CD2, X
LDA.b #$01 : STA $0E50, X LDA.b #$01 : STA.w $0E50, X
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
NewFireBarDamage:
LDA.w $00EE : CMP.w $0F20, X : BNE .NotSameLayer
JSL Sprite_AttemptDamageToPlayerPlusRecoilLong
RTL
.NotSameLayer
RTL

View File

@@ -8,7 +8,7 @@ LockAgahnimDoors:
;#$0 = Never Locked ;#$0 = Never Locked
LDA.w #$0000 : RTL LDA.w #$0000 : RTL
+ : CMP.w #$0001 : BNE + + : 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 JSR.w LockAgahnimDoorsCore : RTL
+ : CMP.w #$0002 : BNE + + : CMP.w #$0002 : BNE +
JSR.w LockAgahnimDoorsCore : BEQ .unlock JSR.w LockAgahnimDoorsCore : BEQ .unlock
@@ -18,20 +18,20 @@ LockAgahnimDoors:
REP #$30 REP #$30
PLY : PLX PLY : PLX
!BGE .crystalOrUnlock !BGE .crystalOrUnlock
LDA #$0001 : RTL LDA.w #$0001 : RTL
.crystalOrUnlock .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.l 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.w $0308 : AND.w #$0080 : BEQ ++ ;If we are holding an item
.locked .locked
LDA #$0001 : RTL ;Keep the door locked LDA.w #$0001 : RTL ;Keep the door locked
++ ++
SEP #$30 SEP #$30
JSL $099B6F ;Add tower break seal JSL $099B6F ;Add tower break seal
REP #$30 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 RTL
+ +
@@ -44,7 +44,7 @@ RTL
FlagAgahnimDoor: FlagAgahnimDoor:
LDA.l InvertedMode : BEQ .vanilla 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 .vanilla
LDA.b #$28 : STA.b $72 LDA.b #$28 : STA.b $72
@@ -53,9 +53,9 @@ FlagAgahnimDoor:
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
LockAgahnimDoorsCore: 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 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 LDA.w #$0001
RTS RTS
+ +
@@ -86,16 +86,15 @@ AllowStartFromSingleEntranceCave:
BNE + BNE +
JMP .done JMP .done
+ +
DEC DEC
STA.b Scrap00 STA.b Scrap00
ASL #2 : !ADD Scrap00 : ASL #2 ; mult by 20 ASL #2 : !ADD Scrap00 : ASL #2 ; mult by 20
TAX 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+$05, X : STA.l $7EC144 ; Cache BG1 V scroll
LDA.l StartingAreaExitTable+$07, X : STA.l $7EC146 ; Cache BG1 H 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+$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+$0D, X : STA.l $7EC150 ; Cache Camera Y coord lower bound.
LDA.l StartingAreaExitTable+$0F, X : STA.l $7EC152 ; Cache Camera X coord lower bound. LDA.l StartingAreaExitTable+$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 BIT.w #$0080 : BEQ + : ORA.w #$FF00 : + ; Sign extend
STA.l $7EC16E STA.l $7EC16E
LDA.w #$0000 : !SUB.l $7EC16A : STA $7EC16C LDA.w #$0000 : !SUB.l $7EC16A : STA.l $7EC16C
LDA.w #$0000 : !SUB.l $7EC16E : STA $7EC170 LDA.w #$0000 : !SUB.l $7EC16E : STA.l $7EC170
LDA.l StartingAreaExitTable+$02, X : AND.w #$00FF LDA.l StartingAreaExitTable+$02, X : AND.w #$00FF
STA $7EC14C ; Cache the overworld area number STA.l $7EC14C ; Cache the overworld area number
STA $7EC140 ; Cache the aux 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.w $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 $0699 ;zero out door overlays in case starting overworld door is not set
SEP #$20 ; set 8-bit accumulator SEP #$20 ; set 8-bit accumulator
LDA $7EF3C8 : TAX LDA.l $7EF3C8 : TAX
LDA.l StartingAreaOverworldDoor, X : STA.l $7F5099 ;Load overworld door LDA.l StartingAreaOverworldDoor, X : STA.l PreviousOverworldDoor ;Load overworld door
REP #$20 ; reset 16-bit accumulator REP #$20 ; reset 16-bit accumulator
JSL.l CacheDoorFrameData JSL.l CacheDoorFrameData
@@ -135,7 +134,7 @@ RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
AllowStartFromExit: AllowStartFromExit:
LDX $1CE8 LDX.w $1CE8
LDA.l ShouldStartatExit, X : BNE .doStart LDA.l ShouldStartatExit, X : BNE .doStart
LDA.l StartingEntrance ; what we wrote over LDA.l StartingEntrance ; what we wrote over
@@ -146,21 +145,21 @@ JML.l AllowStartFromExitReturn
LDA.l $028481, X ;Module_LocationMenu_starting_points LDA.l $028481, X ;Module_LocationMenu_starting_points
ASL : TAX ASL : TAX
LDA.l $02D8D2, X : STA $A0 LDA.l $02D8D2, X : STA.b RoomIndex
LDA.l $02D8D3, X : STA $A1 LDA.l $02D8D3, X : STA.b RoomIndex+1
; Go to pre-overworld mode ; Go to pre-overworld mode
LDA.b #$08 : STA $10 LDA.b #$08 : STA.b $10
STZ $11 STZ.b $11
STZ $B0 STZ.b $B0
STZ $010A STZ.w $010A
STZ $04AA STZ.w $04AA
JSL Equipment_SearchForEquippedItemLong JSL Equipment_SearchForEquippedItemLong
JSL HUD_RebuildLong2 JSL HUD_RebuildLong2
JSL $0DDD32 ; Equipment_UpdateEquippedItemLong JSL Equipment_UpdateEquippedItemLong
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
@@ -196,7 +195,7 @@ PreventEnterOnBonk:
STA.b Scrap00 ; part of what we wrote over STA.b Scrap00 ; part of what we wrote over
LDA.l InvertedMode : AND.w #$00FF : BEQ .done LDA.l InvertedMode : AND.w #$00FF : BEQ .done
LDA.l $5D : AND.w #$00FF : CMP.w #$0014 : BNE .done ;in mirror mode? 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 ; If in inverted, are in mirror mode, and are bonking then do not enter
JML.l PreventEnterOnBonk_BRANCH_IX JML.l PreventEnterOnBonk_BRANCH_IX
@@ -206,8 +205,8 @@ PreventEnterOnBonk:
JML.l PreventEnterOnBonk_return JML.l PreventEnterOnBonk_return
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
TurtleRockEntranceFix: TurtleRockEntranceFix:
LDA TurtleRockAutoOpenFix : BEQ .done LDA.l TurtleRockAutoOpenFix : BEQ .done
LDA $8A : CMP.b #$47 : BNE .done LDA.b $8A : CMP.b #$47 : BNE .done
;If exiting to turtle rock ensure the entrance is open ;If exiting to turtle rock ensure the entrance is open
LDA.l OverworldEventDataWRAM+$47 : ORA.b #$20 : STA.l OverworldEventDataWRAM+$47 LDA.l OverworldEventDataWRAM+$47 : ORA.b #$20 : STA.l OverworldEventDataWRAM+$47
.done .done
@@ -216,14 +215,14 @@ RTL
AnimatedEntranceFix: ;when an entrance animation tries to start AnimatedEntranceFix: ;when an entrance animation tries to start
PHA PHA
LDA.l InvertedMode : BEQ + ;If we are in inverted mode 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 PLA
STZ $04C6 ; skip it. STZ.w $04C6 ; skip it.
LDA #$00 LDA.b #$00
RTL RTL
+ +
PLA PLA
STA $02E4 ;what we wrote over STA.w $02E4 ;what we wrote over
STA $0FC1 ;what we wrote over STA.w $0FC1 ;what we wrote over
STA $0710 ;what we wrote over STA.w $0710 ;what we wrote over
RTL RTL

View File

@@ -148,13 +148,13 @@ OnNewFile:
PHX : PHP PHX : PHP
; reset some values on new file that are otherwise only reset on hard reset ; reset some values on new file that are otherwise only reset on hard reset
SEP #$20 ; set 8-bit accumulator SEP #$20 ; set 8-bit accumulator
STZ $03C4 ; ancilla slot index STZ.w $03C4 ; ancilla slot index
STZ $047A ; EG STZ.w $047A ; EG
STZ $0B08 : STZ $0B09 ; arc variable STZ.w $0B08 : STZ $0B09 ; arc variable
STZ $0CFB ; enemies killed (pull trees) STZ.w $0CFB ; enemies killed (pull trees)
STZ $0CFC ; times taken damage (pull trees) STZ.w $0CFC ; times taken damage (pull trees)
STZ $0FC7 : STZ $0FC8 : STZ $0FC9 : STZ $0FCA : STZ $0FCB : STZ $0FCC : STZ $0FCD ; prize packs STZ.w $0FC7 : STZ.w $0FC8 : STZ.w $0FC9 : STZ.w $0FCA : STZ.w $0FCB : STZ.w $0FCC : STZ.w $0FCD ; prize packs
LDA #$00 : STA.l $7EC011 ; mosaic LDA.b #$00 : STA.l $7EC011 ; mosaic
JSL InitRNGPointerTable ; boss RNG JSL InitRNGPointerTable ; boss RNG
PLP : PLX PLP : PLX
RTL RTL
@@ -166,16 +166,12 @@ RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
OnLinkDamaged: OnLinkDamaged:
JSL.l IncrementDamageTakenCounter_Arb JSL.l IncrementDamageTakenCounter_Arb
;JSL.l FlipperKill
JML.l OHKOTimer JML.l OHKOTimer
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
OnEnterWater: ;OnEnterWater:
JSL.l RegisterWaterEntryScreen ; JSL.l UnequipCapeQuiet ; what we wrote over
;RTL
JSL.l MysteryWaterFunction
LDX.b #$04
RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
OnLinkDamagedFromPit: OnLinkDamagedFromPit:
JSL.l OHKOTimer JSL.l OHKOTimer
@@ -197,7 +193,6 @@ OnLinkDamagedFromPitOutdoors:
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
OnOWTransition: OnOWTransition:
JSL.l FloodGateReset JSL.l FloodGateReset
JSL.l FlipperFlag
JSL.l StatTransitionCounter JSL.l StatTransitionCounter
PHP PHP
SEP #$20 ; set 8-bit accumulator SEP #$20 ; set 8-bit accumulator
@@ -206,14 +201,14 @@ OnOWTransition:
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
OnLoadDuckMap: OnLoadDuckMap:
LDA.l ScratchBufferV LDA.l DuckMapFlag
BNE + BNE +
INC : STA.l ScratchBufferV INC : STA.l DuckMapFlag
JSL OverworldMap_InitGfx : DEC $0200 JSL OverworldMap_InitGfx : DEC $0200
RTL RTL
+ +
LDA.b #$00 : STA.l ScratchBufferV LDA.b #$00 : STA.l DuckMapFlag
JML OverworldMap_DarkWorldTilemap JML OverworldMap_DarkWorldTilemap
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
@@ -228,10 +223,10 @@ RTL
PostItemAnimation: PostItemAnimation:
LDA.b #$00 : STA.l BusyItem ; mark item as finished 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 STZ.w $1CF0 : STZ.w $1CF1 ; reset decompression buffer
JSL.l Main_ShowTextMessage_Alt JSL.l Main_ShowTextMessage_Alt
LDA.b #$00 : STA.l $7F509F LDA.b #$00 : STA.l TextBoxDefer
+ +
LDA.w $02E9 : CMP.b #$01 : BNE + LDA.w $02E9 : CMP.b #$01 : BNE +

View File

@@ -2,20 +2,20 @@
; Fairy Changes & Fixes ; Fairy Changes & Fixes
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
RefillHealthPlusMagic: RefillHealthPlusMagic:
LDA BigFairyHealth : STA HeartsFiller LDA.l BigFairyHealth : STA.l HeartsFiller
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
RefillHealthPlusMagic8bit: RefillHealthPlusMagic8bit:
LDA BigFairyHealth : STA HeartsFiller LDA.l BigFairyHealth : STA.l HeartsFiller
LDA BigFairyMagic : STA MagicFiller LDA.l BigFairyMagic : STA.l MagicFiller
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
CheckFullHealth: CheckFullHealth:
LDA BigFairyHealth : BEQ + LDA.l BigFairyHealth : BEQ +
LDA CurrentHealth : CMP MaximumHealth : BNE .player_hp_not_full_yet LDA.l CurrentHealth : CMP.l MaximumHealth : BNE .player_hp_not_full_yet
+ +
LDA BigFairyMagic : BEQ + LDA.l BigFairyMagic : BEQ +
LDA CurrentMagic : CMP.b #$80 : BNE .player_mp_not_full_yet LDA.l CurrentMagic : CMP.b #$80 : BNE .player_mp_not_full_yet
+ +
LDA.b #$00 LDA.b #$00
RTL RTL
@@ -30,57 +30,56 @@ FairyPond_Init:
JML.l Sprite_ShowMessageFromPlayerContact JML.l Sprite_ShowMessageFromPlayerContact
+ +
PHY : JSL.l Sprite_CheckDamageToPlayerSameLayerLong : BCC + PHY : JSL.l Sprite_CheckDamageToPlayerSameLayerLong : BCC +
LDA BottleContentsOne : CMP.b #$02 : BNE ++ : LDA.b #$1C : PHA : BRA .emptyBottle : ++ LDA.l BottleContentsOne : CMP.b #$02 : BNE ++ : LDA.b #$1C : PHA : BRA .emptyBottle : ++
LDA BottleContentsTwo : CMP.b #$02 : BNE ++ : LDA.b #$1D : PHA : BRA .emptyBottle : ++ LDA.l BottleContentsTwo : CMP.b #$02 : BNE ++ : LDA.b #$1D : PHA : BRA .emptyBottle : ++
LDA BottleContentsThree : CMP.b #$02 : BNE ++ : LDA.b #$1E : PHA : BRA .emptyBottle : ++ LDA.l 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 BottleContentsFour : CMP.b #$02 : BNE ++ : LDA.b #$1F : PHA : BRA .emptyBottle : ++
.noInventory .noInventory
LDA.b #$0A : STA $0D80, X LDA.b #$0A : STA.w $0D80, X
LDA.b #$51 LDA.b #$51
LDY.b #$01 LDY.b #$01
JSL.l Sprite_ShowMessageFromPlayerContact JSL.l Sprite_ShowMessageFromPlayerContact
JMP .cleanup JMP .cleanup
.emptyBottle .emptyBottle
LDA.b #$02 : STA $0D80, X LDA.b #$02 : STA.w $0D80, X
;JSL Player_ResetState ; If we continue to have issues, add this in too. (After determining the address for it)
STZ $2F STZ $2F
LDA.b #$01 : STA $02E4 LDA.b #$01 : STA.w $02E4
PLA : STA $1CE8 PLA : STA.w $1CE8
.cleanup .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 CLC ; skip rest of original function
+ : PLY + : PLY
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
HappinessPond_Check: HappinessPond_Check:
LDA $A0 : CMP.b #$15 ;what we wrote over LDA.b RoomIndex : CMP.b #$15 ;what we wrote over
BNE .done BNE .done
PHP PHP
LDA.b #$72 LDA.b #$72
JSL Sprite_SpawnDynamically JSL Sprite_SpawnDynamically
LDA $0FD8 : STA $0D10, Y LDA.w $0FD8 : STA.w $0D10, Y
LDA $0FD9 : STA $0D30, Y LDA.w $0FD9 : STA.w $0D30, Y
LDA $0FDA : !SUB.b #$40 : STA $0D00, Y LDA.w $0FDA : !SUB.b #$40 : STA.w $0D00, Y
LDA $0FDB : SBC.b #$00 : STA $0D20, 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 LDA.b #$BB
JSL Sprite_SpawnDynamically 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.w $0FD8 : STA.w $0D10, Y
LDA $0FD9 : STA $0D30, Y LDA.w $0FD9 : STA.w $0D30, Y
LDA $0FDA : !SUB.b #$20 : STA $0D00, Y LDA.w $0FDA : !SUB.b #$20 : STA.w $0D00, Y
LDA $0FDB : SBC.b #$00 : STA $0D20, Y LDA.w $0FDB : SBC.b #$00 : STA.w $0D20, Y
STZ $0DD0, X ; self terminate STZ.w $0DD0, X ; self terminate
PLP PLP
.done .done

View File

@@ -328,8 +328,8 @@ DrawPlayerFileShared:
LDA.l EquipmentSRAM+$0108 : AND.w #$00FF LDA.l EquipmentSRAM+$0108 : AND.w #$00FF
JSL.l HexToDec JSL.l HexToDec
LDA.l $7F5006 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(11,26) LDA.l HexToDecDigit4 : 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 HexToDecDigit5 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(11,27)
; Boots ; Boots
%fs_drawItemBasic(EquipmentSRAM+$15,3,28,FileSelectItems_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.w #$029B|!FS_COLOR_GREEN : %fs_draw16x8(0,10)
LDA.l DisplayRupeesSRAM LDA.l DisplayRupeesSRAM
JSL.l HexToDec JSL.l HexToDec
LDA.l $7F5004 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(1,9) LDA.l HexToDecDigit2 : 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 HexToDecDigit3 : 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 HexToDecDigit4 : 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 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.w #$028B|!FS_COLOR_BLUE : %fs_draw16x8(0,14)
LDA.l BombsEquipmentSRAM : AND.w #$00FF LDA.l BombsEquipmentSRAM : AND.w #$00FF
JSL.l HexToDec JSL.l HexToDec
LDA.l $7F5006 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(1,14) LDA.l HexToDecDigit4 : 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 HexToDecDigit5 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(1,15)
LDA.l BowTrackingSRAM : AND.w #$0040 : BEQ + LDA.l BowTrackingSRAM : AND.w #$0040 : BEQ +
LDA.w #$0299|!FS_COLOR_RED : %fs_draw16x8(0,17) LDA.w #$0299|!FS_COLOR_RED : %fs_draw16x8(0,17)
@@ -579,8 +579,8 @@ FileSelectDrawHudBar:
++ ++
LDA.l CurrentArrowsSRAM : AND.w #$00FF LDA.l CurrentArrowsSRAM : AND.w #$00FF
JSL.l HexToDec JSL.l HexToDec
LDA.l $7F5006 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(1,17) LDA.l HexToDecDigit4 : 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 HexToDecDigit5 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(1,18)
RTS RTS
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
AltBufferTable: AltBufferTable:

View File

@@ -1,8 +0,0 @@
NewFireBarDamage:
{
LDA $00EE : CMP $0F20, X : BNE .NotSameLayer
JSL Sprite_AttemptDamageToPlayerPlusRecoilLong
RTL
.NotSameLayer
RTL
}

View File

@@ -1,65 +1,13 @@
;================================================================================ ;================================================================================
; Fake Flippers Softlock Fix ; 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 UnequipCapeQuiet:
LDA.b #$F0 ; set check to invalid entry LDA.b #$20 : STA.w $02E2
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
STZ.w $037B STZ.w $037B
STZ.b $55 STZ.b $55
STZ.w $0360 STZ.w $0360
RTL RTL
;--------------------------------------------------------------------------------
;===================================================================================================
; More elegant solution
;===================================================================================================
protectff: protectff:
LDA.l AllowAccidentalMajorGlitch LDA.l AllowAccidentalMajorGlitch

View File

@@ -5,21 +5,21 @@ FloodGateAndMasterSwordFollowerReset:
JSL.l MasterSwordFollowerClear JSL.l MasterSwordFollowerClear
FloodGateReset: FloodGateReset:
LDA.l PersistentFloodgate : BNE + LDA.l PersistentFloodgate : BNE +
LDA OverworldEventDataWRAM+$3B : AND.b #$DF : STA OverworldEventDataWRAM+$3B ; reset water outside floodgate LDA.l OverworldEventDataWRAM+$3B : AND.b #$DF : STA.l OverworldEventDataWRAM+$3B ; reset water outside floodgate
LDA OverworldEventDataWRAM+$7B : AND.b #$DF : STA OverworldEventDataWRAM+$7B ; reset water outside swamp palace LDA.l OverworldEventDataWRAM+$7B : AND.b #$DF : STA.l OverworldEventDataWRAM+$7B ; reset water outside swamp palace
LDA RoomDataWRAM[$010B].low : AND.b #$7F : STA RoomDataWRAM[$010B].low ; clear water inside floodgate LDA.l RoomDataWRAM[$010B].low : AND.b #$7F : STA.l 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 RoomDataWRAM[$28].high : AND.b #$FE : STA.l RoomDataWRAM[$28].high ; clear water front room (room 40)
+ +
FloodGateResetInner: FloodGateResetInner:
LDA.l Bugfix_SwampWaterLevel : BEQ +++ LDA.l Bugfix_SwampWaterLevel : BEQ +++
LDA RoomDataWRAM[$37].low : AND.b #$04 : BEQ + ; Check if key in room 55 has been collected. LDA.l 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 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. ; 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 RTL
;================================================================================ ;================================================================================

View File

@@ -2,38 +2,38 @@
; Randomize Flute Dig Item ; Randomize Flute Dig Item
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
SpawnHauntedGroveItem: SpawnHauntedGroveItem:
LDA $8A : CMP.b #$2A : BEQ + : RTL : + ; Skip if not the haunted grove LDA.b $8A : CMP.b #$2A : BEQ + : RTL : + ; Skip if not the haunted grove
LDA $1B : BEQ + : RTL : + ; Skip if indoors LDA.b $1B : BEQ + : RTL : + ; Skip if indoors
%GetPossiblyEncryptedItem(HauntedGroveItem, HeartPieceOutdoorValues) %GetPossiblyEncryptedItem(HauntedGroveItem, HeartPieceOutdoorValues)
JSL.l PrepDynamicTile JSL.l PrepDynamicTile
LDA.b #$EB LDA.b #$EB
STA $7FFE00 STA.l $7FFE00
JSL Sprite_SpawnDynamically JSL Sprite_SpawnDynamically
LDX.b #$00 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 #$00 : STA.w $0D40, Y
LDA.b #$18 : STA $0F80, Y LDA.b #$18 : STA.w $0F80, Y
LDA.b #$FF : STA $0B58, Y LDA.b #$FF : STA.w $0B58, Y
LDA.b #$30 : STA $0F10, Y LDA.b #$30 : STA.w $0F10, Y
LDA $22 : !ADD.l .x_offsets, X LDA.b $22 : !ADD.l .x_offsets, X
AND.b #$F0 : STA $0D10, Y AND.b #$F0 : STA.w $0D10, Y
LDA $23 : ADC.b #$00 : STA $0D30, Y LDA.b $23 : ADC.b #$00 : STA.w $0D30, Y
LDA $20 : !ADD.b #$16 : AND.b #$F0 : STA $0D00, Y LDA.b $20 : !ADD.b #$16 : AND.b #$F0 : STA.w $0D00, Y
LDA $21 : ADC.b #$00 : STA $0D20, 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 TYX
LDX $8A ; haunted grove (208D0A) LDX.b $8A ; haunted grove (208D0A)
LDA OverworldEventDataWRAM, X : AND.b #$40 : BNE + LDA.l OverworldEventDataWRAM, X : AND.b #$40 : BNE +
LDA.b #$1B : JSL Sound_SetSfx3PanLong LDA.b #$1B : JSL Sound_SetSfx3PanLong
+ +
RTL RTL
@@ -52,30 +52,30 @@ RTL
} }
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
FluteBoy: FluteBoy:
LDA $10 : CMP.b #$1A : BEQ + LDA.b $10 : CMP.b #$1A : BEQ +
LDA.b #$01 : STA $0FDD LDA.b #$01 : STA.w $0FDD
JML.l FluteBoy_Abort 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 JML.l FluteBoy_Continue
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
FreeDuckCheck: FreeDuckCheck:
LDA.l InvertedMode : BEQ .done 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? ; check the area, is it #$18 = 30?
LDA $8A : CMP.b #$18 : BNE .done LDA.b $8A : CMP.b #$18 : BNE .done
REP #$20 REP #$20
; Y coordinate boundaries for setting it off. ; Y coordinate boundaries for setting it off.
LDA $20 LDA.b $20
CMP.w #$0760 : BCC .done CMP.w #$0760 : BCC .done
CMP.w #$07E0 : BCS .done CMP.w #$07E0 : BCS .done
; do if( (Ycoord >= 0x0760) && (Ycoord < 0x07e0 ; do if( (Ycoord >= 0x0760) && (Ycoord < 0x07e0
LDA $22 LDA.b $22
CMP.w #$01CF : BCC .done CMP.w #$01CF : BCC .done
CMP.w #$0230 : BCS .done CMP.w #$0230 : BCS .done
@@ -84,7 +84,7 @@ FreeDuckCheck:
SEP #$20 SEP #$20
; Apparently a special Overworld mode for doing this? ; 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. ; Trigger the sequence to start the weathervane explosion.
LDY.b #$00 LDY.b #$00
@@ -94,12 +94,12 @@ FreeDuckCheck:
BRA .skipSong BRA .skipSong
.done .done
SEP #$20 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 LDA.b #$13
RTL RTL
.skipSong .skipSong
SEP #$20 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 LDA.b #$00
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------

View File

@@ -33,24 +33,13 @@ NMIHookAction:
JML.l NMIHookReturn JML.l NMIHookReturn
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
PostNMIHookAction: PostNMIHookAction:
LDA.l NMIAux : BEQ + LDA.w NMIAux : BEQ +
LDA.b Scrap00 : PHA ; preserve DP ram
LDA.b Scrap01 : PHA
LDA.b Scrap02 : PHA
LDA.l NMIAux+2 : STA.b Scrap02 ; set up jump pointer PHK : PEA .return-1 ; push stack for RTL return
LDA.l NMIAux+1 : STA.b Scrap01 JMP.w [NMIAux]
LDA.l NMIAux+0 : STA.b Scrap00
PHK : PER .return-1 ; push stack for RTL return
JMP [$0000]
.return .return
LDA.b #$00 : STA.l NMIAux ; zero bank byte of NMI hook pointer STZ.w NMIAux ; zero bank byte of NMI hook pointer
PLA : STA.b Scrap02
PLA : STA.b Scrap01
PLA : STA.b Scrap00
+ +
LDA.b $13 : STA.w INIDISP ; thing we wrote over, turn screen back on LDA.b $13 : STA.w INIDISP ; thing we wrote over, turn screen back on

View File

@@ -2,7 +2,7 @@
; Glitched Mode Fixes ; Glitched Mode Fixes
;================================================================================ ;================================================================================
GetAgahnimPalette: GetAgahnimPalette:
LDA $A0 ; get room id LDA.b RoomIndex ; get room id
CMP.b #13 : BNE + ; Agahnim 2 room CMP.b #13 : BNE + ; Agahnim 2 room
LDA.b #$07 ; Use Agahnim 2 LDA.b #$07 ; Use Agahnim 2
RTL RTL
@@ -11,25 +11,25 @@ GetAgahnimPalette:
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
GetAgahnimDeath: GetAgahnimDeath:
STA $0BA0, X ; thing we wrote over STA.w $0BA0, X ; thing we wrote over
LDA $A0 ; get room id LDA.b RoomIndex ; get room id
CMP.b #13 : BNE + ; Agahnim 2 room CMP.b #13 : BNE + ; Agahnim 2 room
LDA.l Bugfix_SetWorldOnAgahnimDeath : BEQ ++ LDA.l Bugfix_SetWorldOnAgahnimDeath : BEQ ++
LDA.l InvertedMode : 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 ++ 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 LDA.b #$01 ; Use Agahnim 2
RTL RTL
+ ; Elsewhere + ; Elsewhere
LDA.l Bugfix_SetWorldOnAgahnimDeath : BEQ ++ LDA.l Bugfix_SetWorldOnAgahnimDeath : BEQ ++
LDA.l InvertedMode : 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 ++ 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 ; (This will later get flipped to DW when Agahnim 1
; warps us to the pyramid) ; warps us to the pyramid)
++ ++
@@ -37,7 +37,7 @@ GetAgahnimDeath:
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
GetAgahnimType: GetAgahnimType:
LDA $A0 ; get room id LDA.b RoomIndex ; get room id
CMP.b #13 : BNE + ; Agahnim 2 room CMP.b #13 : BNE + ; Agahnim 2 room
LDA.b #$0006 ; Use Agahnim 2 LDA.b #$0006 ; Use Agahnim 2
BRA .done BRA .done
@@ -48,7 +48,7 @@ RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
GetAgahnimSlot: GetAgahnimSlot:
PHX ; thing we wrote over PHX ; thing we wrote over
LDA $A0 ; get room id LDA.b RoomIndex ; get room id
CMP.b #13 : BNE + ; Agahnim 2 room CMP.b #13 : BNE + ; Agahnim 2 room
LDA.b #$01 ; Use Agahnim 2 LDA.b #$01 ; Use Agahnim 2
JML.l GetAgahnimSlotReturn JML.l GetAgahnimSlotReturn
@@ -57,8 +57,8 @@ GetAgahnimSlot:
JML.l GetAgahnimSlotReturn JML.l GetAgahnimSlotReturn
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
GetAgahnimLightning: GetAgahnimLightning:
INC $0E30, X ; thing we wrote over INC.w $0E30, X ; thing we wrote over
LDA $A0 ; get room id LDA.b RoomIndex ; get room id
CMP.b #13 : BNE + ; Agahnim 2 room CMP.b #13 : BNE + ; Agahnim 2 room
LDA.b #$01 ; Use Agahnim 2 LDA.b #$01 ; Use Agahnim 2
RTL RTL
@@ -69,11 +69,11 @@ GetAgahnimLightning:
;0 = Allow ;0 = Allow
;1 = Forbid ;1 = Forbid
AllowJoypadInput: AllowJoypadInput:
LDA PermitSQFromBosses : BEQ .fullCheck LDA.l PermitSQFromBosses : BEQ .fullCheck
LDA $0403 : AND.b #$80 : BEQ .fullCheck LDA.w $0403 : AND.b #$80 : BEQ .fullCheck
LDA $0112 : ORA $02E4 ; we have heart container, do short check LDA.w $0112 : ORA.w $02E4 ; we have heart container, do short check
RTL RTL
.fullCheck .fullCheck
LDA $0112 : ORA $02E4 : ORA $0FFC LDA.w $0112 : ORA.w $02E4 : ORA.w $0FFC
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------

View File

@@ -118,12 +118,12 @@ GetRequiredCrystalsInX:
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
CheckEnoughCrystalsForGanon: CheckEnoughCrystalsForGanon:
LDA CrystalCounter LDA.l CrystalCounter
CMP.l NumberOfCrystalsRequiredForGanon CMP.l NumberOfCrystalsRequiredForGanon
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
CheckEnoughCrystalsForTower: CheckEnoughCrystalsForTower:
LDA CrystalCounter LDA.l CrystalCounter
CMP.l NumberOfCrystalsRequiredForTower CMP.l NumberOfCrystalsRequiredForTower
RTL RTL

View File

@@ -6,10 +6,10 @@ GetMagicBatItem:
%GetPossiblyEncryptedItem(MagicBatItem, SpriteItemValues) %GetPossiblyEncryptedItem(MagicBatItem, SpriteItemValues)
CMP.b #$FF : BEQ .normalLogic CMP.b #$FF : BEQ .normalLogic
TAY 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 JML.l Link_ReceiveItem
.normalLogic .normalLogic
LDA HalfMagic LDA.l HalfMagic
STA MagicConsumption STA.l MagicConsumption
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------

View File

@@ -3,7 +3,7 @@
;================================================================================ ;================================================================================
CalculateSpikeFloorDamage: CalculateSpikeFloorDamage:
REP #$20 ; set 16-bit accumulator 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 CMP.w #279
SEP #$20 ; set 8-bit accumulator SEP #$20 ; set 8-bit accumulator
BNE + BNE +
@@ -18,7 +18,7 @@ RTL
CalculateByrnaUsage: CalculateByrnaUsage:
LDA.b $1B : BEQ ++ LDA.b $1B : BEQ ++
REP #$20 ; set 16-bit accumulator 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 #95 : BEQ + ; Ice Palace Spike Room
CMP.w #172 : BEQ + ; Blind Boss Room CMP.w #172 : BEQ + ; Blind Boss Room
CMP.w #179 : BEQ + ; Room in Misery Mire CMP.w #179 : BEQ + ; Room in Misery Mire
@@ -38,7 +38,7 @@ CalculateByrnaUsage:
CalculateCapeUsage: CalculateCapeUsage:
LDA.b $1B : BEQ ++ LDA.b $1B : BEQ ++
REP #$20 ; set 16-bit accumulator 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 #95 : BEQ + ; Ice Palace Spike Room
CMP.w #179 : BEQ + ; Room in Misery Mire CMP.w #179 : BEQ + ; Room in Misery Mire
CMP.w #213 : BEQ + ; Laser Bridge CMP.w #213 : BEQ + ; Laser Bridge
@@ -56,7 +56,7 @@ CalculateCapeUsage:
ActivateInvulnerabilityOrDont: ActivateInvulnerabilityOrDont:
LDA.b $1B : BEQ .nowhere_special LDA.b $1B : BEQ .nowhere_special
REP #$20 ; set 16-bit accumulator 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 #95 : BEQ .somewhere_cool ; Ice Palace Spike Room
CMP.w #179 : BEQ .somewhere_cool ; Room in Misery Mire CMP.w #179 : BEQ .somewhere_cool ; Room in Misery Mire
CMP.w #213 : BEQ .somewhere_cool ; Laser Bridge CMP.w #213 : BEQ .somewhere_cool ; Laser Bridge
@@ -81,7 +81,7 @@ GetItemDamageValue:
CPX.b #$3d : BEQ .hookshot CPX.b #$3d : BEQ .hookshot
.normal .normal
lda $0db8f1,x ;what we wrote over LDA.l $0db8f1,x ;what we wrote over
RTL RTL
.boomerang .boomerang
LDA.l StunItemAction : AND #$01 : BNE .normal LDA.l StunItemAction : AND #$01 : BNE .normal

View File

@@ -3,10 +3,10 @@
;================================================================================ ;================================================================================
BeepLogic: BeepLogic:
LDA.l HeartBeep : BEQ + LDA.l HeartBeep : BEQ +
STA $04CA STA.w $04CA
LDA.b #$2B : STA $012E LDA.b #$2B : STA.w $012E
RTL RTL
+ +
LDA.b #$FF : STA $04CA LDA.b #$FF : STA.w $04CA
RTL RTL
;================================================================================ ;================================================================================

View File

@@ -3,7 +3,7 @@
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
HeartPieceGet: HeartPieceGet:
PHX : PHY PHX : PHY
LDY $0E80, X ; load item value into Y register LDY.w $0E80, X ; load item value into Y register
BNE + BNE +
; if for any reason the item value is 0 reload it, just in case ; if for any reason the item value is 0 reload it, just in case
JSL.l LoadHeartPieceRoomValue : TAY JSL.l LoadHeartPieceRoomValue : TAY
@@ -19,7 +19,6 @@ HeartPieceGet:
BRA .giveItem BRA .giveItem
.notHeart .notHeart
.giveItem .giveItem
JSL.l $0791B3 ; Player_HaltDashAttackLong JSL.l $0791B3 ; Player_HaltDashAttackLong
JSL.l Link_ReceiveItem JSL.l Link_ReceiveItem
@@ -29,7 +28,6 @@ HeartPieceGet:
.unfinished_heart .unfinished_heart
SEC ; return true SEC ; return true
.done .done
JSL MaybeUnlockTabletAnimation JSL MaybeUnlockTabletAnimation
PLY : PLX PLY : PLX
@@ -118,27 +116,6 @@ RTL
CLC CLC
RTL 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: HeartPieceSpritePrep:
PHA PHA
@@ -215,7 +192,7 @@ endmacro
LoadIndoorValue: LoadIndoorValue:
PHP PHP
REP #$20 ; set 16-bit accumulator 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 + CMP.w #225 : BNE +
%GetPossiblyEncryptedItem(HeartPiece_Forest_Thieves, HeartPieceIndoorValues) %GetPossiblyEncryptedItem(HeartPiece_Forest_Thieves, HeartPieceIndoorValues)
JMP .done JMP .done
@@ -328,7 +305,7 @@ LoadHeartContainerRoomValue:
LoadBossValue: LoadBossValue:
PHP PHP
REP #$20 ; set 16-bit accumulator 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 + CMP.w #200 : BNE +
%GetPossiblyEncryptedItem(HeartContainer_ArmosKnights, HeartContainerBossValues) %GetPossiblyEncryptedItem(HeartContainer_ArmosKnights, HeartContainerBossValues)
JMP .done JMP .done
@@ -371,7 +348,7 @@ CheckIfBossRoom:
; Carry set if we're in a boss room, unset otherwise. ; Carry set if we're in a boss room, unset otherwise.
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
REP #$20 ; set 16-bit accumulator 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 #200 : BEQ .done
CMP.w #51 : BEQ .done CMP.w #51 : BEQ .done
CMP.w #7 : BEQ .done CMP.w #7 : BEQ .done

459
hooks.asm

File diff suppressed because it is too large Load Diff

View File

@@ -5,45 +5,45 @@
; called and it only gets called once ever during RESET. ; called and it only gets called once ever during RESET.
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
Init_Primary: Init_Primary:
LDA #$00 LDA.b #$00
LDX #$00 ; initalize our ram LDX.b #$00 ; initalize our ram
- -
STA $7EC025, X STA.l $7EC025, X
STA $7F5000, X STA.l $7F5000, X
INX 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 INX
CPX #$FF : !BLT - CPX.b #$FF : !BLT -
LDX #$00 LDX #$00
- -
LDA RomNameSRAM, X : CMP $00FFC0, X : BNE .clear LDA.l RomNameSRAM, X : CMP.w $FFC0, X : BNE .clear
INX INX
CPX #$15 : !BLT - CPX.b #$15 : !BLT -
BRA .done BRA .done
.clear .clear
REP #$30 ; set 16-bit accumulator & index registers REP #$30 ; set 16-bit accumulator & index registers
LDA.w #$0000 LDA.w #$0000
- -
STA $700000, X STA.l $700000, X
INX INX
CPX #$2000 : !BLT - CPX.w #$2000 : !BLT -
SEP #$30 ; set 8-bit accumulator & index registers 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 INX
CPX #$15 : !BLT - CPX #$15 : !BLT -
LDX #$00 LDX.b #$00
- -
LDA RomVersion, X : STA RomVersionSRAM, X LDA.w RomVersion, X : STA.l RomVersionSRAM, X
INX INX
CPX #$04 : !BLT - CPX.b #$04 : !BLT -
.done .done
REP #$20 REP #$20
@@ -53,7 +53,7 @@ Init_Primary:
LDA.b #$01 : STA.w MEMSEL ; enable fastrom access on upper banks LDA.b #$01 : STA.w MEMSEL ; enable fastrom access on upper banks
STA.l OneMindId 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 LDA.b #$81 : STA.w NMITIMEN ; thing we wrote over, turn on NMI & gamepad
RTL RTL

View File

@@ -65,7 +65,7 @@ RTL
INX : BRA -- : ++ INX : BRA -- : ++
PLX PLX
LDA.l SilverArrowsUseRestriction : BEQ ++ 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 LDA.l BowEquipment : CMP.b #$03 : !BLT .errorJump : !SUB #$02 : STA.l BowEquipment
BRA .errorJump2 BRA .errorJump2
++ ++
@@ -993,7 +993,7 @@ RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
SpawnChestGamePrizeSFX: SpawnChestGamePrizeSFX:
CPX.b #$07 : BNE .normal CPX.b #$07 : BNE .normal
LDA.b $A0 : CMP.b #$06 : BNE .normal LDA.b RoomIndex : CMP.b #$06 : BNE .normal
.prize .prize
LDA.b #$1B : STA.w $012F : RTL ; play puzzle sound LDA.b #$1B : STA.w $012F : RTL ; play puzzle sound
.normal .normal

View File

@@ -1,9 +1,9 @@
;Statically mapped at $A1A000 Referenced by the front end. Do not move without coordination. ;Statically mapped at $A1A000 Referenced by the front end. Do not move without coordination.
InvertedTileAttributeLookup: InvertedTileAttributeLookup:
SEP #$20 SEP #$20
LDA $8A : CMP.b #$47 : BEQ .turtleRock LDA.b $8A : CMP.b #$47 : BEQ .turtleRock
LDA Overworld_TileAttr, X LDA.l Overworld_TileAttr, X
JML.l Overworld_GetTileAttrAtLocation_continue JML.l Overworld_GetTileAttrAtLocation_continue
.turtleRock .turtleRock
LDA Inverted_TR_TileAttributes, X LDA.l Inverted_TR_TileAttributes, X
JML.l Overworld_GetTileAttrAtLocation_continue JML.l Overworld_GetTileAttrAtLocation_continue

View File

@@ -17,7 +17,7 @@ LampCheck:
LDA.l LampConeLightWorld : BRA .done LDA.l LampConeLightWorld : BRA .done
+ +
.darkWorld .darkWorld
LDA LampConeDarkWorld LDA.l LampConeDarkWorld
.done .done
RTL RTL
;================================================================================ ;================================================================================

View File

@@ -6,20 +6,13 @@
; MaidenCrystalScript ; MaidenCrystalScript
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
MaidenCrystalScript: MaidenCrystalScript:
LDA.b #$00 : STA $7F5091 LDA.b #$00 : STA.l BusyItem
STZ $02D8 STZ.w $02D8
STZ $02DA STZ.w $02DA
STZ $2E STZ.b $2E
LDA #$02 : STA $2F LDA.b #$02 : STA.w $2F
LDA.l CrystalsField : AND.b #$7F : CMP.b #$7F : BNE + ; check if we have all crystals
; Load the dungeon index. Is it the Dark Palace? LDA.b #$08 : STA.l MapIcons ; Update the map icon to just be Ganon's Tower
;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
+ +
JML.l $1ECF35 ; <- F4F35 - sprite_crystal_maiden.asm : 426 JML.l $1ECF35 ; <- F4F35 - sprite_crystal_maiden.asm : 426
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------

View File

@@ -2,11 +2,11 @@
; Mantle Object Changes ; Mantle Object Changes
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
Mantle_CorrectPosition: Mantle_CorrectPosition:
LDA ProgressFlags : AND.b #$04 : BEQ + LDA.l 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 #$0A : STA.w $0D10, X ; just spawn it off to the side where we know it should be
LDA.b #$03 : STA $0D30, X LDA.b #$03 : STA.w $0D30, X
LDA.b #$90 : STA $0ED0, 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 RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------

View File

@@ -3,45 +3,45 @@
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
TryOpenMire: TryOpenMire:
; Checks if we're in the Swamp of Evil. ; 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. ; 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. ; You have to be in the trigger window.
LDY.b #$02 : JSL.l Ancilla_CheckIfEntranceTriggered : BCC .untriggered LDY.b #$02 : JSL.l Ancilla_CheckIfEntranceTriggered : BCC .untriggered
; Do the 3rd animation for opening entrances ; 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.b $B0 ; reset the sub-submodule index
STZ $C8 ; reset this other index. STZ.b $C8 ; reset this other index.
.untriggered .untriggered
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
TryOpenTRock: TryOpenTRock:
; Checks if we're at Turtle Rock. ; 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. ; 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. ; You have to be in the trigger window.
LDY.b #$03 : JSL.l Ancilla_CheckIfEntranceTriggered : BCC .untriggered LDY.b #$03 : JSL.l Ancilla_CheckIfEntranceTriggered : BCC .untriggered
; Do the 4rd animation for opening entrances ; 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.b $B0 ; reset the sub-submodule index
STZ $C8 ; reset this other index. STZ.b $C8 ; reset this other index.
.untriggered .untriggered
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
MedallionTrigger_Bombos: MedallionTrigger_Bombos:
STZ $50 ; stuff we wrote over STZ.b $50 ; stuff we wrote over
STZ $0FC1 STZ.w $0FC1
PHA PHA
LDA.l MireRequiredMedallion : BNE + LDA.l MireRequiredMedallion : BNE +

98
msu.asm
View File

@@ -164,27 +164,27 @@ CheckMusicLoadRequest:
.continue .continue
LDA.l TournamentSeed : BNE +++ LDA.l TournamentSeed : BNE +++
LDA.l MSUPackRequest LDA.w MSUPackRequest
CMP.l MSUPackCurrent : BEQ +++ CMP.w MSUPackCurrent : BEQ +++
CMP.l MSUPackCount : !BLT ++ CMP.w MSUPackCount : !BLT ++
CMP.b #$FE : !BLT + CMP.b #$FE : !BLT +
STA.l MSUPackCurrent STA.w MSUPackCurrent
SEP #$10 SEP #$10
LDA.b #$00 LDA.b #$00
LDX.b #$07 LDX.b #$07
- -
STA.l MSUFallbackTable,X STA.w MSUFallbackTable,X
DEX : BPL - DEX : BPL -
REP #$10 REP #$10
BRA +++ BRA +++
+ : LDA.l MSUPackCurrent : STA.l MSUPackRequest + : LDA.w MSUPackCurrent : STA.w MSUPackRequest
++ : STA.l MSUPackCurrent ++ : STA.w MSUPackCurrent
JSL MSUInit_check_fallback JSL MSUInit_check_fallback
+++ +++
LDA.w MusicControlRequest : CMP.b #$08 : BEQ ++ ; Mirror SFX is not affected by NoBGM or pack $FE LDA.w MusicControlRequest : CMP.b #$08 : BEQ ++ ; Mirror SFX is not affected by NoBGM or pack $FE
LDA.l NoBGM : BNE + LDA.l NoBGM : BNE +
LDA.l MSUPackCurrent : CMP.b #$FE : BNE ++ LDA.w MSUPackCurrent : CMP.b #$FE : BNE ++
+ : JMP .mute + : JMP .mute
++ ++
@@ -240,7 +240,7 @@ CheckMusicLoadRequest:
LDA.l MusicShuffleTable-1,X : DEC : PHA LDA.l MusicShuffleTable-1,X : DEC : PHA
AND.b #$07 : TAY AND.b #$07 : TAY
PLA : LSR #3 : TAX 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 + - : CPY #$00 : BEQ +
LSR : DEY : BRA - LSR : DEY : BRA -
@@ -333,7 +333,7 @@ CheckMusicLoadRequest:
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
SpiralStairsPreCheck: SpiralStairsPreCheck:
REP #$20 ; thing we wrote over REP #$20 ; thing we wrote over
LDA.b $A0 LDA.b RoomIndex
CMP.w #$000C : BNE + CMP.w #$000C : BNE +
LDA.w CurrentMSUTrack : AND.w #$00FF : CMP.w #59 : BNE .done LDA.w CurrentMSUTrack : AND.w #$00FF : CMP.w #59 : BNE .done
BRA .fade BRA .fade
@@ -348,13 +348,13 @@ SpiralStairsPreCheck:
+ +
LDA.l BigKeyField : AND.w #$0004 : BEQ .done ; Check that we have the GT big key 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.w MSUFallbackTable+7 : AND.w #$0004 : BEQ .done ; Check that we have the extended track
.fade .fade
LDX.b #$F1 : STX.w MusicControlRequest LDX.b #$F1 : STX.w MusicControlRequest
.done .done
LDA.b $A0 ; thing we wrote over LDA.b RoomIndex ; thing we wrote over
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
@@ -362,7 +362,7 @@ SpiralStairsPreCheck:
; Change music on stair transition (ToH/GT) ; Change music on stair transition (ToH/GT)
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
SpiralStairsPostCheck: SpiralStairsPostCheck:
LDA.b $A0 LDA.b RoomIndex
CMP.w #$000C : BNE + CMP.w #$000C : BNE +
; Ganon's tower entrance ; Ganon's tower entrance
LDX.w $0130 : CPX.b #$F1 : BNE .done ; Check that we were fading out 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 LDX.b #59 : STX.w MusicControlRequest
.done .done
LDX.b #$1C : LDA.b $A0 ; thing we wrote over LDX.b #$1C : LDA.b RoomIndex ; thing we wrote over
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
@@ -401,10 +401,10 @@ MSUInit:
PHP PHP
LDA.b #$00 LDA.b #$00
STA.l MSULoadedTrack STA.w MSULoadedTrack
STA.l MSUResumeTrack STA.w MSUResumeTrack
STA.l MSUResumeTime : STA.l MSUResumeTime+1 : STA.l MSUResumeTime+2 : STA.l MSUResumeTime+3 STA.w MSUResumeTime : STA.w MSUResumeTime+1 : STA.w MSUResumeTime+2 : STA.w MSUResumeTime+3
STA.l MSUResumeControl STA.w MSUResumeControl
LDA.l NoBGM : BNE .done LDA.l NoBGM : BNE .done
@@ -431,7 +431,7 @@ MSUInit:
.wait_pack .wait_pack
LDA.w MSUSTATUS : BIT.b #!FLAG_MSU_STATUS_AUDIO_BUSY : BNE .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 LDA.w MSUSTATUS : BIT.b #!FLAG_MSU_STATUS_TRACK_MISSING : BEQ .check_pack
TXA : STA.l MSUPackCount TXA : STA.w MSUPackCount
BRA + BRA +
; Check the current MSU-1 pack for tracks that require SPC fallback ; 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 + LDA.w MSUSTATUS : BIT.b #!FLAG_MSU_STATUS_TRACK_MISSING : BNE +
SEC SEC
+ +
LDA.l MSUFallbackTable,X : ROL : STA.l MSUFallbackTable,X LDA.w MSUFallbackTable,X : ROL : STA.w MSUFallbackTable,X
DEY : BPL .next_track DEY : BPL .next_track
DEX : BPL + DEX : BPL +
@@ -474,11 +474,11 @@ MSUInit:
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
MSUStopPlaying: MSUStopPlaying:
PHA : XBA : PHA PHA : XBA : PHA
LDA.l MSULoadedTrack LDA.w MSULoadedTrack
JSR IsResumableTrack : BCC + JSR IsResumableTrack : BCC +
; dont save if we already saved recently ; dont save if we already saved recently
REP #$20 REP #$20
LDA.l MSUResumeTrack : AND #$00FF : BEQ ++ LDA.w MSUResumeTrack : AND #$00FF : BEQ ++
LDA.l NMIFrames : !SUB MSUResumeTime : PHA LDA.l NMIFrames : !SUB MSUResumeTime : PHA
LDA.l NMIFrames+2 : SBC MSUResumeTime+2 : BNE +++ LDA.l NMIFrames+2 : SBC MSUResumeTime+2 : BNE +++
PLA : CMP.l MSUResumeTimer : !BLT .too_early PLA : CMP.l MSUResumeTimer : !BLT .too_early
@@ -487,12 +487,12 @@ PHA : XBA : PHA
PLA PLA
++ ++
; saving ; saving
LDA.l NMIFrames : STA.l MSUResumeTime LDA.l NMIFrames : STA.w MSUResumeTime
LDA.l NMIFrames+2 : STA.l MSUResumeTime+2 LDA.l NMIFrames+2 : STA.w MSUResumeTime+2
SEP #$20 SEP #$20
LDA.l MSULoadedTrack : STA.l MSUResumeTrack LDA.w MSULoadedTrack : STA.w MSUResumeTrack
LDA.b #$00 : STA.l MSULoadedTrack ; dont take this path if we're calling again 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 LDA.b #!FLAG_MSU_RESUME : STA.w MSUCTL ; save this track's position
PLA : XBA : PLA PLA : XBA : PLA
RTS RTS
@@ -523,23 +523,23 @@ MSUMain:
LDX.w MusicControl : BEQ + LDX.w MusicControl : BEQ +
JMP .command_ff JMP .command_ff
+ +
LDA.l MSUDelayedCommand : BEQ .do_fade LDA.w MSUDelayedCommand : BEQ .do_fade
.check_busy .check_busy
LDA.w MSUSTATUS : BIT.b #!FLAG_MSU_STATUS_AUDIO_BUSY : BNE - LDA.w MSUSTATUS : BIT.b #!FLAG_MSU_STATUS_AUDIO_BUSY : BNE -
.ready .ready
LDA.w MSUSTATUS : BIT.b #!FLAG_MSU_STATUS_TRACK_MISSING : BNE - LDA.w MSUSTATUS : BIT.b #!FLAG_MSU_STATUS_TRACK_MISSING : BNE -
.start .start
LDA.l MSUResumeControl : BIT.b #!FLAG_RESUME_CANCEL : BEQ + LDA.w MSUResumeControl : BIT.b #!FLAG_RESUME_CANCEL : BEQ +
EOR.b #!FLAG_RESUME_CANCEL : STA.l MSUResumeControl EOR.b #!FLAG_RESUME_CANCEL : STA.w MSUResumeControl
REP #$20 : LDA.l MSULoadedTrack : STA.w MSUTRACK : SEP #$20 REP #$20 : LDA.w MSULoadedTrack : STA.w MSUTRACK : SEP #$20
BRA - BRA -
+ +
LDA.b #!VAL_VOLUME_FULL LDA.b #!VAL_VOLUME_FULL
STA.w TargetVolume STA.w TargetVolume
LDA.l MSUResumeControl : BIT.b #!FLAG_RESUME_FADEIN : BEQ + LDA.w MSUResumeControl : BIT.b #!FLAG_RESUME_FADEIN : BEQ +
EOR.b #!FLAG_RESUME_FADEIN : STA.l MSUResumeControl EOR.b #!FLAG_RESUME_FADEIN : STA.w MSUResumeControl
LDA.b #$00 LDA.b #$00
BRA ++ BRA ++
+ +
@@ -551,17 +551,17 @@ MSUMain:
LDA.w CurrentMSUTrack : DEC : PHA LDA.w CurrentMSUTrack : DEC : PHA
AND.b #$07 : TAY AND.b #$07 : TAY
PLA : LSR #3 : TAX 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 + - : CPY #$00 : BEQ +
LSR : DEY : BRA - LSR : DEY : BRA -
+ +
AND.b #$01 : BEQ +++ AND.b #$01 : BEQ +++
++ : LDA.l MSUDelayedCommand ++ : LDA.w MSUDelayedCommand
+++ : STA.w MSUCTL +++ : STA.w MSUCTL
LDA.b #$00 LDA.b #$00
STA.l MSUDelayedCommand STA.w MSUDelayedCommand
JML SPCContinue JML SPCContinue
.do_fade: .do_fade:
@@ -624,9 +624,9 @@ MSUMain:
+ +
CPX.w CurrentControlRequest : BEQ - CPX.w CurrentControlRequest : BEQ -
LDA.b #$00 : XBA LDA.b #$00 : XBA
LDA.l MSUPackCurrent : BEQ + LDA.w MSUPackCurrent : BEQ +
- : CMP.l MSUPackCount : !BLT + - : CMP.w MSUPackCount : !BLT +
!SUB.l MSUPackCount : BRA - !SUB.w MSUPackCount : BRA -
+ +
JSR MSUStopPlaying JSR MSUStopPlaying
@@ -639,11 +639,11 @@ MSUMain:
DEX : BNE - DEX : BNE -
+ +
STA.w MSUTRACK STA.w MSUTRACK
STA.l MSULoadedTrack STA.w MSULoadedTrack
SEP #$20 SEP #$20
PLX PLX
TXA : CMP.l MSUResumeTrack : BNE + ; dont resume if too late TXA : CMP.w MSUResumeTrack : BNE + ; dont resume if too late
REP #$20 REP #$20
LDA.l NMIFrames : !SUB MSUResumeTime : PHA LDA.l NMIFrames : !SUB MSUResumeTime : PHA
LDA.l NMIFrames+2 : SBC MSUResumeTime+2 : BNE ++ LDA.l NMIFrames+2 : SBC MSUResumeTime+2 : BNE ++
@@ -656,8 +656,8 @@ MSUMain:
SEP #$20 SEP #$20
LDA.b #!FLAG_RESUME_CANCEL LDA.b #!FLAG_RESUME_CANCEL
.done_resume: .done_resume:
STA.l MSUResumeControl STA.w MSUResumeControl
LDA.b #$00 : STA.l MSUResumeTrack LDA.b #$00 : STA.w MSUResumeTrack
+ +
CPX #07 : BNE + ; Kakariko Village CPX #07 : BNE + ; Kakariko Village
LDA.b $10 : CMP #$07 : BNE + LDA.b $10 : CMP #$07 : BNE +
@@ -667,12 +667,12 @@ MSUMain:
+ +
TXA TXA
++ ++
STA.l MSULoadedTrack STA.w MSULoadedTrack
STX.w CurrentMSUTrack STX.w CurrentMSUTrack
LDA.l MSUPackCurrent : CMP #$FE : !BLT + LDA.w MSUPackCurrent : CMP #$FE : !BLT +
LDA.b #$00 : BRA ++ LDA.b #$00 : BRA ++
+ : LDA.l MSUTrackList-1,X + : LDA.l MSUTrackList-1,X
++ : STA.l MSUDelayedCommand ++ : STA.w MSUDelayedCommand
LDA.l MSUExtendedFallbackList-1,X LDA.l MSUExtendedFallbackList-1,X
CMP.b #17 : BEQ + CMP.b #17 : BEQ +
CMP.b #22 : 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+2 : CMP.w #!VAL_MSU_ID_23 : BNE .spc
LDA.w MSUID+4 : CMP.w #!VAL_MSU_ID_45 : BNE .spc LDA.w MSUID+4 : CMP.w #!VAL_MSU_ID_45 : BNE .spc
SEP #$20 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.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 LDA.w MSUSTATUS : BIT.b #!FLAG_MSU_STATUS_AUDIO_PLAYING : BEQ .done
.continue .continue
jml PendantFanfareContinue jml PendantFanfareContinue
@@ -746,9 +746,9 @@ CrystalFanfareWait:
LDA.w MSUID+2 : CMP.w #!VAL_MSU_ID_23 : BNE .spc LDA.w MSUID+2 : CMP.w #!VAL_MSU_ID_23 : BNE .spc
LDA.w MSUID+4 : CMP.w #!VAL_MSU_ID_45 : BNE .spc LDA.w MSUID+4 : CMP.w #!VAL_MSU_ID_45 : BNE .spc
SEP #$20 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.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 LDA.w MSUSTATUS : BIT.b #!FLAG_MSU_STATUS_AUDIO_PLAYING : BEQ .done
.continue .continue
jml CrystalFanfareContinue jml CrystalFanfareContinue

124
music.asm
View File

@@ -9,7 +9,7 @@ PreOverworld_LoadProperties_ChooseMusic:
LDX.b #$02 ; Default light world theme 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 #$43 : BEQ .endOfLightWorldChecks
CMP.b #$45 : BEQ .endOfLightWorldChecks CMP.b #$45 : BEQ .endOfLightWorldChecks
CMP.b #$47 : BEQ .endOfLightWorldChecks CMP.b #$47 : BEQ .endOfLightWorldChecks
@@ -17,47 +17,42 @@ PreOverworld_LoadProperties_ChooseMusic:
LDY.b #$5A ; Main overworld animated tileset LDY.b #$5A ; Main overworld animated tileset
; Skip village and lost woods checks if entering dark world or a special area ; 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 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 ; 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 ; For NA release would we also branch on indexes #$22 #$28 #$29
LDX.b #$05 ; Lost woods theme LDX.b #$05 ; Lost woods theme
; check if we've pulled from the master sword pedestal ; 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 LDX.b #$02 ; Default light world theme
+ +
; check if we are entering lost woods ; check if we are entering lost woods
LDA $8A : BEQ .endOfLightWorldChecks LDA.b $8A : BEQ .endOfLightWorldChecks
.notVillageOrWoods .notVillageOrWoods
; Use the normal overworld (light world) music ; Use the normal overworld (light world) music
LDX.b #$02 LDX.b #$02
; Check phase ; In phase >= 2 ; 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 ; If phase < 2, play the legend music
LDX.b #$03 LDX.b #$03
+ +
.endOfLightWorldChecks .endOfLightWorldChecks
; if we are in the light world go ahead and set chosen selection ; 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 LDX.b #$0F ; dark woods theme
; This music is used in dark woods ; This music is used in dark woods
LDA $8A LDA.b $8A
CMP.b #$40 : BEQ + CMP.b #$40 : BEQ +
LDX.b #$0D ; dark death mountain theme 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 ; if not inverted and light world, or inverted and dark world, skip moon pearl check
.checkInverted .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? ; Does Link have a moon pearl?
LDA MoonPearlEquipment : BNE + LDA.l MoonPearlEquipment : BNE +
LDX.b #$04 ; bunny theme LDX.b #$04 ; bunny theme
+ +
.lastCheck .lastCheck
LDA $0132 : CMP.b #$F2 : BNE + LDA.w $0132 : CMP.b #$F2 : BNE +
CPX $0130 : BNE + CPX.w $0130 : BNE +
; If the last played command ($0132) was half volume (#$F2) ; 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) ; 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 ; then play the full volume command (#F3) instead of restarting the song
@@ -99,37 +94,37 @@ Overworld_FinishMirrorWarp:
.clear_hdma_table .clear_hdma_table
STA $1B00, X : STA $1B40, X STA.w $1B00, X : STA.w $1B40, X
STA $1B80, X : STA $1BC0, X STA.w $1B80, X : STA.w $1BC0, X
STA $1C00, X : STA $1C40, X STA.w $1C00, X : STA.w $1C40, X
STA $1C80, X STA.w $1C80, X
DEX #2 : BPL .clear_hdma_table DEX #2 : BPL .clear_hdma_table
LDA.w #$0000 : STA $7EC007 : STA $7EC009 LDA.w #$0000 : STA.l $7EC007 : STA.l $7EC009
SEP #$20 SEP #$20
JSL $00D7C8 ; $57C8 IN ROM JSL $00D7C8 ; $57C8 IN ROM
LDA.b #$80 : STA $9B LDA.b #$80 : STA.b $9B
LDX.b #$04 ; bunny theme LDX.b #$04 ; bunny theme
; if not inverted and light world, or inverted and dark world, skip moon pearl check ; if not inverted and light world, or inverted and dark world, skip moon pearl check
LDA CurrentWorld : CLC : ROL #$03 : CMP InvertedMode : BEQ + LDA.l CurrentWorld : CLC : ROL #$03 : CMP.l InvertedMode : BEQ +
LDA MoonPearlEquipment : BEQ .endOfLightWorldChecks LDA.l MoonPearlEquipment : BEQ .endOfLightWorldChecks
+ +
LDX.b #$09 ; default dark world theme 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 LDX.b #$02 ; hyrule field theme
; Check if we're entering the lost woods ; Check if we're entering the lost woods
CMP.b #$00 : BNE + 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 LDX.b #$05 ; lost woods theme
BRA .endOfLightWorldChecks BRA .endOfLightWorldChecks
+ +
@@ -138,14 +133,13 @@ Overworld_FinishMirrorWarp:
CMP.b #$18 : BNE .endOfLightWorldChecks CMP.b #$18 : BNE .endOfLightWorldChecks
; Check what phase we're in ; Check what phase we're in
; LDA ProgressIndicator : CMP.b #$03 : !BGE .endOfLightWorldChecks
LDX.b #$07 ; Default village theme (phase <3) LDX.b #$07 ; Default village theme (phase <3)
.endOfLightWorldChecks .endOfLightWorldChecks
STX $012C STX.w $012C
LDA $8A : CMP.b #$40 : BNE + LDA.b $8A : CMP.b #$40 : BNE +
LDX #$0F ; dark woods theme LDX.b #$0F ; dark woods theme
BRA .bunny BRA .bunny
+ +
@@ -154,24 +148,24 @@ Overworld_FinishMirrorWarp:
CMP.b #$47 : BNE .notDarkMountain CMP.b #$47 : BNE .notDarkMountain
.darkMountain .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 LDX.b #$0D ; dark mountain theme
.bunny .bunny
LDA MoonPearlEquipment : ORA InvertedMode : BNE + LDA.l MoonPearlEquipment : ORA.l InvertedMode : BNE +
LDX #$04 ; bunny theme LDX.b #$04 ; bunny theme
+ +
STX $012C STX.w $012C
.notDarkMountain .notDarkMountain
LDA $11 : STA $010C LDA.b $11 : STA.w $010C
STZ $11 STZ.b $11
STZ $B0 STZ.b $B0
STZ $0200 STZ.w $0200
STZ $0710 STZ.w $0710
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
@@ -179,73 +173,59 @@ Overworld_FinishMirrorWarp:
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
BirdTravel_LoadTargetAreaMusic: BirdTravel_LoadTargetAreaMusic:
; Skip village and lost woods checks if entering dark world or a special area ; 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 CMP.b #$40 : !BGE .notVillageOrWoods
LDX.b #$07 ; Default village theme 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 ; 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 ; 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 ; check if we are entering lost woods
LDA $8A : BEQ .endOfLightWorldChecks LDA.b $8A : BEQ .endOfLightWorldChecks
.notVillageOrWoods .notVillageOrWoods
; Use the normal overworld (light world) music ; Use the normal overworld (light world) music
LDX.b #$02 LDX.b #$02
; Check phase ; In phase >= 2 ; 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 ; If phase < 2, play the legend music
LDX.b #$03 LDX.b #$03
+ +
.endOfLightWorldChecks .endOfLightWorldChecks
; if we are in the light world go ahead and set chosen selection ; 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 LDX.b #$09 ; dark overworld theme
LDA $8A LDA.b $8A
; Misery Mire rain SFX ; Misery Mire rain SFX
CMP.b #$70 : BNE ++ CMP.b #$70 : BNE ++
LDA OverworldEventDataWRAM+$70 : AND.b #$20 : BNE ++ LDA.l OverworldEventDataWRAM+$70 : AND.b #$20 : BNE ++
LDA.b #$01 : CMP $0131 : BEQ + LDA.b #$01 : CMP.w $0131 : BEQ +
STA $012D STA.w $012D
+ : BRA .checkInverted + : BRA .checkInverted
++ ++
; This music is used in dark death mountain ; This music is used in dark death mountain
CMP.b #$43 : BEQ .darkMountain CMP.b #$43 : BEQ .darkMountain
; CMP.b #$45 : BEQ .darkMountain LDA.b #$05 : STA.w $012D
; CMP.b #$47 : BEQ .darkMountain
LDA.b #$05 : STA $012D
BRA .checkInverted BRA .checkInverted
.darkMountain .darkMountain
LDA CrystalsField : CMP.b #$7F : BEQ + LDA.l CrystalsField : CMP.b #$7F : BEQ +
LDX.b #$0D ; dark death mountain theme 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 ; if not inverted and light world, or inverted and dark world, skip moon pearl check
.checkInverted .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? ; Does Link have a moon pearl?
LDA MoonPearlEquipment : BNE + LDA.l MoonPearlEquipment : BNE +
LDX.b #$04 ; bunny theme LDX.b #$04 ; bunny theme
+ +
@@ -257,8 +237,8 @@ BirdTravel_LoadTargetAreaMusic:
;0 = Is Kakariko Overworld ;0 = Is Kakariko Overworld
;1 = Not Kakariko Overworld ;1 = Not Kakariko Overworld
PsychoSolder_MusicCheck: PsychoSolder_MusicCheck:
LDA $040A : CMP.b #$18 : BNE .done ; thing we overwrote - check if overworld location is Kakariko LDA.w $040A : CMP.b #$18 : BNE .done ; thing we overwrote - check if overworld location is Kakariko
LDA $1B ; Also check that we are outdoors LDA.b $1B ; Also check that we are outdoors
.done .done
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
@@ -275,10 +255,10 @@ Overworld_MosaicDarkWorldChecks:
CMP.b #$51 : bne .doFade CMP.b #$51 : bne .doFade
.checkCrystals .checkCrystals
LDA CrystalsField : CMP.b #$7F : BEQ .done LDA.l CrystalsField : CMP.b #$7F : BEQ .done
.doFade .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 .done
RTL RTL

View File

@@ -23,148 +23,127 @@
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
ItemCheck_FairySword: ItemCheck_FairySword:
LDA NpcFlags+1 : AND.b #$08 LDA.l NpcFlags+1 : AND.b #$08
RTL RTL
ItemCheck_SmithSword: ItemCheck_SmithSword:
LDA NpcFlags+1 : AND.b #$04 LDA.l NpcFlags+1 : AND.b #$04
RTL RTL
ItemCheck_MagicBat: ItemCheck_MagicBat:
LDA NpcFlags+1 : AND.b #$80 LDA.l NpcFlags+1 : AND.b #$80
RTL RTL
ItemCheck_OldMan: ItemCheck_OldMan:
LDA NpcFlags : AND.b #$01 : CMP #$01 LDA.l NpcFlags : AND.b #$01 : CMP #$01
RTL RTL
ItemCheck_ZoraKing: ItemCheck_ZoraKing:
LDA NpcFlags : AND.b #$02 LDA.l NpcFlags : AND.b #$02
RTL RTL
ItemCheck_SickKid: ItemCheck_SickKid:
LDA NpcFlags : AND.b #$04 LDA.l NpcFlags : AND.b #$04
RTL RTL
ItemCheck_TreeKid: ItemCheck_TreeKid:
LDA NpcFlags : AND.b #$08 ; FluteBoy_Chillin - 73: LDA FluteEquipment LDA.l NpcFlags : AND.b #$08 ; FluteBoy_Chillin - 73: LDA FluteEquipment
RTL RTL
ItemCheck_TreeKid2: 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 RTL
ItemCheck_TreeKid3: ItemCheck_TreeKid3:
JSL $0DD030 ; FluteAardvark_Draw - thing we wrote over JSL $0DD030 ; FluteAardvark_Draw - thing we wrote over
LDA NpcFlags : AND.b #$08 LDA.l NpcFlags : AND.b #$08
BEQ .normal BEQ .normal
BRA .done BRA .done
LDA.b #$05 LDA.b #$05
.normal .normal
LDA $0D80, X LDA.w $0D80, X
.done .done
RTL RTL
ItemCheck_Sahasrala: ItemCheck_Sahasrala:
LDA NpcFlags : AND.b #$10 LDA.l NpcFlags : AND.b #$10
RTL RTL
ItemCheck_Library: ItemCheck_Library:
LDA NpcFlags : AND.b #$80 LDA.l NpcFlags : AND.b #$80
RTL RTL
ItemCheck_Mushroom: ItemCheck_Mushroom:
LDA NpcFlags+1 : ROL #4 ; does the same thing as below LDA.l NpcFlags+1 : ROL #4 ; does the same thing as below
; LDA NpcFlags+1 : AND.b #$10 : BEQ .clear
; SEC
;RTL
; .clear
; CLC
RTL RTL
ItemCheck_Powder: ItemCheck_Powder:
LDA NpcFlags+1 : AND.b #$20 LDA.l NpcFlags+1 : AND.b #$20
RTL RTL
ItemCheck_Catfish: ItemCheck_Catfish:
;LDA CatfishGoodItem : BEQ .junk LDA.l NpcFlags : AND.b #$20
;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
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
ItemSet_FairySword: 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 RTL
ItemSet_SmithSword: 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 RTL
ItemSet_MagicBat: 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 RTL
ItemSet_OldMan: ItemSet_OldMan:
JSL.l Link_ReceiveItem ; thing we wrote over 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 RTL
ItemSet_ZoraKing: ItemSet_ZoraKing:
;JSL $1DE1AA ; Sprite_SpawnFlippersItem ; thing we wrote over PHA : LDA.l NpcFlags : ORA.b #$02 : STA.l NpcFlags : PLA
PHA : LDA NpcFlags : ORA.b #$02 : STA NpcFlags : PLA
RTL RTL
ItemSet_SickKid: ItemSet_SickKid:
JSL.l Link_ReceiveItem ; thing we wrote over 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 RTL
ItemSet_TreeKid: ItemSet_TreeKid:
JSL.l Link_ReceiveItem ; thing we wrote over 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 RTL
ItemSet_Sahasrala: ItemSet_Sahasrala:
JSL.l Link_ReceiveItem ; thing we wrote over 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 RTL
ItemSet_Catfish: ItemSet_Catfish:
;JSL $00D52D ; GetAnimatedSpriteTile.variable ; thing we wrote over PHA : LDA.l NpcFlags : ORA.b #$20 : STA.l NpcFlags : PLA
;JSL.l LoadCatfishItemGFX
PHA : LDA NpcFlags : ORA.b #$20 : STA NpcFlags : PLA
RTL RTL
ItemSet_Library: ItemSet_Library:
JSL.l Link_ReceiveItem ; thing we wrote over 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 RTL
ItemSet_Mushroom: ItemSet_Mushroom:
PHA PHA
LDA NpcFlags+1 : ORA.b #$10 : STA NpcFlags+1 LDA.l NpcFlags+1 : ORA.b #$10 : STA.l NpcFlags+1
LDY $0E80, X ; Retrieve stored item type LDY.w $0E80, X ; Retrieve stored item type
BNE + BNE +
; if for any reason the item value is 0 reload it, just in case ; if for any reason the item value is 0 reload it, just in case
%GetPossiblyEncryptedItem(MushroomItem, SpriteItemValues) : TAY %GetPossiblyEncryptedItem(MushroomItem, SpriteItemValues) : TAY
+ +
PLA PLA
;LDY.b #$29 STZ.w $02E9 ; thing we wrote over - the mushroom is an npc for item purposes apparently
STZ $02E9 ; thing we wrote over - the mushroom is an npc for item purposes apparently
RTL RTL
ItemSet_Powder: 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 RTL
;================================================================================ ;================================================================================
@@ -172,11 +151,11 @@ RTL
; Randomize 300 Rupee NPC ; Randomize 300 Rupee NPC
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
Set300RupeeNPCItem: Set300RupeeNPCItem:
INC $0D80, X ; thing we wrote over INC.w $0D80, X ; thing we wrote over
PHA : PHP PHA : PHP
REP #$20 ; set 16-bit accumulator 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 + CMP.w #291 : BNE +
%GetPossiblyEncryptedItem(RupeeNPC_MoldormCave, SpriteItemValues) %GetPossiblyEncryptedItem(RupeeNPC_MoldormCave, SpriteItemValues)
TAY ; load moldorm cave value into Y TAY ; load moldorm cave value into Y

View File

@@ -1,20 +1,17 @@
;================================================================================ ;================================================================================
; Pendant / Crystal HUD Fix ; Pendant / Crystal HUD Fix
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
;CheckPendantHUD:
; LDA HudFlag : CMP.b #$40 ; check for hud flag instead
;RTL
;================================================================================ ;================================================================================
FlipLWDWFlag: FlipLWDWFlag:
PHP PHP
SEP #$20 ; set 8-bit accumulator SEP #$20 ; set 8-bit accumulator
LDA CurrentWorld : EOR.b #$40 : STA CurrentWorld LDA.l CurrentWorld : EOR.b #$40 : STA.l CurrentWorld
BEQ + BEQ +
LDA.b #07 : BRA ++ ; dark world - crystals LDA.b #07 : BRA ++ ; dark world - crystals
+ +
LDA.b #03 ; light world - pendants LDA.b #03 ; light world - pendants
++ ++
STA MapIcons STA.l MapIcons
PLP PLP
RTL RTL
;================================================================================ ;================================================================================
@@ -23,7 +20,7 @@ HUDRebuildIndoorHole:
LDA.l GenericKeys : BEQ .normal LDA.l GenericKeys : BEQ .normal
.generic .generic
PLA PLA
LDA CurrentGenericKeys ; generic key count LDA.l CurrentGenericKeys ; generic key count
JSL.l HUD_RebuildIndoor_Palace JSL.l HUD_RebuildIndoor_Palace
RTL RTL
.normal .normal
@@ -34,18 +31,18 @@ RTL
HUDRebuildIndoor: HUDRebuildIndoor:
LDA.l GenericKeys : BEQ .normal LDA.l GenericKeys : BEQ .normal
.generic .generic
LDA.b #$00 : STA $7EC017 LDA.b #$00 : STA.l $7EC017
LDA CurrentGenericKeys ; generic key count LDA.l CurrentGenericKeys ; generic key count
RTL RTL
.normal .normal
LDA.b #$00 : STA $7EC017 LDA.b #$00 : STA.l $7EC017
LDA.b #$FF ; don't show keys LDA.b #$FF ; don't show keys
RTL RTL
;================================================================================ ;================================================================================
GetCrystalNumber: GetCrystalNumber:
PHX PHX
TXA : ASL : TAX TXA : ASL : TAX
LDA CurrentWorld : EOR.b #$40 : BNE + LDA.l CurrentWorld : EOR.b #$40 : BNE +
INX INX
+ +
LDA.l CrystalNumberTable-16, X LDA.l CrystalNumberTable-16, X
@@ -55,13 +52,13 @@ RTL
OverworldMap_CheckObject: OverworldMap_CheckObject:
PHX PHX
;CPX.b #$01 : BNE + : JMP ++ : + : JMP .fail ;CPX.b #$01 : BNE + : JMP ++ : + : JMP .fail
LDA CurrentWorld : AND.b #$40 : BNE + LDA.l CurrentWorld : AND.b #$40 : BNE +
;LW Map ;LW Map
LDA.l MapMode : BEQ +++ LDA.l MapMode : BEQ +++
LDA MapField : ORA MapOverlay : AND.b #$01 : BNE +++ LDA.l MapField : ORA.l MapOverlay : AND.b #$01 : BNE +++
PHX PHX
LDA.l .lw_map_offsets, X : TAX ; put map offset into X 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 PLX
AND.l .lw_map_masks, X : BNE +++ AND.l .lw_map_masks, X : BNE +++
JMP .fail JMP .fail
@@ -72,7 +69,7 @@ OverworldMap_CheckObject:
+ +
;DW Map ;DW Map
LDA.l MapMode : BEQ +++ LDA.l MapMode : BEQ +++
LDA MapField : ORA MapOverlay : AND.b #$02 : BNE +++ LDA.l MapField : ORA.l MapOverlay : AND.b #$02 : BNE +++
PHX PHX
LDA.l .dw_map_offsets, X : TAX ; put map offset into X LDA.l .dw_map_offsets, X : TAX ; put map offset into X
LDA.l MapField, X : ORA MapOverlay, X LDA.l MapField, X : ORA MapOverlay, X
@@ -90,11 +87,11 @@ RTL
AND.b #$40 : BNE .checkCrystal AND.b #$40 : BNE .checkCrystal
.checkPendant .checkPendant
LDA PendantsField : AND.l CrystalPendantFlags, X : BNE .fail LDA.l PendantsField : AND.l CrystalPendantFlags, X : BNE .fail
CLC : BRA .done CLC : BRA .done
.checkCrystal .checkCrystal
LDA CrystalsField : AND.l CrystalPendantFlags, X : BNE .fail LDA.l CrystalsField : AND.l CrystalPendantFlags, X : BNE .fail
CLC : BRA .done CLC : BRA .done
.fail .fail
@@ -119,33 +116,24 @@ db $02, $80, $08, $10, $01, $40, $04
SetLWDWMap: SetLWDWMap:
PHP PHP
SEP #$20 ; set 8-bit accumulator SEP #$20 ; set 8-bit accumulator
LDA CurrentWorld : EOR.b #$40 LDA.l CurrentWorld : EOR.b #$40
BNE + BNE +
LDA.b #07 : BRA ++ ; dark world - crystals LDA.b #07 : BRA ++ ; dark world - crystals
+ +
LDA.b #03 ; light world - pendants LDA.b #03 ; light world - pendants
++ ++
STA MapIcons STA.l MapIcons
PLP PLP
RTL RTL
;================================================================================ ;================================================================================
GetMapMode: GetMapMode:
LDA CurrentWorld : AND.b #$40 : BEQ + LDA.l CurrentWorld : AND.b #$40 : BEQ +
LDA.b #07 ; dark world - crystals LDA.b #07 ; dark world - crystals
RTL RTL
+ +
LDA.b #03 ; light world - pendants LDA.b #03 ; light world - pendants
RTL RTL
;================================================================================ ;================================================================================
;GetPendantCrystalWorld:
; PHB : PHK : PLB
; PHX
; LDA $040C : LSR : TAX
; LDA .dungeon_worlds, X
; PLX : PLB
; CMP.b #$00
;RTL
;================================================================================
BringMenuDownEnhanced: BringMenuDownEnhanced:
REP #$20 ; set 16-bit accumulator REP #$20 ; set 16-bit accumulator
LDA.l TournamentSeed : AND.w #$00FF LDA.l TournamentSeed : AND.w #$00FF
@@ -160,7 +148,7 @@ BringMenuDownEnhanced:
!ADD $EA : CMP.w #$FF18 : !BGE .noOvershoot !ADD $EA : CMP.w #$FF18 : !BGE .noOvershoot
LDA.w #$FF18 ; if we went past the limit, go to the limit LDA.w #$FF18 ; if we went past the limit, go to the limit
.noOvershoot .noOvershoot
STA $EA : CMP.w #$FF18 STA.b $EA : CMP.w #$FF18
SEP #$20 ; set 8-bit accumulator SEP #$20 ; set 8-bit accumulator
BNE .notDoneScrolling BNE .notDoneScrolling
INC $0200 INC $0200
@@ -178,38 +166,37 @@ RaiseHudMenu:
!ADD $EA : BMI .noOvershoot !ADD $EA : BMI .noOvershoot
LDA.w #$0000 ; if we went past the limit, go to the limit LDA.w #$0000 ; if we went past the limit, go to the limit
.noOvershoot .noOvershoot
STA $EA STA.b $EA
RTL RTL
;================================================================================ ;================================================================================
CheckCloseItemMenu: CheckCloseItemMenu:
LDA.l MenuCollapse : BNE + 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 RTL
;================================================================================ ;================================================================================
ShowDungeonItems: ShowDungeonItems:
LDA $040C : AND.w #$00FF : CMP.w #$00FF : BNE + : RTL : + ; return normal result if outdoors or in a cave LDA.w $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.l HudFlag : AND.w #$0020 ; check hud flag
LDA HudFlag : AND.w #$0020 ; check hud flag
BEQ + : LDA.w #$0000 : RTL : + ; if set, send the zero onwards 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 RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
UpdateKeys: UpdateKeys:
PHX : PHP PHX : PHP
SEP #$30 ; set 8-bit accumulator & index registers 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 LSR : TAX ; get dungeon index and store to X
LDA CurrentSmallKeys ; load current key count LDA.l CurrentSmallKeys ; load current key count
STA DungeonKeys, X ; save to main counts STA.l DungeonKeys, X ; save to main counts
CPX.b #$00 : BNE + CPX.b #$00 : BNE +
STA HyruleCastleKeys ; copy HC to sewers STA.l HyruleCastleKeys ; copy HC to sewers
+ : CPX.b #$01 : BNE + + : CPX.b #$01 : BNE +
STA SewerKeys ; copy sewers to HC STA.l SewerKeys ; copy sewers to HC
+ +
.skip .skip
JSL.l PostItemGet JSL.l PostItemGet
@@ -232,34 +219,34 @@ RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
DrawBootsInMenuLocation: DrawBootsInMenuLocation:
LDA.l HUDDungeonItems : BNE + LDA.l HUDDungeonItems : BNE +
LDA.w #$1608 : STA $00 LDA.w #$1608 : STA.b $00
RTL RTL
+ +
LDA.w #$1588 : STA $00 LDA.w #$1588 : STA.b $00
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
DrawGlovesInMenuLocation: DrawGlovesInMenuLocation:
LDA.l HUDDungeonItems : BNE + LDA.l HUDDungeonItems : BNE +
LDA.w #$1610 : STA $00 LDA.w #$1610 : STA.b $00
RTL RTL
+ +
LDA.w #$1590 : STA $00 LDA.w #$1590 : STA.b $00
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
DrawFlippersInMenuLocation: DrawFlippersInMenuLocation:
LDA.l HUDDungeonItems : BNE + LDA.l HUDDungeonItems : BNE +
LDA.w #$1618 : STA $00 LDA.w #$1618 : STA.b $00
RTL RTL
+ +
LDA.w #$1598 : STA $00 LDA.w #$1598 : STA.b $00
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
DrawMoonPearlInMenuLocation: DrawMoonPearlInMenuLocation:
LDA.l HUDDungeonItems : BNE + LDA.l HUDDungeonItems : BNE +
LDA.w #$1620 : STA $00 LDA.w #$1620 : STA.b $00
RTL RTL
+ +
LDA.w #$15A0 : STA $00 LDA.w #$15A0 : STA.b $00
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
DrawHUDDungeonItems: 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 .draw_small_keys
LDA.w #$2810 : STA $1684 ; small keys icon LDA.w #$2810 : STA.w $1684 ; small keys icon
LDY.w #0 LDY.w #0
@@ -399,10 +386,10 @@ DrawHUDDungeonItems:
.skip_small_keys .skip_small_keys
; Big 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 ; use X so we can BIT
LDX.w #0 LDX.w #0
@@ -429,10 +416,8 @@ DrawHUDDungeonItems:
.skip_big_keys .skip_big_keys
LDA HUDDungeonItems : AND.w #$0010 : BEQ .skip_boss_kills LDA.l HUDDungeonItems : AND.w #$0010 : BEQ .skip_boss_kills
LDA.w #$280F : STA.w $1704 ; skull icon
LDA.w #$280F : STA $1704 ; skull icon
LDY.w #0 LDY.w #0
.next_boss_kill .next_boss_kill
@@ -460,8 +445,8 @@ DrawHUDDungeonItems:
.maps_and_compasses .maps_and_compasses
; Maps ; Maps
LDA HUDDungeonItems : AND.w #$0004 : BEQ .skip_maps LDA.l HUDDungeonItems : AND.w #$0004 : BEQ .skip_maps
LDA.w #$2821 : STA $1684 ; map icon LDA.w #$2821 : STA.w $1684 ; map icon
; use X so we can BIT ; use X so we can BIT
LDX.w #0 LDX.w #0
@@ -489,8 +474,8 @@ DrawHUDDungeonItems:
.skip_maps .skip_maps
; Compasses ; Compasses
LDA HUDDungeonItems : AND.w #$0008 : BEQ .skip_compasses LDA.l HUDDungeonItems : AND.w #$0008 : BEQ .skip_compasses
LDA.w #$2C20 : STA $16C4 ; compass icon LDA.w #$2C20 : STA.w $16C4 ; compass icon
; use X so we can BIT ; use X so we can BIT
LDX.w #0 LDX.w #0
@@ -528,19 +513,19 @@ DrawPendantCrystalDiagram:
REP #$30 ; Set 16-bit accumulator & index registers REP #$30 ; Set 16-bit accumulator & index registers
LDX.w #$0000 ; Paint entire box black & draw empty pendants and crystals LDX.w #$0000 ; Paint entire box black & draw empty pendants and crystals
- -
LDA.l .row0, X : STA $12EA, X LDA.l .row0, X : STA.w $12EA, X
LDA.l .row1, X : STA $132A, X LDA.l .row1, X : STA.w $132A, X
LDA.l .row2, X : STA $136A, X LDA.l .row2, X : STA.w $136A, X
LDA.l .row3, X : STA $13AA, X LDA.l .row3, X : STA.w $13AA, X
LDA.l .row4, X : STA $13EA, X LDA.l .row4, X : STA.w $13EA, X
LDA.l .row5, X : STA $142A, X LDA.l .row5, X : STA.w $142A, X
LDA.l .row6, X : STA $146A, X LDA.l .row6, X : STA.w $146A, X
LDA.l .row7, X : STA $14AA, X LDA.l .row7, X : STA.w $14AA, X
LDA.l .row8, X : STA $14EA, X LDA.l .row8, X : STA.w $14EA, X
INX #2 : CPX.w #$0014 : BCC - INX #2 : CPX.w #$0014 : BCC -
; pendants ; pendants
LDA PendantsField LDA.l PendantsField
LSR : BCC + ; pendant of wisdom (red) LSR : BCC + ; pendant of wisdom (red)
LDX.w #$252B LDX.w #$252B
@@ -567,7 +552,7 @@ DrawPendantCrystalDiagram:
; crystals ; crystals
LDA CrystalsField LDA.l CrystalsField
LDX.w #$2D44 LDX.w #$2D44
LDY.w #$2D45 LDY.w #$2D45

View File

@@ -19,16 +19,16 @@ WriteBlanksToPlayerName:
RTL RTL
WriteCharacterToPlayerName: WriteCharacterToPlayerName:
STA ExtendedFileNameSRAM, X STA.l ExtendedFileNameSRAM, X
CPX.w #$0008 : !BGE + CPX.w #$0008 : !BGE +
STA $7003D9, X ;what we wrote over STA.l $7003D9, X ;what we wrote over
+ +
RTL RTL
ReadCharacterFromPlayerName: ;Only for use on Name Screen ReadCharacterFromPlayerName: ;Only for use on Name Screen
LDA ExtendedFileNameSRAM, X LDA.l ExtendedFileNameSRAM, X
CPX.w #$0008 : !BGE + CPX.w #$0008 : !BGE +
LDA $7003D9, X ;what we wrote over LDA.l $7003D9, X ;what we wrote over
+ +
RTL RTL
@@ -40,13 +40,13 @@ PLB
RTL RTL
WrapCharacterPosition: WrapCharacterPosition:
LDA $0B12 : BPL + LDA.w $0B12 : BPL +
LDA.b #$0B LDA.b #$0B
+ +
CMP.b #$0C : !BLT + CMP.b #$0C : !BLT +
LDA.b #$00 LDA.b #$00
+ +
STA $0B12 STA.w $0B12
RTL RTL
CharacterPositions: CharacterPositions:

View File

@@ -4,7 +4,7 @@
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
RefillHealth: RefillHealth:
REP #$20 ; set 16-bit accumulator 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 CMP.w #279 : BNE + ; Spike Cave bottles work normally
SEP #$20 ; set 8-bit accumulator SEP #$20 ; set 8-bit accumulator
LDA.b #$A0 LDA.b #$A0
@@ -50,7 +50,7 @@ RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
RefillMagic: RefillMagic:
REP #$20 ; set 16-bit accumulator 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 CMP.w #279 : BNE + ; Spike Cave bottles work normally
SEP #$20 ; set 8-bit accumulator SEP #$20 ; set 8-bit accumulator
LDA.b #$80 LDA.b #$80

View File

@@ -4,7 +4,7 @@ QuickSwap:
; We perform all other checks only if we are pushing L or R in order to have minimal ; 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 ; 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. 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 ; If prossing both L and R this frame, then go directly to the special swap code
LDX.w $0202 : BRA .special_swap LDX.w $0202 : BRA .special_swap
+ +
BIT #$10 : BEQ + ; Only pressed R BIT.b #$10 : BEQ + ; Only pressed R
JSR.w RCode 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 BRA .store
+ +
; Only pressed L ; Only pressed L
@@ -29,18 +29,18 @@ QuickSwap:
BRA .store BRA .store
.special_swap .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 #$02 : BEQ + ; boomerang
CPX.b #$01 : BEQ + ; bow CPX.b #$01 : BEQ + ; bow
CPX.b #$05 : BEQ + ; powder CPX.b #$05 : BEQ + ; powder
CPX.b #$0D : BEQ + ; flute CPX.b #$0D : BEQ + ; flute
CPX.b #$10 : BEQ + ; bottle CPX.b #$10 : BEQ + ; bottle
BRA .store BRA .store
+ STX $0202 : JSL ProcessMenuButtons_y_pressed + STX.w $0202 : JSL ProcessMenuButtons_y_pressed
.store .store
LDA.b #$20 : STA.w $012F LDA.b #$20 : STA.w $012F
STX $0202 STX.w $0202
JSL HUD_RefreshIconLong JSL HUD_RefreshIconLong
PLX PLX
@@ -50,11 +50,11 @@ QuickSwap:
RTL RTL
RCode: RCode:
LDX.w $0202 LDX.w $0202
LDA.b $F2 : BIT #$20 : BNE ++ ; Still holding L from a previous frame LDA.b $F2 : BIT.b #$20 : BNE ++ ; Still holding L from a previous frame
LDA InventoryTracking+1 : AND #$FE : STA InventoryTracking+1 LDA.l InventoryTracking+1 : AND.b #$FE : STA.l InventoryTracking+1
BRA + BRA +
++ ++
LDA InventoryTracking+1 : BIT #$01 : BEQ + LDA.l InventoryTracking+1 : BIT.b #$01 : BEQ +
RTS RTS
- -
+ CPX.b #$14 : BNE + : LDX.b #$00 ;will wrap around to 1 + CPX.b #$14 : BNE + : LDX.b #$00 ;will wrap around to 1
@@ -68,10 +68,10 @@ RTS
LCode: LCode:
LDX.w $0202 LDX.w $0202
LDA.b $F2 : BIT #$10 : BNE ++ ; Still holding R from a previous frame 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 + BRA +
++ ++
LDA InventoryTracking+1 : BIT #$01 : BEQ + LDA.l InventoryTracking+1 : BIT.b #$01 : BEQ +
RTS RTS
- -
+ CPX.b #$01 : BNE + : LDX.b #$15 ; will wrap around to $14 + CPX.b #$01 : BNE + : LDX.b #$15 ; will wrap around to $14

300
ram.asm
View File

@@ -4,7 +4,7 @@
; This module is primarily concerned with labeling WRAM addresses used by the ; This module is primarily concerned with labeling WRAM addresses used by the
; randomizer and documenting their usage. ; 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) ; (https://github.com/spannerisms/jpdasm/ - 31/10/2022)
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
pushpc pushpc
@@ -36,6 +36,7 @@ Scrap0F: skip 1 ;
LinkPosY = $7E0020 ; 2 bytes LinkPosY = $7E0020 ; 2 bytes
LinkPosX = $7E0022 ; 2 bytes LinkPosX = $7E0022 ; 2 bytes
RoomIndex = $7E00A0 ; 2 bytes, UW room index
;================================================================================ ;================================================================================
; Bank 7E ; Bank 7E
@@ -55,6 +56,8 @@ MusicControlRequest = $7E012C
ItemReceiptID = $7E02D8 ItemReceiptID = $7E02D8
NMIAux = $7E0632
SpritePosYLow = $7E0D00 ; all $10 bytes SpritePosYLow = $7E0D00 ; all $10 bytes
SpritePosXLow = $7E0D10 SpritePosXLow = $7E0D10
SpritePosYHigh = $7E0D20 SpritePosYHigh = $7E0D20
@@ -69,8 +72,15 @@ SpriteDirectionTable = $7E0EB0
ToastBuffer = $7E1E0E ; 2 bytes DoToast ToastBuffer = $7E1E0E ; 2 bytes DoToast
ScratchBufferNV = $7E1E70 ; Callee preserved, not ok to clobber MSUResumeTime = $7E1E6B ; 4 bytes
ScratchBufferV = $7E1E80 ; Caller preserved, okay to clobber MSUResumeControl = $7E1E6F
MSUFallbackTable = $7E1E70 ; 8 bytes
MSUDelayedCommand = $7E1E79
MSUPackCount = $7E1E7A
MSUPackCurrent = $7E1E7B
MSUPackRequest = $7E1E7C
MSULoadedTrack = $7E1E7D ; 2 bytes
MSUResumeTrack = $7E1E7F
;1E90 ;1E90
ClockHours = $7E1E90 ; Clock Hours ClockHours = $7E1E90 ; Clock Hours
@@ -78,7 +88,9 @@ ClockMinutes = $7E1E94 ; Clock Minutes
ClockSeconds = $7E1E98 ; Clock Seconds ClockSeconds = $7E1E98 ; Clock Seconds
ClockBuffer = $7E1E9C ; Clock Temporary ClockBuffer = $7E1E9C ; Clock Temporary
;1EA0 ;1EA0
ScratchBufferNV = $7E1EA0 ; Callee preserved
;1EB0 ;1EB0
ScratchBufferV = $7E1EB0 ; Caller preserved
;1EC0 ;1EC0
;1ED0 ;1ED0
;1EE0 ;1EE0
@@ -108,103 +120,111 @@ BigRAM = $7EC900 ; Big buffer of free ram (0x1F00)
;================================================================================ ;================================================================================
; Bank 7F ; Bank 7F
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
RedrawFlag = $7F5000 base $7F5000
RedrawFlag: skip 1 ;
SpriteSkipEOR = $7F5008 skip 2 ;
HexToDecDigit1: skip 1 ; Space for storing the result of hex to decimal conversion.
MSReceived = $7F5031 HexToDecDigit2: skip 1 ; Digits are stored from high to low.
; GanonWarpChain = $7F5032 HexToDecDigit3: skip 1 ;
ForceHeartSpawn = $7F5033 HexToDecDigit4: skip 1 ;
SkipHeartSave = $7F5034 HexToDecDigit5: skip 1 ;
AltTextFlag = $7F5035 ; two bytes, next must be zero. 0=disable SpriteSkipEOR: skip 2 ; Used in utilities.asm to determine when to skip drawing sprites. Zero-padded
BossKills = $7F5037 skip $2B ; Unused
LagTime = $7F5038 AltTextFlag: skip 2 ; dialog.asm: Determines whether to load from vanilla decompression buffer
RupeesCollected = $7F503C ; 2 bytes ; or from a secondary buffer (used for things like free dungeon item text)
NonChestCounter = $7F503E BossKills: skip 1 ;
LagTime: skip 4 ; Computed during stats preparation for display
TileUploadOffsetOverride = $7F5042 RupeesCollected: skip 2 ; Computed during stats preparation for display
NonChestCounter: skip 2 ; Computed during stats preparation for display
NMIAux = $7F5044 skip 2 ; Unused
TileUploadOffsetOverride: skip 2 ; Offset override for loading sprite gfx
ShopId = $7F5050 skip 3 ;
ShopType = $7F5051 skip 9 ;
ShopInventory = $7F5052 ; 0x0C ; Shop Block $7F5050 - $7F506F
ShopState = $7F505F ShopId: skip 1 ; Shop ID. Used for indexing and loading inventory for custom shops
ShopCapacity = $7F5060 ShopType: skip 1 ; Shop type. $FF = vanilla shop
ShopScratch = $7F5061 ; t - - - - - - -
ShopSRAMIndex = $7F5062 ; t = Take-any
ShopMerchant = $7F5063 ShopInventory: skip $0D ; For three possible shop items, row major:
; ShopDMATimer = $7F5064 unused ; [Item ID][Price low][Price High][Purchase Count]
ShopPriceColumn = $7F5066 ; two bytes 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
OneMindId = $7F5072 ShopScratch: skip 1 ; Scratch byte used in shop drawing routines
OneMindTimerRAM = $7F5073 ShopSRAMIndex: skip 1 ; SRAM index for purchase counts
ShopMerchant: skip 1 ; Loaded from ShopTable and used to jump to one of four drawing routines
ClockStatus = $7F507E ; 2 bytes 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 ; ---- --dn
; d - dnf ; d - DNF mode
; n - negative ; n - Negative
skip $10 ; Unused
RNGLockIn = $7F5090 ; RNG Item RNGLockIn: skip 1 ; Used for RNG item (currently unused by rando)
BusyItem = $7F5091 BusyItem: skip 1 ; Flags for indicating when these things are "busy"
BusyHealth = $7F5092 BusyHealth: skip 1 ; e.g. doing some animation
BusyMagic = $7F5093 BusyMagic: skip 1 ;
DialogOffsetPointer = $7F5094 ; 2 bytes DialogOffsetPointer: skip 2 ; Offset and return pointer into new dialog buffer used
DialogReturnPointer = $7F5096 ; 2 bytes DialogReturnPointer: skip 2 ; for e.g. free dungeon item text.
skip 1 ; Unused
StalfosBombDamage = $7F509D PreviousOverworldDoor: skip 1 ; Previous overworld door is cached or initialized here
ValidKeyLoaded = $7F509E skip 1 ; Reserved
skip 1 ; Unused
SwordModifier = $7F50C0 DuckMapFlag: skip 1 ; Temporary flag used and reset by flute map drawing routine
ShieldModifier = $7F50C1 ; not implemented StalfosBombDamage: skip 1 ; Relocated from damage table
ArmorModifier = $7F50C2 ValidKeyLoaded: skip 1 ;
MagicModifier = $7F50C3 TextBoxDefer: skip 1 ; Flag used to defer post-item text boxes
LightConeModifier = $7F50C4 skip $10 ; Unused
CuccoStormer = $7F50C5 ; non-zero write causes storm, needs to be zeroed skip $10 ; Reserved for enemizer
OldManDash = $7F50C6 ; Most of these modifiers are intended to be written to by
IceModifier = $7F50C7 ; a 3rd party (e.g. Crowd Control.) Writer is responsible
InfiniteArrows = $7F50C8 ; for zeroing.
InfiniteBombs = $7F50C9 SwordModifier: skip 1 ; Adds level to current sword. Doesn't change graphics.
InfiniteMagic = $7F50CA ShieldModifier: skip 1 ; Not implemented
DPadInverter = $7F50CB ; fill in values ArmorModifier: skip 1 ; Adds level to current mail. Doesn't change graphics.
OHKOFlag = $7F50CC MagicModifier: skip 1 ; Adds level to magic consumption (1/2, 1/4.)
SpriteSwapper = $7F50CD LightConeModifier: skip 1 ; Gives lamp cone when set to 1
BootsModifier = $7F50CE CuccoStormer: skip 1 ; Non-zero write causes storm.
OldManDash: skip 1 ; Unused
; $7F50D0 - $7F50FF - Block Cypher Parameters IceModifier: skip 1 ; - - - g - - - i | Flipping either sets ice physics
; $7F5100 - $7F51FF - Block Cypher Buffer InfiniteArrows: skip 1 ; Setting these to $01 will give infinite ammo. Set by
InfiniteBombs: skip 1 ; EscapeAssist.
; Crypto buffer ($7F50D0 - $7F51FF) InfiniteMagic: skip 1 ;
KeyBase = $7F50D0 ControllerInverter: skip 1 ; $01 = D-pad | $02 = Buttons | $03 = Buttons and D-Pad
y = $7F50E0 ; >=$04 = Swap buttons and D-pad
z = $7F50E4 OHKOFlag: skip 1 ; Any non-zero write sets OHKO mode
Sum = $7F50E8 SpriteSwapper: skip 1 ; Loads new link sprite and glove/armor palette. No gfx or
p = $7F50EC ; code currently in base ROM for this.
e = $7F50F0 BootsModifier: skip 1 ; $01 = Give dash ability
CryptoScratch = $7F50F2 skip 1 ; Unused
CryptoBuffer = $7F5100 ; Crypto Block ($7F50D0 - $7F51FF)
v = $7F5100 KeyBase: skip $10 ;
y: skip 4 ;
RNGPointers = $7F5200 ; $FF bytes z: skip 4 ;
Sum: skip 4 ;
RxBuffer = $7F5300 ; $00-$5F buffer $60-7E reserved p: skip 4 ;
RxStatus = $7F537F ; 1 byte e: skip 2 ;
TxBuffer = $7F5380 ; $80 - $EF buffer $F0 - $FE reserved CryptoScratch: skip $0E ;
TxStatus = $7F53FF ; $F0 - $FE CryptoBuffer: ;
v: skip $100 ;
MSUFallbackTable = $7F5460 ; 8 bytes RNGPointers: skip $100 ; Pointers for static RNG
MSUDelayedCommand = $7F5469 ; Network I/O block. See servicerequest.asm. Rx and Tx channels
MSUPackCount = $7F546A ; also allocated 8 persistent bytes each in sram.asm.
MSUPackCurrent = $7F546B RxBuffer: skip $7F ;
MSUPackRequest = $7F546C RxStatus: skip 1 ;
MSULoadedTrack = $7F546D ; 2 bytes TxBuffer: skip $7F ;
MSUResumeTrack = $7F546F TxStatus: skip 1 ;
MSUResumeTime = $7F5470 ; 4 bytes skip $10 ; Unused
MSUResumeControl = $7F5474 CompassTotalsWRAM: skip $10 ; skip $10
skip $40 ; Reserved for general dungeon tracking data. May have over
CompassTotalsWRAM = $7F5410 ; allocated here. Feel free to reassign.
skip $40 ; Unused
DialogBuffer = $7F5700 ; $FF bytes skip $260 ; Unused
DialogBuffer: skip $100 ; Dialog Buffer
;================================================================================ ;================================================================================
; RAM Assertions ; RAM Assertions
@@ -233,6 +253,7 @@ endmacro
%assertRAM(LinkPosY, $7E0020) %assertRAM(LinkPosY, $7E0020)
%assertRAM(LinkPosX, $7E0022) %assertRAM(LinkPosX, $7E0022)
%assertRAM(RoomIndex, $7E00A0)
%assertRAM(CurrentMSUTrack, $7E010B) %assertRAM(CurrentMSUTrack, $7E010B)
%assertRAM(CurrentVolume, $7E0127) %assertRAM(CurrentVolume, $7E0127)
%assertRAM(TargetVolume, $7E0129) %assertRAM(TargetVolume, $7E0129)
@@ -240,6 +261,7 @@ endmacro
%assertRAM(MusicControl, $7E012B) %assertRAM(MusicControl, $7E012B)
%assertRAM(MusicControlRequest, $7E012C) %assertRAM(MusicControlRequest, $7E012C)
%assertRAM(ItemReceiptID, $7E02D8) %assertRAM(ItemReceiptID, $7E02D8)
%assertRAM(NMIAux, $7E0632)
%assertRAM(SpritePosYLow, $7E0D00) %assertRAM(SpritePosYLow, $7E0D00)
%assertRAM(SpritePosXLow, $7E0D10) %assertRAM(SpritePosXLow, $7E0D10)
%assertRAM(SpritePosYHigh, $7E0D20) %assertRAM(SpritePosYHigh, $7E0D20)
@@ -249,12 +271,24 @@ endmacro
%assertRAM(SpriteTypeTable, $7E0E20) %assertRAM(SpriteTypeTable, $7E0E20)
%assertRAM(SpriteDirectionTable, $7E0EB0) %assertRAM(SpriteDirectionTable, $7E0EB0)
%assertRAM(ToastBuffer, $7E1E0E) %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(ClockHours, $7E1E90)
%assertRAM(ClockMinutes, $7E1E94) %assertRAM(ClockMinutes, $7E1E94)
%assertRAM(ClockSeconds, $7E1E98) %assertRAM(ClockSeconds, $7E1E98)
%assertRAM(ClockBuffer, $7E1E9C) %assertRAM(ClockBuffer, $7E1E9C)
%assertRAM(ScratchBufferNV, $7E1EA0)
%assertRAM(ScratchBufferV, $7E1EB0)
%assertRAM(TileUploadBuffer, $7EA180) %assertRAM(TileUploadBuffer, $7EA180)
%assertRAM(SpriteOAM, $7EC025) %assertRAM(SpriteOAM, $7EC025)
%assertRAM(HUDKeyIcon, $7EC726) %assertRAM(HUDKeyIcon, $7EC726)
@@ -266,17 +300,21 @@ endmacro
%assertRAM(HUDKeyDigits, $7EC764) %assertRAM(HUDKeyDigits, $7EC764)
%assertRAM(BigRAM, $7EC900) %assertRAM(BigRAM, $7EC900)
%assertRAM(RedrawFlag, $7F5000) %assertRAM(RedrawFlag, $7F5000)
%assertRAM(HexToDecDigit1, $7F5003)
%assertRAM(HexToDecDigit2, $7F5004)
%assertRAM(HexToDecDigit3, $7F5005)
%assertRAM(HexToDecDigit4, $7F5006)
%assertRAM(HexToDecDigit5, $7F5007)
%assertRAM(SpriteSkipEOR, $7F5008) %assertRAM(SpriteSkipEOR, $7F5008)
%assertRAM(MSReceived, $7F5031)
%assertRAM(ForceHeartSpawn, $7F5033)
%assertRAM(SkipHeartSave, $7F5034)
%assertRAM(AltTextFlag, $7F5035) %assertRAM(AltTextFlag, $7F5035)
%assertRAM(BossKills, $7F5037) %assertRAM(BossKills, $7F5037)
%assertRAM(LagTime, $7F5038) %assertRAM(LagTime, $7F5038)
%assertRAM(RupeesCollected, $7F503C) %assertRAM(RupeesCollected, $7F503C)
%assertRAM(NonChestCounter, $7F503E) %assertRAM(NonChestCounter, $7F503E)
%assertRAM(TileUploadOffsetOverride, $7F5042) %assertRAM(TileUploadOffsetOverride, $7F5042)
%assertRAM(NMIAux, $7F5044)
%assertRAM(ShopId, $7F5050) %assertRAM(ShopId, $7F5050)
%assertRAM(ShopType, $7F5051) %assertRAM(ShopType, $7F5051)
%assertRAM(ShopInventory, $7F5052) %assertRAM(ShopInventory, $7F5052)
@@ -295,8 +333,11 @@ endmacro
%assertRAM(BusyMagic, $7F5093) %assertRAM(BusyMagic, $7F5093)
%assertRAM(DialogOffsetPointer, $7F5094) %assertRAM(DialogOffsetPointer, $7F5094)
%assertRAM(DialogReturnPointer, $7F5096) %assertRAM(DialogReturnPointer, $7F5096)
%assertRAM(PreviousOverworldDoor, $7F5099)
%assertRAM(DuckMapFlag, $7F509C)
%assertRAM(StalfosBombDamage, $7F509D) %assertRAM(StalfosBombDamage, $7F509D)
%assertRAM(ValidKeyLoaded, $7F509E) %assertRAM(ValidKeyLoaded, $7F509E)
%assertRAM(TextBoxDefer, $7F509F)
%assertRAM(SwordModifier, $7F50C0) %assertRAM(SwordModifier, $7F50C0)
%assertRAM(ShieldModifier, $7F50C1) %assertRAM(ShieldModifier, $7F50C1)
%assertRAM(ArmorModifier, $7F50C2) %assertRAM(ArmorModifier, $7F50C2)
@@ -308,7 +349,7 @@ endmacro
%assertRAM(InfiniteArrows, $7F50C8) %assertRAM(InfiniteArrows, $7F50C8)
%assertRAM(InfiniteBombs, $7F50C9) %assertRAM(InfiniteBombs, $7F50C9)
%assertRAM(InfiniteMagic, $7F50CA) %assertRAM(InfiniteMagic, $7F50CA)
%assertRAM(DPadInverter, $7F50CB) %assertRAM(ControllerInverter, $7F50CB)
%assertRAM(OHKOFlag, $7F50CC) %assertRAM(OHKOFlag, $7F50CC)
%assertRAM(SpriteSwapper, $7F50CD) %assertRAM(SpriteSwapper, $7F50CD)
%assertRAM(BootsModifier, $7F50CE) %assertRAM(BootsModifier, $7F50CE)
@@ -326,15 +367,6 @@ endmacro
%assertRAM(RxStatus, $7F537F) %assertRAM(RxStatus, $7F537F)
%assertRAM(TxBuffer, $7F5380) %assertRAM(TxBuffer, $7F5380)
%assertRAM(TxStatus, $7F53FF) %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(CompassTotalsWRAM, $7F5410)
%assertRAM(DialogBuffer, $7F5700) %assertRAM(DialogBuffer, $7F5700)
@@ -344,36 +376,7 @@ pullpc
; Bank 7F ; Bank 7F
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
; $7F5000 - Redraw Flag ;OLDSTUFF
; $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
; $7F5042 - Tile Upload Offset Override (Low) ; $7F5042 - Tile Upload Offset Override (Low)
; $7F5043 - Tile Upload Offset Override (High) ; $7F5043 - Tile Upload Offset Override (High)
; $7F5044 - $7F5046 - NMI Auxiliary Function ; $7F5044 - $7F5046 - NMI Auxiliary Function
@@ -395,11 +398,11 @@ pullpc
; $7F5095 - Dialog Offset Pointer (High) ; $7F5095 - Dialog Offset Pointer (High)
; $7F5096 - Dialog Offset Pointer Return (Low) ; $7F5096 - Dialog Offset Pointer Return (Low)
; $7F5097 - Dialog Offset Pointer Return (High) ; $7F5097 - Dialog Offset Pointer Return (High)
; $7F5098 - Water Entry Index ; $7F5098 - Unused
; $7F5099 - Last Entered Overworld Door ID ; $7F5099 - Last Entered Overworld Door ID
; $7F509A - (Reserved) ; $7F509A - (Reserved)
; $7F509B - Unused ; $7F509B - Unused
; $7F509C - Unused ; $7F509C - Duck Map Flag
; $7F509E - Valid Key Loaded ; $7F509E - Valid Key Loaded
; $7F509F - Text Box Defer Flag ; $7F509F - Text Box Defer Flag
; $7F50A0 - $7F50AF - Unused ; $7F50A0 - $7F50AF - Unused
@@ -427,8 +430,7 @@ pullpc
; $7F5300 - $7F53FF - Multiworld Block ; $7F5300 - $7F53FF - Multiworld Block
; $7F5400 - $7F540F - Unused ; $7F5400 - $7F540F - Unused
; $7F5410 - $7F545F - Dungeon Tracking Block ; $7F5410 - $7F545F - Dungeon Tracking Block
; $7F5460 - $7F549F - MSU Block ; $7F5460 - $7F56FF - Unused
; $7F54A0 - $7F56FF - Unused
; $7F5700 - $7F57FF - Dialog Buffer ; $7F5700 - $7F57FF - Dialog Buffer

View File

@@ -35,7 +35,7 @@ DecrementArrows:
BRA .done BRA .done
.rupees .rupees
REP #$20 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.b $1B : BEQ .not_archery_game ; in overworld
LDA.w $0B9A : BEQ .shoot_arrow ; arrow game active LDA.w $0B9A : BEQ .shoot_arrow ; arrow game active
LDA.b #$00 : BRA .done LDA.b #$00 : BRA .done

View File

@@ -44,7 +44,7 @@ RNG_Lanmolas1:
RNG_Moldorm1: RNG_Moldorm1:
LDA.b #$01 : BRA _rng_done LDA.b #$01 : BRA _rng_done
RNG_Agahnim1: 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 LDA.b #$02
JSL.l GetStaticRNG : PHA JSL.l GetStaticRNG : PHA
LDA.l GanonAgahRNG : BEQ + ; check if blue balls are disabled LDA.l GanonAgahRNG : BEQ + ; check if blue balls are disabled

View File

@@ -4,7 +4,7 @@ LoadRoomHook:
.noStats .noStats
JSL Dungeon_LoadRoom JSL Dungeon_LoadRoom
REP #$10 ; 16 bit XY REP #$10 ; 16 bit XY
LDX $A0 ; Room ID LDX.b RoomIndex ; Room ID
LDA.l RoomCallbackTable, X LDA.l RoomCallbackTable, X
SEP #$10 ; 8 bit XY SEP #$10 ; 8 bit XY
JSL UseImplicitRegIndexedLongJumpTable JSL UseImplicitRegIndexedLongJumpTable
@@ -68,20 +68,20 @@ macro DrawBombosPlatform(roomX, roomY, quadX, quadY)
endMacro endMacro
IcePalaceBombosSE: IcePalaceBombosSE:
LDA AllowSwordlessMedallionUse : CMP #$01 : BEQ + : RTL : + LDA.l AllowSwordlessMedallionUse : CMP.b #$01 : BEQ + : RTL : +
%DrawBombosPlatform(14, 18, 1, 1) %DrawBombosPlatform(14, 18, 1, 1)
RTL RTL
IcePalaceBombosSW: IcePalaceBombosSW:
LDA AllowSwordlessMedallionUse : CMP #$01 : BEQ + : RTL : + LDA.l AllowSwordlessMedallionUse : CMP.b #$01 : BEQ + : RTL : +
%DrawBombosPlatform(14, 18, 0, 1) %DrawBombosPlatform(14, 18, 0, 1)
RTL RTL
IcePalaceBombosNE: IcePalaceBombosNE:
LDA AllowSwordlessMedallionUse : CMP #$01 : BEQ + : RTL : + LDA.l AllowSwordlessMedallionUse : CMP.b #$01 : BEQ + : RTL : +
%DrawBombosPlatform(14, 18, 1, 0) %DrawBombosPlatform(14, 18, 1, 0)
RTL RTL
CastleEastEntrance: 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 : + LDA.l BlockCastleDoorsInRain : BNE + : RTL : +
REP #$20 ; 16 A REP #$20 ; 16 A
@@ -112,7 +112,7 @@ CastleEastEntrance:
RTL RTL
CastleWestEntrance: 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 : + LDA.l BlockCastleDoorsInRain : BNE + : RTL : +
REP #$20 ; 16 A REP #$20 ; 16 A

View File

@@ -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
;================================================================================

View File

@@ -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
;

View File

View File

@@ -60,8 +60,8 @@ macro ServiceRequestChest(type)
LDA.l TxStatus : BEQ + : CLC : RTL : + ; return fail if we don't have the lock LDA.l TxStatus : BEQ + : CLC : RTL : + ; return fail if we don't have the lock
LDA.b $1B : STA.l TxBuffer+8 ; indoor/outdoor LDA.b $1B : STA.l TxBuffer+8 ; indoor/outdoor
BEQ + BEQ +
LDA.b $A0 : STA.l TxBuffer+9 ; roomid low LDA.b RoomIndex : STA.l TxBuffer+9 ; roomid low
LDA.b $A1 : STA.l TxBuffer+10 ; roomid high LDA.b RoomIndex+1 : STA.l TxBuffer+10 ; roomid high
BRA ++ BRA ++
+ +
LDA.w $040A : STA.l TxBuffer+9 ; area id 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.l TxStatus : BEQ + : CLC : RTL : + ; return fail if we don't have the lock
LDA.b $1B : STA.l TxBuffer+8 ; indoor/outdoor LDA.b $1B : STA.l TxBuffer+8 ; indoor/outdoor
BEQ + BEQ +
LDA.b $A0 : STA.l TxBuffer+9 ; roomid low LDA.b RoomIndex : STA.l TxBuffer+9 ; roomid low
LDA.b $A1 : STA.l TxBuffer+10 ; roomid high LDA.b RoomIndex+1 : STA.l TxBuffer+10 ; roomid high
BRA ++ BRA ++
+ +
LDA.w $040A : STA.l TxBuffer+9 ; area id LDA.w $040A : STA.l TxBuffer+9 ; area id

View File

@@ -110,9 +110,9 @@ SpritePrep_ShopKeeper:
REP #$30 ; set 16-bit accumulator & index registers REP #$30 ; set 16-bit accumulator & index registers
LDX.w #$0000 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 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 SEP #$20 ; set 8-bit accumulator
LDA.l ShopTable, X : STA.l ShopId LDA.l ShopTable, X : STA.l ShopId
@@ -174,9 +174,9 @@ SpritePrep_ShopKeeper:
JMP - JMP -
.stop .stop
LDA.b #Shopkeeper_UploadVRAMTilesLong>>16 : STA.l NMIAux+2 LDA.b #Shopkeeper_UploadVRAMTilesLong>>16 : STA.w NMIAux+2
LDA.b #Shopkeeper_UploadVRAMTilesLong>>8 : STA.l NMIAux+1 LDA.b #Shopkeeper_UploadVRAMTilesLong>>8 : STA.w NMIAux+1
LDA.b #Shopkeeper_UploadVRAMTilesLong>>0 : STA.l NMIAux LDA.b #Shopkeeper_UploadVRAMTilesLong>>0 : STA.w NMIAux
.done .done
LDA.l ShopType : BIT.b #$20 : BEQ .notTakeAll ; Take-all LDA.l ShopType : BIT.b #$20 : BEQ .notTakeAll ; Take-all

View File

@@ -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. DungeonsCompleted: skip 2 ; Bitfield indicating whether a dungeon's prize has been collected.
; This has the same shape as the dungeon item bitfields. ; This has the same shape as the dungeon item bitfields.
skip 44 ; Unused skip 44 ; Unused
ServiceSequenceRx: ; Service sequence receive ServiceSequence: ; See servicerequest.asm
ServiceSequenceTx: ; Service sequence transmit ServiceSequenceRx: skip 8 ; Service sequence receive
ServiceSequence: skip 8 ; Service request block. See servicerequest.asm ServiceSequenceTx: skip 8 ; Service sequence transmit
skip 8 ; Unused
DungeonAbsorbedKeys: ; \ Absorbed key counters (integers) DungeonAbsorbedKeys: ; \ Absorbed key counters (integers)
SewerAbsorbedKeys: skip 1 ; | Sewer Passage SewerAbsorbedKeys: skip 1 ; | Sewer Passage
HCAbsorbedKeys: skip 1 ; | Hyrule Castle HCAbsorbedKeys: skip 1 ; | Hyrule Castle
@@ -395,11 +394,11 @@ RoomDataSRAM: ;
skip $280 ; skip $280 ;
OverworldEventDataSRAM: ; OverworldEventDataSRAM: ;
skip $C0 ; skip $C0 ;
EquipmentSRAM: skip 3 ; skip 76 EquipmentSRAM: skip 3 ;
BombsEquipmentSRAM: skip 31 ; 343 BombsEquipmentSRAM: skip 31 ;
DisplayRupeesSRAM: skip 21 ; 362 DisplayRupeesSRAM: skip 21 ;
CurrentArrowsSRAM: skip 21 ; 377 CurrentArrowsSRAM: skip 21 ;
InventoryTrackingSRAM: skip 2 ; 38C InventoryTrackingSRAM: skip 2 ;
BowTrackingSRAM: skip 2 ; BowTrackingSRAM: skip 2 ;
skip 53 ; skip 53 ;
ProgressIndicatorSRAM: skip 1 ; ProgressIndicatorSRAM: skip 1 ;
@@ -600,7 +599,7 @@ endmacro
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
%assertSRAM(ServiceSequence, $7EF4A0) %assertSRAM(ServiceSequence, $7EF4A0)
%assertSRAM(ServiceSequenceRx, $7EF4A0) %assertSRAM(ServiceSequenceRx, $7EF4A0)
%assertSRAM(ServiceSequenceTx, $7EF4A0) %assertSRAM(ServiceSequenceTx, $7EF4A8)
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
%assertSRAM(DungeonAbsorbedKeys, $7EF4B0) %assertSRAM(DungeonAbsorbedKeys, $7EF4B0)
%assertSRAM(SewerAbsorbedKeys, $7EF4B0) %assertSRAM(SewerAbsorbedKeys, $7EF4B0)

View File

@@ -39,7 +39,7 @@ DungeonHoleEntranceTransition:
JSL EnableForceBlank JSL EnableForceBlank
LDA.l SilverArrowsAutoEquip : AND.b #$02 : BEQ + 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 BowTracking : AND.b #$40 : BEQ + ; skip if we don't have silvers
LDA.l BowEquipment : BEQ + ; skip if we have no bow LDA.l BowEquipment : BEQ + ; skip if we have no bow
CMP.b #$03 : !BGE + ; skip if the bow is already silver CMP.b #$03 : !BGE + ; skip if the bow is already silver
@@ -133,7 +133,7 @@ CountChestKey: ; called by neighbor functions
RTS RTS
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
CountBonkItem: ; called from GetBonkItem in bookofmudora.asm 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 CMP.b #115 : BNE + ; Desert Bonk Key
LDA.l BonkKey_Desert : BRA ++ LDA.l BonkKey_Desert : BRA ++
+ : CMP.b #140 : BNE + ; GTower Bonk Key + : CMP.b #140 : BNE + ; GTower Bonk Key
@@ -289,7 +289,7 @@ IncrementUWMirror:
PHA PHA
LDA.b #$00 : STA.l $7F5035 ; bandaid patch bug with mirroring away from text LDA.b #$00 : STA.l $7F5035 ; bandaid patch bug with mirroring away from text
LDA.l StatsLocked : BNE + 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 LDA.l UnderworldMirrors : INC : STA.l UnderworldMirrors
JSL.l StatTransitionCounter JSL.l StatTransitionCounter
+ +

View File

@@ -62,6 +62,6 @@ endmacro
%AddStat(DeathCounter, 0, 0, 08, 2, !DEATHS_X, !DEATHS_Y) %AddStat(DeathCounter, 0, 0, 08, 2, !DEATHS_X, !DEATHS_Y)
%AddStat(FaerieRevivalCounter, 0, 0, 08, 3, !FAERIE_REVIVALS_X, !FAERIE_REVIVALS_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(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(TotalItemCounter, 0, 0, 16, 3, !COLLECTION_RATE_X, !COLLECTION_RATE_Y)
%AddStat(NMIFrames, 1, 0, 32, 4, !TOTAL_TIME_X, !TOTAL_TIME_Y) %AddStat(NMIFrames, 1, 0, 32, 4, !TOTAL_TIME_X, !TOTAL_TIME_Y)

View File

@@ -65,7 +65,7 @@ RTL
;================================================================================ ;================================================================================
; $7E0348 - Ice Value ; $7E0348 - Ice Value
LoadModifiedIceFloorValue_a11: 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 $5D : CMP.b #$01 : BEQ + : CMP.b #$17 : BEQ + : CMP.b #$1C : BEQ +
LDA.b $5E : CMP.b #$02 : BEQ + LDA.b $5E : CMP.b #$02 : BEQ +
LDA.b $5B : BNE + LDA.b $5B : BNE +
@@ -73,7 +73,7 @@ LoadModifiedIceFloorValue_a11:
+ : LDA.w $0348 : AND.b #$11 + : LDA.w $0348 : AND.b #$11
RTL RTL
LoadModifiedIceFloorValue_a01: 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 $5D : CMP.b #$01 : BEQ + : CMP.b #$17 : BEQ + : CMP.b #$1C : BEQ +
LDA.b $5E : CMP.b #$02 : BEQ + LDA.b $5E : CMP.b #$02 : BEQ +
LDA.b $5B : BNE + LDA.b $5B : BNE +
@@ -116,7 +116,7 @@ GetSmithSword:
LDA.b #$7A LDA.b #$7A
LDY.b #$01 LDY.b #$01
JSL.l Sprite_ShowMessageUnconditional JSL.l Sprite_ShowMessageUnconditional
LDA.b #$3C : STA $012E ; error sound LDA.b #$3C : STA.w $012E ; error sound
SEP #$10 SEP #$10
BRA .done BRA .done
@@ -144,7 +144,7 @@ CheckMedallionSword:
LDA.b $1B : BEQ .outdoors LDA.b $1B : BEQ .outdoors
.indoors .indoors
REP #$20 ; set 16-bit accumulator REP #$20 ; set 16-bit accumulator
LDA.b $A0 ; load room ID LDA.b RoomIndex ; load room ID
CMP.w #$000E : BNE + ; freezor1 CMP.w #$000E : BNE + ; freezor1
LDA.b $22 : AND.w #$01FF ; check x-coord LDA.b $22 : AND.w #$01FF ; check x-coord
CMP.w #368-8 : !BLT .normal CMP.w #368-8 : !BLT .normal

View File

@@ -95,8 +95,6 @@ org $06B55C ; PC 0x3355C ; sprite_smithy_bros.asm : 634
SmithSword: SmithSword:
db #$02 ; #$02 = Tempered Sword (default) 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) ; 0x18002B- 0x180030 (Unused)
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
@@ -1435,7 +1433,7 @@ db $04
;JSL Sprite_ShowMessageFromPlayerContact ; Inverted uses Sprite_ShowMessageFromPlayerContact ;JSL Sprite_ShowMessageFromPlayerContact ; Inverted uses Sprite_ShowMessageFromPlayerContact
;;--------------------------------------------------------------------------------- ;;---------------------------------------------------------------------------------
org $00886e ; <- Bank00.asm : 1050 (LDA Overworld_TileAttr, X) 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: Overworld_GetTileAttrAtLocation_continue:
;================================================================================ ;================================================================================
org $0DDBEC ; <- 6DBEC org $0DDBEC ; <- 6DBEC

View File

@@ -30,13 +30,10 @@ SetTabletItem:
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
SpawnTabletItem: SpawnTabletItem:
; JSL.l HeartPieceGet
;RTL
JSL.l LoadOutdoorValue JSL.l LoadOutdoorValue
PHA PHA
JSL.l PrepDynamicTile JSL.l PrepDynamicTile
LDA.b #$01 : STA.l ForceHeartSpawn : STA.l SkipHeartSave
JSL.l SetTabletItem JSL.l SetTabletItem
LDA.b #$EB LDA.b #$EB

View File

@@ -5,8 +5,8 @@ RenderCharSetColorExtended_init:
RenderCharSetColorExtended_close: RenderCharSetColorExtended_close:
stz.b Scrap0C stz.b Scrap0C
lda $010c lda.w $010c
sta $10 sta.b $10
rtl rtl
RenderCharSetColorExtended: RenderCharSetColorExtended:
@@ -33,7 +33,7 @@ RenderCharToMapExtended:
plx plx
lda.w #$0000 lda.w #$0000
sta.b Scrap00 sta.b Scrap00
lda #$007f lda.w #$007f
sta.b Scrap02 sta.b Scrap02
lda.w #$0000 lda.w #$0000
clc : adc.w #$0020 clc : adc.w #$0020

View File

@@ -2,7 +2,7 @@
; Tree Kid Fix ; Tree Kid Fix
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
org $06B12B ; <- 3312B - tree status set - 418 - LDA NpcFlagsVanilla : ORA.b #$08 : STA NpcFlagsVanilla 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 org $06B072 ; <- 33072 - FluteAardvark_InitialStateFromFluteState - 418 : dw FluteAardvark_AlreadyArborated
db #$8B db #$8B

View File

@@ -567,7 +567,7 @@ RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
; HexToDec ; HexToDec
; in: A(w) - Word to Convert ; in: A(w) - Word to Convert
; out: $7F5004 - $7F5007 (high - low) ; out: HexToDecDigit1 - HexToDecDigit5 (high - low)
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
HexToDec: HexToDec:
PHA PHA
@@ -592,8 +592,8 @@ HexToDec:
INC.b Scrap07 INC.b Scrap07
!SUB.w #1 : BRA - !SUB.w #1 : BRA -
+ +
LDA.b Scrap04 : STA.l $7F5004 ; move to digit storage LDA.b Scrap04 : STA.l HexToDecDigit2 ; move to digit storage
LDA.b Scrap06 : STA.l $7F5006 LDA.b Scrap06 : STA.l HexToDecDigit4
PLA PLA
RTL RTL
@@ -626,33 +626,33 @@ db #00, #01, #01, #02, #01, #02, #02, #03, #01, #02, #02, #03, #02, #03, #03, #0
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
; HexToDec ; HexToDec
; in: A(w) - Word to Convert ; in: A(w) - Word to Convert
; out: $7F5003 - $7F5007 (high - low) ; out: HexToDecDigit1 - HexToDecDigit5 (high - low)
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
;HexToDec: ;HexToDec:
; PHA ; PHA
; PHA ; PHA
; LDA.w #$9090 ; 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 ; PLA
; - ; -
; CMP.w #10000 : !BLT + ; 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 - ; !SUB.w #10000 : BRA -
; + - ; + -
; CMP.w #1000 : !BLT + ; 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 - ; !SUB.w #1000 : BRA -
; + - ; + -
; CMP.w #100 : !BLT + ; 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 - ; !SUB.w #100 : BRA -
; + - ; + -
; CMP.w #10 : !BLT + ; 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 - ; !SUB.w #10 : BRA -
; + - ; + -
; CMP.w #1 : !BLT + ; 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 - ; !SUB.w #1 : BRA -
; + ; +
; PLA ; PLA

View File

@@ -94,6 +94,9 @@ Sprite_ShowMessageUnconditional:
org $05EC96 org $05EC96
Sprite_ZeldaLong: Sprite_ZeldaLong:
org $05F0C0
Sprite_EB_HeartPiece_handle_flags:
org $0680FA org $0680FA
Player_ApplyRumbleToSprites: Player_ApplyRumbleToSprites:

View File

@@ -6,7 +6,7 @@ LoadZoraKingItemGFX:
JML.l PrepDynamicTile JML.l PrepDynamicTile
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
JumpToSplashItemTarget: JumpToSplashItemTarget:
LDA $0D90, X LDA.w $0D90, X
CMP.b #$FF : BNE + : JML.l SplashItem_SpawnSplash : + CMP.b #$FF : BNE + : JML.l SplashItem_SpawnSplash : +
CMP.b #$00 : JML.l SplashItem_SpawnOther CMP.b #$00 : JML.l SplashItem_SpawnOther
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------

View File

@@ -1,14 +1,14 @@
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
CheckZSNES: CheckZSNES:
SEP #$28 SEP #$28
LDA #$FF LDA.b #$FF
CLC CLC
ADC #$FF ADC.b #$FF
CMP #$64 CMP.b #$64
CLD CLD
BEQ .zsnes BEQ .zsnes
REP #$20 REP #$20
LDA #$01FF : TCS ; thing we wrote over - initialize stack LDA.w #$01FF : TCS ; thing we wrote over - initialize stack
JML.l ReturnCheckZSNES JML.l ReturnCheckZSNES
.zsnes .zsnes
JML DontUseZSNES JML DontUseZSNES