51 Commits

Author SHA1 Message Date
43602ce9c7 Bee Mode 2022-11-16 14:30:38 -08:00
90a4c50a01 unscramble lowercase letters for new font 2022-04-02 10:07:03 -07:00
3acc2a3f45 Merge branch 'main' into kara 2022-01-24 13:58:12 -08:00
5fd285c767 Make non-seeded rng a rom flag instead of compile flag 2022-01-24 13:53:03 -08:00
7f551ad1a4 Fix boomerang instakilling Armos Knights 2022-01-24 13:50:44 -08:00
Thomas Prescott
96e3427868 update credits 2022-01-03 12:27:15 -08:00
f629bcb15a Merge branch 'main' into kara 2021-12-29 18:56:36 -08:00
02ea894a40 Add permanent ice physics bit 2021-12-29 18:52:38 -08:00
ac81fcbf0f Fix bee damage 2021-12-27 14:05:28 -08:00
265089cedb Fix moldorm/somaria issue and add both-canes mode 2021-12-22 00:29:56 -08:00
6279f32fe3 Fix width of special cane freestanding sprites 2021-12-21 02:10:16 -08:00
843f1cad6f Prevent hitting stunned ganon in cane-mode with default vulnerability 2021-12-21 01:40:23 -08:00
c23b4ad5b2 Fix mothula/ganon breaking things (hopefully) 2021-12-20 19:02:02 -08:00
22b9c17f09 Remove bomb damage in cane modes 2021-12-20 17:37:49 -08:00
e210c85710 Add cane-only modes 2021-12-20 16:10:11 -08:00
e50641db11 Merge branch 'main' into kara 2021-12-20 01:35:56 -08:00
1ec9f22cea Shorten duration of boomerang stun 2021-11-10 00:08:57 -08:00
18a2214b23 Make boomerang in bomb-only mode stun enemies it would normally damage 2021-11-08 16:37:22 -08:00
f2a0cfc098 Fix bomb icons on file select/endgame screens 2021-11-07 23:58:06 -08:00
6565fbfd65 Show bomb level on file select screen in bomb-only mode 2021-11-07 19:32:57 -08:00
ae0a5c685a Unify handling of bomb colors in bomb-only mode 2021-11-07 00:28:28 -07:00
c323a71340 Merge branch 'main' into kara 2021-10-30 16:37:59 -07:00
f3e0def5a2 Allow early detonation of bombs and add build flag to remove static RNG 2021-10-30 09:02:57 -07:00
1fcde00d09 Merge remote-tracking branch 'kara/pseudoswords' into kara 2021-10-12 13:31:37 -07:00
123dcddc94 Merge branch 'main' into kara 2021-09-21 11:50:40 -07:00
7c8ef3afce Merge branch 'main' into kara 2021-08-26 08:39:23 -07:00
74e2f96e0a Merge branch 'fix_ohko' into kara 2021-08-09 15:32:51 -07:00
dafef001be Merge branch 'main' into kara 2021-08-02 18:59:58 -07:00
3f4db583f5 Add pseudo-sword mode 2021-07-24 16:06:01 -07:00
44f3f10bc1 Merge branch 'main' into kara 2021-07-22 12:05:40 -07:00
2bb5ec87b0 Fix Stalfos Knights in bomb-mode to have bombs instakill while collapsed 2021-07-20 20:33:28 -07:00
86a1f82d23 Color bombs in the HUD according to bomb level in bomb-only mode 2021-07-16 03:48:23 -07:00
1071b834cd Adjust things for replacing sword stats with bomb stats 2021-07-15 13:14:49 -07:00
2693e73a21 move storage of BOMB_LEVEL to make it play nicely with starting equipment 2021-07-13 11:15:07 -07:00
6d52427696 Fix bomb downgrades and track bomb stats in bomb-mode 2021-07-11 13:58:04 -07:00
374abe7e88 Merge branch 'kara' of github.com:ardnaxelarak/z3randomizer into kara 2021-07-11 13:56:01 -07:00
1b698808c3 Add L-1 bombs as separate from no bombs in bomb-only mode 2021-07-11 12:52:20 -07:00
62c81f2cf3 Fix extra space in credits 2021-07-11 02:14:01 -07:00
08166fe669 Allow bombing barrier and getting tablet checks with L2+ bombs 2021-07-10 17:40:08 -07:00
70ec318204 Fix junk graphics appearing during GAME OVER screen 2021-07-10 11:32:33 -07:00
081411a448 Merge branch 'main' into kara 2021-07-08 19:26:55 -07:00
55fd818f55 Merge branch 'main' into kara 2021-07-07 10:27:58 -07:00
37b90894e3 Show bombs placed in credits 2021-07-05 17:57:12 -07:00
f6983cee35 Fix quake not blobbing some enemies in bomb-only mode 2021-07-05 15:40:25 -07:00
642205bc68 Fix hookshot and armos knights
- hookshot now stuns enemies it would normally damage
- armos knights with L-2 bombs now take same damage as L-1 or L-3
2021-07-04 18:28:46 -07:00
a8bc95bd1f NO BOMBOS DAMAGE 2021-07-04 15:43:02 -07:00
0dcef701df Merge commit 'f403ca10da9e009599a531be8cdcd20a61b4801c' of github.com:spannerisms/z3randomizer into kara 2021-07-03 18:25:27 -07:00
1dafb620b0 Merge branch 'main' into kara 2021-07-03 18:23:05 -07:00
828a9df7d9 Allow Ganon to be vulnerable to arbitrary item 2021-06-29 16:28:19 -07:00
ea72d70b1b Implement always-allowed medallions 2021-06-29 16:24:21 -07:00
bf953e7953 Add bomb-only mode 2021-06-29 16:23:15 -07:00
83 changed files with 4146 additions and 3908 deletions

2
.gitignore vendored
View File

@@ -1,3 +1,3 @@
tournament.asm
/build
/.idea
/.idea

View File

@@ -9,6 +9,7 @@ lorom
;db #$23, $4E
org $00FFD5 ; <- 7FD5 - Bank00.asm : 9175 (db $20 ; rom layout)
;db #$35 ; set fast exhirom
db #$30 ; set fast lorom
;org $00FFD6 ; <- 7FD6 - Bank00.asm : 9176 (db $02 ; cartridge type)
@@ -28,7 +29,7 @@ db #$20, #$19, #$08, #$31 ; year/month/day
;================================================================================
!ROM_VERSION_LOW ?= 1 ; ROM version (two 16-bit integers)
!ROM_VERSION_HIGH ?= 2 ;
!ROM_VERSION_HIGH ?= 1 ;
org $00FFE0 ; Unused hardware vector
RomVersion:
@@ -42,7 +43,39 @@ dw !ROM_VERSION_HIGH
!BLT = "BCC"
!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"
!DARK_WORLD = "$7EF3CA"
!REDRAW = "$7F5000"
!GANON_WARP_CHAIN = "$7F5032";
@@ -83,8 +116,6 @@ incsrc treekid.asm
incsrc spriteswap.asm
incsrc hashalphabethooks.asm
incsrc sharedplayerpalettefix.asm
incsrc ram.asm
incsrc sram.asm
;org $208000 ; bank #$20
org $A08000 ; bank #$A0
@@ -98,6 +129,7 @@ incsrc heartpieces.asm
incsrc npcitems.asm
incsrc utilities.asm
incsrc flipperkill.asm
incsrc previewdatacopy.asm
incsrc pendantcrystalhud.asm
incsrc potions.asm
incsrc shopkeeper.asm
@@ -155,11 +187,6 @@ org $A1A000 ; static mapping area. Referenced by front end. Do not move.
incsrc invertedstatic.asm
warnpc $A1A100
org $A1B000
incsrc failure.asm
warnpc $A1FF00
org $A1FF00 ; static mapping area
incsrc init.asm
@@ -167,6 +194,7 @@ org $A48000 ; code bank - PUT NEW CODE HERE
incsrc glitched.asm
incsrc hardmode.asm
incsrc goalitem.asm
incsrc openmode.asm
incsrc quickswap.asm
incsrc endingsequence.asm
incsrc cuccostorm.asm
@@ -194,6 +222,8 @@ incsrc darkroomitems.asm
incsrc fastcredits.asm
incsrc msu.asm
incsrc dungeonmap.asm
incsrc special_weapons.asm
incsrc variable_ganon_vulnerability.asm
if !FEATURE_NEW_TEXT
incsrc textrenderer.asm
endif
@@ -271,6 +301,16 @@ InvertedCastleHole: ;address used by front end. DO NOT MOVE!
incbin sheet73.gfx
warnpc $31E501
org $31E800
Damage_Table_Bombs:
incbin damage_table_sword_bombs.bin
warnpc $31F000
org $31F000
Damage_Table_Pseudo:
incbin damage_table_pseudo_sword.bin
warnpc $31F800
org $338000
GFX_HUD_Palette:
incbin hudpalette.pal
@@ -339,21 +379,20 @@ warnpc $B08000
;$7E021B[0x1]: Used by race game instead of $0ABF to avoid witch item conflict
;$7EC900[0x1F00]: BIGRAM buffer
;$7EF000[0x500]: SRAM mirror First 0x500 bytes of SRAM
; See sram.asm for labels and assignments
;$7F5000[0x800]: Rando's main free ram region
; See tables.asm for specific assignments
;$7F6000[0x1000]: SRAM buffer mapped to vanilla save slots 1 and 2
; See sram.asm for labels and assignments
;$7F6000[0x500]: Free RAM (reclaimed from damage table) Not allocated yet
;$7F6500[0xB00]: SRAM mirror for last 0xB00 bytes of SRAM (extended sram)
;$7F7667[0x6719] - free ram
;================================================================================
;SRAM Map
;See sram.asm for rando-specific assignments
;$70:0000 (5K) Game state
; 0000-04FF Vanilla Slot 1 (mirrored at $7EF000)
; 0500-14FF Ext Slot 1 (mirrored at $7F6000)
;$70:2000 (0x25) ROM Name and version number
;$70:3000 (0x16) Password
;$70:6000 (8K) Scratch buffers
;$70:0000 ( 4K) Game state
; 0000-04FF Vanilla Slot 1 (mirrored at 0x7EF000)
; See earlier in this file for rando specific assignments
; 0500-0FFF Ext Slot 1 (not yet mirrored)
; See earlier in this file for rando specific assignments
;$70:1000 (20K) Log entries
;$70:6000 ( 8K) Scratch buffers
;================================================================================
;org $0080DC ; <- 0xDC - Bank00.asm:179 - Kill Music
;db #$A9, #$00, #$EA
@@ -433,8 +472,6 @@ org $00891D
org $00893D
EnableForceBlank:
DungeonMask = $0098C0
org $00D308
DecompSwordGfx:
@@ -605,13 +642,6 @@ OverworldMap_DarkWorldTilemap:
org $0ABAB9
OverworldMap_LoadSprGfx:
org $0CD7D1
NameFile_MakeScreenVisible:
org $0CDB3E
InitializeSaveFile:
org $0CDBC0
InitializeSaveFile_build_checksum:
org $0DBA71
GetRandomInt:

View File

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

View File

@@ -5,15 +5,15 @@
ModifyBoots:
PHA
LDA !BOOTS_MODIFIER : CMP.b #$01 : BNE +
PLA : AND AbilityFlags : ORA.b #$04 : RTL ; yes boots
PLA : AND $7EF379 : ORA.b #$04 : RTL ; yes boots
+ : CMP.b #$02 : BNE +
PLA : AND AbilityFlags : AND.b #$FB : RTL ; no boots
PLA : AND $7EF379 : AND.b #$FB : RTL ; no boots
+ : LDA FakeBoots : CMP.b #$01 : BNE +
LDA $5B : BEQ ++ : LDA $59 : BNE + ; hover check
++ : PLA : AND AbilityFlags : ORA.b #$04 : RTL ; yes boots, not hovering
++ : PLA : AND $7EF379 : ORA.b #$04 : RTL ; yes boots, not hovering
+
PLA
AND AbilityFlags ; regular boots
AND $7EF379 ; regular boots
RTL
;--------------------------------------------------------------------------------
AddBonkTremors:
@@ -22,7 +22,7 @@ AddBonkTremors:
JSL.l IncrementBonkCounter
+
LDA !BOOTS_MODIFIER : CMP.b #$01 : BEQ +
LDA BootsEquipment : BNE + ; Check for Boots
LDA $7EF355 : BNE + ; Check for Boots
PLA : RTL
+
PLA
@@ -33,7 +33,7 @@ BonkBreakableWall:
PHX : PHP
SEP #$30 ; set 8-bit accumulator and index registers
LDA !BOOTS_MODIFIER : CMP.b #$01 : BEQ +
LDA BootsEquipment : BNE + ; Check for Boots
LDA $7EF355 : BNE + ; Check for Boots
PLP : PLX : LDA.w #$0000 : RTL
+
PLP : PLX
@@ -42,7 +42,7 @@ RTL
;--------------------------------------------------------------------------------
BonkRockPile:
LDA !BOOTS_MODIFIER : CMP.b #$01 : BEQ +
LDA BootsEquipment : BNE + ; Check for Boots
LDA $7EF355 : BNE + ; Check for Boots
LDA.b #$00 : RTL
+
LDA $02EF : AND.b #$70 ; things we wrote over
@@ -50,7 +50,7 @@ RTL
;--------------------------------------------------------------------------------
GravestoneHook:
LDA !BOOTS_MODIFIER : CMP.b #$01 : BEQ +
LDA BootsEquipment : BEQ .done ; Check for Boots
LDA $7EF355 : BEQ .done ; Check for Boots
+
LDA $0372 : BEQ .done ; things we wrote over
JML.l moveGravestone
@@ -59,7 +59,7 @@ GravestoneHook:
;--------------------------------------------------------------------------------
JumpDownLedge:
LDA !BOOTS_MODIFIER : CMP.b #$01 : BEQ +
LDA BootsEquipment : BNE + ; Check for Boots
LDA $7EF355 : BNE + ; Check for Boots
; Disarm Waterwalk
LDA $5B : CMP.b #$01 : BNE +
STZ $5B
@@ -70,7 +70,7 @@ RTL
;--------------------------------------------------------------------------------
BonkRecoil:
LDA !BOOTS_MODIFIER : CMP.b #$01 : BEQ +
LDA BootsEquipment : BNE + ; Check for Boots
LDA $7EF355 : BNE + ; Check for Boots
LDA.b #$16 : STA $29 : RTL
+
LDA.b #$24 : STA $29 ; things we wrote over

View File

@@ -1,71 +0,0 @@
=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

Binary file not shown.

Binary file not shown.

View File

@@ -2,8 +2,8 @@
;--------------------------------------------------------------------------------
AssignKiki:
LDA.b #$00 : STA FollowerDropped ; defuse bomb
LDA.b #$0A : STA FollowerIndicator ; assign kiki as follower
LDA.b #$00 : STA $7EF3D3 ; defuse bomb
LDA.b #$0A : STA $7EF3CC ; assign kiki as follower
RTL
;--------------------------------------------------------------------------------
@@ -13,7 +13,7 @@ RTL
;--------------------------------------------------------------------------------
!ITEM_BUSY = "$7F5091"
AllowSQ:
LDA ProgressIndicator : BEQ .done ; thing we overwrote - check if link is in his bed
LDA $7EF3C5 : BEQ .done ; thing we overwrote - check if link is in his bed
LDA !ITEM_BUSY : EOR #$01
.done
RTL
@@ -32,8 +32,8 @@ RTL
;--------------------------------------------------------------------------------
;0 = Become (Perma)bunny
DecideIfBunny:
LDA MoonPearlEquipment : BNE .done
LDA CurrentWorld : AND.b #$40
LDA $7EF357 : BNE .done
LDA $7EF3CA : AND.b #$40
PHA : LDA.l InvertedMode : BNE .inverted
.normal
PLA : EOR #$40
@@ -48,7 +48,7 @@ DecideIfBunnyByScreenIndex:
; If indoors we don't have a screen index. Return non-bunny to make mirror-based
; superbunny work
LDA $1B : BNE .done
LDA MoonPearlEquipment : BNE .done
LDA $7EF357 : BNE .done
LDA $8A : AND.b #$40 : PHA
LDA.l InvertedMode : BNE .inverted
.normal
@@ -63,7 +63,7 @@ RTL
;--------------------------------------------------------------------------------
;ReadInventoryPond:
; CPX.b #$1B : BNE + : LDA.b #$01 : RTL : +
; LDA EquipmentWRAM, X
; LDA $7EF340, X
;RTL
;--------------------------------------------------------------------------------
@@ -83,10 +83,10 @@ RTS
FixAga2Bunny:
LDA.l FixFakeWorld : BEQ + ; Only use this fix is fakeworld fix is in use
LDA.l InvertedMode : BEQ +++
LDA.b #$00 : STA CurrentWorld ; Switch to light world
LDA.b #$00 : STA !DARK_WORLD ; Switch to light world
BRA ++
+++
LDA.b #$40 : STA CurrentWorld ; Switch to dark world
LDA.b #$40 : STA !DARK_WORLD ; Switch to dark world
++
JSL DecideIfBunny : BNE +
JSR MakeBunny
@@ -112,15 +112,15 @@ RTS
; fix issue where cross world caves (in Entrance randomizer) don't cause
; frog to become smith or vice versa.
FixFrogSmith:
LDA.l CurrentWorld : BNE .darkWorld
LDA.l FollowerIndicator : CMP.b #$07 : BNE .done
LDA.l $7EF3CA : BNE .darkWorld
LDA.l $7EF3CC : CMP.b #$07 : BNE .done
LDA.b #$08 ; make frog into smith in light world
BRA .loadgfx
.darkWorld
LDA.l FollowerIndicator : CMP.b #$08 : BNE .done
LDA.l $7EF3CC : CMP.b #$08 : BNE .done
LDA.b #$07 ; make smith into frog in dark world
.loadgfx
STA.l FollowerIndicator
STA.l $7EF3CC
JSL Tagalong_LoadGfx
.done
RTS
@@ -158,8 +158,8 @@ WallmasterCameraFix:
; Fix losing glove colors
LoadActualGearPalettesWithGloves:
REP #$20
LDA SwordEquipment : STA $0C
LDA ArmorEquipment : AND.w #$00FF
LDA $7EF359 : STA $0C
LDA $7EF35B : AND.w #$00FF
JSL LoadGearPalettes_variable
JSL SpriteSwap_Palette_ArmorAndGloves_part_two
RTL
@@ -214,12 +214,7 @@ FixJingleGlitch:
.exit
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:
LDA #$01

View File

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

View File

@@ -1,6 +1,16 @@
;--------------------------------------------------------------------------------
; $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:
LDX $1B : BNE + : RTL : + ; Skip if outdoors
@@ -12,28 +22,17 @@ DrawDungeonCompassCounts:
CPX.b #$1B : BCS .done ; Skip if not in a valid dungeon ID
BIT.w #$0002 : BNE ++ ; if CompassMode==2, we don't check for the compass
LDA CompassField : AND.l DungeonItemMasks, X ; Load compass values to A, mask with dungeon item masks
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
BEQ .done ; skip if we don't have compass
++
TXA : LSR : TAX
BNE +
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
JMP (CompassCountDungeonHandlers, X) : .return_spot
; we switch to 8-bit A in the jump before this
JSR HudHexToDec2Digit
REP #$20
LDX.b $06 : TXA : ORA #$2400 : STA $7EC794 ; Draw the item count
LDX.b $07 : TXA : ORA #$2400 : STA $7EC796
@@ -45,12 +44,103 @@ RTL
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 $0080, $0040, $0020, $0010, $0008, $0004
;--------------------------------------------------------------------------------
InitCompassTotalsRAM:
LDX #$00
-
LDA CompassTotalsROM, X : STA CompassTotalsWRAM, X
INX
CPX #$0F : !BLT -
RTL
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
; h - hyrule castle/sewers
; 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
;--------------------------------------------------------------------------------

View File

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

View File

@@ -24,7 +24,7 @@ CuccoStorm:
SEP #$30 ; set 8-bit accumulator index registers
LDA.l !CUCCO_STORM : BEQ + ; only if storm is on
LDA.b $10 : CMP.b #$09 : BNE + ; only if outdoors
LDA.l LoopFrames : AND.b #$7F : BNE + ; check every 128 frames
LDA.l !LOOP_FRAMES_LOW : AND.b #$7F : BNE + ; check every 128 frames
-
;==== Find a Cucco
@@ -72,4 +72,4 @@ CuccoStorm:
;====
+
RTL
;================================================================================
;================================================================================

Binary file not shown.

Binary file not shown.

View File

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

View File

@@ -267,9 +267,8 @@ RTL
;--------------------------------------------------------------------------------
DialogFairyThrow:
LDA.l Restrict_Ponds : BEQ .normal
LDA BottleContentsOne
ORA BottleContentsTwo : ORA BottleContentsThree : ORA BottleContentsFour : BNE .normal
LDA $7EF35C : ORA $7EF35D : ORA $7EF35E : ORA $7EF35F : BNE .normal
.noInventory
LDA $0D80, X : !ADD #$08 : STA $0D80, X
LDA.b #$51
@@ -295,36 +294,69 @@ RTL
; #$0193 - no silvers alternate
; #$0194 - no silvers
; #$0195 - silvers
; BowTracking - bsp-- ---
; $7EF38E - bsp-- ---
; b = bow
; s = silver arrow bow
; p = 2nd progressive bow
DialogGanon2:
JSL.l CheckGanonVulnerability
JSL.l CheckGanonVulnerability
REP #$20
BCS +
LDA.w #$018D : BRA ++
+
LDA.l BowTracking
LDA.w #$018D : JMP .done
+
LDA.l GanonVulnerabilityItem : AND #$00FF : BNE .special_item
LDA.l SpecialWeapons : AND.w #$00FF
CMP.w #$0001 : BEQ .bombs ; bombs if special bomb mode
.silver_arrows
LDA.l $7EF38E
BIT.w #$0080 : BNE + ; branch if bow
LDA.w #$0192 : BRA ++
+
BIT.w #$0040 : BEQ + ; branch if no silvers
LDA.w #$0195 : BRA ++
+
BIT.w #$0020 : BNE + ; branch if p bow
LDA.w #$0194 : BRA ++
+
BIT.w #$0080 : BEQ + ; branch if no bow
LDA.w #$0193 : BRA ++
+
LDA.w #$016E
++
BIT.w #$0080 : BNE + ; branch if bow
LDA.w #$0192 : JMP .done
+
BIT.w #$0040 : BEQ + ; branch if no silvers
LDA.w #$0195 : JMP .done
+
BIT.w #$0020 : BNE + ; branch if p bow
LDA.w #$0194 : JMP .done
+
BIT.w #$0080 : BEQ + ; branch if no bow
LDA.w #$0193 : JMP .done
+
LDA.w #$016E : JMP .done
.special_item
CMP.w #$0001 : BEQ .silver_arrows
CMP.w #$0004 : BEQ .bombs
CMP.w #$0005 : BEQ .powder
CMP.w #$0010 : BEQ .bee
PHX : TAX
LDA.l $7EF33F, X : PLX : AND #$00FF : BNE +
LDA.w #$0192 : JMP .done
+
LDA.w #$0195 : BRA .done
.bombs
LDA.l $7EF343 : AND #$00FF : BNE +
LDA.l $7F50C9 : AND #$00FF : BNE + ; check for infinite bombs
LDA.w #$0192 : BRA .done
+
LDA.w #$0195 : BRA .done
.powder
LDA.l $7EF38C : AND #$0010 : BNE +
LDA.w #$0192 : BRA .done
+
LDA.w #$0195 : BRA .done
.bee
LDA.l $7EF35C : 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 $7EF35E : AND #$00FF : CMP.w #$0007 : BEQ + : CMP.w #$0008 : BEQ +
LDA.l $7EF35F : AND #$00FF : CMP.w #$0007 : BEQ + : CMP.w #$0008 : BEQ +
LDA.w #$0192 : BRA .done
+
LDA.w #$0195 : BRA .done
.done
STA $1CF0
SEP #$20
JSL.l Sprite_ShowMessageMinimal_Alt
JSL.l Sprite_ShowMessageMinimal_Alt
RTL
;--------------------------------------------------------------------------------
DialogEtherTablet:
@@ -334,11 +366,8 @@ DialogEtherTablet:
PLA : JML Sprite_ShowMessageUnconditional ; Wacky Hylian Text
+
BIT $F4 : BVC - ; Show normal text if Y is not pressed
LDA.l AllowHammerTablets : BEQ ++
LDA HammerEquipment : BEQ .yesText : BRA .noText
++
LDA SwordEquipment : CMP.b #$FF : BEQ .yesText : CMP.b #$02 : BCS .noText
;++
JSL CheckTabletSword : BMI .yesText
CMP.b #$02 : !BGE .noText
.yesText
PLA
LDA.b #$0C
@@ -356,13 +385,10 @@ DialogBombosTablet:
PLA : JML Sprite_ShowMessageUnconditional ; Wacky Hylian Text
+
BIT $F4 : BVC - ; Show normal text if Y is not pressed
LDA.l AllowHammerTablets : BEQ ++
LDA HammerEquipment : BEQ .yesText : BRA .noText
++
LDA SwordEquipment : CMP.b #$FF : BEQ .yesText : CMP.b #$02 : !BGE .noText
;++
JSL CheckTabletSword : BMI .yesText
CMP.b #$02 : !BGE .noText
.yesText
PLA
PLA
LDA.b #$0D
LDY.b #$01
JML Sprite_ShowMessageUnconditional ; Text From MSPedestalText (tables.asm)
@@ -372,16 +398,16 @@ DialogBombosTablet:
RTL
;--------------------------------------------------------------------------------
DialogSahasrahla:
LDA.l PendantsField : AND #$04 : BEQ + ;Check if player has green pendant
LDA.l $7EF374 : AND #$04 : BEQ + ;Check if player has green pendant
LDA.b #$2F
LDY.b #$00
LDY.b #$00
JML Sprite_ShowMessageUnconditional
+
RTL
;--------------------------------------------------------------------------------
DialogBombShopGuy:
LDY.b #$15
LDA.l CrystalsField : AND #$05 : CMP #$05 : BNE + ;Check if player has crystals 5 & 6
LDA.l $7EF37A : AND #$05 : CMP #$05 : BNE + ;Check if player has crystals 5 & 6
INY ; from 15 to 16
+
TYA
@@ -394,7 +420,7 @@ AgahnimAsksAboutPed:
LDA.l InvincibleGanon
CMP.b #$06 : BNE .vanilla
LDA.l OverworldEventDataWRAM+$80 ; check ped flag
LDA.l $7EF300 ; check ped flag
AND.b #$40
BNE .vanilla
@@ -455,7 +481,7 @@ RTL
CalculateSignIndex:
; for the big 1024x1024 screens we are calculating link's effective
; screen area, as though the screen was 4 different 512x512 screens.
; And we do this in a way that will likely give the right value even
; And we do this in a way that will likely give the right value even
; with major glitches.
LDA $8A : ASL A : TAY ;what we wrote over
@@ -464,13 +490,13 @@ CalculateSignIndex:
LDA $21 : AND.w #$0002 : ASL #2 : EOR $8A : AND.w #$0008 : BEQ +
TYA : !ADD.w #$0010 : TAY ;add 16 if we are in lower half of big screen.
+
+
LDA $23 : AND.w #$0002 : LSR : EOR $8A : AND.w #$0001 : BEQ +
TYA : INC #2 : TAY ;add 16 if we are in lower half of big screen.
+
; ensure even if things go horribly wrong, we don't read the sign out of bounds and crash:
TYA : AND.w #$00FF : TAY
TYA : AND.w #$00FF : TAY
.done
RTL

View File

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

View File

@@ -8,7 +8,7 @@ LockAgahnimDoors:
;#$0 = Never Locked
LDA.w #$0000 : RTL
+ : CMP.w #$0001 : BNE +
LDA ProgressIndicator : AND.w #$000F : CMP.w #$0002 : !BGE .unlock ; if we rescued zelda, skip
LDA $7EF3C5 : AND.w #$000F : CMP.w #$0002 : !BGE .unlock ; if we rescued zelda, skip
JSR.w LockAgahnimDoorsCore : RTL
+ : CMP.w #$0002 : BNE +
JSR.w LockAgahnimDoorsCore : BEQ .unlock
@@ -22,7 +22,7 @@ LockAgahnimDoors:
.crystalOrUnlock
LDA InvertedMode : AND.w #$00FF : BEQ .unlock
LDA OverworldEventDataWRAM+$43 : AND.w #$0020 : BNE .unlock ; Check if GT overlay is already on or not
LDA $7EF2C3 : 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
.locked
@@ -44,7 +44,7 @@ RTL
FlagAgahnimDoor:
LDA.l InvertedMode : BEQ .vanilla
LDA OverworldEventDataWRAM+$43 : ORA #$20 : STA OverworldEventDataWRAM+$43 ; activate GT overlay
LDA $7EF2C3 : ORA #$20 : STA $7EF2C3 ; activate GT overlay
.vanilla
LDA.b #$28 : STA.b $72
@@ -77,7 +77,7 @@ JML.l Overworld_Entrance_BRANCH_RHO
AllowStartFromSingleEntranceCave:
; 16 Bit A, 16 bit XY
; do not need to preserve A or X or Y
LDA StartingEntrance : AND.w #$00FF ; What we wrote over
LDA $7EF3C8 : AND.w #$00FF ; What we wrote over
PHA
TAX
LDA.l StartingAreaExitOffset, X
@@ -138,7 +138,7 @@ AllowStartFromExit:
LDX $1CE8
LDA.l ShouldStartatExit, X : BNE .doStart
LDA.l StartingEntrance ; what we wrote over
LDA.l $7EF3C8 ; what we wrote over
JML.l AllowStartFromExitReturn
.doStart
@@ -209,7 +209,7 @@ TurtleRockEntranceFix:
LDA TurtleRockAutoOpenFix : BEQ .done
LDA $8A : CMP.b #$47 : BNE .done
;If exiting to turtle rock ensure the entrance is open
LDA.l OverworldEventDataWRAM+$47 : ORA.b #$20 : STA.l OverworldEventDataWRAM+$47
LDA.l $7EF2C7 : ORA.b #$20 : STA.l $7EF2C7
.done
RTL
;--------------------------------------------------------------------------------

View File

@@ -2,7 +2,7 @@
; OnLoadOW
;--------------------------------------------------------------------------------
;OnLoadMap:
; LDA OverworldEventDataWRAM+$5B ; thing we wrote over
; LDA $7EF2DB ; thing we wrote over
;RTL
;--------------------------------------------------------------------------------
OnPrepFileSelect:
@@ -21,10 +21,9 @@ OnDrawHud:
JSL.l PollService
JML.l ReturnFromOnDrawHud
;--------------------------------------------------------------------------------
OnDungeonEntrance:
STA $7EC172 ; thing we wrote over
JSL MaybeFlagCompassTotalEntrance
RTL
;OnDungeonEntrance:
; STA $7EC172 ; thing we wrote over
;RTL
;--------------------------------------------------------------------------------
OnPlayerDead:
PHA
@@ -64,61 +63,31 @@ OnUncleItemGet:
BIT.b #$01 : BEQ + : STA !INFINITE_ARROWS : +
PLA
JSL.l Link_ReceiveItem
JSL Link_ReceiveItem
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.l BombsFiller : + ; refill bombs
LDA.l UncleRefill : BIT.b #$04 : BEQ + : LDA.b #$80 : STA $7EF373 : + ; refill magic
LDA.l UncleRefill : BIT.b #$02 : BEQ + : LDA.b #50 : STA $7EF375 : + ; refill bombs
LDA.l UncleRefill : BIT.b #$01 : BEQ + ; refill arrows
LDA.b #70 : STA.l ArrowsFiller
LDA.b #70 : STA $7EF376
LDA.l ArrowMode : BEQ +
LDA.l BowTracking : ORA.b #$80 : STA.l BowTracking ; enable bow toggle
LDA !INVENTORY_SWAP_2 : ORA #$80 : STA !INVENTORY_SWAP_2 ; enable bow toggle
REP #$20 ; set 16-bit accumulator
LDA.l CurrentRupees : !ADD.l FreeUncleItemAmount : STA.l CurrentRupees ; rupee arrows, so also give the player some money to start
LDA $7EF360 : !ADD.l FreeUncleItemAmount : STA $7EF360 ; rupee arrows, so also give the player some money to start
SEP #$20 ; set 8-bit accumulator
+
LDA.l ProgressIndicator : BNE +
LDA.b #$01 : STA.l ProgressIndicator ; handle rain state
+
RTL
;--------------------------------------------------------------------------------
OnAga2Defeated:
JSL.l Dungeon_SaveRoomData_justKeys ; thing we wrote over, make sure this is first
LDA.b #$01 : STA.l Aga2Duck
JML.l IncrementAgahnim2Sword
JSL.l Dungeon_SaveRoomData_justKeys ; thing we wrote over, make sure this is first
JML.l IncrementAgahnim2Sword
;--------------------------------------------------------------------------------
OnFileCreation:
; Copy initial SRAM state from ROM to cart SRAM
; If the inital SRAM table is move these addresses must be changed
PHB
LDA.w #$03D7 ; \
LDX.w #$B000 ; | Copies from beginning of inital sram table up to file name
LDY.w #$0000 ; | (exclusively)
MVN SRAMBank, SRAMTableBank ; /
; Skip file name and validity value
LDA.w #$010C ; \
LDX.w #$B3E3 ; | Rando-Specific Assignments & Game Stats block
LDY.w #$03E3 ; |
MVN SRAMBank, SRAMTableBank ; /
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
TAX ; what we wrote over
LDA StartingEquipment+$4C : STA $700340+$4C ; copy starting equipment swaps to file select screen
LDA StartingEquipment+$4E : STA $700340+$4E
LDA StartingEquipment+$4F : STA $700340+$4F ; copy starting bomb level
RTL
;--------------------------------------------------------------------------------
!RNG_ITEM_LOCK_IN = "$7F5090"
OnFileLoad:
@@ -127,19 +96,20 @@ OnFileLoad:
LDA.b #$07 : STA $210C ; Restore screen 3 to normal tile area
LDA.l FileMarker : BNE +
LDA !FRESH_FILE_MARKER : BNE +
JSL.l OnNewFile
LDA.b #$FF : STA.l FileMarker
LDA.b #$FF : STA !FRESH_FILE_MARKER
+
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)
JSL.l DoWorldFix
+
JSL.l MasterSwordFollowerClear
LDA.b #$FF : STA !RNG_ITEM_LOCK_IN ; reset rng item lock-in
LDA.b #$00 : STA $7F5001 ; mark fake flipper softlock as impossible
JSL.l InitOpenMode
LDA #$FF : STA !RNG_ITEM_LOCK_IN ; reset rng item lock-in
LDA #$00 : STA $7F5001 ; mark fake flipper softlock as impossible
LDA.l GenericKeys : BEQ +
LDA.l CurrentGenericKeys : STA.l CurrentSmallKeys ; copy generic keys to key counter
LDA $7EF38B : STA $7EF36F ; copy generic keys to key counter
+
JSL.l SetSilverBowMode
@@ -155,8 +125,39 @@ RTL
!RNG_ITEM_LOCK_IN = "$7F5090"
OnNewFile:
PHX : PHP
; reset some values on new file that are otherwise only reset on hard reset
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
STZ $03C4 ; ancilla slot index
STZ $047A ; EG
STZ $0B08 : STZ $0B09 ; arc variable
@@ -235,8 +236,8 @@ PreItemGet:
RTL
;--------------------------------------------------------------------------------
PostItemGet:
JML.l MaybeWriteSRAMTrace
RTL
;--------------------------------------------------------------------------------
PostItemAnimation:
LDA.b #$00 : STA !ITEM_BUSY ; mark item as finished
@@ -252,6 +253,6 @@ PostItemAnimation:
JSL.l IncrementChestTurnCounter
+
STZ $02E9 : LDA $0C5E, X ; thing we wrote over to get here
STZ $02E9 : LDA $0C5E, X ; thing we wrote over to get here
RTL
;--------------------------------------------------------------------------------

View File

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

View File

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

View File

@@ -1,6 +1,10 @@
!ExtendedPlayerName = "$700500"
!ValidKeyLoaded = "$7F509E"
;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_RED = "$0400"
@@ -132,36 +136,36 @@ DrawPlayerFileShared:
LDA.b #FileSelectItems>>16 : PHA : PLB
REP #$20 ; restore 16 bit accumulator
LDA ExtendedFileNameSRAM+$08 : ORA.w #!FS_COLOR_BW
LDA !ExtendedPlayerName+$00 : ORA.w #!FS_COLOR_BW
%fs_draw8x16(6,5)
LDA ExtendedFileNameSRAM+$0A : ORA.w #!FS_COLOR_BW
LDA !ExtendedPlayerName+$02 : ORA.w #!FS_COLOR_BW
%fs_draw8x16(6,6)
LDA ExtendedFileNameSRAM+$0C : ORA.w #!FS_COLOR_BW
LDA !ExtendedPlayerName+$04 : ORA.w #!FS_COLOR_BW
%fs_draw8x16(6,7)
LDA ExtendedFileNameSRAM+$0E : ORA.w #!FS_COLOR_BW
LDA !ExtendedPlayerName+$06 : ORA.w #!FS_COLOR_BW
%fs_draw8x16(6,8)
LDA ExtendedFileNameSRAM+$10 : ORA.w #!FS_COLOR_BW
LDA !ExtendedPlayerName+$08 : ORA.w #!FS_COLOR_BW
%fs_draw8x16(9,5)
LDA ExtendedFileNameSRAM+$12 : ORA.w #!FS_COLOR_BW
LDA !ExtendedPlayerName+$0A : ORA.w #!FS_COLOR_BW
%fs_draw8x16(9,6)
LDA ExtendedFileNameSRAM+$14 : ORA.w #!FS_COLOR_BW
LDA !ExtendedPlayerName+$0C : ORA.w #!FS_COLOR_BW
%fs_draw8x16(9,7)
LDA ExtendedFileNameSRAM+$16 : ORA.w #!FS_COLOR_BW
LDA !ExtendedPlayerName+$0E : ORA.w #!FS_COLOR_BW
%fs_draw8x16(9,8)
JSR FileSelectDrawHudBar
; Bow
LDA.l BowTrackingSRAM : AND.w #$0040 : BEQ +
LDA EquipmentSRAM+$00 : AND.w #$00FF : BEQ ++
LDA.l !FS_INVENTORY_SWAP_2 : AND.w #$0040 : BEQ +
LDA $700340 : AND.w #$00FF : BEQ ++
%fs_drawItem(3,12,FileSelectItems_silver_bow)
BRA .bow_end
++
%fs_drawItem(3,12,FileSelectItems_silver_arrow)
BRA .bow_end
+
LDA.l EquipmentSRAM : AND.w #$00FF : BEQ +
LDA.l $700340 : AND.w #$00FF : BEQ +
%fs_drawItem(3,12,FileSelectItems_bow)
BRA .bow_end
+
@@ -169,15 +173,15 @@ DrawPlayerFileShared:
.bow_end
; Boomerang
LDA.l InventoryTrackingSRAM : AND.w #$00C0 : CMP.w #$00C0 : BNE +
LDA.l !FS_INVENTORY_SWAP : AND.w #$00C0 : CMP.w #$00C0 : BNE +
%fs_drawItem(3,14,FileSelectItems_both_boomerang)
BRA .boomerang_end
+
LDA.l InventoryTrackingSRAM : AND.w #$0040 : BEQ +
LDA.l !FS_INVENTORY_SWAP : AND.w #$0040 : BEQ +
%fs_drawItem(3,14,FileSelectItems_red_boomerang)
BRA .boomerang_end
+
LDA.l InventoryTrackingSRAM : AND.w #$0080 : BEQ +
LDA.l !FS_INVENTORY_SWAP : AND.w #$0080 : BEQ +
%fs_drawItem(3,14,FileSelectItems_blue_boomerang)
BRA .boomerang_end
+
@@ -185,13 +189,13 @@ DrawPlayerFileShared:
.boomerang_end
; Hookshot
%fs_drawItemBasic(EquipmentSRAM+$02,3,16,FileSelectItems_hookshot)
%fs_drawItemBasic($700342,3,16,FileSelectItems_hookshot)
; Bombs
; %fs_drawItemBasic(EquipmentSRAM+$03,3,18,FileSelectItems_bombs)
; %fs_drawItemBasic($700343,3,18,FileSelectItems_bombs)
; Powder
LDA.l InventoryTrackingSRAM : AND.w #$0010 : BEQ +
LDA.l !FS_INVENTORY_SWAP : AND.w #$0010 : BEQ +
%fs_drawItem(3,20,FileSelectItems_powder)
BRA ++
+
@@ -199,7 +203,7 @@ DrawPlayerFileShared:
++
; Mushroom
LDA.l InventoryTrackingSRAM : AND.w #$0008 : BEQ +
LDA.l !FS_INVENTORY_SWAP : AND.w #$0008 : BEQ +
%fs_drawItem(3,18,FileSelectItems_mushroom)
BRA ++
+
@@ -207,7 +211,7 @@ DrawPlayerFileShared:
++
; Flute
LDA.l InventoryTrackingSRAM : AND.w #$0003 : BEQ +
LDA.l !FS_INVENTORY_SWAP : AND.w #$0003 : BEQ +
%fs_drawItem(7,16,FileSelectItems_flute)
BRA ++
+
@@ -215,7 +219,7 @@ DrawPlayerFileShared:
++
; Shovel
LDA.l InventoryTrackingSRAM : AND.w #$0004 : BEQ +
LDA.l !FS_INVENTORY_SWAP : AND.w #$0004 : BEQ +
%fs_drawItem(9,12,FileSelectItems_shovel)
BRA ++
+
@@ -223,60 +227,61 @@ DrawPlayerFileShared:
++
; Fire Rod
%fs_drawItemBasic(EquipmentSRAM+$05,5,12,FileSelectItems_fire_rod)
%fs_drawItemBasic($700345,5,12,FileSelectItems_fire_rod)
; Ice Rod
%fs_drawItemBasic(EquipmentSRAM+$06,5,14,FileSelectItems_ice_rod)
%fs_drawItemBasic($700346,5,14,FileSelectItems_ice_rod)
; Bombos Medallion
%fs_drawItemBasic(EquipmentSRAM+$07,5,16,FileSelectItems_bombos)
%fs_drawItemBasic($700347,5,16,FileSelectItems_bombos)
; Ether Medallion
%fs_drawItemBasic(EquipmentSRAM+$08,5,18,FileSelectItems_ether)
%fs_drawItemBasic($700348,5,18,FileSelectItems_ether)
; Quake Medallion
%fs_drawItemBasic(EquipmentSRAM+$09,5,20,FileSelectItems_quake)
%fs_drawItemBasic($700349,5,20,FileSelectItems_quake)
; Lamp
%fs_drawItemBasic(EquipmentSRAM+$0A,7,12,FileSelectItems_lamp)
%fs_drawItemBasic($70034A,7,12,FileSelectItems_lamp)
; Hammer
%fs_drawItemBasic(EquipmentSRAM+$0B,7,14,FileSelectItems_hammer)
%fs_drawItemBasic($70034B,7,14,FileSelectItems_hammer)
; Bug Net
%fs_drawItemBasic(EquipmentSRAM+$0D,7,18,FileSelectItems_bugnet)
%fs_drawItemBasic($70034D,7,18,FileSelectItems_bugnet)
; Book of Mudora
%fs_drawItemBasic(EquipmentSRAM+$0E,7,20,FileSelectItems_book)
%fs_drawItemBasic($70034E,7,20,FileSelectItems_book)
; Red Cane
%fs_drawItemBasic(EquipmentSRAM+$10,9,14,FileSelectItems_redcane)
%fs_drawItemBasic($700350,9,14,FileSelectItems_redcane)
; Blue Cane
%fs_drawItemBasic(EquipmentSRAM+$11,9,16,FileSelectItems_bluecane)
%fs_drawItemBasic($700351,9,16,FileSelectItems_bluecane)
; Cape
%fs_drawItemBasic(EquipmentSRAM+$12,9,18,FileSelectItems_cape)
%fs_drawItemBasic($700352,9,18,FileSelectItems_cape)
; Mirror
%fs_drawItemBasic(EquipmentSRAM+$13,9,20,FileSelectItems_mirror)
%fs_drawItemBasic($700353,9,20,FileSelectItems_mirror)
; Bottles
%fs_drawBottle(EquipmentSRAM+$1C,3,23)
%fs_drawBottle(EquipmentSRAM+$1D,5,23)
%fs_drawBottle(EquipmentSRAM+$1E,7,23)
%fs_drawBottle(EquipmentSRAM+$1F,9,23)
%fs_drawBottle($70035C,3,23)
%fs_drawBottle($70035D,5,23)
%fs_drawBottle($70035E,7,23)
%fs_drawBottle($70035F,9,23)
; Sword
LDA.l EquipmentSRAM+$19 : AND.w #$00FF : BNE +
LDA.l SpecialWeapons : AND.w #$00FF : CMP #$0001 : BEQ .bombSword
LDA.l $700359 : AND.w #$00FF : BNE +
%fs_drawItemGray(3,26,FileSelectItems_fighters_sword)
BRA ++
JMP ++
+ : DEC : BNE +
%fs_drawItem(3,26,FileSelectItems_fighters_sword)
BRA ++
JMP ++
+ : DEC : BNE +
%fs_drawItem(3,26,FileSelectItems_master_sword)
BRA ++
JMP ++
+ : DEC : BNE +
%fs_drawItem(3,26,FileSelectItems_tempered_sword)
BRA ++
@@ -286,10 +291,32 @@ DrawPlayerFileShared:
+
; a sword value above 4 is either corrupted or 0xFF (a.k.a. swordless)
%fs_drawItemGray(3,26,FileSelectItems_fighters_sword)
.bombSword
LDA.l $70038F : AND.w #$00FF : BNE +
%fs_drawItemGray(3,26,FileSelectItems_fighters_bombs)
BRA ++
+ : DEC : BNE +
%fs_drawItem(3,26,FileSelectItems_fighters_bombs)
BRA ++
+ : DEC : BNE +
%fs_drawItem(3,26,FileSelectItems_master_bombs)
BRA ++
+ : DEC : BNE +
%fs_drawItem(3,26,FileSelectItems_tempered_bombs)
BRA ++
+ : DEC : BNE +
%fs_drawItem(3,26,FileSelectItems_gold_bombs)
BRA ++
+ : DEC : BNE +
%fs_drawItem(3,26,FileSelectItems_extra_gold_bombs)
BRA ++
+
; a bomb value above 5 is... who knows, let's just pretend it's 5
%fs_drawItem(3,26,FileSelectItems_extra_gold_bombs)
++
; Shield
LDA.l EquipmentSRAM+$1A : AND.w #$00FF : BNE +
LDA.l $70035A : AND.w #$00FF : BNE +
%fs_drawItemGray(5,26,FileSelectItems_fighters_shield)
BRA ++
+ : DEC : BNE +
@@ -303,7 +330,7 @@ DrawPlayerFileShared:
++
; Mail
LDA.l EquipmentSRAM+$1B : AND.w #$00FF : BNE +
LDA.l $70035B : AND.w #$00FF : BNE +
%fs_drawItem(7,26,FileSelectItems_green_mail)
BRA ++
+ : DEC : BNE +
@@ -314,7 +341,7 @@ DrawPlayerFileShared:
++
; Heart Pieces
LDA.l EquipmentSRAM+$2B : AND.w #$00FF : BNE +
LDA.l $70036B : AND.w #$00FF : BNE +
%fs_drawItem(9,26,FileSelectItems_heart_piece_0_of_4)
BRA ++
+ : DEC : BNE +
@@ -327,16 +354,16 @@ DrawPlayerFileShared:
%fs_drawItem(9,26,FileSelectItems_heart_piece_3_of_4)
++
LDA EquipmentSRAM+$0108 : AND.w #$00FF
LDA $700448 : AND.w #$00FF
JSL.l HexToDec
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)
; Boots
%fs_drawItemBasic(EquipmentSRAM+$15,3,28,FileSelectItems_boots)
%fs_drawItemBasic($700355,3,28,FileSelectItems_boots)
; Gloves
LDA.l EquipmentSRAM+$14 : AND.w #$00FF : BNE +
LDA.l $700354 : AND.w #$00FF : BNE +
%fs_drawItemGray(5,28,FileSelectItems_gloves)
BRA ++
+ : DEC : BNE +
@@ -347,27 +374,27 @@ DrawPlayerFileShared:
++
; Flippers
%fs_drawItemBasic(EquipmentSRAM+$16,7,28,FileSelectItems_flippers)
%fs_drawItemBasic($700356,7,28,FileSelectItems_flippers)
; Moon Pearl
%fs_drawItemBasic(EquipmentSRAM+$17,9,28,FileSelectItems_pearl)
%fs_drawItemBasic($700357,9,28,FileSelectItems_pearl)
; Pendants
LDA EquipmentSRAM+$34 : AND.w #$0004 : BEQ +
LDA $700374 : AND.w #$0004 : BEQ +
%fs_drawItem(12,12,FileSelectItems_green_pendant)
BRA ++
+
%fs_drawItem(12,12,FileSelectItems_no_pendant)
++
LDA EquipmentSRAM+$34 : AND.w #$0002 : BEQ +
LDA $700374 : AND.w #$0002 : BEQ +
%fs_drawItem(12,14,FileSelectItems_blue_pendant)
BRA ++
+
%fs_drawItem(12,14,FileSelectItems_no_pendant)
++
LDA EquipmentSRAM+$34 : AND.w #$0001 : BEQ +
LDA $700374 : AND.w #$0001 : BEQ +
%fs_drawItem(12,16,FileSelectItems_red_pendant)
BRA ++
+
@@ -375,49 +402,49 @@ DrawPlayerFileShared:
++
; Crystals
LDA EquipmentSRAM+$3A : AND.w #$0002 : BEQ +
LDA $70037A : AND.w #$0002 : BEQ +
LDA.w #$0297|!FS_COLOR_BLUE
BRA ++
+
LDA.w #$0287|!FS_COLOR_GRAY
++ : %fs_draw16x8(13,18)
LDA EquipmentSRAM+$3A : AND.w #$0010 : BEQ +
LDA $70037A : AND.w #$0010 : BEQ +
LDA.w #$0297|!FS_COLOR_BLUE
BRA ++
+
LDA.w #$0287|!FS_COLOR_GRAY
++ : %fs_draw16x8(12,19)
LDA EquipmentSRAM+$3A : AND.w #$0040 : BEQ +
LDA $70037A : AND.w #$0040 : BEQ +
LDA.w #$0297|!FS_COLOR_BLUE
BRA ++
+
LDA.w #$0287|!FS_COLOR_GRAY
++ : %fs_draw16x8(13,20)
LDA EquipmentSRAM+$3A : AND.w #$0020 : BEQ +
LDA $70037A : AND.w #$0020 : BEQ +
LDA.w #$0297|!FS_COLOR_BLUE
BRA ++
+
LDA.w #$0287|!FS_COLOR_GRAY
++ : %fs_draw16x8(12,21)
LDA EquipmentSRAM+$3A : AND.w #$0004 : BEQ +
LDA $70037A : AND.w #$0004 : BEQ +
LDA.w #$0297|!FS_COLOR_RED
BRA ++
+
LDA.w #$0287|!FS_COLOR_GRAY
++ : %fs_draw16x8(13,22)
LDA EquipmentSRAM+$3A : AND.w #$0001 : BEQ +
LDA $70037A : AND.w #$0001 : BEQ +
LDA.w #$0297|!FS_COLOR_RED
BRA ++
+
LDA.w #$0287|!FS_COLOR_GRAY
++ : %fs_draw16x8(12,23)
LDA EquipmentSRAM+$3A : AND.w #$0008 : BEQ +
LDA $70037A : AND.w #$0008 : BEQ +
LDA.w #$0297|!FS_COLOR_BLUE
BRA ++
+
@@ -556,29 +583,59 @@ FileSelectItems:
.good_bee_bottle
dw #$0240|!FS_COLOR_BW, #$0241|!FS_COLOR_BW, #$0254|!FS_COLOR_YELLOW, #$0246|!FS_COLOR_YELLOW
.fighters_bombs
dw #$020C|!FS_COLOR_GREEN, #$020D|!FS_COLOR_GREEN, #$021C|!FS_COLOR_GREEN, #$02A1|!FS_COLOR_GREEN
.master_bombs
dw #$020C|!FS_COLOR_BLUE, #$020D|!FS_COLOR_BLUE, #$021C|!FS_COLOR_BLUE, #$02A2|!FS_COLOR_BLUE
.tempered_bombs
dw #$020C|!FS_COLOR_RED, #$020D|!FS_COLOR_RED, #$021C|!FS_COLOR_RED, #$02A3|!FS_COLOR_RED
.gold_bombs
dw #$020C|!FS_COLOR_YELLOW, #$020D|!FS_COLOR_YELLOW, #$021C|!FS_COLOR_YELLOW, #$02A4|!FS_COLOR_YELLOW
.extra_gold_bombs
dw #$020C|!FS_COLOR_YELLOW, #$020D|!FS_COLOR_YELLOW, #$021C|!FS_COLOR_YELLOW, #$02A5|!FS_COLOR_YELLOW
;--------------------------------------------------------------------------------
FileSelectDrawHudBar:
LDA #$029B|!FS_COLOR_GREEN : %fs_draw16x8(0,10)
LDA EquipmentSRAM+$22
LDA $700362
JSL.l HexToDec
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 $7F5006 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(1,11)
LDA $7F5007 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(1,12)
LDA SpecialWeapons : AND.w #$00FF : CMP #$0001 : BEQ .colorBombs
LDA #$028B|!FS_COLOR_BLUE : %fs_draw16x8(0,14)
LDA EquipmentSRAM+$03 : AND.w #$00FF
LDA $700343 : AND.w #$00FF
JSL.l HexToDec
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)
BRA ++
.colorBombs
LDA $70038F : AND.w #$00FF : BNE +
; no bombs, draw no icon
BRA ++
+ : DEC : BNE +
LDA #$028B|!FS_COLOR_GREEN : %fs_draw16x8(0,14)
BRA ++
+ : DEC : BNE +
LDA #$028B|!FS_COLOR_BLUE : %fs_draw16x8(0,14)
BRA ++
+ : DEC : BNE +
LDA #$028B|!FS_COLOR_RED : %fs_draw16x8(0,14)
BRA ++
+
LDA #$028B|!FS_COLOR_YELLOW : %fs_draw16x8(0,14)
++
LDA.l BowTrackingSRAM : AND.w #$0040 : BEQ +
LDA.l !FS_INVENTORY_SWAP_2 : AND.w #$0040 : BEQ +
LDA #$0299|!FS_COLOR_RED : %fs_draw16x8(0,17)
BRA ++
+
LDA #$0289|!FS_COLOR_BROWN : %fs_draw16x8(0,17)
++
LDA EquipmentSRAM+$37 : AND.w #$00FF
LDA $700377 : AND.w #$00FF
JSL.l HexToDec
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)
@@ -787,16 +844,16 @@ DrawPlayerFile_credits:
; see $6563C for drawing first file name and hearts
REP #$20 ; set 16 bit accumulator
LDA EquipmentSRAM+$99 : ORA.w #!FS_COLOR_BW
LDA $7003D9 : ORA.w #!FS_COLOR_BW
%fs_draw8x16(3,5)
LDA EquipmentSRAM+$9B : ORA.w #!FS_COLOR_BW
LDA $7003DB : ORA.w #!FS_COLOR_BW
%fs_draw8x16(3,6)
LDA EquipmentSRAM+$9D : ORA.w #!FS_COLOR_BW
LDA $7003DD : ORA.w #!FS_COLOR_BW
%fs_draw8x16(3,7)
LDA EquipmentSRAM+$9F : ORA.w #!FS_COLOR_BW
LDA $7003DF : ORA.w #!FS_COLOR_BW
%fs_draw8x16(3,8)
LDA EquipmentSRAM+$2C : AND.w #$00FF : LSR #3 : STA $02
LDA $70036C : AND.w #$00FF : LSR #3 : STA $02
%fs_LDY_screenpos(0,20)
LDA.w #$028F|!FS_COLOR_RED
LDX.w #$000A
@@ -866,21 +923,3 @@ JML FSSelectFile_continue
LDA.b #$3C : STA $012E ; play error sound
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:
PHP
LDA $5D : CMP #$04 : BNE .done ; skip if we're not swimming
LDA FlippersEquipment : BNE .done ; skip if we have the flippers
LDA $7EF356 : BNE .done ; skip if we have the flippers
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
;JSL.l KillFairies ; take away fairies
LDA IgnoreFaeries : ORA.b #$04 : STA IgnoreFaeries
LDA.b #$00 : STA CurrentHealth ; kill link
LDA !IGNORE_FAIRIES : ORA.b #$04 : STA !IGNORE_FAIRIES
LDA.b #$00 : STA $7EF36D ; kill link
LDA.b #$00 : STA $7F5001 ; mark fake flipper softlock as impossible
.done
PLP
LDA CurrentHealth ; thing we wrote over
LDA $7EF36D ; thing we wrote over
RTL
;--------------------------------------------------------------------------------
IgnoreFairyCheck:
LDX.b #$00 ; thing we wrote over
LDA IgnoreFaeries : BIT.b #$04 : BEQ .normal
LDA !IGNORE_FAIRIES : BIT.b #$04 : BEQ .normal
AND.b #$FB : STA IgnoreFaeries ; clear ignore fairy flag
AND.b #$FB : STA !IGNORE_FAIRIES ; clear ignore fairy flag
LDA.b #$F0 ; set check to invalid entry
RTL
.normal
@@ -28,14 +28,14 @@ RTL
RTL
;--------------------------------------------------------------------------------
;KillFairies:
; LDA BottleContentsOne : CMP #$06 : BNE +
; LDA #$02 : STA BottleContentsOne
; + LDA BottleContentsTwo : CMP #$06 : BNE +
; LDA #$02 : STA BottleContentsTwo
; + LDA BottleContentsThree : CMP #$06 : BNE +
; LDA #$02 : STA BottleContentsThree
; + LDA BottleContentsFour : CMP #$06 : BNE +
; LDA #$02 : STA BottleContentsFour
; LDA $7EF35C : CMP #$06 : BNE +
; LDA #$02 : STA $7EF35C
; + LDA $7EF35D : CMP #$06 : BNE +
; LDA #$02 : STA $7EF35D
; + LDA $7EF35E : CMP #$06 : BNE +
; LDA #$02 : STA $7EF35E
; + LDA $7EF35F : CMP #$06 : BNE +
; LDA #$02 : STA $7EF35F
; +
;RTL
;--------------------------------------------------------------------------------
@@ -47,7 +47,7 @@ RTL
;--------------------------------------------------------------------------------
FlipperFlag:
LDA $5D : CMP #$04 : BNE .done ; skip if we're not swimming
LDA FlippersEquipment : BNE .safe ; skip if we have the flippers
LDA $7EF356 : BNE .safe ; skip if we have the flippers
LDA #$01 : STA $7F5001 ; mark fake flipper softlock as possible
BRA .done
.safe

View File

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

View File

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

View File

@@ -1,22 +1,46 @@
;================================================================================
; 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:
JSL $0080B5 ; Module_MainRouting
JSL CheckMusicLoadRequest
PHP : REP #$30 : PHA
SEP #$20
;LDA EnableSRAMTrace : AND.l TournamentSeedInverse : BEQ +
; LDA $1A : BNE ++ : JSL.l WriteStatusPreview : ++ ; write every 256 frames
;+
LDA StatsLocked : BNE ++
LDA !LOCK_STATS : BNE ++
REP #$20 ; set 16-bit accumulator
LDA LoopFrames : INC : STA LoopFrames : BNE +
LDA LoopFrames+2 : INC : STA LoopFrames+2
LDA !LOOP_FRAMES_LOW : INC : STA !LOOP_FRAMES_LOW : BNE +
LDA !LOOP_FRAMES_HIGH : INC : STA !LOOP_FRAMES_HIGH
+
LDA $10 : CMP.w #$010E : BNE + ; move this to nmi hook?
LDA MenuFrames : INC : STA MenuFrames : BNE +
LDA MenuFrames+2 : INC : STA MenuFrames+2
LDA !ITEM_FRAMES_LOW : INC : STA !ITEM_FRAMES_LOW : BNE +
LDA !ITEM_FRAMES_HIGH : INC : STA !ITEM_FRAMES_HIGH
+
;SEP #$20 ; set 8-bit accumulator ?? check this
++
REP #$30 : PLA : PLP
RTL
@@ -24,9 +48,9 @@ RTL
NMIHookAction:
PHA : PHX : PHY : PHD ; thing we wrote over, push stuff
LDA StatsLocked : AND.w #$00FF : BNE ++
LDA NMIFrames : INC : STA NMIFrames : BNE +
LDA NMIFrames+2 : INC : STA NMIFrames+2
LDA !LOCK_STATS : AND.w #$00FF : BNE ++
LDA !NMI_FRAMES_LOW : INC : STA !NMI_FRAMES_LOW : BNE +
LDA !NMI_FRAMES_HIGH : INC : STA !NMI_FRAMES_HIGH
+
++
@@ -56,4 +80,4 @@ PostNMIHookAction:
LDA $13 : STA $2100 ; thing we wrote over, turn screen back on
JML.l PostNMIHookReturn
;--------------------------------------------------------------------------------
;--------------------------------------------------------------------------------

74
generate_bomb_table.rb Normal file
View File

@@ -0,0 +1,74 @@
def process_values(sprite, values)
ret = values.clone
if [1, 2].include?(ret[0]) # boomerang
if sprite == 0x53 # armos knight
ret[0] = 0 # do nothing
else
ret[0] = 5 # stun very briefly instead of damage
end
end
if ret[6] > 0 && sprite != 0x84 # bow and not red eyegore/mimic
ret[6] = 0
end
if ret[7] == 2 # hookshot
ret[7] = 1 # still want to stun
end
if [1, 2, 7].include?(ret[8]) && sprite != 0x92 # bomb and not helmasaur king
ret[8] = 0
end
if ret[9] > 0 && sprite != 0x84 # silver bow and not red eyegore/mimic
ret[9] = 0
end
if ret[10] == 4 # powder
ret[10] = 0
end
if ret[11] > 0 && ![0xA1, 0xA3, 0xCD].include?(sprite) # fire rod
ret[11] = 0
end
if ret[12] != 3 && sprite != 0xCC # ice rod
ret[12] = 0
end
if ret[13] > 0 && ![0xA3, 0xA1].include?(sprite) # bombos
ret[13] = 0
end
if ret[14] != 1 # ether
ret[14] = 0
end
if [1, 2].include?(ret[15]) # quake
ret[15] = 0
end
if sprite == 0x53 and ret[2] == 3
ret[2] = 1 # armos knight? let's make class 2 not suck
end
return ret
end
def split_value(byte)
return [byte >> 4, byte & 0x0F]
end
def join_values(value1, value2)
return (value1 & 0x0F) << 4 | (value2 & 0x0F)
end
File.open("damage_table.bin") do |input|
File.open("damage_table_sword_bombs.bin", "w") do |output|
i_enum = input.each_byte
(0...0xD7).each do |sprite|
values = []
(0...8).each do
values += split_value(i_enum.next)
end
v_enum = process_values(sprite, values).to_enum
(0...8).each do
output.putc(join_values(v_enum.next, v_enum.next))
end
end
begin
while true
output.putc(i_enum.next)
end
rescue StopIteration
end
end
end

View File

@@ -0,0 +1,38 @@
def process_values(sprite, values)
ret = values.clone
if (ret[1] == 0 && sprite != 0x40) || sprite == 0xCE
# fighter sword does no damage and it's not the evil barrier, or it's Blind
ret[5] = 0
end
return ret
end
def split_value(byte)
return [byte >> 4, byte & 0x0F]
end
def join_values(value1, value2)
return (value1 & 0x0F) << 4 | (value2 & 0x0F)
end
File.open("damage_table.bin") do |input|
File.open("damage_table_pseudo_sword.bin", "w") do |output|
i_enum = input.each_byte
(0...0xD7).each do |sprite|
values = []
(0...8).each do
values += split_value(i_enum.next)
end
v_enum = process_values(sprite, values).to_enum
(0...8).each do
output.putc(join_values(v_enum.next, v_enum.next))
end
end
begin
while true
output.putc(i_enum.next)
end
rescue StopIteration
end
end
end

View File

@@ -16,20 +16,20 @@ GetAgahnimDeath:
CMP.b #13 : BNE + ; Agahnim 2 room
LDA.l Bugfix_SetWorldOnAgahnimDeath : BEQ ++
LDA.l InvertedMode : BEQ +++
LDA.b #$00 : STA CurrentWorld ; Switch to light world
LDA.b #$00 : STA !DARK_WORLD ; Switch to light world
BRA ++
+++
LDA.b #$40 : STA CurrentWorld ; Switch to dark world
LDA.b #$40 : STA !DARK_WORLD ; Switch to dark world
++
LDA.b #$01 ; Use Agahnim 2
RTL
+ ; Elsewhere
LDA.l Bugfix_SetWorldOnAgahnimDeath : BEQ ++
LDA.l InvertedMode : BEQ +++
LDA.b #$40 : STA CurrentWorld ; Switch to dark world
LDA.b #$40 : STA !DARK_WORLD ; Switch to dark world
BRA ++
+++
LDA.b #$00 : STA CurrentWorld ; Switch to light world
LDA.b #$00 : STA !DARK_WORLD ; Switch to light world
; (This will later get flipped to DW when Agahnim 1
; warps us to the pyramid)
++

View File

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

View File

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

View File

@@ -32,7 +32,7 @@ CalculateByrnaUsage:
LDA.l HardModeExclusionCaneOfByrnaUsage, X : STA $00
PLX
++
LDA CurrentMagic ; thing we wrote over
LDA $7EF36E ; thing we wrote over
JML IncrementMagicUseCounterByrna
;--------------------------------------------------------------------------------
CalculateCapeUsage:
@@ -76,12 +76,18 @@ GetItemDamageValue:
CPX.b #$04 : BEQ .boomerang
CPX.b #$05 : BEQ .boomerang
CPX.b #$39 : BEQ .hookshot
CPX.b #$3b : BEQ .hookshot
CPX.b #$3c : BEQ .hookshot
CPX.b #$3d : BEQ .hookshot
CPX.b #$3B : BEQ .hookshot
CPX.b #$3C : BEQ .hookshot
CPX.b #$3D : BEQ .hookshot
LDA.l SpecialWeapons : CMP #$02 : BNE .normal
TXA : AND #$78 : CMP #$28 : BNE .normal
LDA $0DB8F1, X : BEQ .noDamage
LDA #$01
RTL
.normal
lda $0db8f1,x ;what we wrote over
LDA $0DB8F1, X ; what we wrote over
RTL
.boomerang
LDA.l StunItemAction : AND #$01 : BNE .normal

View File

@@ -15,7 +15,7 @@ HeartPieceGet:
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
LDA HeartPieceQuarter : INC A : AND.b #$03 : STA HeartPieceQuarter : BNE .unfinished_heart ; add up heart quarters
LDA $7EF36B : INC A : AND.b #$03 : STA $7EF36B : BNE .unfinished_heart ; add up heart quarters
BRA .giveItem
.notHeart
@@ -130,7 +130,7 @@ HeartUpgradeSpawnDecision: ; this should return #$00 to make the hp spawn
RTL
.normal_behavior
LDA OverworldEventDataWRAM, X
LDA $7EF280, X
RTL
;--------------------------------------------------------------------------------
SaveHeartCollectedStatus:
@@ -140,7 +140,7 @@ SaveHeartCollectedStatus:
RTL
.normal_behavior
LDA OverworldEventDataWRAM, X : ORA.b #$40 : STA OverworldEventDataWRAM, X
LDA $7EF280, X : ORA.b #$40 : STA $7EF280, X
RTL
;--------------------------------------------------------------------------------
!REDRAW = "$7F5000"
@@ -195,7 +195,7 @@ MaybeMarkDigSpotCollected:
REP #$20 ; set 16-bit accumulator
LDA $8A
CMP.w #$2A : BNE +
LDA HasGroveItem : ORA.w #$0001 : STA HasGroveItem
LDA !HAS_GROVE_ITEM : ORA.w #$0001 : STA !HAS_GROVE_ITEM
+
PLP : PLA
RTL

203
hooks.asm
View File

@@ -38,33 +38,11 @@ JML.l CheckZSNES
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)
;--------------------------------------------------------------------------------
org $02D8C7 ; <- 158C7 - Bank02.asm : 10981 (STA $7EC172)
JSL.l OnDungeonEntrance
;org $02D8C7 ; <- 158C7 - Bank02.asm : 10981 (STA $7EC172)
;JSL.l OnDungeonEntrance
;--------------------------------------------------------------------------------
;================================================================================
@@ -188,7 +166,7 @@ JSL.l AltBufferTable : NOP #8 ; Delete screen
;--------------------------------------------------------------------------------
org $0CCCCC ;<- 64CCC - Bank0C.asm : 1628 (JSL Intro_ValidateSram) / Bank02.asm : 75 (REP #$30)
; Explanation: In JP 1.0 the code for Intro_ValidateSram was inline in Bank 0C
JML.l ValidateSRAM ;(Return via RTL. Original code JML'd to Intro_LoadSpriteStats which returns with RTL, but we want to skip that)
JML.l Validate_SRAM ;(Return via RTL. Original code JML'd to Intro_LoadSpriteStats which returns with RTL, but we want to skip that)
org $0CCD57 ;<- 64D57 - Bank0C.asm :
RTL ;Just in case anybody ever removes the previous hook
;--------------------------------------------------------------------------------
@@ -236,8 +214,6 @@ LDA.l HeartCursorPositions, X
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
JSL.l WrapCharacterPosition : NOP
org $0CD75E ; bank_0C.asm (dl NameFile_MakeScreenVisible)
dl MaybeForceFileName
;--------------------------------------------------------------------------------
org $0CE43A ; No assembly source. Makes name entry box wider
db $2C
@@ -299,17 +275,12 @@ BRA +
;================================================================================
; Extended SRAM Save file
;--------------------------------------------------------------------------------
org $0CCF08 ; <- Bank0C.asm : 2036 (LDA.w #$0007 : STA $7EC00D : STA $7EC013)
org $0ccf08 ; <- Bank0C.asm : 2036 (LDA.w #$0007 : STA $7EC00D : STA $7EC013)
JSL CopyExtendedSaveFileToWRAM
;--------------------------------------------------------------------------------
org $008998 ; <- Bank00.asm : 1296 (LDX.w #$0000)
JSL CopyExtendedWRAMSaveFileToSRAM
;--------------------------------------------------------------------------------
org $00899C ; <- bank_00.asm : #_00899C (CLC)
JSL WriteSaveChecksumAndBackup
LDA.w #$01F3 : TCS : SEP #$30 : PLB : RTL ; Get the stack and data bank correct
padbyte $FF : pad $0089C2 ; Fill adjacent free rom forward. See bank_00.asm: #_0089C2
;--------------------------------------------------------------------------------
org $0CD7AB ; <- Bank0C.asm : 3342 (STA $700400, X)
JSL.l ClearExtendedSaveFile
;--------------------------------------------------------------------------------
@@ -337,8 +308,9 @@ org $0CCE85 ; <- Bank0C.asm : 1953 (LDA $C8 : ASL A : INC #2 : STA $701FFE)
NOP #4
;--------------------------------------------------------------------------------
org $0CDB4C ; <- Bank0C.asm : 3655 (LDA $C8 : ASL A : INC #2 : STA $701FFE : TAX)
JML OnFileCreation
JSL OnFileCreation
NOP
;Additionally, display inventory swap starting equipment on file select
;--------------------------------------------------------------------------------
org $09F5EA ; <- module_death.asm : 510 (LDA $701FFE : TAX : DEX #2)
LDA.w #$0002 : NOP
@@ -388,9 +360,6 @@ JSL.l LoadBombCount
org $098133 ; <- 48133 - ancilla_init.asm : 211 (STA $7EF343 : BNE .bombs_left_over)
JSL.l StoreBombCount
;--------------------------------------------------------------------------------
org $0DE4BF ; <- 6E4BF - equipment.asm : 1249 (LDA $7EF343 : AND.w #$00FF : BEQ .gotNoBombs)
JSL.l LoadBombCount16
;--------------------------------------------------------------------------------
org $0DDEB3 ; <- 6DEB3 - equipment.asm : 328 (LDA $7EF33F, X)
JSL.l IsItemAvailable
;--------------------------------------------------------------------------------
@@ -562,13 +531,17 @@ JSL.l CheckGanonHammerDamage : NOP
org $02B797 ; <- 13797 - Bank02.asm : 8712 (LDA.b #$19 : STA $10)
JSL.l StatsFinalPrep
;--------------------------------------------------------------------------------
org $07A95B ; <- 3A95B - Bank07.asm : 6565 (JSL Dungeon_SaveRoomDataWRAM)
org $07A95B ; <- 3A95B - Bank07.asm : 6565 (JSL Dungeon_SaveRoomData)
JSL.l IncrementUWMirror
;--------------------------------------------------------------------------------
org $0288D1 ; <- 108D1 - Bank02.asm : 1690 (STZ $0646)
JSL.l IndoorSubtileTransitionCounter
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)
;JSL.l IncrementSmallKeys
;--------------------------------------------------------------------------------
@@ -736,7 +709,7 @@ JSL.l GetItemDamageValue
;================================================================================
; Misc Stats
;--------------------------------------------------------------------------------
org $029E2E ; <- 11E2E - module_ganon_emerges.asm : 59 (JSL Dungeon_SaveRoomDataWRAM.justKeys)
org $029E2E ; <- 11E2E - module_ganon_emerges.asm : 59 (JSL Dungeon_SaveRoomData.justKeys)
JSL.l OnAga2Defeated
;--------------------------------------------------------------------------------
org $0DDBDE ; <- 6DBDE - headsup_display.asm : 105 (DEC A : BPL .subtractRupees)
@@ -985,12 +958,9 @@ LDA.w AddReceivedItemExpanded_item_target_addr+1, X
org $09861F ; 4861F - ancilla_init.asm:724 (LDA .item_values, Y)
LDA.w AddReceivedItemExpanded_item_values, Y
org $098627 ; 48627 - ancilla_init.asm:731 (LDA .item_target_addr+0, X)
LDA.w AddReceivedItemExpanded_item_target_addr+0, X
org $09862C ; 4862C - ancilla_init.asm:722 (LDA .item_target_addr+1, X)
LDA.w AddReceivedItemExpanded_item_target_addr+1, X
org $098635 ; 48635 - ancilla_init.asm:727 (LDA .item_values, Y)
LDA.w AddReceivedItemExpanded_item_values, Y
org $098624 ; 48624 - ancilla_init.asm:728 (TYA : ASL A : TAX)
JSL.l UpdateInventoryLocationExpanded
BRA + : NOP #18 : +
org $0986AA ; 486AA - ancilla_init.asm:848 (LDA .item_masks, X)
LDA.w AddReceivedItemExpanded_item_masks, X
@@ -1702,7 +1672,7 @@ JSL.l FixAga2Bunny : NOP
; Open Mode Fixes
;--------------------------------------------------------------------------------
org $05DF65 ; <- 2DF65 - sprite_uncle_and_priest.asm:994 - (LDA.b #$01 : STA $7EF3C5)
NOP #6
JSL.l SetUncleRainState : RTS
;--------------------------------------------------------------------------------
;org $0280DD ; <- 100DD - Bank02.asm:298 - (LDA $7EF3C5 : CMP.b #$02 : BCC .indoors)
;JSL.l ForceLinksHouse
@@ -2125,7 +2095,7 @@ JSL.l ItemCheck_TreeKid2
org $06AF9B ; <- 32F9B - FluteBoy_Chillin : 73 : LDA $7EF34C : CMP.b #$02 : BCS .player_has_flute
;NOP #8
LDA HasGroveItem : AND.b #$01
LDA !HAS_GROVE_ITEM : AND.b #$01
db #$D0 ; BNE
org $06B062 ; <- 33062 - FluteAardvark_InitialStateFromFluteState : 225 : LDA $7EF34C : AND.b #$03 : !BGE #$05
@@ -2362,9 +2332,6 @@ NOP #6
;--------------------------------------------------------------------------------
org $09865E ; <- 4865E
JSL.l $1BEE1B ; fix something i wrote over i shouldn't have
;--------------------------------------------------------------------------------
org $098638 ; <- 48638 - ancilla_init.asm:737 - LDA .item_values, Y : BMI .dontWrite (BMI)
JSL.l ItemDowngradeFix
;================================================================================
;================================================================================
@@ -2422,13 +2389,15 @@ Overworld_Hole_End:
;--------------------------------------------------------------------------------
;================================================================================
; Replace pyramid hole check for killing aga2
; Disable pyramid hole check for killing aga2
;
; this check is intended to prevent getting fluted out a second time if you
; return to his room after already killing him once.
; return to his room after already killing him once. But with a pre-opened
; 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 $01C74E ; 00C74E - bank_01.asm:13281 - (LDA.l $7EF2DB : AND.b #$20)
LDA.l Aga2Duck : NOP #2
org $01C753 ; 0C753 = Bank01:10398 (LDA $7EF2DB : AND.b #$20 : BNE .return)
db $00 ; (originally $20)
;================================================================================
; Music fixes
@@ -2494,7 +2463,7 @@ org $00DF62 ; <- Bank00.asm:4672 (LDX.w #$0000 : LDY.w #$0040)
JML ReloadingFloors
NOP : NOP
ReloadingFloorsResume:
org $00DF6E ; <- A few instructions later, right after JSR Do3To.high16Bit
org $00DF6E ; <- A few instructions later, right after JSR Do3To4High16Bit
ReloadingFloorsCancel:
;================================================================================
@@ -2505,7 +2474,7 @@ org $07A055 ; <- Bank07.asm:5205 (LDA $0B99 : BEQ BRANCH_DELTA)
JSL.l ArrowGame : NOP #14
org $07A06C ; <- Bank07.asm:5215 (LDA $7EF377 : BEQ BRANCH_EPSILON)
JSL.l DecrementArrows : SKIP 2 : NOP : LDA CurrentArrows
JSL.l DecrementArrows : SKIP 2 : NOP : LDA $7EF377
;================================================================================
;================================================================================
@@ -2781,6 +2750,128 @@ org $01C536 : JSL FixJingleGlitch
org $01C592 : JSL FixJingleGlitch
org $01C65F : JSL FixJingleGlitch
;================================================================================
; Bomb-Only Mode
;--------------------------------------------------------------------------------
org $06ECC3 ; Bank06.asm@4704 (PHX : TAX : LDA.l .damage_classes, X : PLX)
JSL DamageClassCalc
BRA + : NOP #29 : +
;--------------------------------------------------------------------------------
org $0882D4 ; Bank08.asm@445 (PHX : TYX : ... )
JSL Utility_CheckAncillaOverlapWithSprite
BRA + : NOP #5 : +
;--------------------------------------------------------------------------------
org $088DB1 ; Bank08.asm@1207 (PHY : PHX : TYX : ... )
JSL Utility_CheckAncillaOverlapWithSprite
BRA + : NOP #7 : +
;--------------------------------------------------------------------------------
org $08E252 ; Bank08.asm@1770 (PHY : PHX : TYX : ... )
JSL Utility_CheckAncillaOverlapWithSprite
BRA + : NOP #7 : +
;--------------------------------------------------------------------------------
org $0882E8 ; Bank08.asm@456 (LDA $0DB0, Y : CMP.b #$03)
JSL Utility_CheckHelmasaurKingCollision
NOP
;--------------------------------------------------------------------------------
org $1E838C ; sprite_helmasaur_king.asm@522 (LDA $0301 : AND.b #$0A)
JSL Utility_CheckHammerHelmasaurKingMask
NOP
;--------------------------------------------------------------------------------
org $06ED94 ; Bank06.asm@4866 (LDA $0E60, X : AND.b #$40)
JSL Utility_CheckImpervious
NOP
;--------------------------------------------------------------------------------
org $068F94 ; sprite_prep.asm@1984 (INC $0BA0, X : JSL Sprite_InitializedSegmented)
JSL AllowBombingMoldorm
BRA + : NOP : +
;--------------------------------------------------------------------------------
org $06892F ; sprite_prep.asm@548 (LDA $0D00, X : SUB #$0C : STA $0D00, X : ...)
JSL AllowBombingBarrier
RTS : NOP #7
;--------------------------------------------------------------------------------
org $0DE4BF ; equipment.asm@1247 (LDA $7EF343 : AND.w #$00FF : BEQ .gotNoBombs : ...)
JSL DrawBombInMenu
BRA + : NOP #13 : +
;--------------------------------------------------------------------------------
org $0DFB6A ; headsup_display@727 (CPX #$0004 : BNE .bombsNotEquipped : LDA #$0001)
JSL DrawBombInYBox
BRA + : NOP #2 : +
;--------------------------------------------------------------------------------
org $0DEE05 ; equipment.asm@2065 (LDA $7EF359 : AND.w #$00FF : CMP.w #$00FF : ...)
JSL DrawSwordInMenu
BRA + : NOP #16 : +
;--------------------------------------------------------------------------------
org $0DFA92 ; headsup_display.asm@622 (PDB : LDA.w #$0149 : ...)
JSL DrawBombOnHud
BRA + : NOP #8 : +
;--------------------------------------------------------------------------------
org $089EF8 ; ancilla_bomb@1438 (LDA.w #$04 : STA $0B)
JSL SetBombSpriteColor
;--------------------------------------------------------------------------------
; bomb icons with numbers
org $0DFC51 ; is this being used? I hope not! let's find out if anything breaks!
db $F5, $20, $F5, $20, $F5, $20, $F5, $20
db $B2, $3C, $B3, $3C, $C2, $3C, $17, $3C
db $B2, $2C, $B3, $2C, $C2, $2C, $18, $2C
db $B2, $24, $B3, $24, $C2, $24, $19, $24
db $B2, $28, $B3, $28, $C2, $28, $1A, $28
db $B2, $28, $B3, $28, $C2, $28, $1B, $28
; bomb icons without numbers
org $0DFC81
db $F5, $20, $F5, $20, $F5, $20, $F5, $20
db $B2, $3C, $B3, $3C, $C2, $3C, $C2, $7C
db $B2, $2C, $B3, $2C, $C2, $2C, $C2, $6C
db $B2, $24, $B3, $24, $C2, $24, $C2, $64
db $B2, $28, $B3, $28, $C2, $28, $C2, $68
db $B2, $28, $B3, $28, $C2, $28, $C2, $68
;--------------------------------------------------------------------------------
org $079CE6 ; Bank07.asm@4632 (LDA #$80 : TSB $3A)
JSL CheckDetonateBomb
;--------------------------------------------------------------------------------
org $1EDCF8 ; bank_1E.asm@16086 (LDX $0202 : ...)
JSL SetBeeType
BRA + : NOP #15 : +
;--------------------------------------------------------------------------------
org $1EB5E8 ; bank_1E.asm@9387 (LDA #$03 : STA $0D80, X)
JSL ArrghusBoing
;--------------------------------------------------------------------------------
org $1EDFAF ; bank_1E.asm@16607 (.next_sprite)
JSL BeeCheckTarget
BCS .bee_valid_target
BRA .bee_unsuitable_target
NOP #48
.bee_unsuitable_target
skip 11
.bee_valid_target
;--------------------------------------------------------------------------------
;================================================================================
; Variable Ganon Vulnerability
;--------------------------------------------------------------------------------
org $08BBD4 ; ancilla_magic_powder.asm@253 (LDA #$0A : JSL Ancilla_CheckSpriteDamage.preset_class)
JSL Ganon_CheckPowderVulnerability
NOP #2
;--------------------------------------------------------------------------------
org $1D8F4E ; sprite_ganon.asm@325 (LDA $04C5 : CMP #$02)
JSL Ganon_CheckInvincible
NOP
;--------------------------------------------------------------------------------
org $0DD628 ; Bank0D.asm@1266 (LDA $0B6B, Y : AND #$02)
JSL CheckBeeBoss
NOP
;--------------------------------------------------------------------------------
org $0DD676 ; Bank0D.asm@1303 (TYX : JSL Ancilla_CheckSpriteDamage.preset_class)
JSL Ganon_CheckBeeVulnerability
NOP
;--------------------------------------------------------------------------------
;================================================================================
; Pseudo-Sword Mode
;--------------------------------------------------------------------------------
org $06ED70 ; Bank06.asm@4842 (LDA $06ED39, X : STA $0CF2)
JSL StoreSwordDamage
;================================================================================
; Text Renderer
;--------------------------------------------------------------------------------

View File

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

View File

@@ -1,175 +0,0 @@
;================================================================================
; 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
InitSRAMTable:
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
StartingBombCapacity: db $0A ; PC 0x183370
StartingArrowCapacity: db $1E ; 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
InitProgressiveSwords: db $00
org $30B414 ; PC 0x183418-0x183419
InitGoalCounter: dw $0000
org $30B422 ; PC 0x183422
InitProgressiveShields: 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,18 +1,19 @@
;================================================================================
; Inventory Updates
;================================================================================
; InventoryTracking
; brmpnskf ------oq
; b = blue boomerang | -
; r = red boomerang | -
; m = mushroom current | -
; p = magic powder | -
; n = mushroom past | -
; s = shovel | -
; k = fake flute | o = any bomb acquired from item location
; f = working flute | q = quickswap locked
!INVENTORY_SWAP = "$7EF38C"
; Item Tracking Slot
; brmpnskf
; b = blue boomerang
; r = red boomerang
; m = mushroom current
; p = magic powder
; n = mushroom past
; s = shovel
; k = fake flute
; f = working flute
;--------------------------------------------------------------------------------
; BowTracking
!INVENTORY_SWAP_2 = "$7EF38E"
; Item Tracking Slot #2
; bsp-----
; b = bow
@@ -22,20 +23,20 @@
; -
; -
; -
; -
; q = quickswap lock
;--------------------------------------------------------------------------------
; ProcessMenuButtons:
; out: Carry - 0 = No Button, 1 = Yes Button
;--------------------------------------------------------------------------------
ProcessMenuButtons:
;LDA #$FD : STA InventoryTracking ; DEBUG MODE
;LDA #$FD : STA !INVENTORY_SWAP ; DEBUG MODE
;LDA $F6 : BIT #$20 : BNE .l_pressed ; check for P1 L-button
LDA $F4 : BIT #$40 : BNE .y_pressed ; check for P1 Y-button
BIT #$20 : BNE .sel_pressed ; check for P1 Select button
LDA $F0 : BIT #$20 : BNE .sel_held
.sel_unheld
LDA HudFlag : AND #$20 : BEQ +
LDA HudFlag : AND #$DF : STA HudFlag ; select is released, unset hud flag
LDA !HUD_FLAG : AND #$20 : BEQ +
LDA !HUD_FLAG : AND #$DF : STA !HUD_FLAG ; select is released, unset hud flag
LDA $1B : BEQ + ; skip if outdoors
LDA.b #$20 : STA $012F ; menu select sound
+
@@ -44,8 +45,11 @@ ProcessMenuButtons:
.sel_held
CLC ; no buttons
RTL
;.l_pressed
;JSL.l SpawnAngryCucco
;RTL
.sel_pressed
LDA HudFlag : ORA #$20 : STA HudFlag ; set hud flag
LDA !HUD_FLAG : ORA #$20 : STA !HUD_FLAG ; set hud flag
LDA.b #$20 : STA $012F ; menu select sound
JSL.l ResetEquipment
RTL
@@ -53,12 +57,12 @@ RTL
LDA.b #$10 : STA $0207
LDA $0202 ; check selected item
CMP #$02 : BNE + ; boomerang
LDA InventoryTracking : AND #$C0 : CMP #$C0 : BNE .errorJump ; make sure we have both boomerangs
LDA BoomerangEquipment : EOR #$03 : STA BoomerangEquipment ; swap blue & red boomerang
LDA !INVENTORY_SWAP : AND #$C0 : CMP #$C0 : BNE .errorJump ; make sure we have both boomerangs
LDA $7EF341 : EOR #$03 : STA $7EF341 ; swap blue & red boomerang
LDA.b #$20 : STA $012F ; menu select sound
JMP .captured
+ CMP #$01 : BNE + ; bow
LDA BowTracking : AND #$C0 : CMP #$C0 : BNE .errorJump ; make sure we have both bows
LDA !INVENTORY_SWAP_2 : AND #$C0 : CMP #$C0 : BNE .errorJump ; make sure we have both bows
PHX : LDX.b #$00 ; scan ancilla table for arrows
-- : CPX.b #$0A : !BGE ++
LDA $0C4A, X : CMP.b #$09 : BNE +++
@@ -68,18 +72,18 @@ RTL
PLX
LDA.l SilverArrowsUseRestriction : BEQ ++
LDA $A0 : ORA $A1 : BEQ ++ ; not in ganon's room in restricted mode
LDA BowEquipment : CMP.b #$03 : !BLT .errorJump : !SUB #$02 : STA BowEquipment
LDA $7EF340 : CMP.b #$03 : !BLT .errorJump : !SUB #$02 : STA $7EF340
BRA .errorJump2
++
LDA BowEquipment : !SUB #$01 : EOR #$02 : !ADD #$01 : STA BowEquipment ; swap bows
LDA $7EF340 : !SUB #$01 : EOR #$02 : !ADD #$01 : STA $7EF340 ; swap bows
LDA.b #$20 : STA $012F ; menu select sound
JMP .captured
+ BRA +
.errorJump
BRA .errorJump2
+ CMP #$05 : BNE + ; powder
LDA InventoryTracking : AND #$30 : CMP #$30 : BNE .errorJump ; make sure we have mushroom & magic powder
LDA PowderEquipment : EOR #$03 : STA PowderEquipment ; swap mushroom & magic powder
LDA !INVENTORY_SWAP : AND #$30 : CMP #$30 : BNE .errorJump ; make sure we have mushroom & magic powder
LDA $7EF344 : EOR #$03 : STA $7EF344 ; swap mushroom & magic powder
LDA.b #$20 : STA $012F ; menu select sound
JMP .captured
+ BRA +
@@ -87,11 +91,11 @@ RTL
BRA .error
+ CMP #$0D : BNE + ; flute
LDA $037A : CMP #$01 : BEQ .midShovel ; inside a shovel animation, force the shovel & make error sound
LDA InventoryTracking : BIT #$04 : BEQ .error ; make sure we have shovel
LDA !INVENTORY_SWAP : BIT #$04 : BEQ .error ; make sure we have shovel
AND #$03 : BEQ .error ; make sure we have one of the flutes
LDA FluteEquipment : CMP #01 : BNE .toShovel ; not shovel
LDA $7EF34C : CMP #01 : BNE .toShovel ; not shovel
LDA InventoryTracking : AND #$01 : BEQ .toFakeFlute ; check for real flute
LDA !INVENTORY_SWAP : AND #$01 : BEQ .toFakeFlute ; check for real flute
LDA #$03 ; set real flute
BRA .fluteSuccess
.toFakeFlute
@@ -100,7 +104,7 @@ RTL
.toShovel
LDA #$01 ; set shovel
.fluteSuccess
STA FluteEquipment ; store set item
STA $7EF34C ; store set item
LDA.b #$20 : STA $012F ; menu select sound
BRA .captured
+
@@ -108,7 +112,7 @@ RTL
CLC
RTL
.midShovel
; LDA #$01 : STA FluteEquipment ; set shovel
; LDA #$01 : STA $7EF34C ; set shovel
.error
LDA.b #$3C : STA $012E ; error sound
.captured
@@ -123,13 +127,13 @@ ProcessBottleMenu:
; 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
; .double_shoulder_pressed
LDA BottleIndex ; check bottle state
LDA $7EF34F ; check bottle state
BEQ .no_bottles ; skip if we have no bottles
PHX
INC : CMP #$05 : !BLT + : LDA #$01 : + ;increment and wrap 1-4
TAX : LDA BottleContents-1, X ; check bottle
TAX : LDA $7EF35C-1, X ; check bottle
BNE + : LDX #$01 : + ; wrap if we reached the last bottle
TXA : STA BottleIndex ; set bottle index
TXA : STA $7EF34F ; set bottle index
LDA.b #$20 : STA $012F ; menu select sound
PLX
.no_bottles
@@ -174,6 +178,8 @@ RTL
;--------------------------------------------------------------------------------
; AddInventory:
;--------------------------------------------------------------------------------
!LOCK_STATS = "$7EF443"
macro TopHalf(address)
LDA <address> : !ADD #$10 : STA <address>
endmacro
@@ -187,61 +193,62 @@ macro BottomHalf(address)
endmacro
;--------------------------------------------------------------------------------
;FullInventoryExternal:
; LDA StatsLocked : BEQ + : RTL : +
; LDA !LOCK_STATS : BEQ + : RTL : +
; PHA : PHX : PHP : JMP AddInventory_fullItemCounts
;--------------------------------------------------------------------------------
FullInventoryExternal:
LDA StatsLocked : BEQ + : RTL : +
LDA !LOCK_STATS : BEQ + : RTL : +
PHA : PHX : PHP : JMP AddInventory_incrementCounts
;--------------------------------------------------------------------------------
!SHAME_CHEST = "$7EF416" ; ---s ----
AddInventory:
PHA : PHX : PHP
CPY.b #$0C : BNE + ; Blue Boomerang
LDA InventoryTracking : ORA #$80 : STA InventoryTracking
LDA !INVENTORY_SWAP : ORA #$80 : STA !INVENTORY_SWAP
JMP .incrementCounts
+ CPY.b #$2A : BNE + ; Red Boomerang
LDA InventoryTracking : ORA #$40 : STA InventoryTracking
LDA !INVENTORY_SWAP : ORA #$40 : STA !INVENTORY_SWAP
JMP .incrementCounts
+ CPY.b #$29 : BNE + ; Mushroom
LDA InventoryTracking : ORA #$28 : STA InventoryTracking
LDA !INVENTORY_SWAP : ORA #$28 : STA !INVENTORY_SWAP
JMP .incrementCounts
+ CPY.b #$0D : BNE + ; Magic Powder
LDA InventoryTracking : ORA #$10 : STA InventoryTracking
LDA !INVENTORY_SWAP : ORA #$10 : STA !INVENTORY_SWAP
JMP .incrementCounts
+ CPY.b #$13 : BNE + ; Shovel
LDA InventoryTracking : ORA #$04 : STA InventoryTracking
LDA !INVENTORY_SWAP : ORA #$04 : STA !INVENTORY_SWAP
JMP .incrementCounts
+ CPY.b #$14 : BNE + ; Flute (Inactive)
LDA InventoryTracking : ORA #$02 : STA InventoryTracking
LDA !INVENTORY_SWAP : ORA #$02 : STA !INVENTORY_SWAP
JMP .incrementCounts
+ CPY.b #$4A : BNE + ; Flute (Active)
LDA InventoryTracking : ORA #$01 : STA InventoryTracking
LDA !INVENTORY_SWAP : ORA #$01 : STA !INVENTORY_SWAP
JMP .incrementCounts
+ CPY.b #$0B : BNE + ; Bow
LDA ArrowMode : BNE +++
LDA BowTracking : ORA #$80 : STA BowTracking
LDA !INVENTORY_SWAP_2 : ORA #$80 : STA !INVENTORY_SWAP_2
+++
JMP .incrementCounts
+ CPY.b #$3A : BNE + ; Bow & Arrows
LDA BowTracking : ORA #$80 : STA BowTracking
LDA !INVENTORY_SWAP_2 : ORA #$80 : STA !INVENTORY_SWAP_2
JMP .incrementCounts
+ CPY.b #$3B : BNE + ; Bow & Silver Arrows
LDA BowTracking : ORA #$40 : STA BowTracking
LDA !INVENTORY_SWAP_2 : ORA #$40 : STA !INVENTORY_SWAP_2
LDA ArrowMode : BNE +++
LDA BowTracking : ORA #$80 : STA BowTracking ; activate wood arrows when not in rupee bow
LDA !INVENTORY_SWAP_2 : ORA #$80 : STA !INVENTORY_SWAP_2 ; activate wood arrows when not in rupee bow
+++
JMP .incrementCounts
+ CPY.b #$43 : BNE + ; Single arrow
LDA ArrowMode : BEQ +++
LDA BowTracking : ORA #$80 : STA BowTracking ; activate wood arrows in quick-swap
LDA !INVENTORY_SWAP_2 : ORA #$80 : STA !INVENTORY_SWAP_2 ; activate wood arrows in quick-swap
+++
JMP .incrementCounts
+ CPY.b #$58 : BNE + ; Upgrade-Only Silver Arrows
LDA BowTracking : ORA #$40 : STA BowTracking
LDA !INVENTORY_SWAP_2 : ORA #$40 : STA !INVENTORY_SWAP_2
+
.incrementCounts
LDA StatsLocked : BEQ + : JMP .done : +
LDA !LOCK_STATS : BEQ + : JMP .done : +
; don't count any of this stuff
CPY.b #$20 : BNE + : JMP .itemCounts : + ; Crystal
@@ -252,6 +259,7 @@ AddInventory:
CPY.b #$37 : BNE + : JMP .itemCounts : + ; Pendant
CPY.b #$38 : 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 #$49 : BEQ .isSword
@@ -285,57 +293,112 @@ AddInventory:
.dungeonCounts
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
LDA $040C ; get dungeon id
CMP.b #$FF : BEQ .fullItemCounts
CMP.l BallNChainDungeon : BNE +
CPY.b #$32 : BNE +
JMP .done
+
CMP.b #$04 : BCS +
LDA SewersLocations : INC : STA SewersLocations
LDA HCLocations : INC : STA HCLocations
BRA .fullItemCounts
+ LSR : TAX : LDA DungeonLocationsChecked, X : INC : STA DungeonLocationsChecked, X
++ CPX.b #$0D : BNE +
LDA BigKeyField : AND #$04 : BNE ++
CMP.b #$00 : BNE + ; Sewers (Escape)
BRA ++
+ CMP.b #$02 : BNE + ; Hyrule Castle (Escape)
++
CPY.b #$32 : BNE ++ : JMP .itemCounts : ++ ; Ball & Chain Guard's Big Key
%TopHalf($7EF434)
JMP .fullItemCounts
+ CMP.b #$04 : BNE + ; Eastern Palace
LDA $7EF436 : INC : AND #$07 : TAX
LDA $7EF436 : AND #$F8 : STA $7EF436
TXA : ORA $7EF436 : STA $7EF436
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
++
;JMP .fullItemCounts
+
; == END INDOOR-ONLY SECTION
.fullItemCounts
LDA BootsEquipment : BNE + ; Check for Boots
LDA PreBootsLocations : INC : STA PreBootsLocations ; Increment Pre Boots Counter
CPY.b #$3B : BNE + ; Skip Total Counts for Repeat Silver Arrows
LDA $7EF42A : BIT #$20 : BEQ + : BRA .itemCounts
+
LDA MirrorEquipment : BNE + ; Check for Mirror
LDA PreMirrorLocations : INC : STA PreMirrorLocations ; Increment Pre Mirror Counter
LDA $7EF355 : BNE + ; Check for Boots
LDA $7EF432 : INC : STA $7EF432 ; Increment Pre Boots Counter
+
LDA FluteEquipment : BNE + ; Check for Flute
LDA PreFluteLocations : INC : STA PreFluteLocations ; Increment Pre Mirror Counter
LDA $7EF353 : BNE + ; Check for Mirror
LDA $7EF433 : INC : STA $7EF433 ; Increment Pre Mirror Counter
+
REP #$20
LDA TotalItemCounter : INC : STA TotalItemCounter ; Increment Item Total
SEP #$20
LDA $7EF423 : INC : STA $7EF423 ; Increment Item Total
.itemCounts
CPY.b #$00 : BNE + ; Fighter's Sword & Fighter's Shield
JSR .stampSword
JSR .incrementSword
JSR .incrementShield
JMP .done
+ CPY.b #$01 : BNE + ; Master Sword
JSR .stampSword
JSR .incrementSword
JMP .done
+ CPY.b #$02 : BNE + ; Tempered Sword
JSR .stampSword
JSR .incrementSword
JMP .done
+ CPY.b #$03 : BNE + ; Golden Sword
JSR .stampSword
JSR .incrementSword
JMP .done
+ CPY.b #$04 : BNE + ; Fighter's Shield
JSR .incrementShield
JMP .done
+ CPY.b #$05 : BNE + ; Red Shield
JSR .incrementShield
JMP .done
+ CPY.b #$06 : BNE + ; Mirror Shield
JSR .incrementShield
JMP .done
+ CPY.b #$07 : !BLT + ; Items $07 - $0D
CPY.b #$0E : !BGE +
@@ -369,22 +432,18 @@ AddInventory:
JMP .done
+ CPY.b #$20 : BNE + ; Crystal
JSR .incrementCrystal
JSR .setDungeonCompletion
JMP .done
+ CPY.b #$21 : BNE + ; Bug Net
JSR .incrementY
JMP .done
+ CPY.b #$22 : BNE + ; Blue Mail
LDX #$01
JSR .incrementMail
+ CPY.b #$23 : BNE + ; Red Mail
LDX #$02
JSR .incrementMail
+ CPY.b #$22 : !BLT + ; Items $22 - $23
CPY.b #$24 : !BGE +
JSR .incrementMail
JMP .done
+ CPY.b #$24 : BNE + ; Small Key
JSR .incrementKey
JMP .done
+ CPY.b #$25 : BNE + ; Compass
JSL MaybeFlagCompassTotalPickup
JSR .incrementCompass
JMP .done
+ CPY.b #$26 : BNE + ; Liar Heart (Container)
@@ -396,7 +455,7 @@ AddInventory:
+ CPY.b #$28 : BNE + ; 3 Bombs
JSR .maybeIncrementBombs
JMP .done
+ CPY.b #$29 : BNE + ; Mushroom
+ CPY.b #$29 : BNE + ; Musoroom
JSR .incrementY
JMP .done
+ CPY.b #$2A : !BLT + ; Items $2A - $2D
@@ -415,7 +474,6 @@ AddInventory:
+ CPY.b #$37 : !BLT + ; Items $37 - $39 - Pendants
CPY.b #$3A : !BGE +
JSR .incrementPendant
JSR .setDungeonCompletion
JMP .done
+ CPY.b #$3A : !BLT + ; Items $3A - $3B - Bow & Silver Arrows
CPY.b #$3C : !BGE +
@@ -435,7 +493,7 @@ AddInventory:
JSR .incrementY
JMP .done
+ CPY.b #$49 : BNE + ; Fighter's Sword
JSR .stampSword
JSR .incrementSword
JMP .done
+ CPY.b #$4A : BNE + ; Flute (Active)
JSR .stampFlute
@@ -445,7 +503,7 @@ AddInventory:
JSR .stampBoots
JSR .incrementA
JMP .done
+ CPY.b #$4C : BNE + ; 50 Bomb Capacity Upgrade
+ CPY.b #$4C : BNE + ; Bomb Capacity Upgrade
JSR .incrementCapacity
JSR .maybeIncrementBombs
JMP .done
@@ -454,32 +512,22 @@ AddInventory:
JSR .incrementCapacity
JMP .done
+ CPY.b #$50 : BNE + ; Master Sword (Safe)
JSR .stampSword
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
JSR .incrementSword
JMP .done
+ CPY.b #$51 : !BLT + ; Items $51 - $54 - Capacity Upgrades
CPY.b #$55 : !BGE +
JSR .incrementCapacity
JMP .done
+ CPY.b #$58 : BNE + ; Upgrade-Only Silver Arrows
+ CPY.b #$58 : BNE + ; Upgrade-Only Sivler Arrows
JSR .incrementBow
JMP .done
+ CPY.b #$5E : BNE + ; Progressive Sword
JSR .stampSword
LDA.l ProgressiveSwords : INC : STA.l ProgressiveSwords
JSR .incrementSword
JMP .done
+ CPY.b #$5F : BNE + ; Progressive Shield
LDA.l ProgressiveShields : INC : STA.l ProgressiveShields
JSR .incrementShield
JMP .done
+ CPY.b #$60 : BNE + ; Progressive Armor
LDA ArmorEquipment : INC : TAX
JSR .incrementMail
JMP .done
+ CPY.b #$61 : BNE + ; Progressive Lifting Glove
@@ -495,7 +543,6 @@ AddInventory:
JMP .done
+ CPY.b #$80 : !BLT + ; Items $80 - $8F - Free Compasses
CPY.b #$90 : !BGE +
JSL MaybeFlagCompassTotalPickup
JSR .incrementCompass
JMP .done
+ CPY.b #$90 : !BLT + ; Items $90 - $9F - Free Big Keys
@@ -506,6 +553,14 @@ AddInventory:
CPY.b #$B0 : !BGE +
JSR .incrementKey
JMP .done
+ CPY.b #$B1 : !BLT + ; Items $B1 - $B6 - Bomb Upgrades
CPY.b #$B7 : !BGE +
JSR .incrementBombLevel
JMP .done
+ CPY.b #$B7 : !BLT + ; Items $B7 - $BC - Cane Upgrades
CPY.b #$BD : !BGE +
JSR .incrementCaneLevel
JMP .done
+
.done
PLP : PLX : PLA
@@ -513,84 +568,128 @@ RTL
; WHICH BEE IS BOTTLED?
; 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
REP #$20 ; set 16-bit accumulator
LDA SwordTime : BNE +
LDA SwordTime+2 : BNE +
LDA NMIFrames : STA SwordTime
LDA NMIFrames+2 : STA SwordTime+2
LDA !SWORD_TIME : BNE +
LDA !SWORD_TIME+2 : BNE +
LDA !NMI_TIME : STA !SWORD_TIME
LDA !NMI_TIME+2 : STA !SWORD_TIME+2
+
SEP #$20 ; set 8-bit accumulator
RTS
.stampBoots
REP #$20 ; set 16-bit accumulator
LDA BootsTime : BNE +
LDA BootsTime+2 : BNE +
LDA NMIFrames : STA BootsTime
LDA NMIFrames+2 : STA BootsTime+2
LDA !BOOTS_TIME : BNE +
LDA !BOOTS_TIME+2 : BNE +
LDA !NMI_TIME : STA !BOOTS_TIME
LDA !NMI_TIME+2 : STA !BOOTS_TIME+2
+
SEP #$20 ; set 8-bit accumulator
RTS
.stampFlute
REP #$20 ; set 16-bit accumulator
LDA FluteTime : BNE +
LDA FluteTime+2 : BNE +
LDA NMIFrames : STA FluteTime
LDA NMIFrames+2 : STA FluteTime+2
LDA !FLUTE_TIME : BNE +
LDA !FLUTE_TIME+2 : BNE +
LDA !NMI_TIME : STA !FLUTE_TIME
LDA !NMI_TIME+2 : STA !FLUTE_TIME+2
+
SEP #$20 ; set 8-bit accumulator
RTS
.stampMirror
REP #$20 ; set 16-bit accumulator
LDA MirrorTime : BNE +
LDA MirrorTime+2 : BNE +
LDA NMIFrames : STA MirrorTime
LDA NMIFrames+2 : STA MirrorTime+2
LDA !MIRROR_TIME : BNE +
LDA !MIRROR_TIME+2 : BNE +
LDA !NMI_TIME : STA !MIRROR_TIME
LDA !NMI_TIME+2 : STA !MIRROR_TIME+2
+
SEP #$20 ; set 8-bit accumulator
RTS
.incrementSword
; CHECK FOR DUPLICATE SWORDS
JSR .stampSword
TYA ; load sword item
CMP.b #$50 : BNE + : LDA.b #$01 : + ; convert extra master sword to normal one
CMP.b #$49 : BNE + : LDA.b #$00 : + ; convert extra fighter sword to normal one
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
.incrementBombLevel
JSR .stampSword ; update "first bomb" timestamp
RTS
.incrementCaneLevel
JSR .stampSword ; update "first cane" timestamp
RTS
.incrementShield
; CHECK FOR DUPLICATE SHIELDS
LDA $7EF422 : !ADD #$08 : AND #$18 : TAX
LDA $7EF422 : AND #$E7 : STA $7EF422
TXA : ORA $7EF422 : STA $7EF422
RTS
.incrementBow
LDA BowEquipment : BNE .dontCount ; Don't increment Y item count for extra bows
CPY.b #$3B : BNE ++
LDA $7EF42A : BIT #$20 : BEQ + : RTS : +
ORA #$20 : STA $7EF42A
++
.incrementY
LDA YAItemCounter : !ADD #$08 : STA YAItemCounter
.dontCount
LDA $7EF421 : !ADD #$08 : STA $7EF421
RTS
.incrementA
LDA YAItemCounter : INC : AND #$07 : TAX
LDA YAItemCounter : AND #$F8 : STA YAItemCounter
TXA : ORA YAItemCounter : STA YAItemCounter
LDA $7EF421 : INC : AND #$07 : TAX
LDA $7EF421 : AND #$F8 : STA $7EF421
TXA : ORA $7EF421 : STA $7EF421
RTS
.incrementPendant
LDA PendantCounter : INC : STA PendantCounter
LDA $7EF429 : INC : AND #$03 : TAX
LDA $7EF429 : AND #$FC : STA $7EF429
TXA : ORA $7EF429 : STA $7EF429
; JSR .incrementBossSword
RTS
.incrementCapacity
LDA CapacityUpgrades : INC : STA CapacityUpgrades
%BottomHalf($7EF452)
RTS
.incrementHeartPiece
LDA HeartPieceCounter : INC : STA HeartPieceCounter
LDA $7EF448 : INC : AND #$1F : TAX
LDA $7EF448 : AND #$E0 : STA $7EF448
TXA : ORA $7EF448 : STA $7EF448
RTS
.incrementHeartContainer
LDA HeartContainerCounter : INC : STA HeartContainerCounter
%TopHalf($7EF429)
RTS
.incrementCrystal
LDA CrystalCounter : INC : STA CrystalCounter
LDA $7EF422 : INC : AND #$07 : TAX
LDA $7EF422 : AND #$F8 : STA $7EF422
TXA : ORA $7EF422 : STA $7EF422
; JSR .incrementBossSword
RTS
.incrementMail
LDA HighestMail
INC : STA $04 : CPX $04 : !BLT + ; don't increment unless we're getting a better mail
TXA : STA HighestMail
+
LDA $7EF424 : !ADD #$40 : STA $7EF424
RTS
.incrementKeyLong
@@ -598,30 +697,36 @@ RTS
RTL
.incrementKey
LDA SmallKeyCounter : INC : STA SmallKeyCounter
PHA : PHX
LDA $7EF424 : INC : AND #$3F : TAX
LDA $7EF424 : AND #$C0 : STA $7EF424
TXA : ORA $7EF424 : STA $7EF424
PLX : PLA
RTS
.incrementCompass
%BottomHalf(MapsCompasses)
%BottomHalf($7EF428)
RTS
.incrementBigKey
%TopHalf(BigKeysBigChests)
LDA $7EF427 : !ADD #$10 : STA $7EF427
RTS
.incrementGTowerPreBigKey
LDA PreGTBKLocations : INC : STA PreGTBKLocations
LDA $7EF42A : INC : AND #$1F : TAX
LDA $7EF42A : AND #$E0 : STA $7EF42A
TXA : ORA $7EF42A : STA $7EF42A
RTS
.maybeIncrementBombs
LDA InventoryTracking+1 : AND #$02 : BNE +
LDA InventoryTracking+1 : ORA #$02 : STA InventoryTracking+1
LDA $7EF42A : AND #$80 : BNE +
LDA $7EF42A : ORA #$80 : STA $7EF42A
JSR .incrementY
+
RTS
.incrementMap
%TopHalf(MapsCompasses)
LDA $7EF428 : !ADD #$10 : STA $7EF428
RTS
.incrementBossSwordLong
@@ -629,28 +734,24 @@ RTS
RTL
.incrementBossSword
LDA SwordEquipment
LDA SpecialWeapons : CMP #$01 : BEQ +
CMP #$03 : BEQ +
CMP #$04 : BEQ +
CMP #$05 : BEQ +
LDA $7EF359 : BRA ++
+ : LDA !WEAPON_LEVEL
++
BNE + : -
LDA SwordlessBossKills : INC : STA SwordlessBossKills
RTS
%TopHalf($7EF452) : RTS
+ CMP #$FF : BEQ -
+ CMP #$01 : BNE +
%TopHalf(SwordBossKills) : RTS
%TopHalf($7EF425) : RTS
+ CMP #$02 : BNE +
%BottomHalf(SwordBossKills) : RTS
%BottomHalf($7EF425) : RTS
+ CMP #$03 : BNE +
%TopHalf(SwordBossKills+1) : RTS
%TopHalf($7EF426) : RTS
+ CMP #$04 : BNE +
%BottomHalf(SwordBossKills+1)
+
RTS
.setDungeonCompletion
LDX $040C : BMI +
REP #$20 ; 16 bit
LDA.l DungeonMask, X
ORA DungeonsCompleted : STA DungeonsCompleted
SEP #$20 ; 8 bit
%BottomHalf($7EF426)
+
RTS
;--------------------------------------------------------------------------------
@@ -659,11 +760,11 @@ RTS
; Link_ReceiveItem_HUDRefresh:
;--------------------------------------------------------------------------------
Link_ReceiveItem_HUDRefresh:
LDA BombsEquipment : BNE + ; skip if we have bombs
LDA BombCapacity : BEQ + ; skip if we can't have bombs
LDA BombsFiller : BEQ + ; skip if we are filling no bombs
DEC : STA BombsFiller ; decrease bomb fill count
LDA.b #$01 : STA BombsEquipment ; increase actual bomb count
LDA $7EF343 : BNE + ; skip if we have bombs
LDA $7EF370 : !ADD.l StartingMaxBombs : BEQ + ; skip if we can't have bombs
LDA $7EF375 : BEQ + ; skip if we are filling no bombs
DEC : STA $7EF375 ; decrease bomb fill count
LDA.b #$01 : STA $7EF343 ; increase actual bomb count
+
JSL.l HUD_RefreshIconLong ; thing we wrote over
@@ -675,9 +776,9 @@ RTL
; HandleBombAbsorbtion:
;--------------------------------------------------------------------------------
HandleBombAbsorbtion:
STA BombsFiller ; thing we wrote over
STA $7EF375 ; thing we wrote over
LDA $0303 : BNE + ; skip if we already have some item selected
LDA BombCapacity : BEQ + ; skip if we can't have bombs
LDA $7EF370 : !ADD.l StartingMaxBombs : BEQ + ; skip if we can't have bombs
LDA.b #$04 : STA $0202 ; set selected item to bombs
LDA.b #$01 : STA $0303 ; set selected item to bombs
JSL.l HUD_RebuildLong
@@ -692,13 +793,13 @@ RTL
AddYMarker:
LDA $0202 : AND.w #$FF ; load item value
CMP.w #$02 : BNE + ; boomerang
LDA InventoryTracking : AND.w #$C0 : CMP.w #$C0 : BEQ .drawYBubble : BRA .drawNormal
LDA !INVENTORY_SWAP : AND.w #$C0 : CMP.w #$C0 : BEQ .drawYBubble : BRA .drawNormal
+ CMP.w #$01 : BNE + ; bow
LDA BowTracking : AND.w #$C0 : CMP.w #$C0 : BEQ .drawYBubble : BRA .drawNormal
LDA !INVENTORY_SWAP_2 : AND.w #$C0 : CMP.w #$C0 : BEQ .drawYBubble : BRA .drawNormal
+ CMP.w #$05 : BNE + ; powder
LDA InventoryTracking : AND.w #$30 : CMP.w #$30 : BEQ .drawYBubble : BRA .drawNormal
LDA !INVENTORY_SWAP : AND.w #$30 : CMP.w #$30 : BEQ .drawYBubble : BRA .drawNormal
+ CMP.w #$0D : BNE + ; flute
LDA InventoryTracking : BIT.w #$04 : BEQ .drawNormal ; make sure we have shovel
LDA !INVENTORY_SWAP : BIT.w #$04 : BEQ .drawNormal ; make sure we have shovel
AND.w #$03 : BNE .drawYBubble ; make sure we have one of the flutes
BRA .drawNormal
+ CMP.w #$10 : BEQ .drawJarMarker
@@ -752,8 +853,8 @@ RTS
; UpgradeFlute:
;--------------------------------------------------------------------------------
UpgradeFlute:
LDA InventoryTracking : AND #$FC : ORA #$01 : STA InventoryTracking ; switch to the working flute
LDA.b #$03 : STA FluteEquipment ; upgrade primary inventory
LDA !INVENTORY_SWAP : AND #$FC : ORA #$01 : STA !INVENTORY_SWAP ; switch to the working flute
LDA.b #$03 : STA $7EF34C ; upgrade primary inventory
RTL
;--------------------------------------------------------------------------------
@@ -780,10 +881,10 @@ RTL
;--------------------------------------------------------------------------------
LoadKeys:
LDA.l GenericKeys : BEQ +
LDA CurrentGenericKeys
LDA $7EF38B
RTL
+
LDA DungeonKeys, X
LDA $7EF37C, X
RTL
;--------------------------------------------------------------------------------
@@ -793,10 +894,10 @@ RTL
SaveKeys:
PHA
LDA.l GenericKeys : BEQ +
PLA : STA CurrentGenericKeys
PLA : STA $7EF38B
RTL
+
PLA : STA DungeonKeys, X
PLA : STA $7EF37C, X
RTL
;--------------------------------------------------------------------------------
@@ -810,10 +911,10 @@ ClearOWKeys:
JSL.l FakeWorldFix
JSR.w FixBunnyOnExitToLightWorld
LDA.l GenericKeys : BEQ +
PLA : LDA CurrentGenericKeys : STA CurrentSmallKeys
PLA : LDA $7EF38B : STA $7EF36F
RTL
+
PLA : STA CurrentSmallKeys
PLA : STA $7EF36F
RTL
;--------------------------------------------------------------------------------
@@ -876,10 +977,10 @@ RTL
; InitializeBottles:
;--------------------------------------------------------------------------------
InitializeBottles:
STA BottleContents, X ; thing we wrote over
STA $7EF35C, X ; thing we wrote over
PHA
LDA BottleIndex : BNE +
TXA : INC : STA BottleIndex ; write bottle index to menu properly
LDA $7EF34F : BNE +
TXA : INC : STA $7EF34F ; write bottle index to menu properly
+
PLA
RTL
@@ -968,12 +1069,12 @@ RTL
; RemoveMushroom:
;--------------------------------------------------------------------------------
RemoveMushroom:
LDA InventoryTracking : AND #$DF : STA InventoryTracking ; remove the mushroom
LDA !INVENTORY_SWAP : AND #$DF : STA !INVENTORY_SWAP ; remove the mushroom
AND #$10 : BEQ .empty ; check if we have powder
LDA.b #$02 : STA PowderEquipment ; give powder if we have it
LDA.b #$02 : STA $7EF344 ; give powder if we have it
RTL
.empty
LDA.b #$00 : STA PowderEquipment ; clear the inventory slot if we don't have powder
LDA.b #$00 : STA $7EF344 ; clear the inventory slot if we don't have powder
RTL
;--------------------------------------------------------------------------------
@@ -981,7 +1082,7 @@ RTL
; DrawMagicHeader:
;--------------------------------------------------------------------------------
DrawMagicHeader:
LDA MagicConsumption : AND.w #$00FF : CMP.w #$0002 : BEQ .quarterMagic
LDA $7EF37B : AND.w #$00FF : CMP.w #$0002 : BEQ .quarterMagic
.halfMagic
LDA.w #$28F7 : STA $7EC704
LDA.w #$2851 : STA $7EC706
@@ -999,7 +1100,7 @@ RTL
;--------------------------------------------------------------------------------
;FixShovelLock:
; LDA $037A : CMP #$01 : BEQ + ; skip if link is shoveling
; LDA FluteEquipment ; load shovel/flute item ID
; LDA $7EF34C ; load shovel/flute item ID
; +
; CMP #$00
;RTL

View File

@@ -71,7 +71,7 @@ Overworld_CreatePyramidHoleModified:
SEP #$30
LDA OverworldEventDataWRAM+$5B : ORA.b #$20 : STA OverworldEventDataWRAM+$5B
LDA $7EF2DB : ORA.b #$20 : STA $7EF2DB
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:
LDA InvertedMode : BEQ .done
LDA OverworldEventDataWRAM, X : ORA #$40 : STA OverworldEventDataWRAM, X ;set barrier dead
LDA $7EF280, X : ORA #$40 : STA $7EF280, X ;set barrier dead
.done
LDA OverworldEventDataWRAM, X ; what we wrote over
LDA $7EF280, X ; what we wrote over
RTL
@@ -187,7 +187,7 @@ RTL
TurtleRockPegSolved:
LDA.l InvertedMode : AND.w #$00FF : BNE +
LDA.l OverworldEventDataWRAM+07 ; What we wrote over (reading flags for this screen)
LDA.l $7ef287 ; What we wrote over (reading flags for this screen)
RTL
+
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
LDA #$0034 : STA $3BBE ;Tile when no warp
LDA ProgressIndicator : AND #$00FF : CMP #$0003 : BNE .agahnimAlive
LDA $7EF3C5 : AND #$00FF : CMP #$0003 : BNE .agahnimAlive
LDA #$0212 : STA $3BBE ;warp
.agahnimAlive

View File

@@ -9,29 +9,30 @@ RTL
ItemDowngradeFixMain:
JSL.l AddInventory
BMI .dontWrite ; thing we wrote over part 1
CPY.b #$1B : BEQ .isPowerGloves ; Power Gloves
CPY.b #$05 : BEQ .isRedShield ; Red Shield
CPY.b #$04 : BEQ .isBlueShield ; Blue Shield
CPY.b #$0C : BEQ .isBlueBoomerang ; Blue Boomerang
CPY.b #$0B : BEQ .isBow ; Bow
CPY.b #$3A : BEQ .isBowAndArrows ; Bow
CPY.b #$49 : BEQ .isSword ; Fighter's Sword
CPY.b #$01 : BEQ .isSword ; Master Sword
CPY.b #$50 : BEQ .isSword ; Master Sword (Safe)
CPY.b #$02 : BEQ .isSword ; Tempered Sword
CPY.b #$49 : BEQ .isFightersSword ; Fighter's Sword
CPY.b #$01 : BEQ .isMasterSword ; Master Sword
CPY.b #$50 : BEQ .isMasterSword ; Master Sword (Safe)
CPY.b #$02 : BEQ .isTemperedSword ; Tempered Sword
CPY.b #$3B : BEQ .isSilverArrowBow ; Silver Arrow Bow
CPY.b #$2A : BEQ .isRedBoomerang ; Red Boomerang
CPY.b #$0D : BEQ .isMagicPowder ; Magic Powder
CPY.b #$14 : BEQ .isFlute ; Flute
CPY.b #$13 : BEQ .isShovel ; Shovel
CPY.b #$29 : BEQ .isMushroom ; Mushroom
CPY.b #$00 : BEQ .isUncleSwordShield ; Fighter's Sword & Shield
.done
CPY.b #$B1 : !BLT + : CPY.b #$B6 : !BLT .isBombUpgrade : +
CPY.b #$B7 : !BLT + : CPY.b #$BC : !BLT .isCaneUpgrade : +
.done
STA [$00] ; thing we wrote over part 2
.dontWrite
RTS
@@ -58,26 +59,40 @@ RTS
+
PLA
RTS
.isSword
.isFightersSword
.isMasterSword
.isTemperedSword
PHA
LDA SwordEquipment : STA $04
TYA ; load sword item
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
INC : CMP $04 : !BGE + ; skip if highest is lower (this is an upgrade)
LDA $04 : DEC ; convert to item id
TAY : PLA : LDA $04 ; put sword id into the thing to write
INC : CMP !HIGHEST_SWORD_LEVEL : !BGE + ; skip if highest is lower (this is an upgrade)
LDA !HIGHEST_SWORD_LEVEL : DEC ; convert to item id
TAY : PLA : LDA !HIGHEST_SWORD_LEVEL ; put sword id into the thing to write
JMP .done
+
PLA
JMP .done
.isUncleSwordShield
.isBombUpgrade
PHA
; set sword to 1 if current sword is 0
LDA [$00] : BNE + : LDA.b #$01 : STA [$00] : +
INC $00
; set shield to 1 if current shield is 0
LDA [$00] : BNE + : LDA.b #$01 : STA [$00] : +
TYA ; load bomb upgrade item
!SUB #$B0 ; convert to bomb level
CMP.l !WEAPON_LEVEL : !BGE + ; skip if highest is lower (this is an upgrade)
LDA.l !WEAPON_LEVEL : !ADD #$B0 ; convert to item id
TAY : PLA : LDA.l !WEAPON_LEVEL ; put bomb level into the thing to write
JMP .done
+
PLA
RTS
JMP .done
.isCaneUpgrade
PHA
TYA ; load cane upgrade item
!SUB #$B6 ; convert to cane level
CMP.l !WEAPON_LEVEL : !BGE + ; skip if highest is lower (this is an upgrade)
LDA.l !WEAPON_LEVEL : !ADD #$B6 ; convert to item id
TAY : PLA : LDA.l !WEAPON_LEVEL ; put cane level into the thing to write
JMP .done
+
PLA
JMP .done
;================================================================================

View File

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

View File

@@ -14,12 +14,14 @@ MaidenCrystalScript:
; Load the dungeon index. Is it the Dark Palace?
;LDA $040C : !SUB.b #$0A : TAY : CPY.b #$02 : BNE +
; LDA MapIcons : CMP.b #$07 : BCS ++ : LDA.b #$07 : STA MapIcons : ++
; LDA $7EF3C7 : CMP.b #$07 : BCS ++ : LDA.b #$07 : STA $7EF3C7 : ++
;+
LDA CrystalsField : AND.b #$7F : CMP.b #$7F : BNE + ; check if we have all crystals
LDA.b #$08 : STA MapIcons ; Update the map icon to just be Ganon's Tower
LDA $7EF37A : 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
+
JSL.l MaybeWriteSRAMTrace
JML.l $1ECF35 ; <- F4F35 - sprite_crystal_maiden.asm : 426
;--------------------------------------------------------------------------------

View File

@@ -2,11 +2,11 @@
; Mantle Object Changes
;--------------------------------------------------------------------------------
Mantle_CorrectPosition:
LDA ProgressFlags : AND.b #$04 : BEQ +
LDA $7EF3C6 : AND.b #$04 : BEQ +
LDA.b #$0A : STA $0D10, X ; just spawn it off to the side where we know it should be
LDA.b #$03 : STA $0D30, X
LDA.b #$90 : STA $0ED0, X
+
LDA $0D00, X : !ADD.b #$03 ; thing we did originally
RTL
;--------------------------------------------------------------------------------
;--------------------------------------------------------------------------------

View File

@@ -6,7 +6,7 @@ TryOpenMire:
LDA $8A : CMP.b #$70 : BNE .untriggered
; Checks whether the Misery Mire dungeon is already revealed.
LDA OverworldEventDataWRAM+$70 : AND.b #$20 : BNE .untriggered
LDA $7EF2F0 : AND.b #$20 : BNE .untriggered
; You have to be in the trigger window.
LDY.b #$02 : JSL.l Ancilla_CheckIfEntranceTriggered : BCC .untriggered
@@ -25,7 +25,7 @@ TryOpenTRock:
LDA $8A : CMP.b #$47 : BNE .untriggered
; Checks whether the Turtle Rock dungeon is already revealed.
LDA OverworldEventDataWRAM+$47 : AND.b #$20 : BNE .untriggered
LDA $7EF2C7 : AND.b #$20 : BNE .untriggered
; You have to be in the trigger window.
LDY.b #$03 : JSL.l Ancilla_CheckIfEntranceTriggered : BCC .untriggered
@@ -73,4 +73,4 @@ MedallionTrigger_Quake:
+
PLA
RTL
;--------------------------------------------------------------------------------
;--------------------------------------------------------------------------------

26
msu.asm
View File

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

View File

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

View File

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

File diff suppressed because it is too large Load Diff

View File

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

29
openmode.asm Normal file
View File

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

View File

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

View File

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

View File

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

66
previewdatacopy.asm Normal file
View File

@@ -0,0 +1,66 @@
;================================================================================
; 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
.special_swap
LDA InventoryTracking+1 : ORA #$01 : STA InventoryTracking+1
LDA !INVENTORY_SWAP_2 : ORA #$01 : STA !INVENTORY_SWAP_2
CPX.b #$02 : BEQ + ; boomerang
CPX.b #$01 : BEQ + ; bow
CPX.b #$05 : BEQ + ; powder
@@ -50,10 +50,10 @@ RTL
RCode:
LDX.w $0202
LDA.b $F2 : BIT #$20 : BNE ++ ; Still holding L from a previous frame
LDA InventoryTracking+1 : AND #$FE : STA InventoryTracking+1
LDA !INVENTORY_SWAP_2 : AND #$FE : STA !INVENTORY_SWAP_2
BRA +
++
LDA InventoryTracking+1 : BIT #$01 : BEQ +
LDA !INVENTORY_SWAP_2 : BIT #$01 : BEQ +
RTS
-
+ CPX.b #$14 : BNE + : LDX.b #$00 ;will wrap around to 1
@@ -65,10 +65,10 @@ RTS
LCode:
LDX.w $0202
LDA.b $F2 : BIT #$10 : BNE ++ ; Still holding R from a previous frame
LDA InventoryTracking+1 : AND #$FE : STA InventoryTracking+1
LDA !INVENTORY_SWAP_2 : AND #$FE : STA !INVENTORY_SWAP_2
BRA +
++
LDA InventoryTracking+1 : BIT #$01 : BEQ +
LDA !INVENTORY_SWAP_2 : BIT #$01 : BEQ +
RTS
-
+ CPX.b #$01 : BNE + : LDX.b #$15 ; will wrap around to $14

18
ram.asm
View File

@@ -1,18 +0,0 @@
;================================================================================
; 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

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

View File

@@ -97,7 +97,7 @@ RNG_Ganon_Extra_Warp:
PLA
RTL
RNG_Enemy_Drops:
LDA.l ProgressIndicator : CMP #$01 : BEQ + ; drops are static after uncle pickup & before rescuing zelda
LDA.l $7EF3C5 : CMP #$01 : BEQ + ; drops are static after uncle pickup & before rescuing zelda
JML GetRandomInt
+
LDA.b #$0F
@@ -110,6 +110,10 @@ RTL
;--------------------------------------------------------------------------------
!RNG_POINTERS = "$7F5200"
GetStaticRNG:
LDA.l SeededRNG : BNE .seeded
JML GetRandomInt
RTL
.seeded
PHX : PHP
REP #$30 ; set 16-bit accumulator and index registers
AND.w #$000F

View File

@@ -84,7 +84,7 @@ IcePalaceBombosNE:
RTL
CastleEastEntrance:
LDA ProgressIndicator : CMP.b #$02 : !BLT + : RTL : + ; only apply in rain states (0 or 1)
LDA $7EF3C5 : CMP.b #$02 : !BLT + : RTL : + ; only apply in rain states (0 or 1)
LDA.l BlockCastleDoorsInRain : BNE + : RTL : +
REP #$20 ; 16 A
@@ -115,7 +115,7 @@ CastleEastEntrance:
RTL
CastleWestEntrance:
LDA ProgressIndicator : CMP.b #$02 : !BLT + : RTL : + ; only apply in rain states (0 or 1)
LDA $7EF3C5 : CMP.b #$02 : !BLT + : RTL : + ; only apply in rain states (0 or 1)
LDA.l BlockCastleDoorsInRain : BNE + : RTL : +
REP #$20 ; 16 A

View File

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

292
save.asm
View File

@@ -1,218 +1,124 @@
;--------------------------------------------------------------------------------
WriteSaveChecksumAndBackup:
LDX.w #$0000 : TXA : - ; Checksum first $04FE bytes
CLC : ADC.l SaveDataWRAM, X
INX #2
CPX.w #$04FE : BNE -
LDX.w #$0000 : - ; Checksum extended save data
CLC : ADC.l ExtendedFileNameWRAM, X
INX #2
CPX.w #$0FFE : BNE -
STA.b $00
LDA.w #$5A5A
SEC : SBC.b $00
STA.l InverseChecksumSRAM
PHB
LDA.w #$14FF ; \
LDX.w #CartridgeSRAM&$FFFF ; | Copies $1500 bytes from beginning of cart SRAM to
LDY.w #SaveBackupSRAM&$FFFF ; | $704000
MVN SRAMBank, SRAMBank ; /
PLB
RTL
;--------------------------------------------------------------------------------
ValidateSRAM:
REP #$30
LDX.w #$0000 : TXA : - ; Checksum first $04FE bytes
CLC : ADC.l CartridgeSRAM, X
INX #2
CPX.w #$04FE : BNE -
LDX.w #$0000 : - ; Checksum extended save data
CLC : ADC.l ExtendedFileNameSRAM, X
INX #2
CPX.w #$0FFE : BNE -
STA.b $00
LDA.w #$5A5A
SEC : SBC.b $00
CMP.l InverseChecksumSRAM : BEQ .goodchecksum
LDX.w #$0000 : TXA : - ; Do the same for the backup save
CLC : ADC.l SaveBackupSRAM, X
INX #2
CPX.w #$04FE : BNE -
LDX.w #$0000 : -
CLC : ADC.l SaveBackupSRAM+$500, X
INX #2
CPX.w #$0FFE : BNE -
STA.b $00
LDA.w #$5A5A
SEC : SBC.b $00
CMP.l SaveBackupSRAM+$4FE : BEQ +
TDC : STA.l FileValiditySRAM ; Delete save by way of zeroing validity marker
BRA .goodchecksum : +
PHB
LDA.w #$14FF ; \
LDX.w #SaveBackupSRAM&$FFFF ; | Copies $1500 bytes from backup on cart SRAM to
LDY.w #CartridgeSRAM&$FFFF ; | main save location at $700000
MVN SRAMBank, SRAMBank ; /
PLB
.goodchecksum
LDX.w #$00FE : - ; includes prize pack reset after save and quit
STZ.w $0D00, X
STZ.w $0E00, X
STZ.w $0F00, X
DEX #2
BPL -
Validate_SRAM:
REP #$30 ; vanilla behavior from $0CCD45, includes prize pack reset after save and quit
LDX #$00FE : -
STZ $0D00, X
STZ $0E00, X
STZ $0F00, X
DEX #2
BPL -
SEP #$30
RTL
;--------------------------------------------------------------------------------
ClearExtendedSaveFile:
STA.l $700400, X ; what we wrote over
STA.l $700500, X
STA.l $700600, X
STA.l $700700, X
STA.l $700800, X
STA.l $700900, X
STA.l $700A00, X
STA.l $700B00, X
STA.l $700C00, X
STA.l $700D00, X
STA.l $700E00, X
STA.l $700F00, X
STA.l $701000, X
STA.l $701100, X
STA.l $701200, X
STA.l $701300, X
STA.l $701400, X
; Clear backup save
STA.l $704000, X
STA.l $704100, X
STA.l $704200, X
STA.l $704300, X
STA.l $704400, X
STA.l $704500, X
STA.l $704600, X
STA.l $704700, X
STA.l $704800, X
STA.l $704900, X
STA.l $704A00, X
STA.l $704B00, X
STA.l $704C00, X
STA.l $704D00, X
STA.l $704E00, X
STA.l $704F00, X
STA.l $705000, X
STA.l $705100, X
STA.l $705200, X
STA.l $705300, X
STA.l $705400, X
STA $700400, X ; what we wrote over
STA $700500, X
STA $700600, X
STA $700700, X
STA $700800, X
STA $700900, X
STA $700A00, X
STA $700B00, X
STA $700C00, X
STA $700D00, X
STA $700E00, X
STA $700F00, X
RTL
;--------------------------------------------------------------------------------
ClearExtendedWRAMSaveFile:
STA.l $7EF400, X ; what we wrote over
STA.l $7F6000, X
STA.l $7F6100, X
STA.l $7F6200, X
STA.l $7F6300, X
STA.l $7F6400, X
STA.l $7F6500, X
STA.l $7F6600, X
STA.l $7F6700, X
STA.l $7F6800, X
STA.l $7F6900, X
STA.l $7F6A00, X
STA.l $7F6B00, X
STA.l $7F6C00, X
STA.l $7F6D00, X
STA.l $7F6E00, X
STA.l $7F6F00, X
STA $7EF400, X ; what we wrote over
STA $7F6500, X
STA $7F6600, X
STA $7F6700, X
STA $7F6800, X
STA $7F6900, X
STA $7F6A00, X
STA $7F6B00, X
STA $7F6C00, X
STA $7F6D00, X
STA $7F6E00, X
STA $7F6F00, X
RTL
;--------------------------------------------------------------------------------
CopyExtendedSaveFileToWRAM:
PHA
SEP #$30
LDA.w $4300 : PHA ; preserve DMA parameters
LDA.w $4301 : PHA ; preserve DMA parameters
LDA.w $4302 : PHA ; preserve DMA parameters
LDA.w $4303 : PHA ; preserve DMA parameters
LDA.w $4304 : PHA ; preserve DMA parameters
LDA.w $4305 : PHA ; preserve DMA parameters
LDA.w $4306 : PHA ; preserve DMA parameters
;--------------------------------------------------------------------------------
STZ.w $4200 ; Disable NMI, V/H, joypad
STZ.w $420C ; Disable HDMA
LDA.b #$00 : STA.w $4300 ; set DMA transfer direction A -> B, bus A auto increment, single-byte mode
PHA
SEP #$30
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 #$00 : STA $4300 ; set DMA transfer direction A -> B, bus A auto increment, single-byte mode
LDA.b #$80 : STA.w $4301 ; set bus B source to WRAM register
LDA #$80 : STA $4301 ; set bus B source to WRAM register
LDA.b #$00 : STA.w $2181 ; set WRAM register source address
LDA.b #$60 : STA.w $2182
LDA.b #$7F : STA.w $2183
LDA #$00 : STA $2181 ; set WRAM register source address
LDA #$65 : STA $2182
LDA #$7F : STA $2183
STZ.w $4302 ; set bus A destination address to SRAM
LDA.b #$05 : STA.w $4303
LDA.b #$70 : STA.w $4304
STZ $4302 ; set bus A destination address to SRAM
LDA #$05 : STA $4303
LDA #$70 : STA $4304
LDA.b #$00 : STA.w $4305 ; set transfer size to 0x1000
LDA.b #$10 : STA.w $4306 ; STZ $4307
LDA #$00 : STA $4305 ; set transfer size to 0xB00
LDA #$0B : STA $4306 ; STZ $4307
LDA.b #$01 : STA.w $420B ; begin DMA transfer
LDA.b #$81 : STA.w $4200 ; Re-enable NMI and joypad
;--------------------------------------------------------------------------------
PLA : STA.w $4306 ; restore DMA parameters
PLA : STA.w $4305 ; restore DMA parameters
PLA : STA.w $4304 ; restore DMA parameters
PLA : STA.w $4303 ; restore DMA parameters
PLA : STA.w $4302 ; restore DMA parameters
PLA : STA.w $4301 ; restore DMA parameters
PLA : STA.w $4300 ; restore DMA parameters
REP #$30
PLA
STA $7EC00D ; what we wrote over
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
REP #$30
PLA
STA $7EC00D ; what we wrote over
RTL
;--------------------------------------------------------------------------------
CopyExtendedWRAMSaveFileToSRAM:
PHA
PHB
SEP #$30
LDA #$00 : PHA : PLB
LDA.w $4300 : PHA ; preserve DMA parameters
LDA.w $4301 : PHA ; preserve DMA parameters
LDA.w $4302 : PHA ; preserve DMA parameters
LDA.w $4303 : PHA ; preserve DMA parameters
LDA.w $4304 : PHA ; preserve DMA parameters
LDA.w $4305 : PHA ; preserve DMA parameters
LDA.w $4306 : PHA ; preserve DMA parameters
;--------------------------------------------------------------------------------
STZ.w $4200 ; Disable NMI, V/H, joypad
STZ.w $420C ; Disable HDMA
LDA.b #$80 : STA.w $4300 ; set DMA transfer direction B -> A, bus A auto increment, single-byte mode
PHA
PHB
SEP #$30
LDA #$00 : PHA : PLB
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.w $4301 ; set bus B source to WRAM register
STA $4301 ; set bus B source to WRAM register
LDA.b #$00 : STA.w $2181 ; set WRAM register source address
LDA.b #$60 : STA.w $2182
LDA.b #$7F : STA.w $2183
LDA #$00 : STA $2181 ; set WRAM register source address
LDA #$65 : STA $2182
LDA #$7F : STA $2183
STZ.w $4302 ; set bus A destination address to SRAM
LDA.b #$05 : STA.w $4303
LDA.b #$70 : STA.w $4304
STZ $4302 ; set bus A destination address to SRAM
LDA #$05 : STA $4303
LDA #$70 : STA $4304
LDA.b #$10 : STA.w $4305 ; set transfer size to 0xB00
LDA.b #$0B : STA.w $4306 ; STZ $4307
LDA #$00 : STA $4305 ; set transfer size to 0xB00
LDA #$0B : STA $4306 ; STZ $4307
LDA.b #$01 : STA.w $420B ; begin DMA transfer
LDA.b #$81 : STA.w $4200 ; Re-enable NMI and joypad
;--------------------------------------------------------------------------------
PLA : STA.w $4306 ; restore DMA parameters
PLA : STA.w $4305 ; restore DMA parameters
PLA : STA.w $4304 ; restore DMA parameters
PLA : STA.w $4303 ; restore DMA parameters
PLA : STA.w $4302 ; restore DMA parameters
PLA : STA.w $4301 ; restore DMA parameters
PLA : STA.w $4300 ; restore DMA parameters
REP #$30
PLB
PLA
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
REP #$30
PLB
PLA
LDX.w #$0000 : TXA ; what we wrote over
RTL

View File

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

View File

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

587
special_weapons.asm Normal file
View File

@@ -0,0 +1,587 @@
;--------------------------------------------------------------------------------
!ANCILLA_DAMAGE = "$06EC84"
; start with X = sprite index, A = ancilla type index
;--------------------------------------------------------------------------------
DamageClassCalc:
PHA
LDA GanonVulnerabilityItem : BEQ +
LDA $0E20, X : CMP #$D7 : BNE +
PLA
JSL Ganon_CheckAncillaVulnerability
RTL
+
LDA SpecialWeapons : CMP #$06 : BEQ .cane_immune ; only crystal switches in bee mode
PLA
CMP #$01 : BEQ .red_cane
CMP #$2C : BEQ .red_cane
CMP #$31 : BEQ .blue_cane
CMP #$0C : BEQ .beam
BRA .not_cane_or_beam
.red_cane
PHA
LDA SpecialWeapons : CMP #$01 : BEQ .cane_immune
CMP #$03 : BEQ .cane_immune
CMP #$04 : BEQ .special_cane
CMP #$05 : BEQ .special_cane
BRA .normal
.blue_cane
PHA
LDA SpecialWeapons : CMP #$01 : BEQ .cane_immune
CMP #$03 : BEQ .special_cane
CMP #$04 : BEQ .cane_immune
CMP #$05 : BEQ .special_cane
BRA .normal
.cane_immune
LDA $0E20, X : CMP.b #$1E : BEQ .normal ; crystal switch
PLA
BRA .impervious
.special_cane
PLA
LDA $0E20, X : CMP.b #$D6 : BEQ .unstunned_ganon
CMP.b #$88 : BEQ .mothula
BRA .special_level
.impervious
LDA #$FF
RTL
.beam
PHA
LDA SpecialWeapons : CMP #$02 : BNE .normal
PLA
LDA #$05
RTL
.normal
PLA
.not_cane_or_beam
CMP #$07 : BNE .no_change
LDA SpecialWeapons : CMP #$01 : BNE .normal_bombs
LDA !WEAPON_LEVEL : BEQ .normal_bombs
LDA $0E20, X : CMP.b #$D6 : BEQ .unstunned_ganon
CMP.b #$D7 : BEQ .stunned_ganon
CMP.b #$88 : BEQ .mothula
CMP.b #$91 : BEQ .stalfos_knight
CMP.b #$92 : BEQ .helmasaur_king
.special_level
LDA !WEAPON_LEVEL
BRA .done
.mothula
LDA !WEAPON_LEVEL
CMP #$04 : !BGE .fix_mothula
BRA .done
.fix_mothula
LDA #$03
BRA .done
.stalfos_knight
LDA !StalfosBombDamage : BEQ .special_level
LDA #$08
BRA .done
.helmasaur_king
LDA $0DB0, X : CMP #$03 : !BGE .special_level
LDA #$08
BRA .done
.unstunned_ganon
LDA $04C5 : CMP.b #$02 : BNE .impervious
LDA $0EE0, X : BNE .impervious
LDA #$34 : STA $0EE0, X ; give the poor pig some iframes
BRA .special_level
.stunned_ganon
LDA $0EE0, X : BNE .impervious
LDA #$34 : STA $0EE0, X ; give the poor pig some iframes
LDA #$20 : STA $0F10, X ; knock ganon back or something? idk
LDA #$09
BRA .done
.normal_bombs
LDA #$07
.no_change
PHX : TAX
LDA.l !ANCILLA_DAMAGE, X
PLX
CMP.b #$06 : BNE .done ; not arrows
LDA $7EF340 : CMP.b #$03 : !BGE .actual_silver_arrows
.normal_arrows
LDA #$06
.done
RTL
.actual_silver_arrows
LDA $0E20, X : CMP.b #$D7 : BNE +
LDA SpecialWeapons : CMP #$01 : BEQ .normal_arrows
LDA #$20 : STA $0F10, X
+
LDA #$09
RTL
; end with X = sprite index, A = damage class
;--------------------------------------------------------------------------------
!SPRITE_SETUP_HIT_BOX_LONG = "$0683EA"
!UTILITY_CHECK_IF_HIT_BOXES_OVERLAP_LONG = "$0683E6"
; start with X = ancilla index, Y = sprite index
;--------------------------------------------------------------------------------
Utility_CheckAncillaOverlapWithSprite:
LDA $0E20, Y : CMP #$09 : BEQ .giant_moldorm
CMP #$CB : BEQ .trinexx
.not_giant_moldorm ; ordinary collision checking
PHY : PHX
TYX
JSL !SPRITE_SETUP_HIT_BOX_LONG
PLX : PLY
JSL !UTILITY_CHECK_IF_HIT_BOXES_OVERLAP_LONG
RTL
.giant_moldorm
LDA $0E10, Y : BNE .ignore_collision ; Moldy can have little a I-Frames, as a treat
LDA.l SpecialWeapons : CMP #$01 : BNE ++
LDA $0C4A, X : CMP #$07 : BEQ .check_collision_moldorm
BRA .ignore_collision ; don't collide with non-bombs
++ : LDA.l SpecialWeapons : CMP #$03 : BNE ++
LDA $0C4A, X : CMP #$31 : BEQ .check_collision_moldorm
BRA .ignore_collision ; don't collide with non-byrna
++ : LDA.l SpecialWeapons : CMP #$04 : BNE ++
LDA $0C4A, X : CMP #$01 : BEQ .check_collision_moldorm
CMP #$2C : BEQ .check_collision_moldorm
BRA .ignore_collision ; don't collide with non-somaria
++ : LDA.l SpecialWeapons : CMP #$05 : BNE .ignore_collision
LDA $0C4A, X : CMP #$01 : BEQ .check_collision_moldorm
CMP #$2C : BEQ .check_collision_moldorm
CMP #$31 : BEQ .check_collision_moldorm
BRA .ignore_collision ; don't collide with non-canes
.check_collision_moldorm
JSR SetUpMoldormHitbox
JSL !UTILITY_CHECK_IF_HIT_BOXES_OVERLAP_LONG
RTL
.ignore_collision
CLC
RTL
.trinexx
LDA.l SpecialWeapons : CMP #$01 : BNE ++
LDA $0C4A, X : CMP #$07 : BEQ .check_collision_trinexx
BRA .ignore_collision ; don't collide with non-bombs
++ : LDA.l SpecialWeapons : CMP #$03 : BNE ++
LDA $0C4A, X : CMP #$31 : BEQ .check_collision_trinexx
JMP .ignore_collision ; don't collide with non-byrna
++ : LDA.l SpecialWeapons : CMP #$04 : BNE ++
LDA $0C4A, X : CMP #$01 : BEQ .check_collision_trinexx
CMP #$2C : BEQ .check_collision_trinexx
JMP .ignore_collision ; don't collide with non-somaria
++ : LDA.l SpecialWeapons : CMP #$05 : BNE .ignore_collision
LDA $0C4A, X : CMP #$01 : BEQ .check_collision_trinexx
CMP #$2C : BEQ .check_collision_trinexx
CMP #$31 : BEQ .check_collision_trinexx
JMP .ignore_collision ; don't collide with non-canes
.check_collision_trinexx
JSR SetUpTrinexxHitbox
JSL !UTILITY_CHECK_IF_HIT_BOXES_OVERLAP_LONG
RTL
; returns carry clear if there was no overlap
;--------------------------------------------------------------------------------
SetUpTrinexxHitbox:
; rearrange trinexx's hitbox to be her middle instead of her head
LDA $0CAA, Y : PHA
LDA $0E60, Y : PHA
LDA $0D10, Y : PHA
LDA $0D30, Y : PHA
LDA $0D00, Y : PHA
LDA $0D20, Y : PHA
LDA #$80 : STA $0CAA, Y
PHX
LDA $0E80, Y : !SUB.l $1DAF28 : AND.b #$7F : TAX
LDA $7FFC00, X : STA $0D10, Y
LDA $7FFC80, X : STA $0D30, Y
LDA $7FFD00, X : STA $0D00, Y
LDA $7FFD80, X : STA $0D20, Y
TYX
STZ $0E60, X
JSL !SPRITE_SETUP_HIT_BOX_LONG
PLX
PLA : STA $0D20, Y
PLA : STA $0D00, Y
PLA : STA $0D30, Y
PLA : STA $0D10, Y
PLA : STA $0E60, Y
PLA : STA $0CAA, Y
RTS
;--------------------------------------------------------------------------------
SetUpMoldormHitbox:
; rearrange moldorm's hitbox to be his tail instead of his head
LDA $0D90, Y : PHA
LDA $0F60, Y : PHA
LDA $0D10, Y : PHA
LDA $0D30, Y : PHA
LDA $0D00, Y : PHA
LDA $0D20, Y : PHA
PHY : PHX
LDA $0E80, Y : !SUB.b #$30 : AND.b #$7F : TAX
LDA $7FFC00, X : STA $0D10, Y
LDA $7FFC80, X : STA $0D30, Y
LDA $7FFD00, X : STA $0D00, Y
LDA $7FFD80, X : STA $0D20, Y
LDA #$01 : STA $09D0, Y
TYX
STZ $0F60, X
JSL !SPRITE_SETUP_HIT_BOX_LONG
PLX : PLY
PLA : STA $0D20, Y
PLA : STA $0D00, Y
PLA : STA $0D30, Y
PLA : STA $0D10, Y
PLA : STA $0F60, Y
PLA : STA $0D90, Y
RTS
;--------------------------------------------------------------------------------
; start with X = ancilla index, Y = sprite index
Utility_CheckHelmasaurKingCollision:
LDA.l SpecialWeapons : CMP #$01 : BNE ++
LDA $0C4A, X : CMP #$07 : BEQ .collide
BRA .normal ; normal behavior with non-bombs
++ : LDA.l SpecialWeapons : CMP #$03 : BNE ++
LDA $0C4A, X : CMP #$31 : BEQ .collide
BRA .normal ; normal behavior with non-byrna
++ : LDA.l SpecialWeapons : CMP #$04 : BNE ++
LDA $0C4A, X : CMP #$01 : BEQ .collide
CMP #$2C : BEQ .collide
BRA .normal ; normal behavior with non-somaria
++ : LDA.l SpecialWeapons : CMP #$05 : BNE .normal
LDA $0C4A, X : CMP #$01 : BEQ .collide
CMP #$2C : BEQ .collide
CMP #$31 : BEQ .collide
BRA .normal ; normal behavior with non-canes
.collide
CLC
RTL
.normal
LDA $0DB0, Y : CMP.b #$03
RTL
; returns carry set if there is collision immunity
;--------------------------------------------------------------------------------
Utility_CheckHammerHelmasaurKingMask:
LDA.l SpecialWeapons : CMP #$01 : BEQ .no_effect
LDA $0301 : AND #$0A
RTL
.no_effect
LDA #$00
RTL
;--------------------------------------------------------------------------------
Utility_CheckImpervious:
LDA $0E20, X : CMP.b #$CB : BNE .normal
.trinexx
LDA SpecialWeapons : CMP #$01 : BEQ +
CMP #$03 : BEQ +
CMP #$04 : BEQ +
CMP #$05 : BEQ +
CMP #$06 : BEQ .check_sidenexx
BRA .normal
+
LDA $0301 : AND.b #$0A : BNE .impervious ; impervious to hammer
.check_sidenexx
LDA.w $0DD1 : ORA.w $0DD2 : BNE .impervious ; at least one sidenexx alive
LDA.w $0D80, X : CMP.b #$02 : BCS .impervious ; at least one sidenexx alive
BRA .not_impervious
.normal
LDA $0E60, X : AND.b #$40 : BNE .impervious
LDA $0CF2 : CMP #$FF : BEQ .impervious ; special "always-impervious" class
LDA $0E20, X : CMP.b #$CC : BEQ .sidenexx : CMP.b #$CD : BEQ .sidenexx
LDA $0301 : AND.b #$0A : BEQ .not_impervious ; normal behavior if not hammer
JSL Ganon_CheckHammerVulnerability : BCS .not_impervious
LDA SpecialWeapons : CMP #$01 : BEQ +
CMP #$03 : BEQ +
CMP #$04 : BEQ +
CMP #$05 : BEQ +
BRA .not_impervious
+
LDA $0E20, X : CMP.b #$1E : BEQ .not_impervious ; crystal switch
CMP.b #$40 : BEQ .not_impervious ; aga barrier
BRA .impervious
.not_impervious
LDA #$00 : RTL
.impervious
LDA #$01 : RTL
.sidenexx
LDA $0CAA, X : AND.b #$04 : BEQ .vulnerable
LDA SpecialWeapons : CMP #$01 : BEQ +
CMP #$03 : BEQ +
CMP #$04 : BEQ +
CMP #$05 : BEQ +
BRA .not_impervious
+
LDA $0CF2 : CMP #$06 : !BLT .impervious ; swords are ineffective
BRA .not_impervious
.vulnerable
LDA SpecialWeapons : CMP #$01 : BEQ +
CMP #$03 : BEQ +
CMP #$04 : BEQ +
CMP #$05 : BEQ +
BRA .not_impervious
+
LDA $0CF2 : CMP #$06 : !BGE .impervious ; non-swords are ineffective
BRA .not_impervious
; returns nonzero A if impervious
;--------------------------------------------------------------------------------
!SPRITE_INITIALIZED_SEGMENTED = "$1DD6D1"
; start with X = sprite index
;--------------------------------------------------------------------------------
AllowBombingMoldorm:
LDA SpecialWeapons : CMP #$01 : BEQ .no_disable_projectiles
CMP #$03 : BEQ .no_disable_projectiles
CMP #$04 : BEQ .no_disable_projectiles
CMP #$05 : BEQ .no_disable_projectiles
CMP #$06 : BEQ .no_disable_projectiles
INC $0BA0, X
.no_disable_projectiles
JSL !SPRITE_INITIALIZED_SEGMENTED
RTL
;--------------------------------------------------------------------------------
AllowBombingBarrier:
; what we wrote over
LDA $0D00, X : !SUB.b #$0C : STA $0D00, X
LDA $0E20, X : CMP #$40 : BNE .disable_projectiles
LDA SpecialWeapons : CMP #$01 : BEQ .no_disable_projectiles
CMP #$03 : BEQ .no_disable_projectiles
CMP #$04 : BEQ .no_disable_projectiles
CMP #$05 : BEQ .no_disable_projectiles
CMP #$06 : BEQ .no_disable_projectiles
.disable_projectiles
INC $0BA0, X
.no_disable_projectiles
RTL
;--------------------------------------------------------------------------------
DrawBombInMenu:
JSL LoadBombCount16 : AND.w #$00FF : BEQ .noBombs
LDA SpecialWeapons : AND.w #$00FF : CMP.w #$0001 : BNE .vanillaBombs
LDA.l !WEAPON_LEVEL : AND.w #$00FF : BEQ .noBombs : STA $02
LDA.w #$FC81 : STA $04
BRA .done
.vanillaBombs
LDA.w #$0001 : STA $02
LDA.w #$F699 : STA $04
BRA .done
.noBombs
LDA.w #$0000 : STA $02
LDA.w #$F699 : STA $04
.done
RTL
;--------------------------------------------------------------------------------
DrawSwordInMenu:
LDA SpecialWeapons : AND.w #$00FF : CMP.w #$0001 : BEQ .specialSword
CMP.w #$0003 : BEQ .specialSword
CMP.w #$0004 : BEQ .specialSword
CMP.w #$0005 : BEQ .specialSword
LDA $7EF359 : AND.w #$00FF : CMP.w #$00FF : BEQ .noSword
.hasSword
STA $02
LDA.w #$F859 : STA $04
RTL
.noSword
LDA.w #$0000 : STA $02
LDA.w #$F859 : STA $04
RTL
.specialSword
LDA !WEAPON_LEVEL : AND.w #$00FF : STA $02
LDA.w #$FC51 : STA $04
RTL
;--------------------------------------------------------------------------------
DrawBombInYBox:
CPX.w #$0004 : BNE .done
LDA SpecialWeapons : AND.w #$00FF : CMP.w #$0001 : BNE .vanilla
LDA !WEAPON_LEVEL : AND.w #$00FF : CLC : ADC.w #$00BD : BRA .done
.vanilla
LDA.w #$0001
.done
RTL
;--------------------------------------------------------------------------------
BombIcon:
dw $207F, $207F, $3C88, $3C89, $2C88, $2C89, $2488, $2489, $2888, $2889,$2888, $2889
DrawBombOnHud:
PHB
LDA.w #$0149
LDX.w #$86B0
LDY.w #$C700
MVN $7E, $21
PLB
LDA.l SpecialWeapons : AND.w #$00FF : CMP.w #$0001 : BNE .regularBombs
LDA.l !WEAPON_LEVEL : AND.w #$00FF : ASL #2 : TAX
LDA.l BombIcon, X : STA.l $7EC71A
LDA.l BombIcon+2, X : STA.l $7EC71C
.regularBombs
RTL
;--------------------------------------------------------------------------------
BombSpriteColor:
db $04, $08, $04, $02, $0A, $0A
SetBombSpriteColor:
LDA.l SpecialWeapons : CMP.b #$01 : BNE .normal
PHX
LDA.l !WEAPON_LEVEL
TAX
LDA.l BombSpriteColor, X
STA $0B
PLX
RTL
.normal
LDA #$04 : STA $0B
RTL
;--------------------------------------------------------------------------------
StoreSwordDamage:
LDA.l SpecialWeapons : CMP #$02 : BEQ +
LDA.l $06ED39, X : RTL
+
LDA #$05
RTL
;--------------------------------------------------------------------------------
BeeDamageClass:
db $FF
db $06, $00, $07, $08, $0A
db $0B, $0C, $0D, $0E, $0F
db $FF, $03, $FF, $FF, $FF
db $FF, $01, $01, $FF, $FF
CheckDetonateBomb:
LDA.l SpecialWeapons : CMP.b #$01 : BNE .not_bomb_mode
.detonate_bombs
LDX.b #09
.check_ancilla
LDA.w $0C4A, X
CMP.b #$07
BNE .next_ancilla
LDA.b #03
STA.w $039F, X
.next_ancilla
DEX
BPL .check_ancilla
BRA .done
.not_bomb_mode
LDA.l SpecialWeapons : CMP.b #$06 : BNE .done
LDX.w $0202
LDA.l BeeDamageClass, X : CMP.b #$FF : BEQ .nope
JSL $1EDCC9
BMI .nope
LDX.w $0202
LDA.l BeeDamageClass, X
CMP.b #$06 : BNE .set_bee_class
LDA.l $7EF340 : CMP.b #$03 : !BGE .silver_arrows
LDA.b #$06
BRA .set_bee_class
.silver_arrows
LDA.b #$09
.set_bee_class
STA.w $0ED0, Y
BRA .done
.nope
LDA.b #$3C
STA.w $0CF8
JSL $0DBB67
ORA.w $0CF8
STA.w $012E
.done
; what we wrote over
LDA.b #$80
TSB.b $3A
RTL
;--------------------------------------------------------------------------------
SetBeeType:
LDA.l SpecialWeapons : CMP.b #$06 : BEQ .bee_mode
LDX.w $0202
.check_bee_type
LDA.l $7EF33F, X
TAX
LDA.l $7EF35B, X
CMP.b #$08
BNE .regular_bee
LDA.b #$01
STA.w $0EB0, Y
.regular_bee
LDA.b #$01
STA.w $0ED0, Y
RTL
.bee_mode
LDX.w $0202
CPX.b #$10 : BEQ .check_bee_type
BRA .regular_bee
;--------------------------------------------------------------------------------
ArrghusBoing:
LDA.l SpecialWeapons : CMP.b #$06 : BNE .done
LDA.w $0F60, X : AND.b #$BF : STA.w $0F60, X
.done
; what we wrote over
LDA.b #$03
STA.w $0D80, X
RTL
;--------------------------------------------------------------------------------
BeeCheckTarget:
CPY.w $0FA0
BEQ .unsuitable_target
LDA.w $0DD0,Y
CMP.b #$09
BCC .unsuitable_target
LDA.w $0F00,Y
BNE .unsuitable_target
; in bee-mode skip targets that the bee can't hurt
LDA.l SpecialWeapons : CMP.b #$06 : BNE +
JSR BeeCheckDamage
CMP.b #$00 : BEQ .unsuitable_target
+
LDA.w $0E40,Y
BMI .potential_target
LDA.w $0F20,Y
CMP.w $0F20,X
BNE .unsuitable_target
LDA.w $0F60,Y
AND.b #$40
BEQ +
LDA.l SpecialWeapons : CMP.b #$06 : BNE .unsuitable_target
; in bee mode, allow targetting anti-fairies, bunny beams, and keese
LDA.w $0E20,Y
CMP.b #$15 : BEQ + ; anti-fairy
CMP.b #$6F : BEQ + ; keese
CMP.b #$D1 : BEQ + ; bunny beam
BRA .unsuitable_target
+
LDA.w $0BA0,Y
BEQ .valid_target
BRA .unsuitable_target
.potential_target
LDA.w $0EB0,X
BEQ .unsuitable_target
LDA.w $0CD2,Y
AND.b #$40
BNE .valid_target
.unsuitable_target
CLC : RTL
.valid_target
SEC : RTL
;--------------------------------------------------------------------------------
BeeCheckDamage:
PHX : PHP
REP #$20
LDA.w $0E20,Y : AND.w #$00FF
ASL #4
SEP #$20
ORA.w $0ED0,X
REP #$30
TAX
SEP #$20
JSL LookupDamageLevel
SEP #$10
PLP : PLX
RTS

View File

@@ -32,14 +32,14 @@ SpriteSwap_Palette_ArmorAndGloves:
LDA !SPRITE_SWAP : BNE .continue
LDA.b #$10 : STA $BC ; Load Original Sprite Location
REP #$21
LDA ArmorEquipment
LDA $7EF35B
JSL $1BEDFF ; Read Original Palette Code
RTL
.part_two
SEP #$30
LDA !SPRITE_SWAP : BNE .continue
REP #$30
LDA GloveEquipment
LDA $7EF354
JSL $1BEE21 ; Read Original Palette Code
RTL
@@ -51,7 +51,7 @@ SpriteSwap_Palette_ArmorAndGloves:
REP #$20 ; set 16-bit accumulator
; Check what Link's armor value is.
LDA ArmorEquipment : AND.w #$00FF : TAX
LDA $7EF35B : AND.w #$00FF : TAX
; (DEC06, X)

674
sram.asm
View File

@@ -1,674 +0,0 @@
;================================================================================
; 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.
SaveDataWRAM = $7EF000
;================================================================================
; 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 t
; .low Byte: s e h 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)
BombCapacity: skip 1 ; \ Bomb & Arrow Capacity Upgrades
ArrowCapacity: skip 1 ; / Indicates flatly how many can be held (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 2 ; 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
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
ProgressiveSwords: skip 1 ; Number of Progressive Swords obatined (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
ProgressiveShields: skip 1 ; Number of Progressive Shields obtained
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.
skip 44 ; 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
InverseChecksumWRAM: skip 2 ; Vanilla Inverse Checksum. Don't write unless computing checksum.
;================================================================================
; 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 513 ; Reserved for 3rd party developers
;================================================================================
; 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 283 ;
InverseChecksumSRAM: skip 2 ;
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.
PasswordSRAM: skip 16 ; Password value (16 bytes)
skip 8155 ;
SaveBackupSRAM: ; Backup copy of save ram. Game will attempt to use this if
; checksum on file select screen load fails.
base off
;================================================================================
; Bank Definitions
;--------------------------------------------------------------------------------
; If these move (most likely by placing initsramtable.asm somewhere else) these
; bank definitions need to be changed as well.
;================================================================================
SRAMBank = $70
SRAMTableBank = $30|$80
;================================================================================
; 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(BombCapacity, $7EF370)
%assertSRAM(ArrowCapacity, $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(InverseChecksumWRAM, $7EF4FE)
;================================================================================
; Randomizer Assertions
;--------------------------------------------------------------------------------
; Trackers and other third party consumers may depend on these values.
;--------------------------------------------------------------------------------
%assertSRAM(InventoryTracking, $7EF38C)
%assertSRAM(BowTracking, $7EF38E)
%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(ProgressiveSwords, $7EF417)
%assertSRAM(GoalCounter, $7EF418)
%assertSRAM(ProgrammableItemOne, $7EF41A)
%assertSRAM(ProgrammableItemTwo, $7EF41C)
%assertSRAM(ProgrammableItemThree, $7EF41E)
%assertSRAM(BonkCounter, $7EF420)
%assertSRAM(YAItemCounter, $7EF421)
%assertSRAM(ProgressiveShields, $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(ExtendedFileNameWRAM, $7F6000)
%assertSRAM(RoomPotData, $7F6018)
%assertSRAM(SpritePotData, $7F6268)
%assertSRAM(PurchaseCounts, $7F64B8)
%assertSRAM(PrivateBlock, $7F6518)
;================================================================================
; 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(InverseChecksumSRAM, $7004FE)
%assertSRAM(ExtendedFileNameSRAM, $700500)
%assertSRAM(RomVersionSRAM, $701FFC)
%assertSRAM(RomNameSRAM, $702000)
%assertSRAM(PasswordSRAM, $702015)
%assertSRAM(SaveBackupSRAM, $704000)
pullpc

374
stats.asm
View File

@@ -1,37 +1,185 @@
;================================================================================
; Stat Tracking
;================================================================================
; $7EF420 - $7EF468 - Stat Tracking
;
; See sram.asm for adresses and documentation of stat values
; $7EF420 - $7EF46F - Stat Tracking
;--------------------------------------------------------------------------------
; $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:
LDA StatsLocked : BNE +
LDA BonkCounter : INC
LDA !LOCK_STATS : BNE +
LDA !BONK_COUNTER : INC
CMP.b #100 : BEQ + ; decimal 100
STA BonkCounter
STA !BONK_COUNTER
+
RTL
;--------------------------------------------------------------------------------
!SAVE_COUNTER = "$7EF42D"
StatSaveCounter:
PHA
LDA StatsLocked : BNE +
LDA !LOCK_STATS : BNE +
LDA $10 : CMP.b #$17 : BNE + ; not a proper s&q, link probably died
LDA SaveQuitCounter : INC
LDA !SAVE_COUNTER : INC
CMP.b #100 : BEQ + ; decimal 100
STA SaveQuitCounter
STA !SAVE_COUNTER
+
PLA
RTL
;--------------------------------------------------------------------------------
!SAVE_COUNTER = "$7EF42D"
DecrementSaveCounter:
PHA
LDA StatsLocked : BNE +
LDA SaveQuitCounter : DEC : STA SaveQuitCounter
LDA !LOCK_STATS : BNE +
LDA !SAVE_COUNTER : DEC : STA !SAVE_COUNTER
+
PLA
RTL
;--------------------------------------------------------------------------------
!TRANSITION_COUNTER = "$7EF43C"
DungeonHoleWarpTransition:
LDA $01C31F, X
BRA StatTransitionCounter
@@ -40,10 +188,10 @@ DungeonHoleEntranceTransition:
LDA.l SilverArrowsAutoEquip : AND.b #$02 : BEQ +
LDA $010E : CMP.b #$7B : BNE + ; skip unless falling to ganon's room
LDA BowTracking : AND.b #$40 : BEQ + ; skip if we don't have silvers
LDA BowEquipment : BEQ + ; skip if we have no bow
LDA !INVENTORY_SWAP_2 : AND.b #$40 : BEQ + ; skip if we don't have silvers
LDA $7EF340 : BEQ + ; skip if we have no bow
CMP.b #$03 : !BGE + ; skip if the bow is already silver
!ADD #$02 : STA BowEquipment ; increase bow to silver
!ADD #$02 : STA $7EF340 ; increase bow to silver
+
BRA StatTransitionCounter
@@ -58,26 +206,27 @@ DungeonExitTransition:
LDA.b #$0F : STA $10 ; stop running through the transition
StatTransitionCounter:
PHA : PHP
LDA StatsLocked : BNE +
LDA !LOCK_STATS : BNE +
REP #$20 ; set 16-bit accumulator
LDA ScreenTransitions : INC
LDA !TRANSITION_COUNTER : INC
CMP.w #999 : BEQ + ; decimal 999
STA ScreenTransitions
STA !TRANSITION_COUNTER
+
PLP : PLA
RTL
;--------------------------------------------------------------------------------
!FLUTE_COUNTER = "$7EF44B"
IncrementFlute:
LDA StatsLocked : BNE +
LDA FluteCounter : INC : STA FluteCounter
LDA !LOCK_STATS : BNE +
LDA !FLUTE_COUNTER : INC : STA !FLUTE_COUNTER
+
JSL.l StatTransitionCounter ; also increment transition counter
RTL
;--------------------------------------------------------------------------------
IncrementSmallKeys:
STA CurrentSmallKeys ; thing we wrote over, write small key count
STA $7EF36F ; thing we wrote over, write small key count
PHX
LDA StatsLocked : BNE +
LDA !LOCK_STATS : BNE +
JSL AddInventory_incrementKeyLong
+
JSL.l UpdateKeys
@@ -87,9 +236,9 @@ IncrementSmallKeys:
RTL
;--------------------------------------------------------------------------------
IncrementSmallKeysNoPrimary:
STA CurrentSmallKeys ; thing we wrote over, write small key count
STA $7EF36F ; thing we wrote over, write small key count
PHX
LDA StatsLocked : BNE +
LDA !LOCK_STATS : BNE +
JSL AddInventory_incrementKeyLong
+
JSL.l UpdateKeys
@@ -106,7 +255,7 @@ IncrementSmallKeysNoPrimary:
RTL
;--------------------------------------------------------------------------------
DecrementSmallKeys:
STA CurrentSmallKeys ; thing we wrote over, write small key count
STA $7EF36F ; thing we wrote over, write small key count
JSL.l UpdateKeys
RTL
;--------------------------------------------------------------------------------
@@ -127,7 +276,7 @@ CountChestKey: ; called by neighbor functions
INC ; combines HC and Sewer counts
+ TAX
.count
LDA DungeonCollectedKeys, X : INC : STA DungeonCollectedKeys, X
LDA $7EF4E0, X : INC : STA $7EF4E0, X
.end
PLX : PLA
RTS
@@ -149,61 +298,77 @@ RTL
;--------------------------------------------------------------------------------
IncrementAgahnim2Sword:
PHA
LDA StatsLocked : BNE +
LDA !LOCK_STATS : BNE +
JSL AddInventory_incrementBossSwordLong
+
PLA
RTL
;--------------------------------------------------------------------------------
!DEATH_COUNTER = "$7EF449"
IncrementDeathCounter:
PHA
LDA StatsLocked : BNE +
LDA CurrentHealth : BNE + ; link is still alive, skip
LDA DeathCounter : INC : STA DeathCounter
LDA !LOCK_STATS : BNE +
LDA $7EF36D : BNE + ; link is still alive, skip
LDA !DEATH_COUNTER : INC : STA !DEATH_COUNTER
;JSL.l DecrementSaveCounter
+
PLA
RTL
;--------------------------------------------------------------------------------
!FAIRY_COUNTER = "$7EF453"
IncrementFairyRevivalCounter:
STA BottleContents, X ; thing we wrote over
STA $7EF35C, X ; thing we wrote over
PHA
LDA StatsLocked : BNE +
LDA FaerieRevivalCounter : INC : STA FaerieRevivalCounter
LDA !LOCK_STATS : BNE +
LDA !FAIRY_COUNTER : INC : STA !FAIRY_COUNTER
+
PLA
RTL
;--------------------------------------------------------------------------------
!CHESTTURN_COUNTER = "$7EF468"
IncrementChestTurnCounter:
PHA
LDA StatsLocked : BNE +
LDA ChestTurnCounter : INC : STA ChestTurnCounter
LDA !LOCK_STATS : BNE +
LDA !CHESTTURN_COUNTER : INC : STA !CHESTTURN_COUNTER
+
PLA
RTL
;--------------------------------------------------------------------------------
!BOMBS_PLACED_COUNTER = "$7EF46E"
IncrementBombsPlacedCounter:
PHA
LDA !LOCK_STATS : BNE +
PHP : REP #$20
LDA !BOMBS_PLACED_COUNTER : INC : STA !BOMBS_PLACED_COUNTER
PLP
+
PLA
RTL
;--------------------------------------------------------------------------------
!CHEST_COUNTER = "$7EF442"
IncrementChestCounter:
LDA.b #$01 : STA $02E9 ; thing we wrote over
PHA
LDA StatsLocked : BNE +
LDA ChestsOpened : INC : STA ChestsOpened
LDA !LOCK_STATS : BNE +
LDA !CHEST_COUNTER : INC : STA !CHEST_COUNTER
+
PLA
RTL
;--------------------------------------------------------------------------------
!CHEST_COUNTER = "$7EF442"
DecrementChestCounter:
PHA
LDA StatsLocked : BNE +
LDA ChestsOpened : DEC : STA ChestsOpened
LDA !LOCK_STATS : BNE +
LDA !CHEST_COUNTER : DEC : STA !CHEST_COUNTER
+
PLA
RTL
;--------------------------------------------------------------------------------
!ITEM_TOTAL = "$7EF423"
DecrementItemCounter:
PHA
LDA StatsLocked : BNE +
REP #$20
LDA TotalItemCounter : DEC : STA TotalItemCounter
SEP #$20
LDA !LOCK_STATS : BNE +
LDA !ITEM_TOTAL : DEC : STA !ITEM_TOTAL
+
PLA
RTL
@@ -211,102 +376,107 @@ RTL
IncrementBigChestCounter:
JSL.l Dungeon_SaveRoomQuadrantData ; thing we wrote over
PHA
LDA StatsLocked : BNE +
%BottomHalf(BigKeysBigChests)
LDA !LOCK_STATS : BNE +
%BottomHalf($7EF427)
+
PLA
RTL
;--------------------------------------------------------------------------------
!DAMAGE_COUNTER = $7EF46A
!MAGIC_COUNTER = $7EF46C
IncrementDamageTakenCounter_Eight:
STA.l CurrentHealth
STA.l $7EF36D
PHA : PHP
LDA StatsLocked : BNE +
LDA !LOCK_STATS : BNE +
REP #$21
LDA.l DamageCounter
LDA.l !DAMAGE_COUNTER
ADC.w #$0008
BCC ++
LDA.w #$FFFF
++ STA.l DamageCounter
++ STA.l !DAMAGE_COUNTER
+ PLP
PLA
RTL
IncrementDamageTakenCounter_Arb:
PHP
LDA StatsLocked : BNE +
LDA !LOCK_STATS : BNE +
REP #$21
LDA.b $00
AND.w #$00FF
ADC.l DamageCounter
ADC.l !DAMAGE_COUNTER
BCC ++
LDA.w #$FFFF
++ STA.l DamageCounter
++ STA.l !DAMAGE_COUNTER
+ PLP
LDA.l CurrentHealth
LDA.l $7EF36D
RTL
IncrementMagicUseCounter:
STA.l CurrentMagic
STA.l $7EF36E
IncrementMagicUseCounterByrna:
PHA : PHP
LDA StatsLocked : BNE +
LDA !LOCK_STATS : BNE +
REP #$21
LDA.b $00
AND.w #$00FF
ADC.l MagicCounter
ADC.l !MAGIC_COUNTER
BCC ++
LDA.w #$FFFF
++ STA.l MagicCounter
++ STA.l !MAGIC_COUNTER
+ PLP : PLA
RTL
IncrementMagicUseCounterOne:
LDA StatsLocked : BNE +
LDA !LOCK_STATS : BNE +
REP #$20
LDA.l MagicCounter
LDA.l !MAGIC_COUNTER
INC
BEQ ++
STA.l MagicCounter
STA.l !MAGIC_COUNTER
++ SEP #$20
+ LDA.l CurrentMagic
+ LDA.l $7EF36E
RTL
;--------------------------------------------------------------------------------
!OW_MIRROR_COUNTER = "$7EF43A"
IncrementOWMirror:
PHA
LDA #$08 : STA $021B ; fail race game
LDA StatsLocked : BNE +
LDA CurrentWorld : BEQ + ; only do this for DW->LW
LDA OverworldMirrors : INC : STA OverworldMirrors
LDA !LOCK_STATS : BNE +
LDA $7EF3CA : BEQ + ; only do this for DW->LW
LDA !OW_MIRROR_COUNTER : INC : STA !OW_MIRROR_COUNTER
+
PLA
JMP StatTransitionCounter
;--------------------------------------------------------------------------------
!UW_MIRROR_COUNTER = "$7EF43B"
IncrementUWMirror:
PHA
LDA.b #$00 : STA $7F5035 ; bandaid patch bug with mirroring away from text
LDA StatsLocked : BNE +
LDA !LOCK_STATS : BNE +
LDA $040C : CMP #$FF : BEQ + ; skip if we're in a cave or house
LDA UnderworldMirrors : INC : STA UnderworldMirrors
LDA !UW_MIRROR_COUNTER : INC : STA !UW_MIRROR_COUNTER
JSL.l StatTransitionCounter
+
PLA
JSL.l Dungeon_SaveRoomData ; thing we wrote over
RTL
;--------------------------------------------------------------------------------
!SPENT_RUPEES = "$7EF42B"
IncrementSpentRupees:
DEC A : BPL .subtractRupees
LDA.w #$0000 : STA CurrentRupees
LDA.w #$0000 : STA $7EF360
RTL
.subtractRupees
PHA : PHP
LDA StatsLocked : AND.w #$00FF : BNE +
LDA RupeesSpent : INC
LDA !LOCK_STATS : AND.w #$00FF : BNE +
LDA !SPENT_RUPEES : INC
CMP.w #9999 : BEQ + ; decimal 9999
STA RupeesSpent
STA !SPENT_RUPEES
+
PLP : PLA
RTL
@@ -321,46 +491,76 @@ IndoorSubtileTransitionCounter:
STZ $0642
JMP StatTransitionCounter
;--------------------------------------------------------------------------------
!CHEST_COUNTER = "$7EF442"
!MAIL_COUNTER = "$7EF424" ; mmkkkkkk
!BOSS_KILLS = "$7F5037"
!SWORD_KILLS_1 = "$7EF425"
!SWORD_KILLS_2 = "$7EF426"
!GTOWER_PRE_BIG_KEY = "$7EF42A" ; ---ccccc
!NONCHEST_COUNTER = "$7F503E"
!SAVE_COUNTER = "$7EF42D"
!TRANSITION_COUNTER = "$7EF43C"
!NMI_COUNTER = "$7EF43E"
!LOOP_COUNTER = "$7EF42E"
!LAG_TIME = "$7F5038"
!RUPEES_COLLECTED = "$7F503C"
!ITEM_TOTAL = "$7EF423"
!RTA_END = "$7EF44F"
StatsFinalPrep:
PHA : PHX : PHP
SEP #$30 ; set 8-bit accumulator and index registers
LDA StatsLocked : BNE .ramPostOnly
INC : STA StatsLocked
LDA !LOCK_STATS : BNE .ramPostOnly
INC : STA !LOCK_STATS
JSL.l AddInventory_incrementBossSwordLong
LDA HighestMail : INC : STA HighestMail ; add green mail to mail count
LDA !MAIL_COUNTER : !ADD #$40 : STA !MAIL_COUNTER ; 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 ScreenTransitions : DEC : STA ScreenTransitions ; remove extra transition from exiting gtower via duck
LDA !TRANSITION_COUNTER : DEC : STA !TRANSITION_COUNTER ; remove extra transition from exiting gtower via duck
.ramPostOnly
LDA SwordBossKills : LSR #4 : !ADD SwordBossKills : STA !BOSS_KILLS
LDA SwordBossKills+1 : LSR #4 : !ADD SwordBossKills+1 : !ADD !BOSS_KILLS : AND #$0F : STA !BOSS_KILLS
LDA !SWORD_KILLS_1 : LSR #4 : !ADD !SWORD_KILLS_1 : STA !BOSS_KILLS
LDA !SWORD_KILLS_2 : LSR #4 : !ADD !SWORD_KILLS_2 : !ADD !BOSS_KILLS : AND #$0F : STA !BOSS_KILLS
LDA NMIFrames : !SUB LoopFrames : STA !LAG_TIME
LDA NMIFrames+1 : SBC LoopFrames+1 : STA !LAG_TIME+1
LDA NMIFrames+2 : SBC LoopFrames+2 : STA !LAG_TIME+2
LDA NMIFrames+3 : SBC LoopFrames+3 : STA !LAG_TIME+3
LDA !NMI_COUNTER : !SUB !LOOP_COUNTER : STA !LAG_TIME
LDA !NMI_COUNTER+1 : SBC !LOOP_COUNTER+1 : STA !LAG_TIME+1
LDA !NMI_COUNTER+2 : SBC !LOOP_COUNTER+2 : STA !LAG_TIME+2
LDA !NMI_COUNTER+3 : SBC !LOOP_COUNTER+3 : STA !LAG_TIME+3
LDA RupeesSpent : !ADD DisplayRupees : STA !RUPEES_COLLECTED
LDA RupeesSpent+1 : ADC DisplayRupees+1 : STA !RUPEES_COLLECTED+1
REP #$20
LDA TotalItemCounter : !SUB ChestsOpened : STA !NONCHEST_COUNTER
LDA !SPENT_RUPEES : !ADD $7EF362 : STA !RUPEES_COLLECTED
LDA !SPENT_RUPEES+1 : ADC $7EF363 : STA !RUPEES_COLLECTED+1
LDA !ITEM_TOTAL : !SUB !CHEST_COUNTER : 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
PLP : PLX : PLA
LDA.b #$19 : STA $10 ; thing we wrote over, load triforce room
STZ $11
STZ $B0
STZ $11
STZ $B0
RTL
;--------------------------------------------------------------------------------
; Notes:

View File

@@ -3,15 +3,59 @@
;===================================================================================================
table "creditscharmapbighi.txt"
YourSpriteCreditsHi:
db 2
db 55
db " " ; $238002
db 2, 55, " " ; $238002
table "creditscharmapbiglo.txt"
YourSpriteCreditsLo:
db 2
db 55
db " " ; $238020
db 2, 55, " " ; $238020
table "creditscharmapbighi.txt"
FirstSwordStatsHi:
db 2, 55, "FIRST SWORD " ; $23803E
table "creditscharmapbiglo.txt"
FirstSwordStatsLo:
db 2, 55, "FIRST SWORD " ; $23805C
table "creditscharmapbighi.txt"
SwordlessKillsHi:
db 2, 55, "SWORDLESS /13" ; $23807A
table "creditscharmapbiglo.txt"
SwordlessKillsLo:
db 2, 55, "SWORDLESS /13" ; $238098
table "creditscharmapbighi.txt"
FighterSwordKillsHi:
db 2, 55, "FIGHTER'S SWORD /13" ; $2380B6
table "creditscharmapbiglo.txt"
FighterSwordKillsLo:
db 2, 55, "FIGHTER'S SWORD /13" ; $2380D4
table "creditscharmapbighi.txt"
MasterSwordKillsHi:
db 2, 55, "MASTER SWORD /13" ; $2380F2
table "creditscharmapbiglo.txt"
MasterSwordKillsLo:
db 2, 55, "MASTER SWORD /13" ; $238110
table "creditscharmapbighi.txt"
TemperedSwordKillsHi:
db 2, 55, "TEMPERED SWORD /13" ; $23812E
table "creditscharmapbiglo.txt"
TemperedSwordKillsLo:
db 2, 55, "TEMPERED SWORD /13" ; $23814C
table "creditscharmapbighi.txt"
GoldSwordKillsHi:
db 2, 55, "GOLD SWORD /13" ; $23816A
table "creditscharmapbiglo.txt"
GoldSwordKillsLo:
db 2, 55, "GOLD SWORD /13" ; $238188
;===================================================================================================
@@ -596,7 +640,8 @@ endif
%blankline()
%blankline()
%bigcreditsleft("FIRST SWORD")
%addarbline(FirstSwordStatsHi)
%addarbline(FirstSwordStatsLo)
%blankline()
@@ -619,23 +664,28 @@ endif
%blankline()
%blankline()
%bigcreditsleft("SWORDLESS /13")
%addarbline(SwordlessKillsHi)
%addarbline(SwordlessKillsLo)
%blankline()
%bigcreditsleft("FIGHTER'S SWORD /13")
%addarbline(FighterSwordKillsHi)
%addarbline(FighterSwordKillsLo)
%blankline()
%bigcreditsleft("MASTER SWORD /13")
%addarbline(MasterSwordKillsHi)
%addarbline(MasterSwordKillsLo)
%blankline()
%bigcreditsleft("TEMPERED SWORD /13")
%addarbline(TemperedSwordKillsHi)
%addarbline(TemperedSwordKillsLo)
%blankline()
%bigcreditsleft("GOLD SWORD /13")
%addarbline(GoldSwordKillsHi)
%addarbline(GoldSwordKillsLo)
%blankline()
%blankline()
@@ -657,6 +707,10 @@ endif
%blankline()
%bigcreditsleft("BOMBS PLACED")
%blankline()
%bigcreditsleft("SAVE AND QUITS")
%blankline()
@@ -676,11 +730,6 @@ endif
%bigcreditsleft("TOTAL LAG TIME")
%blankline()
%blankline()
%blankline()
%blankline()
%blankline()
@@ -736,16 +785,18 @@ endif
!MAGICUSED_Y = 349
!BONKS_X = 26
!BONKS_Y = 352
!BOMBS_X = 26
!BOMBS_Y = 355
!SAVE_AND_QUITS_X = 26
!SAVE_AND_QUITS_Y = 355
!SAVE_AND_QUITS_Y = 358
!DEATHS_X = 26
!DEATHS_Y = 358
!DEATHS_Y = 361
!FAERIE_REVIVALS_X = 26
!FAERIE_REVIVALS_Y = 361
!FAERIE_REVIVALS_Y = 364
!TOTAL_MENU_TIME_X = 19
!TOTAL_MENU_TIME_Y = 364
!TOTAL_MENU_TIME_Y = 367
!TOTAL_LAG_TIME_X = 19
!TOTAL_LAG_TIME_Y = 367
!TOTAL_LAG_TIME_Y = 370
!COLLECTION_RATE_X = 22
!COLLECTION_RATE_Y = 380
!TOTAL_TIME_X = 19

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

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

View File

@@ -20,7 +20,7 @@
;JML.l Smithy_DoesntHaveSword
;================================================================================
;LoadSwordForDamage:
; LDA SwordEquipment : CMP #$04 : BNE .done ; skip if not gold sword
; LDA $7EF359 : CMP #$04 : BNE .done ; skip if not gold sword
; LDA $1B : BEQ + ; skip if outdoors
; LDA $A0 : CMP #41 : BNE + ; decimal 41 ; skip if not in the mothula room
; LDA #$03 ; pretend we're using tempered
@@ -39,43 +39,55 @@ LoadSwordForDamage:
JSR.w LoadModifiedSwordLevel ; load normal sword value
RTL
;================================================================================
macro LookupDamageSubclass(table_address)
PHP
REP #$20 ; set 16-bit accumulator
TXA : LSR : TAX : BCS +
PLP
LDA.l <table_address>, X
LSR #4
BRA ++
+
PLP
LDA.l <table_address>, X
AND.b #$0F
++
endmacro
;================================================================================
;!StalfosBombDamage = "$7F509D"
LookupDamageLevel:
CPX.w #$0918 : BNE +
LDA.l !StalfosBombDamage
RTL
+
PHP
REP #$20 ; set 16-bit accumulator
TXA : LSR : TAX : BCS .lower
.upper
PLP
LDA.l Damage_Table, X
LSR #4
RTL
.lower
PLP
LDA.l Damage_Table, X
AND.b #$0F
RTL
LDA SpecialWeapons : CMP #$01 : BEQ .bomb_table
CMP #$02 : BEQ .pseudo_table
CMP #$03 : BEQ .bomb_table
CMP #$04 : BEQ .bomb_table
CMP #$05 : BEQ .bomb_table
%LookupDamageSubclass(Damage_Table) : RTL
.bomb_table
%LookupDamageSubclass(Damage_Table_Bombs) : RTL
.pseudo_table
%LookupDamageSubclass(Damage_Table_Pseudo) : RTL
;================================================================================
; $7F50C0 - Sword Modifier
LoadModifiedSwordLevel: ; returns short
LDA $7F50C0 : BEQ +
!ADD SwordEquipment ; add normal sword value to modifier
!ADD $7EF359 ; add normal sword value to modifier
BNE ++ : LDA.b #$01 : RTS : ++
CMP.b #$05 : !BLT ++ : LDA.b #$04 : RTS : ++
RTS
+
LDA SwordEquipment ; load normal sword value
LDA $7EF359 ; load normal sword value
RTS
;================================================================================
; ArmorEquipment - Armor Inventory
; $7EF35B - Armor Inventory
; $7F50C2 - Armor Modifier
; $7F5020 - Scratch Space (Caller Preserved)
LoadModifiedArmorLevel:
PHA
LDA ArmorEquipment : !ADD $7F50C2
LDA $7EF35B : !ADD $7F50C2
CMP.b #$FF : BNE + : LDA.b #$00 : +
CMP.b #$03 : !BLT + : LDA.b #$02 : +
STA $7F5020
@@ -83,50 +95,60 @@ LoadModifiedArmorLevel:
!ADD $7F5020
RTL
;================================================================================
; MagicConsumption - Magic Inventory
; $7EF37B - Magic Inventory
; $7F50C3 - Magic Modifier
LoadModifiedMagicLevel:
LDA $7F50C3 : BEQ +
!ADD MagicConsumption ; add normal magic value to modifier
!ADD $7EF37B ; add normal magic value to modifier
CMP.b #$FF : BNE ++ : LDA.b #$00 : RTL : ++
CMP.b #$03 : !BLT ++ : LDA.b #$02 : ++
RTL
+
LDA MagicConsumption ; load normal magic value
LDA $7EF37B ; load normal magic value
RTL
;================================================================================
; $7E0348 - Ice Value
; $7F50C7 - Ice Modifier
; $7F50C7 - Temporary Ice Modifier
; $30802D - Permanent Ice Modifier ($01 bit)
LoadModifiedIceFloorValue:
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 $5E : CMP #$02 : BEQ +
LDA $5B : BNE +
LDA.l $30802D : BIT #$01 : BEQ ++
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 $7F50C7 : RTS
+ : LDA.w $0348
RTS
LoadModifiedIceFloorValue_a11:
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 $5E : CMP #$02 : BEQ +
LDA $5B : BNE +
LDA.w $0348 : ORA $7F50C7 : AND.b #$11 : RTL
+ : LDA.w $0348 : AND.b #$11
RTL
JSR LoadModifiedIceFloorValue : AND.b #$11 : RTL
LoadModifiedIceFloorValue_a01:
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 $5E : CMP #$02 : BEQ +
LDA $5B : BNE +
LDA.w $0348 : ORA $7F50C7 : AND.b #$01 : RTL
+ : LDA.w $0348 : AND.b #$01
RTL
JSR LoadModifiedIceFloorValue : AND.b #$01 : RTL
;================================================================================
CheckTabletSword:
LDA.l AllowHammerTablets : BEQ +
LDA HammerEquipment : BEQ + ; check for hammer
LDA.b #$02 : RTL
LDA $7EF34B : BNE .allow ; check for hammer
+
LDA SwordEquipment ; get actual sword value
LDA.l SpecialWeapons : CMP #$01 : BEQ .check_special
CMP #$03 : BEQ .check_special
CMP #$04 : BEQ .check_special
CMP #$05 : BEQ .check_special
CMP #$06 : BEQ .allow
BRA .normal
.allow
LDA.b #$02 : RTL
.check_special
LDA !WEAPON_LEVEL : CMP #$02 : !BGE .allow ; check for master bombs
.normal
LDA $7EF359 ; get actual sword value
RTL
;================================================================================
GetSwordLevelForEvilBarrier:
LDA.l AllowHammerEvilBarrierWithFighterSword : BEQ +
LDA #$FF : RTL
+
LDA SwordEquipment
LDA $7EF359
RTL
;================================================================================
CheckGanonHammerDamage:
@@ -134,7 +156,17 @@ CheckGanonHammerDamage:
LDA $0E20, X : CMP.b #$D8 ; original behavior except ganon
RTL
+
LDA.l GanonVulnerabilityItem : CMP.b #$0C : BEQ +
LDA $0E20, X : CMP.b #$D6 ; original behavior
RTL
+
LDA $0E20, X : CMP.b #$D8 : BCC +
RTL
+
CMP.b #$D6 : BNE +
RTL
+
CLC
RTL
;================================================================================
GetSmithSword:
@@ -143,7 +175,7 @@ GetSmithSword:
JML.l Smithy_DoesntHaveSword ; Classic Smithy
+
REP #$20 : LDA CurrentRupees : CMP #$000A : SEP #$20 : !BGE .buy
REP #$20 : LDA $7EF360 : CMP #$000A : SEP #$20 : !BGE .buy
.cant_afford
REP #$10
LDA.b #$7A
@@ -158,9 +190,9 @@ GetSmithSword:
STZ $02E9 ; Item from NPC
PHX : JSL Link_ReceiveItem : PLX
REP #$20 : LDA CurrentRupees : !SUB.w #$000A : STA CurrentRupees : SEP #$20 ; Take 10 rupees
REP #$20 : LDA $7EF360 : !SUB.w #$000A : STA $7EF360 : SEP #$20 ; Take 10 rupees
JSL ItemSet_SmithSword
.done
JML.l Smithy_AlreadyGotSword
;================================================================================
@@ -170,7 +202,7 @@ CheckMedallionSword:
LDA.b #$02 ; Pretend we have master sword
RTL
.check_sword
LDA SwordEquipment
LDA $7EF359
RTL
.check_pad
PHB : PHX : PHY
@@ -208,19 +240,19 @@ CheckMedallionSword:
.outdoors
LDA $8A : CMP.b #$70 : BNE +
LDA.l MireRequiredMedallion : TAX : LDA.l .medallion_type, X : CMP $0303 : BNE .done
LDA OverworldEventDataWRAM+$70 : AND.b #$20 : BNE .done
LDA $7EF2F0 : AND.b #$20 : BNE .done
LDA.b #$08 : PHA : PLB ; set data bank to $08
LDY.b #$02 : JSL.l Ancilla_CheckIfEntranceTriggered : BCS .permit ; misery mire
BRA .done
+ : CMP.b #$47 : BNE +
LDA.l TRockRequiredMedallion : TAX : LDA.l .medallion_type, X : CMP $0303 : BNE .done
LDA OverworldEventDataWRAM+$47 : AND.b #$20 : BNE .done
LDA $7EF2C7 : AND.b #$20 : BNE .done
LDA.b #$08 : PHA : PLB ; set data bank to $08
LDY.b #$03 : JSL.l Ancilla_CheckIfEntranceTriggered : BCS .permit ; turtle rock
+
.done
PLY : PLX : PLB
LDA SwordEquipment
LDA $7EF359
RTL
.permit
SEP #$20 ; set 8-bit accumulator

View File

@@ -98,19 +98,50 @@ db #$02 ; #$02 = Tempered Sword (default)
;org $05EBD4 ; PC 0x2EBD4 - sprite_zelda.asm:23 - (LDA $7EF359 : CMP.b #$02 : BCS .hasMasterSword) - Zelda Spawnpoint Sword Check
;db #$05 ; #$02 = Tempered Sword (default) - #$05 = All Swords
;--------------------------------------------------------------------------------
; 0x18002B- 0x180030 (Unused)
; 0x18002B- 0x18002C (Unused)
;--------------------------------------------------------------------------------
org $30802D ; PC 0x18003D
ChallengeModes:
; ---- ---i
; i: Permanent Ice Physics
db #$00 ; #$00 = Default behavior;
;--------------------------------------------------------------------------------
org $30802E ; PC 0x18003E
GanonVulnerabilityItem:
db #$00 ; #$00 = Default behavior (silver arrows)
;--------------------------------------------------------------------------------
org $30802F ; PC 0x18003F
SpecialWeapons:
db #$00
; $00 = Off (default)
; $01 = Bomb-Only mode
; $02 = Pseudosword
; $03 = Byrna-Only mode
; $04 = Somaria-Only mode
; $05 = Canes-Only mode
; $06 = Bee mode
;--------------------------------------------------------------------------------
org $308030 ; PC 0x180030
EnableSRAMTrace:
db #$00 ; #$00 = Off (default) - #$01 = On
;--------------------------------------------------------------------------------
org $308031 ; PC 0x180031
EnableEasterEggs:
db #$00 ; #$00 = Off (default) - #$01 = On
;--------------------------------------------------------------------------------
; 0x180032 (unused)
org $308032 ; PC 0x180032
OpenMode:
db #$01 ; #$00 = Normal (default) - #$01 = Open
;--------------------------------------------------------------------------------
org $308033 ; PC 0x180033
HeartBeep:
db #$20 ; #$00 = Off - #$20 = Normal (default) - #$40 = Half Speed - #$80 = Quarter Speed
;--------------------------------------------------------------------------------
; 0x180034 - 0x180035 (Unused)
org $308034 ; PC 0x180034 - 0x180035
StartingMaxBombs:
db #10 ; #10 = Default (10 decimal)
StartingMaxArrows:
db #30 ; #30 = Default (30 decimal)
;--------------------------------------------------------------------------------
org $308036 ; PC 0x180036 - 0x180037
RupoorDeduction:
@@ -151,7 +182,9 @@ org $30803F ; PC 0x18003F
HammerableGanon:
db #$00 ; #$00 = Off (default) - #$01 = On
;--------------------------------------------------------------------------------
; 0x180040 - (unused)
org $308040 ; PC 0x180040
PreopenCurtains:
db #$00 ; #$00 = Off (default) - #$01 = On
;--------------------------------------------------------------------------------
org $308041 ; PC 0x180041
AllowSwordlessMedallionUse:
@@ -161,7 +194,9 @@ org $308042 ; PC 0x180042
PermitSQFromBosses:
db #$00 ; #$00 = Off (default) - #$01 = On
;--------------------------------------------------------------------------------
; 0x180043 (unused)
org $308043 ; PC 0x180043
StartingSword:
db #$00 ; #$00 = No Sword (default) - #$FF = Non-Sword
;--------------------------------------------------------------------------------
org $308044 ; PC 0x180044
AllowHammerTablets:
@@ -176,7 +211,9 @@ HUDDungeonItems:
; display ---edcba a: Small Keys, b: Big Key, c: Map, d: Compass, e: Bosses
db #$00
;--------------------------------------------------------------------------------
; 0x180046 (unused)
org $308046 ; PC 0x180046 Link's starting equipment
LinkStartingRupees:
dw #$0000
;--------------------------------------------------------------------------------
org $308048 ; PC 0x180048
MenuSpeed:
@@ -207,10 +244,13 @@ db #$00 ; #$00 = Off (default) - #$01 = On (frog/smith can enter multi-entrance
org $30804D ; PC 0x18004D
EscapeAssist: ; ScrubMode:
db #$00
;---- -mba
;m - Infinite Magic
;b - Infinite Bombs
;a - Infinite Arrows
;-MBA -mba
;M - Infinite Magic (after escape)
;B - Infinite Bombs (after escape)
;A - Infinite Arrows (after escape)
;m - Infinite Magic (during escape)
;b - Infinite Bombs (during escape)
;a - Infinite Arrows (during escape)
;--------------------------------------------------------------------------------
org $30804E ; PC 0x18004E
UncleRefill:
@@ -226,7 +266,7 @@ db #$01 ; #$00 = Off - #$01 = On (default)
;--------------------------------------------------------------------------------
org $308050 ; PC 0x180050 - 0x18005C
CrystalPendantFlags_2:
db $00 ; Sewers
db $00 ; Sewers
db $00 ; Hyrule Castle
db $00 ; Eastern Palace
db $00 ; Desert Palace
@@ -234,7 +274,7 @@ CrystalPendantFlags_2:
db $40 ; Swamp Palace
db $40 ; Palace of Darkness
db $40 ; Misery Mire
db $40 ; Skull Woods
db $40 ; Skull Woods
db $40 ; Ice Palace
.hera
db $00 ; Tower of Hera
@@ -328,15 +368,15 @@ db $00 ;
;Warp BL : 7A
;Warp BR : 7B
;--------------------------------------------------------------------------------
org $308080 ; PC 0x180080 - 0x180083 ; Default to fill on upgrade. Can be set to 0 to not fill.
org $308080 ; PC 0x180080 - 0x180083
Upgrade5BombsRefill:
db #$32
db #$00
Upgrade10BombsRefill:
db #$32
db #$00
Upgrade5ArrowsRefill:
db #$46
db #$00
Upgrade10ArrowsRefill:
db #$46
db #$00
;--------------------------------------------------------------------------------
org $308084 ; PC 0x180084 - 0x180085
PotionHealthRefill:
@@ -360,13 +400,25 @@ org $30808A ; PC 0x18008A
BlockCastleDoorsInRain:
db #$00 ; #$00 - Normal, $01 - Block them (Used by Entrance Rando in Standard Mode)
;--------------------------------------------------------------------------------
; 0x18008B-0x18008D (unused)
org $30808B ; PC 0x18008B
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
FakeBoots:
db $00 ; #$00 = Off (default) - #$01 = On
;--------------------------------------------------------------------------------
; 0x18008F (unused)
org $30808F ; PC 0x18008F
SeededRNG:
db $01 ; #$00 = Off - #$01 = Seeded RNG (default for rando)
;--------------------------------------------------------------------------------
org $308090 ; PC 0x180090 - 0x180097
ProgressiveSwordLimit:
@@ -626,7 +678,7 @@ dw $6434 ; #6434 - Crystal
;--------------------------------------------------------------------------------
org $02A09B ; PC 0x1209B - Bank02.asm:5802 - (pool MilestoneItem_Flags:)
CrystalPendantFlags:
db $00 ; Sewers
db $00 ; Sewers
db $00 ; Hyrule Castle
db $04 ; Eastern Palace
db $02 ; Desert Palace
@@ -634,7 +686,7 @@ CrystalPendantFlags:
db $10 ; Swamp Palace
db $02 ; Palace of Darkness
db $01 ; Misery Mire
db $40 ; Skull Woods
db $40 ; Skull Woods
db $04 ; Ice Palace
.hera
db $01 ; Tower of Hera
@@ -801,9 +853,13 @@ org $308165 ; PC 0x180165
GoalItemIcon:
dw #$280E ; #$280D = Star - #$280E = Triforce Piece (default)
;================================================================================
org $308167 ; PC 0x180167-0x180167
org $308167 ; PC 0x180167
GoalItemRequirement:
dw $0000 ; #$0000 = Off (default) - #$XXXX = Require $XX Goal Items - #$FFFF = Counter-Only
db #$00 ; #$00 = Off (default) - #$XX = Require $XX Goal Items - #$FF = Counter-Only
;================================================================================
org $308168 ; PC 0x180168
ByrnaCaveSpikeDamage:
db #$08 ; #$08 = 1 Heart (default) - #$02 = 1/4 Heart
;================================================================================
org $308169 ; PC 0x180169
AgahnimDoorStyle:
@@ -926,22 +982,17 @@ org $308194 ; PC 0x180194
TurnInGoalItems:
db #$01 ; #$00 = Instant win if last goal item collected. $01 = (Default) must turn in goal items
;--------------------------------------------------------------------------------
org $308195 ; PC 0x180195
ByrnaCaveSpikeDamage:
db #$08 ; #$08 = 1 Heart (default) - #$02 = 1/4 Heart
;--------------------------------------------------------------------------------
; 0x180196 - 0x1801FF (unused)
; 0x180195 - 0x1801FF (unused)
;================================================================================
org $308200 ; PC 0x180200 - 0x18020B
org $308200 ; PC 0x180200 - 0x18020F
RedClockAmount:
dw #$4650, #$0000 ; $00004650 = +5 minutes
BlueClockAmount:
dw #$B9B0, #$FFFF ; $FFFFB9B0 = -5 minutes
GreenClockAmount:
dw #$0000, #$0000
;--------------------------------------------------------------------------------
; 0x18020C-0x18020F (unused)
;--------------------------------------------------------------------------------
StartingTime:
dw #$0000, #$0000 ; #$A5E0, #$0001 = 30 minutes
;================================================================================
org $09E3BB ; PC 0x4E3BB
db $E4 ; Hera Basement Key (Set to programmable HP $EB) (set to $E4 for original hookable/boomable key behavior)
@@ -1064,14 +1115,8 @@ db $00, $00, $00
org $308358
AllowAccidentalMajorGlitch:
db $00
;--------------------------------------------------------------------------------
; GFX pointer (0x180359 - 0x18035B)
; For 3rd party sprite stuff
;--------------------------------------------------------------------------------
org $308359
dl GfxPalettes
;================================================================================
; 0x18035C - 0x1814FF (unused)
; 0x180359 - 0x1814FF (unused)
;================================================================================
; $309500 (0x181500) - $309FFF (0x181FFF) original 0x39C bytes
; Replacement Ending Sequence Text Data
@@ -1387,6 +1432,19 @@ db $04
;AD - Small Key of Ganon's Tower
;AE - Reserved
;AF - Generic Small Key
;B0 - reserved for bee traps
;B1 - L-1 Bombs
;B2 - L-2 Bombs
;B3 - L-3 Bombs
;B4 - L-4 Bombs
;B5 - L-5 Bombs
;B6 - Progressive Bombs
;B7 - L-1 Cane
;B8 - L-2 Cane
;B9 - L-3 Cane
;BA - L-4 Cane
;BB - L-5 Cane
;================================================================================
;;Residual Portal
;org $0283E0 ; PC 0x103E0 (Bank02.asm:816) (BNE)
@@ -1541,8 +1599,8 @@ dw #9999 ; Rupee Limit
; $7F5200 - $7F52FF - RNG Pointer Block
; $7F5300 - $7F53FF - Multiworld Block
; $7F5400 - $7F540F - MSU Block
; $7F5410 - $7F545F - Dungeon Tracking Block
; $7F5460 - $7F56FF - Unused
; $7F5410 - $7F56FF - Unused
; $7F5700 - $7F57FF - Dialog Buffer
;
@@ -1592,26 +1650,26 @@ dw $0000
;--------------------------------------------------------------------------------
; 0x182305 - 182FFF (unused)
;================================================================================
org $30B000 ; PC 0x183000 - 0x1834FF
incsrc initsramtable.asm
org $30B000 ; PC 0x183000 - 0x183054
StartingEquipment:
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
;--------------------------------------------------------------------------------
; 0x183500 - 183FFF (unused)
; 0x183055 - 183FFF (unused)
;================================================================================
org $30C000 ; PC 0x184000 - 0x184040
org $30C000 ; PC 0x184000 - 0x184007
ItemSubstitutionRules:
;db [item][quantity][substitution][pad] - CURRENT LIMIT 16 ENTRIES
db $12, $01, $35, $FF
db $51, $06, $52, $FF
db $53, $06, $54, $FF
db $FF, $FF, $FF, $FF
org $30C041 ; PC 0x184041
ForceFileName:
db $00 ; $00 = Player picks name (default) - $01 = Use StaticFileName (initsramtable.asm)
;--------------------------------------------------------------------------------
; 0x18405B - 0x1847FF (unused)
; 0x184008 - 0x1847FF (unused)
;================================================================================
;shop_config - tdav --qq
; t - 0=Shop - 1=TakeAny
@@ -1636,6 +1694,11 @@ db $01, $51, $64, $00, $07, $FF, $00, $00
db $01, $53, $64, $00, $07, $FF, $00, $00
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)
;--------------------------------------------------------------------------------
@@ -2633,18 +2696,7 @@ org $30EA84 : RoomHeader_012E: ; pc 0x186A84
db $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF
;--------------------------------------------------------------------------------
; 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)
; 0x186C00 - 187FFF (unused)
;--------------------------------------------------------------------------------
@@ -2661,6 +2713,11 @@ db $08, $08, $06, $06, $02, $0A, $0E, $08, $08, $08, $06, $08, $0C, $1B, $00, $0

View File

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

View File

@@ -2,6 +2,8 @@
; Challenge Timer
;================================================================================
!Temp = "$7F5020"
!BaseTimer = "$7EF43E"
!ChallengeTimer = "$7EF454"
!TemporaryOHKO = "$7F50CC"
;--------------------------------------------------------------------------------
!CLOCK_HOURS = "$7F5080" ; $7F5080 - $7F5083 - Clock Hours
@@ -56,17 +58,17 @@ CalculateTimer:
STA.l !CLOCK_SECONDS+2
LDA.l TimerStyle : AND.w #$00FF : CMP.w #$0002 : BNE + ; Stopwatch Mode
%Sub32(NMIFrames,ChallengeTimer,!CLOCK_TEMPORARY)
%Sub32(!BaseTimer,!ChallengeTimer,!CLOCK_TEMPORARY)
BRA ++
+ CMP.w #$0001 : BNE ++ ; Countdown Mode
%Sub32(ChallengeTimer,NMIFrames,!CLOCK_TEMPORARY)
%Sub32(!ChallengeTimer,!BaseTimer,!CLOCK_TEMPORARY)
++
%Blt32(!CLOCK_TEMPORARY,.halfCycle) : !BLT +
LDA.l TimeoutBehavior : AND.w #$00FF : BNE ++ ; DNF
LDA.w #$0002 : STA.l !Status ; Set DNF Mode
LDA.l NMIFrames : STA.l ChallengeTimer
LDA.l NMIFrames+2 : STA.l ChallengeTimer+2
LDA.l !BaseTimer : STA.l !ChallengeTimer
LDA.l !BaseTimer+2 : STA.l !ChallengeTimer+2
RTS
++ CMP.w #$0001 : BNE ++ ; Negative Time
LDA.l !CLOCK_TEMPORARY : EOR.w #$FFFF : !ADD.w #$0001 : STA.l !CLOCK_TEMPORARY
@@ -75,8 +77,8 @@ CalculateTimer:
BRA .prepDigits
++ CMP.w #$0002 : BNE ++ ; OHKO
LDA.w #$0002 : STA.l !Status ; Set DNF Mode
LDA.l NMIFrames : STA.l ChallengeTimer
LDA.l NMIFrames+2 : STA.l ChallengeTimer+2
LDA.l !BaseTimer : STA.l !ChallengeTimer
LDA.l !BaseTimer+2 : STA.l !ChallengeTimer+2
RTS
++ ; End Game
SEP #$30
@@ -180,8 +182,8 @@ OHKOTimer:
LDA.l TimeoutBehavior : CMP #$02 : BNE +
LDA !Status : AND.b #$02 : BEQ +
.kill
LDA.b #$00 : STA CurrentHealth ; kill link
LDA.b #$00 : STA $7EF36D ; kill link
+
LDA CurrentHealth
LDA $7EF36D
RTL
;--------------------------------------------------------------------------------

View File

@@ -1,9 +1,9 @@
;================================================================================
; Tree Kid Fix
;--------------------------------------------------------------------------------
org $06B12B ; <- 3312B - tree status set - 418 - LDA NpcFlagsVanilla : ORA.b #$08 : STA NpcFlagsVanilla
LDA NpcFlagsVanilla : AND.b #$F7 : STA NpcFlagsVanilla ; unset arboration instead of setting it
org $06B12B ; <- 3312B - tree status set - 418 - LDA $7EF3C9 : ORA.b #$08 : STA $7EF3C9
LDA $7EF3C9 : AND.b #$F7 : STA $7EF3C9 ; unset arboration instead of setting it
;--------------------------------------------------------------------------------
org $06B072 ; <- 33072 - FluteAardvark_InitialStateFromFluteState - 418 : dw FluteAardvark_AlreadyArborated
db #$8B
;================================================================================
;================================================================================

View File

@@ -1,6 +1,8 @@
;================================================================================
; Utility Functions
;================================================================================
!PROGRESSIVE_SHIELD = "$7EF416" ; ss-- ----
;--------------------------------------------------------------------------------
; GetSpriteTile
; in: A - Loot ID
; out: A - Sprite GFX ID
@@ -43,7 +45,7 @@ GetSpriteID:
RTL
.specialHandling
CMP.b #$F9 : BNE ++ ; Progressive Magic
LDA.l MagicConsumption : BNE +++
LDA.l $7EF37B : BNE +++
LDA.b #$3B : RTL ; Half Magic
+++
LDA.b #$3C : RTL ; Quarter Magic
@@ -52,13 +54,13 @@ RTL
++ CMP.b #$FB : BNE ++ ; RNG Item (Multi)
JSL.l GetRNGItemMulti : JMP GetSpriteID
++ CMP.b #$FD : BNE ++ ; Progressive Armor
LDA ArmorEquipment : CMP.l ProgressiveArmorLimit : !BLT + ; Progressive Armor Limit
LDA $7EF35B : CMP.l ProgressiveArmorLimit : !BLT + ; Progressive Armor Limit
LDA.l ProgressiveArmorReplacement
JMP GetSpriteID
+
LDA.b #$04 : RTL
++ CMP.b #$FE : BNE ++ ; Progressive Sword
LDA ProgressiveSwords
LDA $7EF359
CMP.l ProgressiveSwordLimit : !BLT + ; Progressive Sword Limit
LDA.l ProgressiveSwordReplacement
JMP GetSpriteID
@@ -72,7 +74,7 @@ RTL
LDA.b #$46 : RTL
+
++ : CMP.b #$FF : BNE ++ ; Progressive Shield
LDA ProgressiveShields
LDA !PROGRESSIVE_SHIELD : AND #$C0 : LSR #6
CMP.l ProgressiveShieldLimit : !BLT + ; Progressive Shield Limit
LDA.l ProgressiveShieldReplacement
JMP GetSpriteID
@@ -83,7 +85,7 @@ RTL
+ ; Everything Else
LDA.b #$2E : RTL
++ : CMP.b #$F8 : BNE ++ ; Progressive Bow
LDA BowEquipment : INC : LSR
LDA $7EF340 : INC : LSR
CMP.l ProgressiveBowLimit : !BLT +
LDA.l ProgressiveBowReplacement
JMP GetSpriteID
@@ -97,19 +99,19 @@ RTL
;DATA - Loot Identifier to Sprite ID
{
.gfxSlots
db $06, $44, $45, $46, $2D, $20, $2E, $09
db $09, $0A, $08, $05, $10, $0B, $2C, $1B
db $06, $44, $45, $46, $2D, $20, $2E, $09
db $09, $0A, $08, $05, $10, $0B, $2C, $1B
db $1A, $1C, $14, $19, $0C, $07, $1D, $2F
db $07, $15, $12, $0D, $0D, $0E, $11, $17
db $1A, $1C, $14, $19, $0C, $07, $1D, $2F
db $07, $15, $12, $0D, $0D, $0E, $11, $17
db $28, $27, $04, $04, $0F, $16, $03, $13
db $01, $1E, $10, $00, $00, $00, $00, $00
db $28, $27, $04, $04, $0F, $16, $03, $13
db $01, $1E, $10, $00, $00, $00, $00, $00
db $00, $30, $22, $21, $24, $24, $24, $23
db $23, $23, $29, $2A, $2C, $2B, $03, $03
db $00, $30, $22, $21, $24, $24, $24, $23
db $23, $23, $29, $2A, $2C, $2B, $03, $03
db $34, $35, $31, $33, $02, $32, $36, $37
db $34, $35, $31, $33, $02, $32, $36, $37
db $2C, $43, $0C, $38, $39, $3A, $F9, $3C
; db $2C, $06, $0C, $38, $FF, $FF, $FF, $FF
@@ -143,7 +145,12 @@ RTL
;Ax
db $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F, $0F ; Free Small Key
db $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49 ; Unused
;Bx
db $49 ; reserved for bee traps
db $13, $13, $13, $13, $13, $13 ; Bomb Upgrades
db $07, $07, $07, $07, $07, $07 ; Cane Upgrades
db $49, $49, $49 ; Unused
db $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49 ; Unused
db $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49 ; Unused
db $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49, $49 ; Unused
@@ -175,13 +182,13 @@ GetSpritePalette:
PHX
PHB : PHK : PLB
;--------
TAX : LDA.l GfxPalettes, X ; look up item gfx
TAX : LDA.l .gfxPalettes, X ; look up item gfx
PLB : PLX
CMP.b #$F8 : !BGE .specialHandling
CMP.b #$F6 : !BGE .specialHandling
RTL
.specialHandling
CMP.b #$FD : BNE ++ ; Progressive Sword
LDA ProgressiveSwords
LDA $7EF359
CMP.l ProgressiveSwordLimit : !BLT + ; Progressive Sword Limit
LDA.l ProgressiveSwordReplacement
JMP GetSpritePalette
@@ -194,7 +201,7 @@ RTL
+ ; Everything Else
LDA.b #$08 : RTL
++ : CMP.b #$FE : BNE ++ ; Progressive Shield
LDA ProgressiveShields
LDA !PROGRESSIVE_SHIELD : AND #$C0 : LSR #6
CMP.l ProgressiveShieldLimit : !BLT + ; Progressive Shield Limit
LDA.l ProgressiveShieldReplacement
JMP GetSpritePalette
@@ -205,8 +212,7 @@ RTL
+ ; Everything Else
LDA.b #$08 : RTL
++ : CMP.b #$FF : BNE ++ ; Progressive Armor
LDA HighestMail
CMP.l ProgressiveArmorLimit : !BLT + ; Progressive Armor Limit
LDA $7EF35B : CMP.l ProgressiveArmorLimit : !BLT + ; Progressive Armor Limit
LDA.l ProgressiveArmorReplacement
JMP GetSpritePalette
+ : CMP.b #$00 : BNE + ; Green Tunic
@@ -214,12 +220,12 @@ RTL
+ ; Everything Else
LDA.b #$02 : RTL
++ : CMP.b #$FC : BNE ++ ; Progressive Gloves
LDA GloveEquipment : BNE + ; No Gloves
LDA $7EF354 : BNE + ; No Gloves
LDA.b #$02 : RTL
+ ; Everything Else
LDA.b #$08 : RTL
++ : CMP.b #$F8 : BNE ++ ; Progressive Bow
LDA BowEquipment : INC : LSR
LDA $7EF340 : INC : LSR
CMP.l ProgressiveBowLimit : !BLT +
LDA.l ProgressiveBowReplacement
JMP GetSpritePalette
@@ -227,6 +233,16 @@ RTL
LDA.b #$08 : RTL
+ ; Any Bow
LDA.b #$02 : RTL
++ : CMP.b #$F7 : BNE ++ ; Progressive Bombs
LDA !WEAPON_LEVEL
CMP.b #$00 : BNE + ; No Bombs
LDA.b #$08 : RTL
+ : CMP.b #$01 : BNE + ; L1 Bombs
LDA.b #$04 : RTL
+ : CMP.b #$02 : BNE + ; L2 Bombs
LDA.b #$02 : RTL
+ ; Everything Else
LDA.b #$0A : RTL
++ : CMP.b #$FA : BNE ++ ; RNG Item (Single)
JSL.l GetRNGItemSingle : JMP GetSpritePalette
++ : CMP.b #$FB : BNE ++ ; RNG Item (Multi)
@@ -236,7 +252,7 @@ RTL
;DATA - Loot Identifier to Sprite Palette
{
GfxPalettes:
.gfxPalettes
db $00, $04, $02, $08, $04, $02, $08, $02
db $04, $02, $02, $02, $04, $04, $04, $08
@@ -272,7 +288,10 @@ GfxPalettes:
;db $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08 ; *EVENT*
db $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08 ; Free Big Key
db $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08 ; Free Small Key
db $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08 ; Unused
db $08 ; reserved for bee traps
db $08, $04, $02, $0A, $0A, $F7 ; Bomb Upgrades
db $0A, $0A, $0A, $0A, $0A, $0A ; Cane Upgrades
db $08, $08, $08 ; Unused
db $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08 ; Unused
db $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08 ; Unused
db $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08, $08 ; Unused
@@ -306,19 +325,19 @@ IsNarrowSprite:
+ : JMP .continue
.notBottle
CMP.b #$5E : BNE ++ ; Progressive Sword
LDA ProgressiveSwords : CMP.l ProgressiveSwordLimit : !BLT + ; Progressive Sword Limit
LDA $7EF359 : CMP.l ProgressiveSwordLimit : !BLT + ; Progressive Sword Limit
LDA.l ProgressiveSwordReplacement
JSL.l IsNarrowSprite
JMP .done
+ : JMP .continue
++ CMP.b #$5F : BNE ++ ; Progressive Shield
LDA ProgressiveShields : BNE + : JMP .done ; No Shield
+ : CMP.l ProgressiveShieldLimit : !BLT .continue
LDA !PROGRESSIVE_SHIELD : AND #$C0 : BNE + : SEC : JMP .done ; No Shield
+ : LSR #6 : CMP.l ProgressiveShieldLimit : !BLT .continue
LDA.l ProgressiveShieldReplacement
JSL.l IsNarrowSprite
JMP .done
++ CMP.b #$60 : BNE ++ ; Progressive Armor
LDA HighestMail : CMP.l ProgressiveArmorLimit : !BLT .continue
LDA $7EF35B : CMP.l ProgressiveArmorLimit : !BLT .continue
LDA.l ProgressiveArmorReplacement
JSL.l IsNarrowSprite
JMP .done
@@ -328,19 +347,19 @@ IsNarrowSprite:
++ CMP.b #$63 : BNE ++ ; RNG Item (Multi)
JSL.l GetRNGItemMulti
++ CMP.b #$64 : BEQ + ; Progressive Bow
CMP.b #$65 : BNE .continue ; Progressive Bow (alt)
+ : LDA BowEquipment : INC : LSR
CMP.l ProgressiveBowLimit : !BLT +
CMP.b #$65 : BNE .continue ; Progressive Bow (alt)
+ : LDA $7EF340 : INC : LSR
CMP.l ProgressiveBowLimit : !BLT +
LDA.l ProgressiveBowReplacement
JSL.l IsNarrowSprite
JMP .done
JMP .done
.continue
;--------
LDX.b #$00 ; set index counter to 0
;----
-
CPX.b #$24 : !BGE .false ; finish if we've done the whole list
CPX.b #$2A : !BGE .false ; finish if we've done the whole list
CMP.l .smallSprites, X : BNE + ; skip to next if we don't match
;--
SEC ; set true state
@@ -363,7 +382,8 @@ RTL
db $15, $18, $24, $2A, $34, $35, $36, $42
db $43, $45, $59, $A0, $A1, $A2, $A3, $A4
db $A5, $A6, $A7, $A8, $A9, $AA, $AB, $AC
db $AD, $AE, $AF, $FF, $FF, $FF, $FF, $FF
db $AD, $AE, $AF, $B7, $B8, $B9, $BA, $BB
db $BC, $FF, $FF, $FF, $FF, $FF, $FF, $FF
}
;--------------------------------------------------------------------------------
@@ -490,12 +510,12 @@ LoadModifiedTileBufferAddress:
PHA
LDA !TILE_UPLOAD_OFFSET_OVERRIDE : BEQ +
TAX
LDY.w #$0002
LDY.w #$0002
LDA.w #$0000 : STA !TILE_UPLOAD_OFFSET_OVERRIDE
BRA .done
+
LDX.w #$2D40
LDY.w #$0002
LDX.w #$2D40
LDY.w #$0002
.done
PLA
RTL
@@ -507,7 +527,7 @@ RTL
; out: Carry - 1 = On Screen, 0 = Off Screen
;--------------------------------------------------------------------------------
Sprite_IsOnscreen:
JSR _Sprite_IsOnscreen_DoWork
JSR _Sprite_IsOnscreen_DoWork
BCS +
REP #$20
LDA $E2 : PHA : !SUB.w #$0F : STA $E2
@@ -522,11 +542,11 @@ Sprite_IsOnscreen:
RTL
_Sprite_IsOnscreen_DoWork:
LDA $0D10, X : CMP $E2
LDA $0D30, X : SBC $E3 : BNE .offscreen
LDA $0D10, X : CMP $E2
LDA $0D30, X : SBC $E3 : BNE .offscreen
LDA $0D00, X : CMP $E8
LDA $0D20, X : SBC $E9 : BNE .offscreen
LDA $0D00, X : CMP $E8
LDA $0D20, X : SBC $E9 : BNE .offscreen
SEC
RTS
.offscreen
@@ -626,19 +646,19 @@ RTL
; out: A(b) - sum of bits
; caller is responsible for setting 8-bit mode and preserving X and Y
;--------------------------------------------------------------------------------
;CountBits:
; PHX
; TAX ; Save a copy of value
; LSR #4 ; Shift down hi nybble, Leave <3> in C
; PHA ; And save <7:4> in Stack
; TXA ; Recover value
; AND.b #$07 ; Put out <2:0> in X
; TAX ; And save in X
; LDA.l NybbleBitCounts, X ; Fetch count for <2:0>
; PLX ; get <7:4>
; ADC.l NybbleBitCounts, X ; Add count for S & C
; PLX
;RTL
CountBits:
PHX
TAX ; Save a copy of value
LSR #4 ; Shift down hi nybble, Leave <3> in C
PHA ; And save <7:4> in Stack
TXA ; Recover value
AND.b #$07 ; Put out <2:0> in X
TAX ; And save in X
LDA.l NybbleBitCounts, X ; Fetch count for <2:0>
PLX ; get <7:4>
ADC.l NybbleBitCounts, X ; Add count for S & C
PLX
RTL
; Look up table of bit counts in the values $00-$0F
NybbleBitCounts:

View File

@@ -0,0 +1,141 @@
;--------------------------------------------------------------------------------
!ANCILLA_DAMAGE = "$06EC84"
; start with X = sprite index, A = ancilla type index
;--------------------------------------------------------------------------------
Ganon_CheckAncillaVulnerability:
PHA
LDA $0EE0, X : BNE .not_vulnerable_pla
PLA
PHX : PHA
LDA.l GanonVulnerabilityItem
TAX : PLA
CMP.l Ganon_CheckByAncilla, X : BNE +
PLX : BRA .vulnerable
+
PLX : PHA
LDA.l GanonVulnerabilityItem
CMP #$01 : BEQ .silver_arrows
CMP #$11 : BEQ .somaria
BRA .not_vulnerable_pla
.silver_arrows
PLA : CMP #$09 : BNE .not_vulnerable
LDA $7EF340 : CMP.b #$03 : !BGE +
LDA #$09 : BRA .not_vulnerable
+
BRA .vulnerable
.hammer
BRA .not_vulnerable_pla ; NYI
.golden_bee
BRA .not_vulnerable_pla ; NYI
.somaria
PLA : CMP #$01 : BEQ .vulnerable
CMP #$2C : BEQ .vulnerable
BRA .vulnerable
.vulnerable
PHX
LDA.l GanonVulnerabilityItem
TAX
LDA.l Ganon_IFrameDuration, X
PLX
STA $0EE0, X ; give the poor pig some iframes
LDA #$20 : STA $0F10, X
LDA #$09
RTL
.not_vulnerable_pla
PLA
.not_vulnerable
PHX : TAX
LDA.l !ANCILLA_DAMAGE, X
PLX
RTL
; end with X = sprite index, A = damage class
;--------------------------------------------------------------------------------
!ANCILLA_CHECK_SPRITE_DAMAGE_PRESET_CLASS = "$06ECE6"
;--------------------------------------------------------------------------------
Ganon_CheckPowderVulnerability: ; we know it's powder
LDA.l GanonVulnerabilityItem : CMP #$05 : BNE .normal ; ganon not vulnerable to powder
LDA $0E20, X : CMP #$D7 : BNE .normal ; not stunned ganon
LDA $0EE0, X : BNE .normal ; ganon has iframes
LDA.l Ganon_IFrameDuration+$05
STA $0EE0, X ; give the poor pig some iframes
LDA #$20 : STA $0F10, X
LDA #$09
BRA .done
.normal
LDA.b #$0A
.done
JSL.l !ANCILLA_CHECK_SPRITE_DAMAGE_PRESET_CLASS
RTL
;--------------------------------------------------------------------------------
Ganon_CheckBeeVulnerability: ; we know it's a bee
; X is bee sprite index
; Y is target sprite index
LDA.l GanonVulnerabilityItem : CMP #$10 : BNE .normal ; ganon not vulnerable to bee
LDA $0E20, Y : CMP #$D7 : BNE .normal ; not stunned ganon
LDA $0EE0, Y : BNE .normal ; ganon has iframes
LDA.l Ganon_IFrameDuration+$10
STA $0EE0, Y ; give the poor pig some iframes
LDA #$20 : STA $0F10, Y
LDA #$09
BRA .done
.normal
LDA.l SpecialWeapons : CMP.b #$06 : BNE .regular_bee
LDA.w $0ED0, X
BRA .done
.regular_bee
LDA.b #$01
.done
TYX
JSL.l !ANCILLA_CHECK_SPRITE_DAMAGE_PRESET_CLASS
RTL
;--------------------------------------------------------------------------------
Ganon_CheckInvincible:
LDA $04C5 : CMP.b #$02 : BEQ .not_transparent
LDA $0E20, X : CMP #$D7 : BNE .transparent ; non-stunned ganon
LDA $0301 : AND.b #$0A : BEQ .transparent ; normal behavior if not hammer
LDA.l GanonVulnerabilityItem : CMP #$0C : BNE .transparent ; ganon not vulnerable to hammer
.not_transparent
LDA #$00 : RTL
.transparent
LDA #$01 : RTL
; return non-zero A if ganon should be invincible
;--------------------------------------------------------------------------------
Ganon_CheckHammerVulnerability: ; we know it's hammer
LDA.l GanonVulnerabilityItem : CMP #$0C : BNE .normal ; ganon not vulnerable to hammer
LDA $0E20, X : CMP #$D7 : BNE .normal ; not stunned ganon
LDA $0EE0, X : BNE .normal ; ganon has iframes
LDA.l Ganon_IFrameDuration+$0C
STA $0EE0, X ; give the poor pig some iframes
LDA #$20 : STA $0F10, X
LDA #$09 : STA $0CF2 ; set damage class to silver
SEC : RTL
.normal
CLC : RTL
; return carry set bit if stunned Ganon and Ganon vulnerable to hammer
;--------------------------------------------------------------------------------
CheckBeeBoss:
; Y is sprite index
LDA.l SpecialWeapons : CMP #$06 : BNE .not_bee_mode
LDA #$00 : RTL
.not_bee_mode
LDA.l GanonVulnerabilityItem : CMP #$10 : BNE .normal ; ganon not vulnerable to bee
LDA $0E20, Y : CMP #$D7 : BNE .normal ; not stunned ganon
LDA #$00 : RTL
.normal
LDA $0B6B, Y : AND.b #$02
RTL
; return non-zero A if entity is a boss (and bee should not attack)
;--------------------------------------------------------------------------------
Ganon_CheckByAncilla:
db #$00 ; default behavior--we shouldn't be checking the table here anyway
db #$00, #$05, #$1F, #$07, #$00
db #$02, #$0B, #$19, #$18, #$1C
db #$00, #$00, #$00, #$00, #$00
db #$00, #$00, #$31, #$00, #$00
Ganon_IFrameDuration:
db #$00 ; default behavior--we shouldn't be here anyway
db #$00, #$00, #$00, #$34, #$00
db #$00, #$00, #$00, #$00, #$00
db #$00, #$00, #$00, #$00, #$00
db #$00, #$00, #$00, #$00, #$00
;--------------------------------------------------------------------------------

View File

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

View File

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