Merge branch 'main' into kara

This commit is contained in:
2022-07-23 16:47:01 -07:00
75 changed files with 2878 additions and 1786 deletions

View File

@@ -9,7 +9,6 @@ lorom
;db #$23, $4E ;db #$23, $4E
org $00FFD5 ; <- 7FD5 - Bank00.asm : 9175 (db $20 ; rom layout) org $00FFD5 ; <- 7FD5 - Bank00.asm : 9175 (db $20 ; rom layout)
;db #$35 ; set fast exhirom
db #$30 ; set fast lorom db #$30 ; set fast lorom
;org $00FFD6 ; <- 7FD6 - Bank00.asm : 9176 (db $02 ; cartridge type) ;org $00FFD6 ; <- 7FD6 - Bank00.asm : 9176 (db $02 ; cartridge type)
@@ -29,7 +28,7 @@ db #$20, #$19, #$08, #$31 ; year/month/day
;================================================================================ ;================================================================================
!ROM_VERSION_LOW ?= 1 ; ROM version (two 16-bit integers) !ROM_VERSION_LOW ?= 1 ; ROM version (two 16-bit integers)
!ROM_VERSION_HIGH ?= 1 ; !ROM_VERSION_HIGH ?= 2 ;
org $00FFE0 ; Unused hardware vector org $00FFE0 ; Unused hardware vector
RomVersion: RomVersion:
@@ -43,39 +42,7 @@ dw !ROM_VERSION_HIGH
!BLT = "BCC" !BLT = "BCC"
!BGE = "BCS" !BGE = "BCS"
; Rando Specific SRAM assignments
!SHOP_PURCHASE_COUNTS = "$7EF302" ;$7EF302 - $7EF33F (temporary home)
!INVENTORY_SWAP = "$7EF38C"
!INVENTORY_SWAP_2 = "$7EF38E"
!WEAPON_LEVEL = "$7EF38F"
!ITEM_LIMIT_COUNTS = "$7EF390" ; $7EF390 - ????
!NPC_FLAGS = "$7EF410"
!NPC_FLAGS_2 = "$7EF411"
!MAP_OVERLAY = "$7EF414" ; [w]
!PROGRESSIVE_SHIELD = "$7EF416" ; ss-- ----
!HUD_FLAG = "$7EF416" ; --h- ----
!FORCE_PYRAMID = "$7EF416" ; ---- p---
!IGNORE_FAIRIES = "$7EF416" ; ---- -i--
!SHAME_CHEST = "$7EF416" ; ---s ----
!HAS_GROVE_ITEM = "$7EF416" ; ---- ---g general flags, don't waste these
!HIGHEST_SWORD_LEVEL = "$7EF417" ; --- -sss
;$7EF41A[w] - Programmable Item #1
;$7EF41C[w] - Programmable Item #2
;$7EF41E[w] - Programmable Item #3
!SRAM_SINK = "$7EF41E" ; <- change this (conflicts with Programmable item 3)
;$7EF418 - Goal Item Counter
;$7EF419 - Service Sequence
;$7EF420 - $7EF46D - Stat Tracking Bank 1 (overlaps with RNG Item Flags)
;$7EF450 - $7EF45F - RNG Item (Single) Flags
;$7EF4A0 - $7EF4A7 - Service Request Block
!FRESH_FILE_MARKER = "$7EF4F0" ; zero if fresh file
;$700500 - $70050F - Extended File Name
;$701000 - $70100F - Password (incorporate into log header)
;$702000 - $702014 - Rom title copy (incorporate into log header)
!MS_GOT = "$7F5031" !MS_GOT = "$7F5031"
!DARK_WORLD = "$7EF3CA"
!REDRAW = "$7F5000" !REDRAW = "$7F5000"
!GANON_WARP_CHAIN = "$7F5032"; !GANON_WARP_CHAIN = "$7F5032";
@@ -116,6 +83,8 @@ incsrc treekid.asm
incsrc spriteswap.asm incsrc spriteswap.asm
incsrc hashalphabethooks.asm incsrc hashalphabethooks.asm
incsrc sharedplayerpalettefix.asm incsrc sharedplayerpalettefix.asm
incsrc ram.asm
incsrc sram.asm
;org $208000 ; bank #$20 ;org $208000 ; bank #$20
org $A08000 ; bank #$A0 org $A08000 ; bank #$A0
@@ -129,7 +98,6 @@ incsrc heartpieces.asm
incsrc npcitems.asm incsrc npcitems.asm
incsrc utilities.asm incsrc utilities.asm
incsrc flipperkill.asm incsrc flipperkill.asm
incsrc previewdatacopy.asm
incsrc pendantcrystalhud.asm incsrc pendantcrystalhud.asm
incsrc potions.asm incsrc potions.asm
incsrc shopkeeper.asm incsrc shopkeeper.asm
@@ -187,6 +155,11 @@ org $A1A000 ; static mapping area. Referenced by front end. Do not move.
incsrc invertedstatic.asm incsrc invertedstatic.asm
warnpc $A1A100 warnpc $A1A100
org $A1B000
incsrc failure.asm
warnpc $A1FF00
org $A1FF00 ; static mapping area org $A1FF00 ; static mapping area
incsrc init.asm incsrc init.asm
@@ -194,7 +167,6 @@ org $A48000 ; code bank - PUT NEW CODE HERE
incsrc glitched.asm incsrc glitched.asm
incsrc hardmode.asm incsrc hardmode.asm
incsrc goalitem.asm incsrc goalitem.asm
incsrc openmode.asm
incsrc quickswap.asm incsrc quickswap.asm
incsrc endingsequence.asm incsrc endingsequence.asm
incsrc cuccostorm.asm incsrc cuccostorm.asm
@@ -379,20 +351,21 @@ warnpc $B08000
;$7E021B[0x1]: Used by race game instead of $0ABF to avoid witch item conflict ;$7E021B[0x1]: Used by race game instead of $0ABF to avoid witch item conflict
;$7EC900[0x1F00]: BIGRAM buffer ;$7EC900[0x1F00]: BIGRAM buffer
;$7EF000[0x500]: SRAM mirror First 0x500 bytes of SRAM ;$7EF000[0x500]: SRAM mirror First 0x500 bytes of SRAM
; See sram.asm for labels and assignments
;$7F5000[0x800]: Rando's main free ram region ;$7F5000[0x800]: Rando's main free ram region
; See tables.asm for specific assignments ; See tables.asm for specific assignments
;$7F6000[0x500]: Free RAM (reclaimed from damage table) Not allocated yet ;$7F6000[0x1000]: SRAM buffer mapped to vanilla save slots 1 and 2
;$7F6500[0xB00]: SRAM mirror for last 0xB00 bytes of SRAM (extended sram) ; See sram.asm for labels and assignments
;$7F7667[0x6719] - free ram ;$7F7667[0x6719] - free ram
;================================================================================ ;================================================================================
;SRAM Map ;SRAM Map
;$70:0000 ( 4K) Game state ;See sram.asm for rando-specific assignments
; 0000-04FF Vanilla Slot 1 (mirrored at 0x7EF000) ;$70:0000 (5K) Game state
; See earlier in this file for rando specific assignments ; 0000-04FF Vanilla Slot 1 (mirrored at $7EF000)
; 0500-0FFF Ext Slot 1 (not yet mirrored) ; 0500-14FF Ext Slot 1 (mirrored at $7F6000)
; See earlier in this file for rando specific assignments ;$70:2000 (0x25) ROM Name and version number
;$70:1000 (20K) Log entries ;$70:3000 (0x16) Password
;$70:6000 ( 8K) Scratch buffers ;$70:6000 (8K) Scratch buffers
;================================================================================ ;================================================================================
;org $0080DC ; <- 0xDC - Bank00.asm:179 - Kill Music ;org $0080DC ; <- 0xDC - Bank00.asm:179 - Kill Music
;db #$A9, #$00, #$EA ;db #$A9, #$00, #$EA
@@ -642,6 +615,13 @@ OverworldMap_DarkWorldTilemap:
org $0ABAB9 org $0ABAB9
OverworldMap_LoadSprGfx: OverworldMap_LoadSprGfx:
org $0CD7D1
NameFile_MakeScreenVisible:
org $0CDB3E
InitializeSaveFile:
org $0CDBC0
InitializeSaveFile_build_checksum:
org $0DBA71 org $0DBA71
GetRandomInt: GetRandomInt:

View File

@@ -54,7 +54,7 @@ GiveBonkItem:
CMP #$24 : BNE .notKey CMP #$24 : BNE .notKey
.key .key
PHY : LDY.b #$24 : JSL.l AddInventory : PLY ; do inventory processing for a small key PHY : LDY.b #$24 : JSL.l AddInventory : PLY ; do inventory processing for a small key
LDA $7EF36F : INC A : STA $7EF36F LDA CurrentSmallKeys : INC A : STA CurrentSmallKeys
LDA.b #$2F : JSL.l Sound_SetSfx3PanLong LDA.b #$2F : JSL.l Sound_SetSfx3PanLong
JSL CountBonkItem JSL CountBonkItem
RTL RTL
@@ -74,4 +74,4 @@ LoadBonkItem:
+ +
LDA.b #$24 ; default to small key LDA.b #$24 ; default to small key
++ ++
RTS RTS

View File

@@ -1,19 +1,18 @@
;================================================================================ ;================================================================================
; Boots State Modifier ; Boots State Modifier
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
!BOOTS_MODIFIER = "$7F50CE"
ModifyBoots: ModifyBoots:
PHA PHA
LDA !BOOTS_MODIFIER : CMP.b #$01 : BNE + LDA BootsModifier : CMP.b #$01 : BNE +
PLA : AND $7EF379 : ORA.b #$04 : RTL ; yes boots PLA : AND AbilityFlags : ORA.b #$04 : RTL ; yes boots
+ : CMP.b #$02 : BNE + + : CMP.b #$02 : BNE +
PLA : AND $7EF379 : AND.b #$FB : RTL ; no boots PLA : AND AbilityFlags : AND.b #$FB : RTL ; no boots
+ : LDA FakeBoots : CMP.b #$01 : BNE + + : LDA FakeBoots : CMP.b #$01 : BNE +
LDA $5B : BEQ ++ : LDA $59 : BNE + ; hover check LDA $5B : BEQ ++ : LDA $59 : BNE + ; hover check
++ : PLA : AND $7EF379 : ORA.b #$04 : RTL ; yes boots, not hovering ++ : PLA : AND AbilityFlags : ORA.b #$04 : RTL ; yes boots, not hovering
+ +
PLA PLA
AND $7EF379 ; regular boots AND AbilityFlags ; regular boots
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
AddBonkTremors: AddBonkTremors:
@@ -21,8 +20,8 @@ AddBonkTremors:
LDA $46 : BNE + ; Check for incapacitated Link LDA $46 : BNE + ; Check for incapacitated Link
JSL.l IncrementBonkCounter JSL.l IncrementBonkCounter
+ +
LDA !BOOTS_MODIFIER : CMP.b #$01 : BEQ + LDA BootsModifier : CMP.b #$01 : BEQ +
LDA $7EF355 : BNE + ; Check for Boots LDA BootsEquipment : BNE + ; Check for Boots
PLA : RTL PLA : RTL
+ +
PLA PLA
@@ -32,8 +31,8 @@ RTL
BonkBreakableWall: BonkBreakableWall:
PHX : PHP PHX : PHP
SEP #$30 ; set 8-bit accumulator and index registers SEP #$30 ; set 8-bit accumulator and index registers
LDA !BOOTS_MODIFIER : CMP.b #$01 : BEQ + LDA BootsModifier : CMP.b #$01 : BEQ +
LDA $7EF355 : BNE + ; Check for Boots LDA BootsEquipment : BNE + ; Check for Boots
PLP : PLX : LDA.w #$0000 : RTL PLP : PLX : LDA.w #$0000 : RTL
+ +
PLP : PLX PLP : PLX
@@ -41,16 +40,16 @@ BonkBreakableWall:
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
BonkRockPile: BonkRockPile:
LDA !BOOTS_MODIFIER : CMP.b #$01 : BEQ + LDA BootsModifier : CMP.b #$01 : BEQ +
LDA $7EF355 : BNE + ; Check for Boots LDA BootsEquipment : BNE + ; Check for Boots
LDA.b #$00 : RTL LDA.b #$00 : RTL
+ +
LDA $02EF : AND.b #$70 ; things we wrote over LDA $02EF : AND.b #$70 ; things we wrote over
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
GravestoneHook: GravestoneHook:
LDA !BOOTS_MODIFIER : CMP.b #$01 : BEQ + LDA BootsModifier : CMP.b #$01 : BEQ +
LDA $7EF355 : BEQ .done ; Check for Boots LDA BootsEquipment : BEQ .done ; Check for Boots
+ +
LDA $0372 : BEQ .done ; things we wrote over LDA $0372 : BEQ .done ; things we wrote over
JML.l moveGravestone JML.l moveGravestone
@@ -58,8 +57,8 @@ GravestoneHook:
JML.l GravestoneHook_continue JML.l GravestoneHook_continue
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
JumpDownLedge: JumpDownLedge:
LDA !BOOTS_MODIFIER : CMP.b #$01 : BEQ + LDA BootsModifier : CMP.b #$01 : BEQ +
LDA $7EF355 : BNE + ; Check for Boots LDA BootsEquipment : BNE + ; Check for Boots
; Disarm Waterwalk ; Disarm Waterwalk
LDA $5B : CMP.b #$01 : BNE + LDA $5B : CMP.b #$01 : BNE +
STZ $5B STZ $5B
@@ -69,8 +68,8 @@ JumpDownLedge:
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
BonkRecoil: BonkRecoil:
LDA !BOOTS_MODIFIER : CMP.b #$01 : BEQ + LDA BootsModifier : CMP.b #$01 : BEQ +
LDA $7EF355 : BNE + ; Check for Boots LDA BootsEquipment : BNE + ; Check for Boots
LDA.b #$16 : STA $29 : RTL LDA.b #$16 : STA $29 : RTL
+ +
LDA.b #$24 : STA $29 ; things we wrote over LDA.b #$24 : STA $29 ; things we wrote over

71
bsodencode.txt Normal file
View File

@@ -0,0 +1,71 @@
=00
A=01
a=01
B=02
b=02
C=03
c=03
D=04
d=04
E=05
e=05
F=06
f=06
G=07
g=07
H=08
h=08
I=09
i=09
J=0A
j=0A
K=0B
k=0B
L=0C
l=0C
M=0D
m=0D
N=0E
n=0E
O=0F
o=0F
P=10
p=10
Q=11
q=11
R=12
r=12
S=13
s=13
T=14
t=14
U=15
u=15
V=16
v=16
W=17
w=17
X=18
x=18
Y=19
y=19
Z=1A
z=1A
0=1B
1=1C
2=1D
3=1E
4=1F
5=20
6=21
7=22
8=23
9=24
.=25
#=26
?=27
-=28
/=29
,=2A
'=2B
;=2C

BIN
bsodfont.1bpp Normal file

Binary file not shown.

BIN
bsodhex.2bpp Normal file

Binary file not shown.

View File

@@ -2,8 +2,8 @@
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
AssignKiki: AssignKiki:
LDA.b #$00 : STA $7EF3D3 ; defuse bomb LDA.b #$00 : STA FollowerDropped ; defuse bomb
LDA.b #$0A : STA $7EF3CC ; assign kiki as follower LDA.b #$0A : STA FollowerIndicator ; assign kiki as follower
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
@@ -13,7 +13,7 @@ RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
!ITEM_BUSY = "$7F5091" !ITEM_BUSY = "$7F5091"
AllowSQ: AllowSQ:
LDA $7EF3C5 : BEQ .done ; thing we overwrote - check if link is in his bed LDA ProgressIndicator : BEQ .done ; thing we overwrote - check if link is in his bed
LDA !ITEM_BUSY : EOR #$01 LDA !ITEM_BUSY : EOR #$01
.done .done
RTL RTL
@@ -32,8 +32,8 @@ RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
;0 = Become (Perma)bunny ;0 = Become (Perma)bunny
DecideIfBunny: DecideIfBunny:
LDA $7EF357 : BNE .done LDA MoonPearlEquipment : BNE .done
LDA $7EF3CA : AND.b #$40 LDA CurrentWorld : AND.b #$40
PHA : LDA.l InvertedMode : BNE .inverted PHA : LDA.l InvertedMode : BNE .inverted
.normal .normal
PLA : EOR #$40 PLA : EOR #$40
@@ -48,7 +48,7 @@ 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 $1B : BNE .done
LDA $7EF357 : BNE .done LDA MoonPearlEquipment : BNE .done
LDA $8A : AND.b #$40 : PHA LDA $8A : AND.b #$40 : PHA
LDA.l InvertedMode : BNE .inverted LDA.l InvertedMode : BNE .inverted
.normal .normal
@@ -63,7 +63,7 @@ RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
;ReadInventoryPond: ;ReadInventoryPond:
; CPX.b #$1B : BNE + : LDA.b #$01 : RTL : + ; CPX.b #$1B : BNE + : LDA.b #$01 : RTL : +
; LDA $7EF340, X ; LDA EquipmentWRAM, X
;RTL ;RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
@@ -83,10 +83,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 !DARK_WORLD ; Switch to light world LDA.b #$00 : STA CurrentWorld ; Switch to light world
BRA ++ BRA ++
+++ +++
LDA.b #$40 : STA !DARK_WORLD ; Switch to dark world LDA.b #$40 : STA CurrentWorld ; Switch to dark world
++ ++
JSL DecideIfBunny : BNE + JSL DecideIfBunny : BNE +
JSR MakeBunny JSR MakeBunny
@@ -112,15 +112,15 @@ RTS
; fix issue where cross world caves (in Entrance randomizer) don't cause ; fix issue where cross world caves (in Entrance randomizer) don't cause
; frog to become smith or vice versa. ; frog to become smith or vice versa.
FixFrogSmith: FixFrogSmith:
LDA.l $7EF3CA : BNE .darkWorld LDA.l CurrentWorld : BNE .darkWorld
LDA.l $7EF3CC : CMP.b #$07 : BNE .done LDA.l FollowerIndicator : CMP.b #$07 : BNE .done
LDA.b #$08 ; make frog into smith in light world LDA.b #$08 ; make frog into smith in light world
BRA .loadgfx BRA .loadgfx
.darkWorld .darkWorld
LDA.l $7EF3CC : CMP.b #$08 : BNE .done LDA.l FollowerIndicator : CMP.b #$08 : BNE .done
LDA.b #$07 ; make smith into frog in dark world LDA.b #$07 ; make smith into frog in dark world
.loadgfx .loadgfx
STA.l $7EF3CC STA.l FollowerIndicator
JSL Tagalong_LoadGfx JSL Tagalong_LoadGfx
.done .done
RTS RTS
@@ -158,8 +158,8 @@ WallmasterCameraFix:
; Fix losing glove colors ; Fix losing glove colors
LoadActualGearPalettesWithGloves: LoadActualGearPalettesWithGloves:
REP #$20 REP #$20
LDA $7EF359 : STA $0C LDA SwordEquipment : STA $0C
LDA $7EF35B : AND.w #$00FF LDA ArmorEquipment : AND.w #$00FF
JSL LoadGearPalettes_variable JSL LoadGearPalettes_variable
JSL SpriteSwap_Palette_ArmorAndGloves_part_two JSL SpriteSwap_Palette_ArmorAndGloves_part_two
RTL RTL
@@ -214,7 +214,12 @@ FixJingleGlitch:
.exit .exit
RTL RTL
;--------------------------------------------------------------------------------
; Fix spawning with more hearts than capacity when less than 3 heart containers
pushpc
org $09F4AC ; <- module_death.asm:331
db $08, $08, $10
pullpc
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
SetOverworldTransitionFlags: SetOverworldTransitionFlags:
LDA #$01 LDA #$01

View File

@@ -1,43 +1,37 @@
;================================================================================ ;================================================================================
; Capacity Logic ; Capacity Logic
;================================================================================ ;================================================================================
!BOMB_UPGRADES = "$7EF370"
!BOMB_CURRENT = "$7EF343"
;--------------------------------------------------------------------------------
IncrementBombs: IncrementBombs:
LDA !BOMB_UPGRADES ; get bomb upgrades LDA BombCapacityUpgrades ; get bomb upgrades
!ADD.l StartingMaxBombs : BEQ + ; Skip if we can't have bombs !ADD.l StartingMaxBombs : BEQ + ; Skip if we can't have bombs
DEC DEC
CMP !BOMB_CURRENT CMP BombsEquipment
!BLT + !BLT +
LDA !BOMB_CURRENT LDA BombsEquipment
CMP.b #99 : !BGE + CMP.b #99 : !BGE +
INC : STA !BOMB_CURRENT INC : STA BombsEquipment
+ +
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
!ARROW_UPGRADES = "$7EF371"
!ARROW_CURRENT = "$7EF377"
;--------------------------------------------------------------------------------
IncrementArrows: IncrementArrows:
LDA !ARROW_UPGRADES ; get arrow upgrades LDA ArrowCapacityUpgrades ; get arrow upgrades
!ADD.l StartingMaxArrows : DEC !ADD.l StartingMaxArrows : DEC
CMP !ARROW_CURRENT CMP CurrentArrows
!BLT + !BLT +
LDA !ARROW_CURRENT LDA CurrentArrows
CMP.b #99 : !BGE + CMP.b #99 : !BGE +
INC : STA !ARROW_CURRENT INC : STA CurrentArrows
+ +
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
CompareBombsToMax: CompareBombsToMax:
LDA !BOMB_UPGRADES ; get bomb upgrades LDA BombCapacityUpgrades ; get bomb upgrades
!ADD.l StartingMaxBombs !ADD.l StartingMaxBombs
CMP !BOMB_CURRENT CMP BombsEquipment
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------

View File

@@ -1,16 +1,6 @@
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
; $7F5010 - Scratch Space ; $7F5010 - Scratch Space
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
; The number of items in a dungeon never changes. use this macro instead of
; HexToDec when drawing the "??/XX" item counter
; %DrawConstantNumber(1,4) draws 14
;--------------------------------------------------------------------------------
macro DrawConstantNumber(digit1,digit2)
LDA.w #$2490+<digit1> : STA $7EC79A
LDA.w #$2490+<digit2> : STA $7EC79C
SEP #$20
endmacro
;--------------------------------------------------------------------------------
DrawDungeonCompassCounts: DrawDungeonCompassCounts:
LDX $1B : BNE + : RTL : + ; Skip if outdoors LDX $1B : BNE + : RTL : + ; Skip if outdoors
@@ -23,16 +13,27 @@ DrawDungeonCompassCounts:
CPX.b #$1B : BCS .done ; Skip if not in a valid dungeon ID CPX.b #$1B : BCS .done ; Skip if not in a valid dungeon ID
CMP.w #$0002 : BEQ ++ ; if CompassMode==2, we don't check for the compass CMP.w #$0002 : BEQ ++ ; if CompassMode==2, we don't check for the compass
LDA $7EF364 : AND.l DungeonItemMasks, X ; Load compass values to A, mask with dungeon item masks LDA CompassField : AND.l DungeonItemMasks, X ; Load compass values to A, mask with dungeon item masks
BEQ .done ; skip if we don't have compass BEQ .done ; skip if we don't have compass
++ ++
JMP (CompassCountDungeonHandlers, X) : .return_spot TXA : LSR : TAX
BNE +
; we switch to 8-bit A in the jump before this INC
+
LDA.l CompassTotalsWRAM, X : AND #$00FF
SEP #$20
JSR HudHexToDec2Digit
REP #$20
PHX
LDX.b $06 : TXA : ORA #$2400 : STA $7EC79A
LDX.b $07 : TXA : ORA #$2400 : STA $7EC79C
PLX
LDA DungeonLocationsChecked, X : AND #$00FF
SEP #$20
JSR HudHexToDec2Digit JSR HudHexToDec2Digit
REP #$20 REP #$20
LDX.b $06 : TXA : ORA #$2400 : STA $7EC794 ; Draw the item count LDX.b $06 : TXA : ORA #$2400 : STA $7EC794 ; Draw the item count
LDX.b $07 : TXA : ORA #$2400 : STA $7EC796 LDX.b $07 : TXA : ORA #$2400 : STA $7EC796
@@ -44,103 +45,12 @@ RTL
DungeonItemMasks: ; these are dungeon correlations to $7EF364 - $7EF369 so it knows where to store compasses, etc DungeonItemMasks: ; these are dungeon correlations to $7EF364 - $7EF369 so it knows where to store compasses, etc
dw $8000, $4000, $2000, $1000, $0800, $0400, $0200, $0100 dw $8000, $4000, $2000, $1000, $0800, $0400, $0200, $0100
dw $0080, $0040, $0020, $0010, $0008, $0004 dw $0080, $0040, $0020, $0010, $0008, $0004
CompassCountDungeonHandlers: ; pointers to functions that handle dungeon-specific code
dw CompassCount_Escape, CompassCount_Escape ; (hyrule castle, sewers)
dw CompassCount_Eastern, CompassCount_Desert, CompassCount_Agah
dw CompassCount_Swamp, CompassCount_PoD, CompassCount_Mire
dw CompassCount_Skull, CompassCount_Ice, CompassCount_Hera
dw CompassCount_Thieves, CompassCount_Trock, CompassCount_Gt
}
CompassCount_Escape:
%DrawConstantNumber(0,8)
LDA $7EF434 : LSR #4
JMP DrawDungeonCompassCounts_return_spot
CompassCount_Eastern:
%DrawConstantNumber(0,6)
LDA $7EF436 : AND.b #$07
JMP DrawDungeonCompassCounts_return_spot
CompassCount_Desert:
%DrawConstantNumber(0,6)
LDA $7EF435 : LSR #5
JMP DrawDungeonCompassCounts_return_spot
CompassCount_Agah:
%DrawConstantNumber(0,2)
LDA $7EF435 : AND.b #$03
JMP DrawDungeonCompassCounts_return_spot
CompassCount_Swamp:
%DrawConstantNumber(1,0)
LDA $7EF439 : AND.b #$0F
JMP DrawDungeonCompassCounts_return_spot
CompassCount_PoD:
%DrawConstantNumber(1,4)
LDA $7EF434 : AND.b #$0F
JMP DrawDungeonCompassCounts_return_spot
CompassCount_Mire:
%DrawConstantNumber(0,8)
LDA $7EF438 : AND.b #$0F
JMP DrawDungeonCompassCounts_return_spot
CompassCount_Skull:
%DrawConstantNumber(0,8)
LDA $7EF437 : LSR #4
JMP DrawDungeonCompassCounts_return_spot
CompassCount_Ice:
%DrawConstantNumber(0,8)
LDA $7EF438 : LSR #4
JMP DrawDungeonCompassCounts_return_spot
CompassCount_Hera:
%DrawConstantNumber(0,6)
LDA $7EF435 : AND.b #$1C : LSR #2
JMP DrawDungeonCompassCounts_return_spot
CompassCount_Thieves:
%DrawConstantNumber(0,8)
LDA $7EF437 : AND.b #$0F
JMP DrawDungeonCompassCounts_return_spot
CompassCount_Trock:
%DrawConstantNumber(1,2)
LDA $7EF439 : LSR #4
JMP DrawDungeonCompassCounts_return_spot
CompassCount_Gt:
%DrawConstantNumber(2,7)
LDA $7EF436 : LSR #3
JMP DrawDungeonCompassCounts_return_spot
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
; $7EF434 - hhhhdddd - item locations checked InitCompassTotalsRAM:
; h - hyrule castle/sewers LDX #$00
; d - palace of darkness -
;-------------------------------------------------------------------------------- LDA CompassTotalsROM, X : STA CompassTotalsWRAM, X
; $7EF435 - dddhhhaa - item locations checked INX
; d - desert palace CPX #$0F : !BLT -
; h - tower of hera RTL
; a - agahnim's tower
;--------------------------------------------------------------------------------
; $7EF436 - gggggeee - item locations checked
; g - ganon's tower
; e - eastern palace
;--------------------------------------------------------------------------------
; $7EF437 - sssstttt - item locations checked
; s - skull woods
; t - thieves town
;--------------------------------------------------------------------------------
; $7EF438 - iiiimmmm - item locations checked
; i - ice palace
; m - misery mire
;--------------------------------------------------------------------------------
; $7EF439 - ttttssss - item locations checked
; t - turtle rock
; s - swamp palace
;--------------------------------------------------------------------------------

View File

@@ -71,14 +71,13 @@
; ;
; PLX ; PLX
; ;
; LDA.b #$00 : STA $7EF3CC ; LDA.b #$00 : STA FollowerIndicator
; ;
; STZ $5E ; STZ $5E
; ;
; JML $09A6B6 ; <- 4A6B6 tagalong.asm:1194 (SEP #$30 : RTS) ; JML $09A6B6 ; <- 4A6B6 tagalong.asm:1194 (SEP #$30 : RTS)
;} ;}
;================================================================ ;================================================================
!MAP_OVERLAY = "$7EF414" ; [2]
Sprite_ShowSolicitedMessageIfPlayerFacing_Alt: Sprite_ShowSolicitedMessageIfPlayerFacing_Alt:
{ {
STA $1CF0 STA $1CF0
@@ -108,11 +107,11 @@ Sprite_ShowSolicitedMessageIfPlayerFacing_Alt:
BRA .SayNothing BRA .SayNothing
.SahasrahlaDialogs .SahasrahlaDialogs
REP #$20 : LDA.l MapReveal_Sahasrahla : ORA !MAP_OVERLAY : STA !MAP_OVERLAY : SEP #$20 REP #$20 : LDA.l MapReveal_Sahasrahla : ORA MapOverlay : STA MapOverlay : SEP #$20
JSL DialogSahasrahla : BRA .SayNothing JSL DialogSahasrahla : BRA .SayNothing
.BombShopGuyDialog .BombShopGuyDialog
REP #$20 : LDA.l MapReveal_BombShop : ORA !MAP_OVERLAY : STA !MAP_OVERLAY : SEP #$20 REP #$20 : LDA.l MapReveal_BombShop : ORA MapOverlay : STA MapOverlay : SEP #$20
JSL DialogBombShopGuy JSL DialogBombShopGuy
.SayNothing .SayNothing

View File

@@ -4,7 +4,6 @@
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
; Filtered Joypad 1 Register: [AXLR | ????] ; Filtered Joypad 1 Register: [AXLR | ????]
; Filtered Joypad 1 Register: [BYST | udlr] [AXLR | ????] ; Filtered Joypad 1 Register: [BYST | udlr] [AXLR | ????]
!INVERT_DPAD = "$7F50CB"
InvertDPad: InvertDPad:
LDA.l OneMindPlayerCount : BEQ .crowd_control LDA.l OneMindPlayerCount : BEQ .crowd_control
@@ -23,7 +22,7 @@ InvertDPad:
JML.l InvertDPadReturn JML.l InvertDPadReturn
.crowd_control .crowd_control
LDA !INVERT_DPAD : BNE + LDA InvertDPadModifier : BNE +
LDA $4218 : STA $00 LDA $4218 : STA $00
LDA $4219 : STA $01 LDA $4219 : STA $01

View File

@@ -1,5 +1,4 @@
;================================================================================ ;================================================================================
!CUCCO_STORM = "$7F50C5"
!IS_INDOORS = "$7E001B" !IS_INDOORS = "$7E001B"
!ENEMY_STATE_TABLE = "$7E0DD0" !ENEMY_STATE_TABLE = "$7E0DD0"
!ENEMY_TYPE_TABLE = "$7E0E20" !ENEMY_TYPE_TABLE = "$7E0E20"
@@ -22,9 +21,9 @@
CuccoStorm: CuccoStorm:
SEP #$30 ; set 8-bit accumulator index registers SEP #$30 ; set 8-bit accumulator index registers
LDA.l !CUCCO_STORM : BEQ + ; only if storm is on LDA.l CuccoStormModifier : BEQ + ; only if storm is on
LDA.b $10 : CMP.b #$09 : BNE + ; only if outdoors LDA.b $10 : CMP.b #$09 : BNE + ; only if outdoors
LDA.l !LOOP_FRAMES_LOW : AND.b #$7F : BNE + ; check every 128 frames LDA.l LoopFrames : AND.b #$7F : BNE + ; check every 128 frames
- -
;==== Find a Cucco ;==== Find a Cucco
@@ -72,4 +71,4 @@ CuccoStorm:
;==== ;====
+ +
RTL RTL
;================================================================================ ;================================================================================

View File

@@ -11,14 +11,14 @@ DoWorldFix:
JMP DoWorldFix_Inverted JMP DoWorldFix_Inverted
+ +
LDA.l Bugfix_MirrorlessSQToLW : BEQ .skip_mirror_check LDA.l Bugfix_MirrorlessSQToLW : BEQ .skip_mirror_check
LDA $7EF353 : BEQ .noMirror ; check if we have the mirror LDA MirrorEquipment : BEQ .noMirror ; check if we have the mirror
.skip_mirror_check ; alt entrance point .skip_mirror_check ; alt entrance point
LDA $7EF3C5 : CMP.b #$03 : BCS .done ; check if agahnim 1 is alive LDA ProgressIndicator : CMP.b #$03 : BCS .done ; check if agahnim 1 is alive
.aga1Alive .aga1Alive
LDA #$00 LDA #$00
.noMirror .noMirror
STA $7EF3CA ; set flag to light world STA CurrentWorld ; set flag to light world
LDA $7EF3CC : CMP #$07 : BNE .done : INC : STA $7EF3CC ; convert frog to dwarf LDA FollowerIndicator : CMP #$07 : BNE .done : INC : STA FollowerIndicator ; convert frog to dwarf
.done .done
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
@@ -39,25 +39,25 @@ JMP DoWorldFix
JMP DoWorldFix_skip_mirror_check JMP DoWorldFix_skip_mirror_check
.pyramid .pyramid
LDA #$40 : STA $7EF3CA ; set flag to dark world LDA #$40 : STA CurrentWorld ; set flag to dark world
LDA $7EF3CC : CMP #$08 : BNE .done : DEC : STA $7EF3CC : + ; convert dwarf to frog LDA FollowerIndicator : CMP #$08 : BNE .done : DEC : STA FollowerIndicator : + ; convert dwarf to frog
.done .done
RTL RTL
;================================================================================ ;================================================================================
DoWorldFix_Inverted: DoWorldFix_Inverted:
LDA.l Bugfix_MirrorlessSQToLW : BEQ .skip_mirror_check LDA.l Bugfix_MirrorlessSQToLW : BEQ .skip_mirror_check
LDA $7EF353 : BEQ .noMirror ; check if we have the mirror LDA MirrorEquipment : BEQ .noMirror ; check if we have the mirror
.skip_mirror_check ; alt entrance point .skip_mirror_check ; alt entrance point
LDA $7EF3C5 : CMP.b #$03 : BCS .done ; check if agahnim 1 is alive LDA ProgressIndicator : CMP.b #$03 : BCS .done ; check if agahnim 1 is alive
.noMirror .noMirror
.aga1Alive .aga1Alive
LDA #$40 : STA $7EF3CA ; set flag to dark world LDA #$40 : STA CurrentWorld ; set flag to dark world
LDA $7EF3CC LDA FollowerIndicator
CMP #$07 : BEQ .clear ; clear frog CMP #$07 : BEQ .clear ; clear frog
CMP #$08 : BEQ .clear ; clear dwarf - consider flute implications CMP #$08 : BEQ .clear ; clear dwarf - consider flute implications
BRA .done BRA .done
.clear .clear
LDA.b #$00 : STA $7EF3CC ; clear follower LDA.b #$00 : STA FollowerIndicator ; clear follower
.done .done
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
@@ -75,8 +75,8 @@ JMP DoWorldFix
JMP DoWorldFix_Inverted_skip_mirror_check JMP DoWorldFix_Inverted_skip_mirror_check
.castle .castle
LDA #$00 : STA $7EF3CA ; set flag to dark world LDA #$00 : STA CurrentWorld ; set flag to dark world
LDA $7EF3CC : CMP #$07 : BNE + : LDA.b #$08 : STA $7EF3CC : + ; convert frog to dwarf LDA FollowerIndicator : CMP #$07 : BNE + : LDA.b #$08 : STA FollowerIndicator : + ; convert frog to dwarf
.done .done
RTL RTL
;================================================================================ ;================================================================================
@@ -85,19 +85,19 @@ RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
FakeWorldFix: FakeWorldFix:
LDA FixFakeWorld : BEQ + LDA FixFakeWorld : BEQ +
LDA $8A : AND.b #$40 : STA $7EF3CA LDA $8A : AND.b #$40 : STA CurrentWorld
+ +
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
MasterSwordFollowerClear: MasterSwordFollowerClear:
LDA $7EF3CC LDA FollowerIndicator
CMP #$0E : BNE .exit ; clear master sword follower CMP #$0E : BNE .exit ; clear master sword follower
LDA.b #$00 : STA $7EF3CC ; clear follower LDA.b #$00 : STA FollowerIndicator ; clear follower
.exit .exit
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
FixAgahnimFollowers: FixAgahnimFollowers:
LDA.b #$00 : STA $7EF3CC ; clear follower LDA.b #$00 : STA FollowerIndicator ; clear follower
JML PrepDungeonExit ; thing we wrote over JML PrepDungeonExit ; thing we wrote over
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
@@ -107,56 +107,53 @@ macro SetMinimum(base,filler,compare)
?done: ?done:
endmacro endmacro
RefreshRainAmmo: RefreshRainAmmo:
LDA $7EF3C5 : CMP.b #$01 : BEQ .rain ; check if we're in rain state LDA ProgressIndicator : CMP.b #$01 : BEQ .rain ; check if we're in rain state
RTL RTL
.rain .rain
LDA $7EF3C8 LDA StartingEntrance
+ CMP.b #$03 : BNE + ; Uncle + CMP.b #$03 : BNE + ; Uncle
%SetMinimum($7EF36E,$7EF373,RainDeathRefillMagic_Uncle) %SetMinimum(CurrentMagic,MagicFiller,RainDeathRefillMagic_Uncle)
%SetMinimum($7EF343,$7EF375,RainDeathRefillBombs_Uncle) %SetMinimum(BombsEquipment,BombsFiller,RainDeathRefillBombs_Uncle)
%SetMinimum($7EF377,$7EF376,RainDeathRefillArrows_Uncle) %SetMinimum(CurrentArrows,ArrowsFiller,RainDeathRefillArrows_Uncle)
BRA .done BRA .done
+ CMP.b #$02 : BNE + ; Cell + CMP.b #$02 : BNE + ; Cell
%SetMinimum($7EF36E,$7EF373,RainDeathRefillMagic_Cell) %SetMinimum(CurrentMagic,MagicFiller,RainDeathRefillMagic_Cell)
%SetMinimum($7EF343,$7EF375,RainDeathRefillBombs_Cell) %SetMinimum(BombsEquipment,BombsFiller,RainDeathRefillBombs_Cell)
%SetMinimum($7EF377,$7EF376,RainDeathRefillArrows_Cell) %SetMinimum(CurrentArrows,ArrowsFiller,RainDeathRefillArrows_Cell)
BRA .done BRA .done
+ CMP.b #$04 : BNE + ; Mantle + CMP.b #$04 : BNE + ; Mantle
%SetMinimum($7EF36E,$7EF373,RainDeathRefillMagic_Mantle) %SetMinimum(CurrentMagic,MagicFiller,RainDeathRefillMagic_Mantle)
%SetMinimum($7EF343,$7EF375,RainDeathRefillBombs_Mantle) %SetMinimum(BombsEquipment,BombsFiller,RainDeathRefillBombs_Mantle)
%SetMinimum($7EF377,$7EF376,RainDeathRefillArrows_Mantle) %SetMinimum(CurrentArrows,ArrowsFiller,RainDeathRefillArrows_Mantle)
+ +
.done .done
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
!INFINITE_ARROWS = "$7F50C8"
!INFINITE_BOMBS = "$7F50C9"
!INFINITE_MAGIC = "$7F50CA"
SetEscapeAssist: SetEscapeAssist:
LDA $7EF3C5 : CMP.b #$01 : BNE .no_train ; check if we're in rain state LDA ProgressIndicator : CMP.b #$01 : BNE .no_train ; check if we're in rain state
.rain .rain
LDA.l EscapeAssist LDA.l EscapeAssist
BIT.b #$04 : BEQ + : STA !INFINITE_MAGIC : + BIT.b #$04 : BEQ + : STA InfiniteMagicModifier : +
BIT.b #$02 : BEQ + : STA !INFINITE_BOMBS : + BIT.b #$02 : BEQ + : STA InfiniteBombsModifier : +
BIT.b #$01 : BEQ + : STA !INFINITE_ARROWS : + BIT.b #$01 : BEQ + : STA InfiniteArrowsModifier : +
BRA ++ BRA ++
.no_train ; choo choo .no_train ; choo choo
LDA.l EscapeAssist LDA.l EscapeAssist
BIT.b #$40 : BEQ + : STA !INFINITE_MAGIC : + BIT.b #$40 : BEQ + : STA InfiniteMagicModifier : +
BIT.b #$20 : BEQ + : STA !INFINITE_BOMBS : + BIT.b #$20 : BEQ + : STA InfiniteBombsModifier : +
BIT.b #$10 : BEQ + : STA !INFINITE_ARROWS : + BIT.b #$10 : BEQ + : STA InfiniteArrowsModifier : +
++ ++
LDA.l SpecialWeapons : CMP #$01 : BNE + LDA.l SpecialWeapons : CMP #$01 : BNE +
LDA.l !WEAPON_LEVEL : BEQ + LDA.l SpecialWeaponLevel : BEQ +
LDA #$01 : STA !INFINITE_BOMBS LDA #$01 : STA InfiniteBombsModifier
+ +
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
SetSilverBowMode: SetSilverBowMode:
LDA SilverArrowsUseRestriction : BEQ + ; fix bow type for restricted arrow mode LDA SilverArrowsUseRestriction : BEQ + ; fix bow type for restricted arrow mode
LDA $7EF340 : CMP.b #$3 : BCC + LDA BowEquipment : CMP.b #$3 : BCC +
SBC.b #$02 : STA $7EF340 SBC.b #$02 : STA BowEquipment
+ +
RTL RTL
;================================================================================ ;================================================================================

View File

@@ -267,7 +267,8 @@ RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
DialogFairyThrow: DialogFairyThrow:
LDA.l Restrict_Ponds : BEQ .normal LDA.l Restrict_Ponds : BEQ .normal
LDA $7EF35C : ORA $7EF35D : ORA $7EF35E : ORA $7EF35F : BNE .normal LDA BottleContentsOne
ORA BottleContentsTwo : ORA BottleContentsThree : ORA BottleContentsFour : BNE .normal
.noInventory .noInventory
LDA $0D80, X : !ADD #$08 : STA $0D80, X LDA $0D80, X : !ADD #$08 : STA $0D80, X
@@ -294,7 +295,7 @@ RTL
; #$0193 - no silvers alternate ; #$0193 - no silvers alternate
; #$0194 - no silvers ; #$0194 - no silvers
; #$0195 - silvers ; #$0195 - silvers
; $7EF38E - bsp-- --- ; BowTracking - bsp-- ---
; b = bow ; b = bow
; s = silver arrow bow ; s = silver arrow bow
; p = 2nd progressive bow ; p = 2nd progressive bow
@@ -309,7 +310,7 @@ DialogGanon2:
LDA.l SpecialWeapons : AND.w #$00FF LDA.l SpecialWeapons : AND.w #$00FF
CMP.w #$0001 : BEQ .bombs ; bombs if special bomb mode CMP.w #$0001 : BEQ .bombs ; bombs if special bomb mode
.silver_arrows .silver_arrows
LDA.l $7EF38E LDA.l BowTracking
BIT.w #$0080 : BNE + ; branch if bow BIT.w #$0080 : BNE + ; branch if bow
LDA.w #$0192 : JMP .done LDA.w #$0192 : JMP .done
@@ -330,26 +331,26 @@ DialogGanon2:
CMP.w #$0005 : BEQ .powder CMP.w #$0005 : BEQ .powder
CMP.w #$0010 : BEQ .bee CMP.w #$0010 : BEQ .bee
PHX : TAX PHX : TAX
LDA.l $7EF33F, X : PLX : AND #$00FF : BNE + LDA.l EquipmentWRAM-1, X : PLX : AND #$00FF : BNE +
LDA.w #$0192 : JMP .done LDA.w #$0192 : JMP .done
+ +
LDA.w #$0195 : BRA .done LDA.w #$0195 : BRA .done
.bombs .bombs
LDA.l $7EF343 : AND #$00FF : BNE + LDA.l BombsEquipment : AND #$00FF : BNE +
LDA.l $7F50C9 : AND #$00FF : BNE + ; check for infinite bombs LDA.l InfiniteBombsModifier : AND #$00FF : BNE + ; check for infinite bombs
LDA.w #$0192 : BRA .done LDA.w #$0192 : BRA .done
+ +
LDA.w #$0195 : BRA .done LDA.w #$0195 : BRA .done
.powder .powder
LDA.l $7EF38C : AND #$0010 : BNE + LDA.l InventoryTracking : AND #$0010 : BNE + ; check for powder
LDA.w #$0192 : BRA .done LDA.w #$0192 : BRA .done
+ +
LDA.w #$0195 : BRA .done LDA.w #$0195 : BRA .done
.bee .bee
LDA.l $7EF35C : AND #$00FF : CMP.w #$0007 : BEQ + : CMP.w #$0008 : BEQ + LDA.l BottleContentsOne : AND #$00FF : CMP.w #$0007 : BEQ + : CMP.w #$0008 : BEQ +
LDA.l $7EF35D : AND #$00FF : CMP.w #$0007 : BEQ + : CMP.w #$0008 : BEQ + LDA.l BottleContentsTwo : AND #$00FF : CMP.w #$0007 : BEQ + : CMP.w #$0008 : BEQ +
LDA.l $7EF35E : AND #$00FF : CMP.w #$0007 : BEQ + : CMP.w #$0008 : BEQ + LDA.l BottleContentsThree : AND #$00FF : CMP.w #$0007 : BEQ + : CMP.w #$0008 : BEQ +
LDA.l $7EF35F : AND #$00FF : CMP.w #$0007 : BEQ + : CMP.w #$0008 : BEQ + LDA.l BottleContentsFour : AND #$00FF : CMP.w #$0007 : BEQ + : CMP.w #$0008 : BEQ +
LDA.w #$0192 : BRA .done LDA.w #$0192 : BRA .done
+ +
LDA.w #$0195 : BRA .done LDA.w #$0195 : BRA .done
@@ -398,7 +399,7 @@ DialogBombosTablet:
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
DialogSahasrahla: DialogSahasrahla:
LDA.l $7EF374 : AND #$04 : BEQ + ;Check if player has green pendant LDA.l PendantsField : AND #$04 : BEQ + ;Check if player has green pendant
LDA.b #$2F LDA.b #$2F
LDY.b #$00 LDY.b #$00
JML Sprite_ShowMessageUnconditional JML Sprite_ShowMessageUnconditional
@@ -407,7 +408,7 @@ RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
DialogBombShopGuy: DialogBombShopGuy:
LDY.b #$15 LDY.b #$15
LDA.l $7EF37A : AND #$05 : CMP #$05 : BNE + ;Check if player has crystals 5 & 6 LDA.l CrystalsField : AND #$05 : CMP #$05 : BNE + ;Check if player has crystals 5 & 6
INY ; from 15 to 16 INY ; from 15 to 16
+ +
TYA TYA
@@ -420,7 +421,7 @@ AgahnimAsksAboutPed:
LDA.l InvincibleGanon LDA.l InvincibleGanon
CMP.b #$06 : BNE .vanilla CMP.b #$06 : BNE .vanilla
LDA.l $7EF300 ; check ped flag LDA.l OverworldEventDataWRAM+$80 ; check ped flag
AND.b #$40 AND.b #$40
BNE .vanilla BNE .vanilla

View File

@@ -40,25 +40,30 @@ RTL
Elder_Code: Elder_Code:
{ {
LDA GoalItemRequirement : BEQ .despawn REP #$20
LDA InvincibleGanon : CMP #$05 : BEQ .despawn LDA.l GoalItemRequirement : BEQ .despawn
LDA TurnInGoalItems : BNE + LDA.l InvincibleGanon : AND.w #$00FF : CMP.w #$0005 : BEQ .despawn
LDA.l TurnInGoalItems : AND.w #$00FF : BNE +
.despawn .despawn
SEP #$20
STZ $0DD0, X ; despawn self STZ $0DD0, X ; despawn self
RTS RTS
+ +
SEP #$20
LDA.b #$96 LDA.b #$96
LDY.b #$01 LDY.b #$01
JSL Sprite_ShowSolicitedMessageIfPlayerFacing_PreserveMessage : BCC .dont_show JSL Sprite_ShowSolicitedMessageIfPlayerFacing_PreserveMessage : BCC .dont_show
LDA !GOAL_COUNTER REP #$20
CMP GoalItemRequirement : !BLT + LDA.l GoalCounter
CMP.l GoalItemRequirement : !BLT +
SEP #$20
JSL.l ActivateGoal JSL.l ActivateGoal
+ +
.dont_show .dont_show
.done .done
LDA $1A : LSR #5 : AND.b #$01 : STA $0DC0, X SEP #$20
LDA.b $1A : LSR #5 : AND.b #$01 : STA.w $0DC0, X
RTS RTS
} }

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 $7EF3C5 : AND.w #$000F : CMP.w #$0002 : !BGE .unlock ; if we rescued zelda, skip LDA 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
@@ -22,7 +22,7 @@ LockAgahnimDoors:
.crystalOrUnlock .crystalOrUnlock
LDA InvertedMode : AND.w #$00FF : BEQ .unlock LDA InvertedMode : AND.w #$00FF : BEQ .unlock
LDA $7EF2C3 : AND.w #$0020 : BNE .unlock ; Check if GT overlay is already on or not LDA OverworldEventDataWRAM+$43 : AND.w #$0020 : BNE .unlock ; Check if GT overlay is already on or not
LDA $0308 : AND.w #$0080 : BEQ ++ ;If we are holding an item LDA $0308 : AND.w #$0080 : BEQ ++ ;If we are holding an item
.locked .locked
@@ -44,7 +44,7 @@ RTL
FlagAgahnimDoor: FlagAgahnimDoor:
LDA.l InvertedMode : BEQ .vanilla LDA.l InvertedMode : BEQ .vanilla
LDA $7EF2C3 : ORA #$20 : STA $7EF2C3 ; activate GT overlay LDA OverworldEventDataWRAM+$43 : ORA #$20 : STA OverworldEventDataWRAM+$43 ; activate GT overlay
.vanilla .vanilla
LDA.b #$28 : STA.b $72 LDA.b #$28 : STA.b $72
@@ -77,7 +77,7 @@ JML.l Overworld_Entrance_BRANCH_RHO
AllowStartFromSingleEntranceCave: AllowStartFromSingleEntranceCave:
; 16 Bit A, 16 bit XY ; 16 Bit A, 16 bit XY
; do not need to preserve A or X or Y ; do not need to preserve A or X or Y
LDA $7EF3C8 : AND.w #$00FF ; What we wrote over LDA StartingEntrance : AND.w #$00FF ; What we wrote over
PHA PHA
TAX TAX
LDA.l StartingAreaExitOffset, X LDA.l StartingAreaExitOffset, X
@@ -124,7 +124,7 @@ AllowStartFromSingleEntranceCave:
STZ $0699 ;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
SEP #$20 ; set 8-bit accumulator SEP #$20 ; set 8-bit accumulator
LDA $7EF3C8 : TAX LDA StartingEntrance : TAX
LDA.l StartingAreaOverworldDoor, X : STA.l $7F5099 ;Load overworld door LDA.l StartingAreaOverworldDoor, X : STA.l $7F5099 ;Load overworld door
REP #$20 ; reset 16-bit accumulator REP #$20 ; reset 16-bit accumulator
JSL.l CacheDoorFrameData JSL.l CacheDoorFrameData
@@ -138,7 +138,7 @@ AllowStartFromExit:
LDX $1CE8 LDX $1CE8
LDA.l ShouldStartatExit, X : BNE .doStart LDA.l ShouldStartatExit, X : BNE .doStart
LDA.l $7EF3C8 ; what we wrote over LDA.l StartingEntrance ; what we wrote over
JML.l AllowStartFromExitReturn JML.l AllowStartFromExitReturn
.doStart .doStart
@@ -209,7 +209,7 @@ TurtleRockEntranceFix:
LDA TurtleRockAutoOpenFix : BEQ .done LDA TurtleRockAutoOpenFix : BEQ .done
LDA $8A : CMP.b #$47 : BNE .done LDA $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 $7EF2C7 : ORA.b #$20 : STA.l $7EF2C7 LDA.l OverworldEventDataWRAM+$47 : ORA.b #$20 : STA.l OverworldEventDataWRAM+$47
.done .done
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------

View File

@@ -2,7 +2,7 @@
; OnLoadOW ; OnLoadOW
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
;OnLoadMap: ;OnLoadMap:
; LDA $7EF2DB ; thing we wrote over ; LDA OverworldEventDataWRAM+$5B ; thing we wrote over
;RTL ;RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
OnPrepFileSelect: OnPrepFileSelect:
@@ -21,9 +21,10 @@ OnDrawHud:
JSL.l PollService JSL.l PollService
JML.l ReturnFromOnDrawHud JML.l ReturnFromOnDrawHud
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
;OnDungeonEntrance: OnDungeonEntrance:
; STA $7EC172 ; thing we wrote over STA $7EC172 ; thing we wrote over
;RTL JSL MaybeFlagCompassTotalEntrance
RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
OnPlayerDead: OnPlayerDead:
PHA PHA
@@ -58,36 +59,65 @@ OnUncleItemGet:
PHA PHA
LDA.l EscapeAssist LDA.l EscapeAssist
BIT.b #$04 : BEQ + : STA !INFINITE_MAGIC : + BIT.b #$04 : BEQ + : STA InfiniteMagicModifier : +
BIT.b #$02 : BEQ + : STA !INFINITE_BOMBS : + BIT.b #$02 : BEQ + : STA InfiniteBombsModifier : +
BIT.b #$01 : BEQ + : STA !INFINITE_ARROWS : + BIT.b #$01 : BEQ + : STA InfiniteArrowsModifier : +
PLA PLA
JSL Link_ReceiveItem JSL.l Link_ReceiveItem
LDA.l UncleRefill : BIT.b #$04 : BEQ + : LDA.b #$80 : STA $7EF373 : + ; refill magic LDA.l UncleRefill : BIT.b #$04 : BEQ + : LDA.b #$80 : STA.l MagicFiller : + ; refill magic
LDA.l UncleRefill : BIT.b #$02 : BEQ + : LDA.b #50 : STA $7EF375 : + ; refill bombs LDA.l UncleRefill : BIT.b #$02 : BEQ + : LDA.b #50 : STA.l BombsFiller : + ; refill bombs
LDA.l UncleRefill : BIT.b #$01 : BEQ + ; refill arrows LDA.l UncleRefill : BIT.b #$01 : BEQ + ; refill arrows
LDA.b #70 : STA $7EF376 LDA.b #70 : STA.l ArrowsFiller
LDA.l ArrowMode : BEQ + LDA.l ArrowMode : BEQ +
LDA !INVENTORY_SWAP_2 : ORA #$80 : STA !INVENTORY_SWAP_2 ; enable bow toggle LDA.l BowTracking : ORA.b #$80 : STA.l BowTracking ; enable bow toggle
REP #$20 ; set 16-bit accumulator REP #$20 ; set 16-bit accumulator
LDA $7EF360 : !ADD.l FreeUncleItemAmount : STA $7EF360 ; rupee arrows, so also give the player some money to start LDA.l CurrentRupees : !ADD.l FreeUncleItemAmount : STA.l CurrentRupees ; rupee arrows, so also give the player some money to start
SEP #$20 ; set 8-bit accumulator SEP #$20 ; set 8-bit accumulator
+ +
LDA.l ProgressIndicator : BNE +
LDA.b #$01 : STA.l ProgressIndicator ; handle rain state
+
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
OnAga2Defeated: OnAga2Defeated:
JSL.l Dungeon_SaveRoomData_justKeys ; thing we wrote over, make sure this is first JSL.l Dungeon_SaveRoomData_justKeys ; thing we wrote over, make sure this is first
LDA.b #$01 : STA.l Aga2Duck
JML.l IncrementAgahnim2Sword JML.l IncrementAgahnim2Sword
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
OnFileCreation: OnFileCreation:
TAX ; what we wrote over ; Copy initial SRAM state from ROM to cart SRAM
LDA StartingEquipment+$4C : STA $700340+$4C ; copy starting equipment swaps to file select screen PHB
LDA StartingEquipment+$4E : STA $700340+$4E LDA.w #$03D7 ; \
LDA StartingEquipment+$4F : STA $700340+$4F ; copy starting bomb level LDX.w #$B000 ; | Copies from beginning of inital sram table up to file name
RTL LDY.w #$0000 ; | (exclusively)
MVN $70, $30 ; /
; Skip file name and validity value
LDA.w #$010C ; \
LDX.w #$B3E3 ; | Rando-Specific Assignments & Game Stats block
LDY.w #$03E3 ; |
MVN $70, $30 ; /
PLB
; resolve instant post-aga if standard
SEP #$20
LDA.l InitProgressIndicator : BIT #$80 : BEQ +
LDA.b #$00 : STA.l ProgressIndicatorSRAM ; set post-aga after zelda rescue
LDA.b #$00 : STA.l OverworldEventDataSRAM+$02 ; keep rain state vanilla
+
REP #$20
; Set validity value and do some cleanup. Jump to checksum.
LDA.w #$55AA : STA.l $7003E1
STZ $00
STZ $01
LDX.b $00
LDY.w #$0000
TYA
JML.l InitializeSaveFile_build_checksum
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
!RNG_ITEM_LOCK_IN = "$7F5090" !RNG_ITEM_LOCK_IN = "$7F5090"
OnFileLoad: OnFileLoad:
@@ -96,20 +126,19 @@ OnFileLoad:
LDA.b #$07 : STA $210C ; Restore screen 3 to normal tile area LDA.b #$07 : STA $210C ; Restore screen 3 to normal tile area
LDA !FRESH_FILE_MARKER : BNE + LDA.l FileMarker : BNE +
JSL.l OnNewFile JSL.l OnNewFile
LDA.b #$FF : STA !FRESH_FILE_MARKER LDA.b #$FF : STA.l FileMarker
+ +
LDA.w $010A : BNE + ; don't adjust the worlds for "continue" or "save-continue" LDA.w $010A : BNE + ; don't adjust the worlds for "continue" or "save-continue"
LDA.l $7EC011 : BNE + ; don't adjust worlds if mosiac is enabled (Read: mirroring in dungeon) LDA.l $7EC011 : BNE + ; don't adjust worlds if mosiac is enabled (Read: mirroring in dungeon)
JSL.l DoWorldFix JSL.l DoWorldFix
+ +
JSL.l MasterSwordFollowerClear JSL.l MasterSwordFollowerClear
JSL.l InitOpenMode LDA.b #$FF : STA !RNG_ITEM_LOCK_IN ; reset rng item lock-in
LDA #$FF : STA !RNG_ITEM_LOCK_IN ; reset rng item lock-in LDA.b #$00 : STA $7F5001 ; mark fake flipper softlock as impossible
LDA #$00 : STA $7F5001 ; mark fake flipper softlock as impossible
LDA.l GenericKeys : BEQ + LDA.l GenericKeys : BEQ +
LDA $7EF38B : STA $7EF36F ; copy generic keys to key counter LDA.l CurrentGenericKeys : STA.l CurrentSmallKeys ; copy generic keys to key counter
+ +
JSL.l SetSilverBowMode JSL.l SetSilverBowMode
@@ -125,39 +154,8 @@ RTL
!RNG_ITEM_LOCK_IN = "$7F5090" !RNG_ITEM_LOCK_IN = "$7F5090"
OnNewFile: OnNewFile:
PHX : PHP PHX : PHP
REP #$20 ; set 16-bit accumulator
LDA.l LinkStartingRupees : STA $7EF362 : STA $7EF360
LDA.l StartingTime : STA $7EF454
LDA.l StartingTime+2 : STA $7EF454+2
LDX.w #$004F : - ; copy over starting equipment
LDA StartingEquipment, X : STA $7EF340, X
DEX : DEX
BPL -
LDX #$000E : -
LDA $7EF37C, X : STA $7EF4E0, X
DEX : DEX
BPL -
SEP #$20 ; set 8-bit accumulator
;LDA #$FF : STA !RNG_ITEM_LOCK_IN ; reset rng item lock-in
LDA.l PreopenCurtains : BEQ +
LDA.b #$80 : STA $7EF061 ; open aga tower curtain
LDA.b #$80 : STA $7EF093 ; open skull woods curtain
+
LDA.l PreopenPyramid : BEQ +
LDA.b #$20 : STA $7EF2DB ; pyramid hole already open
+
LDA.l PreopenGanonsTower : BEQ +
LDA.b #$20 : STA $7EF2C3 ; Ganons Tower already open
+
LDA StartingSword : STA $7EF359 ; set starting sword type
; 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
STZ $03C4 ; ancilla slot index STZ $03C4 ; ancilla slot index
STZ $047A ; EG STZ $047A ; EG
STZ $0B08 : STZ $0B09 ; arc variable STZ $0B08 : STZ $0B09 ; arc variable
@@ -236,8 +234,8 @@ PreItemGet:
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
PostItemGet: PostItemGet:
JML.l MaybeWriteSRAMTrace
RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
PostItemAnimation: PostItemAnimation:
LDA.b #$00 : STA !ITEM_BUSY ; mark item as finished LDA.b #$00 : STA !ITEM_BUSY ; mark item as finished

565
failure.asm Normal file
View File

@@ -0,0 +1,565 @@
pushtable
table "bsodencode.txt"
; Uncomment this to force a crash to test message
;pushpc : org $008132 : db 0 : pullpc
;===================================================================================================
DontUseZSNES:
SEP #$35 ; sets carry and I flag too
LDA.b #$00
STA.l $4200 ; disable NMI and IRQ
STA.l $420C ; disable HDMA
ROR ; A = 0x80 from carry
STA.l $2100
STA.l $2115
; Empty VRAM
LDA.b #AllZeros>>16 : STA.l $4304
REP #$20
LDA.w #AllZeros
STA.l $4302
LDA.w #$1809
STA.l $4300
LDA.w #$0000
STA.l $4305
LDA.w #$0001
STA.l $420B
JSR ConfigurePPUForFailureReport
JSR ConfigureBSODVWF
STZ.b VWFR
LDA.w #ZSNESMessage
JSR DrawVWFMessage
LDA.w #$0F0F
STA.w $2100
-- BRA --
ZSNESMessage:
db "It has been detected that you are attempting to load", $80
db "this ROM on a low-quality emulator.", $80
db "The randomizer is designed to work on real hardware,", $80
db "which this application cannot emulate properly;", $80
db "as such, this ROM file refuses to boot.", $80
db "Please upgrade to a more accurate emulator such as", $80
db "SNES9X or BSNES/higan.", $80
db $FF
;===================================================================================================
AllZeros:
db $00
UselessStackTooFar:
dw $137
Crashed:
;===================================================================================================
;===================================================================================================
;===================================================================================================
; !!!DO NOT TRY TO OPTIMIZE THIS CODE!!!
; IT IS INTENTIONALLY AVOIDING CHANGING CERTAIN REGISTERS, ESPECIALLY THE STACK.
;===================================================================================================
;===================================================================================================
;===================================================================================================
SEP #$35 ; sets carry and I flag too
LDA.b #$00
STA.l $4200 ; disable NMI and IRQ
STA.l $420C ; disable HDMA
ROR ; A = 0x80 from carry
STA.l $2100
STA.l $2115
; Empty VRAM
LDA.b #AllZeros>>16 : STA.l $4304
REP #$38
LDA.w #AllZeros
STA.l $4302
LDA.w #$1809
STA.l $4300
LDA.w #$0000
STA.l $4305
LDA.w #$0001
STA.l $420B
;===================================================================================================
; Create report
LDA.w #$2100
TCD
;---------------------------------------------------------------------------------------------------
; Report status
; stack pointer
LDA.w #$0C38>>1
STA.b $2116
TSC
XBA
AND.w #$00FF
ORA.w #$0100
STA.b $2118
TSC
AND.w #$00FF
ORA.w #$0100
STA.l $2118
; game module
LDA.w #$0C78>>1
STA.b $2116
LDA.l $10
AND.w #$00FF
ORA.w #$0100
STA.b $2118
LDA.l $11
AND.w #$00FF
ORA.w #$0100
STA.b $2118
;---------------------------------------------------------------------------------------------------
; Report stack
TSC
INC
STA.l $7F0100
LDA.l UselessStackTooFar
; For now, we can report as much of the stack as possible
; If desired later on, uncomment the code below to keep the stack limited to
; where it was last doing stuff
; TSC
;
; ; keep stack in a useful range
; CMP.w #$01FF ; this means we pulled too much and the stack is useless
; BCC .stack_fine
;
; JMP .skip_stack
;
;.stack_fine
; CMP.l UselessStackTooFar
; BCS .stack_adjusted
;
; ; this means we went too far in, and the stack contains little useful info
; LDA.l UselessStackTooFar
;
;.stack_adjusted
STA.l $7F0000
LDX.w #$01FF
LDA.w #$0C04>>1
.next_row
STA.l $7F0004
STA.b $2116
LDY.w #20
TXA
.next_char
; set carry to see if we should color this value as being in the stack
CMP.l $7F0100
LDA.l $000000,X
AND.w #$00FF
ORA.w #$0500
BCS .in_stack
AND.w #$01FF
.in_stack
STA.b $2118
DEX
TXA
CMP.l $7F0000
BEQ .skip_stack
DEY
BNE .next_char
.done_row
CLC
LDA.l $7F0004
ADC.w #32
BRA .next_row
;===================================================================================================
;===================================================================================================
;===================================================================================================
; once the stack is reported, we can start doing stuff that mucks with it
.skip_stack
LDA.w #$0000
TCD
; TSC
; STA.b $80 ; remember stack for later messages
LDA.w #$01FF
TCS
JSR ConfigurePPUForFailureReport
JSR ConfigureBSODVWF
JSR LoadBSODHexFont
STZ.b VWFR
LDA.w #BSODMessage
JSR DrawVWFMessage
LDA.w #$0F0F
STA.w $2100
-- BRA --
; LDA.w #$0000
; TCD
;
; TSC
BSODMessage:
db "A fatal error has occurred and resulted in an", $80
db "unrecoverable crash. ?", $80
db "If you believe this was the result of a bug caused by", $80
db "the randomizer itself, please screenshot this message", $80
db "and share it in the #bug-reports channel of the official", $80
db "ALTTPR discord along with a detailed description of", $80
db "what you were doing, including video if available.", $80
db "Please also make a savestate now and include that in", $80
db "your report.", $80
db $FF
;===================================================================================================
DrawVWFMessage:
STA.b $06
.next
LDA.b ($06)
INC.b $06
AND.w #$00FF
CMP.w #$0080
BEQ .done_row
CMP.w #$00FF
BEQ .done_message
JSR DrawFailureVWFChar
BRA .next
.done_message
RTS
.done_row
LDA.b VWFR
ASL
TAX
LDA.w .row_offset,X
STA.w $2116
INC.b VWFR
LDA.w #$1800
STA.w $4300
LDA.w #20*16
STA.w $4305
LDA.w #$1000
STA.w $4302
SEP #$20
STZ.w $2115
STZ.w $4304
LDA.b #$01
STA.w $420B
REP #$20
JSR ResetVFW
BRA .next
.row_offset
dw $10F8
dw $11E8
dw $12D8
dw $13C8
dw $14B8
dw $15A8
dw $1698
dw $1788
dw $1878
dw $1968
dw $1A58
;===================================================================================================
VWFL = $40
VWFX = $44
VWFS = $46
VWFP = $48
VWFR = $4A
;===================================================================================================
DrawFailureVWFChar:
AND.w #$00FF
STA.b VWFL
TAX
ASL
ASL
ASL
ADC.w #BSODFontGFX
STA.b $08
LDA.b VWFP
AND.w #$FFF8
STA.w VWFX
LDA.b VWFP
AND.w #$0007
STA.w VWFS
; carry set on purpose to add letter spacing
SEC
LDA.w BSODCharWidths,X
AND.w #$00FF
ADC.b VWFP
STA.b VWFP
LDY.w #$0000
.next_row
LDA.b ($08),Y
AND.w #$00FF
XBA
LDX.w VWFS
BEQ ++
-- LSR
DEX
BNE --
++ LDX.w VWFX
SEP #$20
ORA.w $1008,X
STA.w $1008,X
XBA
ORA.w $1000,X
STA.w $1000,X
REP #$20
INX
STX.w VWFX
INY
CPY.w #$0008
BCC .next_row
RTS
;===================================================================================================
LoadBSODHexFont:
REP #$20
LDA.w #BSODHex
STA.w $4302
LDA.w #$1801
STA.w $4300
LDA.w #$1000
STA.w $4305
LDA.w #$2800
STA.w $2116
SEP #$20
LDA.b #BSODHex>>16
STA.w $4304
LDA.b #$01
STA.w $420B
REP #$30
RTS
;===================================================================================================
ConfigureBSODVWF:
REP #$30
LDA.w #$2100
TCD
SEP #$30
LDX.b #$FF
LDY.b #$7F
STZ.b $2121
STZ.b $2122 : STZ.b $2122
STX.b $2122 : STY.b $2122
LDA.b #$05
STA.b $2121
LDA.b #$11 : STA.b $2122 : STY.b $2122
LDA.b #$21 : STA.b $2121
STX.b $2122 : STY.b $2122
LDA.b #$25 : STA.b $2121
LDA.b #$11 : STA.b $2122 : STY.b $2122
REP #$30
PEA.w $0001
LDA.w #15
STA.w $28
LDA.w #$0042>>1
BRA .start
.next_row
PHA
LDA.w $20
CLC
LDA.w $20
ADC.w #32
.start
STA.w $20
STA.b $2116
PLA
LDY.w #30
.next_char
STA.b $2118
INC
DEY
BNE .next_char
DEC.w $28
BNE .next_row
LDA.w #$0000
TCD
ResetVFW:
REP #$30
LDX.w #$0400
-- STZ.w $1000,X
DEX
DEX
BPL --
STZ.b VWFL
STZ.b VWFX
STZ.b VWFS
STZ.b VWFP
RTS
;===================================================================================================
ConfigurePPUForFailureReport:
SEP #$30
PHK
PLB
STZ.w $2105 ; BG mode 0
STZ.w $2106 ; no mosaic
STZ.w $2107 ; BG1 tilemap to $0000
STZ.w $212D
STZ.w $210D : STZ.w $210D
STZ.w $210E : STZ.w $210E
STZ.w $210F : STZ.w $210F
STZ.w $2110 : STZ.w $2110
STZ.w $2123
STZ.w $2131
STZ.w $2133
LDA.b #$04
STA.w $2108 ; BG1 tilemap to $0800
LDA.b #$21
STA.w $210B
LDA.b #$03
STA.w $212C
RTS
;===================================================================================================
BSODHex:
incbin "bsodhex.2bpp"
BSODFontGFX:
incbin "bsodfont.1bpp"
BSODCharWidths:
; [space]
db 3
; A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
db 4, 4, 3, 4, 3, 3, 4, 3, 1, 4, 3, 3, 5, 4, 4, 4, 5, 4, 4, 3, 4, 5, 5, 3, 3, 3
; 0 1 2 3 4 5 6 7 8 9 . # ? - / , '
db 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 5, 8, 3, 3, 2, 1
;===================================================================================================
pulltable

View File

@@ -2,20 +2,20 @@
; Fairy Changes & Fixes ; Fairy Changes & Fixes
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
RefillHealthPlusMagic: RefillHealthPlusMagic:
LDA BigFairyHealth : STA $7EF372 LDA BigFairyHealth : STA HeartsFiller
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
RefillHealthPlusMagic8bit: RefillHealthPlusMagic8bit:
LDA BigFairyHealth : STA $7EF372 LDA BigFairyHealth : STA HeartsFiller
LDA BigFairyMagic : STA $7EF373 LDA BigFairyMagic : STA MagicFiller
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
CheckFullHealth: CheckFullHealth:
LDA BigFairyHealth : BEQ + LDA BigFairyHealth : BEQ +
LDA $7EF36D : CMP $7EF36C : BNE .player_hp_not_full_yet LDA CurrentHealth : CMP MaximumHealth : BNE .player_hp_not_full_yet
+ +
LDA BigFairyMagic : BEQ + LDA BigFairyMagic : BEQ +
LDA $7EF36E : CMP.b #$80 : BNE .player_mp_not_full_yet LDA CurrentMagic : CMP.b #$80 : BNE .player_mp_not_full_yet
+ +
LDA.b #$00 LDA.b #$00
RTL RTL
@@ -30,10 +30,10 @@ FairyPond_Init:
JML.l Sprite_ShowMessageFromPlayerContact JML.l Sprite_ShowMessageFromPlayerContact
+ +
PHY : JSL.l Sprite_CheckDamageToPlayerSameLayerLong : BCC + PHY : JSL.l Sprite_CheckDamageToPlayerSameLayerLong : BCC +
LDA $7EF35C : CMP.b #$02 : BNE ++ : LDA.b #$1C : PHA : BRA .emptyBottle : ++ LDA BottleContentsOne : CMP.b #$02 : BNE ++ : LDA.b #$1C : PHA : BRA .emptyBottle : ++
LDA $7EF35D : CMP.b #$02 : BNE ++ : LDA.b #$1D : PHA : BRA .emptyBottle : ++ LDA BottleContentsTwo : CMP.b #$02 : BNE ++ : LDA.b #$1D : PHA : BRA .emptyBottle : ++
LDA $7EF35E : CMP.b #$02 : BNE ++ : LDA.b #$1E : PHA : BRA .emptyBottle : ++ LDA BottleContentsThree : CMP.b #$02 : BNE ++ : LDA.b #$1E : PHA : BRA .emptyBottle : ++
LDA $7EF35F : CMP.b #$02 : BNE ++ : LDA.b #$1F : PHA : BRA .emptyBottle : ++ LDA BottleContentsFour : CMP.b #$02 : BNE ++ : LDA.b #$1F : PHA : BRA .emptyBottle : ++
.noInventory .noInventory
LDA.b #$0A : STA $0D80, X LDA.b #$0A : STA $0D80, X
LDA.b #$51 LDA.b #$51

View File

@@ -117,7 +117,7 @@ FastTextScroll:
RTL RTL
DumbFlagForMSU: DumbFlagForMSU:
STA.l $7EF3CA STA.l CurrentWorld
STZ.b $50 STZ.b $50
RTL RTL

View File

@@ -1,10 +1,6 @@
!ExtendedPlayerName = "$700500"
!ValidKeyLoaded = "$7F509E" !ValidKeyLoaded = "$7F509E"
;FS prefix means file_select, since these defines and macros are specific to this screen ;FS prefix means file_select, since these defines and macros are specific to this screen
!FS_INVENTORY_SWAP = "$70038C"
!FS_INVENTORY_SWAP_2 = "$70038E"
!FS_COLOR_BROWN = "$0000" ;(only used for: Shovel, hammer, powder) !FS_COLOR_BROWN = "$0000" ;(only used for: Shovel, hammer, powder)
!FS_COLOR_RED = "$0400" !FS_COLOR_RED = "$0400"
@@ -136,36 +132,36 @@ DrawPlayerFileShared:
LDA.b #FileSelectItems>>16 : PHA : PLB LDA.b #FileSelectItems>>16 : PHA : PLB
REP #$20 ; restore 16 bit accumulator REP #$20 ; restore 16 bit accumulator
LDA !ExtendedPlayerName+$00 : ORA.w #!FS_COLOR_BW LDA ExtendedFileNameSRAM+$08 : ORA.w #!FS_COLOR_BW
%fs_draw8x16(6,5) %fs_draw8x16(6,5)
LDA !ExtendedPlayerName+$02 : ORA.w #!FS_COLOR_BW LDA ExtendedFileNameSRAM+$0A : ORA.w #!FS_COLOR_BW
%fs_draw8x16(6,6) %fs_draw8x16(6,6)
LDA !ExtendedPlayerName+$04 : ORA.w #!FS_COLOR_BW LDA ExtendedFileNameSRAM+$0C : ORA.w #!FS_COLOR_BW
%fs_draw8x16(6,7) %fs_draw8x16(6,7)
LDA !ExtendedPlayerName+$06 : ORA.w #!FS_COLOR_BW LDA ExtendedFileNameSRAM+$0E : ORA.w #!FS_COLOR_BW
%fs_draw8x16(6,8) %fs_draw8x16(6,8)
LDA !ExtendedPlayerName+$08 : ORA.w #!FS_COLOR_BW LDA ExtendedFileNameSRAM+$10 : ORA.w #!FS_COLOR_BW
%fs_draw8x16(9,5) %fs_draw8x16(9,5)
LDA !ExtendedPlayerName+$0A : ORA.w #!FS_COLOR_BW LDA ExtendedFileNameSRAM+$12 : ORA.w #!FS_COLOR_BW
%fs_draw8x16(9,6) %fs_draw8x16(9,6)
LDA !ExtendedPlayerName+$0C : ORA.w #!FS_COLOR_BW LDA ExtendedFileNameSRAM+$14 : ORA.w #!FS_COLOR_BW
%fs_draw8x16(9,7) %fs_draw8x16(9,7)
LDA !ExtendedPlayerName+$0E : ORA.w #!FS_COLOR_BW LDA ExtendedFileNameSRAM+$16 : ORA.w #!FS_COLOR_BW
%fs_draw8x16(9,8) %fs_draw8x16(9,8)
JSR FileSelectDrawHudBar JSR FileSelectDrawHudBar
; Bow ; Bow
LDA.l !FS_INVENTORY_SWAP_2 : AND.w #$0040 : BEQ + LDA.l BowTrackingSRAM : AND.w #$0040 : BEQ +
LDA $700340 : AND.w #$00FF : BEQ ++ LDA EquipmentSRAM+$00 : AND.w #$00FF : BEQ ++
%fs_drawItem(3,12,FileSelectItems_silver_bow) %fs_drawItem(3,12,FileSelectItems_silver_bow)
BRA .bow_end BRA .bow_end
++ ++
%fs_drawItem(3,12,FileSelectItems_silver_arrow) %fs_drawItem(3,12,FileSelectItems_silver_arrow)
BRA .bow_end BRA .bow_end
+ +
LDA.l $700340 : AND.w #$00FF : BEQ + LDA.l EquipmentSRAM : AND.w #$00FF : BEQ +
%fs_drawItem(3,12,FileSelectItems_bow) %fs_drawItem(3,12,FileSelectItems_bow)
BRA .bow_end BRA .bow_end
+ +
@@ -173,15 +169,15 @@ DrawPlayerFileShared:
.bow_end .bow_end
; Boomerang ; Boomerang
LDA.l !FS_INVENTORY_SWAP : AND.w #$00C0 : CMP.w #$00C0 : BNE + LDA.l InventoryTrackingSRAM : AND.w #$00C0 : CMP.w #$00C0 : BNE +
%fs_drawItem(3,14,FileSelectItems_both_boomerang) %fs_drawItem(3,14,FileSelectItems_both_boomerang)
BRA .boomerang_end BRA .boomerang_end
+ +
LDA.l !FS_INVENTORY_SWAP : AND.w #$0040 : BEQ + LDA.l InventoryTrackingSRAM : AND.w #$0040 : BEQ +
%fs_drawItem(3,14,FileSelectItems_red_boomerang) %fs_drawItem(3,14,FileSelectItems_red_boomerang)
BRA .boomerang_end BRA .boomerang_end
+ +
LDA.l !FS_INVENTORY_SWAP : AND.w #$0080 : BEQ + LDA.l InventoryTrackingSRAM : AND.w #$0080 : BEQ +
%fs_drawItem(3,14,FileSelectItems_blue_boomerang) %fs_drawItem(3,14,FileSelectItems_blue_boomerang)
BRA .boomerang_end BRA .boomerang_end
+ +
@@ -189,13 +185,13 @@ DrawPlayerFileShared:
.boomerang_end .boomerang_end
; Hookshot ; Hookshot
%fs_drawItemBasic($700342,3,16,FileSelectItems_hookshot) %fs_drawItemBasic(EquipmentSRAM+$02,3,16,FileSelectItems_hookshot)
; Bombs ; Bombs
; %fs_drawItemBasic($700343,3,18,FileSelectItems_bombs) ; %fs_drawItemBasic(EquipmentSRAM+$03,3,18,FileSelectItems_bombs)
; Powder ; Powder
LDA.l !FS_INVENTORY_SWAP : AND.w #$0010 : BEQ + LDA.l InventoryTrackingSRAM : AND.w #$0010 : BEQ +
%fs_drawItem(3,20,FileSelectItems_powder) %fs_drawItem(3,20,FileSelectItems_powder)
BRA ++ BRA ++
+ +
@@ -203,7 +199,7 @@ DrawPlayerFileShared:
++ ++
; Mushroom ; Mushroom
LDA.l !FS_INVENTORY_SWAP : AND.w #$0008 : BEQ + LDA.l InventoryTrackingSRAM : AND.w #$0008 : BEQ +
%fs_drawItem(3,18,FileSelectItems_mushroom) %fs_drawItem(3,18,FileSelectItems_mushroom)
BRA ++ BRA ++
+ +
@@ -211,7 +207,7 @@ DrawPlayerFileShared:
++ ++
; Flute ; Flute
LDA.l !FS_INVENTORY_SWAP : AND.w #$0003 : BEQ + LDA.l InventoryTrackingSRAM : AND.w #$0003 : BEQ +
%fs_drawItem(7,16,FileSelectItems_flute) %fs_drawItem(7,16,FileSelectItems_flute)
BRA ++ BRA ++
+ +
@@ -219,7 +215,7 @@ DrawPlayerFileShared:
++ ++
; Shovel ; Shovel
LDA.l !FS_INVENTORY_SWAP : AND.w #$0004 : BEQ + LDA.l InventoryTrackingSRAM : AND.w #$0004 : BEQ +
%fs_drawItem(9,12,FileSelectItems_shovel) %fs_drawItem(9,12,FileSelectItems_shovel)
BRA ++ BRA ++
+ +
@@ -227,53 +223,53 @@ DrawPlayerFileShared:
++ ++
; Fire Rod ; Fire Rod
%fs_drawItemBasic($700345,5,12,FileSelectItems_fire_rod) %fs_drawItemBasic(EquipmentSRAM+$05,5,12,FileSelectItems_fire_rod)
; Ice Rod ; Ice Rod
%fs_drawItemBasic($700346,5,14,FileSelectItems_ice_rod) %fs_drawItemBasic(EquipmentSRAM+$06,5,14,FileSelectItems_ice_rod)
; Bombos Medallion ; Bombos Medallion
%fs_drawItemBasic($700347,5,16,FileSelectItems_bombos) %fs_drawItemBasic(EquipmentSRAM+$07,5,16,FileSelectItems_bombos)
; Ether Medallion ; Ether Medallion
%fs_drawItemBasic($700348,5,18,FileSelectItems_ether) %fs_drawItemBasic(EquipmentSRAM+$08,5,18,FileSelectItems_ether)
; Quake Medallion ; Quake Medallion
%fs_drawItemBasic($700349,5,20,FileSelectItems_quake) %fs_drawItemBasic(EquipmentSRAM+$09,5,20,FileSelectItems_quake)
; Lamp ; Lamp
%fs_drawItemBasic($70034A,7,12,FileSelectItems_lamp) %fs_drawItemBasic(EquipmentSRAM+$0A,7,12,FileSelectItems_lamp)
; Hammer ; Hammer
%fs_drawItemBasic($70034B,7,14,FileSelectItems_hammer) %fs_drawItemBasic(EquipmentSRAM+$0B,7,14,FileSelectItems_hammer)
; Bug Net ; Bug Net
%fs_drawItemBasic($70034D,7,18,FileSelectItems_bugnet) %fs_drawItemBasic(EquipmentSRAM+$0D,7,18,FileSelectItems_bugnet)
; Book of Mudora ; Book of Mudora
%fs_drawItemBasic($70034E,7,20,FileSelectItems_book) %fs_drawItemBasic(EquipmentSRAM+$0E,7,20,FileSelectItems_book)
; Red Cane ; Red Cane
%fs_drawItemBasic($700350,9,14,FileSelectItems_redcane) %fs_drawItemBasic(EquipmentSRAM+$10,9,14,FileSelectItems_redcane)
; Blue Cane ; Blue Cane
%fs_drawItemBasic($700351,9,16,FileSelectItems_bluecane) %fs_drawItemBasic(EquipmentSRAM+$11,9,16,FileSelectItems_bluecane)
; Cape ; Cape
%fs_drawItemBasic($700352,9,18,FileSelectItems_cape) %fs_drawItemBasic(EquipmentSRAM+$12,9,18,FileSelectItems_cape)
; Mirror ; Mirror
%fs_drawItemBasic($700353,9,20,FileSelectItems_mirror) %fs_drawItemBasic(EquipmentSRAM+$13,9,20,FileSelectItems_mirror)
; Bottles ; Bottles
%fs_drawBottle($70035C,3,23) %fs_drawBottle(EquipmentSRAM+$1C,3,23)
%fs_drawBottle($70035D,5,23) %fs_drawBottle(EquipmentSRAM+$1D,5,23)
%fs_drawBottle($70035E,7,23) %fs_drawBottle(EquipmentSRAM+$1E,7,23)
%fs_drawBottle($70035F,9,23) %fs_drawBottle(EquipmentSRAM+$1F,9,23)
; Sword ; Sword
LDA.l SpecialWeapons : AND.w #$00FF : CMP #$0001 : BEQ .bombSword LDA.l SpecialWeapons : AND.w #$00FF : CMP #$0001 : BEQ .bombSword
LDA.l $700359 : AND.w #$00FF : BNE + LDA.l EquipmentSRAM+$19 : AND.w #$00FF : BNE +
%fs_drawItemGray(3,26,FileSelectItems_fighters_sword) %fs_drawItemGray(3,26,FileSelectItems_fighters_sword)
JMP ++ JMP ++
+ : DEC : BNE + + : DEC : BNE +
@@ -316,7 +312,7 @@ DrawPlayerFileShared:
++ ++
; Shield ; Shield
LDA.l $70035A : AND.w #$00FF : BNE + LDA.l EquipmentSRAM+$1A : AND.w #$00FF : BNE +
%fs_drawItemGray(5,26,FileSelectItems_fighters_shield) %fs_drawItemGray(5,26,FileSelectItems_fighters_shield)
BRA ++ BRA ++
+ : DEC : BNE + + : DEC : BNE +
@@ -330,7 +326,7 @@ DrawPlayerFileShared:
++ ++
; Mail ; Mail
LDA.l $70035B : AND.w #$00FF : BNE + LDA.l EquipmentSRAM+$1B : AND.w #$00FF : BNE +
%fs_drawItem(7,26,FileSelectItems_green_mail) %fs_drawItem(7,26,FileSelectItems_green_mail)
BRA ++ BRA ++
+ : DEC : BNE + + : DEC : BNE +
@@ -341,7 +337,7 @@ DrawPlayerFileShared:
++ ++
; Heart Pieces ; Heart Pieces
LDA.l $70036B : AND.w #$00FF : BNE + LDA.l EquipmentSRAM+$2B : AND.w #$00FF : BNE +
%fs_drawItem(9,26,FileSelectItems_heart_piece_0_of_4) %fs_drawItem(9,26,FileSelectItems_heart_piece_0_of_4)
BRA ++ BRA ++
+ : DEC : BNE + + : DEC : BNE +
@@ -354,16 +350,16 @@ DrawPlayerFileShared:
%fs_drawItem(9,26,FileSelectItems_heart_piece_3_of_4) %fs_drawItem(9,26,FileSelectItems_heart_piece_3_of_4)
++ ++
LDA $700448 : AND.w #$00FF LDA EquipmentSRAM+$0108 : AND.w #$00FF
JSL.l HexToDec JSL.l HexToDec
LDA $7F5006 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(11,26) LDA $7F5006 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(11,26)
LDA $7F5007 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(11,27) LDA $7F5007 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(11,27)
; Boots ; Boots
%fs_drawItemBasic($700355,3,28,FileSelectItems_boots) %fs_drawItemBasic(EquipmentSRAM+$15,3,28,FileSelectItems_boots)
; Gloves ; Gloves
LDA.l $700354 : AND.w #$00FF : BNE + LDA.l EquipmentSRAM+$14 : AND.w #$00FF : BNE +
%fs_drawItemGray(5,28,FileSelectItems_gloves) %fs_drawItemGray(5,28,FileSelectItems_gloves)
BRA ++ BRA ++
+ : DEC : BNE + + : DEC : BNE +
@@ -374,27 +370,27 @@ DrawPlayerFileShared:
++ ++
; Flippers ; Flippers
%fs_drawItemBasic($700356,7,28,FileSelectItems_flippers) %fs_drawItemBasic(EquipmentSRAM+$16,7,28,FileSelectItems_flippers)
; Moon Pearl ; Moon Pearl
%fs_drawItemBasic($700357,9,28,FileSelectItems_pearl) %fs_drawItemBasic(EquipmentSRAM+$17,9,28,FileSelectItems_pearl)
; Pendants ; Pendants
LDA $700374 : AND.w #$0004 : BEQ + LDA EquipmentSRAM+$34 : AND.w #$0004 : BEQ +
%fs_drawItem(12,12,FileSelectItems_green_pendant) %fs_drawItem(12,12,FileSelectItems_green_pendant)
BRA ++ BRA ++
+ +
%fs_drawItem(12,12,FileSelectItems_no_pendant) %fs_drawItem(12,12,FileSelectItems_no_pendant)
++ ++
LDA $700374 : AND.w #$0002 : BEQ + LDA EquipmentSRAM+$34 : AND.w #$0002 : BEQ +
%fs_drawItem(12,14,FileSelectItems_blue_pendant) %fs_drawItem(12,14,FileSelectItems_blue_pendant)
BRA ++ BRA ++
+ +
%fs_drawItem(12,14,FileSelectItems_no_pendant) %fs_drawItem(12,14,FileSelectItems_no_pendant)
++ ++
LDA $700374 : AND.w #$0001 : BEQ + LDA EquipmentSRAM+$34 : AND.w #$0001 : BEQ +
%fs_drawItem(12,16,FileSelectItems_red_pendant) %fs_drawItem(12,16,FileSelectItems_red_pendant)
BRA ++ BRA ++
+ +
@@ -402,49 +398,49 @@ DrawPlayerFileShared:
++ ++
; Crystals ; Crystals
LDA $70037A : AND.w #$0002 : BEQ + LDA EquipmentSRAM+$3A : AND.w #$0002 : BEQ +
LDA.w #$0297|!FS_COLOR_BLUE LDA.w #$0297|!FS_COLOR_BLUE
BRA ++ BRA ++
+ +
LDA.w #$0287|!FS_COLOR_GRAY LDA.w #$0287|!FS_COLOR_GRAY
++ : %fs_draw16x8(13,18) ++ : %fs_draw16x8(13,18)
LDA $70037A : AND.w #$0010 : BEQ + LDA EquipmentSRAM+$3A : AND.w #$0010 : BEQ +
LDA.w #$0297|!FS_COLOR_BLUE LDA.w #$0297|!FS_COLOR_BLUE
BRA ++ BRA ++
+ +
LDA.w #$0287|!FS_COLOR_GRAY LDA.w #$0287|!FS_COLOR_GRAY
++ : %fs_draw16x8(12,19) ++ : %fs_draw16x8(12,19)
LDA $70037A : AND.w #$0040 : BEQ + LDA EquipmentSRAM+$3A : AND.w #$0040 : BEQ +
LDA.w #$0297|!FS_COLOR_BLUE LDA.w #$0297|!FS_COLOR_BLUE
BRA ++ BRA ++
+ +
LDA.w #$0287|!FS_COLOR_GRAY LDA.w #$0287|!FS_COLOR_GRAY
++ : %fs_draw16x8(13,20) ++ : %fs_draw16x8(13,20)
LDA $70037A : AND.w #$0020 : BEQ + LDA EquipmentSRAM+$3A : AND.w #$0020 : BEQ +
LDA.w #$0297|!FS_COLOR_BLUE LDA.w #$0297|!FS_COLOR_BLUE
BRA ++ BRA ++
+ +
LDA.w #$0287|!FS_COLOR_GRAY LDA.w #$0287|!FS_COLOR_GRAY
++ : %fs_draw16x8(12,21) ++ : %fs_draw16x8(12,21)
LDA $70037A : AND.w #$0004 : BEQ + LDA EquipmentSRAM+$3A : AND.w #$0004 : BEQ +
LDA.w #$0297|!FS_COLOR_RED LDA.w #$0297|!FS_COLOR_RED
BRA ++ BRA ++
+ +
LDA.w #$0287|!FS_COLOR_GRAY LDA.w #$0287|!FS_COLOR_GRAY
++ : %fs_draw16x8(13,22) ++ : %fs_draw16x8(13,22)
LDA $70037A : AND.w #$0001 : BEQ + LDA EquipmentSRAM+$3A : AND.w #$0001 : BEQ +
LDA.w #$0297|!FS_COLOR_RED LDA.w #$0297|!FS_COLOR_RED
BRA ++ BRA ++
+ +
LDA.w #$0287|!FS_COLOR_GRAY LDA.w #$0287|!FS_COLOR_GRAY
++ : %fs_draw16x8(12,23) ++ : %fs_draw16x8(12,23)
LDA $70037A : AND.w #$0008 : BEQ + LDA EquipmentSRAM+$3A : AND.w #$0008 : BEQ +
LDA.w #$0297|!FS_COLOR_BLUE LDA.w #$0297|!FS_COLOR_BLUE
BRA ++ BRA ++
+ +
@@ -598,7 +594,7 @@ FileSelectItems:
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
FileSelectDrawHudBar: FileSelectDrawHudBar:
LDA #$029B|!FS_COLOR_GREEN : %fs_draw16x8(0,10) LDA #$029B|!FS_COLOR_GREEN : %fs_draw16x8(0,10)
LDA $700362 LDA EquipmentSRAM+$22
JSL.l HexToDec JSL.l HexToDec
LDA $7F5004 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(1,9) LDA $7F5004 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(1,9)
LDA $7F5005 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(1,10) LDA $7F5005 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(1,10)
@@ -607,7 +603,7 @@ FileSelectDrawHudBar:
LDA SpecialWeapons : AND.w #$00FF : CMP #$0001 : BEQ .colorBombs LDA SpecialWeapons : AND.w #$00FF : CMP #$0001 : BEQ .colorBombs
LDA #$028B|!FS_COLOR_BLUE : %fs_draw16x8(0,14) LDA #$028B|!FS_COLOR_BLUE : %fs_draw16x8(0,14)
LDA $700343 : AND.w #$00FF LDA EquipmentSRAM+$03 : AND.w #$00FF
JSL.l HexToDec JSL.l HexToDec
LDA $7F5006 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(1,14) LDA $7F5006 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(1,14)
LDA $7F5007 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(1,15) LDA $7F5007 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(1,15)
@@ -629,13 +625,13 @@ FileSelectDrawHudBar:
LDA #$028B|!FS_COLOR_YELLOW : %fs_draw16x8(0,14) LDA #$028B|!FS_COLOR_YELLOW : %fs_draw16x8(0,14)
++ ++
LDA.l !FS_INVENTORY_SWAP_2 : AND.w #$0040 : BEQ + LDA.l BowTrackingSRAM : AND.w #$0040 : BEQ +
LDA #$0299|!FS_COLOR_RED : %fs_draw16x8(0,17) LDA #$0299|!FS_COLOR_RED : %fs_draw16x8(0,17)
BRA ++ BRA ++
+ +
LDA #$0289|!FS_COLOR_BROWN : %fs_draw16x8(0,17) LDA #$0289|!FS_COLOR_BROWN : %fs_draw16x8(0,17)
++ ++
LDA $700377 : AND.w #$00FF LDA EquipmentSRAM+$37 : AND.w #$00FF
JSL.l HexToDec JSL.l HexToDec
LDA $7F5006 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(1,17) LDA $7F5006 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(1,17)
LDA $7F5007 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(1,18) LDA $7F5007 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(1,18)
@@ -844,16 +840,16 @@ DrawPlayerFile_credits:
; see $6563C for drawing first file name and hearts ; see $6563C for drawing first file name and hearts
REP #$20 ; set 16 bit accumulator REP #$20 ; set 16 bit accumulator
LDA $7003D9 : ORA.w #!FS_COLOR_BW LDA EquipmentSRAM+$99 : ORA.w #!FS_COLOR_BW
%fs_draw8x16(3,5) %fs_draw8x16(3,5)
LDA $7003DB : ORA.w #!FS_COLOR_BW LDA EquipmentSRAM+$9B : ORA.w #!FS_COLOR_BW
%fs_draw8x16(3,6) %fs_draw8x16(3,6)
LDA $7003DD : ORA.w #!FS_COLOR_BW LDA EquipmentSRAM+$9D : ORA.w #!FS_COLOR_BW
%fs_draw8x16(3,7) %fs_draw8x16(3,7)
LDA $7003DF : ORA.w #!FS_COLOR_BW LDA EquipmentSRAM+$9F : ORA.w #!FS_COLOR_BW
%fs_draw8x16(3,8) %fs_draw8x16(3,8)
LDA $70036C : AND.w #$00FF : LSR #3 : STA $02 LDA EquipmentSRAM+$2C : AND.w #$00FF : LSR #3 : STA $02
%fs_LDY_screenpos(0,20) %fs_LDY_screenpos(0,20)
LDA.w #$028F|!FS_COLOR_RED LDA.w #$028F|!FS_COLOR_RED
LDX.w #$000A LDX.w #$000A
@@ -923,3 +919,21 @@ JML FSSelectFile_continue
LDA.b #$3C : STA $012E ; play error sound LDA.b #$3C : STA $012E ; play error sound
JML FSSelectFile_return JML FSSelectFile_return
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
MaybeForceFileName:
LDA.l ForceFileName : BEQ +
REP #$20
LDX.b #$FE
-
INX : INX
LDA.l StaticFileName, X : STA.l ExtendedFileNameSRAM, X
CPX #$16 : BEQ .done
CPX #$08 : BCS -
STA.l FileNameVanillaSRAM, X
BRA -
.done
SEP #$20
JML.l InitializeSaveFile
+
JML.l NameFile_MakeScreenVisible
;--------------------------------------------------------------------------------

View File

@@ -4,23 +4,23 @@
FlipperKill: FlipperKill:
PHP PHP
LDA $5D : CMP #$04 : BNE .done ; skip if we're not swimming LDA $5D : CMP #$04 : BNE .done ; skip if we're not swimming
LDA $7EF356 : BNE .done ; skip if we have the flippers LDA FlippersEquipment : BNE .done ; skip if we have the flippers
LDA $7F5001 : BEQ .done ; skip if we're not marked in danger for softlock LDA $7F5001 : BEQ .done ; skip if we're not marked in danger for softlock
LDA $8A : CMP $7F5098 : BEQ .done ; skip if we're on the same screen we entered the water on LDA $8A : CMP $7F5098 : BEQ .done ; skip if we're on the same screen we entered the water on
;JSL.l KillFairies ; take away fairies ;JSL.l KillFairies ; take away fairies
LDA !IGNORE_FAIRIES : ORA.b #$04 : STA !IGNORE_FAIRIES LDA IgnoreFaeries : ORA.b #$04 : STA IgnoreFaeries
LDA.b #$00 : STA $7EF36D ; kill link LDA.b #$00 : STA CurrentHealth ; kill link
LDA.b #$00 : STA $7F5001 ; mark fake flipper softlock as impossible LDA.b #$00 : STA $7F5001 ; mark fake flipper softlock as impossible
.done .done
PLP PLP
LDA $7EF36D ; thing we wrote over LDA CurrentHealth ; thing we wrote over
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
IgnoreFairyCheck: IgnoreFairyCheck:
LDX.b #$00 ; thing we wrote over LDX.b #$00 ; thing we wrote over
LDA !IGNORE_FAIRIES : BIT.b #$04 : BEQ .normal LDA IgnoreFaeries : BIT.b #$04 : BEQ .normal
AND.b #$FB : STA !IGNORE_FAIRIES ; clear ignore fairy flag AND.b #$FB : STA IgnoreFaeries ; clear ignore fairy flag
LDA.b #$F0 ; set check to invalid entry LDA.b #$F0 ; set check to invalid entry
RTL RTL
.normal .normal
@@ -28,14 +28,14 @@ RTL
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
;KillFairies: ;KillFairies:
; LDA $7EF35C : CMP #$06 : BNE + ; LDA BottleContentsOne : CMP #$06 : BNE +
; LDA #$02 : STA $7EF35C ; LDA #$02 : STA BottleContentsOne
; + LDA $7EF35D : CMP #$06 : BNE + ; + LDA BottleContentsTwo : CMP #$06 : BNE +
; LDA #$02 : STA $7EF35D ; LDA #$02 : STA BottleContentsTwo
; + LDA $7EF35E : CMP #$06 : BNE + ; + LDA BottleContentsThree : CMP #$06 : BNE +
; LDA #$02 : STA $7EF35E ; LDA #$02 : STA BottleContentsThree
; + LDA $7EF35F : CMP #$06 : BNE + ; + LDA BottleContentsFour : CMP #$06 : BNE +
; LDA #$02 : STA $7EF35F ; LDA #$02 : STA BottleContentsFour
; + ; +
;RTL ;RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
@@ -47,7 +47,7 @@ RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
FlipperFlag: FlipperFlag:
LDA $5D : CMP #$04 : BNE .done ; skip if we're not swimming LDA $5D : CMP #$04 : BNE .done ; skip if we're not swimming
LDA $7EF356 : BNE .safe ; skip if we have the flippers LDA FlippersEquipment : BNE .safe ; skip if we have the flippers
LDA #$01 : STA $7F5001 ; mark fake flipper softlock as possible LDA #$01 : STA $7F5001 ; mark fake flipper softlock as possible
BRA .done BRA .done
.safe .safe

View File

@@ -5,21 +5,21 @@ FloodGateAndMasterSwordFollowerReset:
JSL.l MasterSwordFollowerClear JSL.l MasterSwordFollowerClear
FloodGateReset: FloodGateReset:
LDA.l PersistentFloodgate : BNE + LDA.l PersistentFloodgate : BNE +
LDA $7EF2BB : AND.b #$DF : STA $7EF2BB ; reset water outside floodgate LDA OverworldEventDataWRAM+$3B : AND.b #$DF : STA OverworldEventDataWRAM+$3B ; reset water outside floodgate
LDA $7EF2FB : AND.b #$DF : STA $7EF2FB ; reset water outside swamp palace LDA OverworldEventDataWRAM+$7B : AND.b #$DF : STA OverworldEventDataWRAM+$7B ; reset water outside swamp palace
LDA $7EF216 : AND.b #$7F : STA $7EF216 ; clear water inside floodgate LDA RoomDataWRAM[$010B].low : AND.b #$7F : STA RoomDataWRAM[$010B].low ; clear water inside floodgate
LDA $7EF051 : AND.b #$FE : STA $7EF051 ; clear water front room (room 40) LDA RoomDataWRAM[$28].high : AND.b #$FE : STA RoomDataWRAM[$28].high ; clear water front room (room 40)
+ +
FloodGateResetInner: FloodGateResetInner:
LDA.l Bugfix_SwampWaterLevel : BEQ +++ LDA.l Bugfix_SwampWaterLevel : BEQ +++
LDA $7EF06F : AND.b #$04 : BEQ + ; Check if key in room 55 has been collected. LDA RoomDataWRAM[$37].low : AND.b #$04 : BEQ + ; Check if key in room 55 has been collected.
LDA $7EF356 : AND.b #$01 : BNE ++ ; Check for flippers. This can otherwise softlock doors if flooded without flippers and no way to reset. LDA FlippersEquipment : AND.b #$01 : BNE ++ ; Check for flippers. This can otherwise softlock doors if flooded without flippers and no way to reset.
+ +
LDA $7EF06E : AND.b #$7F : STA $7EF06E ; clear water room 55 - outer room you shouldn't be able to softlock except in major glitches 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 $7EF06B : AND.b #$04 : BNE +++ ; Check if key in room 53 has been collected. LDA 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 $7EF06A : AND.b #$7F : STA $7EF06A ; clear water room 53 - inner room with the easy key flood softlock LDA RoomDataWRAM[$35].low : AND.b #$7F : STA RoomDataWRAM[$35].low ; clear water room 53 - inner room with the easy key flood softlock
+++ +++
RTL RTL
;================================================================================ ;================================================================================

View File

@@ -23,17 +23,17 @@ SpawnHauntedGroveItem:
LDA.b #$30 : STA $0F10, Y LDA.b #$30 : STA $0F10, Y
LDA $22 : !ADD.l .x_offsets, X LDA $22 : !ADD.l .x_offsets, X
AND.b #$F0 : STA $0D10, Y AND.b #$F0 : STA $0D10, Y
LDA $23 : ADC.b #$00 : STA $0D30, Y LDA $23 : ADC.b #$00 : STA $0D30, Y
LDA $20 : !ADD.b #$16 : AND.b #$F0 : STA $0D00, Y LDA $20 : !ADD.b #$16 : AND.b #$F0 : STA $0D00, Y
LDA $21 : ADC.b #$00 : STA $0D20, Y LDA $21 : ADC.b #$00 : STA $0D20, Y
LDA.b #$00 : STA $0F20, Y LDA.b #$00 : STA $0F20, Y
TYX TYX
LDX $8A ; haunted grove (208D0A) LDX $8A ; haunted grove (208D0A)
LDA $7EF280, X : AND.b #$40 : BNE + LDA OverworldEventDataWRAM, X : AND.b #$40 : BNE +
LDA.b #$1B : JSL Sound_SetSfx3PanLong LDA.b #$1B : JSL Sound_SetSfx3PanLong
+ +
RTL RTL
@@ -61,7 +61,7 @@ JML.l FluteBoy_Continue
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
FreeDuckCheck: FreeDuckCheck:
LDA.l InvertedMode : BEQ .done LDA.l InvertedMode : BEQ .done
LDA $7EF34C : CMP.b #$03 : BEQ .done ; flute is already active LDA 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 $8A : CMP.b #$18 : BNE .done

View File

@@ -1,46 +1,22 @@
;================================================================================ ;================================================================================
; Frame Hook ; Frame Hook
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
; $7EF42Ew[2] - loop frame counter (low)
!LOOP_FRAMES_LOW = "$7EF42E"
;--------------------------------------------------------------------------------
; $7EF430w[2] - loop frame counter (high)
!LOOP_FRAMES_HIGH = "$7EF430"
;--------------------------------------------------------------------------------
; $7EF43Ew[2] - nmi frame counter (low)
!NMI_FRAMES_LOW = "$7EF43E"
;--------------------------------------------------------------------------------
; $7EF440w[2] - nmi frame counter (high)
!NMI_FRAMES_HIGH = "$7EF440"
;--------------------------------------------------------------------------------
; $7EF444w[2] - item menu frame counter (low)
!ITEM_FRAMES_LOW = "$7EF444"
;--------------------------------------------------------------------------------
; $7EF446w[2] - item menu frame counter (high)
!ITEM_FRAMES_HIGH = "$7EF446"
;--------------------------------------------------------------------------------
!LOCK_STATS = "$7EF443"
FrameHookAction: FrameHookAction:
JSL $0080B5 ; Module_MainRouting JSL $0080B5 ; Module_MainRouting
JSL CheckMusicLoadRequest JSL CheckMusicLoadRequest
PHP : REP #$30 : PHA PHP : REP #$30 : PHA
SEP #$20 SEP #$20
;LDA EnableSRAMTrace : AND.l TournamentSeedInverse : BEQ +
; LDA $1A : BNE ++ : JSL.l WriteStatusPreview : ++ ; write every 256 frames
;+
LDA !LOCK_STATS : BNE ++ LDA StatsLocked : BNE ++
REP #$20 ; set 16-bit accumulator REP #$20 ; set 16-bit accumulator
LDA !LOOP_FRAMES_LOW : INC : STA !LOOP_FRAMES_LOW : BNE + LDA LoopFrames : INC : STA LoopFrames : BNE +
LDA !LOOP_FRAMES_HIGH : INC : STA !LOOP_FRAMES_HIGH LDA LoopFrames+2 : INC : STA LoopFrames+2
+ +
LDA $10 : CMP.w #$010E : BNE + ; move this to nmi hook? LDA $10 : CMP.w #$010E : BNE + ; move this to nmi hook?
LDA !ITEM_FRAMES_LOW : INC : STA !ITEM_FRAMES_LOW : BNE + LDA MenuFrames : INC : STA MenuFrames : BNE +
LDA !ITEM_FRAMES_HIGH : INC : STA !ITEM_FRAMES_HIGH LDA MenuFrames+2 : INC : STA MenuFrames+2
+ +
;SEP #$20 ; set 8-bit accumulator ?? check this
++ ++
REP #$30 : PLA : PLP REP #$30 : PLA : PLP
RTL RTL
@@ -48,9 +24,9 @@ RTL
NMIHookAction: NMIHookAction:
PHA : PHX : PHY : PHD ; thing we wrote over, push stuff PHA : PHX : PHY : PHD ; thing we wrote over, push stuff
LDA !LOCK_STATS : AND.w #$00FF : BNE ++ LDA StatsLocked : AND.w #$00FF : BNE ++
LDA !NMI_FRAMES_LOW : INC : STA !NMI_FRAMES_LOW : BNE + LDA NMIFrames : INC : STA NMIFrames : BNE +
LDA !NMI_FRAMES_HIGH : INC : STA !NMI_FRAMES_HIGH LDA NMIFrames+2 : INC : STA NMIFrames+2
+ +
++ ++
@@ -80,4 +56,4 @@ PostNMIHookAction:
LDA $13 : STA $2100 ; thing we wrote over, turn screen back on LDA $13 : STA $2100 ; thing we wrote over, turn screen back on
JML.l PostNMIHookReturn JML.l PostNMIHookReturn
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------

View File

@@ -16,20 +16,20 @@ GetAgahnimDeath:
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 !DARK_WORLD ; Switch to light world LDA.b #$00 : STA CurrentWorld ; Switch to light world
BRA ++ BRA ++
+++ +++
LDA.b #$40 : STA !DARK_WORLD ; Switch to dark world LDA.b #$40 : STA 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 !DARK_WORLD ; Switch to dark world LDA.b #$40 : STA CurrentWorld ; Switch to dark world
BRA ++ BRA ++
+++ +++
LDA.b #$00 : STA !DARK_WORLD ; Switch to light world LDA.b #$00 : STA 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)
++ ++

View File

@@ -1,7 +1,6 @@
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
; $7F5010 - Scratch Space (Callee Preserved) ; $7F5010 - Scratch Space (Callee Preserved)
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
!GOAL_COUNTER = "$7EF418"
!GOAL_DRAW_ADDRESS = "$7EC72A" !GOAL_DRAW_ADDRESS = "$7EC72A"
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
; DrawGoalIndicator moved to newhud.asm ; DrawGoalIndicator moved to newhud.asm
@@ -62,18 +61,18 @@ CheckGanonVulnerability:
; 02 = All dungeons ; 02 = All dungeons
.all_dungeons .all_dungeons
LDA.l $7EF3C5 : CMP.b #$03 : BCC .fail ; require post-aga world state LDA.l ProgressIndicator : CMP.b #$03 : BCC .fail ; require post-aga world state
; 09 = All dungeons except agahnim ; 09 = All dungeons except agahnim
.all_dungeons_no_agahnim .all_dungeons_no_agahnim
LDA.l $7EF374 : AND.b #$07 : CMP.b #$07 : BNE .fail ; require all pendants LDA.l PendantsField : AND.b #$07 : CMP.b #$07 : BNE .fail ; require all pendants
LDA.l $7EF37A : AND.b #$7F : CMP.b #$7F : BNE .fail ; require all crystals LDA.l CrystalsField : AND.b #$7F : CMP.b #$7F : BNE .fail ; require all crystals
LDA.l $7EF2DB : AND.b #$20 : BEQ .fail ; require aga2 defeated (pyramid hole open) LDA.l OverworldEventDataWRAM+$5B : AND.b #$20 : BEQ .fail ; require aga2 defeated (pyramid hole open)
BRA .success BRA .success
; 03 = crystals and aga 2 ; 03 = crystals and aga 2
.crystals_and_aga .crystals_and_aga
LDA.l $7EF2DB : AND.b #$20 : BEQ .fail ; check aga2 first then bleed in LDA.l OverworldEventDataWRAM+$5B : AND.b #$20 : BEQ .fail ; check aga2 first then bleed in
; 04 = crystals only ; 04 = crystals only
.crystals .crystals
@@ -82,7 +81,9 @@ CheckGanonVulnerability:
; 05 = require goal item ; 05 = require goal item
.goal_item .goal_item
LDA.l !GOAL_COUNTER : CMP GoalItemRequirement REP #$20
LDA.l GoalCounter : CMP.l GoalItemRequirement
SEP #$20
RTS RTS
; 06 = light speed ; 06 = light speed
@@ -96,7 +97,6 @@ CheckGanonVulnerability:
; 08 = Crystal bosses but no crystals ; 08 = Crystal bosses but no crystals
.bosses_only .bosses_only
;LDA.l $7EF2DDB : AND.b #$20 : BEQ .fail ; check aga2
JMP CheckForCrystalBossesDefeated JMP CheckForCrystalBossesDefeated
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
@@ -125,12 +125,12 @@ GetRequiredCrystalsInX:
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
CheckEnoughCrystalsForGanon: CheckEnoughCrystalsForGanon:
LDA $7EF37A : JSL CountBits ; the comparison is against 1 less LDA CrystalCounter
CMP.l NumberOfCrystalsRequiredForGanon CMP.l NumberOfCrystalsRequiredForGanon
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
CheckEnoughCrystalsForTower: CheckEnoughCrystalsForTower:
LDA $7EF37A : JSL CountBits ; the comparison is against 1 less LDA CrystalCounter
CMP.l NumberOfCrystalsRequiredForTower CMP.l NumberOfCrystalsRequiredForTower
RTL RTL
@@ -140,7 +140,7 @@ CheckAgaForPed:
CMP.b #$06 : BNE .vanilla CMP.b #$06 : BNE .vanilla
.light_speed .light_speed
LDA.l $7EF300 ; check ped flag LDA.l OverworldEventDataWRAM+$80 ; check ped flag
AND.b #$40 AND.b #$40
BEQ .force_blue_ball BEQ .force_blue_ball
@@ -158,15 +158,15 @@ CheckAgaForPed:
;--------------------------------------------------------------------------------------------------- ;---------------------------------------------------------------------------------------------------
KillGanon: KillGanon:
STA.l $7EF3C5 ; vanilla game state stuff we overwrote STA.l ProgressIndicator ; vanilla game state stuff we overwrote
LDA.l InvincibleGanon LDA.l InvincibleGanon
CMP.b #$06 : BNE .exit CMP.b #$06 : BNE .exit
.light_speed .light_speed
LDA.l $7EF2DB : ORA.b #$20 : STA.l $7EF2DB ; pyramid hole LDA.l OverworldEventDataWRAM+$5B : ORA.b #$20 : STA.l OverworldEventDataWRAM+$5B ; pyramid hole
LDA.b #$08 : STA.l $7EF001 ; kill ganon LDA.b #$08 : STA.l RoomDataWRAM[$00].high ; kill ganon
LDA.b #$02 : STA.l $7EF357 ; pearl but invisible in menu LDA.b #$02 : STA.l MoonPearlEquipment ; pearl but invisible in menu
.exit .exit
RTL RTL
@@ -197,7 +197,7 @@ CheckForCrystalBossesDefeated:
LDA.l DrawHUDDungeonItems_boss_room_ids-4,X LDA.l DrawHUDDungeonItems_boss_room_ids-4,X
TAX TAX
LDA.l $7EF000,X LDA.l RoomDataWRAM.l,X
AND.w #$0800 AND.w #$0800
BEQ ++ BEQ ++

View File

@@ -10,6 +10,6 @@ GetMagicBatItem:
JML.l Link_ReceiveItem JML.l Link_ReceiveItem
.normalLogic .normalLogic
LDA HalfMagic LDA HalfMagic
STA $7EF37B STA MagicConsumption
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------

View File

@@ -32,7 +32,7 @@ CalculateByrnaUsage:
LDA.l HardModeExclusionCaneOfByrnaUsage, X : STA $00 LDA.l HardModeExclusionCaneOfByrnaUsage, X : STA $00
PLX PLX
++ ++
LDA $7EF36E ; thing we wrote over LDA CurrentMagic ; thing we wrote over
JML IncrementMagicUseCounterByrna JML IncrementMagicUseCounterByrna
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
CalculateCapeUsage: CalculateCapeUsage:

View File

@@ -15,7 +15,7 @@ HeartPieceGet:
STZ $02E9 ; 0 = Receiving item from an NPC or message STZ $02E9 ; 0 = Receiving item from an NPC or message
CPY.b #$26 : BNE .notHeart ; don't add a 1/4 heart if it's not a heart piece CPY.b #$26 : BNE .notHeart ; don't add a 1/4 heart if it's not a heart piece
LDA $7EF36B : INC A : AND.b #$03 : STA $7EF36B : BNE .unfinished_heart ; add up heart quarters LDA HeartPieceQuarter : INC A : AND.b #$03 : STA HeartPieceQuarter : BNE .unfinished_heart ; add up heart quarters
BRA .giveItem BRA .giveItem
.notHeart .notHeart
@@ -130,7 +130,7 @@ HeartUpgradeSpawnDecision: ; this should return #$00 to make the hp spawn
RTL RTL
.normal_behavior .normal_behavior
LDA $7EF280, X LDA OverworldEventDataWRAM, X
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
SaveHeartCollectedStatus: SaveHeartCollectedStatus:
@@ -140,7 +140,7 @@ SaveHeartCollectedStatus:
RTL RTL
.normal_behavior .normal_behavior
LDA $7EF280, X : ORA.b #$40 : STA $7EF280, X LDA OverworldEventDataWRAM, X : ORA.b #$40 : STA OverworldEventDataWRAM, X
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
!REDRAW = "$7F5000" !REDRAW = "$7F5000"
@@ -195,7 +195,7 @@ MaybeMarkDigSpotCollected:
REP #$20 ; set 16-bit accumulator REP #$20 ; set 16-bit accumulator
LDA $8A LDA $8A
CMP.w #$2A : BNE + CMP.w #$2A : BNE +
LDA !HAS_GROVE_ITEM : ORA.w #$0001 : STA !HAS_GROVE_ITEM LDA HasGroveItem : ORA.w #$0001 : STA HasGroveItem
+ +
PLP : PLA PLP : PLA
RTL RTL

View File

@@ -38,11 +38,33 @@ JML.l CheckZSNES
ReturnCheckZSNES: ReturnCheckZSNES:
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
;================================================================================
; Ok so basically, in rare cases, major glitches may try to read far into the
; A bus until they reach a value of $FFFF
; For maximum security of vanilla behavior, I am reserving this space
; that could otherwise be considered free ROM.
;--------------------------------------------------------------------------------
org $0089C2
dw $FFFF, $FFFF, $FFFF, $FFFF
dw $FFFF, $FFFF, $FFFF, $FFFF
dw $FFFF, $FFFF, $FFFF, $FFFF
;================================================================================
; BSOD for BRK and COP opcodes
;--------------------------------------------------------------------------------
org $00FFB7
SoftwareInterrupt:
JML Crashed
org $00FFE4 : dw SoftwareInterrupt
org $00FFE6 : dw SoftwareInterrupt
org $00FFF4 : dw SoftwareInterrupt
;================================================================================ ;================================================================================
; Dungeon Entrance Hook (works, but not needed at the moment) ; Dungeon Entrance Hook (works, but not needed at the moment)
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
;org $02D8C7 ; <- 158C7 - Bank02.asm : 10981 (STA $7EC172) org $02D8C7 ; <- 158C7 - Bank02.asm : 10981 (STA $7EC172)
;JSL.l OnDungeonEntrance JSL.l OnDungeonEntrance
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
;================================================================================ ;================================================================================
@@ -214,6 +236,8 @@ LDA.l HeartCursorPositions, X
org $0CDAEB ; <- 65AEB : Bank0C.asm : 3571-3575,3581-3587 (...) [LDA $0B12 : AND #$03] org $0CDAEB ; <- 65AEB : Bank0C.asm : 3571-3575,3581-3587 (...) [LDA $0B12 : AND #$03]
; JP here is different. Indicated line number implement the US version of the same functionality ; JP here is different. Indicated line number implement the US version of the same functionality
JSL.l WrapCharacterPosition : NOP JSL.l WrapCharacterPosition : NOP
org $0CD75E ; bank_0C.asm (dl NameFile_MakeScreenVisible)
dl MaybeForceFileName
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
org $0CE43A ; No assembly source. Makes name entry box wider org $0CE43A ; No assembly source. Makes name entry box wider
db $2C db $2C
@@ -308,9 +332,8 @@ org $0CCE85 ; <- Bank0C.asm : 1953 (LDA $C8 : ASL A : INC #2 : STA $701FFE)
NOP #4 NOP #4
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
org $0CDB4C ; <- Bank0C.asm : 3655 (LDA $C8 : ASL A : INC #2 : STA $701FFE : TAX) org $0CDB4C ; <- Bank0C.asm : 3655 (LDA $C8 : ASL A : INC #2 : STA $701FFE : TAX)
JSL OnFileCreation JML OnFileCreation
NOP NOP
;Additionally, display inventory swap starting equipment on file select
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
org $09F5EA ; <- module_death.asm : 510 (LDA $701FFE : TAX : DEX #2) org $09F5EA ; <- module_death.asm : 510 (LDA $701FFE : TAX : DEX #2)
LDA.w #$0002 : NOP LDA.w #$0002 : NOP
@@ -531,17 +554,13 @@ JSL.l CheckGanonHammerDamage : NOP
org $02B797 ; <- 13797 - Bank02.asm : 8712 (LDA.b #$19 : STA $10) org $02B797 ; <- 13797 - Bank02.asm : 8712 (LDA.b #$19 : STA $10)
JSL.l StatsFinalPrep JSL.l StatsFinalPrep
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
org $07A95B ; <- 3A95B - Bank07.asm : 6565 (JSL Dungeon_SaveRoomData) org $07A95B ; <- 3A95B - Bank07.asm : 6565 (JSL Dungeon_SaveRoomDataWRAM)
JSL.l IncrementUWMirror JSL.l IncrementUWMirror
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
org $0288D1 ; <- 108D1 - Bank02.asm : 1690 (STZ $0646) org $0288D1 ; <- 108D1 - Bank02.asm : 1690 (STZ $0646)
JSL.l IndoorSubtileTransitionCounter JSL.l IndoorSubtileTransitionCounter
NOP #2 NOP #2
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
org $07B574 ; <- 3B574 - Bank07.asm : 8519 (LDA.b #$01 : STA $02E9)
JSL.l IncrementChestCounter
NOP
;--------------------------------------------------------------------------------
;org $05FC7E ; <- 2FC7E - sprite_dash_item.asm : 118 (LDA $7EF36F : INC A : STA $7EF36F) ;org $05FC7E ; <- 2FC7E - sprite_dash_item.asm : 118 (LDA $7EF36F : INC A : STA $7EF36F)
;JSL.l IncrementSmallKeys ;JSL.l IncrementSmallKeys
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
@@ -709,7 +728,7 @@ JSL.l GetItemDamageValue
;================================================================================ ;================================================================================
; Misc Stats ; Misc Stats
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
org $029E2E ; <- 11E2E - module_ganon_emerges.asm : 59 (JSL Dungeon_SaveRoomData.justKeys) org $029E2E ; <- 11E2E - module_ganon_emerges.asm : 59 (JSL Dungeon_SaveRoomDataWRAM.justKeys)
JSL.l OnAga2Defeated JSL.l OnAga2Defeated
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
org $0DDBDE ; <- 6DBDE - headsup_display.asm : 105 (DEC A : BPL .subtractRupees) org $0DDBDE ; <- 6DBDE - headsup_display.asm : 105 (DEC A : BPL .subtractRupees)
@@ -1672,7 +1691,7 @@ JSL.l FixAga2Bunny : NOP
; Open Mode Fixes ; Open Mode Fixes
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
org $05DF65 ; <- 2DF65 - sprite_uncle_and_priest.asm:994 - (LDA.b #$01 : STA $7EF3C5) org $05DF65 ; <- 2DF65 - sprite_uncle_and_priest.asm:994 - (LDA.b #$01 : STA $7EF3C5)
JSL.l SetUncleRainState : RTS NOP #6
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
;org $0280DD ; <- 100DD - Bank02.asm:298 - (LDA $7EF3C5 : CMP.b #$02 : BCC .indoors) ;org $0280DD ; <- 100DD - Bank02.asm:298 - (LDA $7EF3C5 : CMP.b #$02 : BCC .indoors)
;JSL.l ForceLinksHouse ;JSL.l ForceLinksHouse
@@ -2095,7 +2114,7 @@ JSL.l ItemCheck_TreeKid2
org $06AF9B ; <- 32F9B - FluteBoy_Chillin : 73 : LDA $7EF34C : CMP.b #$02 : BCS .player_has_flute org $06AF9B ; <- 32F9B - FluteBoy_Chillin : 73 : LDA $7EF34C : CMP.b #$02 : BCS .player_has_flute
;NOP #8 ;NOP #8
LDA !HAS_GROVE_ITEM : AND.b #$01 LDA HasGroveItem : AND.b #$01
db #$D0 ; BNE db #$D0 ; BNE
org $06B062 ; <- 33062 - FluteAardvark_InitialStateFromFluteState : 225 : LDA $7EF34C : AND.b #$03 : !BGE #$05 org $06B062 ; <- 33062 - FluteAardvark_InitialStateFromFluteState : 225 : LDA $7EF34C : AND.b #$03 : !BGE #$05
@@ -2389,15 +2408,13 @@ Overworld_Hole_End:
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
;================================================================================ ;================================================================================
; Disable pyramid hole check for killing aga2 ; Replace pyramid hole check for killing aga2
; ;
; this check is intended to prevent getting fluted out a second time if you ; this check is intended to prevent getting fluted out a second time if you
; return to his room after already killing him once. But with a pre-opened ; return to his room after already killing him once.
; pyramid hole, it can cause you to get stuck there on killing him the first
; time. So we change it, and accept the flute out if you return.
;--------------------------------------------------------------------------------- ;---------------------------------------------------------------------------------
org $01C753 ; 0C753 = Bank01:10398 (LDA $7EF2DB : AND.b #$20 : BNE .return) org $01C74E ; 00C74E - bank_01.asm:13281 - (LDA.l $7EF2DB : AND.b #$20)
db $00 ; (originally $20) LDA.l Aga2Duck : NOP #2
;================================================================================ ;================================================================================
; Music fixes ; Music fixes
@@ -2463,7 +2480,7 @@ org $00DF62 ; <- Bank00.asm:4672 (LDX.w #$0000 : LDY.w #$0040)
JML ReloadingFloors JML ReloadingFloors
NOP : NOP NOP : NOP
ReloadingFloorsResume: ReloadingFloorsResume:
org $00DF6E ; <- A few instructions later, right after JSR Do3To4High16Bit org $00DF6E ; <- A few instructions later, right after JSR Do3To.high16Bit
ReloadingFloorsCancel: ReloadingFloorsCancel:
;================================================================================ ;================================================================================
@@ -2474,7 +2491,7 @@ org $07A055 ; <- Bank07.asm:5205 (LDA $0B99 : BEQ BRANCH_DELTA)
JSL.l ArrowGame : NOP #14 JSL.l ArrowGame : NOP #14
org $07A06C ; <- Bank07.asm:5215 (LDA $7EF377 : BEQ BRANCH_EPSILON) org $07A06C ; <- Bank07.asm:5215 (LDA $7EF377 : BEQ BRANCH_EPSILON)
JSL.l DecrementArrows : SKIP 2 : NOP : LDA $7EF377 JSL.l DecrementArrows : SKIP 2 : NOP : LDA CurrentArrows
;================================================================================ ;================================================================================
;================================================================================ ;================================================================================

View File

@@ -1,5 +1,3 @@
RomVersionSRAM = $701FFC
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
; Init_Primary ; Init_Primary
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
@@ -24,7 +22,7 @@ Init_Primary:
LDX #$00 LDX #$00
- -
LDA $702000, X : CMP $00FFC0, X : BNE .clear LDA RomNameSRAM, X : CMP $00FFC0, X : BNE .clear
INX INX
CPX #$15 : !BLT - CPX #$15 : !BLT -
BRA .done BRA .done
@@ -38,7 +36,7 @@ Init_Primary:
SEP #$30 ; set 8-bit accumulator & index registers SEP #$30 ; set 8-bit accumulator & index registers
LDX #$00 LDX #$00
- -
LDA $00FFC0, X : STA $702000, X LDA $00FFC0, X : STA RomNameSRAM, X
INX INX
CPX #$15 : !BLT - CPX #$15 : !BLT -
LDX #$00 LDX #$00
@@ -69,5 +67,6 @@ Init_PostRAMClear:
JSL MSUInit JSL MSUInit
JSL InitRNGPointerTable JSL InitRNGPointerTable
JSL InitCompassTotalsRAM
JML $00D463 ; The original target of the jump table that we hijacked JML $00D463 ; The original target of the jump table that we hijacked

174
initsramtable.asm Normal file
View File

@@ -0,0 +1,174 @@
;================================================================================
; Initial SRAM table.
;--------------------------------------------------------------------------------
; The ROM copies blocks of bytes from here on save file init. This table has an
; identical layout to the first $500 bytes of SRAM, although some values such as
; the file validity value, file name, and inverse checksum are skipped.
;
; NOTE: Set InitProgressIndicator to $80 for standard mode with instant post-aga
; world state
;
; See sram.asm for further documentation on how to write to this table.
;--------------------------------------------------------------------------------
fillword $0000 ; Zero out the table
fill $500 ;
org $30B000 ; PC 0x183000
InitRoomDataWRAM:
org $30B060 ; PC 0x183060
InitATAltarRoom: dw $0000 ; aga curtains
org $30B092 ; PC 0x183092
InitSWBackEntryRoom: dw $0000 ; skull woods curtains (?)
org $30B20C
dw $F000, $F000 ; Pre-open kak bomb hut & brewery
org $30B280 ; PC 0x183280 - 0x1832FF
InitOverworldEvents:
org $30B282 ; PC 0x183282 - Lumberjacks
InitLumberjackOW: db $00
org $30B29B ; PC 0x18329B - Open castle gate
InitHyruleCastleOW: db $20
org $30B2DB ; PC 0x1832DB - Pyramid hole
InitPyramidOW: db $00
org $30B2C3 ; PC 0x1832C3 - GT
InitDDMWestOW: db $00
org $30B340 ; PC 0x183340
StartingEquipment:
StartingBow: skip 1 ; PC 0x183340
StartingBoomerang: skip 1 ; PC 0x183341
StartingHookshot: skip 1 ; PC 0x183342
StartingBombs: skip 1 ; PC 0x183343
StartingPowder: skip 1 ; PC 0x183344
StartingFireRod: skip 1 ; PC 0x183345
StartingIceRod: skip 1 ; PC 0x183346
StartingBombos: skip 1 ; PC 0x183347
StartingEther: skip 1 ; PC 0x183348
StartingQuake: skip 1 ; PC 0x183349
StartingLamp: skip 1 ; PC 0x18334A
StartingHammer: skip 1 ; PC 0x18334B
StartingFlute: skip 1 ; PC 0x18334C
StartingBugNet: skip 1 ; PC 0x18334D
StartingBookOfMudora: skip 1 ; PC 0x18334E
StartingBottleIndex: skip 1 ; PC 0x18334F
StartingSomaria: skip 1 ; PC 0x183350
StartingByrna: skip 1 ; PC 0x183351
StartingCape: skip 1 ; PC 0x183352
StartingMirror: skip 1 ; PC 0x183353
StartingGlove: skip 1 ; PC 0x183354
StartingBoots: skip 1 ; PC 0x183355
StartingFlippers: skip 1 ; PC 0x183356
StartingMoonPearl: skip 1 ; PC 0x183357
skip 1 ; PC 0x183358
StartingSword: skip 1 ; PC 0x183359
StartingShield: skip 1 ; PC 0x18335A
StartingArmor: skip 1 ; PC 0x18335B
StartingBottleContentsOne: skip 1 ; PC 0x18335C
StartingBottleContentsTwo: skip 1 ; PC 0x18335D
StartingBottleContentsThree: skip 1 ; PC 0x18335E
StartingBottleContentsFour: skip 1 ; PC 0x18335F
StartingCurrentRupees: skip 2 ; PC 0x183360 \ Write same value to both
StartingDisplayRupees: skip 2 ; PC 0x183362 / of these
StartingCompasses: skip 2 ; PC 0x183364
StartingBigKeys: skip 2 ; PC 0x183366
StartingMaps: skip 2 ; PC 0x183368
skip 1 ; PC 0x18336A
StartingQuarterHearts: skip 1 ; PC 0x18336B
StartingHealth: db $18 ; PC 0x18336C
StartingMaximumHealth: db $18 ; PC 0x18336D
StartingMagic: skip 1 ; PC 0x18336E
StartingSmallKeys: db $FF ; PC 0x18336F
StartingBombCapacityUpgrade: skip 1 ; PC 0x183370
StartingArrowCapacityUpgrade: skip 1 ; PC 0x183371
InitHeartsFiller: skip 1 ; PC 0x183372
InitMagicFiller: skip 1 ; PC 0x183373
StartingPendants: skip 1 ; PC 0x183374
InitBombsFiller: skip 1 ; PC 0x183375
InitArrowsFiller: skip 1 ; PC 0x183376
StartingArrows: skip 1 ; PC 0x183377
skip 1 ; PC 0x183378
InitAbilityFlags: db $68 ; PC 0x183379
StartingCrystals: skip 1 ; PC 0x18337A
StartingMagicConsumption: skip 1 ; PC 0x18337B
StartingDungeonKeys: ;
StartingSewerKeys: skip 1 ; PC 0x18337C
StartingHyruleCastleKeys: skip 1 ; PC 0x18337D
StartingEasternKeys: skip 1 ; PC 0x18337E
StartingDesertKeys: skip 1 ; PC 0x18337F
StartingCastleTowerKeys: skip 1 ; PC 0x183380
StartingSwampKeys: skip 1 ; PC 0x183381
StartingPalaceOfDarknessKeys: skip 1 ; PC 0x183382
StartingMireKeys: skip 1 ; PC 0x183383
StartingSkullWoodsKeys: skip 1 ; PC 0x183384
StartingIcePalaceKeys: skip 1 ; PC 0x183385
StartingHeraKeys: skip 1 ; PC 0x183386
StartingThievesTownKeys: skip 1 ; PC 0x183387
StartingTurtleRockKeys: skip 1 ; PC 0x183388
StartingGanonsTowerKeys: skip 1 ; PC 0x183389
skip 1 ; PC 0x18338A
StartingGenericKeys: skip 1 ; PC 0x18338B
InitInventoryTracking: skip 2 ; PC 0x18338C \ Need to set bits here for silver arrows,
InitBowTracking: skip 2 ; PC 0x18338E / boomerangs, powder/mushroom, etc
InitItemLimitCounts: skip 16 ; PC 0x183390
skip 37 ;
InitProgressIndicator: db $02 ; PC 0x1833C5 - Set to $80 for instant post-aga with standard
InitProgressFlags: db $14 ; PC 0x1833C6 - Set to $00 for standard
InitMapIcons: skip 1 ; PC 0x1833C7
InitStartingEntrance: db $01 ; PC 0x1833C8 - Set to $00 for standard
InitNpcFlagsVanilla: skip 1 ; PC 0x1833C9
InitCurrentWorld: skip 1 ; PC 0x1833CA
skip 1 ; PC 0x1833CB
InitFollowerIndicator: skip 1 ; PC 0x1833CC
InitFollowerXCoord: skip 2 ; PC 0x1833CD
InitFollowerYCoord: skip 2 ; PC 0x1833CF
InitDroppedFollowerIndoors: skip 1 ; PC 0x1833D1
InitDroppedFollowerLayer: skip 1 ; PC 0x1833D2
InitFollowerDropped: skip 1 ; PC 0x1833D3
org $30B3D9 ; PC 0x1833D9 - 0x1833F0
StaticFileName: ; The validity value ($55AA) must be written manually on SRAM init at $7003E1
dw $0181, $0162, $0168, $018C
dw $0166, $014E, $0162, $018C
dw $0165, $0162, $0167, $018C
org $30B401 ; PC 0x183401
InitDeathCounter:
dw $FFFF
;--------------------------------------------------------------------------------
; The following labels and their addresses are provided for convenience. You
; may want to write, for example, to InitHighestSword in addition to setting
; StartingSword. But any value can be written to the whole block from
; $30B000-$30B4FF (PC 0x183000-0x18034FF) and it will be initialized
; excluding ~28 bytes (File name, validity value, and checksum.)
;--------------------------------------------------------------------------------
org $30B414 ; PC 0x183414-0x183416
InitMapOverlay: dw $0000
org $30B417 ; PC 0x183417
InitHighestSword: db $00
org $30B414 ; PC 0x183418-0x183419
InitGoalCounter: dw $0000
org $30B422 ; PC 0x183422
InitHighestShield: db $00
org $30B428 ; PC 0x183428
InitMapsCompasses: db $00
org $30B429 ; PC 0x183429
InitPendantCounter: db $00
org $30B454 ; PC 0x183454-0x183457
InitChallengeTimer: dw $0000, $0000
org $30B46E ; PC 0x18346E
InitHighestMail: db $00
org $30B471 ; PC 0x183471
InitCrystalCounter: db $00

View File

@@ -1,19 +1,18 @@
;================================================================================ ;================================================================================
; Inventory Updates ; Inventory Updates
;================================================================================ ;================================================================================
!INVENTORY_SWAP = "$7EF38C" ; InventoryTracking
; Item Tracking Slot ; brmpnskf ------oq
; brmpnskf ; b = blue boomerang | -
; b = blue boomerang ; r = red boomerang | -
; r = red boomerang ; m = mushroom current | -
; m = mushroom current ; p = magic powder | -
; p = magic powder ; n = mushroom past | -
; n = mushroom past ; s = shovel | -
; s = shovel ; k = fake flute | o = any bomb acquired from item location
; k = fake flute ; f = working flute | q = quickswap locked
; f = working flute
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
!INVENTORY_SWAP_2 = "$7EF38E" ; BowTracking
; Item Tracking Slot #2 ; Item Tracking Slot #2
; bsp----- ; bsp-----
; b = bow ; b = bow
@@ -23,20 +22,20 @@
; - ; -
; - ; -
; - ; -
; q = quickswap lock ; -
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
; ProcessMenuButtons: ; ProcessMenuButtons:
; out: Carry - 0 = No Button, 1 = Yes Button ; out: Carry - 0 = No Button, 1 = Yes Button
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
ProcessMenuButtons: ProcessMenuButtons:
;LDA #$FD : STA !INVENTORY_SWAP ; DEBUG MODE ;LDA #$FD : STA InventoryTracking ; DEBUG MODE
;LDA $F6 : BIT #$20 : BNE .l_pressed ; check for P1 L-button ;LDA $F6 : BIT #$20 : BNE .l_pressed ; check for P1 L-button
LDA $F4 : BIT #$40 : BNE .y_pressed ; check for P1 Y-button LDA $F4 : BIT #$40 : BNE .y_pressed ; check for P1 Y-button
BIT #$20 : BNE .sel_pressed ; check for P1 Select button BIT #$20 : BNE .sel_pressed ; check for P1 Select button
LDA $F0 : BIT #$20 : BNE .sel_held LDA $F0 : BIT #$20 : BNE .sel_held
.sel_unheld .sel_unheld
LDA !HUD_FLAG : AND #$20 : BEQ + LDA HudFlag : AND #$20 : BEQ +
LDA !HUD_FLAG : AND #$DF : STA !HUD_FLAG ; select is released, unset hud flag LDA HudFlag : AND #$DF : STA HudFlag ; select is released, unset hud flag
LDA $1B : BEQ + ; skip if outdoors LDA $1B : BEQ + ; skip if outdoors
LDA.b #$20 : STA $012F ; menu select sound LDA.b #$20 : STA $012F ; menu select sound
+ +
@@ -45,11 +44,8 @@ ProcessMenuButtons:
.sel_held .sel_held
CLC ; no buttons CLC ; no buttons
RTL RTL
;.l_pressed
;JSL.l SpawnAngryCucco
;RTL
.sel_pressed .sel_pressed
LDA !HUD_FLAG : ORA #$20 : STA !HUD_FLAG ; set hud flag LDA HudFlag : ORA #$20 : STA HudFlag ; set hud flag
LDA.b #$20 : STA $012F ; menu select sound LDA.b #$20 : STA $012F ; menu select sound
JSL.l ResetEquipment JSL.l ResetEquipment
RTL RTL
@@ -57,12 +53,12 @@ RTL
LDA.b #$10 : STA $0207 LDA.b #$10 : STA $0207
LDA $0202 ; check selected item LDA $0202 ; check selected item
CMP #$02 : BNE + ; boomerang CMP #$02 : BNE + ; boomerang
LDA !INVENTORY_SWAP : AND #$C0 : CMP #$C0 : BNE .errorJump ; make sure we have both boomerangs LDA InventoryTracking : AND #$C0 : CMP #$C0 : BNE .errorJump ; make sure we have both boomerangs
LDA $7EF341 : EOR #$03 : STA $7EF341 ; swap blue & red boomerang LDA BoomerangEquipment : EOR #$03 : STA BoomerangEquipment ; swap blue & red boomerang
LDA.b #$20 : STA $012F ; menu select sound LDA.b #$20 : STA $012F ; menu select sound
JMP .captured JMP .captured
+ CMP #$01 : BNE + ; bow + CMP #$01 : BNE + ; bow
LDA !INVENTORY_SWAP_2 : AND #$C0 : CMP #$C0 : BNE .errorJump ; make sure we have both bows LDA BowTracking : AND #$C0 : CMP #$C0 : BNE .errorJump ; make sure we have both bows
PHX : LDX.b #$00 ; scan ancilla table for arrows PHX : LDX.b #$00 ; scan ancilla table for arrows
-- : CPX.b #$0A : !BGE ++ -- : CPX.b #$0A : !BGE ++
LDA $0C4A, X : CMP.b #$09 : BNE +++ LDA $0C4A, X : CMP.b #$09 : BNE +++
@@ -72,18 +68,18 @@ RTL
PLX PLX
LDA.l SilverArrowsUseRestriction : BEQ ++ LDA.l SilverArrowsUseRestriction : BEQ ++
LDA $A0 : ORA $A1 : BEQ ++ ; not in ganon's room in restricted mode LDA $A0 : ORA $A1 : BEQ ++ ; not in ganon's room in restricted mode
LDA $7EF340 : CMP.b #$03 : !BLT .errorJump : !SUB #$02 : STA $7EF340 LDA BowEquipment : CMP.b #$03 : !BLT .errorJump : !SUB #$02 : STA BowEquipment
BRA .errorJump2 BRA .errorJump2
++ ++
LDA $7EF340 : !SUB #$01 : EOR #$02 : !ADD #$01 : STA $7EF340 ; swap bows LDA BowEquipment : !SUB #$01 : EOR #$02 : !ADD #$01 : STA BowEquipment ; swap bows
LDA.b #$20 : STA $012F ; menu select sound LDA.b #$20 : STA $012F ; menu select sound
JMP .captured JMP .captured
+ BRA + + BRA +
.errorJump .errorJump
BRA .errorJump2 BRA .errorJump2
+ CMP #$05 : BNE + ; powder + CMP #$05 : BNE + ; powder
LDA !INVENTORY_SWAP : AND #$30 : CMP #$30 : BNE .errorJump ; make sure we have mushroom & magic powder LDA InventoryTracking : AND #$30 : CMP #$30 : BNE .errorJump ; make sure we have mushroom & magic powder
LDA $7EF344 : EOR #$03 : STA $7EF344 ; swap mushroom & magic powder LDA PowderEquipment : EOR #$03 : STA PowderEquipment ; swap mushroom & magic powder
LDA.b #$20 : STA $012F ; menu select sound LDA.b #$20 : STA $012F ; menu select sound
JMP .captured JMP .captured
+ BRA + + BRA +
@@ -91,11 +87,11 @@ RTL
BRA .error BRA .error
+ CMP #$0D : BNE + ; flute + CMP #$0D : BNE + ; flute
LDA $037A : CMP #$01 : BEQ .midShovel ; inside a shovel animation, force the shovel & make error sound LDA $037A : CMP #$01 : BEQ .midShovel ; inside a shovel animation, force the shovel & make error sound
LDA !INVENTORY_SWAP : BIT #$04 : BEQ .error ; make sure we have shovel LDA InventoryTracking : BIT #$04 : BEQ .error ; make sure we have shovel
AND #$03 : BEQ .error ; make sure we have one of the flutes AND #$03 : BEQ .error ; make sure we have one of the flutes
LDA $7EF34C : CMP #01 : BNE .toShovel ; not shovel LDA FluteEquipment : CMP #01 : BNE .toShovel ; not shovel
LDA !INVENTORY_SWAP : AND #$01 : BEQ .toFakeFlute ; check for real flute LDA InventoryTracking : AND #$01 : BEQ .toFakeFlute ; check for real flute
LDA #$03 ; set real flute LDA #$03 ; set real flute
BRA .fluteSuccess BRA .fluteSuccess
.toFakeFlute .toFakeFlute
@@ -104,7 +100,7 @@ RTL
.toShovel .toShovel
LDA #$01 ; set shovel LDA #$01 ; set shovel
.fluteSuccess .fluteSuccess
STA $7EF34C ; store set item STA FluteEquipment ; store set item
LDA.b #$20 : STA $012F ; menu select sound LDA.b #$20 : STA $012F ; menu select sound
BRA .captured BRA .captured
+ +
@@ -112,7 +108,7 @@ RTL
CLC CLC
RTL RTL
.midShovel .midShovel
; LDA #$01 : STA $7EF34C ; set shovel ; LDA #$01 : STA FluteEquipment ; set shovel
.error .error
LDA.b #$3C : STA $012E ; error sound LDA.b #$3C : STA $012E ; error sound
.captured .captured
@@ -127,13 +123,13 @@ ProcessBottleMenu:
; LDA $F6 : AND #$30 : CMP.b #$30 : BEQ .double_shoulder_pressed ; LDA $F6 : AND #$30 : CMP.b #$30 : BEQ .double_shoulder_pressed
; LDA $F4 : AND #$40 : BEQ .y_not_pressed ; skip if Y is not down ; LDA $F4 : AND #$40 : BEQ .y_not_pressed ; skip if Y is not down
; .double_shoulder_pressed ; .double_shoulder_pressed
LDA $7EF34F ; check bottle state LDA BottleIndex ; check bottle state
BEQ .no_bottles ; skip if we have no bottles BEQ .no_bottles ; skip if we have no bottles
PHX PHX
INC : CMP #$05 : !BLT + : LDA #$01 : + ;increment and wrap 1-4 INC : CMP #$05 : !BLT + : LDA #$01 : + ;increment and wrap 1-4
TAX : LDA $7EF35C-1, X ; check bottle TAX : LDA BottleContents-1, X ; check bottle
BNE + : LDX #$01 : + ; wrap if we reached the last bottle BNE + : LDX #$01 : + ; wrap if we reached the last bottle
TXA : STA $7EF34F ; set bottle index TXA : STA BottleIndex ; set bottle index
LDA.b #$20 : STA $012F ; menu select sound LDA.b #$20 : STA $012F ; menu select sound
PLX PLX
.no_bottles .no_bottles
@@ -178,8 +174,6 @@ RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
; AddInventory: ; AddInventory:
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
!LOCK_STATS = "$7EF443"
macro TopHalf(address) macro TopHalf(address)
LDA <address> : !ADD #$10 : STA <address> LDA <address> : !ADD #$10 : STA <address>
endmacro endmacro
@@ -193,62 +187,61 @@ macro BottomHalf(address)
endmacro endmacro
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
;FullInventoryExternal: ;FullInventoryExternal:
; LDA !LOCK_STATS : BEQ + : RTL : + ; LDA StatsLocked : BEQ + : RTL : +
; PHA : PHX : PHP : JMP AddInventory_fullItemCounts ; PHA : PHX : PHP : JMP AddInventory_fullItemCounts
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
FullInventoryExternal: FullInventoryExternal:
LDA !LOCK_STATS : BEQ + : RTL : + LDA StatsLocked : BEQ + : RTL : +
PHA : PHX : PHP : JMP AddInventory_incrementCounts PHA : PHX : PHP : JMP AddInventory_incrementCounts
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
!SHAME_CHEST = "$7EF416" ; ---s ----
AddInventory: AddInventory:
PHA : PHX : PHP PHA : PHX : PHP
CPY.b #$0C : BNE + ; Blue Boomerang CPY.b #$0C : BNE + ; Blue Boomerang
LDA !INVENTORY_SWAP : ORA #$80 : STA !INVENTORY_SWAP LDA InventoryTracking : ORA #$80 : STA InventoryTracking
JMP .incrementCounts JMP .incrementCounts
+ CPY.b #$2A : BNE + ; Red Boomerang + CPY.b #$2A : BNE + ; Red Boomerang
LDA !INVENTORY_SWAP : ORA #$40 : STA !INVENTORY_SWAP LDA InventoryTracking : ORA #$40 : STA InventoryTracking
JMP .incrementCounts JMP .incrementCounts
+ CPY.b #$29 : BNE + ; Mushroom + CPY.b #$29 : BNE + ; Mushroom
LDA !INVENTORY_SWAP : ORA #$28 : STA !INVENTORY_SWAP LDA InventoryTracking : ORA #$28 : STA InventoryTracking
JMP .incrementCounts JMP .incrementCounts
+ CPY.b #$0D : BNE + ; Magic Powder + CPY.b #$0D : BNE + ; Magic Powder
LDA !INVENTORY_SWAP : ORA #$10 : STA !INVENTORY_SWAP LDA InventoryTracking : ORA #$10 : STA InventoryTracking
JMP .incrementCounts JMP .incrementCounts
+ CPY.b #$13 : BNE + ; Shovel + CPY.b #$13 : BNE + ; Shovel
LDA !INVENTORY_SWAP : ORA #$04 : STA !INVENTORY_SWAP LDA InventoryTracking : ORA #$04 : STA InventoryTracking
JMP .incrementCounts JMP .incrementCounts
+ CPY.b #$14 : BNE + ; Flute (Inactive) + CPY.b #$14 : BNE + ; Flute (Inactive)
LDA !INVENTORY_SWAP : ORA #$02 : STA !INVENTORY_SWAP LDA InventoryTracking : ORA #$02 : STA InventoryTracking
JMP .incrementCounts JMP .incrementCounts
+ CPY.b #$4A : BNE + ; Flute (Active) + CPY.b #$4A : BNE + ; Flute (Active)
LDA !INVENTORY_SWAP : ORA #$01 : STA !INVENTORY_SWAP LDA InventoryTracking : ORA #$01 : STA InventoryTracking
JMP .incrementCounts JMP .incrementCounts
+ CPY.b #$0B : BNE + ; Bow + CPY.b #$0B : BNE + ; Bow
LDA ArrowMode : BNE +++ LDA ArrowMode : BNE +++
LDA !INVENTORY_SWAP_2 : ORA #$80 : STA !INVENTORY_SWAP_2 LDA BowTracking : ORA #$80 : STA BowTracking
+++ +++
JMP .incrementCounts JMP .incrementCounts
+ CPY.b #$3A : BNE + ; Bow & Arrows + CPY.b #$3A : BNE + ; Bow & Arrows
LDA !INVENTORY_SWAP_2 : ORA #$80 : STA !INVENTORY_SWAP_2 LDA BowTracking : ORA #$80 : STA BowTracking
JMP .incrementCounts JMP .incrementCounts
+ CPY.b #$3B : BNE + ; Bow & Silver Arrows + CPY.b #$3B : BNE + ; Bow & Silver Arrows
LDA !INVENTORY_SWAP_2 : ORA #$40 : STA !INVENTORY_SWAP_2 LDA BowTracking : ORA #$40 : STA BowTracking
LDA ArrowMode : BNE +++ LDA ArrowMode : BNE +++
LDA !INVENTORY_SWAP_2 : ORA #$80 : STA !INVENTORY_SWAP_2 ; activate wood arrows when not in rupee bow LDA BowTracking : ORA #$80 : STA BowTracking ; activate wood arrows when not in rupee bow
+++ +++
JMP .incrementCounts JMP .incrementCounts
+ CPY.b #$43 : BNE + ; Single arrow + CPY.b #$43 : BNE + ; Single arrow
LDA ArrowMode : BEQ +++ LDA ArrowMode : BEQ +++
LDA !INVENTORY_SWAP_2 : ORA #$80 : STA !INVENTORY_SWAP_2 ; activate wood arrows in quick-swap LDA BowTracking : ORA #$80 : STA BowTracking ; activate wood arrows in quick-swap
+++ +++
JMP .incrementCounts JMP .incrementCounts
+ CPY.b #$58 : BNE + ; Upgrade-Only Silver Arrows + CPY.b #$58 : BNE + ; Upgrade-Only Silver Arrows
LDA !INVENTORY_SWAP_2 : ORA #$40 : STA !INVENTORY_SWAP_2 LDA BowTracking : ORA #$40 : STA BowTracking
+ +
.incrementCounts .incrementCounts
LDA !LOCK_STATS : BEQ + : JMP .done : + LDA StatsLocked : BEQ + : JMP .done : +
; don't count any of this stuff ; don't count any of this stuff
CPY.b #$20 : BNE + : JMP .itemCounts : + ; Crystal CPY.b #$20 : BNE + : JMP .itemCounts : + ; Crystal
@@ -259,7 +252,6 @@ AddInventory:
CPY.b #$37 : BNE + : JMP .itemCounts : + ; Pendant CPY.b #$37 : BNE + : JMP .itemCounts : + ; Pendant
CPY.b #$38 : BNE + : JMP .itemCounts : + ; Pendant CPY.b #$38 : BNE + : JMP .itemCounts : + ; Pendant
CPY.b #$39 : BNE + : JMP .itemCounts : + ; Pendant CPY.b #$39 : BNE + : JMP .itemCounts : + ; Pendant
CPY.b #$00 : BNE + : JMP .itemCounts : + ; Uncle Sword & Shield
CPY.b #$04 : !BLT .isSword ; Swords - Skip Shop/Fairy Check for Swords CPY.b #$04 : !BLT .isSword ; Swords - Skip Shop/Fairy Check for Swords
CPY.b #$49 : BEQ .isSword CPY.b #$49 : BEQ .isSword
@@ -293,111 +285,73 @@ AddInventory:
.dungeonCounts .dungeonCounts
LDA $1B : BNE + : JMP .fullItemCounts : + LDA $1B : BNE + : JMP .fullItemCounts : +
; ==BEGIN INDOOR-ONLY SECTION
;REP #$20 ; Set 16-bit Accumulator
;LDA $A0 ; load room ID
;CMP.w #$0010 : BNE + ; Ganon Fall Room - I think this got taken out
;!SHAME_CHEST = "$7EF416" ; ---s ----
;LDA !SHAME_CHEST : ORA.w #$0010 : STA !SHAME_CHEST
;+
SEP #$20 ; Set 8-bit Accumulator SEP #$20 ; Set 8-bit Accumulator
LDA $040C ; get dungeon id LDA $040C ; get dungeon id
CMP.b #$FF : BEQ .fullItemCounts
CMP.b #$00 : BNE + ; Sewers (Escape) CMP.l BallNChainDungeon : BNE +
BRA ++ CPY.b #$32 : BNE +
+ CMP.b #$02 : BNE + ; Hyrule Castle (Escape) JMP .done
++ +
CPY.b #$32 : BNE ++ : JMP .itemCounts : ++ ; Ball & Chain Guard's Big Key CMP.b #$04 : BCS +
%TopHalf($7EF434) LDA SewersLocations : INC : STA SewersLocations
JMP .fullItemCounts LDA HCLocations : INC : STA HCLocations
+ CMP.b #$04 : BNE + ; Eastern Palace BRA .fullItemCounts
LDA $7EF436 : INC : AND #$07 : TAX + LSR : TAX : LDA DungeonLocationsChecked, X : INC : STA DungeonLocationsChecked, X
LDA $7EF436 : AND #$F8 : STA $7EF436 ++ CPX.b #$0D : BNE +
TXA : ORA $7EF436 : STA $7EF436 LDA BigKeyField : AND #$04 : BNE ++
JMP .fullItemCounts
+ CMP.b #$06 : BNE + ; Desert Palace
LDA $7EF435 : !ADD #$20 : STA $7EF435
JMP .fullItemCounts
+ CMP.b #$08 : BNE + ; Agahnim's Tower
LDA $7EF435 : INC : AND #$03 : TAX
LDA $7EF435 : AND #$FC : STA $7EF435
TXA : ORA $7EF435 : STA $7EF435
JMP .fullItemCounts
+ CMP.b #$0A : BNE + ; Swamp Palace
%BottomHalf($7EF439)
JMP .fullItemCounts
+ CMP.b #$0C : BNE + ; Palace of Darkness
%BottomHalf($7EF434)
JMP .fullItemCounts
+ CMP.b #$0E : BNE + ; Misery Mire
%BottomHalf($7EF438)
JMP .fullItemCounts
+ CMP.b #$10 : BNE + ; Skull Woods
%TopHalf($7EF437)
JMP .fullItemCounts
+ CMP.b #$12 : BNE + ; Ice Palace
%TopHalf($7EF438)
JMP .fullItemCounts
+ CMP.b #$14 : BNE + ; Tower of Hera
LDA $7EF435 : !ADD #$04 : AND #$1C : TAX
LDA $7EF435 : AND #$E3 : STA $7EF435
TXA : ORA $7EF435 : STA $7EF435
JMP .fullItemCounts
+ CMP.b #$16 : BNE + ; Thieves' Town
%BottomHalf($7EF437)
JMP .fullItemCounts
+ CMP.b #$18 : BNE + ; Turtle Rock
%TopHalf($7EF439)
JMP .fullItemCounts
+ CMP.b #$1A : BNE + ; Ganon's Tower
LDA $7EF436 : !ADD #$08 : STA $7EF436
LDA $7EF366 : AND #$04 : BNE ++
JSR .incrementGTowerPreBigKey JSR .incrementGTowerPreBigKey
++ ++
;JMP .fullItemCounts
+ +
; == END INDOOR-ONLY SECTION ; == END INDOOR-ONLY SECTION
.fullItemCounts .fullItemCounts
CPY.b #$3B : BNE + ; Skip Total Counts for Repeat Silver Arrows LDA BootsEquipment : BNE + ; Check for Boots
LDA $7EF42A : BIT #$20 : BEQ + : BRA .itemCounts LDA PreBootsLocations : INC : STA PreBootsLocations ; Increment Pre Boots Counter
+ +
LDA $7EF355 : BNE + ; Check for Boots LDA MirrorEquipment : BNE + ; Check for Mirror
LDA $7EF432 : INC : STA $7EF432 ; Increment Pre Boots Counter LDA PreMirrorLocations : INC : STA PreMirrorLocations ; Increment Pre Mirror Counter
+ +
LDA $7EF353 : BNE + ; Check for Mirror LDA FluteEquipment : BNE + ; Check for Flute
LDA $7EF433 : INC : STA $7EF433 ; Increment Pre Mirror Counter LDA PreFluteLocations : INC : STA PreFluteLocations ; Increment Pre Mirror Counter
+ +
LDA $7EF423 : INC : STA $7EF423 ; Increment Item Total REP #$20
LDA TotalItemCounter : INC : STA TotalItemCounter ; Increment Item Total
SEP #$20
.itemCounts .itemCounts
CPY.b #$00 : BNE + ; Fighter's Sword & Fighter's Shield CPY.b #$00 : BNE + ; Fighter's Sword & Fighter's Shield
LDX #$01
JSR .incrementSword JSR .incrementSword
JSR .incrementShield JSR .incrementShield
JMP .done JMP .done
+ CPY.b #$01 : BNE + ; Master Sword + CPY.b #$01 : BNE + ; Master Sword
LDX #$02
JSR .incrementSword JSR .incrementSword
JMP .done JMP .done
+ CPY.b #$02 : BNE + ; Tempered Sword + CPY.b #$02 : BNE + ; Tempered Sword
LDX #$03
JSR .incrementSword JSR .incrementSword
JMP .done JMP .done
+ CPY.b #$03 : BNE + ; Golden Sword + CPY.b #$03 : BNE + ; Golden Sword
LDX #$04
JSR .incrementSword JSR .incrementSword
JMP .done JMP .done
+ CPY.b #$04 : BNE + ; Fighter's Shield + CPY.b #$04 : BNE + ; Fighter's Shield
LDX #$01
JSR .incrementShield JSR .incrementShield
JMP .done JMP .done
+ CPY.b #$05 : BNE + ; Red Shield + CPY.b #$05 : BNE + ; Red Shield
LDX #$02
JSR .incrementShield JSR .incrementShield
JMP .done JMP .done
+ CPY.b #$06 : BNE + ; Mirror Shield + CPY.b #$06 : BNE + ; Mirror Shield
LDX #$03
JSR .incrementShield JSR .incrementShield
JMP .done JMP .done
+ CPY.b #$07 : !BLT + ; Items $07 - $0D + CPY.b #$07 : !BLT + ; Items $07 - $0D
@@ -432,18 +386,22 @@ AddInventory:
JMP .done JMP .done
+ CPY.b #$20 : BNE + ; Crystal + CPY.b #$20 : BNE + ; Crystal
JSR .incrementCrystal JSR .incrementCrystal
JSR .setDungeonCompletion
JMP .done JMP .done
+ CPY.b #$21 : BNE + ; Bug Net + CPY.b #$21 : BNE + ; Bug Net
JSR .incrementY JSR .incrementY
JMP .done JMP .done
+ CPY.b #$22 : !BLT + ; Items $22 - $23 + CPY.b #$22 : BNE + ; Blue Mail
CPY.b #$24 : !BGE + LDX #$01
JSR .incrementMail JSR .incrementMail
JMP .done + CPY.b #$23 : BNE + ; Red Mail
LDX #$02
JSR .incrementMail
+ CPY.b #$24 : BNE + ; Small Key + CPY.b #$24 : BNE + ; Small Key
JSR .incrementKey JSR .incrementKey
JMP .done JMP .done
+ CPY.b #$25 : BNE + ; Compass + CPY.b #$25 : BNE + ; Compass
JSL MaybeFlagCompassTotalPickup
JSR .incrementCompass JSR .incrementCompass
JMP .done JMP .done
+ CPY.b #$26 : BNE + ; Liar Heart (Container) + CPY.b #$26 : BNE + ; Liar Heart (Container)
@@ -455,7 +413,7 @@ AddInventory:
+ CPY.b #$28 : BNE + ; 3 Bombs + CPY.b #$28 : BNE + ; 3 Bombs
JSR .maybeIncrementBombs JSR .maybeIncrementBombs
JMP .done JMP .done
+ CPY.b #$29 : BNE + ; Musoroom + CPY.b #$29 : BNE + ; Mushroom
JSR .incrementY JSR .incrementY
JMP .done JMP .done
+ CPY.b #$2A : !BLT + ; Items $2A - $2D + CPY.b #$2A : !BLT + ; Items $2A - $2D
@@ -474,6 +432,7 @@ AddInventory:
+ CPY.b #$37 : !BLT + ; Items $37 - $39 - Pendants + CPY.b #$37 : !BLT + ; Items $37 - $39 - Pendants
CPY.b #$3A : !BGE + CPY.b #$3A : !BGE +
JSR .incrementPendant JSR .incrementPendant
JSR .setDungeonCompletion
JMP .done JMP .done
+ CPY.b #$3A : !BLT + ; Items $3A - $3B - Bow & Silver Arrows + CPY.b #$3A : !BLT + ; Items $3A - $3B - Bow & Silver Arrows
CPY.b #$3C : !BGE + CPY.b #$3C : !BGE +
@@ -493,6 +452,7 @@ AddInventory:
JSR .incrementY JSR .incrementY
JMP .done JMP .done
+ CPY.b #$49 : BNE + ; Fighter's Sword + CPY.b #$49 : BNE + ; Fighter's Sword
LDX #$01
JSR .incrementSword JSR .incrementSword
JMP .done JMP .done
+ CPY.b #$4A : BNE + ; Flute (Active) + CPY.b #$4A : BNE + ; Flute (Active)
@@ -503,7 +463,7 @@ AddInventory:
JSR .stampBoots JSR .stampBoots
JSR .incrementA JSR .incrementA
JMP .done JMP .done
+ CPY.b #$4C : BNE + ; Bomb Capacity Upgrade + CPY.b #$4C : BNE + ; 50 Bomb Capacity Upgrade
JSR .incrementCapacity JSR .incrementCapacity
JSR .maybeIncrementBombs JSR .maybeIncrementBombs
JMP .done JMP .done
@@ -512,22 +472,34 @@ AddInventory:
JSR .incrementCapacity JSR .incrementCapacity
JMP .done JMP .done
+ CPY.b #$50 : BNE + ; Master Sword (Safe) + CPY.b #$50 : BNE + ; Master Sword (Safe)
LDX #$02
JSR .incrementSword JSR .incrementSword
JMP .done JMP .done
+ CPY.b #$51 : BNE + ; 5 Bomb Capacity Upgrade
LDX #$02
JSR .maybeIncrementBombs
JMP .done
+ CPY.b #$52 : BNE + ; 10 Bomb Capacity Upgrade
LDX #$02
JSR .maybeIncrementBombs
JMP .done
+ CPY.b #$51 : !BLT + ; Items $51 - $54 - Capacity Upgrades + CPY.b #$51 : !BLT + ; Items $51 - $54 - Capacity Upgrades
CPY.b #$55 : !BGE + CPY.b #$55 : !BGE +
JSR .incrementCapacity JSR .incrementCapacity
JMP .done JMP .done
+ CPY.b #$58 : BNE + ; Upgrade-Only Sivler Arrows + CPY.b #$58 : BNE + ; Upgrade-Only Silver Arrows
JSR .incrementBow JSR .incrementBow
JMP .done JMP .done
+ CPY.b #$5E : BNE + ; Progressive Sword + CPY.b #$5E : BNE + ; Progressive Sword
LDA SwordEquipment : INC : TAX
JSR .incrementSword JSR .incrementSword
JMP .done JMP .done
+ CPY.b #$5F : BNE + ; Progressive Shield + CPY.b #$5F : BNE + ; Progressive Shield
LDA ShieldEquipment : INC : TAX
JSR .incrementShield JSR .incrementShield
JMP .done JMP .done
+ CPY.b #$60 : BNE + ; Progressive Armor + CPY.b #$60 : BNE + ; Progressive Armor
LDA ArmorEquipment : INC : TAX
JSR .incrementMail JSR .incrementMail
JMP .done JMP .done
+ CPY.b #$61 : BNE + ; Progressive Lifting Glove + CPY.b #$61 : BNE + ; Progressive Lifting Glove
@@ -543,6 +515,7 @@ AddInventory:
JMP .done JMP .done
+ CPY.b #$80 : !BLT + ; Items $80 - $8F - Free Compasses + CPY.b #$80 : !BLT + ; Items $80 - $8F - Free Compasses
CPY.b #$90 : !BGE + CPY.b #$90 : !BGE +
JSL MaybeFlagCompassTotalPickup
JSR .incrementCompass JSR .incrementCompass
JMP .done JMP .done
+ CPY.b #$90 : !BLT + ; Items $90 - $9F - Free Big Keys + CPY.b #$90 : !BLT + ; Items $90 - $9F - Free Big Keys
@@ -568,66 +541,52 @@ RTL
; WHICH BEE IS BOTTLED? ; WHICH BEE IS BOTTLED?
; MAKE SURE FAIRY FOUNTAINS DON'T FUCK THE COUNTS UP ; MAKE SURE FAIRY FOUNTAINS DON'T FUCK THE COUNTS UP
!NMI_TIME = "$7EF43E"
!SWORD_TIME = "$7EF458"
!BOOTS_TIME = "$7EF45C"
!FLUTE_TIME = "$7EF460"
!MIRROR_TIME = "$7EF464"
.stampSword .stampSword
REP #$20 ; set 16-bit accumulator REP #$20 ; set 16-bit accumulator
LDA !SWORD_TIME : BNE + LDA SwordTime : BNE +
LDA !SWORD_TIME+2 : BNE + LDA SwordTime+2 : BNE +
LDA !NMI_TIME : STA !SWORD_TIME LDA NMIFrames : STA SwordTime
LDA !NMI_TIME+2 : STA !SWORD_TIME+2 LDA NMIFrames+2 : STA SwordTime+2
+ +
SEP #$20 ; set 8-bit accumulator SEP #$20 ; set 8-bit accumulator
RTS RTS
.stampBoots .stampBoots
REP #$20 ; set 16-bit accumulator REP #$20 ; set 16-bit accumulator
LDA !BOOTS_TIME : BNE + LDA BootsTime : BNE +
LDA !BOOTS_TIME+2 : BNE + LDA BootsTime+2 : BNE +
LDA !NMI_TIME : STA !BOOTS_TIME LDA NMIFrames : STA BootsTime
LDA !NMI_TIME+2 : STA !BOOTS_TIME+2 LDA NMIFrames+2 : STA BootsTime+2
+ +
SEP #$20 ; set 8-bit accumulator SEP #$20 ; set 8-bit accumulator
RTS RTS
.stampFlute .stampFlute
REP #$20 ; set 16-bit accumulator REP #$20 ; set 16-bit accumulator
LDA !FLUTE_TIME : BNE + LDA FluteTime : BNE +
LDA !FLUTE_TIME+2 : BNE + LDA FluteTime+2 : BNE +
LDA !NMI_TIME : STA !FLUTE_TIME LDA NMIFrames : STA FluteTime
LDA !NMI_TIME+2 : STA !FLUTE_TIME+2 LDA NMIFrames+2 : STA FluteTime+2
+ +
SEP #$20 ; set 8-bit accumulator SEP #$20 ; set 8-bit accumulator
RTS RTS
.stampMirror .stampMirror
REP #$20 ; set 16-bit accumulator REP #$20 ; set 16-bit accumulator
LDA !MIRROR_TIME : BNE + LDA MirrorTime : BNE +
LDA !MIRROR_TIME+2 : BNE + LDA MirrorTime+2 : BNE +
LDA !NMI_TIME : STA !MIRROR_TIME LDA NMIFrames : STA MirrorTime
LDA !NMI_TIME+2 : STA !MIRROR_TIME+2 LDA NMIFrames+2 : STA MirrorTime+2
+ +
SEP #$20 ; set 8-bit accumulator SEP #$20 ; set 8-bit accumulator
RTS RTS
.incrementSword .incrementSword
; CHECK FOR DUPLICATE SWORDS
JSR .stampSword JSR .stampSword
TYA ; load sword item LDA HighestSword
CMP.b #$50 : BNE + : LDA.b #$01 : + ; convert extra master sword to normal one INC : STA $04 : CPX $04 : !BLT + ; don't increment unless we're getting a better sword
CMP.b #$49 : BNE + : LDA.b #$00 : + ; convert extra fighter sword to normal one TXA : STA HighestSword
INC : CMP !HIGHEST_SWORD_LEVEL : !BLT + ; skip if highest is higher +
PHA
LDA !HIGHEST_SWORD_LEVEL : AND #$F8 : ORA 1,s : STA !HIGHEST_SWORD_LEVEL
PLA
+
LDA $7EF422 : !ADD #$20 : STA $7EF422 ; increment sword counter
RTS RTS
.incrementBombLevel .incrementBombLevel
@@ -639,57 +598,50 @@ RTS
RTS RTS
.incrementShield .incrementShield
; CHECK FOR DUPLICATE SHIELDS LDA HighestShield
LDA $7EF422 : !ADD #$08 : AND #$18 : TAX INC : STA $04 : CPX $04 : !BLT + ; don't increment unless we're getting a better shield
LDA $7EF422 : AND #$E7 : STA $7EF422 TXA : STA HighestShield
TXA : ORA $7EF422 : STA $7EF422 +
RTS RTS
.incrementBow .incrementBow
CPY.b #$3B : BNE ++ LDA BowEquipment : BNE .dontCount ; Don't increment Y item count for extra bows
LDA $7EF42A : BIT #$20 : BEQ + : RTS : +
ORA #$20 : STA $7EF42A
++
.incrementY .incrementY
LDA $7EF421 : !ADD #$08 : STA $7EF421 LDA YAItemCounter : !ADD #$08 : STA YAItemCounter
.dontCount
RTS RTS
.incrementA .incrementA
LDA $7EF421 : INC : AND #$07 : TAX LDA YAItemCounter : INC : AND #$07 : TAX
LDA $7EF421 : AND #$F8 : STA $7EF421 LDA YAItemCounter : AND #$F8 : STA YAItemCounter
TXA : ORA $7EF421 : STA $7EF421 TXA : ORA YAItemCounter : STA YAItemCounter
RTS RTS
.incrementPendant .incrementPendant
LDA $7EF429 : INC : AND #$03 : TAX LDA PendantCounter : INC : STA PendantCounter
LDA $7EF429 : AND #$FC : STA $7EF429
TXA : ORA $7EF429 : STA $7EF429
; JSR .incrementBossSword
RTS RTS
.incrementCapacity .incrementCapacity
%BottomHalf($7EF452) LDA CapacityUpgrades : INC : STA CapacityUpgrades
RTS RTS
.incrementHeartPiece .incrementHeartPiece
LDA $7EF448 : INC : AND #$1F : TAX LDA HeartPieceCounter : INC : STA HeartPieceCounter
LDA $7EF448 : AND #$E0 : STA $7EF448
TXA : ORA $7EF448 : STA $7EF448
RTS RTS
.incrementHeartContainer .incrementHeartContainer
%TopHalf($7EF429) LDA HeartContainerCounter : INC : STA HeartContainerCounter
RTS RTS
.incrementCrystal .incrementCrystal
LDA $7EF422 : INC : AND #$07 : TAX LDA CrystalCounter : INC : STA CrystalCounter
LDA $7EF422 : AND #$F8 : STA $7EF422
TXA : ORA $7EF422 : STA $7EF422
; JSR .incrementBossSword
RTS RTS
.incrementMail .incrementMail
LDA $7EF424 : !ADD #$40 : STA $7EF424 LDA HighestMail
INC : STA $04 : CPX $04 : !BLT + ; don't increment unless we're getting a better mail
TXA : STA HighestMail
+
RTS RTS
.incrementKeyLong .incrementKeyLong
@@ -697,36 +649,30 @@ RTS
RTL RTL
.incrementKey .incrementKey
PHA : PHX LDA SmallKeyCounter : INC : STA SmallKeyCounter
LDA $7EF424 : INC : AND #$3F : TAX
LDA $7EF424 : AND #$C0 : STA $7EF424
TXA : ORA $7EF424 : STA $7EF424
PLX : PLA
RTS RTS
.incrementCompass .incrementCompass
%BottomHalf($7EF428) %BottomHalf(MapsCompasses)
RTS RTS
.incrementBigKey .incrementBigKey
LDA $7EF427 : !ADD #$10 : STA $7EF427 %TopHalf(BigKeysBigChests)
RTS RTS
.incrementGTowerPreBigKey .incrementGTowerPreBigKey
LDA $7EF42A : INC : AND #$1F : TAX LDA PreGTBKLocations : INC : STA PreGTBKLocations
LDA $7EF42A : AND #$E0 : STA $7EF42A
TXA : ORA $7EF42A : STA $7EF42A
RTS RTS
.maybeIncrementBombs .maybeIncrementBombs
LDA $7EF42A : AND #$80 : BNE + LDA InventoryTracking+1 : AND #$02 : BNE +
LDA $7EF42A : ORA #$80 : STA $7EF42A LDA InventoryTracking+1 : ORA #$02 : STA InventoryTracking+1
JSR .incrementY JSR .incrementY
+ +
RTS RTS
.incrementMap .incrementMap
LDA $7EF428 : !ADD #$10 : STA $7EF428 %TopHalf(MapsCompasses)
RTS RTS
.incrementBossSwordLong .incrementBossSwordLong
@@ -738,33 +684,61 @@ RTL
CMP #$03 : BEQ + CMP #$03 : BEQ +
CMP #$04 : BEQ + CMP #$04 : BEQ +
CMP #$05 : BEQ + CMP #$05 : BEQ +
LDA $7EF359 : BRA ++ LDA SwordEquipment : BRA ++
+ : LDA !WEAPON_LEVEL + : LDA SpecialWeaponLevel
++ ++
BNE + : - BNE + : -
%TopHalf($7EF452) : RTS LDA SwordlessBossKills : INC : STA SwordlessBossKills
RTS
+ CMP #$FF : BEQ - + CMP #$FF : BEQ -
+ CMP #$01 : BNE + + CMP #$01 : BNE +
%TopHalf($7EF425) : RTS %TopHalf(SwordBossKills) : RTS
+ CMP #$02 : BNE + + CMP #$02 : BNE +
%BottomHalf($7EF425) : RTS %BottomHalf(SwordBossKills) : RTS
+ CMP #$03 : BNE + + CMP #$03 : BNE +
%TopHalf($7EF426) : RTS %TopHalf(SwordBossKills+1) : RTS
+ CMP #$04 : BNE + + CMP #$04 : BNE +
%BottomHalf($7EF426) %BottomHalf(SwordBossKills+1)
+ +
RTS RTS
.setDungeonCompletion
LDA $040C
CMP #$FF : BEQ +
LSR : AND #$0F : CMP #$08 : !BGE ++
JSR .valueShift
ORA DungeonsCompleted : STA DungeonsCompleted
BRA +
++
!SUB #$08
JSR .valueShift
BIT.b #$C0 : BEQ +++ : LDA.b #$C0 : +++ ; Make Hyrule Castle / Sewers Count for Both
ORA DungeonsCompleted+1 : STA DungeonsCompleted+1
+
RTS
.valueShift
PHX
TAX : LDA.b #$01
-
CPX #$00 : BEQ +
ASL
DEX
BRA -
+
PLX
RTS
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
; Link_ReceiveItem_HUDRefresh: ; Link_ReceiveItem_HUDRefresh:
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
Link_ReceiveItem_HUDRefresh: Link_ReceiveItem_HUDRefresh:
LDA $7EF343 : BNE + ; skip if we have bombs LDA BombsEquipment : BNE + ; skip if we have bombs
LDA $7EF370 : !ADD.l StartingMaxBombs : BEQ + ; skip if we can't have bombs LDA BombCapacityUpgrades : !ADD.l StartingMaxBombs : BEQ + ; skip if we can't have bombs
LDA $7EF375 : BEQ + ; skip if we are filling no bombs LDA BombsFiller : BEQ + ; skip if we are filling no bombs
DEC : STA $7EF375 ; decrease bomb fill count DEC : STA BombsFiller ; decrease bomb fill count
LDA.b #$01 : STA $7EF343 ; increase actual bomb count LDA.b #$01 : STA BombsEquipment ; increase actual bomb count
+ +
JSL.l HUD_RefreshIconLong ; thing we wrote over JSL.l HUD_RefreshIconLong ; thing we wrote over
@@ -776,9 +750,9 @@ RTL
; HandleBombAbsorbtion: ; HandleBombAbsorbtion:
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
HandleBombAbsorbtion: HandleBombAbsorbtion:
STA $7EF375 ; thing we wrote over STA BombsFiller ; thing we wrote over
LDA $0303 : BNE + ; skip if we already have some item selected LDA $0303 : BNE + ; skip if we already have some item selected
LDA $7EF370 : !ADD.l StartingMaxBombs : BEQ + ; skip if we can't have bombs LDA BombCapacityUpgrades : !ADD.l StartingMaxBombs : BEQ + ; skip if we can't have bombs
LDA.b #$04 : STA $0202 ; set selected item to bombs LDA.b #$04 : STA $0202 ; set selected item to bombs
LDA.b #$01 : STA $0303 ; set selected item to bombs LDA.b #$01 : STA $0303 ; set selected item to bombs
JSL.l HUD_RebuildLong JSL.l HUD_RebuildLong
@@ -793,13 +767,13 @@ RTL
AddYMarker: AddYMarker:
LDA $0202 : AND.w #$FF ; load item value LDA $0202 : AND.w #$FF ; load item value
CMP.w #$02 : BNE + ; boomerang CMP.w #$02 : BNE + ; boomerang
LDA !INVENTORY_SWAP : AND.w #$C0 : CMP.w #$C0 : BEQ .drawYBubble : BRA .drawNormal LDA InventoryTracking : AND.w #$C0 : CMP.w #$C0 : BEQ .drawYBubble : BRA .drawNormal
+ CMP.w #$01 : BNE + ; bow + CMP.w #$01 : BNE + ; bow
LDA !INVENTORY_SWAP_2 : AND.w #$C0 : CMP.w #$C0 : BEQ .drawYBubble : BRA .drawNormal LDA BowTracking : AND.w #$C0 : CMP.w #$C0 : BEQ .drawYBubble : BRA .drawNormal
+ CMP.w #$05 : BNE + ; powder + CMP.w #$05 : BNE + ; powder
LDA !INVENTORY_SWAP : AND.w #$30 : CMP.w #$30 : BEQ .drawYBubble : BRA .drawNormal LDA InventoryTracking : AND.w #$30 : CMP.w #$30 : BEQ .drawYBubble : BRA .drawNormal
+ CMP.w #$0D : BNE + ; flute + CMP.w #$0D : BNE + ; flute
LDA !INVENTORY_SWAP : BIT.w #$04 : BEQ .drawNormal ; make sure we have shovel LDA InventoryTracking : BIT.w #$04 : BEQ .drawNormal ; make sure we have shovel
AND.w #$03 : BNE .drawYBubble ; make sure we have one of the flutes AND.w #$03 : BNE .drawYBubble ; make sure we have one of the flutes
BRA .drawNormal BRA .drawNormal
+ CMP.w #$10 : BEQ .drawJarMarker + CMP.w #$10 : BEQ .drawJarMarker
@@ -853,8 +827,8 @@ RTS
; UpgradeFlute: ; UpgradeFlute:
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
UpgradeFlute: UpgradeFlute:
LDA !INVENTORY_SWAP : AND #$FC : ORA #$01 : STA !INVENTORY_SWAP ; switch to the working flute LDA InventoryTracking : AND #$FC : ORA #$01 : STA InventoryTracking ; switch to the working flute
LDA.b #$03 : STA $7EF34C ; upgrade primary inventory LDA.b #$03 : STA FluteEquipment ; upgrade primary inventory
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
@@ -881,10 +855,10 @@ RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
LoadKeys: LoadKeys:
LDA.l GenericKeys : BEQ + LDA.l GenericKeys : BEQ +
LDA $7EF38B LDA CurrentGenericKeys
RTL RTL
+ +
LDA $7EF37C, X LDA DungeonKeys, X
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
@@ -894,10 +868,10 @@ RTL
SaveKeys: SaveKeys:
PHA PHA
LDA.l GenericKeys : BEQ + LDA.l GenericKeys : BEQ +
PLA : STA $7EF38B PLA : STA CurrentGenericKeys
RTL RTL
+ +
PLA : STA $7EF37C, X PLA : STA DungeonKeys, X
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
@@ -911,10 +885,10 @@ ClearOWKeys:
JSL.l FakeWorldFix JSL.l FakeWorldFix
JSR.w FixBunnyOnExitToLightWorld JSR.w FixBunnyOnExitToLightWorld
LDA.l GenericKeys : BEQ + LDA.l GenericKeys : BEQ +
PLA : LDA $7EF38B : STA $7EF36F PLA : LDA CurrentGenericKeys : STA CurrentSmallKeys
RTL RTL
+ +
PLA : STA $7EF36F PLA : STA CurrentSmallKeys
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
@@ -977,10 +951,10 @@ RTL
; InitializeBottles: ; InitializeBottles:
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
InitializeBottles: InitializeBottles:
STA $7EF35C, X ; thing we wrote over STA BottleContents, X ; thing we wrote over
PHA PHA
LDA $7EF34F : BNE + LDA BottleIndex : BNE +
TXA : INC : STA $7EF34F ; write bottle index to menu properly TXA : INC : STA BottleIndex ; write bottle index to menu properly
+ +
PLA PLA
RTL RTL
@@ -1069,12 +1043,12 @@ RTL
; RemoveMushroom: ; RemoveMushroom:
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
RemoveMushroom: RemoveMushroom:
LDA !INVENTORY_SWAP : AND #$DF : STA !INVENTORY_SWAP ; remove the mushroom LDA InventoryTracking : AND #$DF : STA InventoryTracking ; remove the mushroom
AND #$10 : BEQ .empty ; check if we have powder AND #$10 : BEQ .empty ; check if we have powder
LDA.b #$02 : STA $7EF344 ; give powder if we have it LDA.b #$02 : STA PowderEquipment ; give powder if we have it
RTL RTL
.empty .empty
LDA.b #$00 : STA $7EF344 ; clear the inventory slot if we don't have powder LDA.b #$00 : STA PowderEquipment ; clear the inventory slot if we don't have powder
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
@@ -1082,7 +1056,7 @@ RTL
; DrawMagicHeader: ; DrawMagicHeader:
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
DrawMagicHeader: DrawMagicHeader:
LDA $7EF37B : AND.w #$00FF : CMP.w #$0002 : BEQ .quarterMagic LDA MagicConsumption : AND.w #$00FF : CMP.w #$0002 : BEQ .quarterMagic
.halfMagic .halfMagic
LDA.w #$28F7 : STA $7EC704 LDA.w #$28F7 : STA $7EC704
LDA.w #$2851 : STA $7EC706 LDA.w #$2851 : STA $7EC706
@@ -1100,7 +1074,7 @@ RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
;FixShovelLock: ;FixShovelLock:
; LDA $037A : CMP #$01 : BEQ + ; skip if link is shoveling ; LDA $037A : CMP #$01 : BEQ + ; skip if link is shoveling
; LDA $7EF34C ; load shovel/flute item ID ; LDA FluteEquipment ; load shovel/flute item ID
; + ; +
; CMP #$00 ; CMP #$00
;RTL ;RTL

View File

@@ -71,7 +71,7 @@ Overworld_CreatePyramidHoleModified:
SEP #$30 SEP #$30
LDA $7EF2DB : ORA.b #$20 : STA $7EF2DB LDA OverworldEventDataWRAM+$5B : ORA.b #$20 : STA OverworldEventDataWRAM+$5B
LDA.b #$03 : STA $012F LDA.b #$03 : STA $012F
@@ -131,9 +131,9 @@ db $02, $02, $02, $02, $02, $02, $02, $00, $00, $01, $01, $01, $02, $00, $08, $0
Electric_Barrier: Electric_Barrier:
LDA InvertedMode : BEQ .done LDA InvertedMode : BEQ .done
LDA $7EF280, X : ORA #$40 : STA $7EF280, X ;set barrier dead LDA OverworldEventDataWRAM, X : ORA #$40 : STA OverworldEventDataWRAM, X ;set barrier dead
.done .done
LDA $7EF280, X ; what we wrote over LDA OverworldEventDataWRAM, X ; what we wrote over
RTL RTL
@@ -187,7 +187,7 @@ RTL
TurtleRockPegSolved: TurtleRockPegSolved:
LDA.l InvertedMode : AND.w #$00FF : BNE + LDA.l InvertedMode : AND.w #$00FF : BNE +
LDA.l $7ef287 ; What we wrote over (reading flags for this screen) LDA.l OverworldEventDataWRAM+07 ; What we wrote over (reading flags for this screen)
RTL RTL
+ +
LDA.w #$0020 ; We always treat puzzle as pre solved (overlay flag set) for inverted mode. LDA.w #$0020 ; We always treat puzzle as pre solved (overlay flag set) for inverted mode.

View File

@@ -1007,7 +1007,7 @@ LDA #$0108 : STA $3C38
;Warp Tile agah defeated ;Warp Tile agah defeated
LDA #$0034 : STA $3BBE ;Tile when no warp LDA #$0034 : STA $3BBE ;Tile when no warp
LDA $7EF3C5 : AND #$00FF : CMP #$0003 : BNE .agahnimAlive LDA ProgressIndicator : AND #$00FF : CMP #$0003 : BNE .agahnimAlive
LDA #$0212 : STA $3BBE ;warp LDA #$0212 : STA $3BBE ;warp
.agahnimAlive .agahnimAlive

View File

@@ -17,10 +17,10 @@ ItemDowngradeFixMain:
CPY.b #$0B : BEQ .isBow ; Bow CPY.b #$0B : BEQ .isBow ; Bow
CPY.b #$3A : BEQ .isBowAndArrows ; Bow CPY.b #$3A : BEQ .isBowAndArrows ; Bow
CPY.b #$49 : BEQ .isFightersSword ; Fighter's Sword CPY.b #$49 : BEQ .isSword ; Fighter's Sword
CPY.b #$01 : BEQ .isMasterSword ; Master Sword CPY.b #$01 : BEQ .isSword ; Master Sword
CPY.b #$50 : BEQ .isMasterSword ; Master Sword (Safe) CPY.b #$50 : BEQ .isSword ; Master Sword (Safe)
CPY.b #$02 : BEQ .isTemperedSword ; Tempered Sword CPY.b #$02 : BEQ .isSword ; Tempered Sword
CPY.b #$3B : BEQ .isSilverArrowBow ; Silver Arrow Bow CPY.b #$3B : BEQ .isSilverArrowBow ; Silver Arrow Bow
CPY.b #$2A : BEQ .isRedBoomerang ; Red Boomerang CPY.b #$2A : BEQ .isRedBoomerang ; Red Boomerang
@@ -32,6 +32,8 @@ ItemDowngradeFixMain:
CPY.b #$B1 : !BLT + : CPY.b #$B6 : !BLT .isBombUpgrade : + CPY.b #$B1 : !BLT + : CPY.b #$B6 : !BLT .isBombUpgrade : +
CPY.b #$B7 : !BLT + : CPY.b #$BC : !BLT .isCaneUpgrade : + CPY.b #$B7 : !BLT + : CPY.b #$BC : !BLT .isCaneUpgrade : +
CPY.b #$00 : BEQ .isUncleSwordShield ; Fighter's Sword & Shield
.done .done
STA [$00] ; thing we wrote over part 2 STA [$00] ; thing we wrote over part 2
.dontWrite .dontWrite
@@ -59,16 +61,15 @@ RTS
+ +
PLA PLA
RTS RTS
.isFightersSword .isSword
.isMasterSword
.isTemperedSword
PHA PHA
LDA HighestSword : STA $04
TYA ; load sword item TYA ; load sword item
CMP.b #$49 : BNE + : LDA.b #$00 : + ; convert extra fighter's sword to normal one CMP.b #$49 : BNE + : LDA.b #$00 : + ; convert extra fighter's sword to normal one
CMP.b #$50 : BNE + : LDA.b #$01 : + ; convert extra master sword to normal one CMP.b #$50 : BNE + : LDA.b #$01 : + ; convert extra master sword to normal one
INC : CMP !HIGHEST_SWORD_LEVEL : !BGE + ; skip if highest is lower (this is an upgrade) INC : CMP $04 : !BGE + ; skip if highest is lower (this is an upgrade)
LDA !HIGHEST_SWORD_LEVEL : DEC ; convert to item id LDA $04 : DEC ; convert to item id
TAY : PLA : LDA !HIGHEST_SWORD_LEVEL ; put sword id into the thing to write TAY : PLA : LDA $04 ; put sword id into the thing to write
JMP .done JMP .done
+ +
PLA PLA
@@ -77,9 +78,9 @@ JMP .done
PHA PHA
TYA ; load bomb upgrade item TYA ; load bomb upgrade item
!SUB #$B0 ; convert to bomb level !SUB #$B0 ; convert to bomb level
CMP.l !WEAPON_LEVEL : !BGE + ; skip if highest is lower (this is an upgrade) CMP.l SpecialWeaponLevel : !BGE + ; skip if highest is lower (this is an upgrade)
LDA.l !WEAPON_LEVEL : !ADD #$B0 ; convert to item id LDA.l SpecialWeaponLevel : !ADD #$B0 ; convert to item id
TAY : PLA : LDA.l !WEAPON_LEVEL ; put bomb level into the thing to write TAY : PLA : LDA.l SpecialWeaponLevel ; put bomb level into the thing to write
JMP .done JMP .done
+ +
PLA PLA
@@ -88,11 +89,18 @@ JMP .done
PHA PHA
TYA ; load cane upgrade item TYA ; load cane upgrade item
!SUB #$B6 ; convert to cane level !SUB #$B6 ; convert to cane level
CMP.l !WEAPON_LEVEL : !BGE + ; skip if highest is lower (this is an upgrade) CMP.l SpecialWeaponLevel : !BGE + ; skip if highest is lower (this is an upgrade)
LDA.l !WEAPON_LEVEL : !ADD #$B6 ; convert to item id LDA.l SpecialWeaponLevel : !ADD #$B6 ; convert to item id
TAY : PLA : LDA.l !WEAPON_LEVEL ; put cane level into the thing to write TAY : PLA : LDA.l SpecialWeaponLevel ; put cane level into the thing to write
JMP .done JMP .done
+ +
PLA PLA
JMP .done JMP .done
.isUncleSwordShield
PHA
LDA HighestSword : STA [$00] ; already set to 1 if we had no sword, always keep highest
INC $00
LDA HighestShield : STA [$00]
PLA
RTS
;================================================================================ ;================================================================================

View File

@@ -4,12 +4,12 @@
; Output: 0 for darkness, 1 for lamp cone ; Output: 0 for darkness, 1 for lamp cone
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
LampCheck: LampCheck:
LDA $7F50C4 : CMP.b #$01 : BNE + : RTL : + LDA LightConeModifier : CMP.b #$01 : BNE + : RTL : +
CMP.b #$FF : BNE + : INC : RTL : + CMP.b #$FF : BNE + : INC : RTL : +
LDA $7EF34A : BNE .done ; skip if we already have lantern LDA LampEquipment : BNE .done ; skip if we already have lantern
LDA $7EF3CA : BNE + LDA CurrentWorld : BNE +
.lightWorld .lightWorld
LDA $040C : BNE ++ ; check if we're in sewers LDA $040C : BNE ++ ; check if we're in sewers
LDA LampConeSewers : BRA .done LDA LampConeSewers : BRA .done
@@ -26,20 +26,17 @@ RTL
; Output: 0 locked, 1 open ; Output: 0 locked, 1 open
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
CheckForZelda: CheckForZelda:
;LDA.l OpenMode : BEQ + ; Skip if not open mode LDA.l ProgressIndicator : CMP.b #$02 : !BLT + ; Skip if rain is falling
;LDA $FFFFFF
LDA.l $7EF3C5 : CMP.b #$02 : !BLT + ; Skip if rain is falling
LDA.b #$01 ; pretend we have zelda anyway LDA.b #$01 ; pretend we have zelda anyway
RTL RTL
+ +
LDA $7EF3CC LDA FollowerIndicator
RTL RTL
;================================================================================ ;================================================================================
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
SetOverlayIfLamp: SetOverlayIfLamp:
;LDA $7EF34A ; check if lamp
JSL.l LampCheck JSL.l LampCheck
STA $1D ; write it directly to the overlay, this isn't a terrible idea at all STA $1D ; write it directly to the overlay, this isn't a terrible idea at all
RTL RTL
;================================================================================ ;================================================================================
;LDA $7EF3CA : EOR #$40 : LSR #6 : AND #$01 ; return the same result as having the lantern in the light world ;LDA CurrentWorld : EOR #$40 : LSR #6 : AND #$01 ; return the same result as having the lantern in the light world

View File

@@ -14,14 +14,12 @@ MaidenCrystalScript:
; Load the dungeon index. Is it the Dark Palace? ; Load the dungeon index. Is it the Dark Palace?
;LDA $040C : !SUB.b #$0A : TAY : CPY.b #$02 : BNE + ;LDA $040C : !SUB.b #$0A : TAY : CPY.b #$02 : BNE +
; LDA $7EF3C7 : CMP.b #$07 : BCS ++ : LDA.b #$07 : STA $7EF3C7 : ++ ; LDA MapIcons : CMP.b #$07 : BCS ++ : LDA.b #$07 : STA MapIcons : ++
;+ ;+
LDA $7EF37A : AND.b #$7F : CMP.b #$7F : BNE + ; check if we have all crystals LDA CrystalsField : AND.b #$7F : CMP.b #$7F : BNE + ; check if we have all crystals
LDA.b #$08 : STA $7EF3C7 ; Update the map icon to just be Ganon's Tower LDA.b #$08 : STA MapIcons ; Update the map icon to just be Ganon's Tower
+ +
JSL.l MaybeWriteSRAMTrace
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 $7EF3C6 : AND.b #$04 : BEQ + LDA ProgressFlags : AND.b #$04 : BEQ +
LDA.b #$0A : STA $0D10, X ; just spawn it off to the side where we know it should be LDA.b #$0A : STA $0D10, X ; just spawn it off to the side where we know it should be
LDA.b #$03 : STA $0D30, X LDA.b #$03 : STA $0D30, X
LDA.b #$90 : STA $0ED0, X LDA.b #$90 : STA $0ED0, X
+ +
LDA $0D00, X : !ADD.b #$03 ; thing we did originally LDA $0D00, X : !ADD.b #$03 ; thing we did originally
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------

View File

@@ -6,7 +6,7 @@ TryOpenMire:
LDA $8A : CMP.b #$70 : BNE .untriggered LDA $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 $7EF2F0 : AND.b #$20 : BNE .untriggered LDA 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
@@ -25,7 +25,7 @@ TryOpenTRock:
LDA $8A : CMP.b #$47 : BNE .untriggered LDA $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 $7EF2C7 : AND.b #$20 : BNE .untriggered LDA 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
@@ -73,4 +73,4 @@ MedallionTrigger_Quake:
+ +
PLA PLA
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------

26
msu.asm
View File

@@ -250,20 +250,20 @@ CheckMusicLoadRequest:
BRA .check_fallback-3 BRA .check_fallback-3
.lightworld .lightworld
PHA PHA
LDA $7EF300 : AND.b #$40 : BEQ + LDA OverworldEventDataWRAM+$80 : AND.b #$40 : BEQ +
PLA PLA
LDA.b #60 : BRA .check_fallback-3 LDA.b #60 : BRA .check_fallback-3
+ +
-- : PLA : BRA .check_fallback-3 -- : PLA : BRA .check_fallback-3
.darkworld .darkworld
PHA PHA
LDA $7EF37A : CMP.b #$7F : BNE -- LDA CrystalsField : CMP.b #$7F : BNE --
- : PLA - : PLA
LDA.b #61 : BRA .check_fallback-3 LDA.b #61 : BRA .check_fallback-3
.darkwoods .darkwoods
PHA PHA
LDA $7EF37A : CMP.b #$7F : BEQ - LDA CrystalsField : CMP.b #$7F : BEQ -
LDA $7EF3CA : BEQ -- LDA CurrentWorld : BEQ --
LDA $8A : CMP #$40 : BNE -- LDA $8A : CMP #$40 : BNE --
PLA PLA
LDA.b #15 : BRA .check_fallback-3 LDA.b #15 : BRA .check_fallback-3
@@ -344,10 +344,10 @@ CheckMusicLoadRequest:
+ +
CMP.b #$70 : BNE + ; Misery Mire CMP.b #$70 : BNE + ; Misery Mire
LDA $7EF2F0 : AND.b #$20 : BEQ .rain LDA OverworldEventDataWRAM+$70 : AND.b #$20 : BEQ .rain
+ +
LDA $7EF3C5 : CMP.b #$02 : BCS + LDA ProgressIndicator : CMP.b #$02 : BCS +
.rain .rain
LDX.b #$01 LDX.b #$01
+ +
@@ -385,7 +385,7 @@ SpiralStairsPreCheck:
LDA !REG_MSU_ID_45 : CMP !VAL_MSU_ID_45 : BNE .done LDA !REG_MSU_ID_45 : CMP !VAL_MSU_ID_45 : BNE .done
+ +
LDA $7EF366 : AND.w #$0004 : BEQ .done ; Check that we have the GT big key LDA BigKeyField : AND.w #$0004 : BEQ .done ; Check that we have the GT big key
LDA !REG_MSU_FALLBACK_TABLE+7 : AND.w #$0004 : BEQ .done ; Check that we have the extended track LDA !REG_MSU_FALLBACK_TABLE+7 : AND.w #$0004 : BEQ .done ; Check that we have the extended track
.fade .fade
@@ -517,16 +517,16 @@ PHA : XBA : PHA
; dont save if we already saved recently ; dont save if we already saved recently
REP #$20 REP #$20
LDA !MSU_RESUME_TRACK : AND #$00FF : BEQ ++ LDA !MSU_RESUME_TRACK : AND #$00FF : BEQ ++
LDA !NMI_COUNTER : !SUB !MSU_RESUME_TIME : PHA LDA NMIFrames : !SUB !MSU_RESUME_TIME : PHA
LDA !NMI_COUNTER+2 : SBC !MSU_RESUME_TIME+2 : BNE +++ LDA NMIFrames+2 : SBC !MSU_RESUME_TIME+2 : BNE +++
PLA : CMP MSUResumeTimer : !BLT .too_early PLA : CMP MSUResumeTimer : !BLT .too_early
BRA ++ BRA ++
+++ +++
PLA PLA
++ ++
; saving ; saving
LDA !NMI_COUNTER : STA !MSU_RESUME_TIME LDA NMIFrames : STA !MSU_RESUME_TIME
LDA !NMI_COUNTER+2 : STA !MSU_RESUME_TIME+2 LDA NMIFrames+2 : STA !MSU_RESUME_TIME+2
SEP #$20 SEP #$20
LDA !MSU_LOADED_TRACK : STA !MSU_RESUME_TRACK LDA !MSU_LOADED_TRACK : STA !MSU_RESUME_TRACK
@@ -683,8 +683,8 @@ MSUMain:
PLX PLX
TXA : CMP !MSU_RESUME_TRACK : BNE + ; dont resume if too late TXA : CMP !MSU_RESUME_TRACK : BNE + ; dont resume if too late
REP #$20 REP #$20
LDA !NMI_COUNTER : !SUB !MSU_RESUME_TIME : PHA LDA NMIFrames : !SUB !MSU_RESUME_TIME : PHA
LDA !NMI_COUNTER+2 : SBC !MSU_RESUME_TIME+2 : BNE ++ LDA NMIFrames+2 : SBC !MSU_RESUME_TIME+2 : BNE ++
PLA : CMP MSUResumeTimer : !BGE +++ PLA : CMP MSUResumeTimer : !BGE +++
SEP #$20 SEP #$20
LDA !FLAG_RESUME_FADEIN : BRA .done_resume LDA !FLAG_RESUME_FADEIN : BRA .done_resume

View File

@@ -22,7 +22,7 @@ PreOverworld_LoadProperties_ChooseMusic:
LDX.b #$07 ; Default village theme LDX.b #$07 ; Default village theme
; Check what phase we're in ; Check what phase we're in
;LDA $7EF3C5 : CMP.b #$03 : !BLT + ;LDA ProgressIndicator : CMP.b #$03 : !BLT +
; LDX.b #$02 ; Default light world theme (phase >=3) ; LDX.b #$02 ; Default light world theme (phase >=3)
;+ ;+
@@ -33,7 +33,7 @@ PreOverworld_LoadProperties_ChooseMusic:
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 $7EF300 : AND.b #$40 : BEQ + LDA OverworldEventDataWRAM+$80 : AND.b #$40 : BEQ +
LDX.b #$02 ; Default light world theme LDX.b #$02 ; Default light world theme
+ +
@@ -45,14 +45,14 @@ PreOverworld_LoadProperties_ChooseMusic:
LDX.b #$02 LDX.b #$02
; Check phase ; In phase >= 2 ; Check phase ; In phase >= 2
LDA $7EF3C5 : CMP.b #$02 : !BGE + LDA 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 $7EF3CA : BEQ .checkInverted+4 LDA CurrentWorld : BEQ .checkInverted+4
LDX.b #$0F ; dark woods theme LDX.b #$0F ; dark woods theme
@@ -68,10 +68,10 @@ 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 $7EF3CA : CLC : ROL #$03 : CMP InvertedMode : BEQ .lastCheck LDA CurrentWorld : CLC : ROL #$03 : CMP InvertedMode : BEQ .lastCheck
; Does Link have a moon pearl? ; Does Link have a moon pearl?
LDA $7EF357 : BNE + LDA MoonPearlEquipment : BNE +
LDX.b #$04 ; bunny theme LDX.b #$04 ; bunny theme
+ +
@@ -117,8 +117,8 @@ Overworld_FinishMirrorWarp:
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 $7EF3CA : CLC : ROL #$03 : CMP InvertedMode : BEQ + LDA CurrentWorld : CLC : ROL #$03 : CMP InvertedMode : BEQ +
LDA $7EF357 : BEQ .endOfLightWorldChecks LDA MoonPearlEquipment : BEQ .endOfLightWorldChecks
+ +
LDX.b #$09 ; default dark world theme LDX.b #$09 ; default dark world theme
@@ -129,7 +129,7 @@ Overworld_FinishMirrorWarp:
; 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 $7EF300 : AND.b #$40 : BNE .endOfLightWorldChecks LDA OverworldEventDataWRAM+$80 : AND.b #$40 : BNE .endOfLightWorldChecks
LDX.b #$05 ; lost woods theme LDX.b #$05 ; lost woods theme
BRA .endOfLightWorldChecks BRA .endOfLightWorldChecks
+ +
@@ -138,7 +138,7 @@ 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 $7EF3C5 : CMP.b #$03 : !BGE .endOfLightWorldChecks ; 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
@@ -158,7 +158,7 @@ Overworld_FinishMirrorWarp:
LDX.b #$0D ; dark mountain theme LDX.b #$0D ; dark mountain theme
.bunny .bunny
LDA $7EF357 : ORA InvertedMode : BNE + LDA MoonPearlEquipment : ORA InvertedMode : BNE +
LDX #$04 ; bunny theme LDX #$04 ; bunny theme
+ +
@@ -185,7 +185,7 @@ BirdTravel_LoadTargetAreaMusic:
LDX.b #$07 ; Default village theme LDX.b #$07 ; Default village theme
; Check what phase we're in ; Check what phase we're in
;LDA $7EF3C5 : CMP.b #$03 : !BLT + ;LDA ProgressIndicator : CMP.b #$03 : !BLT +
; LDX.b #$02 ; Default light world theme (phase >=3) ; LDX.b #$02 ; Default light world theme (phase >=3)
;+ ;+
@@ -196,7 +196,7 @@ BirdTravel_LoadTargetAreaMusic:
;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 $7EF300 : AND.b #$40 : BEQ + ;LDA OverworldEventDataWRAM+$80 : AND.b #$40 : BEQ +
; LDX.b #$02 ; Default light world theme ; LDX.b #$02 ; Default light world theme
;+ ;+
@@ -208,21 +208,21 @@ BirdTravel_LoadTargetAreaMusic:
LDX.b #$02 LDX.b #$02
; Check phase ; In phase >= 2 ; Check phase ; In phase >= 2
LDA $7EF3C5 : CMP.b #$02 : !BGE + LDA 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 $7EF3CA : BEQ .checkInverted+4 LDA CurrentWorld : BEQ .checkInverted+4
LDX.b #$09 ; dark overworld theme LDX.b #$09 ; dark overworld theme
LDA $8A LDA $8A
; Misery Mire rain SFX ; Misery Mire rain SFX
CMP.b #$70 : BNE ++ CMP.b #$70 : BNE ++
LDA $7EF2F0 : AND.b #$20 : BNE ++ LDA OverworldEventDataWRAM+$70 : AND.b #$20 : BNE ++
LDA.b #$01 : CMP $0131 : BEQ + LDA.b #$01 : CMP $0131 : BEQ +
STA $012D STA $012D
+ : BRA .checkInverted + : BRA .checkInverted
@@ -236,16 +236,16 @@ BirdTravel_LoadTargetAreaMusic:
BRA .checkInverted BRA .checkInverted
.darkMountain .darkMountain
LDA $7EF37A : CMP.b #$7F : BEQ + LDA 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 $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 $7EF3CA : CLC : ROL #$03 : CMP InvertedMode : BEQ .lastCheck LDA CurrentWorld : CLC : ROL #$03 : CMP InvertedMode : BEQ .lastCheck
; Does Link have a moon pearl? ; Does Link have a moon pearl?
LDA $7EF357 : BNE + LDA MoonPearlEquipment : BNE +
LDX.b #$04 ; bunny theme LDX.b #$04 ; bunny theme
+ +
@@ -275,7 +275,7 @@ Overworld_MosaicDarkWorldChecks:
CMP.b #$51 : bne .doFade CMP.b #$51 : bne .doFade
.checkCrystals .checkCrystals
LDA $7EF37A : CMP.b #$7F : BEQ .done LDA CrystalsField : CMP.b #$7F : BEQ .done
.doFade .doFade
LDA.b #$F1 : STA $012C ; thing we wrote over, fade out music LDA.b #$F1 : STA $012C ; thing we wrote over, fade out music

View File

@@ -3,16 +3,15 @@ SEP #$30
;================================================================================ ;================================================================================
; Draw bomb count ; Draw bomb count
!BOMBCOUNT_DRAW_ADDRESS = "$7EC75A" !BOMBCOUNT_DRAW_ADDRESS = "$7EC75A"
!INFINITE_BOMBS = "$7F50C9"
;================================================================================ ;================================================================================
LDA !INFINITE_BOMBS : BNE .infinite_bombs LDA InfiniteBombsModifier : BNE .infinite_bombs
.finite_bombs .finite_bombs
LDA.l SpecialWeapons : CMP #$01 : BNE .normal LDA.l SpecialWeapons : CMP #$01 : BNE .normal
LDA.l !WEAPON_LEVEL : BEQ .no_bombs LDA.l SpecialWeaponLevel : BEQ .no_bombs
.normal .normal
LDA.l $7EF343 ; bombs LDA.l BombsEquipment ; bombs
JSR HudHexToDec2Digit ;requires 8 bit registers! JSR HudHexToDec2Digit ; requires 8 bit registers!
REP #$20 REP #$20
LDX.b $06 : TXA : ORA.w #$2400 : STA !BOMBCOUNT_DRAW_ADDRESS ; Draw bombs 10 digit LDX.b $06 : TXA : ORA.w #$2400 : STA !BOMBCOUNT_DRAW_ADDRESS ; Draw bombs 10 digit
LDX.b $07 : TXA : ORA.w #$2400 : STA !BOMBCOUNT_DRAW_ADDRESS+2 ; Draw bombs 1 digit LDX.b $07 : TXA : ORA.w #$2400 : STA !BOMBCOUNT_DRAW_ADDRESS+2 ; Draw bombs 1 digit
@@ -35,7 +34,7 @@ SEP #$30
!RUPEE_DRAW_ADDRESS = "$7EC750" !RUPEE_DRAW_ADDRESS = "$7EC750"
;================================================================================ ;================================================================================
LDA.l $7EF362 ; Drawing bombs (above) always ends with 16-bit A, so, no need to REP here LDA.l DisplayRupees ; Drawing bombs (above) always ends with 16-bit A, so, no need to REP here
JSR HudHexToDec4Digit JSR HudHexToDec4Digit
LDX.b $04 : TXA : ORA.w #$2400 : STA !RUPEE_DRAW_ADDRESS ; 1000s LDX.b $04 : TXA : ORA.w #$2400 : STA !RUPEE_DRAW_ADDRESS ; 1000s
LDX.b $05 : TXA : ORA.w #$2400 : STA !RUPEE_DRAW_ADDRESS+2 ; 100s LDX.b $05 : TXA : ORA.w #$2400 : STA !RUPEE_DRAW_ADDRESS+2 ; 100s
@@ -45,14 +44,13 @@ SEP #$30
;================================================================================ ;================================================================================
; Draw arrow count ; Draw arrow count
!ARROWCOUNT_DRAW_ADDRESS = "$7EC760" !ARROWCOUNT_DRAW_ADDRESS = "$7EC760"
!INFINITE_ARROWS = "$7F50C8"
;================================================================================ ;================================================================================
SEP #$20 SEP #$20
LDA.l ArrowMode : BNE + LDA.l ArrowMode : BNE +
LDA !INFINITE_ARROWS : BNE .infinite_arrows LDA InfiniteArrowsModifier : BNE .infinite_arrows
.finite_arrows .finite_arrows
LDA.l $7EF377 ; arrows LDA.l CurrentArrows ; arrows
JSR HudHexToDec2Digit JSR HudHexToDec2Digit
REP #$20 REP #$20
LDX.b $06 : TXA : ORA.w #$2400 : STA !ARROWCOUNT_DRAW_ADDRESS ; Draw arrows 10 digit LDX.b $06 : TXA : ORA.w #$2400 : STA !ARROWCOUNT_DRAW_ADDRESS ; Draw arrows 10 digit
@@ -67,36 +65,30 @@ SEP #$30
;================================================================================ ;================================================================================
; Draw Goal Item Indicator ; Draw Goal Item Indicator
!GOAL_COUNTER = "$7EF418"
!GOAL_DRAW_ADDRESS = "$7EC72A" !GOAL_DRAW_ADDRESS = "$7EC72A"
;================================================================================ ;================================================================================
SEP #$20
LDA.l GoalItemRequirement : BNE + : JMP .done : + ; Star Meter
LDA.l !GOAL_COUNTER
JSR HudHexToDec3Digit
REP #$20 REP #$20
LDA.l GoalItemRequirement : BNE + : JMP .done : + ; Star Meter
LDA.l GoalItemIcon : STA !GOAL_DRAW_ADDRESS ; draw star icon
LDA.l GoalCounter
JSR HudHexToDec4Digit
LDA.l GoalItemIcon : STA.l !GOAL_DRAW_ADDRESS ; draw star icon
LDX.b $05 : TXA : ORA.w #$2400 : STA !GOAL_DRAW_ADDRESS+2 ; draw 100's digit LDX.b $05 : TXA : ORA.w #$2400 : STA !GOAL_DRAW_ADDRESS+2 ; draw 100's digit
LDX.b $06 : TXA : ORA.w #$2400 : STA !GOAL_DRAW_ADDRESS+4 ; draw 10's digit LDX.b $06 : TXA : ORA.w #$2400 : STA !GOAL_DRAW_ADDRESS+4 ; draw 10's digit
LDX.b $07 : TXA : ORA.w #$2400 : STA !GOAL_DRAW_ADDRESS+6 ; draw 1's digit LDX.b $07 : TXA : ORA.w #$2400 : STA !GOAL_DRAW_ADDRESS+6 ; draw 1's digit
SEP #$20 LDA.l GoalItemRequirement : CMP.w #$FFFF : BEQ .skip
LDA.l GoalItemRequirement : CMP.b #$FF : BEQ .skip
LDA.l GoalItemRequirement LDA.l GoalItemRequirement
JSR HudHexToDec3Digit JSR HudHexToDec4Digit
REP #$20
LDA.w #$2830 : STA !GOAL_DRAW_ADDRESS+8 ; draw slash LDA.w #$2830 : STA !GOAL_DRAW_ADDRESS+8 ; draw slash
LDX.b $05 : TXA : ORA.w #$2400 : STA !GOAL_DRAW_ADDRESS+10 ; draw 100's digit LDX.b $05 : TXA : ORA.w #$2400 : STA !GOAL_DRAW_ADDRESS+10 ; draw 100's digit
LDX.b $06 : TXA : ORA.w #$2400 : STA !GOAL_DRAW_ADDRESS+12 ; draw 10's digit LDX.b $06 : TXA : ORA.w #$2400 : STA !GOAL_DRAW_ADDRESS+12 ; draw 10's digit
LDX.b $07 : TXA : ORA.w #$2400 : STA !GOAL_DRAW_ADDRESS+14 ; draw 1's digit LDX.b $07 : TXA : ORA.w #$2400 : STA !GOAL_DRAW_ADDRESS+14 ; draw 1's digit
BRA .done BRA .done
.skip .skip
REP #$20
LDA.w #$207F ; transparent tile LDA.w #$207F ; transparent tile
STA !GOAL_DRAW_ADDRESS+8 STA !GOAL_DRAW_ADDRESS+8
STA !GOAL_DRAW_ADDRESS+10 STA !GOAL_DRAW_ADDRESS+10
@@ -106,19 +98,17 @@ SEP #$30
;================================================================================ ;================================================================================
; Draw Dungeon Compass Counts ; Draw Dungeon Compass Counts
;================================================================================ ;================================================================================
REP #$20
LDA.l CompassMode : AND #$00FF : BEQ + ; skip if CompassMode is 0. LDA.l CompassMode : AND #$00FF : BEQ + ; skip if CompassMode is 0.
JSL.l DrawDungeonCompassCounts ; compasses.asm JSL.l DrawDungeonCompassCounts ; compasses.asm
+ +
;================================================================================ ;================================================================================
; Draw key count ; Draw key count
!KEYS = "$7EF36F"
!KEY_DIGITS_ADDRESS = "$7EC764" !KEY_DIGITS_ADDRESS = "$7EC764"
!KEY_ICON_ADDRESS = "$7EC726" !KEY_ICON_ADDRESS = "$7EC726"
;================================================================================ ;================================================================================
SEP #$20 SEP #$20
LDA.l !KEYS : CMP.b #$FF : BEQ .not_in_dungeon LDA.l CurrentSmallKeys : CMP.b #$FF : BEQ .not_in_dungeon
.in_dungeon .in_dungeon
JSR HudHexToDec2Digit : REP #$20 JSR HudHexToDec2Digit : REP #$20
@@ -165,7 +155,7 @@ SEP #$30
REP #$20 REP #$20
BEQ .drawprize BEQ .drawprize
LDA.l $7EF368 LDA.l MapField
AND.l DungeonItemMasks,X AND.l DungeonItemMasks,X
BEQ .noprize BEQ .noprize
@@ -190,16 +180,15 @@ SEP #$30
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
; Draw Magic Meter ; Draw Magic Meter
!INFINITE_MAGIC = "$7F50CA"
!DrawMagicMeter_mp_tilemap = "$0DFE0F" !DrawMagicMeter_mp_tilemap = "$0DFE0F"
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
LDA $7EF36E : AND #$00FF ; crap we wrote over when placing the hook for OnDrawHud LDA CurrentMagic : AND #$00FF ; crap we wrote over when placing the hook for OnDrawHud
!ADD #$0007 !ADD #$0007
AND #$FFF8 AND #$FFF8
TAX ; end of crap TAX ; end of crap
LDA !INFINITE_MAGIC : AND.w #$00FF : BNE + : JMP .green : + LDA InfiniteMagicModifier : AND.w #$00FF : BNE + : JMP .green : +
SEP #$20 : LDA.b #$80 : STA $7EF36E : REP #$30 ; set magic to max SEP #$20 : LDA.b #$80 : STA CurrentMagic : REP #$30 ; set magic to max
LDX.w #$0080 ; load full magic meter graphics LDX.w #$0080 ; load full magic meter graphics
LDA $1A : AND.w #$000C : LSR #2 LDA $1A : AND.w #$000C : LSR #2
BEQ .red BEQ .red
@@ -274,27 +263,27 @@ RTS
; in: A(b) - Byte to Convert ; in: A(b) - Byte to Convert
; out: $05 - $07 (high - low) ; out: $05 - $07 (high - low)
;================================================================================ ;================================================================================
HudHexToDec3Digit: ; this may be overkill, could have used the 4 digit one... ;HudHexToDec3Digit: ; this may be overkill, could have used the 4 digit one...
LDY.b #$90 ; LDY.b #$90
- ; -
CMP.b #100 : !BLT + ; CMP.b #100 : !BLT +
INY ; INY
SBC.b #100 : BRA - ; SBC.b #100 : BRA -
+ ; +
STY $05 : LDY.b #$90 ; Store 100s digit and reset Y ; STY $05 : LDY.b #$90 ; Store 100s digit and reset Y
- ; -
CMP.b #10 : !BLT + ; CMP.b #10 : !BLT +
INY ; INY
SBC.b #10 : BRA - ; SBC.b #10 : BRA -
+ ; +
STY $06 : LDY #$90 ; Store 10s digit and reset Y ; STY $06 : LDY #$90 ; Store 10s digit and reset Y
CMP.b #1 : !BLT + ; CMP.b #1 : !BLT +
- ; -
INY ; INY
DEC : BNE - ; DEC : BNE -
+ ; +
STY $07 ; Store 1s digit ; STY $07 ; Store 1s digit
RTS ;RTS
;================================================================================ ;================================================================================
; 8-bit registers ; 8-bit registers

View File

@@ -155,10 +155,6 @@ macro ValueShift()
BRA ?start : ?end: BRA ?start : ?end:
endmacro endmacro
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
!CHALLENGE_TIMER = "$7EF454"
!GOAL_COUNTER = "$7EF418"
!INVENTORY_SWAP_2 = "$7EF38E"
;--------------------------------------------------------------------------------
;carry clear if pass ;carry clear if pass
;carry set if caught ;carry set if caught
;incsrc eventdata.asm ;incsrc eventdata.asm
@@ -172,24 +168,24 @@ ProcessEventItems:
LDA $02D8 LDA $02D8
CMP.b #$E0 : BNE + CMP.b #$E0 : BNE +
REP #$30 ; set 16-bit accumulator & index registers REP #$30 ; set 16-bit accumulator & index registers
LDA $7EF450 : ASL : TAX LDA RNGItem : ASL : TAX
LDA.l EventDataOffsets, X : !ADD #EventDataTable : STA $00 LDA.l EventDataOffsets, X : !ADD #EventDataTable : STA $00
SEP #$20 ; set 8-bit accumulator SEP #$20 ; set 8-bit accumulator
LDA.b #$AF : STA $02 LDA.b #$AF : STA $02
JSL.l LoadDialogAddressIndirect JSL.l LoadDialogAddressIndirect
LDA $7EF450 : INC : STA $7EF450 LDA RNGItem : INC : STA RNGItem
SEP #$10 ; set 8-bit index registers SEP #$10 ; set 8-bit index registers
REP #$20 ; set 16-bit accumulator
LDA GoalItemRequirement : BEQ ++ LDA GoalItemRequirement : BEQ ++
LDA !GOAL_COUNTER : INC : STA !GOAL_COUNTER LDA GoalCounter : INC : STA GoalCounter
CMP GoalItemRequirement : !BLT ++ CMP GoalItemRequirement : !BLT ++
LDA TurnInGoalItems : BNE ++ LDA TurnInGoalItems : AND.w #$00FF : BNE ++
JSL.l ActivateGoal JSL.l ActivateGoal
++ ++
SEP #$20 ; set 8-bit accumulator
LDX.b #$01 : BRA .done LDX.b #$01 : BRA .done
+ +
LDX.b #$00 LDX.b #$00
@@ -204,72 +200,65 @@ RTS
AddReceivedItemExpandedGetItem: AddReceivedItemExpandedGetItem:
PHX PHX
;JSR.w ProcessEventItems : CPX.b #$00 : BEQ ++
; ;JSL.l Main_ShowTextMessage_Alt
; LDA !GOAL_COUNTER : INC : STA !GOAL_COUNTER
; LDA.b #$01 : STA $7F50XX
; JMP .done
;++
;STA $FFFFFF
LDA $02D8 ; check inventory LDA $02D8 ; check inventory
JSL.l FreeDungeonItemNotice JSL.l FreeDungeonItemNotice
CMP.b #$0B : BNE + ; Bow CMP.b #$0B : BNE + ; Bow
LDA !INVENTORY_SWAP_2 : AND.b #$40 : BEQ ++ LDA BowTracking : AND.b #$40 : BEQ ++
LDA.l SilverArrowsUseRestriction : BNE ++ LDA.l SilverArrowsUseRestriction : BNE ++
LDA.b #03 : STA $7EF340 ; set bow to silver LDA.b #03 : STA BowEquipment ; set bow to silver
++ ++
JMP .done JMP .done
+ CMP.b #$3B : BNE + ; Silver Bow + CMP.b #$3B : BNE + ; Silver Bow
LDA.l SilverArrowsUseRestriction : BNE .noequip LDA.l SilverArrowsUseRestriction : BNE .noequip
LDA.l SilverArrowsAutoEquip : AND.b #$01 : BEQ .noequip LDA.l SilverArrowsAutoEquip : AND.b #$01 : BEQ .noequip
LDA $7EF376 : BNE ++ ; check arrows LDA ArrowsFiller : BNE ++ ; check arrows
LDA.b #$03 : BRA +++ ; bow without arrow LDA.b #$03 : BRA +++ ; bow without arrow
++ ++
LDA.b #$04 ; bow with arrow LDA.b #$04 ; bow with arrow
+++ +++
STA $7EF340 STA BowEquipment
.noequip .noequip
LDA !INVENTORY_SWAP_2 : ORA #$40 : STA !INVENTORY_SWAP_2 ; mark silver bow on y-toggle LDA BowTracking : ORA #$40 : STA BowTracking ; mark silver bow on y-toggle
JMP .done JMP .done
+ CMP.b #$4C : BNE + ; 50 bombs + CMP.b #$4C : BNE + ; 50 bombs
;LDA.b #$07 : STA $7EF370 ; upgrade bombs ;LDA.b #$07 : STA BombCapacityUpgrades ; upgrade bombs
LDA.b #50 : !SUB.l StartingMaxBombs : STA $7EF370 ; upgrade bombs LDA.b #50 : !SUB.l StartingMaxBombs : STA BombCapacityUpgrades ; upgrade bombs
LDA.b #50 : STA $7EF375 ; fill bombs LDA.b #50 : STA BombsFiller ; fill bombs
JMP .done JMP .done
+ CMP.b #$4D : BNE + ; 70 arrows + CMP.b #$4D : BNE + ; 70 arrows
;LDA #$07 : STA $7EF371 ; upgrade arrows ;LDA #$07 : STA ArrowCapacityUpgrades ; upgrade arrows
LDA.b #70 : !SUB.l StartingMaxArrows : STA $7EF371 ; upgrade arrows LDA.b #70 : !SUB.l StartingMaxArrows : STA ArrowCapacityUpgrades ; upgrade arrows
LDA.b #70 : STA $7EF376 ; fill arrows LDA.b #70 : STA ArrowsFiller ; fill arrows
JMP .done JMP .done
+ CMP.b #$4E : BNE + ; 1/2 magic + CMP.b #$4E : BNE + ; 1/2 magic
LDA $7EF37B : CMP #$02 : !BGE ++ LDA MagicConsumption : CMP #$02 : !BGE ++
INC : STA $7EF37B ; upgrade magic INC : STA MagicConsumption ; upgrade magic
++ ++
LDA.b #$80 : STA $7EF373 ; fill magic LDA.b #$80 : STA MagicFiller ; fill magic
JMP .done JMP .done
+ CMP.b #$4F : BNE + ; 1/4 magic + CMP.b #$4F : BNE + ; 1/4 magic
LDA.b #$02 : STA $7EF37B ; upgrade magic LDA.b #$02 : STA MagicConsumption ; upgrade magic
LDA.b #$80 : STA $7EF373 ; fill magic LDA.b #$80 : STA MagicFiller ; fill magic
JMP .done JMP .done
+ CMP.b #$50 : BNE + ; Master Sword (Safe) + CMP.b #$50 : BNE + ; Master Sword (Safe)
LDA $7EF359 : CMP.b #$02 : !BGE + ; skip if we have a better sword LDA SwordEquipment : CMP.b #$02 : !BGE + ; skip if we have a better sword
LDA.b #$02 : STA $7EF359 ; set master sword LDA.b #$02 : STA SwordEquipment ; set master sword
JMP .done JMP .done
+ CMP.b #$51 : BNE + ; +5 Bombs + CMP.b #$51 : BNE + ; +5 Bombs
LDA $7EF370 : !ADD.b #$05 : STA $7EF370 ; upgrade bombs +5 LDA BombCapacityUpgrades : !ADD.b #$05 : STA BombCapacityUpgrades ; upgrade bombs +5
LDA.l Upgrade5BombsRefill : STA $7EF375 ; fill bombs LDA.l Upgrade5BombsRefill : STA BombsFiller ; fill bombs
JMP .done JMP .done
+ CMP.b #$52 : BNE + ; +10 Bombs + CMP.b #$52 : BNE + ; +10 Bombs
LDA $7EF370 : !ADD.b #$0A : STA $7EF370 ; upgrade bombs +10 LDA BombCapacityUpgrades : !ADD.b #$0A : STA BombCapacityUpgrades ; upgrade bombs +10
LDA.l Upgrade10BombsRefill : STA $7EF375 ; fill bombs LDA.l Upgrade10BombsRefill : STA BombsFiller ; fill bombs
JMP .done JMP .done
+ CMP.b #$53 : BNE + ; +5 Arrows + CMP.b #$53 : BNE + ; +5 Arrows
LDA $7EF371 : !ADD.b #$05 : STA $7EF371 ; upgrade arrows +5 LDA ArrowCapacityUpgrades : !ADD.b #$05 : STA ArrowCapacityUpgrades ; upgrade arrows +5
LDA.l Upgrade5ArrowsRefill : STA $7EF376 ; fill arrows LDA.l Upgrade5ArrowsRefill : STA ArrowsFiller ; fill arrows
JMP .done JMP .done
+ CMP.b #$54 : BNE + ; +10 Arrows + CMP.b #$54 : BNE + ; +10 Arrows
LDA $7EF371 : !ADD.b #$0A : STA $7EF371 ; upgrade arrows +10 LDA ArrowCapacityUpgrades : !ADD.b #$0A : STA ArrowCapacityUpgrades ; upgrade arrows +10
LDA.l Upgrade10ArrowsRefill : STA $7EF376 ; fill arrows LDA.l Upgrade10ArrowsRefill : STA ArrowsFiller ; fill arrows
JMP .done JMP .done
+ CMP.b #$55 : BNE + ; Programmable Object 1 + CMP.b #$55 : BNE + ; Programmable Object 1
%ProgrammableItemLogic(1) %ProgrammableItemLogic(1)
@@ -283,34 +272,34 @@ AddReceivedItemExpandedGetItem:
+ CMP.b #$58 : BNE + ; Upgrade-Only Silver Arrows + CMP.b #$58 : BNE + ; Upgrade-Only Silver Arrows
LDA.l SilverArrowsUseRestriction : BNE +++ LDA.l SilverArrowsUseRestriction : BNE +++
LDA.l SilverArrowsAutoEquip : AND.b #$01 : BEQ +++ LDA.l SilverArrowsAutoEquip : AND.b #$01 : BEQ +++
LDA $7EF340 : BEQ ++ : CMP.b #$03 : !BGE ++ LDA BowEquipment : BEQ ++ : CMP.b #$03 : !BGE ++
!ADD.b #$02 : STA $7EF340 ; switch to silver bow !ADD.b #$02 : STA BowEquipment ; switch to silver bow
++ ++
+++ +++
LDA.l ArrowMode : BEQ ++ LDA.l ArrowMode : BEQ ++
LDA.b #$01 : STA $7EF376 LDA.b #$01 : STA ArrowsFiller
++ ++
+ CMP.b #$59 : BNE + ; 1 Rupoor + CMP.b #$59 : BNE + ; 1 Rupoor
REP #$20 : LDA $7EF360 : !SUB RupoorDeduction : STA $7EF360 : SEP #$20 ; Take 1 rupee REP #$20 : LDA CurrentRupees : !SUB RupoorDeduction : STA CurrentRupees : SEP #$20 ; Take 1 rupee
JMP .done JMP .done
+ CMP.b #$5A : BNE + ; Null Item + CMP.b #$5A : BNE + ; Null Item
JMP .done JMP .done
+ CMP.b #$5B : BNE + ; Red Clock + CMP.b #$5B : BNE + ; Red Clock
REP #$20 ; set 16-bit accumulator REP #$20 ; set 16-bit accumulator
LDA !CHALLENGE_TIMER : !ADD.l RedClockAmount : STA !CHALLENGE_TIMER LDA ChallengeTimer : !ADD.l RedClockAmount : STA ChallengeTimer
LDA !CHALLENGE_TIMER+2 : ADC.l RedClockAmount+2 : STA !CHALLENGE_TIMER+2 LDA ChallengeTimer+2 : ADC.l RedClockAmount+2 : STA ChallengeTimer+2
SEP #$20 ; set 8-bit accumulator SEP #$20 ; set 8-bit accumulator
JMP .done JMP .done
+ CMP.b #$5C : BNE + ; Blue Clock + CMP.b #$5C : BNE + ; Blue Clock
REP #$20 ; set 16-bit accumulator REP #$20 ; set 16-bit accumulator
LDA !CHALLENGE_TIMER : !ADD.l BlueClockAmount : STA !CHALLENGE_TIMER LDA ChallengeTimer : !ADD.l BlueClockAmount : STA ChallengeTimer
LDA !CHALLENGE_TIMER+2 : ADC.l BlueClockAmount+2 : STA !CHALLENGE_TIMER+2 LDA ChallengeTimer+2 : ADC.l BlueClockAmount+2 : STA ChallengeTimer+2
SEP #$20 ; set 8-bit accumulator SEP #$20 ; set 8-bit accumulator
JMP .done JMP .done
+ CMP.b #$5D : BNE + ; Green Clock + CMP.b #$5D : BNE + ; Green Clock
REP #$20 ; set 16-bit accumulator REP #$20 ; set 16-bit accumulator
LDA !CHALLENGE_TIMER : !ADD.l GreenClockAmount : STA !CHALLENGE_TIMER LDA ChallengeTimer : !ADD.l GreenClockAmount : STA ChallengeTimer
LDA !CHALLENGE_TIMER+2 : ADC.l GreenClockAmount+2 : STA !CHALLENGE_TIMER+2 LDA ChallengeTimer+2 : ADC.l GreenClockAmount+2 : STA ChallengeTimer+2
SEP #$20 ; set 8-bit accumulator SEP #$20 ; set 8-bit accumulator
JMP .done JMP .done
+ CMP.b #$5E : BNE + ; Progressive Sword + CMP.b #$5E : BNE + ; Progressive Sword
@@ -336,12 +325,14 @@ AddReceivedItemExpandedGetItem:
BRA .multi_collect BRA .multi_collect
+ CMP.b #$6C : BNE + ; Goal Collectable (Multi/Power Star) Alternate Graphic + CMP.b #$6C : BNE + ; Goal Collectable (Multi/Power Star) Alternate Graphic
.multi_collect .multi_collect
LDA GoalItemRequirement : BEQ ++ REP #$20 ; set 16-bit accumulator
LDA !GOAL_COUNTER : INC : STA !GOAL_COUNTER LDA.l GoalItemRequirement : BEQ ++
CMP GoalItemRequirement : !BLT ++ LDA.l GoalCounter : INC : STA.l GoalCounter
LDA TurnInGoalItems : BNE ++ CMP.w GoalItemRequirement : !BLT ++
LDA.l TurnInGoalItems : AND.w #$00FF : BNE ++
JSL.l ActivateGoal JSL.l ActivateGoal
++ ++
SEP #$20 ; set 8-bit accumulator
JMP .done JMP .done
+ CMP.b #$6D : BNE + ; Server Request F0 + CMP.b #$6D : BNE + ; Server Request F0
JSL.l ItemGetServiceRequest_F0 JSL.l ItemGetServiceRequest_F0
@@ -358,68 +349,68 @@ AddReceivedItemExpandedGetItem:
+ CMP.b #$70 : !BLT + : CMP.b #$80 : !BGE + ; Free Map + CMP.b #$70 : !BLT + : CMP.b #$80 : !BGE + ; Free Map
AND #$0F : CMP #$08 : !BGE ++ AND #$0F : CMP #$08 : !BGE ++
%ValueShift() %ValueShift()
ORA $7EF368 : STA $7EF368 ; Map 1 ORA MapField : STA MapField ; Map 1
JMP .done JMP .done
++ ++
!SUB #$08 !SUB #$08
%ValueShift() %ValueShift()
BIT.b #$C0 : BEQ +++ : LDA.b #$C0 : +++ ; Make Hyrule Castle / Sewers Count for Both BIT.b #$C0 : BEQ +++ : LDA.b #$C0 : +++ ; Make Hyrule Castle / Sewers Count for Both
ORA $7EF369 : STA $7EF369 ; Map 2 ORA MapField+1 : STA MapField+1 ; Map 2
JMP .done JMP .done
+ CMP.b #$80 : !BLT + : CMP.b #$90 : !BGE + ; Free Compass + CMP.b #$80 : !BLT + : CMP.b #$90 : !BGE + ; Free Compass
AND #$0F : CMP #$08 : !BGE ++ AND #$0F : CMP #$08 : !BGE ++
%ValueShift() %ValueShift()
ORA $7EF364 : STA $7EF364 ; Compass 1 ORA CompassField : STA CompassField ; Compass 1
JMP .done JMP .done
++ ++
!SUB #$08 !SUB #$08
%ValueShift() %ValueShift()
BIT.b #$C0 : BEQ +++ : LDA.b #$C0 : +++ ; Make Hyrule Castle / Sewers Count for Both BIT.b #$C0 : BEQ +++ : LDA.b #$C0 : +++ ; Make Hyrule Castle / Sewers Count for Both
ORA $7EF365 : STA $7EF365 ; Compass 2 ORA CompassField+1 : STA CompassField+1 ; Compass 2
JMP .done JMP .done
+ CMP.b #$90 : !BLT + : CMP.b #$A0 : !BGE + ; Free Big Key + CMP.b #$90 : !BLT + : CMP.b #$A0 : !BGE + ; Free Big Key
AND #$0F : CMP #$08 : !BGE ++ AND #$0F : CMP #$08 : !BGE ++
%ValueShift() %ValueShift()
ORA $7EF366 : STA $7EF366 ; Big Key 1 ORA BigKeyField : STA BigKeyField ; Big Key 1
JMP .done JMP .done
++ ++
!SUB #$08 !SUB #$08
%ValueShift() %ValueShift()
BIT.b #$C0 : BEQ +++ : LDA.b #$C0 : +++ ; Make Hyrule Castle / Sewers Count for Both BIT.b #$C0 : BEQ +++ : LDA.b #$C0 : +++ ; Make Hyrule Castle / Sewers Count for Both
ORA $7EF367 : STA $7EF367 ; Big Key 2 ORA BigKeyField+1 : STA BigKeyField+1 ; Big Key 2
JMP .done JMP .done
+ CMP.b #$A0 : !BLT + : CMP.b #$B0 : !BGE + ; Free Small Key + CMP.b #$A0 : !BLT + : CMP.b #$B0 : !BGE + ; Free Small Key
AND #$0F : TAX AND #$0F : TAX
LDA $7EF37C, X : INC : STA $7EF37C, X ; Increment Key Count LDA DungeonKeys, X : INC : STA DungeonKeys, X ; Increment Key Count
CPX.b #$00 : BNE ++ CPX.b #$00 : BNE ++
STA $7EF37D ; copy HC to sewers STA HyruleCastleKeys ; copy HC to sewers
++ : CPX.b #$01 : BNE ++ ++ : CPX.b #$01 : BNE ++
STA $7EF37C ; copy sewers to HC STA SewerKeys ; copy sewers to HC
++ ++
LDA.l GenericKeys : BEQ + LDA.l GenericKeys : BEQ +
.generic .generic
LDA $7EF36F : INC : STA $7EF36F LDA CurrentSmallKeys : INC : STA CurrentSmallKeys
JMP .done JMP .done
.normal .normal
TXA : ASL : CMP $040C : BNE ++ TXA : ASL : CMP $040C : BNE ++
LDA $7EF36F : INC : STA $7EF36F LDA CurrentSmallKeys : INC : STA CurrentSmallKeys
++ ++
JMP .done JMP .done
+ CMP.b #$B1 : !BLT + : CMP.b #$B7 : !BGE + ; Bomb Upgrades + CMP.b #$B1 : !BLT + : CMP.b #$B7 : !BGE + ; Bomb Upgrades
LDA.l SpecialWeapons : CMP #$01 : BNE .done LDA.l SpecialWeapons : CMP #$01 : BNE .done
LDA #$01 : STA $7F50C9 ; infinite bombs LDA #$01 : STA InfiniteBombsModifier
JMP .done JMP .done
+ : CMP.b #$B7 : !BLT + : CMP.b #$BD : !BGE + ; Cane Upgrades + : CMP.b #$B7 : !BLT + : CMP.b #$BD : !BGE + ; Cane Upgrades
LDA.l SpecialWeapons : CMP #$03 : BEQ .blue_cane LDA.l SpecialWeapons : CMP #$03 : BEQ .blue_cane
CMP #$04 : BEQ .red_cane CMP #$04 : BEQ .red_cane
BRA .done BRA .done
.blue_cane .blue_cane
LDA #$01 : STA $7EF351 LDA #$01 : STA ByrnaEquipment
BRA .done BRA .done
.red_cane .red_cane
LDA #$01 : STA $7EF350 LDA #$01 : STA SomariaEquipment
BRA .done BRA .done
BRA .done BRA .done
+ +
@@ -433,8 +424,6 @@ RTL
; #$90 - Big Keys ; #$90 - Big Keys
; #$A0 - Small Keys ; #$A0 - Small Keys
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
!PROGRESSIVE_SHIELD = "$7EF416" ; ss-- ----
!RNG_ITEM = "$7EF450"
!SCRATCH_AREA = "$7F5020" !SCRATCH_AREA = "$7F5020"
!SINGLE_INDEX_TEMP = "$7F5020" !SINGLE_INDEX_TEMP = "$7F5020"
!SINGLE_INDEX_OFFSET_TEMP = "$7F5021" !SINGLE_INDEX_OFFSET_TEMP = "$7F5021"
@@ -487,11 +476,11 @@ AddReceivedItemExpanded:
LDA.l BottleLimitReplacement : STA $02D8 LDA.l BottleLimitReplacement : STA $02D8
+++ : JMP .done +++ : JMP .done
++ : CMP.b #$4E : BNE ++ ; Progressive Magic ++ : CMP.b #$4E : BNE ++ ; Progressive Magic
LDA $7EF37B : BEQ +++ LDA MagicConsumption : BEQ +++
LDA.b #$4F : STA $02D8 LDA.b #$4F : STA $02D8
+++ : JMP .done +++ : JMP .done
++ : CMP.b #$5E : BNE ++ ; Progressive Sword ++ : CMP.b #$5E : BNE ++ ; Progressive Sword
LDA $7EF359 : CMP.l ProgressiveSwordLimit : !BLT + LDA SwordEquipment : CMP.l ProgressiveSwordLimit : !BLT +
LDA.l ProgressiveSwordReplacement : STA $02D8 : JMP .done LDA.l ProgressiveSwordReplacement : STA $02D8 : JMP .done
+ : CMP.b #$00 : BNE + ; No Sword + : CMP.b #$00 : BNE + ; No Sword
LDA.b #$49 : STA $02D8 : JMP .done LDA.b #$49 : STA $02D8 : JMP .done
@@ -502,39 +491,35 @@ AddReceivedItemExpanded:
+ ; Everything Else + ; Everything Else
LDA.b #$03 : STA $02D8 : JMP .done LDA.b #$03 : STA $02D8 : JMP .done
++ : CMP.b #$5F : BNE ++ ; Progressive Shield ++ : CMP.b #$5F : BNE ++ ; Progressive Shield
LDA !PROGRESSIVE_SHIELD : LSR #6 : CMP.l ProgressiveShieldLimit : !BLT + LDA ShieldEquipment : CMP.l ProgressiveShieldLimit : !BLT +
LDA.l ProgressiveShieldReplacement : STA $02D8 : JMP .done LDA.l ProgressiveShieldReplacement : STA $02D8 : JMP .done
+ + : CMP.b #$00 : BNE + ; No Shield
LDA !PROGRESSIVE_SHIELD : AND.b #$C0 : BNE + ; No Shield LDA.b #$04 : STA $02D8 : JMP .done
LDA.b #$04 : STA $02D8 + : CMP.b #$01 : BNE + ; Fighter Shield
LDA !PROGRESSIVE_SHIELD : !ADD.b #$40 : STA !PROGRESSIVE_SHIELD : JMP .done LDA.b #$05 : STA $02D8 : JMP .done
+ : CMP.b #$40 : BNE + ; Fighter Shield
LDA.b #$05 : STA $02D8
LDA !PROGRESSIVE_SHIELD : !ADD.b #$40 : STA !PROGRESSIVE_SHIELD : JMP .done
+ ; Everything Else + ; Everything Else
LDA.b #$06 : STA $02D8 LDA.b #$06 : STA $02D8 : JMP .done
LDA !PROGRESSIVE_SHIELD : !ADD.b #$40 : STA !PROGRESSIVE_SHIELD : JMP .done
++ : CMP.b #$60 : BNE ++ ; Progressive Armor ++ : CMP.b #$60 : BNE ++ ; Progressive Armor
LDA $7EF35B : CMP.l ProgressiveArmorLimit : !BLT + LDA ArmorEquipment : CMP.l ProgressiveArmorLimit : !BLT +
LDA.l ProgressiveArmorReplacement : STA $02D8 : JMP .done LDA.l ProgressiveArmorReplacement : STA $02D8 : JMP .done
+ : CMP.b #$00 : BNE + ; No Armor + : CMP.b #$00 : BNE + ; No Armor
LDA.b #$22 : STA $02D8 : JMP .done LDA.b #$22 : STA $02D8 : JMP .done
+ ; Everything Else + ; Everything Else
LDA.b #$23 : STA $02D8 : JMP .done LDA.b #$23 : STA $02D8 : JMP .done
++ : CMP.b #$61 : BNE ++ ; Progressive Lifting Glove ++ : CMP.b #$61 : BNE ++ ; Progressive Lifting Glove
LDA $7EF354 : BNE + ; No Lift LDA GloveEquipment : BNE + ; No Lift
LDA.b #$1B : STA $02D8 : JMP .done LDA.b #$1B : STA $02D8 : JMP .done
+ ; Everything Else + ; Everything Else
LDA.b #$1C : STA $02D8 : JMP .done LDA.b #$1C : STA $02D8 : JMP .done
++ : CMP.b #$64 : BNE ++ : -- ; Progressive Bow ++ : CMP.b #$64 : BNE ++ : -- ; Progressive Bow
LDA $7EF340 : INC : LSR : CMP.l ProgressiveBowLimit : !BLT + LDA BowEquipment : INC : LSR : CMP.l ProgressiveBowLimit : !BLT +
LDA.l ProgressiveBowReplacement : STA $02D8 : JMP .done LDA.l ProgressiveBowReplacement : STA $02D8 : JMP .done
+ : CMP.b #$00 : BNE + ; No Bow + : CMP.b #$00 : BNE + ; No Bow
LDA.b #$3A : STA $02D8 : JMP .done LDA.b #$3A : STA $02D8 : JMP .done
+ ; Any Bow + ; Any Bow
LDA.b #$3B : STA $02D8 : JMP .done LDA.b #$3B : STA $02D8 : JMP .done
++ : CMP.b #$65 : BNE ++ ; Progressive Bow 2 ++ : CMP.b #$65 : BNE ++ ; Progressive Bow 2
LDA.l !INVENTORY_SWAP_2 : ORA #$20 : STA.l !INVENTORY_SWAP_2 LDA.l BowTracking : ORA #$20 : STA.l BowTracking
BRA -- BRA --
; ++ : CMP.b #$FE : BNE ++ ; Server Request (Null Chest) ; ++ : CMP.b #$FE : BNE ++ ; Server Request (Null Chest)
; JSL ChestItemServiceRequest ; JSL ChestItemServiceRequest
@@ -549,7 +534,7 @@ AddReceivedItemExpanded:
LDA #$FF : STA !LOCK_IN ; clear lock-in LDA #$FF : STA !LOCK_IN ; clear lock-in
JMP .done JMP .done
++ : CMP.b #$B6 : BNE ++ ; Progressive Bombs ++ : CMP.b #$B6 : BNE ++ ; Progressive Bombs
LDA !WEAPON_LEVEL LDA SpecialWeaponLevel
CMP.b #$00 : BNE + ; have no Bombs CMP.b #$00 : BNE + ; have no Bombs
LDA.b #$B1 : STA $02D8 : JMP .done LDA.b #$B1 : STA $02D8 : JMP .done
+ : CMP.b #$01 : BNE + ; have L-1 Bombs + : CMP.b #$01 : BNE + ; have L-1 Bombs
@@ -561,7 +546,7 @@ AddReceivedItemExpanded:
+ ; Everything Else + ; Everything Else
LDA.b #$B5 : STA $02D8 : JMP .done LDA.b #$B5 : STA $02D8 : JMP .done
++ : CMP.b #$BC : BNE ++ ; Progressive Cane ++ : CMP.b #$BC : BNE ++ ; Progressive Cane
LDA !WEAPON_LEVEL LDA SpecialWeaponLevel
CMP.b #$00 : BNE + ; have no Cane CMP.b #$00 : BNE + ; have no Cane
LDA.b #$B7 : STA $02D8 : JMP .done LDA.b #$B7 : STA $02D8 : JMP .done
+ : CMP.b #$01 : BNE + ; have L-1 Cane + : CMP.b #$01 : BNE + ; have L-1 Cane
@@ -906,7 +891,7 @@ AddReceivedItemExpanded:
;0x1A - Ganon's Tower ;0x1A - Ganon's Tower
.item_masks ; these are dungeon correlations to $7EF364 - $7EF369 so it knows where to store compasses, etc .item_masks ; these are dungeon correlations to $7EF364 - $7EF369 so it knows where to store compasses, etc
; sewers and castle get 2 bits active so that they can share their items elegantly ; sewers and castle get 2 bits active so that they can share their items elegantly
dw $C000, $C000, $2000, $1000, $0800, $0400, $0200, $0100 dw $C000, $C000, $2000, $1000, $0800, $0400, $0200, $0100
dw $0080, $0040, $0020, $0010, $0008, $0004, $0000, $0000 dw $0080, $0040, $0020, $0010, $0008, $0004, $0000, $0000
@@ -990,29 +975,29 @@ Link_ReceiveItemAlternatesExpanded:
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
;DrawHUDSilverArrows: ;DrawHUDSilverArrows:
; LDA $7EF340 : AND.w #$00FF : BNE + ; LDA BowEquipment : AND.w #$00FF : BNE +
; LDA !INVENTORY_SWAP_2 : AND.w #$0040 : BEQ + ; LDA BowTracking : AND.w #$0040 : BEQ +
; LDA.w #$2810 : STA $11C8 ; LDA.w #$2810 : STA $11C8
; LDA.w #$2811 : STA $11CA ; LDA.w #$2811 : STA $11CA
; LDA.w #$2820 : STA $1208 ; LDA.w #$2820 : STA $1208
; LDA.w #$2821 : STA $120A ; LDA.w #$2821 : STA $120A
; + ; +
; LDA.w #$11CE : STA $00 ; thing we wrote over ; LDA.w #$11CE : STA $00 ; thing we wrote over
;RTL ;RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
;Return $7EF340 but also draw silver arrows if you have the upgrade even if you don't have the bow ;Return BowEquipment but also draw silver arrows if you have the upgrade even if you don't have the bow
CheckHUDSilverArrows: CheckHUDSilverArrows:
LDA.l ArrowMode : BEQ .normal LDA.l ArrowMode : BEQ .normal
.rupee_arrows .rupee_arrows
JSL.l DrawHUDArrows JSL.l DrawHUDArrows
LDA $7EF340 LDA BowEquipment
RTL RTL
.normal .normal
LDA $7EF340 : BNE + LDA BowEquipment : BNE +
LDA !INVENTORY_SWAP_2 : AND.b #$40 : BEQ ++ LDA BowTracking : AND.b #$40 : BEQ ++
JSL.l DrawHUDArrows JSL.l DrawHUDArrows
++ ++
LDA $7EF340 LDA BowEquipment
+ +
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
@@ -1020,9 +1005,9 @@ DrawHUDArrows:
LDA.l ArrowMode : BEQ .normal LDA.l ArrowMode : BEQ .normal
.rupee_arrows .rupee_arrows
LDA $7EF377 : BEQ .none ; assuming silvers will increment this. if we go with something else, reorder these checks LDA CurrentArrows : BEQ .none ; assuming silvers will increment this. if we go with something else, reorder these checks
LDA $7EF340 : BNE + LDA BowEquipment : BNE +
LDA !INVENTORY_SWAP_2 : AND.b #$40 : BNE .silver LDA BowTracking : AND.b #$40 : BNE .silver
BRA .wooden BRA .wooden
+ CMP.b #03 : !BGE .silver + CMP.b #03 : !BGE .silver
@@ -1046,7 +1031,6 @@ RTL
LDA.b #$24 : STA $7EC723 LDA.b #$24 : STA $7EC723
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
!RNG_ITEM = "$7EF450"
!SCRATCH_AREA = "$7F5020" !SCRATCH_AREA = "$7F5020"
!SINGLE_INDEX_TEMP = "$7F5020" !SINGLE_INDEX_TEMP = "$7F5020"
!SINGLE_INDEX_OFFSET_TEMP = "$7F5021" !SINGLE_INDEX_OFFSET_TEMP = "$7F5021"
@@ -1084,7 +1068,7 @@ RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
CheckSingleItem: CheckSingleItem:
LSR #3 : TAX LSR #3 : TAX
LDA.l !RNG_ITEM, X : STA !SINGLE_INDEX_BITMASK_TEMP ; load value to temporary LDA.l RNGItem, X : STA !SINGLE_INDEX_BITMASK_TEMP ; load value to temporary
PHX PHX
LDA !SINGLE_INDEX_TEMP : AND #$07 : TAX ; load 0-7 part into X LDA !SINGLE_INDEX_TEMP : AND #$07 : TAX ; load 0-7 part into X
LDA !SINGLE_INDEX_BITMASK_TEMP LDA !SINGLE_INDEX_BITMASK_TEMP
@@ -1102,7 +1086,7 @@ MarkRNGItemSingle:
;STA !SINGLE_INDEX_TEMP ;STA !SINGLE_INDEX_TEMP
LSR #3 : STA !SINGLE_INDEX_OFFSET_TEMP : TAX LSR #3 : STA !SINGLE_INDEX_OFFSET_TEMP : TAX
LDA.l !RNG_ITEM, X LDA.l RNGItem, X
STA.l !SINGLE_INDEX_BITMASK_TEMP STA.l !SINGLE_INDEX_BITMASK_TEMP
LDA.l !SINGLE_INDEX_TEMP : AND #$07 : TAX ; load 0-7 part into X LDA.l !SINGLE_INDEX_TEMP : AND #$07 : TAX ; load 0-7 part into X
LDA.b #01 LDA.b #01
@@ -1117,7 +1101,7 @@ MarkRNGItemSingle:
LDA.l !SINGLE_INDEX_OFFSET_TEMP : TAX LDA.l !SINGLE_INDEX_OFFSET_TEMP : TAX
PLA PLA
ORA.l !SINGLE_INDEX_BITMASK_TEMP ORA.l !SINGLE_INDEX_BITMASK_TEMP
STA.l !RNG_ITEM, X STA.l RNGItem, X
RTS RTS
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
GetRNGItemMulti: GetRNGItemMulti:
@@ -1142,7 +1126,7 @@ IncrementItemCounters:
.match .match
PHX PHX
TXA : LSR #2 : TAX TXA : LSR #2 : TAX
LDA !ITEM_LIMIT_COUNTS, X : INC : STA !ITEM_LIMIT_COUNTS, X LDA ItemLimitCounts, X : INC : STA ItemLimitCounts, X
PLX PLX
BEQ .exit BEQ .exit
.noMatch .noMatch
@@ -1162,7 +1146,7 @@ AttemptItemSubstitution:
.match .match
PHX PHX
TXA : LSR #2 : TAX TXA : LSR #2 : TAX
LDA !ITEM_LIMIT_COUNTS, X LDA ItemLimitCounts, X
PLX PLX
CMP.l ItemSubstitutionRules+1, X : !BLT + CMP.l ItemSubstitutionRules+1, X : !BLT +
LDA.l ItemSubstitutionRules+2, X : STA 1,s LDA.l ItemSubstitutionRules+2, X : STA 1,s
@@ -1178,10 +1162,10 @@ RTS
CountBottles: CountBottles:
PHX PHX
LDX.b #$00 LDX.b #$00
LDA $7EF35C : BEQ ++ : INX LDA BottleContentsOne : BEQ ++ : INX
++ : LDA $7EF35D : BEQ ++ : INX ++ : LDA BottleContentsTwo : BEQ ++ : INX
++ : LDA $7EF35E : BEQ ++ : INX ++ : LDA BottleContentsThree : BEQ ++ : INX
++ : LDA $7EF35F : BEQ ++ : INX ++ : LDA BottleContentsFour : BEQ ++ : INX
++ ++
TXA TXA
PLX PLX
@@ -1194,6 +1178,7 @@ JML.l StatsFinalPrep
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
ChestPrep: ChestPrep:
LDA.b #$01 : STA $02E9 LDA.b #$01 : STA $02E9
JSL.l IncrementChestCounter
LDA.l ServerRequestMode : BEQ + LDA.l ServerRequestMode : BEQ +
JSL.l ChestItemServiceRequest JSL.l ChestItemServiceRequest
RTL RTL
@@ -1218,3 +1203,50 @@ UpdateInventoryLocationExpanded:
JSL ItemDowngradeFix JSL ItemDowngradeFix
RTL RTL
} }
;--------------------------------------------------------------------------------
; Set a flag in SRAM if we pick up a compass in its own dungeon with HUD compass
; counts on
MaybeFlagCompassTotalPickup:
LDA CompassMode : BEQ .done
LDA $040C : CMP #$FF : BEQ .done
LSR : STA $04 : LDA #$0F : !SUB $04 ; Compute flag "index"
CPY #$25 : BEQ .setFlag ; Set flag if it's a compass for this dungeon
STA $04
TYA : AND #$0F : CMP $04 : BNE .done ; Check if compass is for this dungeon
.setFlag
CMP #$08 : !BGE ++
%ValueShift()
ORA CompassCountDisplay : STA CompassCountDisplay
BRA .done
++
!SUB #$08
%ValueShift()
BIT.b #$C0 : BEQ + : LDA.b #$C0 : + ; Make Hyrule Castle / Sewers Count for Both
ORA CompassCountDisplay+1 : STA CompassCountDisplay+1
.done
RTL
;--------------------------------------------------------------------------------
; Set the compass count display flag if we're entering a dungeon and alerady have
; that compass
MaybeFlagCompassTotalEntrance:
LDX $040C : CPX #$FF : BEQ .done ; Skip if we're not entering dungeon
LDA CompassMode : BEQ .done ; Skip if we're not showing compass counts
CMP.w #$0002 : BEQ .countShown
LDA CompassField : AND.l DungeonItemMasks, X : BEQ .done ; skip if we don't have compass
.countShown
SEP #$20
TXA : LSR : STA.b $04 : LDA.b #$0F : !SUB $04 ; Compute flag "index"
CMP #$08 : !BGE ++
%ValueShift()
ORA CompassCountDisplay : STA CompassCountDisplay
REP #$20
BRA .done
++
!SUB #$08
%ValueShift()
BIT.b #$C0 : BEQ + : LDA.b #$C0 : + ; Make Hyrule Castle / Sewers Count for Both
ORA CompassCountDisplay+1 : STA CompassCountDisplay+1
REP #$20
.done
RTL
;--------------------------------------------------------------------------------

View File

@@ -21,44 +21,42 @@
;UNUSED = "#$40" ;UNUSED = "#$40"
;MAGIC_BAT = "#$80" ;MAGIC_BAT = "#$80"
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
!NPC_FLAGS = "$7EF410"
!NPC_FLAGS_2 = "$7EF411"
ItemCheck_FairySword: ItemCheck_FairySword:
LDA !NPC_FLAGS_2 : AND.b #$08 LDA NpcFlags+1 : AND.b #$08
RTL RTL
ItemCheck_SmithSword: ItemCheck_SmithSword:
LDA !NPC_FLAGS_2 : AND.b #$04 LDA NpcFlags+1 : AND.b #$04
RTL RTL
ItemCheck_MagicBat: ItemCheck_MagicBat:
LDA !NPC_FLAGS_2 : AND.b #$80 LDA NpcFlags+1 : AND.b #$80
RTL RTL
ItemCheck_OldMan: ItemCheck_OldMan:
LDA !NPC_FLAGS : AND.b #$01 : CMP #$01 LDA NpcFlags : AND.b #$01 : CMP #$01
RTL RTL
ItemCheck_ZoraKing: ItemCheck_ZoraKing:
LDA !NPC_FLAGS : AND.b #$02 LDA NpcFlags : AND.b #$02
RTL RTL
ItemCheck_SickKid: ItemCheck_SickKid:
LDA !NPC_FLAGS : AND.b #$04 LDA NpcFlags : AND.b #$04
RTL RTL
ItemCheck_TreeKid: ItemCheck_TreeKid:
LDA !NPC_FLAGS : AND.b #$08 ; FluteBoy_Chillin - 73: LDA $7EF34C LDA NpcFlags : AND.b #$08 ; FluteBoy_Chillin - 73: LDA FluteEquipment
RTL RTL
ItemCheck_TreeKid2: ItemCheck_TreeKid2:
LDA !NPC_FLAGS : AND.b #$08 : LSR #$02 ; FluteAardvark_InitialStateFromFluteState - 225: LDA $7EF34C : AND.b #$03 LDA 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 !NPC_FLAGS : AND.b #$08 LDA NpcFlags : AND.b #$08
BEQ .normal BEQ .normal
BRA .done BRA .done
LDA.b #$05 LDA.b #$05
@@ -68,16 +66,16 @@ ItemCheck_TreeKid3:
RTL RTL
ItemCheck_Sahasrala: ItemCheck_Sahasrala:
LDA !NPC_FLAGS : AND.b #$10 LDA NpcFlags : AND.b #$10
RTL RTL
ItemCheck_Library: ItemCheck_Library:
LDA !NPC_FLAGS : AND.b #$80 LDA NpcFlags : AND.b #$80
RTL RTL
ItemCheck_Mushroom: ItemCheck_Mushroom:
LDA !NPC_FLAGS_2 : ROL #4 ; does the same thing as below LDA NpcFlags+1 : ROL #4 ; does the same thing as below
; LDA !NPC_FLAGS_2 : AND.b #$10 : BEQ .clear ; LDA NpcFlags+1 : AND.b #$10 : BEQ .clear
; SEC ; SEC
;RTL ;RTL
; .clear ; .clear
@@ -85,14 +83,14 @@ ItemCheck_Mushroom:
RTL RTL
ItemCheck_Powder: ItemCheck_Powder:
LDA !NPC_FLAGS_2 : AND.b #$20 LDA NpcFlags+1 : AND.b #$20
RTL RTL
ItemCheck_Catfish: ItemCheck_Catfish:
;LDA CatfishGoodItem : BEQ .junk ;LDA CatfishGoodItem : BEQ .junk
;PHX ;PHX
; LDA CatfishGoodItem+1 : TAX ; LDA CatfishGoodItem+1 : TAX
; LDA $7EF340-1, X ; LDA BowEquipment-1, X
;PLX ;PLX
;-- ;--
;CMP CatfishGoodItem : !BLT .oursNewer ;CMP CatfishGoodItem : !BLT .oursNewer
@@ -101,60 +99,60 @@ ItemCheck_Catfish:
;.oursNewers ;.oursNewers
;LDA #$00 : RTL ; give item ;LDA #$00 : RTL ; give item
;.junk ;.junk
LDA !NPC_FLAGS : AND.b #$20 LDA NpcFlags : AND.b #$20
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
ItemSet_FairySword: ItemSet_FairySword:
PHA : LDA !NPC_FLAGS_2 : ORA.b #$08 : STA !NPC_FLAGS_2 : PLA PHA : LDA NpcFlags+1 : ORA.b #$08 : STA NpcFlags+1 : PLA
RTL RTL
ItemSet_SmithSword: ItemSet_SmithSword:
PHA : LDA !NPC_FLAGS_2 : ORA.b #$04 : STA !NPC_FLAGS_2 : PLA PHA : LDA NpcFlags+1 : ORA.b #$04 : STA NpcFlags+1 : PLA
RTL RTL
ItemSet_MagicBat: ItemSet_MagicBat:
PHA : LDA !NPC_FLAGS_2 : ORA.b #$80 : STA !NPC_FLAGS_2 : PLA PHA : LDA NpcFlags+1 : ORA.b #$80 : STA 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 !NPC_FLAGS : ORA.b #$01 : STA !NPC_FLAGS : PLA PHA : LDA NpcFlags : ORA.b #$01 : STA NpcFlags : PLA
RTL RTL
ItemSet_ZoraKing: ItemSet_ZoraKing:
;JSL $1DE1AA ; Sprite_SpawnFlippersItem ; thing we wrote over ;JSL $1DE1AA ; Sprite_SpawnFlippersItem ; thing we wrote over
PHA : LDA !NPC_FLAGS : ORA.b #$02 : STA !NPC_FLAGS : 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 !NPC_FLAGS : ORA.b #$04 : STA !NPC_FLAGS : PLA PHA : LDA NpcFlags : ORA.b #$04 : STA 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 !NPC_FLAGS : ORA.b #$08 : STA !NPC_FLAGS : PLA PHA : LDA NpcFlags : ORA.b #$08 : STA 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 !NPC_FLAGS : ORA.b #$10 : STA !NPC_FLAGS : PLA PHA : LDA NpcFlags : ORA.b #$10 : STA NpcFlags : PLA
RTL RTL
ItemSet_Catfish: ItemSet_Catfish:
;JSL $00D52D ; GetAnimatedSpriteTile.variable ; thing we wrote over ;JSL $00D52D ; GetAnimatedSpriteTile.variable ; thing we wrote over
;JSL.l LoadCatfishItemGFX ;JSL.l LoadCatfishItemGFX
PHA : LDA !NPC_FLAGS : ORA.b #$20 : STA !NPC_FLAGS : PLA 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 !NPC_FLAGS : ORA.b #$80 : STA !NPC_FLAGS : PLA PHA : LDA NpcFlags : ORA.b #$80 : STA NpcFlags : PLA
RTL RTL
ItemSet_Mushroom: ItemSet_Mushroom:
PHA PHA
LDA !NPC_FLAGS_2 : ORA.b #$10 : STA !NPC_FLAGS_2 LDA NpcFlags+1 : ORA.b #$10 : STA NpcFlags+1
LDY $0E80, X ; Retrieve stored item type LDY $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
@@ -166,7 +164,7 @@ ItemSet_Mushroom:
RTL RTL
ItemSet_Powder: ItemSet_Powder:
PHA : LDA !NPC_FLAGS_2 : ORA.b #$20 : STA !NPC_FLAGS_2 : PLA PHA : LDA NpcFlags+1 : ORA.b #$20 : STA NpcFlags+1 : PLA
RTL RTL
;================================================================================ ;================================================================================

View File

@@ -1,29 +0,0 @@
;================================================================================
; Open Mode Uncle Rain State Check
;================================================================================
!INFINITE_ARROWS = "$7F50C8"
!INFINITE_BOMBS = "$7F50C9"
!INFINITE_MAGIC = "$7F50CA"
SetUncleRainState:
LDA.l OpenMode : BEQ + : RTL : + ; we're done if open mode is on
LDA.b #$01 : STA $7EF3C5
RTL
;--------------------------------------------------------------------------------
InitOpenMode:
LDA.l OpenMode : BEQ + ; Skip if not open mode
LDA $7EF3C5 : CMP #$02 : !BGE + ; Skip if already past escape
LDA.b #$02 : STA $7EF3C5 ; Go to post-escape phase (pre aga1)
LDA $7EF3C6 : ORA #$14 : STA $7EF3C6 ; remove uncle
LDA $7EF3C8 : CMP #$05 : BEQ ++ : LDA.b #$01 : ++ : STA $7EF3C8 ; set spawn points to house+sanc unless already house+sanc+mountain
LDA $7EF29B : ORA.b #$20 : STA $7EF29B ; open castle gate
JSL MaybeSetPostAgaWorldState
+
RTL
;--------------------------------------------------------------------------------
MaybeSetPostAgaWorldState:
LDA.l InstantPostAgaWorldState : BEQ + ; Skip if not enabled
LDA.b #$03 : STA $7EF3C5 ; Go to post-aga phase
LDA $7EF282 : ORA.b #$20 : STA $7EF282 ; make lumberjack tree accessible
+
RTL
;--------------------------------------------------------------------------------

View File

@@ -1,7 +1,5 @@
!PASSWORD_CODE_POSITION = "$C8" !PASSWORD_CODE_POSITION = "$C8"
!PASSWORD_SELECTION_POSITION = "$C9" !PASSWORD_SELECTION_POSITION = "$C9"
!PASSWORD_SRAM = "$701000"
Module_Password: Module_Password:
LDA $11 LDA $11
@@ -39,7 +37,7 @@ Password_EndInit:
LDX.b #$0F LDX.b #$0F
LDA.b #$00 LDA.b #$00
- -
STA.l !PASSWORD_SRAM, X STA.l PasswordSRAM, X
DEX : BPL - DEX : BPL -
+ +
@@ -108,7 +106,7 @@ Password_Main:
BRA + BRA +
++ ++
LDX !PASSWORD_CODE_POSITION LDX !PASSWORD_CODE_POSITION
STA !PASSWORD_SRAM,X STA PasswordSRAM,X
TXA : INC A : AND.b #$0F : STA !PASSWORD_CODE_POSITION TXA : INC A : AND.b #$0F : STA !PASSWORD_CODE_POSITION
BNE ++ BNE ++
STZ $012E STZ $012E
@@ -166,7 +164,7 @@ ValidatePassword:
;check for incomplete password ;check for incomplete password
LDX #$0F LDX #$0F
- -
LDA.l !PASSWORD_SRAM, X : BNE + LDA.l PasswordSRAM, X : BNE +
JMP .incorrect JMP .incorrect
+ +
DEX : BPL - DEX : BPL -
@@ -229,7 +227,7 @@ PasswordToKey:
LDA.w #$000B : STA $04 LDA.w #$000B : STA $04
- -
LDX $00 LDX $00
LDA !PASSWORD_SRAM, X : DEC : AND #$001F LDA PasswordSRAM, X : DEC : AND #$001F
LDY $04 LDY $04
-- : BEQ + : ASL : DEY : BRA -- : + ; Shift left by Y -- : BEQ + : ASL : DEY : BRA -- : + ; Shift left by Y
XBA XBA
@@ -343,7 +341,7 @@ UpdatePasswordTiles:
REP #$30 ; set 16-bit both REP #$30 ; set 16-bit both
LDX.w #$000F LDX.w #$000F
- -
LDA.l !PASSWORD_SRAM, X : AND.w #$00FF : TXY LDA.l PasswordSRAM, X : AND.w #$00FF : TXY
ASL #3 : STA $00 ASL #3 : STA $00
TYA : ASL #4 : STA $03 TYA : ASL #4 : STA $03
LDX $00 : LDA.l HashAlphabetTilesWithBlank, X LDX $00 : LDA.l HashAlphabetTilesWithBlank, X

View File

@@ -2,19 +2,19 @@
; Pendant / Crystal HUD Fix ; Pendant / Crystal HUD Fix
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
;CheckPendantHUD: ;CheckPendantHUD:
; LDA !HUD_FLAG : CMP.b #$40 ; check for hud flag instead ; LDA HudFlag : CMP.b #$40 ; check for hud flag instead
;RTL ;RTL
;================================================================================ ;================================================================================
FlipLWDWFlag: FlipLWDWFlag:
PHP PHP
SEP #$20 ; set 8-bit accumulator SEP #$20 ; set 8-bit accumulator
LDA $7EF3CA : EOR.b #$40 : STA $7EF3CA LDA CurrentWorld : EOR.b #$40 : STA 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 $7EF3C7 STA MapIcons
PLP PLP
RTL RTL
;================================================================================ ;================================================================================
@@ -23,7 +23,7 @@ HUDRebuildIndoorHole:
LDA.l GenericKeys : BEQ .normal LDA.l GenericKeys : BEQ .normal
.generic .generic
PLA PLA
LDA $7EF38B ; generic key count LDA CurrentGenericKeys ; generic key count
JSL.l HUD_RebuildIndoor_Palace JSL.l HUD_RebuildIndoor_Palace
RTL RTL
.normal .normal
@@ -35,7 +35,7 @@ HUDRebuildIndoor:
LDA.l GenericKeys : BEQ .normal LDA.l GenericKeys : BEQ .normal
.generic .generic
LDA.b #$00 : STA $7EC017 LDA.b #$00 : STA $7EC017
LDA $7EF38B ; generic key count LDA CurrentGenericKeys ; generic key count
RTL RTL
.normal .normal
LDA.b #$00 : STA $7EC017 LDA.b #$00 : STA $7EC017
@@ -45,25 +45,23 @@ RTL
GetCrystalNumber: GetCrystalNumber:
PHX PHX
TXA : ASL : TAX TXA : ASL : TAX
LDA $7EF3CA : EOR.b #$40 : BNE + LDA CurrentWorld : EOR.b #$40 : BNE +
INX INX
+ +
LDA.l CrystalNumberTable-16, X LDA.l CrystalNumberTable-16, X
PLX PLX
RTL RTL
;================================================================================ ;================================================================================
!INVENTORY_MAP = "$7EF368"
!MAP_OVERLAY = "$7EF414" ; [2]
OverworldMap_CheckObject: OverworldMap_CheckObject:
PHX PHX
;CPX.b #$01 : BNE + : JMP ++ : + : JMP .fail ;CPX.b #$01 : BNE + : JMP ++ : + : JMP .fail
LDA $7EF3CA : AND.b #$40 : BNE + LDA CurrentWorld : AND.b #$40 : BNE +
;LW Map ;LW Map
LDA.l MapMode : BEQ +++ LDA.l MapMode : BEQ +++
LDA !INVENTORY_MAP : ORA !MAP_OVERLAY : AND.b #$01 : BNE +++ LDA MapField : ORA 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 !INVENTORY_MAP, X : ORA !MAP_OVERLAY, X LDA MapField, X : ORA MapOverlay, X
PLX PLX
AND.l .lw_map_masks, X : BNE +++ AND.l .lw_map_masks, X : BNE +++
JMP .fail JMP .fail
@@ -74,10 +72,10 @@ OverworldMap_CheckObject:
+ +
;DW Map ;DW Map
LDA.l MapMode : BEQ +++ LDA.l MapMode : BEQ +++
LDA !INVENTORY_MAP : ORA !MAP_OVERLAY : AND.b #$02 : BNE +++ LDA MapField : ORA 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 !INVENTORY_MAP, X : ORA !MAP_OVERLAY, X LDA.l MapField, X : ORA MapOverlay, X
PLX PLX
AND.l .dw_map_masks, X : BNE +++ AND.l .dw_map_masks, X : BNE +++
JMP .fail JMP .fail
@@ -92,11 +90,11 @@ RTL
AND.b #$40 : BNE .checkCrystal AND.b #$40 : BNE .checkCrystal
.checkPendant .checkPendant
LDA $7EF374 : AND.l CrystalPendantFlags, X : BNE .fail LDA PendantsField : AND.l CrystalPendantFlags, X : BNE .fail
CLC : BRA .done CLC : BRA .done
.checkCrystal .checkCrystal
LDA $7EF37A : AND.l CrystalPendantFlags, X : BNE .fail LDA CrystalsField : AND.l CrystalPendantFlags, X : BNE .fail
CLC : BRA .done CLC : BRA .done
.fail .fail
@@ -121,18 +119,18 @@ 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 $7EF3CA : EOR.b #$40 LDA 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 $7EF3C7 STA MapIcons
PLP PLP
RTL RTL
;================================================================================ ;================================================================================
GetMapMode: GetMapMode:
LDA $7EF3CA : AND.b #$40 : BEQ + LDA CurrentWorld : AND.b #$40 : BEQ +
LDA.b #07 ; dark world - crystals LDA.b #07 ; dark world - crystals
RTL RTL
+ +
@@ -193,7 +191,7 @@ RTL
ShowDungeonItems: ShowDungeonItems:
LDA $040C : AND.w #$00FF : CMP.w #$00FF : BNE + : RTL : + ; return normal result if outdoors or in a cave LDA $040C : AND.w #$00FF : CMP.w #$00FF : BNE + : RTL : + ; return normal result if outdoors or in a cave
;LDA $F0 : AND.w #$0020 ; check for select ;LDA $F0 : AND.w #$0020 ; check for select
LDA !HUD_FLAG : 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 $040C : AND.w #$00FF : CMP.w #$00FF ; original logic
RTL RTL
@@ -205,13 +203,13 @@ UpdateKeys:
LSR : TAX ; get dungeon index and store to X LSR : TAX ; get dungeon index and store to X
LDA $7EF36F ; load current key count LDA CurrentSmallKeys ; load current key count
STA $7EF37C, X ; save to main counts STA DungeonKeys, X ; save to main counts
CPX.b #$00 : BNE + CPX.b #$00 : BNE +
STA $7EF37D ; copy HC to sewers STA HyruleCastleKeys ; copy HC to sewers
+ : CPX.b #$01 : BNE + + : CPX.b #$01 : BNE +
STA $7EF37C ; copy sewers to HC STA SewerKeys ; copy sewers to HC
+ +
.skip .skip
JSL.l PostItemGet JSL.l PostItemGet
@@ -285,19 +283,19 @@ DrawHUDDungeonItems:
dw 30 ; Ganon's Tower dw 30 ; Ganon's Tower
.small_key_x_offset .small_key_x_offset
dw $7EF37D-$7EF37D ; Hyrule Castle dw HyruleCastleKeys-DungeonKeys ; Hyrule Castle
dw $7EF37E-$7EF37D ; Eastern dw EasternKeys-DungeonKeys ; Eastern
dw $7EF37F-$7EF37D ; Desert dw DesertKeys-DungeonKeys ; Desert
dw $7EF386-$7EF37D ; Hera dw HeraKeys-DungeonKeys ; Hera
dw $7EF380-$7EF37D ; Agahnims Tower dw CastleTowerKeys-DungeonKeys ; Agahnims Tower
dw $7EF382-$7EF37D ; PoD dw PalaceOfDarknessKeys-DungeonKeys ; PoD
dw $7EF381-$7EF37D ; Swamp dw SwampKeys-DungeonKeys ; Swamp
dw $7EF384-$7EF37D ; Skull Woods dw SkullWoodsKeys-DungeonKeys ; Skull Woods
dw $7EF387-$7EF37D ; Thieves Town dw ThievesTownKeys-DungeonKeys ; Thieves Town
dw $7EF385-$7EF37D ; Ice dw IcePalaceKeys-DungeonKeys ; Ice
dw $7EF383-$7EF37D ; Mire dw MireKeys-DungeonKeys ; Mire
dw $7EF388-$7EF37D ; Turtle Rock dw TurtleRockKeys-DungeonKeys ; Turtle Rock
dw $7EF389-$7EF37D ; Ganon's Tower dw GanonsTowerKeys-DungeonKeys ; Ganon's Tower
.dungeon_bitmasks .dungeon_bitmasks
@@ -366,7 +364,7 @@ DrawHUDDungeonItems:
DEX : DEX : BPL -- DEX : DEX : BPL --
LDA.l !HUD_FLAG : AND.w #$0020 : BEQ + LDA.l HudFlag : AND.w #$0020 : BEQ +
JMP .maps_and_compasses JMP .maps_and_compasses
@@ -386,7 +384,7 @@ DrawHUDDungeonItems:
.next_small_key .next_small_key
LDX.w .small_key_x_offset,Y LDX.w .small_key_x_offset,Y
LDA.l $7EF37D,X LDA.l DungeonKeys,X
AND.w #$00FF AND.w #$00FF
LDX.w .dungeon_positions,Y LDX.w .dungeon_positions,Y
@@ -410,7 +408,7 @@ DrawHUDDungeonItems:
LDX.w #0 LDX.w #0
; load once and test multiple times ; load once and test multiple times
LDA.l $7EF366 LDA.l BigKeyField
.next_big_key .next_big_key
BIT.w .dungeon_bitmasks,X BIT.w .dungeon_bitmasks,X
@@ -421,7 +419,7 @@ DrawHUDDungeonItems:
STA.w $16C6,Y STA.w $16C6,Y
; reload ; reload
LDA.l $7EF366 LDA.l BigKeyField
..skip_key ..skip_key
INX : INX INX : INX
@@ -439,7 +437,7 @@ DrawHUDDungeonItems:
.next_boss_kill .next_boss_kill
LDX.w .boss_room_ids,Y LDX.w .boss_room_ids,Y
LDA.l $7EF000,X LDA.l RoomDataWRAM.l,X
AND.w #$0800 AND.w #$0800
BEQ ..skip_boss_kill BEQ ..skip_boss_kill
@@ -469,7 +467,7 @@ DrawHUDDungeonItems:
LDX.w #0 LDX.w #0
; load once and test multiple times ; load once and test multiple times
LDA.l $7EF368 LDA.l MapField
.next_map .next_map
BIT.w .dungeon_bitmasks,X BIT.w .dungeon_bitmasks,X
@@ -480,7 +478,7 @@ DrawHUDDungeonItems:
STA.w $1686,Y STA.w $1686,Y
; reload ; reload
LDA.l $7EF368 LDA.l MapField
..skip_map ..skip_map
INX : INX INX : INX
@@ -498,7 +496,7 @@ DrawHUDDungeonItems:
LDX.w #0 LDX.w #0
; load once and test multiple times ; load once and test multiple times
LDA.l $7EF364 LDA.l CompassField
.next_compass .next_compass
BIT.w .dungeon_bitmasks,X BIT.w .dungeon_bitmasks,X
@@ -509,7 +507,7 @@ DrawHUDDungeonItems:
STA.w $16C6,Y STA.w $16C6,Y
; reload ; reload
LDA.l $7EF364 LDA.l CompassField
..skip_compass ..skip_compass
INX : INX INX : INX
@@ -542,7 +540,7 @@ DrawPendantCrystalDiagram:
INX #2 : CPX.w #$0014 : BCC - INX #2 : CPX.w #$0014 : BCC -
; pendants ; pendants
LDA $7EF374 LDA PendantsField
LSR : BCC + ; pendant of wisdom (red) LSR : BCC + ; pendant of wisdom (red)
LDX.w #$252B LDX.w #$252B
@@ -569,7 +567,7 @@ DrawPendantCrystalDiagram:
; crystals ; crystals
LDA $7EF37A LDA CrystalsField
LDX.w #$2D44 LDX.w #$2D44
LDY.w #$2D45 LDY.w #$2D45
@@ -675,4 +673,4 @@ dw $A8FB, $A8F9, $A8F9, $A8F9, $A8F9, $A8F9, $A8F9, $A8F9, $A8F9, $E8FB
;0x1A - Ganon's Tower ;0x1A - Ganon's Tower
;0x1C - ??? possibly unused. (Were they planning two extra dungeons perhaps?) ;0x1C - ??? possibly unused. (Were they planning two extra dungeons perhaps?)
;0x1E - ??? possibly unused. ;0x1E - ??? possibly unused.
;================================================================================ ;================================================================================

View File

@@ -1,30 +1,35 @@
; Note shortly before this we have a blank-the-sram slot code that we might want to hook ; Note shortly before this we have a blank-the-sram slot code that we might want to hook
WriteBlanksToPlayerName: WriteBlanksToPlayerName:
STA.l !ExtendedPlayerName STA.l ExtendedFileNameSRAM
STA.l !ExtendedPlayerName+2 STA.l ExtendedFileNameSRAM+2
STA.l !ExtendedPlayerName+4 STA.l ExtendedFileNameSRAM+4
STA.l !ExtendedPlayerName+6 STA.l ExtendedFileNameSRAM+6
STA.l !ExtendedPlayerName+8 STA.l ExtendedFileNameSRAM+8
STA.l !ExtendedPlayerName+10 STA.l ExtendedFileNameSRAM+10
STA.l !ExtendedPlayerName+12 STA.l ExtendedFileNameSRAM+12
STA.l !ExtendedPlayerName+14 STA.l ExtendedFileNameSRAM+14
STA.l $7003D9, X ;What we wrote over (clear first byte of vanilla name slot) STA.l ExtendedFileNameSRAM+16
STA.l ExtendedFileNameSRAM+18
STA.l ExtendedFileNameSRAM+20
STA.l ExtendedFileNameSRAM+22
STA.l $7003D9, X ;What we wrote over (clear first byte of vanilla name slot)
RTL RTL
WriteCharacterToPlayerName: WriteCharacterToPlayerName:
CPX.w #$0008 : !BLT .orig STA ExtendedFileNameSRAM, X
STA !ExtendedPlayerName-8, X CPX.w #$0008 : !BGE +
.orig STA $7003D9, X ;what we wrote over
STA $7003D9, X ;what we wrote over +
RTL RTL
ReadCharacterFromPlayerName: ;Only for use on Name Screen ReadCharacterFromPlayerName: ;Only for use on Name Screen
CPX.w #$0008 : !BLT .orig LDA ExtendedFileNameSRAM, X
LDA !ExtendedPlayerName-8, X CPX.w #$0008 : !BGE +
.orig LDA $7003D9, X ;what we wrote over
LDA $7003D9, X ;what we wrote over +
RTL RTL
GetCharacterPosition: GetCharacterPosition:

View File

@@ -15,19 +15,19 @@ RefillHealth:
LDA.l PotionHealthRefill : CMP.b #$A0 : !BGE .done LDA.l PotionHealthRefill : CMP.b #$A0 : !BGE .done
LDA !BUSY_HEALTH : BNE ++ LDA !BUSY_HEALTH : BNE ++
LDA.l PotionHealthRefill ; load refill amount LDA.l PotionHealthRefill ; load refill amount
!ADD $7EF36D ; add to current health !ADD CurrentHealth ; add to current health
CMP $7EF36C : !BLT +++ : LDA $7EF36C : +++ CMP MaximumHealth : !BLT +++ : LDA MaximumHealth : +++
STA !BUSY_HEALTH STA !BUSY_HEALTH
++ ++
LDA $7EF36D : CMP.l !BUSY_HEALTH : !BLT ++ LDA CurrentHealth : CMP.l !BUSY_HEALTH : !BLT ++
LDA.b #$00 : STA $7EF372 LDA.b #$00 : STA HeartsFiller
LDA $020A : BNE .notDone LDA $020A : BNE .notDone
LDA.b #$00 : STA !BUSY_HEALTH LDA.b #$00 : STA !BUSY_HEALTH
SEC SEC
RTL RTL
++ ++
LDA.b #$08 : STA $7EF372 ; refill some health LDA.b #$08 : STA HeartsFiller ; refill some health
.notDone .notDone
CLC CLC
RTL RTL
@@ -35,16 +35,16 @@ RefillHealth:
; Check goal health versus actual health. ; Check goal health versus actual health.
; if(actual < goal) then branch. ; if(actual < goal) then branch.
LDA $7EF36D : CMP $7EF36C : BCC .refillAllHealth LDA CurrentHealth : CMP MaximumHealth : BCC .refillAllHealth
LDA $7EF36C : STA $7EF36D LDA MaximumHealth : STA CurrentHealth
LDA.b #$00 : STA $7EF372 LDA.b #$00 : STA HeartsFiller
; ??? not sure what purpose this branch serves. ; ??? not sure what purpose this branch serves.
LDA $020A : BNE .beta LDA $020A : BNE .beta
SEC SEC
RTL RTL
.refillAllHealth .refillAllHealth
; Fill up ze health. ; Fill up ze health.
LDA.b #$A0 : STA $7EF372 LDA.b #$A0 : STA HeartsFiller
.beta .beta
CLC CLC
RTL RTL
@@ -62,27 +62,27 @@ RefillMagic:
LDA.l PotionMagicRefill : CMP.b #$80 : !BGE .done LDA.l PotionMagicRefill : CMP.b #$80 : !BGE .done
LDA !BUSY_MAGIC : BNE ++ LDA !BUSY_MAGIC : BNE ++
LDA.l PotionMagicRefill ; load refill amount LDA.l PotionMagicRefill ; load refill amount
!ADD $7EF36E ; add to current magic !ADD CurrentMagic ; add to current magic
CMP.b #$80 : !BLT +++ : LDA.b #$80 : +++ CMP.b #$80 : !BLT +++ : LDA.b #$80 : +++
STA !BUSY_MAGIC STA !BUSY_MAGIC
++ ++
LDA $7EF36E : CMP.l !BUSY_MAGIC : !BLT ++ LDA CurrentMagic : CMP.l !BUSY_MAGIC : !BLT ++
LDA.b #$00 : STA !BUSY_MAGIC LDA.b #$00 : STA !BUSY_MAGIC
SEC SEC
RTL RTL
++ ++
LDA.b #$01 : STA $7EF373 ; refill some magic LDA.b #$01 : STA MagicFiller ; refill some magic
CLC CLC
RTL RTL
.done .done
SEP #$30 SEP #$30
; Check if Link's magic meter is full ; Check if Link's magic meter is full
LDA $7EF36E : CMP.b #$80 LDA CurrentMagic : CMP.b #$80
BCS .itsFull BCS .itsFull
; Tell the magic meter to fill up until it's full. ; Tell the magic meter to fill up until it's full.
LDA.b #$80 : STA $7EF373 LDA.b #$80 : STA MagicFiller
SEP #$30 SEP #$30
RTL RTL
.itsFull .itsFull

View File

@@ -1,66 +0,0 @@
;================================================================================
; RTPreview SRAM Hook
;--------------------------------------------------------------------------------
MaybeWriteSRAMTrace:
LDA EnableSRAMTrace : AND.l TournamentSeedInverse : BEQ +
JSL.l WriteStatusPreview
+
RTL
;--------------------------------------------------------------------------------
WriteStatusPreview:
PHA
LDA $4300 : PHA ; preserve DMA parameters
LDA $4301 : PHA ; preserve DMA parameters
LDA $4302 : PHA ; preserve DMA parameters
LDA $4303 : PHA ; preserve DMA parameters
LDA $4304 : PHA ; preserve DMA parameters
LDA $4305 : PHA ; preserve DMA parameters
LDA $4306 : PHA ; preserve DMA parameters
;--------------------------------------------------------------------------------
LDA #$80 : STA $4300 ; set DMA transfer direction B -> A, bus A auto increment, single-byte mode
STA $4301 ; set bus B source to WRAM register
LDA #$40 : STA $2181 ; set WRAM register source address
LDA #$F3 : STA $2182
LDA #$7E : STA $2183
STZ $4302 ; set bus A destination address to SRAM
LDA #$1E : STA $4303
LDA #$70 : STA $4304
LDA #$80 : STA $4305 ; set transfer size to 0x180
LDA #$01 : STA $4306 ; STZ $4307
LDA #$01 : STA $420B ; begin DMA transfer
;--------------------------------------------------------------------------------
PLA : STA $4306 ; restore DMA parameters
PLA : STA $4305 ; restore DMA parameters
PLA : STA $4304 ; restore DMA parameters
PLA : STA $4303 ; restore DMA parameters
PLA : STA $4302 ; restore DMA parameters
PLA : STA $4301 ; restore DMA parameters
PLA : STA $4300 ; restore DMA parameters
PLA
RTL
;--------------------------------------------------------------------------------
;WriteStatusPreview:
; PHA : PHX : PHP
;
; REP #$20 ; set 16-bit accumulator
; CLC
; LDX.b #$00
; -
; LDA $7EF340, X : STA $701E00, X
; LDA $7EF340+2, X : STA $701E00+2, X
; LDA $7EF340+4, X : STA $701E00+4, X
; TXA : ADC.b #$06 : TAX
; CPX #$24 : !BLT -
;
; SEP #$20 ; set 8-bit accumulator
; LDA $7EF374 : STA $701E24
; LDA $7EF37A : STA $701E25
;
; PLP : PLX : PLA
;RTL
;--------------------------------------------------------------------------------

View File

@@ -28,7 +28,7 @@ QuickSwap:
BRA .store BRA .store
.special_swap .special_swap
LDA !INVENTORY_SWAP_2 : ORA #$01 : STA !INVENTORY_SWAP_2 LDA InventoryTracking+1 : ORA #$01 : STA 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
@@ -50,10 +50,10 @@ 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 #$20 : BNE ++ ; Still holding L from a previous frame
LDA !INVENTORY_SWAP_2 : AND #$FE : STA !INVENTORY_SWAP_2 LDA InventoryTracking+1 : AND #$FE : STA InventoryTracking+1
BRA + BRA +
++ ++
LDA !INVENTORY_SWAP_2 : BIT #$01 : BEQ + LDA InventoryTracking+1 : BIT #$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
@@ -65,10 +65,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 !INVENTORY_SWAP_2 : AND #$FE : STA !INVENTORY_SWAP_2 LDA InventoryTracking+1 : AND #$FE : STA InventoryTracking+1
BRA + BRA +
++ ++
LDA !INVENTORY_SWAP_2 : BIT #$01 : BEQ + LDA InventoryTracking+1 : BIT #$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

18
ram.asm Normal file
View File

@@ -0,0 +1,18 @@
;================================================================================
; RAM Labels & Assertions
;--------------------------------------------------------------------------------
; Labels for values in WRAM and assertions that ensure they're correct and
; at the expected addresses. All values larger than one byte are little endian.
;--------------------------------------------------------------------------------
; Placeholder and for compass item max count allocations, still WIP
;--------------------------------------------------------------------------------
CompassTotalsWRAM = $7F5410
;================================================================================
; RAM Assertions
;--------------------------------------------------------------------------------
macro assertRAM(label, address)
assert <label> = <address>, "<label> labeled at incorrect address."
endmacro
%assertRAM(CompassTotalsWRAM, $7F5410)

View File

@@ -1,48 +1,46 @@
!INFINITE_BOMBS = "$7F50C9"
IsItemAvailable: IsItemAvailable:
LDA !INFINITE_BOMBS : BEQ .finite LDA InfiniteBombsModifier : BEQ .finite
.infinite .infinite
CPX.b #$04 : BNE .finite CPX.b #$04 : BNE .finite
LDA.b #$01 : RTL LDA.b #$01 : RTL
.finite .finite
LDA $7EF33F, X LDA EquipmentWRAM-1, X
RTL RTL
LoadBombCount: LoadBombCount:
LDA !INFINITE_BOMBS : BNE .infinite LDA InfiniteBombsModifier : BNE .infinite
.finite .finite
LDA $7EF343 LDA BombsEquipment
.infinite .infinite
RTL RTL
LoadBombCount16: LoadBombCount16:
LDA !INFINITE_BOMBS : AND.w #$00FF : BNE .infinite LDA InfiniteBombsModifier : AND.w #$00FF : BNE .infinite
.finite .finite
LDA $7EF343 LDA BombsEquipment
.infinite .infinite
RTL RTL
StoreBombCount: StoreBombCount:
JSL IncrementBombsPlacedCounter JSL IncrementBombsPlacedCounter
PHA : LDA !INFINITE_BOMBS : BEQ .finite PHA : LDA InfiniteBombsModifier : BEQ .finite
.infinite .infinite
PLA : LDA.b #$01 : RTL PLA : LDA.b #$01 : RTL
.finite .finite
PLA : STA $7EF343 PLA : STA BombsEquipment
RTL RTL
SearchForEquippedItem: SearchForEquippedItem:
LDA !INFINITE_BOMBS : BEQ + LDA InfiniteBombsModifier : BEQ +
LDA.b #$01 : LDX.b #$00 : RTL LDA.b #$01 : LDX.b #$00 : RTL
+ +
LDA $7EF340 ; thing we wrote over LDA BowEquipment ; thing we wrote over
RTL RTL
!INFINITE_ARROWS = "$7F50C8"
DecrementArrows: DecrementArrows:
LDA !INFINITE_ARROWS : BNE .infinite LDA InfiniteArrowsModifier : BNE .infinite
LDA.l ArrowMode : BNE .rupees : BRA .normal LDA.l ArrowMode : BNE .rupees : BRA .normal
.infinite .infinite
LDA.b #$01 : RTL LDA.b #$01 : RTL
.normal .normal
LDA $7EF377 : BEQ .done LDA CurrentArrows : BEQ .done
DEC : STA $7EF377 : INC DEC : STA CurrentArrows : INC
BRA .done BRA .done
.rupees .rupees
REP #$20 REP #$20
@@ -52,17 +50,17 @@ DecrementArrows:
LDA.b #$00 : BRA .done LDA.b #$00 : BRA .done
.not_archery_game .not_archery_game
LDA.l $7EF377 : BNE .shoot_arrow ; check if we have arrows LDA.l CurrentArrows : BNE .shoot_arrow ; check if we have arrows
BRA .done BRA .done
.shoot_arrow .shoot_arrow
PHX PHX
REP #$20 REP #$20
LDA $7EF360 : BEQ + LDA CurrentRupees : BEQ +
PHA : LDA $7EF340 : DEC : AND #$0002 : TAX : PLA PHA : LDA BowEquipment : DEC : AND #$0002 : TAX : PLA
!SUB.l ArrowModeWoodArrowCost, X ; CMP.w #$0000 !SUB.l ArrowModeWoodArrowCost, X ; CMP.w #$0000
BMI .not_enough_money BMI .not_enough_money
STA $7EF360 : LDA.w #$0001 : BRA + STA CurrentRupees : LDA.w #$0001 : BRA +
.not_enough_money .not_enough_money
LDA.w #$0000 LDA.w #$0000
+ +
@@ -77,13 +75,13 @@ ArrowGame:
DEC $0B99 ; reduce minigame arrow count DEC $0B99 ; reduce minigame arrow count
LDA.l ArrowMode : BNE .rupees LDA.l ArrowMode : BNE .rupees
.normal .normal
LDA $7EF377 : INC #2 : STA $7EF377 ; increment arrow count (by 2 for some reason) LDA CurrentArrows : INC #2 : STA CurrentArrows ; increment arrow count (by 2 for some reason)
RTL RTL
.rupees .rupees
PHX PHX
REP #$20 ; set 16-bit accumulator REP #$20 ; set 16-bit accumulator
LDA $7EF340 : DEC : AND #$0002 : TAX LDA BowEquipment : DEC : AND #$0002 : TAX
LDA $7EF360 : !ADD.l ArrowModeWoodArrowCost, X : STA $7EF360 LDA CurrentRupees : !ADD.l ArrowModeWoodArrowCost, X : STA CurrentRupees
SEP #$20 ; set 8-bit accumulator SEP #$20 ; set 8-bit accumulator
PLX PLX
+ +

View File

@@ -97,7 +97,7 @@ RNG_Ganon_Extra_Warp:
PLA PLA
RTL RTL
RNG_Enemy_Drops: RNG_Enemy_Drops:
LDA.l $7EF3C5 : CMP #$01 : BEQ + ; drops are static after uncle pickup & before rescuing zelda LDA.l ProgressIndicator : CMP #$01 : BEQ + ; drops are static after uncle pickup & before rescuing zelda
JML GetRandomInt JML GetRandomInt
+ +
LDA.b #$0F LDA.b #$0F

View File

@@ -84,7 +84,7 @@ IcePalaceBombosNE:
RTL RTL
CastleEastEntrance: CastleEastEntrance:
LDA $7EF3C5 : CMP.b #$02 : !BLT + : RTL : + ; only apply in rain states (0 or 1) LDA 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
@@ -115,7 +115,7 @@ CastleEastEntrance:
RTL RTL
CastleWestEntrance: CastleWestEntrance:
LDA $7EF3C5 : CMP.b #$02 : !BLT + : RTL : + ; only apply in rain states (0 or 1) LDA 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

@@ -5,13 +5,11 @@ Draw4DigitRupees:
LDA $1B : AND.w #$00FF : BEQ .outdoors ; skip if outdoors LDA $1B : AND.w #$00FF : BEQ .outdoors ; skip if outdoors
.indoors .indoors
LDA $A0 : BNE .normal ; skip except for ganon's room LDA $A0 : BNE .normal ; skip except for ganon's room
;LDA #$246E : STA $7EC712 LDA TotalItemCounter
;LDA #$246F : STA $7EC714
LDA $7EF423 : AND #$00FF
BRA .print BRA .print
.outdoors .outdoors
.normal .normal
LDA $7EF362 LDA DisplayRupees
.print .print
JSL.l HexToDec JSL.l HexToDec
LDA $7F5004 : AND.w #$00FF : ORA.w #$2400 : STA $7EC750 LDA $7F5004 : AND.w #$00FF : ORA.w #$2400 : STA $7EC750
@@ -19,4 +17,4 @@ Draw4DigitRupees:
LDA $7F5006 : AND.w #$00FF : ORA.w #$2400 : STA $7EC754 LDA $7F5006 : AND.w #$00FF : ORA.w #$2400 : STA $7EC754
LDA $7F5007 : AND.w #$00FF : ORA.w #$2400 : STA $7EC756 LDA $7F5007 : AND.w #$00FF : ORA.w #$2400 : STA $7EC756
RTL RTL
;================================================================================ ;================================================================================

View File

@@ -27,6 +27,11 @@ RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
ClearExtendedWRAMSaveFile: ClearExtendedWRAMSaveFile:
STA $7EF400, X ; what we wrote over STA $7EF400, X ; what we wrote over
STA $7F6000, X
STA $7F6100, X
STA $7F6200, X
STA $7F6300, X
STA $7F6400, X
STA $7F6500, X STA $7F6500, X
STA $7F6600, X STA $7F6600, X
STA $7F6700, X STA $7F6700, X
@@ -55,16 +60,16 @@ CopyExtendedSaveFileToWRAM:
LDA #$80 : STA $4301 ; set bus B source to WRAM register LDA #$80 : STA $4301 ; set bus B source to WRAM register
LDA #$00 : STA $2181 ; set WRAM register source address LDA #$00 : STA $2181 ; set WRAM register source address
LDA #$65 : STA $2182 LDA #$60 : STA $2182
LDA #$7F : STA $2183 LDA #$7F : STA $2183
STZ $4302 ; set bus A destination address to SRAM STZ $4302 ; set bus A destination address to SRAM
LDA #$05 : STA $4303 LDA #$05 : STA $4303
LDA #$70 : STA $4304 LDA #$70 : STA $4304
LDA #$00 : STA $4305 ; set transfer size to 0xB00 LDA #$00 : STA $4305 ; set transfer size to 0x1000
LDA #$0B : STA $4306 ; STZ $4307 LDA #$10 : STA $4306 ; STZ $4307
LDA #$01 : STA $420B ; begin DMA transfer LDA #$01 : STA $420B ; begin DMA transfer
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
@@ -97,15 +102,15 @@ CopyExtendedWRAMSaveFileToSRAM:
STA $4301 ; set bus B source to WRAM register STA $4301 ; set bus B source to WRAM register
LDA #$00 : STA $2181 ; set WRAM register source address LDA #$00 : STA $2181 ; set WRAM register source address
LDA #$65 : STA $2182 LDA #$60 : STA $2182
LDA #$7F : STA $2183 LDA #$7F : STA $2183
STZ $4302 ; set bus A destination address to SRAM STZ $4302 ; set bus A destination address to SRAM
LDA #$05 : STA $4303 LDA #$05 : STA $4303
LDA #$70 : STA $4304 LDA #$70 : STA $4304
LDA #$00 : STA $4305 ; set transfer size to 0xB00 LDA #$10 : STA $4305 ; set transfer size to 0xB00
LDA #$0B : STA $4306 ; STZ $4307 LDA #$0B : STA $4306 ; STZ $4307
LDA #$01 : STA $420B ; begin DMA transfer LDA #$01 : STA $420B ; begin DMA transfer

View File

@@ -46,10 +46,10 @@
; ;-------------------------------------------------------------------------------- ; ;--------------------------------------------------------------------------------
!RX_BUFFER = "$7F5300" !RX_BUFFER = "$7F5300"
!RX_STATUS = "$7F537F" !RX_STATUS = "$7F537F"
!RX_SEQUENCE = "$7EF4A0" ;ServiceSequenceRx = $7EF4A0
!TX_BUFFER = "$7F5380" !TX_BUFFER = "$7F5380"
!TX_STATUS = "$7F53FF" !TX_STATUS = "$7F53FF"
!TX_SEQUENCE = "$7EF4A0" ;ServiceSequenceTx = $7EF4A0
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
macro ServiceRequestVersion() macro ServiceRequestVersion()
LDA !TX_STATUS : BEQ + : CLC : RTL : + ; return fail if we don't have the lock LDA !TX_STATUS : BEQ + : CLC : RTL : + ; return fail if we don't have the lock
@@ -153,4 +153,4 @@ ItemGetServiceRequest_F1:
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
ItemGetServiceRequest_F2: ItemGetServiceRequest_F2:
%ServiceRequest(!SCM_GET, #$F2) %ServiceRequest(!SCM_GET, #$F2)
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------

View File

@@ -168,7 +168,7 @@ SpritePrep_ShopKeeper:
PHY PHY
PHX PHX
LDA.b #$00 : XBA : TYA : LSR #2 : !ADD !SHOP_SRAM_INDEX : TAX LDA.b #$00 : XBA : TYA : LSR #2 : !ADD !SHOP_SRAM_INDEX : TAX
LDA !SHOP_PURCHASE_COUNTS, X : TYX : STA.l !SHOP_INVENTORY+3, X : TAY LDA PurchaseCounts, X : TYX : STA.l !SHOP_INVENTORY+3, X : TAY
PLX PLX
LDA.l ShopContentsTable+4, X : BEQ ++ LDA.l ShopContentsTable+4, X : BEQ ++
@@ -214,7 +214,7 @@ SpritePrep_ShopKeeper:
.takeAll .takeAll
LDA.b #$00 : XBA : LDA !SHOP_SRAM_INDEX : TAX LDA.b #$00 : XBA : LDA !SHOP_SRAM_INDEX : TAX
LDA.l !SHOP_PURCHASE_COUNTS, X LDA.l PurchaseCounts, X
BRA ++ BRA ++
.notTakeAll .notTakeAll
LDA.b #$00 LDA.b #$00
@@ -266,8 +266,6 @@ RTS
;!SHOP_INVENTORY, X ;!SHOP_INVENTORY, X
;[id][$lo][$hi][purchase_counter] ;[id][$lo][$hi][purchase_counter]
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
;!SHOP_PURCHASE_COUNTS = "$7EF302"
;--------------------------------------------------------------------------------
Shopkeeper_UploadVRAMTilesLong: Shopkeeper_UploadVRAMTilesLong:
JSR.w Shopkeeper_UploadVRAMTiles JSR.w Shopkeeper_UploadVRAMTiles
RTL RTL
@@ -390,13 +388,13 @@ Sprite_ShopKeeper:
BIT.b #$20 : BNE + ; Not A Take-All BIT.b #$20 : BNE + ; Not A Take-All
PHX PHX
LDA !SHOP_SRAM_INDEX : TAX LDA !SHOP_SRAM_INDEX : TAX
LDA !SHOP_PURCHASE_COUNTS, X : BEQ ++ : PLX : BRA .done : ++ LDA PurchaseCounts, X : BEQ ++ : PLX : BRA .done : ++
PLX PLX
BRA .normal BRA .normal
+ ; Take-All + ; Take-All
;PHX ;PHX
; LDA !SHOP_SRAM_INDEX : TAX ; LDA !SHOP_SRAM_INDEX : TAX
; LDA.w !SHOP_PURCHASE_COUNTS, X : STA.l !SHOP_STATE ; LDA.w PurchaseCounts, X : STA.l !SHOP_STATE
;PLX ;PLX
.normal .normal
@@ -539,7 +537,7 @@ Shopkeeper_BuyItem:
+ +
LDA !SHOP_TYPE : AND.b #$80 : BNE .buy ; don't charge if this is a take-any LDA !SHOP_TYPE : AND.b #$80 : BNE .buy ; don't charge if this is a take-any
REP #$20 : LDA $7EF360 : CMP.l !SHOP_INVENTORY+1, X : SEP #$20 : !BGE .buy REP #$20 : LDA CurrentRupees : CMP.l !SHOP_INVENTORY+1, X : SEP #$20 : !BGE .buy
.cant_afford .cant_afford
LDA.b #$7A LDA.b #$7A
@@ -555,7 +553,7 @@ Shopkeeper_BuyItem:
JMP .done JMP .done
.buy .buy
LDA !SHOP_TYPE : AND.b #$80 : BNE ++ ; don't charge if this is a take-any LDA !SHOP_TYPE : AND.b #$80 : BNE ++ ; don't charge if this is a take-any
REP #$20 : LDA $7EF360 : !SUB !SHOP_INVENTORY+1, X : STA $7EF360 : SEP #$20 ; Take price away REP #$20 : LDA CurrentRupees : !SUB !SHOP_INVENTORY+1, X : STA CurrentRupees : SEP #$20 ; Take price away
++ ++
LDA.l !SHOP_INVENTORY, X : TAY : JSL.l Link_ReceiveItem LDA.l !SHOP_INVENTORY, X : TAY : JSL.l Link_ReceiveItem
LDA.l !SHOP_INVENTORY+3, X : INC : STA.l !SHOP_INVENTORY+3, X LDA.l !SHOP_INVENTORY+3, X : INC : STA.l !SHOP_INVENTORY+3, X
@@ -565,7 +563,7 @@ Shopkeeper_BuyItem:
LDA.l !SHOP_STATE : ORA.w Shopkeeper_ItemMasks, X : STA.l !SHOP_STATE LDA.l !SHOP_STATE : ORA.w Shopkeeper_ItemMasks, X : STA.l !SHOP_STATE
PHX PHX
TXA : !ADD !SHOP_SRAM_INDEX : TAX TXA : !ADD !SHOP_SRAM_INDEX : TAX
LDA !SHOP_PURCHASE_COUNTS, X : INC : BEQ +++ : STA !SHOP_PURCHASE_COUNTS, X : +++ LDA PurchaseCounts, X : INC : BEQ +++ : STA PurchaseCounts, X : +++
PLX PLX
BRA ++ BRA ++
+ ; Take-any + ; Take-any
@@ -573,11 +571,11 @@ Shopkeeper_BuyItem:
BIT.b #$20 : BNE .takeAll BIT.b #$20 : BNE .takeAll
.takeAny .takeAny
LDA.l !SHOP_STATE : ORA.b #$07 : STA.l !SHOP_STATE LDA.l !SHOP_STATE : ORA.b #$07 : STA.l !SHOP_STATE
PHX : LDA.l !SHOP_SRAM_INDEX : TAX : LDA.b #$01 : STA.l !SHOP_PURCHASE_COUNTS, X : PLX PHX : LDA.l !SHOP_SRAM_INDEX : TAX : LDA.b #$01 : STA.l PurchaseCounts, X : PLX
BRA ++ BRA ++
.takeAll .takeAll
LDA.l !SHOP_STATE : ORA.w Shopkeeper_ItemMasks, X : STA.l !SHOP_STATE LDA.l !SHOP_STATE : ORA.w Shopkeeper_ItemMasks, X : STA.l !SHOP_STATE
PHX : LDA.l !SHOP_SRAM_INDEX : TAX : LDA.l !SHOP_STATE : STA.l !SHOP_PURCHASE_COUNTS, X : PLX PHX : LDA.l !SHOP_SRAM_INDEX : TAX : LDA.l !SHOP_STATE : STA.l PurchaseCounts, X : PLX
++ ++
.done .done
PLY : PLX PLY : PLX
@@ -587,7 +585,6 @@ db #$01, #$02, #$04
;-------------------- ;--------------------
;!SHOP_ID = "$7F5050" ;!SHOP_ID = "$7F5050"
;!SHOP_SRAM_INDEX = "$7F5062" ;!SHOP_SRAM_INDEX = "$7F5062"
;!SHOP_PURCHASE_COUNTS = "$7EF302"
;-------------------- ;--------------------
Setup_ShopItemCollisionHitbox: Setup_ShopItemCollisionHitbox:
;The complications with XBA are to handle the fact that nintendo likes to store ;The complications with XBA are to handle the fact that nintendo likes to store

View File

@@ -54,17 +54,17 @@ DamageClassCalc:
.not_cane_or_beam .not_cane_or_beam
CMP #$07 : BNE .no_change CMP #$07 : BNE .no_change
LDA SpecialWeapons : CMP #$01 : BNE .normal_bombs LDA SpecialWeapons : CMP #$01 : BNE .normal_bombs
LDA !WEAPON_LEVEL : BEQ .normal_bombs LDA SpecialWeaponLevel : BEQ .normal_bombs
LDA $0E20, X : CMP.b #$D6 : BEQ .unstunned_ganon LDA $0E20, X : CMP.b #$D6 : BEQ .unstunned_ganon
CMP.b #$D7 : BEQ .stunned_ganon CMP.b #$D7 : BEQ .stunned_ganon
CMP.b #$88 : BEQ .mothula CMP.b #$88 : BEQ .mothula
CMP.b #$91 : BEQ .stalfos_knight CMP.b #$91 : BEQ .stalfos_knight
CMP.b #$92 : BEQ .helmasaur_king CMP.b #$92 : BEQ .helmasaur_king
.special_level .special_level
LDA !WEAPON_LEVEL LDA SpecialWeaponLevel
BRA .done BRA .done
.mothula .mothula
LDA !WEAPON_LEVEL LDA SpecialWeaponLevel
CMP #$04 : !BGE .fix_mothula CMP #$04 : !BGE .fix_mothula
BRA .done BRA .done
.fix_mothula .fix_mothula
@@ -96,7 +96,7 @@ DamageClassCalc:
LDA.l !ANCILLA_DAMAGE, X LDA.l !ANCILLA_DAMAGE, X
PLX PLX
CMP.b #$06 : BNE .done ; not arrows CMP.b #$06 : BNE .done ; not arrows
LDA $7EF340 : CMP.b #$03 : !BGE .actual_silver_arrows LDA BowEquipment : CMP.b #$03 : !BGE .actual_silver_arrows
.normal_arrows .normal_arrows
LDA #$06 LDA #$06
.done .done
@@ -359,7 +359,7 @@ AllowBombingBarrier:
DrawBombInMenu: DrawBombInMenu:
JSL LoadBombCount16 : AND.w #$00FF : BEQ .noBombs JSL LoadBombCount16 : AND.w #$00FF : BEQ .noBombs
LDA SpecialWeapons : AND.w #$00FF : CMP.w #$0001 : BNE .vanillaBombs LDA SpecialWeapons : AND.w #$00FF : CMP.w #$0001 : BNE .vanillaBombs
LDA.l !WEAPON_LEVEL : AND.w #$00FF : BEQ .noBombs : STA $02 LDA.l SpecialWeaponLevel : AND.w #$00FF : BEQ .noBombs : STA $02
LDA.w #$FC81 : STA $04 LDA.w #$FC81 : STA $04
BRA .done BRA .done
.vanillaBombs .vanillaBombs
@@ -377,7 +377,7 @@ DrawSwordInMenu:
CMP.w #$0003 : BEQ .specialSword CMP.w #$0003 : BEQ .specialSword
CMP.w #$0004 : BEQ .specialSword CMP.w #$0004 : BEQ .specialSword
CMP.w #$0005 : BEQ .specialSword CMP.w #$0005 : BEQ .specialSword
LDA $7EF359 : AND.w #$00FF : CMP.w #$00FF : BEQ .noSword LDA SwordEquipment : AND.w #$00FF : CMP.w #$00FF : BEQ .noSword
.hasSword .hasSword
STA $02 STA $02
LDA.w #$F859 : STA $04 LDA.w #$F859 : STA $04
@@ -387,14 +387,14 @@ DrawSwordInMenu:
LDA.w #$F859 : STA $04 LDA.w #$F859 : STA $04
RTL RTL
.specialSword .specialSword
LDA !WEAPON_LEVEL : AND.w #$00FF : STA $02 LDA SpecialWeaponLevel : AND.w #$00FF : STA $02
LDA.w #$FC51 : STA $04 LDA.w #$FC51 : STA $04
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
DrawBombInYBox: DrawBombInYBox:
CPX.w #$0004 : BNE .done CPX.w #$0004 : BNE .done
LDA SpecialWeapons : AND.w #$00FF : CMP.w #$0001 : BNE .vanilla LDA SpecialWeapons : AND.w #$00FF : CMP.w #$0001 : BNE .vanilla
LDA !WEAPON_LEVEL : AND.w #$00FF : CLC : ADC.w #$00BD : BRA .done LDA SpecialWeaponLevel : AND.w #$00FF : CLC : ADC.w #$00BD : BRA .done
.vanilla .vanilla
LDA.w #$0001 LDA.w #$0001
.done .done
@@ -411,7 +411,7 @@ DrawBombOnHud:
PLB PLB
LDA.l SpecialWeapons : AND.w #$00FF : CMP.w #$0001 : BNE .regularBombs LDA.l SpecialWeapons : AND.w #$00FF : CMP.w #$0001 : BNE .regularBombs
LDA.l !WEAPON_LEVEL : AND.w #$00FF : ASL #2 : TAX LDA.l SpecialWeaponLevel : AND.w #$00FF : ASL #2 : TAX
LDA.l BombIcon, X : STA.l $7EC71A LDA.l BombIcon, X : STA.l $7EC71A
LDA.l BombIcon+2, X : STA.l $7EC71C LDA.l BombIcon+2, X : STA.l $7EC71C
.regularBombs .regularBombs
@@ -422,7 +422,7 @@ BombSpriteColor:
SetBombSpriteColor: SetBombSpriteColor:
LDA.l SpecialWeapons : CMP.b #$01 : BNE .normal LDA.l SpecialWeapons : CMP.b #$01 : BNE .normal
PHX PHX
LDA.l !WEAPON_LEVEL LDA.l SpecialWeaponLevel
TAX TAX
LDA.l BombSpriteColor, X LDA.l BombSpriteColor, X
STA $0B STA $0B
@@ -468,7 +468,7 @@ CheckDetonateBomb:
LDX.w $0202 LDX.w $0202
LDA.l BeeDamageClass, X LDA.l BeeDamageClass, X
CMP.b #$06 : BNE .set_bee_class CMP.b #$06 : BNE .set_bee_class
LDA.l $7EF340 : CMP.b #$03 : !BGE .silver_arrows LDA.l BowEquipment : CMP.b #$03 : !BGE .silver_arrows
LDA.b #$06 LDA.b #$06
BRA .set_bee_class BRA .set_bee_class
.silver_arrows .silver_arrows
@@ -492,9 +492,9 @@ SetBeeType:
LDA.l SpecialWeapons : CMP.b #$06 : BEQ .bee_mode LDA.l SpecialWeapons : CMP.b #$06 : BEQ .bee_mode
LDX.w $0202 LDX.w $0202
.check_bee_type .check_bee_type
LDA.l $7EF33F, X LDA.l EquipmentWRAM-1, X
TAX TAX
LDA.l $7EF35B, X LDA.l BottleContents-1, X
CMP.b #$08 CMP.b #$08
BNE .regular_bee BNE .regular_bee
LDA.b #$01 LDA.b #$01

View File

@@ -10,7 +10,6 @@ org $1BEE1B
JSL SpriteSwap_Palette_ArmorAndGloves_part_two JSL SpriteSwap_Palette_ArmorAndGloves_part_two
RTL RTL
!SPRITE_SWAP = "$7F50CD"
;!STABLE_SCRATCH = "$7EC178" ;!STABLE_SCRATCH = "$7EC178"
!BANK_BASE = "#$29" !BANK_BASE = "#$29"
@@ -18,7 +17,7 @@ org $BF8000
SwapSpriteIfNecessary: SwapSpriteIfNecessary:
PHP PHP
SEP #$20 ; set 8-bit accumulator SEP #$20 ; set 8-bit accumulator
LDA !SPRITE_SWAP : BEQ + : !ADD !BANK_BASE : CMP $BC : BEQ + LDA SpriteSwapper : BEQ + : !ADD !BANK_BASE : CMP $BC : BEQ +
STA $BC STA $BC
STZ $0710 ; Set Normal Sprite NMI STZ $0710 ; Set Normal Sprite NMI
JSL.l SpriteSwap_Palette_ArmorAndGloves_part_two JSL.l SpriteSwap_Palette_ArmorAndGloves_part_two
@@ -29,17 +28,17 @@ RTL
SpriteSwap_Palette_ArmorAndGloves: SpriteSwap_Palette_ArmorAndGloves:
{ {
;DEDF9 ;DEDF9
LDA !SPRITE_SWAP : BNE .continue LDA SpriteSwapper : BNE .continue
LDA.b #$10 : STA $BC ; Load Original Sprite Location LDA.b #$10 : STA $BC ; Load Original Sprite Location
REP #$21 REP #$21
LDA $7EF35B LDA ArmorEquipment
JSL $1BEDFF ; Read Original Palette Code JSL $1BEDFF ; Read Original Palette Code
RTL RTL
.part_two .part_two
SEP #$30 SEP #$30
LDA !SPRITE_SWAP : BNE .continue LDA SpriteSwapper : BNE .continue
REP #$30 REP #$30
LDA $7EF354 LDA GloveEquipment
JSL $1BEE21 ; Read Original Palette Code JSL $1BEE21 ; Read Original Palette Code
RTL RTL
@@ -51,7 +50,7 @@ SpriteSwap_Palette_ArmorAndGloves:
REP #$20 ; set 16-bit accumulator REP #$20 ; set 16-bit accumulator
; Check what Link's armor value is. ; Check what Link's armor value is.
LDA $7EF35B : AND.w #$00FF : TAX LDA ArmorEquipment : AND.w #$00FF : TAX
; (DEC06, X) ; (DEC06, X)

701
sram.asm Normal file
View File

@@ -0,0 +1,701 @@
;================================================================================
; SRAM Labels & Assertions
;--------------------------------------------------------------------------------
; Labels for values in SRAM and assertions that ensure they're correct and
; at the expected addresses. All values larger than one byte are little endian.
;--------------------------------------------------------------------------------
; $7EF000 - $7EF4FF in WRAM maps to the first $4FF bytes in SRAM (Bank $70)
; $7F6000 - $7F6FFF in WRAM maps to the next 4k bytes, occupying the 2nd and 3rd vanilla
; save file locations. ($700500 - $701500)
;--------------------------------------------------------------------------------
pushpc
org 0 ; This module writes no bytes. Asar gives bank cross errors without this.
;================================================================================
; Room Data ($7EF000 - $7EF27F
;--------------------------------------------------------------------------------
; Each room has two bytes. There are 296 ($128) rooms in the ROM. The data beyond
; $7EF24F is unused. The current room index is located at $A0 in WRAM (16-bits.)
;
; The quadrant bits from left to right correspond to quadrants 4 (northwest), 3 (northeast),
; 2 (southwest), and 1 (southeast), which is the same as they are laid out on the screen from
; left to right, top to bottom.
;
; Example: We can use RoomDataWRAM[$37].high to read or write the pot key in the first
; floodable room in Swamp Palace ($04)
;--------------------------------------------------------------------------------
; .high Byte: d d d d b k u r
; .low Byte: c c c c q q q q
;
; d = Door opened (key, bomb wall, etc)
; b = Boss kill / Heart Container
; k = Key / Heart Piece
; u = Second key
; t = Chest 4 / Rupee floor / Swamp drains / Bombable floor / Mire wall
; s = Chest 3 / Bomable floor / PoD or Desert wall
; e = Chest 2
; h = Chest 1
; c = Chest 0
; q = Quadrant visits
;--------------------------------------------------------------------------------
struct RoomDataWRAM $7EF000
.l
.low: skip 1
.high: skip 1
endstruct align 2
;================================================================================
; Overworld Event Data ($7EF280 - $7EF33F)
;--------------------------------------------------------------------------------
; Each overworld area has one byte. The overworld screen index is located at $8A
; in WRAM (16-bits.)
;
; This label can be indexed with a plus symbol (e.g. The Hyrule Castle screen would
; be OverworldEventDataWRAM+$1B or OverworldEventDataWRAM+27)
;--------------------------------------------------------------------------------
; - i o - - - b -
;
; i = Free-standing item collected. Also used for sprites like the castle tower barrier
; o = Overlay active
; b = Bomb wall opened
;--------------------------------------------------------------------------------
OverworldEventDataWRAM = $7EF280
;================================================================================
; Items & Equipment ($7EF340 - $7EF38B)
;--------------------------------------------------------------------------------
; Current equipment labels & values
; Values will represent current menu selection in cases where player can switch
; items (e.g. holding powder and mushroom at the same time.)
;
; $00 = None
;--------------------------------------------------------------------------------
base $7EF340
EquipmentWRAM: ;
BowEquipment: skip 1 ; $01 = Bow | $02 = Bow & Arrows
; $03 = Silver Arrow Bow | $04 = Bow & Silver Arrows
BoomerangEquipment: skip 1 ; $01 = Blue | $02 = Red
HookshotEquipment: skip 1 ; $01 = Hookshot
BombsEquipment: skip 1 ; Number of bombs currently held (8-bit integer)
PowderEquipment: skip 1 ; $01 = Mushroom | $02 = Powder
FireRodEquipment: skip 1 ; $01 = Fire Rod
IceRodEquipment: skip 1 ; $01 = Ice Rod
BombosEquipment: skip 1 ; $01 = Bombos Medallion
EtherEquipment: skip 1 ; $01 = Ether Medallion
QuakeEquipment: skip 1 ; $01 = Quake Medallion
LampEquipment: skip 1 ; $01 = Lamp
HammerEquipment: skip 1 ; $01 = Hammer
FluteEquipment: skip 1 ; $01 = Shovel | $02 = Inactive Flute | $03 = Active Flute
BugNetEquipment: skip 1 ; $01 = Bug Net
BookOfMudoraEquipment: skip 1 ; $01 = Book of Mudora
BottleIndex: skip 1 ; Current bottle in menu. 1-based index into BottleContents below
SomariaEquipment: skip 1 ; $01 = Cane of Somaria
ByrnaEquipment: skip 1 ; $01 = Cane of Byrna
CapeEquipment: skip 1 ; $01 = Magic Cape
MirrorEquipment: skip 1 ; $01 = Scroll (graphic only) | $02 = Mirror
GloveEquipment: skip 1 ; $01 = Power Gloves | $02 = Titan's Mitts
BootsEquipment: skip 1 ; $01 = Boots | This only shows menu item, see: AbilityFlags
FlippersEquipment: skip 1 ; $01 = Flippers
MoonPearlEquipment: skip 1 ; $01 = Moon Pearl
skip 1 ; Not used
SwordEquipment: skip 1 ; $01 = Fighter | $02 = Master | $03 = Tempered | $04 = Gold
ShieldEquipment: skip 1 ; $01 = Fighter | $02 = Red | $03 = Mirror
ArmorEquipment: skip 1 ; $00 = Green | $01 = Blue | $02 = Red
BottleContents: ; \ Bottle Contents
BottleContentsOne: skip 1 ; |
BottleContentsTwo: skip 1 ; | $00 = No Bottle | $01 = Mushroom | $02 = Empty Bottle
BottleContentsThree: skip 1 ; | $03 = Red Potion | $04 = Green Potion | $05 = Blue Potion
BottleContentsFour: skip 1 ; / $06 = Fairy | $07 = Bee | $08 = Good Bee
CurrentRupees: skip 2 ; \ DisplayRupees holds the number on the HUD. It will always
DisplayRupees: skip 2 ; / increment/decrement to match CurrentRupees if not equal (16-bit integers)
;--------------------------------------------------------------------------------
CompassField: skip 2 ; Dungeon item bitfields
BigKeyField: skip 2 ; Low byte: w i h b t g - -
MapField: skip 2 ; w = Skull Woods | i = Ice Palace | h = Hera | b = Thieves' Town
; t = Turtle Rock | g = Ganon's Tower
;------------------------------------------------
; High Byte: x c e d a s p m
; x = Sewers | c = Hyrule Castle | e = Eastern Palace | d = Desert Palace
; a = Castle Tower | s = Swamp Palace | p = PoD | m = Mire
;--------------------------------------------------------------------------------
; HUD & other equipment
skip 1 ; Wishing Pond Rupee (Unused)
HeartPieceQuarter: skip 1 ; Heart pieces of four for health upgrade. Wraps around to $00 after $03.
MaximumHealth: skip 1 ; \ Max Health & Current Health
CurrentHealth: skip 1 ; / Max value for both is $A0 | $04 = half heart | $08 = heart
CurrentMagic: skip 1 ; Current magic | Max value is $80
CurrentSmallKeys: skip 1 ; Number of small keys held for current dungeon (integer)
BombCapacityUpgrades: skip 1 ; \ Bomb & Arrow Capacity Upgrades
ArrowCapacityUpgrades: skip 1 ; / Indicates flatly how many can be held above vanilla max (integers)
HeartsFiller: skip 1 ; Hearts collected yet to be filled. Write in multiples of $08
MagicFiller: skip 1 ; Magic collected yet to be filled
PendantsField: skip 1 ; - - - - - g b r (bitfield)
; g = Green (Courage) | b = Blue (Power) | r = Red (Wisdom)
BombsFiller: skip 1 ; Bombs collected yet to be filled (integer)
ArrowsFiller: skip 1 ; Arrows collected yet to be filled (integer)
CurrentArrows: skip 1 ; Current arrows (integer)
skip 1 ; Unknown
AbilityFlags: skip 1 ; l r t u p b s h (bitfield)
; l = Lift | r = Read | t = Talk | u = Unused but set by default
; p = Pull | b = Dash | s = Swim | h = Pray (unused)
CrystalsField: skip 1 ; - w b s t i p m (bitfield)
; w = Skull Woods | b = Thieves' Town | s = Swamp Palace | t = Turtle Rock
; i = Ice Palace | p = Palace of Darkness | m = Misery Mire
MagicConsumption: skip 1 ; $00 = Normal | $01 = Half Magic | $02 = Quarter Magic
;--------------------------------------------------------------------------------
; Small keys earned per dungeon (integers)
DungeonKeys: ;
SewerKeys: skip 1 ; \ HC and Sewers small keys increment together
HyruleCastleKeys: skip 1 ; /
EasternKeys: skip 1 ; Eastern Palace small keys
DesertKeys: skip 1 ; Desert Palace small keys
CastleTowerKeys: skip 1 ; Agahnim's Tower small keys
SwampKeys: skip 1 ; Swamp Palace small keys
PalaceOfDarknessKeys: skip 1 ; Palace of Darkness small keys
MireKeys: skip 1 ; Misery Mire small keys
SkullWoodsKeys: skip 1 ; Skull Woods small keys
IcePalaceKeys: skip 1 ; Ice Palace small keys
HeraKeys: skip 1 ; Tower of Hera small keys
ThievesTownKeys: skip 1 ; Thieves' Town small keys
TurtleRockKeys: skip 1 ; Turtle Rock small keys
GanonsTowerKeys: skip 1 ; Ganon's Tower small keys
skip 1 ; Unused
CurrentGenericKeys: skip 1 ; Generic small keys
;================================================================================
; Tracking & Indicators ($7EF38C - $7EF3F0)
;--------------------------------------------------------------------------------
InventoryTracking: skip 2 ; b r m p n s k f - - - - - - o q (bitfield)
; b = Blue Boomerang | r = Red Boomerang | m = Mushroom Current
; p = Magic Powder | n = Mushroom Past | s = Shovel
; k = Inactive Flute | f = Active Flute | o = Any bomb acquired
; q = Quickswap locked
BowTracking: skip 1 ; b s p - - - - - (bitfield)
; b = Bow | s = Silver Arrows Upgrade | p = Second Progressive Bow
; The front end writes two distinct progressive bow items. p
; indicates whether the "second" has been found independent of
; the first
SpecialWeaponLevel: skip 1 ; Keeps track of level of weapon in bomb-only and cane-only modes
ItemLimitCounts: skip 16 ; Keeps track of limited non-progressive items such as lamp.
; See: ItemSubstitutionRules in tables.asm
; Right now this is only used for three items but extra space is
; reserved
skip 37 ; Unused
ProgressIndicator: skip 1 ; $00 = Pre-Uncle | $01 = Post-Uncle item | $02 = Zelda Rescued
; $03 = Agahnim 1 defeated
; $04 and above don't do anything. $00-$02 used in standard mode
ProgressFlags: skip 1 ; - - - h - z - u (bitfield)
; h = Uncle left house | z = Zelda rescued | u = Uncle item obtained
MapIcons: skip 1 ; Used for deciding which icons to display on OW map
; $03 = Pendants | $04 = Master Sword | $05 = Skull at Hyrule Castle
; $06 = Crystal 1 | $07 = All Crystals | $08 = Skull at Ganon's Tower
StartingEntrance: skip 1 ; Starting entrance to use
; $00 = Link's House | $01 = Menu or Pyramid w/ Aga dead & mirror
; $02 = Zelda's Cell | $03 = Secret Passage or HC if entered (escape)
; $04 = Throne Room (escape) | $05 = Old Man Cave w/ Old Man
NpcFlagsVanilla: skip 1 ; - - d p s - b h (bitfield)
; d = Frog rescued | p = Purple Chest | s = Tree Kid (unused)
; b = Bottle Merchant item | h = Hobo item
CurrentWorld: skip 1 ; $00 = Light World | $40 = Dark World
skip 1 ; Unused
FollowerIndicator: skip 1 ; $00 = No Follower | $01 = Zelda | $04 = Old Man
; $06 = Blind Maiden | $07 = Frog | $08 = Dwarf
; $09 = Locksmith | $0A = Kiki | $0C = Purple Chest
; $0D = Big Bomb
FollowerXCoord: skip 2 ; \ Cached X and Y overworld coordinates of dropped follower
FollowerYCoord: skip 2 ; / (16-bit integers)
DroppedFollowerIndoors: skip 1 ; $00 = Dropped follower outdoors | $01 = Dropped follower indoors
DroppedFollowerLayer: skip 1 ; $00 = Upper layer | $01 =.lower layer
FollowerDropped: skip 1 ; Set to $80 when a follower exists and has been dropped somewhere
; $00 otherwise
skip 5 ; Unused
FileNameVanillaWRAM: skip 8 ; First four characters of file name
FileValidity: skip 2 ; Always $55AA. Don't write.
;================================================================================
; Rando-Specific Assignments & Game Stats ($7EF3F1 - $7EF4FF)
;--------------------------------------------------------------------------------
skip 28 ; Unused
GameCounter: skip 2 ; Number of deaths and save + quits (16-bit integer)
PostGameCounter: skip 2 ; Initialized to $FFFF, replaced with GameCounter on goal completion
; Number is displayed on file select when not $FFFF. Max 999 (16-bit integer)
CompassCountDisplay: skip 2 ; Compass count display flags (bitfield)
; Sets a flag if the total item count has been displayed on HUD
; Low byte: w i h b t g - -
; w = Skull Woods | i = Ice Palace | h = Hera | b = Thieves' Town
; t = Turtle Rock | g = Ganon's Tower
; High Byte: x c e d a s p m
; x = Sewers | c = Hyrule Castle | e = Eastern Palace | d = Desert Palace
; a = Castle Tower | s = Swamp Palace | p = PoD | m = Mire
skip 10 ;
Aga2Duck: skip 1 ; Used in lieu of pyramid hole for checking if the duck should come
; 0 = Haven't called post-Aga 2 bird | 1 = Have called post-Aga 2 bird
NpcFlags: skip 2 ; l - c s t k z o (bitfield)
; l = Library | c = Catfish | s = Sahasrahla | t = Stumpy
; k = Sick Kid | z = King Zora | o = Old Man
;
; b - p m f s b e (bitfield)
; b = Magic Bat | p = Potion Shop (Powder) | m = Lost Woods (Mushroom)
; f = Fairy (unused) | s = Smith | b = Bombos Tablet
; e = Ether Tablet
skip 2 ; Unused
MapOverlay: skip 2 ; Used to reveal dungeon prizes on the map in modes where maps,
; Saha, and the bomb shop guy reveal dungeon prizes (bitfield)
; \ - - g r t h i s
; | g = Ganon's Tower | r = Turtle Rock | t = Thieves' Town
; / h = Tower of Hera | i = Ice Palace | s = Skull Woods
; \ m d s a t e h p
; | m = Misery Mire | d = Palace of Darkness | s = Swamp Palace
; | a = Aga Tower | t = Desert Palace | e = Eastern Palace
; / h = Hyrule Castle | s = Sewer Passage
HudFlag: ;
IgnoreFaeries: ;
HasGroveItem: ;
GeneralFlags: skip 1 ; - - h - - i - g (bitfield)
; h = HUD Flag | i = ignore faeries | g = has diggable grove item
HighestSword: skip 1 ; Highest sword level (integer)
GoalCounter: skip 2 ; Goal items collected (16-bit integer)
ProgrammableItemOne: skip 2 ; \ Reserved for programmable items
ProgrammableItemTwo: skip 2 ; |
ProgrammableItemThree: skip 2 ; /
BonkCounter: skip 1 ; Number of times the player has bonked (integer)
YAItemCounter: skip 1 ; y y y y y a a a (packed integers)
; Number of Y and A items collected represented as packed integers
HighestShield: skip 1 ; Highest Shield level
TotalItemCounter: skip 2 ; Total items collected (integer)
SwordBossKills: skip 2 ; t t t t g g g g f f f f m m m m (packed integers)
; t = Tempered Sword boss kills | g = Gold Sword boss kills
; f = Fighter Sword boss kills | m = Master Sword boss kills
BigKeysBigChests: skip 1 ; k k k k c c c c (packed integers)
; k = Big Keys collected | c = Big Chests opened
MapsCompasses: skip 1 ; m m m m c c c c (packed integers)
; m = Maps collected | c = Compasses collected
PendantCounter: skip 1 ; Number of pendants collected (integer)
PreGTBKLocations: skip 1 ; Locations checked in GT before finding the big key
; b = Big Bomb Acquired | s = Silver Arrows Acquired
; c = GT locations collected before big key
RupeesSpent: skip 2 ; Rupees spent (16-bit integer)
SaveQuitCounter: skip 1 ; Number of times player has saved and quit (integer)
LoopFrames: skip 4 ; Frame counter incremented during frame hook (32-bit integer)
PreBootsLocations: skip 2 ; Number of locations checked before getting boots (integer)
PreMirrorLocations: skip 2 ; Number of locations checked before getting mirror (integer)
PreFluteLocations: skip 2 ; Number of locations checked before getting flute (integer)
skip 2 ; Unused
OverworldMirrors: skip 1 ; Number of times mirror used on overworld (integer)
UnderworldMirrors: skip 1 ; Number of times mirror used in underworld (integer)
ScreenTransitions: skip 2 ; Number of screen transitions (16-bit integer)
NMIFrames: skip 4 ; Frame counter incremented during NMI hook (32-bit integer)
ChestsOpened: skip 1 ; Number of chests opened. Doesn't count NPC, free standing items etc (integer)
StatsLocked: skip 1 ; Set to $01 when goal is completed; game stops counting stats.
MenuFrames: skip 4 ; Total menu time in frames (32-bit integer)
HeartContainerCounter: skip 1 ; Total number of heart containers collected (integer)
DeathCounter: skip 1 ; Number of deaths (integer)
skip 1 ; Reserved
FluteCounter: skip 1 ; Number of times fluted (integer)
skip 4 ;
RNGItem: skip 2 ; RNG Item
SwordlessBossKills: skip 1 ; Number of bosses killed without a sword (integer)
FaerieRevivalCounter: skip 1 ; Number of faerie revivals (integer)
ChallengeTimer: skip 4 ; Timer used for OHKO etc
SwordTime: skip 4 ; Time first sword found in frames (32-bit integer)
BootsTime: skip 4 ; Time boots found in frames (32-bit integer)
FluteTime: skip 4 ; Time flute found in frames (32-bit integer)
MirrorTime: skip 4 ; Time mirror found in frames (32-bit integer)
ChestTurnCounter: skip 1 ; Number of chest turns (integer)
CapacityUpgrades: skip 1 ; Number of capacity upgrades collected (integer)
DamageCounter: skip 2 ; Damage taken by player (16-bit integer)
MagicCounter: skip 2 ; Magic used by player (16-bit integer)
HighestMail: skip 1 ; Highest mail level
SmallKeyCounter: skip 1 ; Total Number of small keys collected (integer)
HeartPieceCounter: skip 1 ; Total Number of heartpieces collected (integer)
CrystalCounter: skip 1 ; Total Number of crystals collected (integer)
DungeonsCompleted: skip 2 ; Bitfield indicating whether a dungeon's prize has been collected.
; This has the same shape as the dungeon item bitfields.
BombsPlaced: skip 2 ; Total Number of bombs placed (16-bit integer)
skip 42 ; Unused
ServiceSequenceRx: ; Service sequence receive
ServiceSequenceTx: ; Service sequence transmit
ServiceSequence: skip 8 ; Service request block. See servicerequest.asm
skip 8 ; Unused
DungeonAbsorbedKeys: ; \ Absorbed key counters (integers)
SewerAbsorbedKeys: skip 1 ; | Sewer Passage
HCAbsorbedKeys: skip 1 ; | Hyrule Castle
EPAbsorbedKeys: skip 1 ; | Eastern Palace
DPAbsorbedKeys: skip 1 ; | Desert Palace
CTAbsorbedKeys: skip 1 ; | Agahnim's Tower
SPAbsorbedKeys: skip 1 ; | Swamp Palace
PDAbsorbedKeys: skip 1 ; | Palace of Darkness
MMAbsorbedKeys: skip 1 ; | Misery Mire
SWAbsorbedKeys: skip 1 ; | Skull Woods
IPAbsorbedKeys: skip 1 ; | Ice Palace
THAbsorbedKeys: skip 1 ; | Tower of Hera
TTAbsorbedKeys: skip 1 ; | Thieves' Town
TRAbsorbedKeys: skip 1 ; | Turtle Rock
GTAbsorbedKeys: skip 1 ; / Ganon's Tower
skip 2 ; Reserved for previous table
DungeonLocationsChecked: ; \ Dungeon locations checked counters (integers)
SewersLocations: skip 1 ; | Sewer Passage
HCLocations: skip 1 ; | Hyrule Castle
EPLocations: skip 1 ; | Eastern Palace
DPLocations: skip 1 ; | Desert Palace
CTLocations: skip 1 ; | Agahnim's Tower
SPLocations: skip 1 ; | Swamp Palace
PDLocations: skip 1 ; | Palace of Darkness
MMLocations: skip 1 ; | Misery Mire
SWLocations: skip 1 ; | Skull Woods
IPLocations: skip 1 ; | Ice Palace
THLocations: skip 1 ; | Tower of Hera
TTLocations: skip 1 ; | Thieves' Town
TRLocations: skip 1 ; | Turtle Rock
GTLocations: skip 1 ; / Ganon's Tower:
skip 2 ; Reserved for previous table
skip 16 ; Currently occupied by multiworld stuff in DR, can be reclaimed
DungeonCollectedKeys: ; \ Chest Key Counters. Only counts keys placed in chests. (integers)
SewerCollectedKeys: skip 1 ; | Sewer Passage
HCCollectedKeys: skip 1 ; | Hyrule Castle
EPCollectedKeys: skip 1 ; | Eastern Palace
DPCollectedKeys: skip 1 ; | Desert Palace
CTCollectedKeys: skip 1 ; | Agahnim's Tower
SPCollectedKeys: skip 1 ; | Swamp Palace
PDCollectedKeys: skip 1 ; | Palace of Darkness
MMCollectedKeys: skip 1 ; | Misery Mire
SWCollectedKeys: skip 1 ; | Skull Woods
IPCollectedKeys: skip 1 ; | Ice Palace
THCollectedKeys: skip 1 ; | Tower of Hera
TTCollectedKeys: skip 1 ; | Thieves' Town
TRCollectedKeys: skip 1 ; | Turtle Rock
GTCollectedKeys: skip 1 ; / Ganon's Tower
skip 2 ; Reserved for previous table
FileMarker: skip 1 ; $FF = Active save file | $00 = Inactive save file
skip 13 ; Unused
InverseChecksum: skip 2 ; Vanilla Inverse Checksum. Don't write unless computing checksum.
;================================================================================
; Temporary Effects ($7F50C0 - $7F50CF)
;--------------------------------------------------------------------------------
base $7F50C0
SwordModifier: skip 1
ShieldModifier: skip 1 ; (not implemented)
ArmorModifier: skip 1
MagicModifier: skip 1
LightConeModifier: skip 1
CuccoStormModifier: skip 1
OldManDashModifier: skip 1
IcePhysicsModifier: skip 1
InfiniteArrowsModifier: skip 1
InfiniteBombsModifier: skip 1
InfiniteMagicModifier: skip 1
InvertDPadModifier: skip 1
TemporaryOHKO: skip 1
SpriteSwapper: skip 1
BootsModifier: skip 1 ; (0=Off, 1=Always, 2=Never)
;================================================================================
; Expanded SRAM ($7F6000 - $7F6FFF)
;--------------------------------------------------------------------------------
; This $1000 byte segment is saved beginning where the second save file was in SRAM
; beginning at $700500
;--------------------------------------------------------------------------------
base $7F6000 ; $1000 byte buffer we place beginning at second save file
ExtendedFileNameWRAM: skip 24 ; File name, 12 word-length characters.
RoomPotData: skip 592 ; Table for expanded pot shuffle. One word per room.
SpritePotData: skip 592 ; Table for expanded pot shuffle. One word per room.
PurchaseCounts: skip 96 ; Keeps track of shop purchases
PrivateBlock: skip 512 ; Reserved for 3rd party developers
DummyValue: skip 1 ; $01 if you're a real dummy
;================================================================================
; Direct SRAM Assignments ($700000 - $7080000)
;--------------------------------------------------------------------------------
; Label assignments for the actual cartridge SRAM, expanded to 32k. Used mainly
; for burning in values such as the ROM name directly or when we only have to read
; a small amount of data which is not currently in the WRAM mirror.
;--------------------------------------------------------------------------------
base $700000 ;
CartridgeSRAM: ;
RoomDataSRAM: ;
skip $280 ;
OverworldEventDataSRAM: ;
skip $C0 ;
EquipmentSRAM: skip 76 ;
InventoryTrackingSRAM: skip 2 ;
BowTrackingSRAM: skip 2 ;
skip 53 ;
ProgressIndicatorSRAM: skip 1 ;
skip 19 ;
FileNameVanillaSRAM: skip 8 ; First four characters of file name
FileValiditySRAM: skip 2 ;
skip 285 ;
ExtendedFileNameSRAM: skip 24 ; We read and write the file name directly from and to SRAM (24 bytes)
skip $1AE4 ;
RomVersionSRAM: skip 4 ; ALTTPR ROM version. Low byte is the version, high byte writes
; $01 for now (32-bits total)
RomNameSRAM: skip 21 ; ROM name from $FFC0, burned in during init (21 bytes)
; If value in the ROM doesn't match SRAM, save is cleared.
skip 4075 ;
PasswordSRAM: skip 16 ; Password value (16 bytes)
base off
;================================================================================
; Assertions
;================================================================================
macro assertSRAM(label, address)
assert <label> = <address>, "<label> labeled at incorrect address."
endmacro
;================================================================================
; Vanilla Assertions
;--------------------------------------------------------------------------------
; All of these need to pass for the base rom to build or something is probably
; very wrong.
;--------------------------------------------------------------------------------
%assertSRAM(EquipmentWRAM, $7EF340)
%assertSRAM(BowEquipment, $7EF340)
%assertSRAM(BoomerangEquipment, $7EF341)
%assertSRAM(HookshotEquipment, $7EF342)
%assertSRAM(BombsEquipment, $7EF343)
%assertSRAM(PowderEquipment, $7EF344)
%assertSRAM(FireRodEquipment, $7EF345)
%assertSRAM(IceRodEquipment, $7EF346)
%assertSRAM(BombosEquipment, $7EF347)
%assertSRAM(EtherEquipment, $7EF348)
%assertSRAM(QuakeEquipment, $7EF349)
%assertSRAM(LampEquipment, $7EF34A)
%assertSRAM(HammerEquipment, $7EF34B)
%assertSRAM(FluteEquipment, $7EF34C)
%assertSRAM(BugNetEquipment, $7EF34D)
%assertSRAM(BookOfMudoraEquipment, $7EF34E)
%assertSRAM(BottleIndex, $7EF34F)
%assertSRAM(SomariaEquipment, $7EF350)
%assertSRAM(ByrnaEquipment, $7EF351)
%assertSRAM(CapeEquipment, $7EF352)
%assertSRAM(MirrorEquipment, $7EF353)
%assertSRAM(GloveEquipment, $7EF354)
%assertSRAM(BootsEquipment, $7EF355)
%assertSRAM(FlippersEquipment, $7EF356)
%assertSRAM(MoonPearlEquipment, $7EF357)
%assertSRAM(SwordEquipment, $7EF359)
%assertSRAM(ShieldEquipment, $7EF35A)
%assertSRAM(ArmorEquipment, $7EF35B)
%assertSRAM(BottleContentsOne, $7EF35C)
%assertSRAM(BottleContentsTwo, $7EF35D)
%assertSRAM(BottleContentsThree, $7EF35E)
%assertSRAM(BottleContentsFour, $7EF35F)
%assertSRAM(CurrentRupees, $7EF360)
%assertSRAM(DisplayRupees, $7EF362)
;--------------------------------------------------------------------------------
%assertSRAM(CompassField, $7EF364)
%assertSRAM(BigKeyField, $7EF366)
%assertSRAM(MapField, $7EF368)
;--------------------------------------------------------------------------------
%assertSRAM(HeartPieceQuarter, $7EF36B)
%assertSRAM(MaximumHealth, $7EF36C)
%assertSRAM(CurrentHealth, $7EF36D)
%assertSRAM(CurrentMagic, $7EF36E)
%assertSRAM(CurrentSmallKeys, $7EF36F)
%assertSRAM(BombCapacityUpgrades, $7EF370)
%assertSRAM(ArrowCapacityUpgrades, $7EF371)
%assertSRAM(HeartsFiller, $7EF372)
%assertSRAM(MagicFiller, $7EF373)
%assertSRAM(PendantsField, $7EF374)
%assertSRAM(BombsFiller, $7EF375)
%assertSRAM(ArrowsFiller, $7EF376)
%assertSRAM(CurrentArrows, $7EF377)
%assertSRAM(AbilityFlags, $7EF379)
%assertSRAM(CrystalsField, $7EF37A)
%assertSRAM(MagicConsumption, $7EF37B)
;--------------------------------------------------------------------------------
%assertSRAM(DungeonKeys, $7EF37C)
%assertSRAM(SewerKeys, $7EF37C)
%assertSRAM(HyruleCastleKeys, $7EF37D)
%assertSRAM(EasternKeys, $7EF37E)
%assertSRAM(DesertKeys, $7EF37F)
%assertSRAM(CastleTowerKeys, $7EF380)
%assertSRAM(SwampKeys, $7EF381)
%assertSRAM(PalaceOfDarknessKeys, $7EF382)
%assertSRAM(MireKeys, $7EF383)
%assertSRAM(SkullWoodsKeys, $7EF384)
%assertSRAM(IcePalaceKeys, $7EF385)
%assertSRAM(HeraKeys, $7EF386)
%assertSRAM(ThievesTownKeys, $7EF387)
%assertSRAM(TurtleRockKeys, $7EF388)
%assertSRAM(GanonsTowerKeys, $7EF389)
%assertSRAM(CurrentGenericKeys, $7EF38B)
;--------------------------------------------------------------------------------
%assertSRAM(ProgressIndicator, $7EF3C5)
%assertSRAM(ProgressFlags, $7EF3C6)
%assertSRAM(MapIcons, $7EF3C7)
%assertSRAM(StartingEntrance, $7EF3C8)
%assertSRAM(NpcFlagsVanilla, $7EF3C9)
%assertSRAM(CurrentWorld, $7EF3CA)
%assertSRAM(FollowerIndicator, $7EF3CC)
%assertSRAM(FollowerXCoord, $7EF3CD)
%assertSRAM(FollowerYCoord, $7EF3CF)
%assertSRAM(DroppedFollowerIndoors, $7EF3D1)
%assertSRAM(DroppedFollowerLayer, $7EF3D2)
%assertSRAM(FollowerDropped, $7EF3D3)
%assertSRAM(FileNameVanillaWRAM, $7EF3D9)
%assertSRAM(FileValidity, $7EF3E1)
%assertSRAM(InverseChecksum, $7EF4FE)
;================================================================================
; Randomizer Assertions
;--------------------------------------------------------------------------------
; Trackers and other third party consumers may depend on these values.
;--------------------------------------------------------------------------------
%assertSRAM(InventoryTracking, $7EF38C)
%assertSRAM(BowTracking, $7EF38E)
%assertSRAM(SpecialWeaponLevel, $7EF38F)
%assertSRAM(ItemLimitCounts, $7EF390)
;--------------------------------------------------------------------------------
%assertSRAM(GameCounter, $7EF3FF)
%assertSRAM(PostGameCounter, $7EF401)
%assertSRAM(CompassCountDisplay, $7EF403)
%assertSRAM(Aga2Duck, $7EF40F)
%assertSRAM(NpcFlags, $7EF410)
%assertSRAM(MapOverlay, $7EF414)
%assertSRAM(HudFlag, $7EF416)
%assertSRAM(IgnoreFaeries, $7EF416)
%assertSRAM(HasGroveItem, $7EF416)
%assertSRAM(GeneralFlags, $7EF416)
%assertSRAM(HighestSword, $7EF417)
%assertSRAM(GoalCounter, $7EF418)
%assertSRAM(ProgrammableItemOne, $7EF41A)
%assertSRAM(ProgrammableItemTwo, $7EF41C)
%assertSRAM(ProgrammableItemThree, $7EF41E)
%assertSRAM(BonkCounter, $7EF420)
%assertSRAM(YAItemCounter, $7EF421)
%assertSRAM(HighestShield, $7EF422)
%assertSRAM(TotalItemCounter, $7EF423)
%assertSRAM(SwordBossKills, $7EF425)
%assertSRAM(BigKeysBigChests, $7EF427)
%assertSRAM(MapsCompasses, $7EF428)
%assertSRAM(PendantCounter, $7EF429)
%assertSRAM(PreGTBKLocations, $7EF42A)
%assertSRAM(RupeesSpent, $7EF42B)
%assertSRAM(SaveQuitCounter, $7EF42D)
%assertSRAM(LoopFrames, $7EF42E)
%assertSRAM(PreBootsLocations, $7EF432)
%assertSRAM(PreMirrorLocations, $7EF434)
%assertSRAM(PreFluteLocations, $7EF436)
%assertSRAM(OverworldMirrors, $7EF43A)
%assertSRAM(UnderworldMirrors, $7EF43B)
%assertSRAM(ScreenTransitions, $7EF43C)
%assertSRAM(NMIFrames, $7EF43E)
%assertSRAM(ChestsOpened, $7EF442)
%assertSRAM(StatsLocked, $7EF443)
%assertSRAM(MenuFrames, $7EF444)
%assertSRAM(HeartContainerCounter, $7EF448)
%assertSRAM(DeathCounter, $7EF449)
%assertSRAM(FluteCounter, $7EF44B)
%assertSRAM(RNGItem, $7EF450)
%assertSRAM(SwordlessBossKills, $7EF452)
%assertSRAM(FaerieRevivalCounter, $7EF453)
%assertSRAM(ChallengeTimer, $7EF454)
%assertSRAM(SwordTime, $7EF458)
%assertSRAM(BootsTime, $7EF45C)
%assertSRAM(FluteTime, $7EF460)
%assertSRAM(MirrorTime, $7EF464)
%assertSRAM(ChestTurnCounter, $7EF468)
%assertSRAM(CapacityUpgrades, $7EF469)
%assertSRAM(DamageCounter, $7EF46A)
%assertSRAM(MagicCounter, $7EF46C)
%assertSRAM(HighestMail, $7EF46E)
%assertSRAM(SmallKeyCounter, $7EF46F)
%assertSRAM(HeartPieceCounter, $7EF470)
%assertSRAM(CrystalCounter, $7EF471)
%assertSRAM(DungeonsCompleted, $7EF472)
;--------------------------------------------------------------------------------
%assertSRAM(ServiceSequence, $7EF4A0)
%assertSRAM(ServiceSequenceRx, $7EF4A0)
%assertSRAM(ServiceSequenceTx, $7EF4A0)
;--------------------------------------------------------------------------------
%assertSRAM(DungeonAbsorbedKeys, $7EF4B0)
%assertSRAM(SewerAbsorbedKeys, $7EF4B0)
%assertSRAM(HCAbsorbedKeys, $7EF4B1)
%assertSRAM(EPAbsorbedKeys, $7EF4B2)
%assertSRAM(DPAbsorbedKeys, $7EF4B3)
%assertSRAM(CTAbsorbedKeys, $7EF4B4)
%assertSRAM(SPAbsorbedKeys, $7EF4B5)
%assertSRAM(PDAbsorbedKeys, $7EF4B6)
%assertSRAM(MMAbsorbedKeys, $7EF4B7)
%assertSRAM(SWAbsorbedKeys, $7EF4B8)
%assertSRAM(IPAbsorbedKeys, $7EF4B9)
%assertSRAM(THAbsorbedKeys, $7EF4BA)
%assertSRAM(TTAbsorbedKeys, $7EF4BB)
%assertSRAM(TRAbsorbedKeys, $7EF4BC)
%assertSRAM(GTAbsorbedKeys, $7EF4BD)
%assertSRAM(DungeonLocationsChecked, $7EF4C0)
%assertSRAM(SewersLocations, $7EF4C0)
%assertSRAM(HCLocations, $7EF4C1)
%assertSRAM(EPLocations, $7EF4C2)
%assertSRAM(DPLocations, $7EF4C3)
%assertSRAM(CTLocations, $7EF4C4)
%assertSRAM(SPLocations, $7EF4C5)
%assertSRAM(PDLocations, $7EF4C6)
%assertSRAM(MMLocations, $7EF4C7)
%assertSRAM(SWLocations, $7EF4C8)
%assertSRAM(IPLocations, $7EF4C9)
%assertSRAM(THLocations, $7EF4CA)
%assertSRAM(TTLocations, $7EF4CB)
%assertSRAM(TRLocations, $7EF4CC)
%assertSRAM(GTLocations, $7EF4CD)
%assertSRAM(DungeonCollectedKeys, $7EF4E0)
%assertSRAM(SewerCollectedKeys, $7EF4E0)
%assertSRAM(HCCollectedKeys, $7EF4E1)
%assertSRAM(EPCollectedKeys, $7EF4E2)
%assertSRAM(DPCollectedKeys, $7EF4E3)
%assertSRAM(CTCollectedKeys, $7EF4E4)
%assertSRAM(SPCollectedKeys, $7EF4E5)
%assertSRAM(PDCollectedKeys, $7EF4E6)
%assertSRAM(MMCollectedKeys, $7EF4E7)
%assertSRAM(SWCollectedKeys, $7EF4E8)
%assertSRAM(IPCollectedKeys, $7EF4E9)
%assertSRAM(THCollectedKeys, $7EF4EA)
%assertSRAM(TTCollectedKeys, $7EF4EB)
%assertSRAM(TRCollectedKeys, $7EF4EC)
%assertSRAM(GTCollectedKeys, $7EF4ED)
%assertSRAM(FileMarker, $7EF4F0)
;--------------------------------------------------------------------------------
%assertSRAM(SwordModifier, $7F50C0)
%assertSRAM(ShieldModifier, $7F50C1)
%assertSRAM(ArmorModifier, $7F50C2)
%assertSRAM(MagicModifier, $7F50C3)
%assertSRAM(LightConeModifier, $7F50C4)
%assertSRAM(CuccoStormModifier, $7F50C5)
%assertSRAM(OldManDashModifier, $7F50C6)
%assertSRAM(IcePhysicsModifier, $7F50C7)
%assertSRAM(InfiniteArrowsModifier, $7F50C8)
%assertSRAM(InfiniteBombsModifier, $7F50C9)
%assertSRAM(InfiniteMagicModifier, $7F50CA)
%assertSRAM(InvertDPadModifier, $7F50CB)
%assertSRAM(TemporaryOHKO, $7F50CC)
%assertSRAM(SpriteSwapper, $7F50CD)
%assertSRAM(BootsModifier, $7F50CE)
;--------------------------------------------------------------------------------
%assertSRAM(ExtendedFileNameWRAM, $7F6000)
%assertSRAM(RoomPotData, $7F6018)
%assertSRAM(SpritePotData, $7F6268)
%assertSRAM(PurchaseCounts, $7F64B8)
%assertSRAM(PrivateBlock, $7F6518)
%assertSRAM(DummyValue, $7F6718)
;================================================================================
; Direct SRAM Assertions
;--------------------------------------------------------------------------------
%assertSRAM(CartridgeSRAM, $700000)
%assertSRAM(RoomDataSRAM, $700000)
%assertSRAM(OverworldEventDataSRAM, $700280)
%assertSRAM(EquipmentSRAM, $700340)
%assertSRAM(InventoryTrackingSRAM, $70038C)
%assertSRAM(BowTrackingSRAM, $70038E)
%assertSRAM(ProgressIndicatorSRAM, $7003C5)
%assertSRAM(FileNameVanillaSRAM, $7003D9)
%assertSRAM(FileValiditySRAM, $7003E1)
%assertSRAM(ExtendedFileNameSRAM, $700500)
%assertSRAM(RomNameSRAM, $702000)
%assertSRAM(RomVersionSRAM, $701FFC)
%assertSRAM(PasswordSRAM, $703000)
pullpc

370
stats.asm
View File

@@ -1,185 +1,37 @@
;================================================================================ ;================================================================================
; Stat Tracking ; Stat Tracking
;================================================================================ ;================================================================================
; $7EF420 - $7EF46F - Stat Tracking ; $7EF420 - $7EF468 - Stat Tracking
;
; See sram.asm for adresses and documentation of stat values
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
; $7EF420 - bonk counter
;--------------------------------------------------------------------------------
; $7EF421 yyyyyaaa
; y - y item counter
; a - a item counter
;--------------------------------------------------------------------------------
; $7EF422 ssshhccc
; s - sword counter
; h - shield counter
; c - crystal counter
;--------------------------------------------------------------------------------
; $7EF423 - item counter
;--------------------------------------------------------------------------------
; $7EF424 mmkkkkkk
; m - mail counter
; k - small keys
;--------------------------------------------------------------------------------
; $7EF425w[2] 1111 2222 3333 4444
; 1 - lvl 1 sword bosses
; 2 - lvl 2 sword bosses
; 3 - lvl 3 sword bosses
; 4 - lvl 4 sword bosses
;--------------------------------------------------------------------------------
; $7EF427 kkkkcccc
; k - big keys
; c - big chests
;--------------------------------------------------------------------------------
; $7EF428 mmmmcccc
; k - maps
; c - compases
;--------------------------------------------------------------------------------
; $7EF429 bbbb--pp
; b - heart containers
; p - pendant upgrades
;--------------------------------------------------------------------------------
; $7EF42A b-sccccc
; b - bomb acquired
; s - silver arrow bow acquired
; c - chests before gtower big key
;--------------------------------------------------------------------------------
; $7EF42Bw[2] - rupees spent
;--------------------------------------------------------------------------------
; $7EF42D - s&q counter
;--------------------------------------------------------------------------------
; $7EF42Ew[2] - loop frame counter (low)
;--------------------------------------------------------------------------------
; $7EF430w[2] - loop frame counter (high)
;--------------------------------------------------------------------------------
; $7EF432 - locations before boots
;--------------------------------------------------------------------------------
; $7EF433 - locations before mirror
;--------------------------------------------------------------------------------
; $7EF434 - hhhhdddd - item locations checked
; h - hyrule castle
; d - palace of darkness
;--------------------------------------------------------------------------------
; $7EF435 - dddhhhaa - item locations checked
; d - desert palace
; h - tower of hera
; a - agahnim's tower
;--------------------------------------------------------------------------------
; $7EF436 - gggggeee - item locations checked
; g - ganon's tower
; e - eastern palace
;--------------------------------------------------------------------------------
; $7EF437 - sssstttt - item locations checked
; s - skull woods
; t - thieves town
;--------------------------------------------------------------------------------
; $7EF438 - iiiimmmm - item locations checked
; i - ice palace
; m - misery mire
;--------------------------------------------------------------------------------
; $7EF439 - ttttssss - item locations checked
; t - turtle rock
; s - swamp palace
;--------------------------------------------------------------------------------
; $7EF43A - times mirrored outdoors
;--------------------------------------------------------------------------------
; $7EF43B - times mirrored in dungeons
;--------------------------------------------------------------------------------
; $7EF43Cw[2] - screen transition counter
;--------------------------------------------------------------------------------
; $7EF43Ew[2] - nmi frame counter (low)
;--------------------------------------------------------------------------------
; $7EF440w[2] - nmi frame counter (high)
;--------------------------------------------------------------------------------
; $7EF442 - chest counter
;--------------------------------------------------------------------------------
; $7EF443 - lock stats
;--------------------------------------------------------------------------------
; $7EF444w[2] - item menu frame counter (low)
;--------------------------------------------------------------------------------
; $7EF446w[2] - item menu frame counter (high)
;--------------------------------------------------------------------------------
; $7EF448 - ---hhhhh
; h - heart pieces
;--------------------------------------------------------------------------------
; $7EF449 - death counter
;--------------------------------------------------------------------------------
; $7EF44A - reserved
;--------------------------------------------------------------------------------
; $7EF44B - flute counter
;--------------------------------------------------------------------------------
; $7EF44Cl[3] - RTA-Timestamp (Start)
;--------------------------------------------------------------------------------
; $7EF44Fl[3] - RTA-Timestamp (End)
;--------------------------------------------------------------------------------
; $7EF452 - sssscccc
; s - swordless bosses
; c - capacity upgrades
;--------------------------------------------------------------------------------
; $7EF453 - fairy revival counter
;--------------------------------------------------------------------------------
; $7EF454w[2] - challenge timer (low)
;--------------------------------------------------------------------------------
; $7EF456w[2] - challenge timer (high)
;--------------------------------------------------------------------------------
; $7EF458w[2] - sword timestamp (low)
;--------------------------------------------------------------------------------
; $7EF45Aw[2] - sword timestamp (high)
;--------------------------------------------------------------------------------
; $7EF45Cw[2] - boots timestamp (low)
;--------------------------------------------------------------------------------
; $7EF45Ew[2] - boots timestamp (high)
;--------------------------------------------------------------------------------
; $7EF460w[2] - flute timestamp (low)
;--------------------------------------------------------------------------------
; $7EF462w[2] - flute timestamp (high)
;--------------------------------------------------------------------------------
; $7EF464w[2] - mirror timestamp (low)
;--------------------------------------------------------------------------------
; $7EF466w[2] - mirror timestamp (high)
;--------------------------------------------------------------------------------
; $7EF468 - chest turn counter
;--------------------------------------------------------------------------------
; $7EF46Aw[2] - damage counter
;--------------------------------------------------------------------------------
; $7EF46Cw[2] - magic counter
;--------------------------------------------------------------------------------
; $7EF46Ew[2] - bombs placed counter
;--------------------------------------------------------------------------------
;--------------------------------------------------------------------------------
!LOCK_STATS = "$7EF443"
;--------------------------------------------------------------------------------
!BONK_COUNTER = "$7EF420"
IncrementBonkCounter: IncrementBonkCounter:
LDA !LOCK_STATS : BNE + LDA StatsLocked : BNE +
LDA !BONK_COUNTER : INC LDA BonkCounter : INC
CMP.b #100 : BEQ + ; decimal 100 CMP.b #100 : BEQ + ; decimal 100
STA !BONK_COUNTER STA BonkCounter
+ +
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
!SAVE_COUNTER = "$7EF42D"
StatSaveCounter: StatSaveCounter:
PHA PHA
LDA !LOCK_STATS : BNE + LDA StatsLocked : BNE +
LDA $10 : CMP.b #$17 : BNE + ; not a proper s&q, link probably died LDA $10 : CMP.b #$17 : BNE + ; not a proper s&q, link probably died
LDA !SAVE_COUNTER : INC LDA SaveQuitCounter : INC
CMP.b #100 : BEQ + ; decimal 100 CMP.b #100 : BEQ + ; decimal 100
STA !SAVE_COUNTER STA SaveQuitCounter
+ +
PLA PLA
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
!SAVE_COUNTER = "$7EF42D"
DecrementSaveCounter: DecrementSaveCounter:
PHA PHA
LDA !LOCK_STATS : BNE + LDA StatsLocked : BNE +
LDA !SAVE_COUNTER : DEC : STA !SAVE_COUNTER LDA SaveQuitCounter : DEC : STA SaveQuitCounter
+ +
PLA PLA
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
!TRANSITION_COUNTER = "$7EF43C"
DungeonHoleWarpTransition: DungeonHoleWarpTransition:
LDA $01C31F, X LDA $01C31F, X
BRA StatTransitionCounter BRA StatTransitionCounter
@@ -188,10 +40,10 @@ DungeonHoleEntranceTransition:
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 $010E : CMP.b #$7B : BNE + ; skip unless falling to ganon's room
LDA !INVENTORY_SWAP_2 : AND.b #$40 : BEQ + ; skip if we don't have silvers LDA BowTracking : AND.b #$40 : BEQ + ; skip if we don't have silvers
LDA $7EF340 : BEQ + ; skip if we have no bow LDA 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
!ADD #$02 : STA $7EF340 ; increase bow to silver !ADD #$02 : STA BowEquipment ; increase bow to silver
+ +
BRA StatTransitionCounter BRA StatTransitionCounter
@@ -199,34 +51,33 @@ DungeonStairsTransition:
JSL Dungeon_SaveRoomQuadrantData JSL Dungeon_SaveRoomQuadrantData
BRA StatTransitionCounter BRA StatTransitionCounter
DungeonExitTransition: DungeonExitTransition:
LDA $7F50C7 : BEQ + ; ice physics LDA IcePhysicsModifier : BEQ + ; ice physics
JSL Player_HaltDashAttackLong JSL Player_HaltDashAttackLong
LDA.b #$00 : STA $0301 ; stop item dashing LDA.b #$00 : STA $0301 ; stop item dashing
+ +
LDA.b #$0F : STA $10 ; stop running through the transition LDA.b #$0F : STA $10 ; stop running through the transition
StatTransitionCounter: StatTransitionCounter:
PHA : PHP PHA : PHP
LDA !LOCK_STATS : BNE + LDA StatsLocked : BNE +
REP #$20 ; set 16-bit accumulator REP #$20 ; set 16-bit accumulator
LDA !TRANSITION_COUNTER : INC LDA ScreenTransitions : INC
CMP.w #999 : BEQ + ; decimal 999 CMP.w #999 : BEQ + ; decimal 999
STA !TRANSITION_COUNTER STA ScreenTransitions
+ +
PLP : PLA PLP : PLA
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
!FLUTE_COUNTER = "$7EF44B"
IncrementFlute: IncrementFlute:
LDA !LOCK_STATS : BNE + LDA StatsLocked : BNE +
LDA !FLUTE_COUNTER : INC : STA !FLUTE_COUNTER LDA FluteCounter : INC : STA FluteCounter
+ +
JSL.l StatTransitionCounter ; also increment transition counter JSL.l StatTransitionCounter ; also increment transition counter
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
IncrementSmallKeys: IncrementSmallKeys:
STA $7EF36F ; thing we wrote over, write small key count STA CurrentSmallKeys ; thing we wrote over, write small key count
PHX PHX
LDA !LOCK_STATS : BNE + LDA StatsLocked : BNE +
JSL AddInventory_incrementKeyLong JSL AddInventory_incrementKeyLong
+ +
JSL.l UpdateKeys JSL.l UpdateKeys
@@ -236,9 +87,9 @@ IncrementSmallKeys:
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
IncrementSmallKeysNoPrimary: IncrementSmallKeysNoPrimary:
STA $7EF36F ; thing we wrote over, write small key count STA CurrentSmallKeys ; thing we wrote over, write small key count
PHX PHX
LDA !LOCK_STATS : BNE + LDA StatsLocked : BNE +
JSL AddInventory_incrementKeyLong JSL AddInventory_incrementKeyLong
+ +
JSL.l UpdateKeys JSL.l UpdateKeys
@@ -255,7 +106,7 @@ IncrementSmallKeysNoPrimary:
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
DecrementSmallKeys: DecrementSmallKeys:
STA $7EF36F ; thing we wrote over, write small key count STA CurrentSmallKeys ; thing we wrote over, write small key count
JSL.l UpdateKeys JSL.l UpdateKeys
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
@@ -276,7 +127,7 @@ CountChestKey: ; called by neighbor functions
INC ; combines HC and Sewer counts INC ; combines HC and Sewer counts
+ TAX + TAX
.count .count
LDA $7EF4E0, X : INC : STA $7EF4E0, X LDA DungeonCollectedKeys, X : INC : STA DungeonCollectedKeys, X
.end .end
PLX : PLA PLX : PLA
RTS RTS
@@ -298,77 +149,71 @@ RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
IncrementAgahnim2Sword: IncrementAgahnim2Sword:
PHA PHA
LDA !LOCK_STATS : BNE + LDA StatsLocked : BNE +
JSL AddInventory_incrementBossSwordLong JSL AddInventory_incrementBossSwordLong
+ +
PLA PLA
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
!DEATH_COUNTER = "$7EF449"
IncrementDeathCounter: IncrementDeathCounter:
PHA PHA
LDA !LOCK_STATS : BNE + LDA StatsLocked : BNE +
LDA $7EF36D : BNE + ; link is still alive, skip LDA CurrentHealth : BNE + ; link is still alive, skip
LDA !DEATH_COUNTER : INC : STA !DEATH_COUNTER LDA DeathCounter : INC : STA DeathCounter
;JSL.l DecrementSaveCounter
+ +
PLA PLA
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
!FAIRY_COUNTER = "$7EF453"
IncrementFairyRevivalCounter: IncrementFairyRevivalCounter:
STA $7EF35C, X ; thing we wrote over STA BottleContents, X ; thing we wrote over
PHA PHA
LDA !LOCK_STATS : BNE + LDA StatsLocked : BNE +
LDA !FAIRY_COUNTER : INC : STA !FAIRY_COUNTER LDA FaerieRevivalCounter : INC : STA FaerieRevivalCounter
+ +
PLA PLA
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
!CHESTTURN_COUNTER = "$7EF468"
IncrementChestTurnCounter: IncrementChestTurnCounter:
PHA PHA
LDA !LOCK_STATS : BNE + LDA StatsLocked : BNE +
LDA !CHESTTURN_COUNTER : INC : STA !CHESTTURN_COUNTER LDA ChestTurnCounter : INC : STA ChestTurnCounter
+ +
PLA PLA
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
!BOMBS_PLACED_COUNTER = "$7EF46E"
IncrementBombsPlacedCounter: IncrementBombsPlacedCounter:
PHA PHA
LDA !LOCK_STATS : BNE + LDA StatsLocked : BNE +
PHP : REP #$20 PHP : REP #$20
LDA !BOMBS_PLACED_COUNTER : INC : STA !BOMBS_PLACED_COUNTER LDA BombsPlaced : INC : STA BombsPlaced
PLP PLP
+ +
PLA PLA
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
!CHEST_COUNTER = "$7EF442"
IncrementChestCounter: IncrementChestCounter:
LDA.b #$01 : STA $02E9 ; thing we wrote over LDA.b #$01 : STA $02E9 ; thing we wrote over
PHA PHA
LDA !LOCK_STATS : BNE + LDA StatsLocked : BNE +
LDA !CHEST_COUNTER : INC : STA !CHEST_COUNTER LDA ChestsOpened : INC : STA ChestsOpened
+ +
PLA PLA
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
!CHEST_COUNTER = "$7EF442"
DecrementChestCounter: DecrementChestCounter:
PHA PHA
LDA !LOCK_STATS : BNE + LDA StatsLocked : BNE +
LDA !CHEST_COUNTER : DEC : STA !CHEST_COUNTER LDA ChestsOpened : DEC : STA ChestsOpened
+ +
PLA PLA
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
!ITEM_TOTAL = "$7EF423"
DecrementItemCounter: DecrementItemCounter:
PHA PHA
LDA !LOCK_STATS : BNE + LDA StatsLocked : BNE +
LDA !ITEM_TOTAL : DEC : STA !ITEM_TOTAL REP #$20
LDA TotalItemCounter : DEC : STA TotalItemCounter
SEP #$20
+ +
PLA PLA
RTL RTL
@@ -376,107 +221,102 @@ RTL
IncrementBigChestCounter: IncrementBigChestCounter:
JSL.l Dungeon_SaveRoomQuadrantData ; thing we wrote over JSL.l Dungeon_SaveRoomQuadrantData ; thing we wrote over
PHA PHA
LDA !LOCK_STATS : BNE + LDA StatsLocked : BNE +
%BottomHalf($7EF427) %BottomHalf(BigKeysBigChests)
+ +
PLA PLA
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
!DAMAGE_COUNTER = $7EF46A
!MAGIC_COUNTER = $7EF46C
IncrementDamageTakenCounter_Eight: IncrementDamageTakenCounter_Eight:
STA.l $7EF36D STA.l CurrentHealth
PHA : PHP PHA : PHP
LDA !LOCK_STATS : BNE + LDA StatsLocked : BNE +
REP #$21 REP #$21
LDA.l !DAMAGE_COUNTER LDA.l DamageCounter
ADC.w #$0008 ADC.w #$0008
BCC ++ BCC ++
LDA.w #$FFFF LDA.w #$FFFF
++ STA.l !DAMAGE_COUNTER ++ STA.l DamageCounter
+ PLP + PLP
PLA PLA
RTL RTL
IncrementDamageTakenCounter_Arb: IncrementDamageTakenCounter_Arb:
PHP PHP
LDA !LOCK_STATS : BNE + LDA StatsLocked : BNE +
REP #$21 REP #$21
LDA.b $00 LDA.b $00
AND.w #$00FF AND.w #$00FF
ADC.l !DAMAGE_COUNTER ADC.l DamageCounter
BCC ++ BCC ++
LDA.w #$FFFF LDA.w #$FFFF
++ STA.l !DAMAGE_COUNTER ++ STA.l DamageCounter
+ PLP + PLP
LDA.l $7EF36D LDA.l CurrentHealth
RTL RTL
IncrementMagicUseCounter: IncrementMagicUseCounter:
STA.l $7EF36E STA.l CurrentMagic
IncrementMagicUseCounterByrna: IncrementMagicUseCounterByrna:
PHA : PHP PHA : PHP
LDA !LOCK_STATS : BNE + LDA StatsLocked : BNE +
REP #$21 REP #$21
LDA.b $00 LDA.b $00
AND.w #$00FF AND.w #$00FF
ADC.l !MAGIC_COUNTER ADC.l MagicCounter
BCC ++ BCC ++
LDA.w #$FFFF LDA.w #$FFFF
++ STA.l !MAGIC_COUNTER ++ STA.l MagicCounter
+ PLP : PLA + PLP : PLA
RTL RTL
IncrementMagicUseCounterOne: IncrementMagicUseCounterOne:
LDA !LOCK_STATS : BNE + LDA StatsLocked : BNE +
REP #$20 REP #$20
LDA.l !MAGIC_COUNTER LDA.l MagicCounter
INC INC
BEQ ++ BEQ ++
STA.l !MAGIC_COUNTER STA.l MagicCounter
++ SEP #$20 ++ SEP #$20
+ LDA.l $7EF36E + LDA.l CurrentMagic
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
!OW_MIRROR_COUNTER = "$7EF43A"
IncrementOWMirror: IncrementOWMirror:
PHA PHA
LDA #$08 : STA $021B ; fail race game LDA #$08 : STA $021B ; fail race game
LDA !LOCK_STATS : BNE + LDA StatsLocked : BNE +
LDA $7EF3CA : BEQ + ; only do this for DW->LW LDA CurrentWorld : BEQ + ; only do this for DW->LW
LDA !OW_MIRROR_COUNTER : INC : STA !OW_MIRROR_COUNTER LDA OverworldMirrors : INC : STA OverworldMirrors
+ +
PLA PLA
JMP StatTransitionCounter JMP StatTransitionCounter
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
!UW_MIRROR_COUNTER = "$7EF43B"
IncrementUWMirror: IncrementUWMirror:
PHA PHA
LDA.b #$00 : STA $7F5035 ; bandaid patch bug with mirroring away from text LDA.b #$00 : STA $7F5035 ; bandaid patch bug with mirroring away from text
LDA !LOCK_STATS : BNE + LDA StatsLocked : BNE +
LDA $040C : CMP #$FF : BEQ + ; skip if we're in a cave or house LDA $040C : CMP #$FF : BEQ + ; skip if we're in a cave or house
LDA !UW_MIRROR_COUNTER : INC : STA !UW_MIRROR_COUNTER LDA UnderworldMirrors : INC : STA UnderworldMirrors
JSL.l StatTransitionCounter JSL.l StatTransitionCounter
+ +
PLA PLA
JSL.l Dungeon_SaveRoomData ; thing we wrote over JSL.l Dungeon_SaveRoomData ; thing we wrote over
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
!SPENT_RUPEES = "$7EF42B"
IncrementSpentRupees: IncrementSpentRupees:
DEC A : BPL .subtractRupees DEC A : BPL .subtractRupees
LDA.w #$0000 : STA $7EF360 LDA.w #$0000 : STA CurrentRupees
RTL RTL
.subtractRupees .subtractRupees
PHA : PHP PHA : PHP
LDA !LOCK_STATS : AND.w #$00FF : BNE + LDA StatsLocked : AND.w #$00FF : BNE +
LDA !SPENT_RUPEES : INC LDA RupeesSpent : INC
CMP.w #9999 : BEQ + ; decimal 9999 CMP.w #9999 : BEQ + ; decimal 9999
STA !SPENT_RUPEES STA RupeesSpent
+ +
PLP : PLA PLP : PLA
RTL RTL
@@ -491,76 +331,46 @@ IndoorSubtileTransitionCounter:
STZ $0642 STZ $0642
JMP StatTransitionCounter JMP StatTransitionCounter
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
!CHEST_COUNTER = "$7EF442"
!MAIL_COUNTER = "$7EF424" ; mmkkkkkk
!BOSS_KILLS = "$7F5037" !BOSS_KILLS = "$7F5037"
!SWORD_KILLS_1 = "$7EF425"
!SWORD_KILLS_2 = "$7EF426"
!GTOWER_PRE_BIG_KEY = "$7EF42A" ; ---ccccc
!NONCHEST_COUNTER = "$7F503E" !NONCHEST_COUNTER = "$7F503E"
!SAVE_COUNTER = "$7EF42D"
!TRANSITION_COUNTER = "$7EF43C"
!NMI_COUNTER = "$7EF43E"
!LOOP_COUNTER = "$7EF42E"
!LAG_TIME = "$7F5038" !LAG_TIME = "$7F5038"
!RUPEES_COLLECTED = "$7F503C" !RUPEES_COLLECTED = "$7F503C"
!ITEM_TOTAL = "$7EF423"
!RTA_END = "$7EF44F"
StatsFinalPrep: StatsFinalPrep:
PHA : PHX : PHP PHA : PHX : PHP
SEP #$30 ; set 8-bit accumulator and index registers SEP #$30 ; set 8-bit accumulator and index registers
LDA !LOCK_STATS : BNE .ramPostOnly LDA StatsLocked : BNE .ramPostOnly
INC : STA !LOCK_STATS INC : STA StatsLocked
JSL.l AddInventory_incrementBossSwordLong JSL.l AddInventory_incrementBossSwordLong
LDA !MAIL_COUNTER : !ADD #$40 : STA !MAIL_COUNTER ; add green mail to mail count LDA HighestMail : INC : STA HighestMail ; add green mail to mail count
;LDA !GTOWER_PRE_BIG_KEY : DEC : AND #$1F : TAX
;LDA !GTOWER_PRE_BIG_KEY : AND #$E0 : STA !GTOWER_PRE_BIG_KEY
;TXA : ORA !GTOWER_PRE_BIG_KEY : STA !GTOWER_PRE_BIG_KEY
LDA !TRANSITION_COUNTER : DEC : STA !TRANSITION_COUNTER ; remove extra transition from exiting gtower via duck LDA ScreenTransitions : DEC : STA ScreenTransitions ; remove extra transition from exiting gtower via duck
.ramPostOnly .ramPostOnly
LDA !SWORD_KILLS_1 : LSR #4 : !ADD !SWORD_KILLS_1 : STA !BOSS_KILLS LDA SwordBossKills : LSR #4 : !ADD SwordBossKills : STA !BOSS_KILLS
LDA !SWORD_KILLS_2 : LSR #4 : !ADD !SWORD_KILLS_2 : !ADD !BOSS_KILLS : AND #$0F : STA !BOSS_KILLS LDA SwordBossKills+1 : LSR #4 : !ADD SwordBossKills+1 : !ADD !BOSS_KILLS : AND #$0F : STA !BOSS_KILLS
LDA !NMI_COUNTER : !SUB !LOOP_COUNTER : STA !LAG_TIME LDA NMIFrames : !SUB LoopFrames : STA !LAG_TIME
LDA !NMI_COUNTER+1 : SBC !LOOP_COUNTER+1 : STA !LAG_TIME+1 LDA NMIFrames+1 : SBC LoopFrames+1 : STA !LAG_TIME+1
LDA !NMI_COUNTER+2 : SBC !LOOP_COUNTER+2 : STA !LAG_TIME+2 LDA NMIFrames+2 : SBC LoopFrames+2 : STA !LAG_TIME+2
LDA !NMI_COUNTER+3 : SBC !LOOP_COUNTER+3 : STA !LAG_TIME+3 LDA NMIFrames+3 : SBC LoopFrames+3 : STA !LAG_TIME+3
LDA !SPENT_RUPEES : !ADD $7EF362 : STA !RUPEES_COLLECTED LDA RupeesSpent : !ADD DisplayRupees : STA !RUPEES_COLLECTED
LDA !SPENT_RUPEES+1 : ADC $7EF363 : STA !RUPEES_COLLECTED+1 LDA RupeesSpent+1 : ADC DisplayRupees+1 : STA !RUPEES_COLLECTED+1
LDA !ITEM_TOTAL : !SUB !CHEST_COUNTER : STA !NONCHEST_COUNTER REP #$20
LDA TotalItemCounter : !SUB ChestsOpened : STA !NONCHEST_COUNTER
;LDA $FFFFFF
;JSL.l Clock_IsSupported
;BRA +
; REP #$20 ; set 16-bit accumulator
;
; LDA $00 : PHA
; LDA $02 : PHA
;
; JSL.l Clock_QuickStamp
; LDA $00 : STA !RTA_END
; LDA $02 : STA !RTA_END+2
;
; PLA : STA $02
; PLA : STA $00
;+
.done .done
PLP : PLX : PLA PLP : PLX : PLA
LDA.b #$19 : STA $10 ; thing we wrote over, load triforce room LDA.b #$19 : STA $10 ; thing we wrote over, load triforce room
STZ $11 STZ $11
STZ $B0 STZ $B0
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
; Notes: ; Notes:

View File

@@ -1,22 +1,22 @@
;(address, type, shiftRight, bits, digits, xPos, lineNumber) ;(address, type, shiftRight, bits, digits, xPos, lineNumber)
%AddStat($7EF458, 1, 0, 32, 4, !FIRST_SWORD_X, !FIRST_SWORD_Y) %AddStat(SwordTime, 1, 0, 32, 4, !FIRST_SWORD_X, !FIRST_SWORD_Y)
%AddStat($7EF45C, 1, 0, 32, 4, !PEGASUS_BOOTS_X, !PEGASUS_BOOTS_Y) %AddStat(BootsTime, 1, 0, 32, 4, !PEGASUS_BOOTS_X, !PEGASUS_BOOTS_Y)
%AddStat($7EF460, 1, 0, 32, 4, !FLUTE_X, !FLUTE_Y) %AddStat(FluteTime, 1, 0, 32, 4, !FLUTE_X, !FLUTE_Y)
%AddStat($7EF464, 1, 0, 32, 4, !MIRROR_X, !MIRROR_Y) %AddStat(MirrorTime, 1, 0, 32, 4, !MIRROR_X, !MIRROR_Y)
%AddStat($7EF452, 0, 4, 04, 2, !SWORDLESS_X, !SWORDLESS_Y) %AddStat(SwordlessBossKills, 0, 0, 08, 2, !SWORDLESS_X, !SWORDLESS_Y)
%AddStat($7EF425, 0, 4, 04, 2, !FIGHTERS_SWORD_X, !FIGHTERS_SWORD_Y) %AddStat(SwordBossKills, 0, 4, 04, 2, !FIGHTERS_SWORD_X, !FIGHTERS_SWORD_Y)
%AddStat($7EF425, 0, 0, 04, 2, !MASTER_SWORD_X, !MASTER_SWORD_Y) %AddStat(SwordBossKills, 0, 0, 04, 2, !MASTER_SWORD_X, !MASTER_SWORD_Y)
%AddStat($7EF426, 0, 4, 04, 2, !TEMPERED_SWORD_X, !TEMPERED_SWORD_Y) %AddStat(SwordBossKills+1, 0, 4, 04, 2, !TEMPERED_SWORD_X, !TEMPERED_SWORD_Y)
%AddStat($7EF426, 0, 0, 04, 2, !GOLD_SWORD_X, !GOLD_SWORD_Y) %AddStat(SwordBossKills+1, 0, 0, 04, 2, !GOLD_SWORD_X, !GOLD_SWORD_Y)
%AddStat($7EF46A, 0, 0, 16, 5, !DAMAGETAKEN_X, !DAMAGETAKEN_Y) %AddStat(DamageCounter, 0, 0, 16, 5, !DAMAGETAKEN_X, !DAMAGETAKEN_Y)
%AddStat($7EF46C, 0, 0, 16, 5, !MAGICUSED_X, !MAGICUSED_Y) %AddStat(MagicCounter, 0, 0, 16, 5, !MAGICUSED_X, !MAGICUSED_Y)
%AddStat($7EF420, 0, 0, 08, 3, !BONKS_X, !BONKS_Y) %AddStat(BonkCounter, 0, 0, 08, 3, !BONKS_X, !BONKS_Y)
%AddStat($7EF46E, 0, 0, 16, 4, !BOMBS_X, !BOMBS_Y) %AddStat(BombsPlaced, 0, 0, 16, 4, !BOMBS_X, !BOMBS_Y)
%AddStat($7EF42D, 0, 0, 08, 2, !SAVE_AND_QUITS_X, !SAVE_AND_QUITS_Y) %AddStat(SaveQuitCounter, 0, 0, 08, 2, !SAVE_AND_QUITS_X, !SAVE_AND_QUITS_Y)
%AddStat($7EF449, 0, 0, 08, 2, !DEATHS_X, !DEATHS_Y) %AddStat(DeathCounter, 0, 0, 08, 2, !DEATHS_X, !DEATHS_Y)
%AddStat($7EF453, 0, 0, 08, 3, !FAERIE_REVIVALS_X, !FAERIE_REVIVALS_Y) %AddStat(FaerieRevivalCounter, 0, 0, 08, 3, !FAERIE_REVIVALS_X, !FAERIE_REVIVALS_Y)
%AddStat($7EF444, 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($7F5038, 1, 0, 32, 4, !TOTAL_LAG_TIME_X, !TOTAL_LAG_TIME_Y)
%AddStat($7EF423, 0, 0, 08, 3, !COLLECTION_RATE_X, !COLLECTION_RATE_Y) %AddStat(TotalItemCounter, 0, 0, 16, 3, !COLLECTION_RATE_X, !COLLECTION_RATE_Y)
%AddStat($7EF43E, 1, 0, 32, 4, !TOTAL_TIME_X, !TOTAL_TIME_Y) %AddStat(NMIFrames, 1, 0, 32, 4, !TOTAL_TIME_X, !TOTAL_TIME_Y)

View File

@@ -20,7 +20,7 @@
;JML.l Smithy_DoesntHaveSword ;JML.l Smithy_DoesntHaveSword
;================================================================================ ;================================================================================
;LoadSwordForDamage: ;LoadSwordForDamage:
; LDA $7EF359 : CMP #$04 : BNE .done ; skip if not gold sword ; LDA SwordEquipment : CMP #$04 : BNE .done ; skip if not gold sword
; LDA $1B : BEQ + ; skip if outdoors ; LDA $1B : BEQ + ; skip if outdoors
; LDA $A0 : CMP #41 : BNE + ; decimal 41 ; skip if not in the mothula room ; LDA $A0 : CMP #41 : BNE + ; decimal 41 ; skip if not in the mothula room
; LDA #$03 ; pretend we're using tempered ; LDA #$03 ; pretend we're using tempered
@@ -71,23 +71,21 @@ LookupDamageLevel:
.pseudo_table .pseudo_table
%LookupDamageSubclass(Damage_Table_Pseudo) : RTL %LookupDamageSubclass(Damage_Table_Pseudo) : RTL
;================================================================================ ;================================================================================
; $7F50C0 - Sword Modifier
LoadModifiedSwordLevel: ; returns short LoadModifiedSwordLevel: ; returns short
LDA $7F50C0 : BEQ + LDA SwordModifier : BEQ +
!ADD $7EF359 ; add normal sword value to modifier !ADD SwordEquipment ; add normal sword value to modifier
BNE ++ : LDA.b #$01 : RTS : ++ BNE ++ : LDA.b #$01 : RTS : ++
CMP.b #$05 : !BLT ++ : LDA.b #$04 : RTS : ++ CMP.b #$05 : !BLT ++ : LDA.b #$04 : RTS : ++
RTS RTS
+ +
LDA $7EF359 ; load normal sword value LDA SwordEquipment ; load normal sword value
RTS RTS
;================================================================================ ;================================================================================
; $7EF35B - Armor Inventory ; ArmorEquipment - Armor Inventory
; $7F50C2 - Armor Modifier
; $7F5020 - Scratch Space (Caller Preserved) ; $7F5020 - Scratch Space (Caller Preserved)
LoadModifiedArmorLevel: LoadModifiedArmorLevel:
PHA PHA
LDA $7EF35B : !ADD $7F50C2 LDA ArmorEquipment : !ADD ArmorModifier
CMP.b #$FF : BNE + : LDA.b #$00 : + CMP.b #$FF : BNE + : LDA.b #$00 : +
CMP.b #$03 : !BLT + : LDA.b #$02 : + CMP.b #$03 : !BLT + : LDA.b #$02 : +
STA $7F5020 STA $7F5020
@@ -95,30 +93,28 @@ LoadModifiedArmorLevel:
!ADD $7F5020 !ADD $7F5020
RTL RTL
;================================================================================ ;================================================================================
; $7EF37B - Magic Inventory ; MagicConsumption - Magic Inventory
; $7F50C3 - Magic Modifier
LoadModifiedMagicLevel: LoadModifiedMagicLevel:
LDA $7F50C3 : BEQ + LDA MagicModifier : BEQ +
!ADD $7EF37B ; add normal magic value to modifier !ADD MagicConsumption ; add normal magic value to modifier
CMP.b #$FF : BNE ++ : LDA.b #$00 : RTL : ++ CMP.b #$FF : BNE ++ : LDA.b #$00 : RTL : ++
CMP.b #$03 : !BLT ++ : LDA.b #$02 : ++ CMP.b #$03 : !BLT ++ : LDA.b #$02 : ++
RTL RTL
+ +
LDA $7EF37B ; load normal magic value LDA MagicConsumption ; load normal magic value
RTL RTL
;================================================================================ ;================================================================================
; $7E0348 - Ice Value ; $7E0348 - Ice Value
; $7F50C7 - Temporary Ice Modifier ; ChallengeModes - Permanent Ice Modifier ($01 bit)
; $30802D - Permanent Ice Modifier ($01 bit)
LoadModifiedIceFloorValue: LoadModifiedIceFloorValue:
LDA $A0 : CMP #$91 : BEQ + : CMP #$92 : BEQ + : CMP #$93 : BEQ + ; mire basement currently broken - not sure why LDA $A0 : CMP #$91 : BEQ + : CMP #$92 : BEQ + : CMP #$93 : BEQ + ; mire basement currently broken - not sure why
LDA $5D : CMP #$01 : BEQ + : CMP #$17 : BEQ + : CMP #$1C : BEQ + LDA $5D : CMP #$01 : BEQ + : CMP #$17 : BEQ + : CMP #$1C : BEQ +
LDA $5E : CMP #$02 : BEQ + LDA $5E : CMP #$02 : BEQ +
LDA $5B : BNE + LDA $5B : BNE +
LDA.l $30802D : BIT #$01 : BEQ ++ LDA.l ChallengeModes : BIT #$01 : BEQ ++
LDA $A0 : CMP #$16 : BEQ ++ ; swamp supertile with current -- fine for temporary physics but impossible without boots for permanent LDA $A0 : CMP #$16 : BEQ ++ ; swamp supertile with current -- fine for temporary physics but impossible without boots for permanent
LDA.w $0348 : ORA $7F50C7 : ORA #$10 : RTS LDA.w $0348 : ORA IcePhysicsModifier : ORA #$10 : RTS
++ : LDA.w $0348 : ORA $7F50C7 : RTS ++ : LDA.w $0348 : ORA IcePhysicsModifier : RTS
+ : LDA.w $0348 + : LDA.w $0348
RTS RTS
LoadModifiedIceFloorValue_a11: LoadModifiedIceFloorValue_a11:
@@ -128,7 +124,7 @@ LoadModifiedIceFloorValue_a01:
;================================================================================ ;================================================================================
CheckTabletSword: CheckTabletSword:
LDA.l AllowHammerTablets : BEQ + LDA.l AllowHammerTablets : BEQ +
LDA $7EF34B : BNE .allow ; check for hammer LDA HammerEquipment : BNE .allow ; check for hammer
+ +
LDA.l SpecialWeapons : CMP #$01 : BEQ .check_special LDA.l SpecialWeapons : CMP #$01 : BEQ .check_special
CMP #$03 : BEQ .check_special CMP #$03 : BEQ .check_special
@@ -139,16 +135,16 @@ CheckTabletSword:
.allow .allow
LDA.b #$02 : RTL LDA.b #$02 : RTL
.check_special .check_special
LDA !WEAPON_LEVEL : CMP #$02 : !BGE .allow ; check for master bombs LDA SpecialWeaponLevel : CMP #$02 : !BGE .allow ; check for master bombs
.normal .normal
LDA $7EF359 ; get actual sword value LDA SwordEquipment ; get actual sword value
RTL RTL
;================================================================================ ;================================================================================
GetSwordLevelForEvilBarrier: GetSwordLevelForEvilBarrier:
LDA.l AllowHammerEvilBarrierWithFighterSword : BEQ + LDA.l AllowHammerEvilBarrierWithFighterSword : BEQ +
LDA #$FF : RTL LDA #$FF : RTL
+ +
LDA $7EF359 LDA SwordEquipment
RTL RTL
;================================================================================ ;================================================================================
CheckGanonHammerDamage: CheckGanonHammerDamage:
@@ -159,14 +155,14 @@ RTL
LDA.l GanonVulnerabilityItem : CMP.b #$0C : BEQ + LDA.l GanonVulnerabilityItem : CMP.b #$0C : BEQ +
LDA $0E20, X : CMP.b #$D6 ; original behavior LDA $0E20, X : CMP.b #$D6 ; original behavior
RTL RTL
+ +
LDA $0E20, X : CMP.b #$D8 : BCC + LDA $0E20, X : CMP.b #$D8 : BCC +
RTL RTL
+ +
CMP.b #$D6 : BNE + CMP.b #$D6 : BNE +
RTL RTL
+ +
CLC CLC
RTL RTL
;================================================================================ ;================================================================================
GetSmithSword: GetSmithSword:
@@ -175,7 +171,7 @@ GetSmithSword:
JML.l Smithy_DoesntHaveSword ; Classic Smithy JML.l Smithy_DoesntHaveSword ; Classic Smithy
+ +
REP #$20 : LDA $7EF360 : CMP #$000A : SEP #$20 : !BGE .buy REP #$20 : LDA CurrentRupees : CMP #$000A : SEP #$20 : !BGE .buy
.cant_afford .cant_afford
REP #$10 REP #$10
LDA.b #$7A LDA.b #$7A
@@ -190,7 +186,7 @@ GetSmithSword:
STZ $02E9 ; Item from NPC STZ $02E9 ; Item from NPC
PHX : JSL Link_ReceiveItem : PLX PHX : JSL Link_ReceiveItem : PLX
REP #$20 : LDA $7EF360 : !SUB.w #$000A : STA $7EF360 : SEP #$20 ; Take 10 rupees REP #$20 : LDA CurrentRupees : !SUB.w #$000A : STA CurrentRupees : SEP #$20 ; Take 10 rupees
JSL ItemSet_SmithSword JSL ItemSet_SmithSword
.done .done
@@ -202,7 +198,7 @@ CheckMedallionSword:
LDA.b #$02 ; Pretend we have master sword LDA.b #$02 ; Pretend we have master sword
RTL RTL
.check_sword .check_sword
LDA $7EF359 LDA SwordEquipment
RTL RTL
.check_pad .check_pad
PHB : PHX : PHY PHB : PHX : PHY
@@ -240,19 +236,19 @@ CheckMedallionSword:
.outdoors .outdoors
LDA $8A : CMP.b #$70 : BNE + LDA $8A : CMP.b #$70 : BNE +
LDA.l MireRequiredMedallion : TAX : LDA.l .medallion_type, X : CMP $0303 : BNE .done LDA.l MireRequiredMedallion : TAX : LDA.l .medallion_type, X : CMP $0303 : BNE .done
LDA $7EF2F0 : AND.b #$20 : BNE .done LDA OverworldEventDataWRAM+$70 : AND.b #$20 : BNE .done
LDA.b #$08 : PHA : PLB ; set data bank to $08 LDA.b #$08 : PHA : PLB ; set data bank to $08
LDY.b #$02 : JSL.l Ancilla_CheckIfEntranceTriggered : BCS .permit ; misery mire LDY.b #$02 : JSL.l Ancilla_CheckIfEntranceTriggered : BCS .permit ; misery mire
BRA .done BRA .done
+ : CMP.b #$47 : BNE + + : CMP.b #$47 : BNE +
LDA.l TRockRequiredMedallion : TAX : LDA.l .medallion_type, X : CMP $0303 : BNE .done LDA.l TRockRequiredMedallion : TAX : LDA.l .medallion_type, X : CMP $0303 : BNE .done
LDA $7EF2C7 : AND.b #$20 : BNE .done LDA OverworldEventDataWRAM+$47 : AND.b #$20 : BNE .done
LDA.b #$08 : PHA : PLB ; set data bank to $08 LDA.b #$08 : PHA : PLB ; set data bank to $08
LDY.b #$03 : JSL.l Ancilla_CheckIfEntranceTriggered : BCS .permit ; turtle rock LDY.b #$03 : JSL.l Ancilla_CheckIfEntranceTriggered : BCS .permit ; turtle rock
+ +
.done .done
PLY : PLX : PLB PLY : PLX : PLB
LDA $7EF359 LDA SwordEquipment
RTL RTL
.permit .permit
SEP #$20 ; set 8-bit accumulator SEP #$20 ; set 8-bit accumulator

View File

@@ -129,9 +129,7 @@ org $308031 ; PC 0x180031
EnableEasterEggs: EnableEasterEggs:
db #$00 ; #$00 = Off (default) - #$01 = On db #$00 ; #$00 = Off (default) - #$01 = On
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
org $308032 ; PC 0x180032 ; 0x180032 (unused)
OpenMode:
db #$01 ; #$00 = Normal (default) - #$01 = Open
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
org $308033 ; PC 0x180033 org $308033 ; PC 0x180033
HeartBeep: HeartBeep:
@@ -182,9 +180,7 @@ org $30803F ; PC 0x18003F
HammerableGanon: HammerableGanon:
db #$00 ; #$00 = Off (default) - #$01 = On db #$00 ; #$00 = Off (default) - #$01 = On
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
org $308040 ; PC 0x180040 ; 0x180040 - (unused)
PreopenCurtains:
db #$00 ; #$00 = Off (default) - #$01 = On
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
org $308041 ; PC 0x180041 org $308041 ; PC 0x180041
AllowSwordlessMedallionUse: AllowSwordlessMedallionUse:
@@ -194,9 +190,7 @@ org $308042 ; PC 0x180042
PermitSQFromBosses: PermitSQFromBosses:
db #$00 ; #$00 = Off (default) - #$01 = On db #$00 ; #$00 = Off (default) - #$01 = On
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
org $308043 ; PC 0x180043 ; 0x180043 (unused)
StartingSword:
db #$00 ; #$00 = No Sword (default) - #$FF = Non-Sword
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
org $308044 ; PC 0x180044 org $308044 ; PC 0x180044
AllowHammerTablets: AllowHammerTablets:
@@ -211,9 +205,7 @@ HUDDungeonItems:
; display ---edcba a: Small Keys, b: Big Key, c: Map, d: Compass, e: Bosses ; display ---edcba a: Small Keys, b: Big Key, c: Map, d: Compass, e: Bosses
db #$00 db #$00
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
org $308046 ; PC 0x180046 Link's starting equipment ; 0x180046 (unused)
LinkStartingRupees:
dw #$0000
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
org $308048 ; PC 0x180048 org $308048 ; PC 0x180048
MenuSpeed: MenuSpeed:
@@ -400,17 +392,7 @@ org $30808A ; PC 0x18008A
BlockCastleDoorsInRain: BlockCastleDoorsInRain:
db #$00 ; #$00 - Normal, $01 - Block them (Used by Entrance Rando in Standard Mode) db #$00 ; #$00 - Normal, $01 - Block them (Used by Entrance Rando in Standard Mode)
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
org $30808B ; PC 0x18008B ; 0x18008B-0x18008D (unused)
PreopenPyramid:
db $00 ; #$00 = Off (default) - #$01 = On
;--------------------------------------------------------------------------------
org $30808C ; PC 0x18008C
PreopenGanonsTower:
db $00 ; #$00 = Off (default) - #$01 = On
;--------------------------------------------------------------------------------
org $30808D ; PC 0x18008D
InstantPostAgaWorldState:
db $00 ; #$00 = Off (default) - #$01 = On
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
org $30808E ; PC 0x18008E org $30808E ; PC 0x18008E
FakeBoots: FakeBoots:
@@ -853,13 +835,9 @@ org $308165 ; PC 0x180165
GoalItemIcon: GoalItemIcon:
dw #$280E ; #$280D = Star - #$280E = Triforce Piece (default) dw #$280E ; #$280D = Star - #$280E = Triforce Piece (default)
;================================================================================ ;================================================================================
org $308167 ; PC 0x180167 org $308167 ; PC 0x180167-0x180167
GoalItemRequirement: GoalItemRequirement:
db #$00 ; #$00 = Off (default) - #$XX = Require $XX Goal Items - #$FF = Counter-Only dw $0000 ; #$0000 = Off (default) - #$XXXX = Require $XX Goal Items - #$FFFF = Counter-Only
;================================================================================
org $308168 ; PC 0x180168
ByrnaCaveSpikeDamage:
db #$08 ; #$08 = 1 Heart (default) - #$02 = 1/4 Heart
;================================================================================ ;================================================================================
org $308169 ; PC 0x180169 org $308169 ; PC 0x180169
AgahnimDoorStyle: AgahnimDoorStyle:
@@ -982,17 +960,22 @@ org $308194 ; PC 0x180194
TurnInGoalItems: TurnInGoalItems:
db #$01 ; #$00 = Instant win if last goal item collected. $01 = (Default) must turn in goal items db #$01 ; #$00 = Instant win if last goal item collected. $01 = (Default) must turn in goal items
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
; 0x180195 - 0x1801FF (unused) org $308195 ; PC 0x180195
ByrnaCaveSpikeDamage:
db #$08 ; #$08 = 1 Heart (default) - #$02 = 1/4 Heart
;--------------------------------------------------------------------------------
; 0x180196 - 0x1801FF (unused)
;================================================================================ ;================================================================================
org $308200 ; PC 0x180200 - 0x18020F org $308200 ; PC 0x180200 - 0x18020B
RedClockAmount: RedClockAmount:
dw #$4650, #$0000 ; $00004650 = +5 minutes dw #$4650, #$0000 ; $00004650 = +5 minutes
BlueClockAmount: BlueClockAmount:
dw #$B9B0, #$FFFF ; $FFFFB9B0 = -5 minutes dw #$B9B0, #$FFFF ; $FFFFB9B0 = -5 minutes
GreenClockAmount: GreenClockAmount:
dw #$0000, #$0000 dw #$0000, #$0000
StartingTime: ;--------------------------------------------------------------------------------
dw #$0000, #$0000 ; #$A5E0, #$0001 = 30 minutes ; 0x18020C-0x18020F (unused)
;--------------------------------------------------------------------------------
;================================================================================ ;================================================================================
org $09E3BB ; PC 0x4E3BB org $09E3BB ; PC 0x4E3BB
db $E4 ; Hera Basement Key (Set to programmable HP $EB) (set to $E4 for original hookable/boomable key behavior) db $E4 ; Hera Basement Key (Set to programmable HP $EB) (set to $E4 for original hookable/boomable key behavior)
@@ -1599,8 +1582,8 @@ dw #9999 ; Rupee Limit
; $7F5200 - $7F52FF - RNG Pointer Block ; $7F5200 - $7F52FF - RNG Pointer Block
; $7F5300 - $7F53FF - Multiworld Block ; $7F5300 - $7F53FF - Multiworld Block
; $7F5400 - $7F540F - MSU Block ; $7F5400 - $7F540F - MSU Block
; $7F5410 - $7F545F - Dungeon Tracking Block
; $7F5410 - $7F56FF - Unused ; $7F5460 - $7F56FF - Unused
; $7F5700 - $7F57FF - Dialog Buffer ; $7F5700 - $7F57FF - Dialog Buffer
; ;
@@ -1650,26 +1633,26 @@ dw $0000
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
; 0x182305 - 182FFF (unused) ; 0x182305 - 182FFF (unused)
;================================================================================ ;================================================================================
org $30B000 ; PC 0x183000 - 0x183054 org $30B000 ; PC 0x183000 - 0x1834FF
StartingEquipment: incsrc initsramtable.asm
dw $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000
dw $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000
dw $0000, $0000, $0000, $0000, $0000, $0000, $1818, $FF00
dw $0000, $0000, $0000, $0000, $F800, $0000, $0000, $0000
dw $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000
dw $0000, $0000
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
; 0x183055 - 183FFF (unused) ; 0x183500 - 183FFF (unused)
;================================================================================ ;================================================================================
org $30C000 ; PC 0x184000 - 0x184007 org $30C000 ; PC 0x184000 - 0x184040
ItemSubstitutionRules: ItemSubstitutionRules:
;db [item][quantity][substitution][pad] - CURRENT LIMIT 16 ENTRIES ;db [item][quantity][substitution][pad] - CURRENT LIMIT 16 ENTRIES
db $12, $01, $35, $FF db $12, $01, $35, $FF
db $51, $06, $52, $FF db $51, $06, $52, $FF
db $53, $06, $54, $FF db $53, $06, $54, $FF
db $FF, $FF, $FF, $FF db $FF, $FF, $FF, $FF
org $30C041 ; PC 0x184041
ForceFileName:
db $00 ; $00 = Player picks name (default) - $01 = Use StaticFileName (initsramtable.asm)
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
; 0x184008 - 0x1847FF (unused) ; 0x18405B - 0x1847FF (unused)
;================================================================================ ;================================================================================
;shop_config - tdav --qq ;shop_config - tdav --qq
; t - 0=Shop - 1=TakeAny ; t - 0=Shop - 1=TakeAny
@@ -1694,11 +1677,6 @@ db $01, $51, $64, $00, $07, $FF, $00, $00
db $01, $53, $64, $00, $07, $FF, $00, $00 db $01, $53, $64, $00, $07, $FF, $00, $00
db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF
; Fix spawning with more hearts than capacity when less than 3 heart containers
LowHeartFix:
org $09F4AC ; <- module_death.asm:331
db $08, $08, $10
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
; 0x185060 - 1850FF (unused) ; 0x185060 - 1850FF (unused)
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
@@ -2696,7 +2674,18 @@ org $30EA84 : RoomHeader_012E: ; pc 0x186A84
db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
; 0x186C00 - 187FFF (unused) ; 0x186C00 - 186FFE (unused)
;--------------------------------------------------------------------------------
org $30EFFF ; PC 0x186FFF
BallNChainDungeon:
db #$02
org $30F000 ; PC 0x187000-0x18700F
CompassTotalsROM:
db $08, $08, $06, $06, $02, $0A, $0E, $08, $08, $08, $06, $08, $0C, $1B, $00, $00
;--------------------------------------------------------------------------------
; 0x187010 - 187FFF (unused)
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
@@ -2713,11 +2702,6 @@ db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF

View File

@@ -2,19 +2,19 @@
; Randomize Tablets ; Randomize Tablets
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
ItemSet_EtherTablet: ItemSet_EtherTablet:
PHA : LDA !NPC_FLAGS_2 : ORA.b #$01 : STA !NPC_FLAGS_2 : PLA PHA : LDA NpcFlags+1 : ORA.b #$01 : STA NpcFlags+1 : PLA
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
ItemSet_BombosTablet: ItemSet_BombosTablet:
PHA : LDA !NPC_FLAGS_2 : ORA.b #$02 : STA !NPC_FLAGS_2 : PLA PHA : LDA NpcFlags+1 : ORA.b #$02 : STA NpcFlags+1 : PLA
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
ItemCheck_EtherTablet: ItemCheck_EtherTablet:
LDA !NPC_FLAGS_2 : AND.b #$01 LDA NpcFlags+1 : AND.b #$01
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
ItemCheck_BombosTablet: ItemCheck_BombosTablet:
LDA !NPC_FLAGS_2 : AND.b #$02 LDA NpcFlags+1 : AND.b #$02
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
SetTabletItem: SetTabletItem:
@@ -132,4 +132,4 @@ DrawNarrowDroppedObject:
PLY PLY
.large_sprite .large_sprite
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------

View File

@@ -2,9 +2,6 @@
; Challenge Timer ; Challenge Timer
;================================================================================ ;================================================================================
!Temp = "$7F5020" !Temp = "$7F5020"
!BaseTimer = "$7EF43E"
!ChallengeTimer = "$7EF454"
!TemporaryOHKO = "$7F50CC"
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
!CLOCK_HOURS = "$7F5080" ; $7F5080 - $7F5083 - Clock Hours !CLOCK_HOURS = "$7F5080" ; $7F5080 - $7F5083 - Clock Hours
!CLOCK_MINUTES = "$7F5084" ; $7F5084 - $7F5087 - Clock Minutes !CLOCK_MINUTES = "$7F5084" ; $7F5084 - $7F5087 - Clock Minutes
@@ -58,17 +55,17 @@ CalculateTimer:
STA.l !CLOCK_SECONDS+2 STA.l !CLOCK_SECONDS+2
LDA.l TimerStyle : AND.w #$00FF : CMP.w #$0002 : BNE + ; Stopwatch Mode LDA.l TimerStyle : AND.w #$00FF : CMP.w #$0002 : BNE + ; Stopwatch Mode
%Sub32(!BaseTimer,!ChallengeTimer,!CLOCK_TEMPORARY) %Sub32(NMIFrames,ChallengeTimer,!CLOCK_TEMPORARY)
BRA ++ BRA ++
+ CMP.w #$0001 : BNE ++ ; Countdown Mode + CMP.w #$0001 : BNE ++ ; Countdown Mode
%Sub32(!ChallengeTimer,!BaseTimer,!CLOCK_TEMPORARY) %Sub32(ChallengeTimer,NMIFrames,!CLOCK_TEMPORARY)
++ ++
%Blt32(!CLOCK_TEMPORARY,.halfCycle) : !BLT + %Blt32(!CLOCK_TEMPORARY,.halfCycle) : !BLT +
LDA.l TimeoutBehavior : AND.w #$00FF : BNE ++ ; DNF LDA.l TimeoutBehavior : AND.w #$00FF : BNE ++ ; DNF
LDA.w #$0002 : STA.l !Status ; Set DNF Mode LDA.w #$0002 : STA.l !Status ; Set DNF Mode
LDA.l !BaseTimer : STA.l !ChallengeTimer LDA.l NMIFrames : STA.l ChallengeTimer
LDA.l !BaseTimer+2 : STA.l !ChallengeTimer+2 LDA.l NMIFrames+2 : STA.l ChallengeTimer+2
RTS RTS
++ CMP.w #$0001 : BNE ++ ; Negative Time ++ CMP.w #$0001 : BNE ++ ; Negative Time
LDA.l !CLOCK_TEMPORARY : EOR.w #$FFFF : !ADD.w #$0001 : STA.l !CLOCK_TEMPORARY LDA.l !CLOCK_TEMPORARY : EOR.w #$FFFF : !ADD.w #$0001 : STA.l !CLOCK_TEMPORARY
@@ -77,8 +74,8 @@ CalculateTimer:
BRA .prepDigits BRA .prepDigits
++ CMP.w #$0002 : BNE ++ ; OHKO ++ CMP.w #$0002 : BNE ++ ; OHKO
LDA.w #$0002 : STA.l !Status ; Set DNF Mode LDA.w #$0002 : STA.l !Status ; Set DNF Mode
LDA.l !BaseTimer : STA.l !ChallengeTimer LDA.l NMIFrames : STA.l ChallengeTimer
LDA.l !BaseTimer+2 : STA.l !ChallengeTimer+2 LDA.l NMIFrames+2 : STA.l ChallengeTimer+2
RTS RTS
++ ; End Game ++ ; End Game
SEP #$30 SEP #$30
@@ -123,26 +120,25 @@ dw #$003C, #$0000
.halfCycle .halfCycle
dw #$FFFF, #$7FFF dw #$FFFF, #$7FFF
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
!TEMPORARY_OHKO = "$7F50CC"
DrawChallengeTimer: DrawChallengeTimer:
LDA !TEMPORARY_OHKO : AND.w #$00FF : BEQ + LDA TemporaryOHKO : AND.w #$00FF : BEQ +
LDA.w #$2807 : STA $7EC790 LDA.w #$2807 : STA $7EC790
LDA.w #$280A : STA $7EC792 LDA.w #$280A : STA $7EC792
LDA.w #$280B : STA $7EC794 LDA.w #$280B : STA $7EC794
LDA.w #$280C : STA $7EC796 LDA.w #$280C : STA $7EC796
RTL RTL
+ +
LDA.w #$247F : STA $7EC790 LDA.w #$247F : STA $7EC790
STA $7EC792 STA $7EC792
STA $7EC794 STA $7EC794
STA $7EC796 STA $7EC796
++ ++
LDA.l TimerStyle : BNE + : RTL : + ; Hud Timer LDA.l TimerStyle : BNE + : RTL : + ; Hud Timer
LDA.w #$2807 : STA $7EC792 LDA.w #$2807 : STA $7EC792
LDA.l !Status : AND.w #$0002 : BEQ + ; DNF / OKHO LDA.l !Status : AND.w #$0002 : BEQ + ; DNF / OKHO
LDA.l TimeoutBehavior : AND.w #$00FF : BNE ++ ; DNF LDA.l TimeoutBehavior : AND.w #$00FF : BNE ++ ; DNF
LDA.w #$2808 : STA $7EC794 LDA.w #$2808 : STA $7EC794
LDA.w #$2809 : STA $7EC796 LDA.w #$2809 : STA $7EC796
@@ -163,13 +159,13 @@ DrawChallengeTimer:
LDA.l TimerRestart : BNE +++ : RTL : +++ LDA.l TimerRestart : BNE +++ : RTL : +++
BRA ++ BRA ++
+ ; Show Timer + ; Show Timer
LDA.l !Status : AND.w #$0001 : !ADD.w #$2804 : STA $7EC794 LDA.l !Status : AND.w #$0001 : !ADD.w #$2804 : STA $7EC794
LDA !CLOCK_HOURS+2 : STA $7EC796 LDA !CLOCK_HOURS+2 : STA $7EC796
LDA !CLOCK_HOURS : STA $7EC798 LDA !CLOCK_HOURS : STA $7EC798
LDA.w #$2806 : STA $7EC79A LDA.w #$2806 : STA $7EC79A
LDA !CLOCK_MINUTES+2 : STA $7EC79C LDA !CLOCK_MINUTES+2 : STA $7EC79C
LDA !CLOCK_MINUTES : STA $7EC79E LDA !CLOCK_MINUTES : STA $7EC79E
LDA.w #$2806 : STA $7EC7A0 LDA.w #$2806 : STA $7EC7A0
LDA !CLOCK_SECONDS+2 : STA $7EC7A2 LDA !CLOCK_SECONDS+2 : STA $7EC7A2
LDA !CLOCK_SECONDS : STA $7EC7A4 LDA !CLOCK_SECONDS : STA $7EC7A4
++ ++
@@ -178,12 +174,12 @@ DrawChallengeTimer:
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
OHKOTimer: OHKOTimer:
LDA !TemporaryOHKO : BNE .kill LDA TemporaryOHKO : BNE .kill
LDA.l TimeoutBehavior : CMP #$02 : BNE + LDA.l TimeoutBehavior : CMP #$02 : BNE +
LDA !Status : AND.b #$02 : BEQ + LDA !Status : AND.b #$02 : BEQ +
.kill .kill
LDA.b #$00 : STA $7EF36D ; kill link LDA.b #$00 : STA CurrentHealth ; kill link
+ +
LDA $7EF36D LDA CurrentHealth
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------

View File

@@ -1,9 +1,9 @@
;================================================================================ ;================================================================================
; Tree Kid Fix ; Tree Kid Fix
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
org $06B12B ; <- 3312B - tree status set - 418 - LDA $7EF3C9 : ORA.b #$08 : STA $7EF3C9 org $06B12B ; <- 3312B - tree status set - 418 - LDA NpcFlagsVanilla : ORA.b #$08 : STA NpcFlagsVanilla
LDA $7EF3C9 : AND.b #$F7 : STA $7EF3C9 ; unset arboration instead of setting it LDA NpcFlagsVanilla : AND.b #$F7 : STA 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

@@ -1,8 +1,6 @@
;================================================================================ ;================================================================================
; Utility Functions ; Utility Functions
;================================================================================ ;================================================================================
!PROGRESSIVE_SHIELD = "$7EF416" ; ss-- ----
;--------------------------------------------------------------------------------
; GetSpriteTile ; GetSpriteTile
; in: A - Loot ID ; in: A - Loot ID
; out: A - Sprite GFX ID ; out: A - Sprite GFX ID
@@ -45,7 +43,7 @@ GetSpriteID:
RTL RTL
.specialHandling .specialHandling
CMP.b #$F9 : BNE ++ ; Progressive Magic CMP.b #$F9 : BNE ++ ; Progressive Magic
LDA.l $7EF37B : BNE +++ LDA.l MagicConsumption : BNE +++
LDA.b #$3B : RTL ; Half Magic LDA.b #$3B : RTL ; Half Magic
+++ +++
LDA.b #$3C : RTL ; Quarter Magic LDA.b #$3C : RTL ; Quarter Magic
@@ -54,13 +52,13 @@ RTL
++ CMP.b #$FB : BNE ++ ; RNG Item (Multi) ++ CMP.b #$FB : BNE ++ ; RNG Item (Multi)
JSL.l GetRNGItemMulti : JMP GetSpriteID JSL.l GetRNGItemMulti : JMP GetSpriteID
++ CMP.b #$FD : BNE ++ ; Progressive Armor ++ CMP.b #$FD : BNE ++ ; Progressive Armor
LDA $7EF35B : CMP.l ProgressiveArmorLimit : !BLT + ; Progressive Armor Limit LDA ArmorEquipment : CMP.l ProgressiveArmorLimit : !BLT + ; Progressive Armor Limit
LDA.l ProgressiveArmorReplacement LDA.l ProgressiveArmorReplacement
JMP GetSpriteID JMP GetSpriteID
+ +
LDA.b #$04 : RTL LDA.b #$04 : RTL
++ CMP.b #$FE : BNE ++ ; Progressive Sword ++ CMP.b #$FE : BNE ++ ; Progressive Sword
LDA $7EF359 LDA HighestSword
CMP.l ProgressiveSwordLimit : !BLT + ; Progressive Sword Limit CMP.l ProgressiveSwordLimit : !BLT + ; Progressive Sword Limit
LDA.l ProgressiveSwordReplacement LDA.l ProgressiveSwordReplacement
JMP GetSpriteID JMP GetSpriteID
@@ -74,7 +72,7 @@ RTL
LDA.b #$46 : RTL LDA.b #$46 : RTL
+ +
++ : CMP.b #$FF : BNE ++ ; Progressive Shield ++ : CMP.b #$FF : BNE ++ ; Progressive Shield
LDA !PROGRESSIVE_SHIELD : AND #$C0 : LSR #6 LDA HighestShield
CMP.l ProgressiveShieldLimit : !BLT + ; Progressive Shield Limit CMP.l ProgressiveShieldLimit : !BLT + ; Progressive Shield Limit
LDA.l ProgressiveShieldReplacement LDA.l ProgressiveShieldReplacement
JMP GetSpriteID JMP GetSpriteID
@@ -85,7 +83,7 @@ RTL
+ ; Everything Else + ; Everything Else
LDA.b #$2E : RTL LDA.b #$2E : RTL
++ : CMP.b #$F8 : BNE ++ ; Progressive Bow ++ : CMP.b #$F8 : BNE ++ ; Progressive Bow
LDA $7EF340 : INC : LSR LDA BowEquipment : INC : LSR
CMP.l ProgressiveBowLimit : !BLT + CMP.l ProgressiveBowLimit : !BLT +
LDA.l ProgressiveBowReplacement LDA.l ProgressiveBowReplacement
JMP GetSpriteID JMP GetSpriteID
@@ -188,7 +186,7 @@ GetSpritePalette:
RTL RTL
.specialHandling .specialHandling
CMP.b #$FD : BNE ++ ; Progressive Sword CMP.b #$FD : BNE ++ ; Progressive Sword
LDA $7EF359 LDA HighestSword
CMP.l ProgressiveSwordLimit : !BLT + ; Progressive Sword Limit CMP.l ProgressiveSwordLimit : !BLT + ; Progressive Sword Limit
LDA.l ProgressiveSwordReplacement LDA.l ProgressiveSwordReplacement
JMP GetSpritePalette JMP GetSpritePalette
@@ -201,7 +199,7 @@ RTL
+ ; Everything Else + ; Everything Else
LDA.b #$08 : RTL LDA.b #$08 : RTL
++ : CMP.b #$FE : BNE ++ ; Progressive Shield ++ : CMP.b #$FE : BNE ++ ; Progressive Shield
LDA !PROGRESSIVE_SHIELD : AND #$C0 : LSR #6 LDA HighestShield
CMP.l ProgressiveShieldLimit : !BLT + ; Progressive Shield Limit CMP.l ProgressiveShieldLimit : !BLT + ; Progressive Shield Limit
LDA.l ProgressiveShieldReplacement LDA.l ProgressiveShieldReplacement
JMP GetSpritePalette JMP GetSpritePalette
@@ -212,7 +210,8 @@ RTL
+ ; Everything Else + ; Everything Else
LDA.b #$08 : RTL LDA.b #$08 : RTL
++ : CMP.b #$FF : BNE ++ ; Progressive Armor ++ : CMP.b #$FF : BNE ++ ; Progressive Armor
LDA $7EF35B : CMP.l ProgressiveArmorLimit : !BLT + ; Progressive Armor Limit LDA HighestMail
CMP.l ProgressiveArmorLimit : !BLT + ; Progressive Armor Limit
LDA.l ProgressiveArmorReplacement LDA.l ProgressiveArmorReplacement
JMP GetSpritePalette JMP GetSpritePalette
+ : CMP.b #$00 : BNE + ; Green Tunic + : CMP.b #$00 : BNE + ; Green Tunic
@@ -220,12 +219,12 @@ RTL
+ ; Everything Else + ; Everything Else
LDA.b #$02 : RTL LDA.b #$02 : RTL
++ : CMP.b #$FC : BNE ++ ; Progressive Gloves ++ : CMP.b #$FC : BNE ++ ; Progressive Gloves
LDA $7EF354 : BNE + ; No Gloves LDA GloveEquipment : BNE + ; No Gloves
LDA.b #$02 : RTL LDA.b #$02 : RTL
+ ; Everything Else + ; Everything Else
LDA.b #$08 : RTL LDA.b #$08 : RTL
++ : CMP.b #$F8 : BNE ++ ; Progressive Bow ++ : CMP.b #$F8 : BNE ++ ; Progressive Bow
LDA $7EF340 : INC : LSR LDA BowEquipment : INC : LSR
CMP.l ProgressiveBowLimit : !BLT + CMP.l ProgressiveBowLimit : !BLT +
LDA.l ProgressiveBowReplacement LDA.l ProgressiveBowReplacement
JMP GetSpritePalette JMP GetSpritePalette
@@ -234,7 +233,7 @@ RTL
+ ; Any Bow + ; Any Bow
LDA.b #$02 : RTL LDA.b #$02 : RTL
++ : CMP.b #$F7 : BNE ++ ; Progressive Bombs ++ : CMP.b #$F7 : BNE ++ ; Progressive Bombs
LDA !WEAPON_LEVEL LDA SpecialWeaponLevel
CMP.b #$00 : BNE + ; No Bombs CMP.b #$00 : BNE + ; No Bombs
LDA.b #$08 : RTL LDA.b #$08 : RTL
+ : CMP.b #$01 : BNE + ; L1 Bombs + : CMP.b #$01 : BNE + ; L1 Bombs
@@ -325,19 +324,19 @@ IsNarrowSprite:
+ : JMP .continue + : JMP .continue
.notBottle .notBottle
CMP.b #$5E : BNE ++ ; Progressive Sword CMP.b #$5E : BNE ++ ; Progressive Sword
LDA $7EF359 : CMP.l ProgressiveSwordLimit : !BLT + ; Progressive Sword Limit LDA HighestSword : CMP.l ProgressiveSwordLimit : !BLT + ; Progressive Sword Limit
LDA.l ProgressiveSwordReplacement LDA.l ProgressiveSwordReplacement
JSL.l IsNarrowSprite JSL.l IsNarrowSprite
JMP .done JMP .done
+ : JMP .continue + : JMP .continue
++ CMP.b #$5F : BNE ++ ; Progressive Shield ++ CMP.b #$5F : BNE ++ ; Progressive Shield
LDA !PROGRESSIVE_SHIELD : AND #$C0 : BNE + : SEC : JMP .done ; No Shield LDA HighestShield : BNE + : JMP .done ; No Shield
+ : LSR #6 : CMP.l ProgressiveShieldLimit : !BLT .continue + : CMP.l ProgressiveShieldLimit : !BLT .continue
LDA.l ProgressiveShieldReplacement LDA.l ProgressiveShieldReplacement
JSL.l IsNarrowSprite JSL.l IsNarrowSprite
JMP .done JMP .done
++ CMP.b #$60 : BNE ++ ; Progressive Armor ++ CMP.b #$60 : BNE ++ ; Progressive Armor
LDA $7EF35B : CMP.l ProgressiveArmorLimit : !BLT .continue LDA HighestMail : CMP.l ProgressiveArmorLimit : !BLT .continue
LDA.l ProgressiveArmorReplacement LDA.l ProgressiveArmorReplacement
JSL.l IsNarrowSprite JSL.l IsNarrowSprite
JMP .done JMP .done
@@ -348,7 +347,7 @@ IsNarrowSprite:
JSL.l GetRNGItemMulti JSL.l GetRNGItemMulti
++ CMP.b #$64 : BEQ + ; Progressive Bow ++ CMP.b #$64 : BEQ + ; Progressive Bow
CMP.b #$65 : BNE .continue ; Progressive Bow (alt) CMP.b #$65 : BNE .continue ; Progressive Bow (alt)
+ : LDA $7EF340 : INC : LSR + : LDA BowEquipment : INC : LSR
CMP.l ProgressiveBowLimit : !BLT + CMP.l ProgressiveBowLimit : !BLT +
LDA.l ProgressiveBowReplacement LDA.l ProgressiveBowReplacement
JSL.l IsNarrowSprite JSL.l IsNarrowSprite
@@ -646,19 +645,19 @@ RTL
; out: A(b) - sum of bits ; out: A(b) - sum of bits
; caller is responsible for setting 8-bit mode and preserving X and Y ; caller is responsible for setting 8-bit mode and preserving X and Y
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
CountBits: ;CountBits:
PHX ; PHX
TAX ; Save a copy of value ; TAX ; Save a copy of value
LSR #4 ; Shift down hi nybble, Leave <3> in C ; LSR #4 ; Shift down hi nybble, Leave <3> in C
PHA ; And save <7:4> in Stack ; PHA ; And save <7:4> in Stack
TXA ; Recover value ; TXA ; Recover value
AND.b #$07 ; Put out <2:0> in X ; AND.b #$07 ; Put out <2:0> in X
TAX ; And save in X ; TAX ; And save in X
LDA.l NybbleBitCounts, X ; Fetch count for <2:0> ; LDA.l NybbleBitCounts, X ; Fetch count for <2:0>
PLX ; get <7:4> ; PLX ; get <7:4>
ADC.l NybbleBitCounts, X ; Add count for S & C ; ADC.l NybbleBitCounts, X ; Add count for S & C
PLX ; PLX
RTL ;RTL
; Look up table of bit counts in the values $00-$0F ; Look up table of bit counts in the values $00-$0F
NybbleBitCounts: NybbleBitCounts:

View File

@@ -19,7 +19,7 @@ Ganon_CheckAncillaVulnerability:
BRA .not_vulnerable_pla BRA .not_vulnerable_pla
.silver_arrows .silver_arrows
PLA : CMP #$09 : BNE .not_vulnerable PLA : CMP #$09 : BNE .not_vulnerable
LDA $7EF340 : CMP.b #$03 : !BGE + LDA BowEquipment : CMP.b #$03 : !BGE +
LDA #$09 : BRA .not_vulnerable LDA #$09 : BRA .not_vulnerable
+ +
BRA .vulnerable BRA .vulnerable

View File

@@ -2,30 +2,18 @@
; Spawn Zelda (or not) ; Spawn Zelda (or not)
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
SpawnZelda: SpawnZelda:
LDA.l $7EF3CC : CMP #$08 : BEQ + ; don't spawn if dwarf is present LDA.l FollowerIndicator : CMP.b #$08 : BEQ + ; don't spawn if dwarf is present
CMP #$07 : BEQ + ; don't spawn if frog is present CMP.b #$07 : BEQ + ; don't spawn if frog is present
CMP #$0C : BEQ + ; don't spawn if purple chest is present CMP.b #$0C : BEQ + ; don't spawn if purple chest is present
CLC CLC
+ RTL + RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
EndRainState: EndRainState:
LDA $7EF3C5 : CMP.b #$02 : !BGE ++ ; skip if past escape already LDA.l InitProgressIndicator : BIT.b #$80 : BNE + ; check for instant post-aga
LDA.l EscapeAssist : AND #$44 LDA.b #$02 : STA.l ProgressIndicator
CMP #$04 : BNE + : LDA #$00 : STA !INFINITE_MAGIC : + RTL
CMP #$40 : BNE + : STA !INFINITE_MAGIC : + +
LDA.l EscapeAssist : AND #$22 LDA.b #$03 : STA.l ProgressIndicator
CMP #$02 : BNE + : LDA #$00 : STA !INFINITE_BOMBS : + LDA.l InitLumberjackOW : STA.l OverworldEventDataWRAM+$02
CMP #$20 : BNE + : STA !INFINITE_BOMBS : +
LDA.l EscapeAssist : AND #$11
CMP #$01 : BNE + : LDA #$00 : STA !INFINITE_ARROWS : +
CMP #$10 : BNE + : STA !INFINITE_ARROWS : +
LDA.l SpecialWeapons : CMP #$01 : BNE +
LDA.l !WEAPON_LEVEL : BEQ +
LDA #$01 : STA !INFINITE_BOMBS
+
LDA.b #$02 : STA $7EF3C5 ; end rain state
JSL MaybeSetPostAgaWorldState
++
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------

View File

@@ -11,6 +11,5 @@ CheckZSNES:
LDA #$01FF : TCS ; thing we wrote over - initialize stack LDA #$01FF : TCS ; thing we wrote over - initialize stack
JML.l ReturnCheckZSNES JML.l ReturnCheckZSNES
.zsnes .zsnes
JML DontUseZSNES
STP ; !
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------