134 Commits

Author SHA1 Message Date
802188c906 Update credits 2025-03-26 15:57:04 -05:00
086ec3f6c1 Fix credits spacing for sprite name 2025-03-08 12:21:26 -06:00
612db53323 Update credits 2025-03-06 13:00:28 -06:00
785bd05f58 Add mirror scroll 2025-03-05 18:12:28 -06:00
89cf2e29ff Minor bug fixes:
- single-entrance teleporting was borked
- glove palettes
- updating HUD on changing item
2024-11-28 03:04:46 -06:00
7a21eaa62a 50 rupees at start, show mirror message only on second mirror 2024-11-27 16:21:03 -06:00
2d1b5116ec Open GT by killing deadrocks 2024-11-25 12:28:08 -06:00
ae54371cdb Show crossed-out glove for no glove 2024-11-25 04:48:38 -06:00
f0d76f9918 Upgradeable mirror can mirror from light world 2024-11-25 02:23:13 -06:00
30122cfa3d Per-Item improved magic consumption 2024-11-25 00:03:09 -06:00
a949230f34 Variable I-Frames 2024-11-24 22:08:05 -06:00
00487370b3 Zoom on carry, slip on sword, crystal switch changes 2024-11-24 14:37:23 -06:00
799e47443d Mess with mothula 2024-11-23 00:51:10 -06:00
8477fbe623 Show correct glove icon on file select 2024-11-23 00:50:46 -06:00
07af59720f Rewind -> warp 2024-11-22 07:40:40 -06:00
87249343ed Add weak glove and rewind clocks 2024-11-21 20:53:42 -06:00
Lexi Rose
86f641b710 Merge pull request #217 from hiimcody1/pseudoboots-visibility
Add indicator for pseudoboots to File Select screen
2024-06-13 13:36:07 -07:00
Lexi Rose
cc309ecb48 Merge pull request #215 from ardnaxelarak/use_text_table
Replace long sequences of dbs with strings using a text table
2024-06-10 08:07:46 -07:00
hiimcody1
474cfba250 Add indicator for pseudoboots to File Select screen 2024-06-08 21:29:20 -04:00
29d241bcbe Replace long strings of dbs with using a text table 2024-02-20 23:04:25 -06:00
Lexi Rose
dcb0a2b42d Merge pull request #214 from crossedstaves/master
Bomb count fix
2024-02-18 08:41:39 -08:00
crossedstaves
de8703e13f Update retro.asm
Fix to erroneous infinite bomb count
2024-02-17 16:27:42 -06:00
sporchia
2daa8daaae some register issues 2024-02-17 14:24:25 -06:00
Lexi Rose
ce8497e3d2 Merge pull request #213 from spannerisms/fixes
MSU, etc fix
2024-01-15 21:29:34 -06:00
spannerisms
014b3a719a fix things 2024-01-04 06:45:57 -05:00
Lexi Rose
85581b6813 Merge pull request #212 from cassidoxa/bonkkey
Update HUD when picking up bonk key
2024-01-02 11:33:56 -06:00
cassidoxa
cec4e0430b Fix narrow heart piece sprite shadow flickering 2024-01-02 00:26:12 -05:00
cassidoxa
d81a19c367 Update HUD when picking up bonk key 2024-01-01 22:29:14 -05:00
Lexi Rose
88ef1f385d Merge pull request #211 from cassidoxa/prize_ancilla
Fix dungeon prize ancilla spawn regression
2023-12-28 03:36:58 -06:00
cassidoxa
7001767c9b Fix dungeon prize ancilla spawn regression 2023-12-27 11:39:00 -05:00
Lexi Rose
7116cb6557 Merge pull request #210 from cassidoxa/bonkkey
Fix bonk key double count
2023-11-30 02:29:03 -06:00
cassidoxa
85e338ad67 Fix bonk key double count 2023-11-30 00:42:55 -05:00
Lexi Rose
032d15fba6 Merge pull request #209 from tcprescott/patreon
Names for Patreon Supporters
2023-09-22 23:43:22 -05:00
Thomas Prescott
f133ce7159 add some extra space 2023-09-22 23:09:35 -05:00
Thomas Prescott
c5d8c69396 fix PC addresses for patrons 2023-09-22 22:49:57 -05:00
Thomas Prescott
f71759754e patreon fields 2023-09-22 21:49:50 -05:00
Lexi Rose
507ba379cf Merge pull request #208 from cassidoxa/v31.2.0-fixes
Don't increment highest mail on final stats prep
2023-09-17 13:30:02 -05:00
cassidoxa
334f721a29 Don't increment highest mail on final stats prep 2023-09-17 12:02:54 -04:00
Lexi Rose
0fdb6ed133 Merge pull request #207 from cassidoxa/v31.2.0-fixes
Add time stamp for tossed fighter sword item
2023-09-10 01:31:32 -05:00
cassidoxa
cc36ccc0b1 Add time stamp for tossed fighter sword item 2023-09-10 00:55:03 -04:00
Lexi Rose
fcbde59a1e Merge pull request #206 from cassidoxa/v31.2.0-fixes
Fix HUD rebuild when releasing fairy
2023-09-09 04:21:01 -05:00
cassidoxa
70758bf5c0 Set silvers bit with silvers restriction 2023-09-08 15:43:31 -04:00
cassidoxa
f6842204d0 Fix BowTracking docs 2023-09-08 15:30:37 -04:00
cassidoxa
8af9c17cfe Fix stumpy double item 2023-09-08 13:57:26 -04:00
cassidoxa
57e537f12d Fix HUD rebuild when releasing fairy 2023-09-08 08:56:23 -04:00
Lexi Rose
bc3dd5c186 Merge pull request #205 from cassidoxa/v31.2.0-fixes
Fix HUD item icon not refreshing after last bomb spent
2023-09-08 02:30:29 -05:00
cassidoxa
71e86f7c1a Set our hud update flag on quickswap 2023-09-08 00:35:06 -04:00
cassidoxa
0f72e6fcec Better solution 2023-09-08 00:21:24 -04:00
cassidoxa
790f3f0ba3 Fix HUD item icon not refreshing after last bomb spent
Rename UpdateHUD to UpdateHUDFlag, replace with UpdateHUD vanilla JSR
label
2023-09-07 16:29:45 -04:00
Lexi Rose
6a55fc2b12 Merge pull request #204 from cassidoxa/v31.2.0-fixes
Fix some stats counting
2023-09-07 11:50:36 -05:00
cassidoxa
7dc71cf1ac Fix some stats counting 2023-09-07 11:53:24 -04:00
Lexi Rose
5a0bd6dbe0 Merge pull request #203 from cassidoxa/v31.2.0-fixes
Rework bow tracking to assign tracking bits to non-chest sprites
2023-09-05 03:23:35 -05:00
cassidoxa
f778674b83 Rework bow tracking to assign tracking bits to non-chest sprites
Fix small key palettes to be consistent with vanilla colors
2023-09-04 22:29:50 -04:00
Lexi Rose
2e433732f8 Merge pull request #202 from cassidoxa/v31.2.0-fixes
Fix HUD heart colors on credits end screen
2023-09-04 15:15:37 -05:00
cassidoxa
4ec523c8b3 Fix HUD heart colors on credits end screen
Small fix for counting menu HUD keys for "this dungeon"
2023-09-04 13:28:51 -04:00
Lexi Rose
23b6e1ae6b Merge pull request #201 from cassidoxa/v31.2.0-fixes
Palette fix for GT Torch/Hera cage items that load new palette
2023-09-03 16:11:15 -05:00
cassidoxa
9800a86189 Palette fix for GT Torch/Hera cage items that load new palette 2023-09-03 15:39:53 -04:00
Lexi Rose
74a31f5f11 Merge pull request #200 from cassidoxa/v31.2.0-fixes
Fix active flute standing item gfx
2023-09-02 23:23:42 -05:00
cassidoxa
73b2a180ba Fix AddInventory/stats tracking with 16 bit item properties 2023-09-02 22:57:50 -04:00
cassidoxa
2cead7ae92 Fix Active flute standing item gfx
Move setting dungeon completed to prize pickup (or after aga1/aga2)
Fix some inverted tiles
Remove text-related conditional assembly
Make InventoryTable_properties 16 bits wide
Fix expanded save slot writing to cart SRAM
Fix HUD resetting with red potion
2023-09-02 15:55:37 -04:00
Lexi Rose
6fbce240b8 Merge pull request #199 from cassidoxa/decompressed
Fix for item receipt after GT boss heart container collected
2023-08-31 17:39:17 -05:00
cassidoxa
3a5974b456 Only check if we're getting a chest item if boss heart flag is set 2023-08-31 16:38:53 -04:00
cassidoxa
71e6d54276 Fix for item receipt after GT boss heart container collected 2023-08-31 15:17:07 -04:00
Lexi Rose
139c963e6a Merge pull request #198 from spannerisms/decompressed
Absorb torch keys if they belong to the dungeon they're in.
2023-08-31 03:07:31 -05:00
cassidoxa
29176fa194 Absorb torch keys if they belong to the dungeon they're in. 2023-08-30 20:47:06 -04:00
Lexi Rose
d6ac9feae4 Merge pull request #197 from spannerisms/decompressed
Glitch fixes
2023-08-30 11:45:05 -05:00
cassidoxa
90c8e95f9b Fix overworld item duping
Fix setting dungeon completed when Aga 1 and 2 are defeated (prize drops)
2023-08-30 01:25:43 -04:00
S
c6e586fbb8 Merge pull request #196 from spannerisms/decompressed
Even more v31.2.0
2023-08-29 16:40:31 -04:00
cassidoxa
4c98268d81 Various fixes 2023-08-29 16:03:22 -04:00
Lexi Rose
e3a35ef5fc Merge pull request #195 from spannerisms/decompressed
More v31.2.0
2023-08-26 23:39:21 -05:00
cassidoxa
52d2616537 RomSpeed option 2023-08-26 23:24:34 -04:00
cassidoxa
05a79ad2d9 Fix Ped/GT open modes
Fix key colors
2023-08-26 20:29:38 -04:00
cassidoxa
7e513c4696 More sprite fixes 2023-08-26 14:30:39 -04:00
cassidoxa
77e269ff31 Ridiculous game 2023-08-26 01:42:31 -04:00
cassidoxa
90ffa8bd23 Fix cave state item cutscene flag with boss hearts
Add item substitutions
2023-08-25 21:11:48 -04:00
cassidoxa
5ac2f8c537 Fix GFX transfer, use stack
Fix HUD arrow icon after buying shop arrow
2023-08-25 12:29:52 -04:00
cassidoxa
3f5455b647 Fix key palettes
Fix HUD item counter when releasing bee
2023-08-25 09:48:29 -04:00
cassidoxa
1cbcd1d5ff Sprite fixes 2023-08-25 01:38:32 -04:00
Lexi Rose
188c965fbc Merge pull request #194 from spannerisms/decompressed
More v31.2.0 fixes
2023-08-23 21:10:13 -05:00
cassidoxa
247128b9f6 Move setting DungeonsCompleted bitfield to post-boss/prize transition 2023-08-23 13:24:46 -04:00
cassidoxa
9bde734ca3 Fix current dungeon items in menu 2023-08-22 16:22:39 -04:00
cassidoxa
80f94824f4 Small fixes 2023-08-22 10:18:02 -04:00
cassidoxa
e2525ebdb1 Rework menu dungeon item + select behavior
Fix colored heart animations
2023-08-22 01:40:53 -04:00
cassidoxa
66540f2819 Replace GT, Ganon vuln crystal checks, ped check with new system
InvincibleGanon 0x18003E -> GanonVulnerableMode 0x1801A8-0x1801A9
NumberOfCrystalsRequiredForTower 0x18005E -> GanonsTowerOpenTarget 0x18019A-0x18019B
NumberOfCrystalsRequiredForGanon 0x18005F -> GanonVulnerableTarget 0x1801A6-0x1801A7
Various fixes
Moved CrystalCounter to word length space $7EF471 -> $7EF476
2023-08-21 20:43:27 -04:00
spannerisms
59b16eeb05 optimize/fix inverted maps 2023-08-21 07:10:26 -04:00
cassidoxa
63ba27e93d Update item gfx/receipt documentation in itemdatatables.asm 2023-08-20 19:59:55 -04:00
cassidoxa
ca917404e5 Inverted maps 2023-08-20 11:51:12 -04:00
cassidoxa
ba080ef556 Fix HC/Sewers keys and inverted castle hole 2023-08-19 21:41:58 -04:00
cassidoxa
8a63b7ca91 v31.2.0 fixes 2023-08-19 14:33:24 -04:00
Lexi Rose
71d3f6cefe Merge pull request #193 from spannerisms/decompressed
Decompressed
2023-08-16 01:56:09 -05:00
cassidoxa
e206d6f368 Small fixes 2023-08-15 23:55:53 -04:00
cassidoxa
1b115ebb50 Fix pyramid map 2023-08-14 12:49:30 -04:00
cassidoxa
491e033ff0 Fix heart piece item resolution when mirroring
Fix HC big key incrementing total item count
Fix key tracking
Fix misc stat incrementing
2023-08-14 00:25:59 -04:00
cassidoxa
a3bc24c383 Quick fixes for shop fighter shield and retro shop arrow 2023-08-13 19:51:29 -04:00
cassidoxa
cc83fef9b0 Shops VRAM transfer 2023-08-13 18:55:52 -04:00
cassidoxa
aaf970b837 Heart colors 2023-08-13 13:46:21 -04:00
cassidoxa
ad17c8e88d More small fixes 2023-08-12 15:34:33 -04:00
cassidoxa
ed1a8f1bdb Update ROM version
Breaking changes:
Dungeon prize table at $81C6FC uses receipt id instead of vanilla index
Removed Gfx pointers from tables.asm
2023-08-12 10:21:34 -04:00
cassidoxa
858057d9c0 Lower case item text 2023-08-12 01:58:50 -04:00
cassidoxa
a2671e7ed5 A few font fixes 2023-08-11 20:11:50 -04:00
cassidoxa
103f072cf3 Add back some JP characters and re-arrange player name screen
Re-arrange a bunch of text-related stuff
Fix post-credits game counter
Fix bows
2023-08-11 02:10:54 -04:00
cassidoxa
56cb17a0a3 Small fixes 2023-08-08 01:00:49 -04:00
cassidoxa
39ac6c301a Fix mushroom gfx loading 2023-08-07 13:50:33 -04:00
cassidoxa
87e665965c Free crystals and ability to shuffle dungeon prizes
Overworld map code via Aerinon
2023-08-06 23:07:39 -04:00
cassidoxa
cb16ffc20b Merge branch 'master' into decompressed
Also some pendant receipt and palette fixes
2023-08-02 17:40:38 -04:00
cassidoxa
d446bd3c1b More fixes 2023-08-02 15:39:03 -04:00
cassidoxa
ddfb8eed0f Small fixes 2023-08-01 20:30:15 -04:00
cassidoxa
8ed4cbda1d Palette handling & sprite props data tables
Statically assign item data tables
Fix some save-related bugs
Fix dungeon item notice in "this dungeon" with free dungeon items
2023-08-01 17:13:47 -04:00
cassidoxa
d3ed95d639 Refactor inventory.asm
Refactor extended save data to use MVN
Free small keys can be place in their own dungeon
2023-07-29 00:48:34 -04:00
cassidoxa
0a073df728 Item receipt refactor
Inverted maps
Fix shops
2023-06-30 21:21:59 -04:00
spannerisms
83377b6bea fast hearts 2023-06-13 07:28:25 -04:00
Lexi Rose
421740cdae Merge pull request #192 from cassidoxa/hundo_mode
Add "completionist" goals and HUD item counter
2023-06-10 22:26:37 -05:00
cassidoxa
389e436b52 More HUD fixes 2023-06-10 22:05:55 -04:00
cassidoxa
bbd25c2543 Fix Bow icon
Set dungeon ID to $FF after Aga 2 kill for proper HUD draw
2023-06-10 12:26:01 -04:00
cassidoxa
d5b5a20862 OHKO HUD 2023-06-09 18:45:57 -04:00
cassidoxa
fed357141b Bump version 2023-06-09 16:16:02 -04:00
cassidoxa
c3c7078969 Fix HUD arrow icon 2023-06-08 23:59:55 -04:00
cassidoxa
aec3370f48 More HUD stuff 2023-06-08 19:26:31 -04:00
cassidoxa
815c2ab81f More fast hud
Added update hud flag
2023-06-08 11:21:42 -04:00
cassidoxa
3a90df5bd4 Fast HUD via kan 2023-06-07 19:44:52 -04:00
cassidoxa
878536903e Initial total item count HUD
Initial 100% item collection Ganon vulnerability
2023-06-05 15:05:31 -04:00
spannerisms
21522f29d1 credits 2023-03-30 01:51:12 -04:00
spannerisms
aae1e2a1f3 fastrom 2023-02-14 01:24:43 -05:00
spannerisms
c0b7605c12 fix hearts 2023-02-13 13:53:23 -05:00
spannerisms
caac2877fc tiny fixes 2023-02-13 13:00:04 -05:00
spannerisms
830e86f199 inverted maps
untested, unfinished
2023-02-11 05:22:27 -05:00
spannerisms
4802107516 bug fixes 2023-01-02 06:21:15 -05:00
spannerisms
ff88437f8e fixes
turn a bunch of addresses into fast rom
bunch of consistency clean ups in hooks
move zsnes to failures
2022-12-30 03:07:15 -05:00
cassidoxa
36ca193b75 Newitems
Fix magic bar & file select HUD
2022-12-29 12:09:50 -05:00
spannerisms
89f2f555e5 fix rupees 2022-12-08 00:27:58 -05:00
spannerisms
03601d5df5 dumb thing i have to push before i stop 2022-12-06 03:07:19 -05:00
spannerisms
194e745f22 bees 2022-12-05 11:32:14 -05:00
spannerisms
918173523f faster HUD 2022-12-05 02:01:46 -05:00
spannerisms
0397623340 cassidy
item properties tabulated with a macro
new item graphics
better hex to dec code
some item code readability improvements
2022-12-05 00:18:27 -05:00
127 changed files with 19284 additions and 9840 deletions

2
.gitignore vendored
View File

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

31
2waymirror.asm Normal file
View File

@@ -0,0 +1,31 @@
pushpc
org $8DF7E9
dw $28DE, $28DF, $28EE, $28EF ; Scroll
dw $2C62, $2C63, $2C72, $2C73 ; Mirror
dw $2C62, $2C63, $2C72, $2D11 ; 2-Way Mirror
org $87A93F
JSL.l CheckMirrorWorld
org $87A955
JSL.l BlockEraseFix
NOP #2
pullpc
CheckMirrorWorld:
LDA.l MirrorEquipment
BEQ + ; just scroll, so don't allow
DEC
BNE +
LDA.b $8A
AND.b #$40
+ RTL
BlockEraseFix:
LDA.l MirrorEquipment
BEQ +
STZ.w $05FC
STZ.w $05FD
+ RTL

View File

@@ -3,34 +3,40 @@
;================================================================================
lorom
;===================================================================================================
; THIS NEEDS TO BE THE FIRST INCLUDE BECAUSE IT CHANGES THINGS EVERYWHERE
; If this were to be included later, it would almost certainly overwrite other changes
incsrc "fastrom.asm"
;================================================================================
;org $00FFC0 ; <- 7FC0 - Bank00.asm : 9173 (db "THE LEGEND OF ZELDA " ; 21 bytes)
;db #$23, $4E
;org $80FFC0 ; <- 7FC0 - Bank00.asm : 9173 (db "THE LEGEND OF ZELDA " ; 21 bytes)
;db $23, $4E
org $00FFD5 ; <- 7FD5 - Bank00.asm : 9175 (db $20 ; rom layout)
db #$30 ; set fast lorom
org $80FFD5 ; <- 7FD5 - Bank00.asm : 9175 (db $20 ; rom layout)
db $30 ; set fast lorom
;org $00FFD6 ; <- 7FD6 - Bank00.asm : 9176 (db $02 ; cartridge type)
;db #$55 ; enable S-RTC
;org $80FFD6 ; <- 7FD6 - Bank00.asm : 9176 (db $02 ; cartridge type)
;db $55 ; enable S-RTC
org $00FFD7 ; <- 7FD7 - Bank00.asm : 9177 (db $0A ; rom size)
db #$0B ; mark rom as 16mbit
org $80FFD7 ; <- 7FD7 - Bank00.asm : 9177 (db $0A ; rom size)
db $0B ; mark rom as 16mbit
org $00FFD8 ; <- 7FD8 - Bank00.asm : 9178 (db $03 ; ram size (sram size))
db #$05 ; mark sram as 32k
org $80FFD8 ; <- 7FD8 - Bank00.asm : 9178 (db $03 ; ram size (sram size))
db $05 ; mark sram as 32k
org $3FFFFF ; <- 1FFFFF
db #$00 ; expand file to 2mb
org $BFFFFF ; <- 1FFFFF
db $00 ; expand file to 2mb
org $1FFFF8 ; <- FFFF8 timestamp rom
db #$20, #$19, #$08, #$31 ; year/month/day
org $9FFFF8 ; <- FFFF8 timestamp rom
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 ?= 4 ;
org $00FFE0 ; Unused hardware vector
org $80FFE0 ; Unused hardware vector
RomVersion:
dw !ROM_VERSION_LOW
dw !ROM_VERSION_HIGH
@@ -44,7 +50,6 @@ dw !ROM_VERSION_HIGH
function hexto555(h) = ((((h&$FF)/8)<<10)|(((h>>8&$FF)/8)<<5)|(((h>>16&$FF)/8)<<0))
; Feature flags, run asar with -DFEATURE_X=1 to enable
!FEATURE_NEW_TEXT ?= 0
;================================================================================
@@ -56,10 +61,9 @@ incsrc ram.asm
incsrc sram.asm
incsrc registers.asm
incsrc vanillalabels.asm
incsrc overworldmap.asm ; Overwrites some code in bank $8A
;org $208000 ; bank #$20
org $A08000 ; bank #$A0
incsrc newitems.asm ; LEAVE THIS AS FIRST
org $A08000 ; bank $20
incsrc itemdowngrade.asm
incsrc bugfixes.asm
incsrc darkworldspawn.asm
@@ -67,7 +71,6 @@ incsrc lampmantlecone.asm
incsrc floodgatesoftlock.asm
incsrc heartpieces.asm
incsrc npcitems.asm
incsrc utilities.asm
incsrc flipperkill.asm
incsrc pendantcrystalhud.asm
incsrc potions.asm
@@ -78,7 +81,6 @@ incsrc tablets.asm
incsrc fairyfixes.asm
incsrc rngfixes.asm
incsrc medallions.asm
incsrc inventory.asm
incsrc zelda.asm
incsrc maidencrystals.asm
incsrc flute.asm
@@ -98,9 +100,9 @@ incsrc roomloading.asm
incsrc icepalacegraphics.asm
warnpc $A18000
org $1C8000 ; text tables for translation
org $9C8000 ; text tables for translation
incbin "data/i18n_en.bin"
warnpc $1CF356
warnpc $9CF356
org $A18000 ; static mapping area
incsrc framehook.asm
@@ -111,7 +113,7 @@ incsrc hud.asm
warnpc $A18800
org $A18800 ; static mapping area
incsrc zsnes.asm
warnpc $A19000
org $A1A000 ; static mapping area. Referenced by front end. Do not move.
@@ -131,7 +133,6 @@ incsrc glitched.asm
incsrc hardmode.asm
incsrc goalitem.asm
incsrc quickswap.asm
incsrc endingsequence.asm
incsrc cuccostorm.asm
incsrc retro.asm
incsrc controllerjank.asm
@@ -144,7 +145,6 @@ incsrc hashalphabet.asm
incsrc inverted.asm
incsrc invertedmaps.asm
incsrc newhud.asm
incsrc compasses.asm
incsrc save.asm
incsrc password.asm
incsrc enemy_adjustments.asm
@@ -152,134 +152,144 @@ incsrc hudtext.asm
incsrc servicerequest.asm
incsrc elder.asm
incsrc toast.asm
incsrc darkroomitems.asm
incsrc fastcredits.asm
incsrc msu.asm
incsrc dungeonmap.asm
incsrc special_weapons.asm
incsrc variable_ganon_vulnerability.asm
incsrc trolls.asm
if !FEATURE_NEW_TEXT
incsrc textrenderer.asm
endif
incsrc hextodec.asm
incsrc textrenderer.asm
incsrc rewind.asm
incsrc lift.asm
; incsrc mothula.asm
incsrc switches.asm
incsrc zoom_on_carry.asm
incsrc iframes.asm
incsrc improve_items.asm
incsrc 2waymirror.asm
incsrc deadrocks.asm
warnpc $A58000
org $A28000
ItemReceiptGraphicsROM:
; we need some empty space here so that 0000 can mean nothing
fillbyte $00 : fill 32
incbin "data/customitems.4bpp"
warnpc $A2B000
org $A2B000
incsrc itemdatatables.asm ; Statically mapped
incsrc decompresseditemgraphics.asm
incsrc newitems.asm
incsrc utilities.asm
incsrc inventory.asm
org $A38000
incsrc stats/credits.asm ; Statically mapped
incsrc stats/main.asm
incsrc stats/statConfig.asm
FontTable:
incsrc stats/fonttable.asm
org $308000 ; bank #$30
org $B08000 ; bank $30
incsrc tables.asm
org $348000
org $B48000
incsrc spc.asm
org $318000 ; bank #$31
org $B18000 ; bank $31
GFX_Mire_Bombos:
incbin "data/99ff1_bombos.gfx"
warnpc $318800
warnpc $B18800
org $318800
org $B18800
GFX_Mire_Quake:
incbin "data/99ff1_quake.gfx"
warnpc $319000
warnpc $B19000
org $319000
org $B19000
GFX_TRock_Bombos:
incbin "data/a6fc4_bombos.gfx"
warnpc $319800
warnpc $B19800
org $319800
org $B19800
GFX_TRock_Ether:
incbin "data/a6fc4_ether.gfx"
warnpc $31A000
warnpc $B1A000
org $31A000
org $B1A000
GFX_HUD_Items:
incbin "data/c2807_v4.gfx"
warnpc $31A800
warnpc $B1A800
org $31A800
GFX_New_Items:
incbin "data/newitems.gfx"
;incbin eventitems.gfx ; *EVENT*
warnpc $31B000
org $B1A800
org $31B000
warnpc $B1B000
org $B1B000
GFX_HUD_Main:
incbin "data/c2e3e.gfx"
warnpc $31B800
warnpc $B1B800
org $31C000
org $B1C000
IcePalaceFloorGfx:
incbin "data/ice_palace_floor.bin"
warnpc $31C801
warnpc $B1C801
org $31C800
org $B1C800
Damage_Table:
incbin "data/damage_table.bin"
warnpc $31D001
warnpc $B1D001
org $31D000
org $B1D000
FileSelectNewGraphics:
incbin "data/fileselectgfx.2bpp"
warnpc $31E001
warnpc $B1E001
org $31E000
org $B1E000
InvertedCastleHole: ;address used by front end. DO NOT MOVE!
incbin "data/sheet73.gfx"
warnpc $31E501
warnpc $B1E501
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
org $B38000
GFX_HUD_Palette:
incbin "data/hudpalette.pal"
warnpc $338041
warnpc $B38041
org $339000
org $B39000
ExpandedTrinexx:
incbin "data/sheet178.gfx"
warnpc $339600
warnpc $B39600
org $339600
org $B39600
BossMapIconGFX:
incbin "data/bossicons.4bpp"
if !FEATURE_NEW_TEXT
org $339C00
NewFont:
incbin "data/newfont.bin"
NewFontInverted:
incbin "data/newfont_inverted.bin"
org $B39C00
NewFont:
incbin "data/newfont.bin"
NewFontInverted:
incbin "data/newfont_inverted.bin"
SmallCharacters:
incbin "data/smallchars.2bpp"
org $8CD7DF
incsrc data/playernamecharmap.asm
org $8CE73D
incbin data/playernamestripes_1.bin
org $8CE911
incbin data/playernamestripes_2.bin
incsrc data/kanjireplacements.asm ; Overwrites text gfx data and masks in bank $8E
org $0CD7DF
incbin "data/text_unscramble1.bin"
org $0CE4D5
incbin "data/text_unscramble2.bin"
endif
org $328000
org $B28000
Extra_Text_Table:
if !FEATURE_NEW_TEXT
incsrc itemtext_lower.asm
else
incsrc itemtext.asm
endif
incsrc itemtext.asm
incsrc externalhooks.asm
;================================================================================
org $119100 ; PC 0x89100
org $919100 ; PC 0x89100
incbin "data/map_icons.gfx"
warnpc $119401
warnpc $919401
;================================================================================
org $9BB1E0
incsrc custompalettes.asm
warnpc $9BB880
;================================================================================
org $AF8000 ; PC 0x178000
Static_RNG: ; each line below is 512 bytes of rng
@@ -330,25 +340,18 @@ warnpc $B08000
;$70:6000 (8K) Scratch buffers
;================================================================================
org $00D09C ; 0x509C - HUD Items H
org $80D09C ; 0x509C - HUD Items H
db GFX_HUD_Items>>16
org $00D17B ; 0x517B - HUD Items M
org $80D17B ; 0x517B - HUD Items M
db GFX_HUD_Items>>8
org $00D25A ; 0x525A - HUD Items L
org $80D25A ; 0x525A - HUD Items L
db GFX_HUD_Items
; this used to be a pointer to a dummy file
org $00D065 ; 005065 - New Items H
db GFX_New_Items>>16
org $00D144 ; 005114 - New Items M
db GFX_New_Items>>8
org $00D223 ; 005223 - New Items L
db GFX_New_Items
org $00D09D ; 0x509D - HUD Main H
org $80D09D ; 0x509D - HUD Main H
db GFX_HUD_Main>>16
org $00D17C ; 0x517C - HUD Main M
org $80D17C ; 0x517C - HUD Main M
db GFX_HUD_Main>>8
org $00D25B ; 0x525B - HUD Main L
org $80D25B ; 0x525B - HUD Main L
db GFX_HUD_Main
;================================================================================

View File

@@ -153,7 +153,7 @@ RestoreBgEther:
INX #2 : CPX.b #$10 : BNE -
BRA ++
++
JML $02FF51 ; Bank0E.asm : 3936 vanilla restore routine after loop which RTLs
JML $82FF51 ; Bank0E.asm : 3936 vanilla restore routine after loop which RTLs
;================================================================================
DDMConditionalLightning:
LDA.l DisableFlashing
@@ -161,7 +161,7 @@ DDMConditionalLightning:
BNE +
LDA.w Scrap
LDX.b #$02
JML $07FA7F ; Bank0E.asm : 4738 vanilla loop equivalent to below beginning at LDY #$00
JML $87FA7F ; Bank0E.asm : 4738 vanilla loop equivalent to below beginning at LDY #$00
+
LDA.b Scrap00 : LDX.b #$02 : LDY.b #$00
-
@@ -172,7 +172,7 @@ DDMConditionalLightning:
LDA.w $F523, Y : LDA.l PaletteBuffer+$F0, X
INY #2
INX #2 : CPX.b #$10 : BNE -
JML $07FAAC ; Bank0E.asm : 4754 both branches converge here
JML $87FAAC ; Bank0E.asm : 4754 both branches converge here
;================================================================================
ConditionalGTFlash:
LDA.l DisableFlashing : REP #$20 : BNE +
@@ -222,17 +222,17 @@ LoadElectroPalette:
LDA.w #$0404 : STA.b Scrap0E
LDA.w #$001B : STA.b Scrap02
SEP #$10
LDX.b Scrap0C : LDA.l $1BEBB4, X : AND.w #$00FF : ADC.w #$D630
LDX.b Scrap0C : LDA.l $9BEBB4, X : AND.w #$00FF : ADC.w #$D630
REP #$10 : LDX.w #$01B2 : LDY.w #$0002
JSR ConditionalLoadGearPalette
SEP #$10
LDX.b Scrap0D
LDA.l $1BEBC1, X : AND.w #$00FF : ADC.w #$D648
LDA.l $9BEBC1, X : AND.w #$00FF : ADC.w #$D648
REP #$10 : LDX.w #$01B8 : LDY.w #$0003
JSR ConditionalLoadGearPalette
SEP #$10
LDX.b Scrap0E
LDA.l $1BEC06, X : AND.w #$00FF : ASL A : ADC.w #$D308
LDA.l $9BEC06, X : AND.w #$00FF : ASL A : ADC.w #$D308
REP #$10 : LDX.w #$01E2 : LDY.w #$000E
JSR ConditionalLoadGearPalette
SEP #$30

View File

@@ -3,19 +3,21 @@
;--------------------------------------------------------------------------------
LoadLibraryItemGFX:
%GetPossiblyEncryptedItem(LibraryItem, SpriteItemValues)
STA.w SpriteItemType, X ; Store item type
JSL.l PrepDynamicTile
JSL.l AttemptItemSubstitution
JSL.l ResolveLootIDLong
STA.w SpriteID, X
JSL.l PrepDynamicTile_loot_resolved
RTL
;--------------------------------------------------------------------------------
DrawLibraryItemGFX:
PHA
LDA.w SpriteItemType, X ; Retrieve stored item type
LDA.w SpriteID, X
JSL.l DrawDynamicTile
PLA
RTL
;--------------------------------------------------------------------------------
SetLibraryItem:
LDY.w SpriteItemType, X ; Retrieve stored item type
LDY.w SpriteID, X
JSL.l ItemSet_Library ; contains thing we wrote over
RTL
;--------------------------------------------------------------------------------
@@ -29,17 +31,27 @@ LoadBonkItemGFX:
LoadBonkItemGFX_inner:
LDA.b #$00 : STA.l RedrawFlag
JSR LoadBonkItem
JSL.l AttemptItemSubstitution
JSL.l ResolveLootIDLong
STA.w SpriteItemType, X
STA.w SpriteID, X
JSL.l PrepDynamicTile
PHA : PHX
LDA.w SpriteID,X : TAX
LDA.l SpriteProperties_standing_width,X : BNE +
LDA.b #$00 : STA.l SpriteOAM : STA.l SpriteOAM+8
+
PLX : PLA
RTL
;--------------------------------------------------------------------------------
DrawBonkItemGFX:
PHA
LDA.l RedrawFlag : BEQ .skipInit ; skip init if already ready
LDA.l RedrawFlag : BEQ .skipInit
JSL.l LoadBonkItemGFX_inner
BRA .done ; don't draw on the init frame
.skipInit
JSR LoadBonkItem
LDA.w SpriteID,X
JSL.l DrawDynamicTileNoShadow
.done
@@ -48,16 +60,15 @@ RTL
;--------------------------------------------------------------------------------
GiveBonkItem:
JSR LoadBonkItem
CMP.b #$24 : BNE .notKey
JSR.w AbsorbKeyCheck : BCC .notKey
.key
PHY : LDY.b #$24 : JSL.l AddInventory : PLY ; do inventory processing for a small key
LDA.l CurrentSmallKeys : INC A : STA.l CurrentSmallKeys
LDA.b #$2F : JSL.l Sound_SetSfx3PanLong
JSL CountBonkItem
LDA.b #$01 : STA.l UpdateHUDFlag
RTL
.notKey
PHY : TAY : JSL.l Link_ReceiveItem : PLY
JSL CountBonkItem
RTL
;--------------------------------------------------------------------------------
LoadBonkItem:
@@ -72,3 +83,19 @@ LoadBonkItem:
LDA.b #$24 ; default to small key
++
RTS
;--------------------------------------------------------------------------------
AbsorbKeyCheck:
PHA
CMP.b #$24 : BEQ .key
CMP.b #$A0 : BCC .not_key
CMP.b #$B0 : BCS .not_key
AND.b #$0F : ASL
CMP.w DungeonID : BNE .not_key
.key
PLA
SEC
RTS
.not_key
PLA
CLC
RTS

View File

@@ -3,13 +3,9 @@
;--------------------------------------------------------------------------------
ModifyBoots:
PHA
LDA.b RoomIndex : CMP.b #$06 : BNE +
LDA.b RoomIndex+1 : CMP.b #$00 : BEQ .no_boots
+
LDA.l BootsModifier : CMP.b #$01 : BNE +
PLA : AND.l AbilityFlags : ORA.b #$04 : RTL ; yes boots
+ : CMP.b #$02 : BNE +
.no_boots
PLA : AND.l AbilityFlags : AND.b #$FB : RTL ; no boots
+ : LDA.l FakeBoots : CMP.b #$01 : BNE +
LDA.b LinkSlipping : BEQ ++ : LDA.b $59 : BNE + ; hover check

View File

@@ -64,7 +64,7 @@ FixBunnyOnExitToLightWorld:
STZ.b LinkState ; set player mode to Normal
STZ.w BunnyFlag : STZ.b BunnyFlagDP ; return player graphics to normal
+
RTS
RTL
;--------------------------------------------------------------------------------
;--------------------------------------------------------------------------------
@@ -245,3 +245,10 @@ ParadoxCaveGfxFix:
LDX.w #$00C0 : STX.w DAS0L
BRA .uploadLine
;--------------------------------------------------------------------------------
SetItemRiseTimer:
LDA.w ItemReceiptMethod : CMP #$01 : BNE .not_from_chest
LDA.b #$38 : STA.w AncillaTimer, X
RTL
.not_from_chest
TYA : STA.w AncillaTimer, X ; What we wrote over
RTL

View File

@@ -2,4 +2,4 @@
rm ../working.sfc
cp ../alttp.sfc ../working.sfc
./bin/macos/asar -DFEATURE_NEW_TEXT=1 LTTP_RND_GeneralBugfixes.asm ../working.sfc
./bin/macos/asar LTTP_RND_GeneralBugfixes.asm ../working.sfc

View File

@@ -2,4 +2,4 @@
rm ../working.sfc
cp ../alttp.sfc ../working.sfc
./bin/linux/asar -DFEATURE_NEW_TEXT=1 LTTP_RND_GeneralBugfixes.asm ../working.sfc
./bin/linux/asar -DFEATURE_PATREON_SUPPORTERS=1 LTTP_RND_GeneralBugfixes.asm ../working.sfc

View File

@@ -1,82 +0,0 @@
DrawDungeonItemCounts:
LDX.b IndoorsFlag : BNE + : RTL : + ; Skip if outdoors
; extra hard safeties for getting dungeon ID to prevent crashes
PHA
LDA.w DungeonID : AND.w #$00FE : TAX ; force dungeon ID to be multiple of 2
PLA
CPX.b #$1B : BCS .done ; Skip if not in a valid dungeon ID
JSR.w DrawCompassCounts
JSR.w DrawMapCounts
.done
RTL
DrawCompassCounts:
PHX
LDA.l CompassMode : AND.w #$00FF : BEQ .done
BIT.w #$0002 : BNE + ; if CompassMode==2, we don't check for the compass
LDA.l CompassField : 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
LDA.l CompassTotalsWRAM, X : AND.w #$00FF
SEP #$20
JSR HudHexToDec2Digit
REP #$20
PHX
LDX.b Scrap06 : TXA : ORA.w #$2400 : STA.l HUDTileMapBuffer+$9A
LDX.b Scrap07 : TXA : ORA.w #$2400 : STA.l HUDTileMapBuffer+$9C
PLX
LDA.l DungeonLocationsChecked, X : AND.w #$00FF
SEP #$20
JSR HudHexToDec2Digit
REP #$20
LDX.b Scrap06 : TXA : ORA.w #$2400 : STA.l HUDTileMapBuffer+$94 ; Draw the item count
LDX.b Scrap07 : TXA : ORA.w #$2400 : STA.l HUDTileMapBuffer+$96
LDA.w #$2830 : STA.l HUDTileMapBuffer+$98 ; draw the slash
.done
PLX
RTS
DrawMapCounts:
PHX
LDA.l MapHUDMode : AND.w #$00FF : BEQ .done
BIT.w #$0002 : BNE + ; if MapHUDMode==2, we don't check for map
LDA.l MapField : AND.l DungeonItemMasks, X ; Load map values to A, mask with dungeon item masks
BEQ .done ; skip if we don't have map
+
TXA : LSR : TAX
LDA.l MapTotalsWRAM, X : AND.w #$00FF
SEP #$20
JSR HudHexToDec2Digit
REP #$20
PHX
LDX.b Scrap07 : TXA : ORA.w #$2400 : STA.l HUDTileMapBuffer+$A6
PLX
LDA.l DungeonCollectedKeys, X : AND.w #$00FF
SEP #$20
JSR HudHexToDec2Digit
REP #$20
LDX.b Scrap07 : TXA : ORA.w #$2400 : STA.l HUDTileMapBuffer+$A2
LDA.w #$2830 : STA.l HUDTileMapBuffer+$A4 ; draw the slash
.done
PLX
RTS
DungeonItemMasks: ; these are dungeon correlations to $7EF364 - $7EF369 so it knows where to store compasses, etc
dw $C000, $C000, $2000, $1000, $0800, $0400, $0200, $0100
dw $0080, $0040, $0020, $0010, $0008, $0004
;--------------------------------------------------------------------------------
InitDungeonCounts:
LDX.b #$0F
-
LDA.l CompassTotalsROM, X : STA.l CompassTotalsWRAM, X
DEX
BPL -
LDX.b #$0F
-
LDA.l ChestKeys, X : STA.l MapTotalsWRAM, X
DEX
BPL -
RTL

View File

@@ -23,10 +23,7 @@ InvertDPad:
.crowd_control
LDA.l ControllerInverter : BNE +
LDA.b RoomIndex : CMP.b #$DE : BNE .off
LDA.b #$01 : BRA +
.off
LDA.w JOY1L : STA.b Scrap00
LDA.w JOY1H : STA.b Scrap01
JML.l InvertDPadReturn
@@ -122,5 +119,5 @@ HandleOneMindController:
.no_onemind
STZ.b NMIDoneFlag
JML $008034 ; reset frame loop
JML $808034 ; reset frame loop

View File

@@ -9,11 +9,7 @@ CuccoStorm:
SEP #$30 ; set 8-bit accumulator index registers
LDA.l CuccoStormer : BEQ + ; only if storm is on
LDA.b GameMode : CMP.b #$09 : BEQ .check ; only if outdoors
.indoors
LDA.b #$00 : STA.l CuccoStormer ; turn off cucco storm if indoors
BRA +
.check
LDA.b GameMode : CMP.b #$09 : BNE + ; only if outdoors
LDA.l LoopFrames : AND.b #$7F : BNE + ; check every 128 frames
-
@@ -36,9 +32,9 @@ CuccoStorm:
LDA.w SpriteAuxTable, X : CMP.b #!CUCCO_ENRAGED : !BLT ++
PLA : BRA + ; we found an angry cucco, done
++ : INX : BRA -- : .ldone
;==== Create a Cucco
CPY.b #$FF : BNE ++
; we didn't find a cucco, so try to create one
PLY

17
custompalettes.asm Normal file
View File

@@ -0,0 +1,17 @@
PalettesCustom:
.master_sword
dw $0000, $7E4E, $6FF4, $1CF5, $7FFF, $1CE7, $7A10, $64A5
.tempered_sword
dw $7FFF, $093B, $169F, $7E8D, $7FFF, $1CE7, $7A10, $64A5
.golden_sword
dw $0000, $033F, $7FFF, $2640, $7FFF, $1CE7, $7A10, $64A5
.fighter_shield
dw $0000, $7FFF, $27FF, $5E2D, $7FFF, $1CE7, $7A10, $64A5
.red_shield
dw $0000, $7FFF, $27FF, $5E2D, $4F5F, $1CE7, $2E9C, $14B6
.mirror_shield
dw $0000, $7E4E, $6F44, $1CF5, $7399, $1CE7, $02F9, $0233
.crystal
dw $7FFF, $7FFF, $0000, $5907, $6E0E, $0000, $7FBB, $7672
.off_black
dw $0000, $14A5, $14A5, $14A5, $14A5, $14A5, $14A5, $14A5

Binary file not shown.

Binary file not shown.

View File

@@ -1,27 +0,0 @@
CheckReceivedItemPropertiesBeforeLoad:
LDA.b RoomIndex : BEQ .normalCode
LDA.l RoomFade : BNE .lightOff
.normalCode
LDA.l AddReceivedItemExpanded_properties, X ;Restore Rando Code
RTL
.lightOff
PHX : PHY : PHB
JSL LoadReceivedItemExpandedProperties ; get palette
REP #$30
AND.w #$0007 ; mask out palette
ASL #5 ; multiply by 32
ADC.w #$C610 ; offset to latter half
TAX ; give to destination
LDY.w #$C610 ; target palette SP0 colors 8-F
LDA.w #$000F ; 16 bytes
MVN $7E, $7E ; move palette
SEP #$30
PLB : PLY : PLX
INC.b NMICGRAM
LDA.b #$00
RTL

View File

@@ -143,11 +143,6 @@ SetEscapeAssist:
LDA.l EscapeAssist : BIT.b #$02 : BEQ + : LDA.b #$00 : STA.l InfiniteBombs : +
LDA.l EscapeAssist : BIT.b #$01 : BEQ + : LDA.b #$00 : STA.l InfiniteArrows : +
++
LDA.l SpecialWeapons : CMP #$01 : BNE +
LDA.l SpecialWeaponLevel : BEQ +
LDA #$01 : STA InfiniteBombs
+
RTL
;--------------------------------------------------------------------------------
SetSilverBowMode:

Binary file not shown.

Binary file not shown.

View File

@@ -35,8 +35,45 @@ W=73
X=74
Y=75
Z=76
'=77
.=A0
/=A2
:=A3
_=A6
a=A0
b=A1
c=A2
d=A3
e=A4
f=A5
g=A6
h=A7
i=A8
j=A9
k=AA
l=AB
m=AC
n=AD
o=AE
p=AF
q=B0
r=B1
s=B2
t=B3
u=B4
v=B5
w=B6
x=B7
y=B8
z=B9
'=D9
"=DA
/=DB
.=DC
:=DD
_=DE
^=DF
&=E0
#=E1
@=E2
>=E3
?=E4
!=E5
~=E6
,=E7
-=E8

View File

@@ -35,8 +35,45 @@ W=99
X=9A
Y=9B
Z=9C
'=9d
.=C0
/=C2
:=C3
_=C6
a=BB
b=BC
c=BD
d=BE
e=BF
f=C0
g=C1
h=C2
i=C3
j=C4
k=C5
l=C6
m=C7
n=C8
o=C9
p=CA
q=CB
r=CC
s=CD
t=CE
u=CF
v=D0
w=D1
x=D2
y=D3
z=D4
'=EC
"=ED
/=EE
.=EF
:=F0
_=F1
^=F2
&=F3
#=F4
@=F5
>=F6
?=F7
!=F8
~=F9
,=FA
-=FB

View File

@@ -24,4 +24,5 @@ V=4D
W=4E
X=4F
Y=50
Z=51
Z=51
.=52

View File

@@ -24,4 +24,8 @@ V=2F
W=30
X=31
Y=32
Z=33
Z=33
,=34
'=35
-=36
.=37

BIN
data/customitems.4bpp Normal file

Binary file not shown.

BIN
data/customitems.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

View File

@@ -0,0 +1,55 @@
; Kanji replacement characters
org $8E9AC9
;.charDD ; 𓄿
db $FB, $8C, $73, $CB, $30, $4B, $30, $54
db $2B, $5B, $24, $2D, $12, $13, $61, $1E
db $36, $09, $1B, $04, $14, $0B, $15, $0A
db $15, $0A, $21, $1E, $1E, $48, $30, $38
;.charDE ; ☥
db $1E, $33, $0C, $2D, $12, $2D, $12, $2D
db $12, $F3, $0C, $01, $01, $BF, $40, $C0
db $3F, $BF, $40, $F2, $0C, $12, $0C, $12
db $0C, $12, $0C, $1E, $50, $A0, $F0
;.charDF ; ≈
db $01, $3B, $6E, $11, $C4, $3B, $91, $6E
db $BB, $44, $26, $18, $3C, $E7, $3B, $6E
db $11, $C4, $3B, $91, $6E, $BB, $44, $EE
db $98, $60, $F0
;.charE0 ; 🡅
db $0C, $12, $0C, $21, $1E, $40, $3F, $80
db $7F, $02, $01, $01, $E1, $1E, $21, $1E
db $21, $1E, $21, $1E, $21, $1E, $21, $1E
db $21, $1E, $3F, $80, $80
;.charE1 ; 🡇
db $3F, $21, $1E, $21, $1E, $21, $1E, $21
db $1E, $21, $1E, $21, $1E, $E1, $1E, $80
db $7F, $40, $3F, $21, $1E, $12, $0C, $0C
db $28, $10, $30
;.charE2 ; 🡆
db $18, $14, $08, $12, $0C, $F1, $0E, $80
db $7F, $01, $80, $7F, $80, $7F, $80, $7F
db $F1, $0E, $12, $0C, $14, $08, $18, $20
db $C0, $C0
;.charE3 ; 🡄
db $06, $0A, $04, $12, $0C, $23, $1C, $40
db $3F, $02, $01, $03, $80, $7F, $80, $7F
db $40, $3F, $23, $1C, $12, $0C, $0A, $04
db $06, $10, $E0, $F0
org $8EBD94
;.charDD ; 𓄿
db $BF, $FE, $3F, $FF, $B8 ; 10111111 11111110 00111111 11111111 10111000
;.charDE ; ☥
db $BF, $FA, $3F, $FF, $B8 ; 10111111 11111010 00111111 11111111 10111000
;.charDF ; ≈
db $AF, $FE, $2B, $FE, $38 ; 10101111 11111110 00101011 11111110 00111000
;.charE0 ; 🡅
db $2F, $FE, $3F, $FF, $A8 ; 00101111 11111110 00111111 11111111 10101000
;.charE1 ; 🡇
db $2F, $F0, $3F, $FF, $B8 ; 00101111 11110000 00111111 11111111 10111000
;.charE2 ; 🡆
db $2F, $F8, $3F, $FE, $38 ; 00101111 11111000 00111111 11111110 00111000
;.charE3 ; 🡄
db $2F, $FE, $3F, $FE, $38 ; 00101111 11111110 00111111 11111110 00111000

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,59 @@
db $00, $01, $02, $03, $04, $CC, $CC ; あ い う え お ⎵ ⎵
db $15, $16, $17, $1D, $1E, $CC ; が ぎ ぐ げ ご ⎵
db $50, $51, $52, $53, $54, $CC, $CC ; ア イ ウ エ オ ⎵ ⎵
db $D0, $D1, $D2, $D3, $D4, $CC ; a b c d e ⎵
db $AA, $AB, $AC, $AD, $CC, $CC ; A B C D ⎵ ⎵
db $08, $09, $0A, $0B, $0C, $CC, $CC ; か き く け こ ⎵ ⎵
db $1F, $25, $26, $27, $2D, $CC ; ざ じ ず ぜ ぞ ⎵
db $58, $59, $5A, $5B, $5C, $CC, $CC ; カ キ ク ケ コ ⎵ ⎵
db $D5, $D6, $D7, $D8, $D9, $CC ; ザ ジ ズ ゼ ゾ ⎵
db $AE, $AF, $B0, $B1, $CC, $CC ; E F G H ⎵ ⎵
db $10, $11, $12, $13, $14, $CC, $CC ; さ し す せ そ ⎵ ⎵
db $2E, $2F, $35, $36, $37, $CC ; だ ぢ づ で ど ⎵
db $60, $61, $62, $63, $64, $CC, $CC ; サ シ ス セ ソ ⎵ ⎵
db $DA, $DB, $DC, $DD, $DE, $CC ; ダ ヂ ヅ デ ド ⎵
db $B2, $B3, $B4, $B5, $CC, $CC ; I J K L ⎵ ⎵
db $18, $19, $1A, $1B, $1C, $CC, $CC ; た ち つ て と ⎵ ⎵
db $3D, $3E, $3F, $40, $41, $CC ; ば び ぶ べ ぼ ⎵
db $68, $69, $6A, $6B, $6C, $CC, $CC ; タ チ ツ テ ト ⎵ ⎵
db $DF, $E0, $E1, $E2, $E3, $CC ; バ ビ ブ ベ ボ ⎵
db $B6, $B7, $B8, $B9, $CC, $CC ; M N O P ⎵ ⎵
db $20, $21, $22, $23, $24, $CC, $CC ; な に ぬ ね の ⎵ ⎵
db $42, $43, $44, $45, $46, $CC ; ぱ ぴ ぷ ぺ ぽ ⎵
db $70, $71, $72, $73, $74, $CC, $CC ; ナ ニ ヌ ネ ⎵ ⎵
db $E4, $E5, $E6, $E7, $E8, $CC ; パ ピ プ ペ ポ ⎵
db $BA, $BB, $BC, $BD, $CC, $CC ; Q R S T ⎵ ⎵
db $28, $29, $2A, $2B, $2C, $CC, $CC ; は ひ ふ へ ほ ⎵ ⎵
db $65, $66, $67, $6D, $6E, $CC
db $78, $79, $7A, $7B, $7C, $CC, $CC ; ハ ヒ フ ヘ ホ ⎵ ⎵
db $E9, $EA, $EB, $EC, $C6, $CC ; ァ ィ ゥ ェ ォ ⎵
db $BE, $BF, $C0, $C1, $CC, $CC ; U V W X ⎵ ⎵
db $30, $31, $32, $33, $34, $CC, $CC ; ま み む め も ⎵ ⎵
db $6F, $75, $76, $77, $7D, $CC ; ザ ジ ズ ゼ ゾ ⎵
db $80, $81, $82, $83, $84, $CC, $CC ; マ ミ ム メ モ ⎵ ⎵
db $CC, $CC, $CC, $CC, $9A, $CC ; ャ ュ ョ ⎵ ッ ⎵
db $C2, $C3, $C9, $CE, $CC, $CC ; Y Z 〜 ⎵ ⎵
db $05, $CC, $06, $CC, $07, $CC, $CC ; や ⎵ ゆ ⎵ よ ⎵ ⎵
db $7E, $7F, $85, $86, $87, $CC ; ダ ヂ ヅ デ ド ⎵
db $55, $CC, $56, $CC, $57, $CC, $CC ; ヤ ⎵ ユ ⎵ ヨ ⎵ ⎵
db $A0, $A1, $A2, $A3, $A4, $CC ; ⎵ ⎵ ⎵ ⎵ ⎵ ⎵
db $CC, $CC, $CC, $CC, $CC, $CC ; ⎵ ⎵ ⎵ ⎵ ⎵ ⎵
db $38, $39, $3A, $3B, $3C, $CC, $CC ; ら り る れ ろ ⎵ ⎵
db $8D, $8E, $8F, $90, $91, $CC ; バ ビ ブ ベ ボ ⎵
db $88, $89, $8A, $8B, $8C, $CC, $CC ; ラ リ ル レ ロ ⎵ ⎵
db $A5, $A6, $A7, $A8, $A9, $CC ; ⎵ ⎵ ⎵ ⎵ ⎵ ⎵
db $CA, $CB, $CD, $CD, $CC, $CC ; 🡄 🡆 END ⎵ ⎵
db $0D, $0E, $0F, $CC, $C9, $CC, $CC ; わ を ん ⎵ ⎵ ⎵
db $92, $93, $94, $95, $96, $CC ; パ ピ プ ペ ポ ⎵
db $5D, $5E, $5F, $CC, $C9, $CC, $CC ; ワ ヲ ン ⎵ ⎵ ⎵
db $CC, $CC, $CC, $CC, $CC, $CC ; ⎵ ⎵ ⎵ ⎵ ⎵ ⎵
db $CC, $CC, $CC, $CC, $CC, $CC ; ⎵ ⎵ ⎵ ⎵ ⎵ ⎵

BIN
data/playernamecharmap.bin Normal file

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,72 @@
dw $E164, $3900 ; VRAM $C9C2 | 58 bytes | Horizontal
dw $1CA2, $0188, $1CA3, $0188, $1CA4, $0188, $0188, $0188
dw $0188, $0188, $1DA0, $0188, $1DA1, $0188, $1DA2, $0188
dw $1DA3, $0188, $1DA4, $0188, $0188, $0188, $1D4A, $0188
dw $1D4B, $0188, $1D4C, $0188, $1D4D
dw $0165, $3900 ; VRAM $CA02 | 58 bytes | Horizontal
dw $1CB2, $0188, $1CB3, $0188, $1CB4, $0188, $0188, $0188
dw $0188, $0188, $1DB0, $0188, $1DB1, $0188, $1DB2, $0188
dw $1DB3, $0188, $1DB4, $0188, $0188, $0188, $1D5A, $0188
dw $1D5B, $0188, $1D5C, $0188, $1D5D
dw $2165, $3900 ; VRAM $CA42 | 58 bytes | Horizontal
dw $1CAA, $0188, $1CAB, $0188, $1CAC, $0188, $0188, $0188
dw $0188, $0188, $1DA5, $0188, $1DA6, $0188, $1DA7, $0188
dw $1DA8, $0188, $1DA9, $0188, $0188, $0188, $1D4E, $0188
dw $1D4F, $0188, $1D60, $0188, $1D61
dw $4165, $3900 ; VRAM $CA82 | 58 bytes | Horizontal
dw $1CBA, $0188, $1CBB, $0188, $1CBC, $0188, $0188, $0188
dw $0188, $0188, $1DB5, $0188, $1DB6, $0188, $1DB7, $0188
dw $1DB8, $0188, $1DB9, $0188, $0188, $0188, $1D5E, $0188
dw $1D5F, $0188, $1D70, $0188, $1D71
dw $6165, $3900 ; VRAM $CAC2 | 58 bytes | Horizontal
dw $1CC2, $0188, $1CC3, $0188, $1CC4, $0188, $0188, $0188
dw $0188, $0188, $1DAA, $0188, $1DAB, $0188, $1DAC, $0188
dw $1DAD, $0188, $1DAE, $0188, $0188, $0188, $1D62, $0188
dw $1D63, $0188, $1D64, $0188, $1D65
dw $8165, $3900 ; VRAM $CB02 | 58 bytes | Horizontal
dw $1CD2, $0188, $1CD3, $0188, $1CD4, $0188, $0188, $0188
dw $0188, $0188, $1DBA, $0188, $1DBB, $0188, $1DBC, $0188
dw $1DBD, $0188, $1DBE, $0188, $0188, $0188, $1D72, $0188
dw $1D73, $0188, $1D74, $0188, $1D75
dw $A165, $3900 ; VRAM $CB42 | 58 bytes | Horizontal
dw $1CCA, $0188, $1CCB, $0188, $1CCC, $0188, $0188, $0188
dw $0188, $0188, $1DAF, $0188, $1DC0, $0188, $1DC1, $0188
dw $1DC2, $0188, $1DC3, $0188, $0188, $0188, $1D66, $0188
dw $1D67, $0188, $1D68, $0188, $1D69
dw $C165, $3900 ; VRAM $CB82 | 58 bytes | Horizontal
dw $1CDA, $0188, $1CDB, $0188, $1CDC, $0188, $0188, $0188
dw $0188, $0188, $1DBF, $0188, $1DD0, $0188, $1DD1, $0188
dw $1DD2, $0188, $1DD3, $0188, $0188, $0188, $1D76, $0188
dw $1D77, $0188, $1D78, $0188, $1D79
dw $E165, $3900 ; VRAM $CBC2 | 58 bytes | Horizontal
dw $1CE2, $0188, $1CE3, $0188, $1CE4, $0188, $0188, $0188
dw $0188, $0188, $1DC4, $0188, $1DC5, $0188, $1DC6, $0188
dw $1DC7, $0188, $1DC8, $0188, $0188, $0188, $1D6A, $0188
dw $1D6B, $0188, $1D6C, $0188, $1D6D
dw $0166, $3900 ; VRAM $CC02 | 58 bytes | Horizontal
dw $1CF2, $0188, $1CF3, $0188, $1CF4, $0188, $0188, $0188
dw $0188, $0188, $1DD4, $0188, $1DD5, $0188, $1DD6, $0188
dw $1DD7, $0188, $1DD8, $0188, $0188, $0188, $1D7A, $0188
dw $1D7B, $0188, $1D7C, $0188, $1D7D
; dw $2166, $3900 ; VRAM $CC42 | 58 bytes | Horizontal
; dw $1CEA, $0188, $1CEB, $0188, $1CEC, $0188, $0188, $0188
; dw $0188, $0188, $1DC9, $0188, $1DCA, $0188, $1DCB, $0188
; dw $1DCC, $0188, $1D86, $0188, $0188, $0188, $1D6E, $0188
; dw $1D6F, $0188, $1D80, $0188, $1D81
;
; dw $4166, $3900 ; VRAM $CC82 | 58 bytes | Horizontal
; dw $1CFA, $0188, $1CFB, $0188, $1CFC, $0188, $0188, $0188
; dw $0188, $0188, $1DD9, $0188, $1DDA, $0188, $1DDB, $0188
; dw $1DDC, $0188, $1D96, $0188, $0188, $0188, $1D7E, $0188
; dw $1D7F, $0188, $1D90, $0188, $1D91

Binary file not shown.

View File

@@ -0,0 +1,72 @@
dw $E164, $3900 ; VRAM $C9C2 | 58 bytes | Horizontal
dw $1CA2, $0188, $1CA3, $0188, $1CA4, $0188, $0188, $0188
dw $0188, $0188, $1DA0, $0188, $1DA1, $0188, $1DA2, $0188
dw $1DA3, $0188, $1DA4, $0188, $0188, $0188, $1D4A, $0188
dw $1D4B, $0188, $1D4C, $0188, $1D4D
dw $0165, $3900 ; VRAM $CA02 | 58 bytes | Horizontal
dw $1CB2, $0188, $1CB3, $0188, $1CB4, $0188, $0188, $0188
dw $0188, $0188, $1DB0, $0188, $1DB1, $0188, $1DB2, $0188
dw $1DB3, $0188, $1DB4, $0188, $0188, $0188, $1D5A, $0188
dw $1D5B, $0188, $1D5C, $0188, $1D5D
dw $2165, $3900 ; VRAM $CA42 | 58 bytes | Horizontal
dw $1CAA, $0188, $1CAB, $0188, $1CAC, $0188, $0188, $0188
dw $0188, $0188, $1DA5, $0188, $1DA6, $0188, $1DA7, $0188
dw $1DA8, $0188, $1DA9, $0188, $0188, $0188, $1D4E, $0188
dw $1D4F, $0188, $1D60, $0188, $1D61
dw $4165, $3900 ; VRAM $CA82 | 58 bytes | Horizontal
dw $1CBA, $0188, $1CBB, $0188, $1CBC, $0188, $0188, $0188
dw $0188, $0188, $1DB5, $0188, $1DB6, $0188, $1DB7, $0188
dw $1DB8, $0188, $1DB9, $0188, $0188, $0188, $1D5E, $0188
dw $1D5F, $0188, $1D70, $0188, $1D71
dw $6165, $3900 ; VRAM $CAC2 | 58 bytes | Horizontal
dw $1CC2, $0188, $1CC3, $0188, $1CC4, $0188, $0188, $0188
dw $0188, $0188, $1DAA, $0188, $1DAB, $0188, $1DAC, $0188
dw $1DAD, $0188, $1DAE, $0188, $0188, $0188, $1D62, $0188
dw $1D63, $0188, $1D64, $0188, $1D65
dw $8165, $3900 ; VRAM $CB02 | 58 bytes | Horizontal
dw $1CD2, $0188, $1CD3, $0188, $1CD4, $0188, $0188, $0188
dw $0188, $0188, $1DBA, $0188, $1DBB, $0188, $1DBC, $0188
dw $1DBD, $0188, $1DBE, $0188, $0188, $0188, $1D72, $0188
dw $1D73, $0188, $1D74, $0188, $1D75
dw $A165, $3900 ; VRAM $CB42 | 58 bytes | Horizontal
dw $1CCA, $0188, $1CCB, $0188, $1CCC, $0188, $0188, $0188
dw $0188, $0188, $1DAF, $0188, $1DC0, $0188, $1DC1, $0188
dw $1DC2, $0188, $1DC3, $0188, $0188, $0188, $1D66, $0188
dw $1D67, $0188, $1D68, $0188, $1D69
dw $C165, $3900 ; VRAM $CB82 | 58 bytes | Horizontal
dw $1CDA, $0188, $1CDB, $0188, $1CDC, $0188, $0188, $0188
dw $0188, $0188, $1DBF, $0188, $1DD0, $0188, $1DD1, $0188
dw $1DD2, $0188, $1DD3, $0188, $0188, $0188, $1D76, $0188
dw $1D77, $0188, $1D78, $0188, $1D79
dw $E165, $3900 ; VRAM $CBC2 | 58 bytes | Horizontal
dw $1CE2, $0188, $1CE3, $0188, $1CE4, $0188, $0188, $0188
dw $0188, $0188, $1DC4, $0188, $1DC5, $0188, $1DC6, $0188
dw $1DC7, $0188, $1DC8, $0188, $0188, $0188, $1D6A, $0188
dw $1D6B, $0188, $1D6C, $0188, $1D6D
dw $0166, $3900 ; VRAM $CC02 | 58 bytes | Horizontal
dw $1CF2, $0188, $1CF3, $0188, $1CF4, $0188, $0188, $0188
dw $0188, $0188, $1DD4, $0188, $1DD5, $0188, $1DD6, $0188
dw $1DD7, $0188, $1DD8, $0188, $0188, $0188, $1D7A, $0188
dw $1D7B, $0188, $1D7C, $0188, $1D7D
dw $2166, $3900 ; VRAM $CC42 | 58 bytes | Horizontal
dw $1CEA, $0188, $1CEB, $0188, $1CEC, $0188, $0188, $0188
dw $0188, $0188, $1DC9, $0188, $1DCA, $0188, $1DCB, $0188
dw $1DCC, $0188, $1D86, $0188, $0188, $0188, $1D6E, $0188
dw $1D6F, $0188, $1D80, $0188, $1D81
dw $4166, $3900 ; VRAM $CC82 | 58 bytes | Horizontal
dw $1CFA, $0188, $1CFB, $0188, $1CFC, $0188, $0188, $0188
dw $0188, $0188, $1DD9, $0188, $1DDA, $0188, $1DDB, $0188
dw $1DDC, $0188, $1D96, $0188, $0188, $0188, $1D7E, $0188
dw $1D7F, $0188, $1D90, $0188, $1D91

View File

@@ -0,0 +1,25 @@
dw $2362, $3900 ; VRAM $C446 | 58 bytes | Horizontal
dw $1C48, $0188, $1C49, $0188, $1C4A, $0188, $1C4B, $0188
dw $1C4C, $0188, $0188, $0188, $0188, $0188, $1CC5, $0188
dw $1CC6, $0188, $1CC7, $0188, $1CCD, $0188, $1CCE, $0188
dw $0188, $0188, $1CE8, $0188, $1CE9
dw $4362, $3900 ; VRAM $C486 | 58 bytes | Horizontal
dw $1C58, $0188, $1C59, $0188, $1C5A, $0188, $1C5B, $0188
dw $1C5C, $0188, $0188, $0188, $0188, $0188, $1CD5, $0188
dw $1CD6, $0188, $1CD7, $0188, $1CDD, $0188, $1CDE, $0188
dw $0188, $0188, $1CF8, $0188, $1CF9
dw $6362, $3900 ; VRAM $C4C6 | 58 bytes | Horizontal
dw $1C60, $0188, $1C61, $0188, $1C62, $0188, $1C63, $0188
dw $1C64, $0188, $0188, $0188, $0188, $0188, $1CCF, $0188
dw $1CE5, $0188, $1CE6, $0188, $1CE7, $0188, $1CED, $0188
dw $0188, $0188, $1D00, $0188, $1D01
dw $8362, $3900 ; VRAM $C506 | 58 bytes | Horizontal
dw $1C70, $0188, $1C71, $0188, $1C72, $0188, $1C73, $0188
dw $1C74, $0188, $0188, $0188, $0188, $0188, $1CDF, $0188
dw $1CF5, $0188, $1CF6, $0188, $1CF7, $0188, $1CFD, $0188
dw $0188, $0188, $1D10, $0188, $1D11

BIN
data/smallchars.2bpp Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

61
data/textbytecharmap.txt Normal file
View File

@@ -0,0 +1,61 @@
'=9D
A=AA
B=AB
C=AC
D=AD
E=AE
F=AF
G=B0
H=B1
I=B2
J=B3
K=B4
L=B5
M=B6
N=B7
O=B8
P=B9
Q=BA
R=BB
S=BC
T=BD
U=BE
V=BF
W=C0
X=C1
Y=C2
Z=C3
?=C6
!=C7
,=C8
-=C9
.=CD
~=CE
a=D0
b=D1
c=D2
d=D3
e=D4
f=D5
g=D6
h=D7
i=D8
j=D9
k=DA
l=DB
m=DC
n=DD
o=DE
p=DF
q=E0
r=E1
s=E2
t=E3
u=E4
v=E5
w=E6
x=E7
y=E8
z=E9
:=EA
=FF

61
data/textwordcharmap.txt Normal file
View File

@@ -0,0 +1,61 @@
'=9D00
A=AA00
B=AB00
C=AC00
D=AD00
E=AE00
F=AF00
G=B000
H=B100
I=B200
J=B300
K=B400
L=B500
M=B600
N=B700
O=B800
P=B900
Q=BA00
R=BB00
S=BC00
T=BD00
U=BE00
V=BF00
W=C000
X=C100
Y=C200
Z=C300
?=C600
!=C700
,=C800
-=C900
.=CD00
~=CE00
a=D000
b=D100
c=D200
d=D300
e=D400
f=D500
g=D600
h=D700
i=D800
j=D900
k=DA00
l=DB00
m=DC00
n=DD00
o=DE00
p=DF00
q=E000
r=E100
s=E200
t=E300
u=E400
v=E500
w=E600
x=E700
y=E800
z=E900
:=EA00
=FF00

50
deadrocks.asm Normal file
View File

@@ -0,0 +1,50 @@
pushpc
org $86EDD1
JSL CheckTransform
BRA + : NOP : +
org $86EF9A
JSL SpriteDeath
NOP
pullpc
CheckTransform:
CMP.b #$8F
BNE .skip
LDA.w $0E20, X
PHA
LDA.b #$8F
STA.w $0E20, X
JSL.l $8DB818
PLA
STA.w $0DE0, X
LDA.b #$8F
RTL
.skip
STA.w $0E20, X
JSL.l $8DB818
RTL
SpriteDeath:
LDA.w $0E20, X
CMP.b #$8F
BNE .done; not blob
LDA.w $0DE0, X
CMP.b #$27
BNE .done; blob that was formerly not a deadrock
LDA.l DeadrockCounter
CMP.b #$FF
BEQ .done ; deadrock counter maxed
INC
STA.l DeadrockCounter
.done
; what we wrote over
LDY.w $0E20, X
CPY.b #$1B
RTL

View File

@@ -0,0 +1,539 @@
;===================================================================================================
; Get the item's graphic from WRAM/ROM
; Bit 7 set indicates an explicit WRAM address
; Bit 7 reset indicates an offset into the ROM buffer
;===================================================================================================
;---------------------------------------------------------------------------------------------------
; Enters with A for parameter
;---------------------------------------------------------------------------------------------------
TransferItemReceiptToBuffer_using_GraphicsID:
PHP
PHB
REP #$30
PHX
PHY
SEP #$30
LDX.b #$00
.find_reverse
CMP.l ItemReceipts_graphics,X
BEQ .found
INX
BNE .find_reverse
.found
TXA
REP #$30
BRA ++
;===================================================================================================
TransferRupeesProperly:
PHP
PHB
REP #$31
PHX
PHY
AND.w #$00FF
SBC.w #$0023
XBA
LSR
LSR
LSR
ADC.w #BigDecompressionBuffer+$800
BRA TransferItemReceiptToBuffer_using_ExplicitBufferAddress
;===================================================================================================
TransferItemReceiptToBuffer_using_ReceiptID:
PHP : PHB
REP #$30
PHX : PHY
++ AND.w #$00FF
ASL : TAX
LDA.l BusyItem : BNE +
LDA.l StandingItemGraphicsOffsets,X
BRA .have_address
+
LDA.l ItemReceiptGraphicsOffsets,X
.have_address
BMI TransferItemReceiptToBuffer_using_ExplicitBufferAddress
.rom_address
ADC.w #ItemReceiptGraphicsROM
PHK
BRA .continue
#TransferItemReceiptToBuffer_using_ExplicitBufferAddress:
PEA.w $7F7F
PLB
.continue
PLB
TAY
LDX.w #62
.next_write
LDA.w $003E,Y
STA.l ItemGetGFX+$00,X
LDA.w $023E,Y
STA.l ItemGetGFX+$40,X
DEY
DEY
DEX
DEX
BPL .next_write
REP #$30
PLY
PLX
PLB
PLP
RTL
;===================================================================================================
TransferItemToVRAM:
REP #$21
SEP #$10
LDA.w ItemGFXPtr
BEQ .exit
BMI .wram_address
.rom_address
ADC.w #ItemReceiptGraphicsROM
LDX.b #ItemReceiptGraphicsROM>>16
.set_address
STA.w $4302
ADC.w #$0200
STA.w $4312
STX.w $4304
STX.w $4314
LDX.b #$80
STX.w $2115
LDA.w #$1801
STA.w $4300
STA.w $4310
LDA.w #$0040
STA.w $4305
STA.w $4315
LDA.w ItemGFXTarget
STA.w $2116
LDX.b #$01
STX.w $420B
ADC.w #$0100
STA.w $2116
INX
STX.w $420B
STZ.w ItemGFXPtr
STZ.w ItemGFXTarget
.exit
RTL
.wram_address
LDX.b #$7F
BRA .set_address
;===================================================================================================
; Decompress everything at the start of the game
;===================================================================================================
DecompBufferOffset = $18
DecompTestByte = $04
DecompCommand = $02
DecompSize = $00
DecompTileCount = $1A
DecompSaveY = $1A
Decomp3BPPScratch = $20
;===================================================================================================
DecompressAllItemGraphics:
PHP
PHB
PHD
REP #$38
; Stack change for safety
TSX
LDA.w #$1400
TCS
PHX
; direct page change for speed
LDA.w #$1200
TCD
STZ.b DecompBufferOffset
SEP #$34
STA.l $4200 ; already 0 from the LDA above
LDX.b #$5D+$73 : JSR FastSpriteDecomp
LDX.b #$5C+$73 : JSR FastSpriteDecomp
LDX.b #$5B+$73 : JSR FastSpriteDecomp
LDX.b #$5A+$73 : JSR FastSpriteDecomp
REP #$30
PLX
TXS
SEP #$20
LDA.b #$81
STA.l $4200
PLD
PLB
PLP
RTL
;===================================================================================================
; I normally hate macros like this... but I don't feel like constantly rewriting this
;===================================================================================================
macro GetNextByte()
LDA.w $0000,Y
INY
BNE ?++
; Y pulls more than it needs, but that's fine
; the high byte should only be affected if we somehow have FF as our bank
; and if that happens, we have other problems
PHB
PLY
INY
PHY
PLB
LDY.w #$8000
?++
endmacro
;===================================================================================================
; There's no long vanilla routine, and we're going to make heavy use of this
; so might as well rewrite it to be fast
;===================================================================================================
FastSpriteDecomp:
SEP #$30
LDA.l $80CFC0,X : PHA : PLB ; bank
LDA.l $80D09F,X : XBA ; high
LDA.l $80D17E,X ; low
REP #$10
TAY
LDX.w #$0000
.next_command
%GetNextByte()
CMP.b #$FF
BNE .continue
;---------------------------------------------------------------------------------------------------
JMP Unrolled3BPPConvert
;---------------------------------------------------------------------------------------------------
.continue
CMP.b #$E0
BCS .expanded
STA.b DecompTestByte
REP #$20
AND.w #$001F
BRA .normal
;---------------------------------------------------------------------------------------------------
; Putting some commands up here for branch distance
;---------------------------------------------------------------------------------------------------
.nonrepeating
REP #$21
TYA
ADC.b DecompSize
ORA.w #$8000
STA.b DecompSize
SEP #$20
.next_nonrepeating
%GetNextByte()
STA.l DecompBuffer2,X
INX
CPY.b DecompSize
BNE .next_nonrepeating
BRA .next_command
;---------------------------------------------------------------------------------------------------
.repeating
%GetNextByte()
STY.b DecompSaveY
LDY.b DecompSize
.next_repeating
STA.l DecompBuffer2,X
INX
DEY
BNE .next_repeating
LDY.b DecompSaveY
BRA .next_command
;---------------------------------------------------------------------------------------------------
; Rest of command handling
;---------------------------------------------------------------------------------------------------
.expanded
STA.b DecompCommand
ASL
ASL
ASL
STA.b DecompTestByte
LDA.b DecompCommand
AND.b #$03
XBA
%GetNextByte()
REP #$20
;---------------------------------------------------------------------------------------------------
.normal
INC
STA.b DecompSize
SEP #$20
LDA.b DecompTestByte
AND.b #$E0
BEQ .nonrepeating
BMI .copy
ASL
BPL .repeating
ASL
BPL .repeating_word
;---------------------------------------------------------------------------------------------------
.incremental
%GetNextByte()
STY.b DecompSaveY
LDY.b DecompSize
.next_incremental
STA.l DecompBuffer2,X
INC
INX
DEY
BNE .next_incremental
LDY.b DecompSaveY
JMP .next_command
;---------------------------------------------------------------------------------------------------
.repeating_word
JSR .get_next_word
REP #$20
STY.b DecompSaveY
LDY.b DecompSize
DEY
.next_word
STA.l DecompBuffer2,X
INX
INX
DEY
DEY
BPL .next_word
INY
BEQ .not_too_far
DEX
.not_too_far
SEP #$20
LDY.b DecompSaveY
JMP .next_command
;---------------------------------------------------------------------------------------------------
.copy
JSR .get_next_word
STY.b DecompSaveY
TAY
LDA.b DecompSize
BNE ++
DEC.b DecompSize+1
++ PHB
LDA.b #$7F
PHA
PLB
.next_copy
LDA.w DecompBuffer2,Y
STA.w DecompBuffer2,X
INX
INY
DEC.b DecompSize+0
BNE .next_copy
DEC.b DecompSize+1
BPL .next_copy
PLB
LDY.b DecompSaveY
JMP .next_command
;---------------------------------------------------------------------------------------------------
; These are only used once per command, so I'm fine with letting them be a JSR I guess
;---------------------------------------------------------------------------------------------------
.get_next_word
%GetNextByte()
XBA
%GetNextByte()
XBA
RTS
;===================================================================================================
; More macros, because lazy
;===================================================================================================
macro DoPlanesA(offset)
LDA.w DecompBuffer2+<offset>+<offset>,Y
STA.w BigDecompressionBuffer+<offset>+<offset>,X
ORA.w DecompBuffer2+<offset>+<offset>-1,Y
AND.w #$FF00
STA.b Decomp3BPPScratch
LDA.w DecompBuffer2+$10+<offset>,Y
AND.w #$00FF
TSB.b Decomp3BPPScratch
XBA
ORA.b Decomp3BPPScratch
STA.w BigDecompressionBuffer+$10+<offset>+<offset>,X
endmacro
;===================================================================================================
Unrolled3BPPConvert:
LDA.b #$7F
PHA
PLB
REP #$21
LDY.w #$0000
LDX.b DecompBufferOffset
.next_3bpp_tile
%DoPlanesA(0) ; 8 times
%DoPlanesA(1)
%DoPlanesA(2)
%DoPlanesA(3)
%DoPlanesA(4)
%DoPlanesA(5)
%DoPlanesA(6)
%DoPlanesA(7)
; carry will always be clear
; don't worry
TXA
ADC.w #32
TAX
; just trust me
TYA
ADC.w #24
TAY
CMP.w #24*64
BCS .done
JMP .next_3bpp_tile
.done
STX.b DecompBufferOffset
SEP #$30
RTS
;===================================================================================================

View File

@@ -61,7 +61,7 @@ LoadDialogAddressIndirect:
RTL
;--------------------------------------------------------------------------------
FreeDungeonItemNotice:
STA.w ScratchBufferV
STA.l ScratchBufferV
PHA : PHX : PHY
PHP
@@ -70,70 +70,89 @@ FreeDungeonItemNotice:
REP #$10 ; set 16-bit index registers
PEI.b (Scrap00)
LDA.b Scrap02 : PHA
LDA.w ScratchBufferNV : PHA
LDA.w ScratchBufferNV+1 : PHA
LDA.l ScratchBufferNV : PHA
LDA.l ScratchBufferNV+1 : PHA
;--------------------------------
LDA.l FreeItemText : BNE + : JMP .skip : +
LDA.b #$00 : STA.w ScratchBufferNV ; initialize scratch
LDA.b #$00 : STA.l ScratchBufferNV ; initialize scratch
LDA.l FreeItemText : AND.b #$01 : BEQ + ; show message for general small key
LDA.w ScratchBufferV : CMP.b #$24 : BNE + ; general small key
LDA.l ScratchBufferV : CMP.b #$24 : BNE + ; general small key
%CopyDialog(Notice_SmallKeyOf)
LDA.l DialogReturnPointer : DEC #2 : STA.l DialogOffsetPointer
%CopyDialog(Notice_Self)
JMP .done
+ : LDA.l FreeItemText : AND.b #$02 : BEQ + ; show message for general compass
LDA.w ScratchBufferV : CMP.b #$25 : BNE + ; general compass
LDA.l ScratchBufferV : CMP.b #$25 : BNE + ; general compass
%CopyDialog(Notice_CompassOf)
LDA.l DialogReturnPointer : DEC #2 : STA.l DialogOffsetPointer
%CopyDialog(Notice_Self)
JMP .done
+ : LDA.l FreeItemText : AND.b #$04 : BEQ + ; show message for general map
LDA.w ScratchBufferV : CMP.b #$33 : BNE + ; general map
LDA.l ScratchBufferV : CMP.b #$33 : BNE + ; general map
%CopyDialog(Notice_MapOf)
LDA.l DialogReturnPointer : DEC #2 : STA.l DialogOffsetPointer
%CopyDialog(Notice_Self)
JMP .done
+ : LDA.l FreeItemText : AND.b #$08 : BEQ + ; show message for general big key
LDA.w ScratchBufferV : CMP.b #$32 : BNE + ; general big key
LDA.l ScratchBufferV : CMP.b #$32 : BNE + ; general big key
%CopyDialog(Notice_BigKeyOf)
LDA.l DialogReturnPointer : DEC #2 : STA.l DialogOffsetPointer
%CopyDialog(Notice_Self)
JMP .done
+
LDA.l FreeItemText : AND.b #$04 : BEQ + ; show message for dungeon map
LDA.w ScratchBufferV : AND.b #$F0 ; looking at high bits only
LDA.l ScratchBufferV : AND.b #$F0 ; looking at high bits only
CMP.b #$70 : BNE + ; map of...
%CopyDialog(Notice_MapOf)
JMP .dungeon
+ : LDA.l FreeItemText : AND.b #$02 : BEQ + ; show message for dungeon compass
LDA.w ScratchBufferV : AND.b #$F0 : CMP.b #$80 : BNE + ; compass of...
LDA.l ScratchBufferV : AND.b #$F0 : CMP.b #$80 : BNE + ; compass of...
%CopyDialog(Notice_CompassOf)
JMP .dungeon
+ : LDA.l FreeItemText : AND.b #$08 : BEQ + ; show message for dungeon big key
LDA.w ScratchBufferV : AND.b #$F0 : CMP.b #$90 : BNE + ; big key of...
LDA.l ScratchBufferV : AND.b #$F0 : CMP.b #$90 : BNE + ; big key of...
%CopyDialog(Notice_BigKeyOf)
BRA .dungeon
JMP .dungeon
+ : LDA.l FreeItemText : AND.b #$01 : BEQ + ; show message for dungeon small key
LDA.w ScratchBufferV : AND.b #$F0 : CMP.b #$A0 : BNE + ; small key of...
LDA.w ScratchBufferV : CMP.b #$AF : BNE ++ : JMP .skip : ++
LDA.l ScratchBufferV : AND.b #$F0 : CMP.b #$A0 : BNE + ; small key of...
LDA.l ScratchBufferV : CMP.b #$AF : BNE ++ : JMP .skip : ++
%CopyDialog(Notice_SmallKeyOf)
LDA.b #$01 : STA.w ScratchBufferNV ; set up a flip for small keys
LDA.b #$01 : STA.l ScratchBufferNV ; set up a flip for small keys
BRA .dungeon
+
+ : LDA.l FreeItemText : AND.b #$20 : BEQ + ; show message for crystal
LDA.l ScratchBufferV : CMP.b #$B0 : !BLT + ; crystal #
CMP.b #$B7 : !BGE +
%CopyDialog(Notice_Crystal)
JMP .crystal
+
JMP .skip ; it's not something we are going to give a notice for
.dungeon
LDA.l DialogReturnPointer : DEC #2 : STA.l DialogOffsetPointer
LDA.w ScratchBufferV
AND.b #$0F ; looking at low bits only
STA.w ScratchBufferNV+1
LDA.w ScratchBufferNV : BEQ +
LDA.w ScratchBufferNV
LDA.b #$0F : !SUB.w ScratchBufferNV+1 : STA.w ScratchBufferNV+1 ; flip the values for small keys
LDA.l ScratchBufferV
AND.b #$0F
STA.l ScratchBufferNV+1
LDA.l ScratchBufferNV : BEQ +
LDA.l ScratchBufferNV
LDA.b #$0F : !SUB.l ScratchBufferNV+1 : STA.l ScratchBufferNV+1 ; flip the values for small keys
+
LDA.w ScratchBufferNV+1
LDA.l ScratchBufferNV+1
ASL : TAX
REP #$20
LDA.l DungeonItemIDMap,X : CMP.w #$0003 : BCC .hc_sewers
CMP.w DungeonID : BNE +
BRA .self_notice
.hc_sewers
LDA.w DungeonID : CMP.w #$0003 : BCS +
.self_notice
SEP #$20
%CopyDialog(Notice_Self)
JMP.w .done
+
SEP #$20
LDA.l ScratchBufferNV+1
CMP.b #$00 : BNE + ; ...light world
%CopyDialog(Notice_LightWorld) : JMP .done
+ : CMP.b #$01 : BNE + ; ...dark world
@@ -161,12 +180,34 @@ FreeDungeonItemNotice:
+ : CMP.b #$0C : BNE + ; ...desert palace
%CopyDialog(Notice_Desert) : JMP .done
+ : CMP.b #$0D : BNE + ; ...eastern palace
%CopyDialog(Notice_Eastern) : BRA .done
%CopyDialog(Notice_Eastern) : JMP .done
+ : CMP.b #$0E : BNE + ; ...hyrule castle
%CopyDialog(Notice_Castle) : BRA .done
%CopyDialog(Notice_Castle) : JMP .done
+ : CMP.b #$0F : BNE + ; ...sewers
%CopyDialog(Notice_Sewers)
+
JMP .done
.crystal
LDA.l DialogReturnPointer : DEC #2 : STA.l DialogOffsetPointer
LDA.l ScratchBufferV
AND.b #$0F ; looking at low bits only
CMP.b #$00 : BNE +
%CopyDialog(Notice_Six) : JMP .done
+ : CMP.b #$01 : BNE +
%CopyDialog(Notice_One) : JMP .done
+ : CMP.b #$02 : BNE +
%CopyDialog(Notice_Five) : JMP .done
+ : CMP.b #$03 : BNE +
%CopyDialog(Notice_Seven) : JMP .done
+ : CMP.b #$04 : BNE +
%CopyDialog(Notice_Two) : JMP .done
+ : CMP.b #$05 : BNE +
%CopyDialog(Notice_Four) : JMP .done
+ : CMP.b #$06 : BNE +
%CopyDialog(Notice_Three) : JMP .done
+
.done
STZ.w TextID : STZ.w TextID+1 ; reset decompression buffer
@@ -175,8 +216,8 @@ FreeDungeonItemNotice:
;--------------------------------
.skip
PLA : STA.w ScratchBufferNV+1
PLA : STA.w ScratchBufferNV
PLA : STA.l ScratchBufferNV+1
PLA : STA.l ScratchBufferNV
PLA : STA.b Scrap02
REP #$20
PLA : STA.b Scrap00
@@ -193,7 +234,12 @@ RTL
;--------------------------------------------------------------------------------
DialogItemReceive:
BCS .nomessage ; if doubling the item value overflowed it must be a rando item
CPY.b #$98 : BCC ++ ;if the item is $4C or greater it must be a rando item
CPY.b #$98 : BCS .nomessage ; if the item is $4C or greater it must be a rando item
CPY.b #$34 : BEQ .mirror
BRA ++
.mirror
LDA.l MirrorEquipment : AND.w #$00FF
CMP.w #$0002 : BEQ ++
.nomessage
LDA.w #$FFFF
@@ -207,11 +253,8 @@ RTL
DialogFairyThrow:
LDA.l Restrict_Ponds : BEQ .normal
LDA.l BottleContentsOne
ORA.l BottleContentsTwo
ORA.l BottleContentsThree
ORA.l BottleContentsFour
BNE .normal
ORA.l BottleContentsTwo : ORA.l BottleContentsThree : ORA.l BottleContentsFour : BNE .normal
.noInventory
LDA.w SpriteActivity, X : !ADD #$08 : STA.w SpriteActivity, X
LDA.b #$51
@@ -227,10 +270,7 @@ DialogGanon1:
REP #$20
LDA.w #$018C
BCC +
JSL CheckMushroom
LDA.w #$016D
BCC +
LDA.w #$0197
+ STA.w TextID
SEP #$20
JSL.l Sprite_ShowMessageMinimal_Alt
@@ -245,68 +285,31 @@ RTL
; s = silver arrow bow
; p = 2nd progressive bow
DialogGanon2:
JSL.l CheckGanonVulnerability
JSL.l CheckGanonVulnerability
REP #$20
BCS +
LDA.w #$018D : JMP .done
+
JSL CheckMushroom
BCC +
LDA.w #$0198 : 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 BowTracking
REP #$20
BCS +
LDA.w #$018D : BRA ++
+
LDA.l BowTracking
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 EquipmentWRAM-1, X : PLX : AND #$00FF : BNE +
LDA.w #$0192 : JMP .done
+
LDA.w #$0195 : BRA .done
.bombs
LDA.l BombsEquipment : AND #$00FF : BNE +
LDA.l InfiniteBombs : AND #$00FF : BNE + ; check for infinite bombs
LDA.w #$0192 : BRA .done
+
LDA.w #$0195 : BRA .done
.powder
LDA.l InventoryTracking : AND #$0010 : BNE + ; check for powder
LDA.w #$0192 : BRA .done
+
LDA.w #$0195 : BRA .done
.bee
LDA.l BottleContentsOne : AND #$00FF : CMP.w #$0007 : BEQ + : CMP.w #$0008 : BEQ +
LDA.l BottleContentsTwo : AND #$00FF : CMP.w #$0007 : BEQ + : CMP.w #$0008 : BEQ +
LDA.l BottleContentsThree : AND #$00FF : CMP.w #$0007 : BEQ + : CMP.w #$0008 : BEQ +
LDA.l BottleContentsFour : AND #$00FF : CMP.w #$0007 : BEQ + : CMP.w #$0008 : BEQ +
LDA.w #$0192 : BRA .done
+
LDA.w #$0195 : BRA .done
.done
STA.w TextID
SEP #$20
JSL.l Sprite_ShowMessageMinimal_Alt
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
++
STA.w TextID
SEP #$20
JSL.l Sprite_ShowMessageMinimal_Alt
RTL
;--------------------------------------------------------------------------------
DialogEtherTablet:
@@ -316,8 +319,11 @@ DialogEtherTablet:
PLA : JML Sprite_ShowMessageUnconditional ; Wacky Hylian Text
+
BIT.b Joy1A_New : BVC - ; Show normal text if Y is not pressed
JSL CheckTabletSword : BMI .yesText
CMP.b #$02 : !BGE .noText
LDA.l AllowHammerTablets : BEQ ++
LDA.l HammerEquipment : BEQ .yesText : BRA .noText
++
LDA.l SwordEquipment : CMP.b #$FF : BEQ .yesText : CMP.b #$02 : BCS .noText
;++
.yesText
PLA
LDA.b #$0C
@@ -335,10 +341,13 @@ DialogBombosTablet:
PLA : JML Sprite_ShowMessageUnconditional ; Wacky Hylian Text
+
BIT.b Joy1A_New : BVC - ; Show normal text if Y is not pressed
JSL CheckTabletSword : BMI .yesText
CMP.b #$02 : !BGE .noText
LDA.l AllowHammerTablets : BEQ ++
LDA.l HammerEquipment : BEQ .yesText : BRA .noText
++
LDA.l SwordEquipment : CMP.b #$FF : BEQ .yesText : CMP.b #$02 : !BGE .noText
;++
.yesText
PLA
PLA
LDA.b #$0D
LDY.b #$01
JML Sprite_ShowMessageUnconditional ; Text From MSPedestalText (tables.asm)
@@ -350,7 +359,7 @@ RTL
DialogSahasrahla:
LDA.l PendantsField : AND.b #$04 : BEQ + ;Check if player has green pendant
LDA.b #$2F
LDY.b #$00
LDY.b #$00
JML Sprite_ShowMessageUnconditional
+
RTL
@@ -367,7 +376,7 @@ RTL
;---------------------------------------------------------------------------------------------------
AgahnimAsksAboutPed:
LDA.l InvincibleGanon
LDA.l GanonVulnerableMode
CMP.b #$06 : BNE .vanilla
LDA.l OverworldEventDataWRAM+$80 ; check ped flag
@@ -378,7 +387,7 @@ AgahnimAsksAboutPed:
STA.w TextID
.vanilla
JML $05FA8E ; Sprite_ShowMessageMinimal
JML $85FA8E ; Sprite_ShowMessageMinimal
;--------------------------------------------------------------------------------
Main_ShowTextMessage_Alt:
; Are we in text mode? If so then end the routine.
@@ -431,7 +440,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.b OverworldIndex : ASL A : TAY ;what we wrote over
@@ -440,13 +449,13 @@ CalculateSignIndex:
LDA.b LinkPosY+1 : AND.w #$0002 : ASL #2 : EOR.b OverworldIndex : AND.w #$0008 : BEQ +
TYA : !ADD.w #$0010 : TAY ;add 16 if we are in lower half of big screen.
+
+
LDA.b LinkPosX+1 : AND.w #$0002 : LSR : EOR.b OverworldIndex : 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
@@ -470,7 +479,7 @@ Sprite_ShowSolicitedMessageIfPlayerFacing_Alt:
; Make sure that the sprite is facing towards the player, otherwise
; talking can't happen. (What sprites actually use this???)
LDA.l $05E1A3, X : PLX : CMP.b LinkDirection : BNE .not_facing_each_other
LDA.l $85E1A3, X : PLX : CMP.b LinkDirection : BNE .not_facing_each_other
PHY
@@ -527,7 +536,7 @@ Sprite_ShowSolicitedMessageIfPlayerFacing_PreserveMessage:
; Make sure that the sprite is facing towards the player, otherwise
; talking can't happen. (What sprites actually use this???)
LDA.l $05E1A3, X : PLX : CMP.b LinkDirection : BNE .not_facing_each_other
LDA.l $85E1A3, X : PLX : CMP.b LinkDirection : BNE .not_facing_each_other
PLA : XBA : PLA

View File

@@ -8,7 +8,7 @@
StoreLastOverworldDoorID:
TXA : INC
STA.l PreviousOverworldDoor
LDA.l $1BBB73, X : STA.w EntranceIndex
LDA.l $9BBB73, X : STA.w EntranceIndex
RTL
;--------------------------------------------------------------------------------

View File

@@ -1,9 +1,329 @@
;================================================================================
; Dungeon & Boss Drop Fixes
;--------------------------------------------------------------------------------
DropSafeDungeon:
LDA.w DungeonID : CMP.b #$08 : BEQ +
LDA.l $01C6FC, X : JML Sprite_SpawnFallingItem
+
SpawnDungeonPrize:
PHX : PHB
TAX
LDA.b $06,S : STA.b ScrapBuffer72 ; Store current RoomTag index
TXA
JSL.l AttemptItemSubstitution
JSL.l ResolveLootIDLong
STA.w ItemReceiptID
TAX
LDA.b #$29 : LDY.b #$06
JSL.l AddAncillaLong
BCS .failed_spawn
LDA.w ItemReceiptID
STA.w AncillaGet,X : STA.w SpriteID,X
JSR.w AddDungeonPrizeAncilla
LDX.b ScrapBuffer72 : STZ.b RoomTag,X
.failed_spawn
PLB : PLX
RTL
;--------------------------------------------------------------------------------
AddDungeonPrizeAncilla:
LDY.w ItemReceiptID
STZ.w AncillaVelocityY,X
STZ.w AncillaVelocityX,X
STZ.w AncillaGeneral,X
STZ.w $0385,X
STZ.w $0C54,X
LDA.b #$D0 : STA.w AncillaVelocityZ,X
LDA.b #$80 : STA.w AncillaZCoord,X
LDA.b #$09 : STA.w AncillaTimer,X
LDA.b #$00 : STA.w $0394,X
LDA.w AncillaGet,X : STA.w ItemReceiptID
LDA.w DungeonID : CMP.b #$14 : BNE .not_hera
LDA.b LinkAbsoluteY+1 : AND.b #$FE
INC A
STA.b Scrap01
STZ.b Scrap00
LDA.b LinkAbsoluteX+1 : AND.b #$FE
INC A
STA.b Scrap03
STZ.b Scrap02
BRA .set_coords_exit
.not_hera
TYA : ASL : TAY
REP #$20
LDA.w #$0078
CLC : ADC.b BG2V
STA.b Scrap00
LDA.w #$0078
CLC : ADC.b BG2H
STA.b Scrap02
SEP #$20
.set_coords_exit
LDA.b Scrap00 : STA.w AncillaCoordYLow,X
LDA.b Scrap01 : STA.w AncillaCoordYHigh,X
LDA.b Scrap02 : STA.w AncillaCoordXLow,X
LDA.b Scrap03 : STA.w AncillaCoordXHigh,X
RTS
PrepPrizeTile:
PHA : PHX : PHY
LDA.w AncillaGet, X
JSL.l AttemptItemSubstitution
JSL.l ResolveLootIDLong
STA.w SpriteID,X
JSL.l TransferItemReceiptToBuffer_using_ReceiptID
PLY : PLX : PLA
RTL
SetItemPose:
PHA
LDA.w DungeonID : BMI .one_handed
LDA.w RoomItemsTaken : BIT.b #$80 : BNE +
.one_handed
PLA
JML $8799F2
+
JSR.w CrystalOrPendantBehavior : BCC .one_handed
.two_handed
PLA
JML $8799EE ; cool pose
SetPrizeCoords:
PHX : PHY
STZ.b Scrap03
LDA.w ItemReceiptMethod : CMP.b #$03 : BEQ +
.regular_coords
PLY : PLX
LDY.w AncillaGet,X
RTL
+
JSR.w CrystalOrPendantBehavior : BCC .regular_coords
PLY : PLX
LDY.b #$20 ; Treat as crystal
RTL
SetCutsceneFlag:
; Out: c - Cutscene flag $02 if set, $01 if unset.
PHX
LDY.b #$01 ; wrote over
LDA.w DungeonID : BMI .no_cutscene
LDA.w RoomItemsTaken : BIT #$80 : BNE .dungeon_prize
.no_cutscene
SEP #$30
PLX
CLC
RTL
.dungeon_prize
LDA.w ItemReceiptMethod : CMP.b #$03 : BCC .no_cutscene
JSR.w SetDungeonCompleted
LDA.w ItemReceiptID
REP #$30
AND.w #$00FF : ASL : TAX
LDA.l InventoryTable_properties,X : BIT.w #$0080 : BEQ .no_cutscene
SEP #$31
PLX
RTL
AnimatePrizeCutscene:
LDA.w ItemReceiptMethod : CMP.b #$03 : BNE +
JSR.w CrystalOrPendantBehavior : BCC +
LDA.w DungeonID : BMI +
LDA.w RoomItemsTaken : BIT #$80 : BEQ +
SEC
RTL
+
CLC
RTL
PrizeDropSparkle:
LDA.w AncillaID,X : CMP.b #$29 : BNE .no_sparkle
JSR.w CrystalOrPendantBehavior : BCC .no_sparkle
SEC
RTL
.no_sparkle
CLC
RTL
HandleDropSFX:
LDA.w RoomItemsTaken : BIT #$80 : BEQ .no_sound
JSR.w CrystalOrPendantBehavior : BCC .no_sound
SEC
RTL
.no_sound
CLC
RTL
HandleCrystalsField:
TAX
LDA.w ItemReceiptID : CMP.b #$20 : BNE .not_crystal
TXA
STA.l CrystalsField
RTL
.not_crystal
RTL
MaybeKeepLootID:
PHA
LDA.w DungeonID : BMI .no_prize
LDA.w RoomItemsTaken : BIT #$80 : BNE .prize
.no_prize
STZ.w ItemReceiptID
STZ.w ItemReceiptPose
PLA
RTL
.prize
STZ.w ItemReceiptPose
PLA
RTL
CheckSpawnPrize:
; In: A - DungeonID
; Out: c - Spawn prize if set
REP #$20
LDX.w DungeonID
LDA.l DungeonItemMasks,X : AND.l DungeonsCompleted : BEQ .spawn
SEP #$20
CLC
RTL
.spawn
SEP #$21
RTL
CheckDungeonCompletion:
LDX.w DungeonID
REP #$20
LDA.l DungeonItemMasks,X : AND.l DungeonsCompleted
SEP #$20
RTL
PendantMusicCheck:
; In: A - Item receipt ID
PHX
TAY
LDA.w ItemReceiptMethod : CMP.b #$03 : BNE .dont_wait
TYA
REP #$30
AND.w #$00FF : ASL : TAX
LDA.l InventoryTable_properties,X : BIT.w #$0080 : BNE .dont_wait
SEP #$31
PLX
RTL
.dont_wait
SEP #$30
PLX
CLC
RTL
PrepPrizeOAMCoordinates:
PHX : PHY
LDY.w AncillaLayer,X
LDA.w $F67F,Y : STA.b $65
STZ.b $64
LDA.w AncillaCoordYLow,X : STA.b Scrap00
LDA.w AncillaCoordYHigh,X : STA.b Scrap01
LDA.w AncillaCoordXLow,X : STA.b Scrap02
LDA.w AncillaCoordXHigh,X : STA.b Scrap03
REP #$20
LDA.b Scrap00
SEC : SBC.w $0122
STA.b Scrap00
LDA.b Scrap02
SEC : SBC.w $011E
STA.b Scrap02
STA.b Scrap04
REP #$20
LDA.w $029E,X
AND.w #$00FF
STA.b $72
LDA.b $00
STA.b $06
SEC
SBC.b $72
STA.b $00
SEP #$20
TXY
LDA.w AncillaGet,X : TAX
LDA.l SpriteProperties_chest_width,X : BNE .wide
TYX
LDA.w AncillaID,X : CMP.b #$3E : BEQ .rising_crystal
REP #$20
LDA.b Scrap00
CLC : ADC.w #$0008
STA.b Scrap08
LDA.b Scrap02
CLC : ADC.w #$0004
STA.b Scrap02 : STA.b Scrap0A
BRA .wide
.rising_crystal
REP #$20
LDA.b Scrap00
CLC : ADC.w #$0008 : STA.b Scrap08
LDA.b Scrap02 : STA.b Scrap0A
.wide
SEP #$20
PLY : PLX
RTL
PrepPrizeShadow:
PHX
LDA.w ItemReceiptID : TAX
LDA.l SpriteProperties_standing_width,X : BNE .wide
LDA.b Scrap02
SEC : SBC.b #$04
STA.b Scrap02
.wide
LDA.b #$20 : STA.b Scrap04 ; What we wrote over
PLX
RTL
CheckPoseItemCoordinates:
PHX
LDA.w ItemReceiptPose : BEQ .done
BIT.b #$02 : BEQ .done
LDA.w AncillaGet,X : TAX
LDA.l SpriteProperties_chest_width,X : BNE .done
LDA.b Scrap02
CLC : ADC.b #$04
STA.b Scrap02
.done
PLX
LDA.w AncillaGet,X
TAX
RTL
CrystalOrPendantBehavior:
; Out: c - Crystal Behavior if set, pendant if unset
PHA : PHX
LDA.w AncillaGet,X
REP #$31
AND.w #$00FF : ASL : TAX
LDA.l InventoryTable_properties,X : BIT.w #$0080 : BNE .crystal_behavior
SEP #$30
PLX : PLA
RTS
.crystal_behavior
SEP #$31
PLX : PLA
RTS
CheckDungeonWorld:
; Maintain vanilla door opening behavior with dungeon prizes
TXA : CMP.b #$05 : BCS .dark_world
REP #$02
RTL
.dark_world
SEP #$02
RTL
SetDungeonCompleted:
LDX.w DungeonID : BMI +
REP #$20
LDA.l DungeonItemMasks, X : ORA.l DungeonsCompleted : STA.l DungeonsCompleted
SEP #$20
+
RTS

View File

@@ -2,7 +2,7 @@ NewElderCode:
{
LDA.b OverworldIndex : CMP.b #$1B : BEQ .newCodeContinue
;Restore Jump we can keep the RTL so JML
JML $05F0CD
JML $85F0CD
.newCodeContinue
PHB : PHK : PLB
LDA.b #$07 : STA.w SpriteOAMProp, X ; Palette
@@ -42,7 +42,7 @@ RTL
{
REP #$20
LDA.l GoalItemRequirement : BEQ .despawn
LDA.l InvincibleGanon : AND.w #$00FF : CMP.w #$0005 : BEQ .despawn
LDA.l GanonVulnerableMode : AND.w #$00FF : CMP.w #$0005 : BEQ .despawn
LDA.l TurnInGoalItems : AND.w #$00FF : BNE +
.despawn
SEP #$20

View File

@@ -1,22 +0,0 @@
;================================================================================
; Dialog Pointer Override
;--------------------------------------------------------------------------------
EndingSequenceTableOverride:
PHY
PHX
TYX
LDA.l EndingSequenceText, X
PLX
STA.w $1008, X
PLY
RTL
;--------------------------------------------------------------------------------
EndingSequenceTableLookupOverride:
PHY
PHX
TYX
LDA.l EndingSequenceText, X : AND.w #$00FF
PLX
PLY
RTL
;--------------------------------------------------------------------------------

View File

@@ -20,7 +20,7 @@ RTL
RTL
;--------------------------------------------------------------------------------
NewFireBarDamage:
LDA.w $00EE : CMP.w SpriteLayer, X : BNE .NotSameLayer
LDA.b LinkLayer : CMP.w SpriteLayer, X : BNE .NotSameLayer
JSL Sprite_AttemptDamageToPlayerPlusRecoilLong
RTL
.NotSameLayer

View File

@@ -14,7 +14,7 @@ LockAgahnimDoors:
JSR.w LockAgahnimDoorsCore : BEQ .unlock
PHX : PHY
SEP #$30
JSL.l CheckEnoughCrystalsForTower
JSL.l CheckTowerOpen
REP #$30
PLY : PLX
!BGE .crystalOrUnlock
@@ -29,7 +29,7 @@ LockAgahnimDoors:
LDA.w #$0001 : RTL ;Keep the door locked
++
SEP #$30
JSL $099B6F ;Add tower break seal
JSL $899B6F ;Add tower break seal
REP #$30
LDA.w #$0001 ;Prevent door from opening that frame otherwise it glitchy
RTL
@@ -54,9 +54,9 @@ FlagAgahnimDoor:
;--------------------------------------------------------------------------------
LockAgahnimDoorsCore:
LDA.b LinkPosX : CMP.w #1992 : !BLT + ; door too far left, skip
CMP.w #2088 : !BGE + ; door too rat right, skip
CMP.w #2088 : !BGE + ; door too rat right, skip
LDA.b LinkPosY : CMP.w #1720 : !BGE + ; door too low, skip
LDA.w #$0001
LDA.w #$0001
RTS
+
LDA.w #$0000
@@ -81,7 +81,7 @@ AllowStartFromSingleEntranceCave:
PHA
TAX
LDA.l StartingAreaExitOffset, X
AND.w #$00FF
AND.w #$00FF
BNE +
JMP .done
@@ -126,7 +126,7 @@ AllowStartFromSingleEntranceCave:
LDA.l StartingEntrance : TAX
LDA.l StartingAreaOverworldDoor, X : STA.l PreviousOverworldDoor ;Load overworld door
REP #$20 ; reset 16-bit accumulator
JSL.l CacheDoorFrameData
JSL.l CacheDoorFrameData
.done
PLA
@@ -142,11 +142,11 @@ JML.l AllowStartFromExitReturn
.doStart
LDA.l $028481, X ;Module_LocationMenu_starting_points
LDA.l $828481, X ;Module_LocationMenu_starting_points
ASL : TAX
LDA.l $02D8D2, X : STA.b RoomIndex
LDA.l $02D8D3, X : STA.b RoomIndex+1
LDA.l $82D8D2, X : STA.b RoomIndex
LDA.l $82D8D3, X : STA.b RoomIndex+1
; Go to pre-overworld mode
LDA.b #$08 : STA.b GameMode
@@ -155,6 +155,7 @@ JML.l AllowStartFromExitReturn
STZ.b SubSubModule
STZ.w DeathReloadFlag
STZ.w RespawnFlag
LDA.b #$01 : STA.l UpdateHUDFlag
JSL Equipment_SearchForEquippedItemLong
JSL HUD_RebuildLong2
@@ -165,9 +166,9 @@ RTL
CheckHole:
LDX.w #$0024
.nextHoleClassic
LDA.b Scrap00 : CMP.l $1BB800, X
LDA.b Scrap00 : CMP.l $9BB800, X
BNE .wrongMap16Classic
LDA.b OverworldIndex : CMP.l $1BB826, X
LDA.b OverworldIndex : CMP.l $9BB826, X
BEQ .matchedHoleClassic
.wrongMap16Classic
DEX #2 : BPL .nextHoleClassic

View File

@@ -1,10 +1,15 @@
OnPrepFileSelect:
LDA.b GameSubMode : CMP.b #$03 : BNE +
LDA.b #$06 : STA.b NMISTRIPES ; thing we wrote over
RTL
+
JSL.l LoadAlphabetTilemap
JML.l LoadFullItemTiles
LDA.b GameSubMode : CMP.b #$03 : BNE +
LDA.b #$06 : STA.b NMISTRIPES ; thing we wrote over
RTL
+
PHA : PHX
REP #$10
JSL.l LoadAlphabetTilemap
JSL.l LoadFullItemTiles
SEP #$10
PLX : PLA
RTL
;--------------------------------------------------------------------------------
OnDrawHud:
JSL.l DrawChallengeTimer ; this has to come before NewDrawHud because the timer overwrites the compass counter
@@ -16,7 +21,12 @@ JML.l ReturnFromOnDrawHud
;--------------------------------------------------------------------------------
OnDungeonEntrance:
STA.l PegColor ; thing we wrote over
JSL MaybeFlagDungeonTotalsEntrance
JSL MaybeFlagDungeonTotalsEntrance
LDA.w #$0001 : STA.l UpdateHUDFlag
RTL
;--------------------------------------------------------------------------------
OnDungeonBossExit:
JSL.l StatTransitionCounter
RTL
;--------------------------------------------------------------------------------
OnPlayerDead:
@@ -28,18 +38,19 @@ OnPlayerDead:
RTL
;--------------------------------------------------------------------------------
OnDungeonExit:
PHA : PHP
SEP #$20 ; set 8-bit accumulator
JSL.l SQEGFix
PLP : PLA
PHA : PHP
SEP #$20 ; set 8-bit accumulator
JSL.l SQEGFix
PLP : PLA
STA.w DungeonID : STZ.w Map16ChangeIndex ; thing we wrote over
STA.w DungeonID : STZ.w Map16ChangeIndex ; thing we wrote over
PHA : PHP
JSL.l HUD_RebuildLong
JSL.l FloodGateResetInner
JSL.l SetSilverBowMode
PLP : PLA
PHA : PHP
LDA.w #$0001 : STA.l UpdateHUDFlag
JSL.l HUD_RebuildLong
JSL.l FloodGateResetInner
JSL.l SetSilverBowMode
PLP : PLA
RTL
;--------------------------------------------------------------------------------
OnQuit:
@@ -70,46 +81,69 @@ OnUncleItemGet:
LDA.l CurrentRupees : !ADD.l FreeUncleItemAmount : STA.l CurrentRupees ; rupee arrows, so also give the player some money to start
SEP #$20 ; set 8-bit accumulator
+
LDA.l ProgressIndicator : BNE +
LDA.b #$01 : STA.l ProgressIndicator ; handle rain state
+
LDA.l ProgressIndicator : BNE +
LDA.b #$01 : STA.l ProgressIndicator ; handle rain state
+
RTL
;--------------------------------------------------------------------------------
OnAga1Defeated:
STA.l ProgressIndicator ; vanilla game state stuff we overwrote
LDA.l GanonVulnerableMode
CMP.b #$06 : BNE +
.light_speed
REP #$20
LDA.w #$0019 : STA.b GameMode
SEP #$20
+
LDA.b #$08 : CMP.w DungeonID : BNE +
ORA.l DungeonsCompleted+1 : STA.l DungeonsCompleted+1
+
.exit
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
LDA.b #$01 : STA.l Aga2Duck
LDA.w DungeonID : CMP.b #$1A : BNE +
LDA.l DungeonsCompleted : ORA.b #$04 : STA.l DungeonsCompleted
+
LDA.b #$FF : STA.w DungeonID
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
PHB
LDA.w #$03D7
LDX.w #$B000
LDY.w #$0000
MVN CartridgeSRAM>>16, InitSRAMTable>>16
; Skip file name and validity value
LDA.w #$010C
LDX.w #$B3E3
LDY.w #$03E3
MVN CartridgeSRAM>>16, InitSRAMTable>>16
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
; initialize rewind table and IFrames
LDA.w #$0014
STA.l IFramesSRAM ; low byte i-frames, high byte rewind trigger
LDA.w #$FFFF
STA.l RewindRoomIdSRAM
; Set validity value and do some cleanup. Jump to checksum.
LDA.w #$55AA : STA.l FileValiditySRAM
JSL.l WriteNewFileChecksum
STZ.b Scrap00
STZ.b Scrap01
; 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
JML.l InitializeSaveFile_done
; Set validity value and do some cleanup. Jump to checksum done.
LDA.w #$55AA : STA.l FileValiditySRAM
JSL.l WriteSaveChecksumAndBackup
STZ.b Scrap00
STZ.b Scrap01
JML.l InitializeSaveFile_checksum_done
;--------------------------------------------------------------------------------
OnFileLoad:
REP #$10 ; set 16 bit index registers
@@ -135,6 +169,15 @@ OnFileLoad:
JSL.l RefreshRainAmmo
JSL.l SetEscapeAssist
REP #$20
LDA.l CurrentRupees
CMP.w #50
BCS +
LDA.w #50
STA.l CurrentRupees
+
SEP #$20
LDA.l IsEncrypted : CMP.b #01 : BNE +
JSL LoadStaticDecryptionKey
+
@@ -151,12 +194,12 @@ OnNewFile:
STZ.w TreePullKills
STZ.w TreePullHits
STZ.w PrizePackIndexes
STZ.w PrizePackIndexes+1
STZ.w PrizePackIndexes+2
STZ.w PrizePackIndexes+3
STZ.w PrizePackIndexes+4
STZ.w PrizePackIndexes+5
STZ.w PrizePackIndexes+6
STZ.w PrizePackIndexes+1
STZ.w PrizePackIndexes+2
STZ.w PrizePackIndexes+3
STZ.w PrizePackIndexes+4
STZ.w PrizePackIndexes+5
STZ.w PrizePackIndexes+6
LDA.b #$00 : STA.l MosaicLevel
JSL InitRNGPointerTable
PLP : PLX
@@ -172,7 +215,7 @@ OnLinkDamaged:
JML.l OHKOTimer
;--------------------------------------------------------------------------------
;OnEnterWater:
; JSL.l UnequipCapeQuiet ; what we wrote over
; JSL.l UnequipCapeQuiet ; what we wrote over
;RTL
;--------------------------------------------------------------------------------
OnLinkDamagedFromPit:
@@ -193,12 +236,13 @@ OnLinkDamagedFromPitOutdoors:
JML.l OHKOTimer ; make sure this is last
;--------------------------------------------------------------------------------
OnOWTransition:
JSL.l FloodGateReset
JSL.l StatTransitionCounter
PHP
SEP #$20 ; set 8-bit accumulator
LDA.b #$FF : STA.l RNGLockIn ; clear lock-in
PLP
JSL.l FloodGateReset
JSL.l StatTransitionCounter
PHP
SEP #$20 ; set 8-bit accumulator
LDA.b #$FF : STA.l RNGLockIn ; clear lock-in
LDA.b #$01 : STA.l UpdateHUDFlag
PLP
RTL
;--------------------------------------------------------------------------------
OnLoadDuckMap:
@@ -216,23 +260,62 @@ PreItemGet:
RTL
;--------------------------------------------------------------------------------
PostItemGet:
STZ.w ShopPurchaseFlag
LDA.w ItemReceiptMethod : CMP.b #$01 : BEQ +
LDX.w CurrentSpriteSlot
STZ.w SpriteMetaData,X
+
RTL
;--------------------------------------------------------------------------------
PostItemAnimation:
LDA.b #$00 : STA.l BusyItem ; mark item as finished
PHB
LDA.b #$00 : STA.l BusyItem ; mark item as finished
LDA.l TextBoxDefer : BEQ +
STZ.w TextID : STZ.w TextID+1 ; reset decompression buffer
JSL.l Main_ShowTextMessage_Alt
LDA.b #$00 : STA.l TextBoxDefer
+
LDA.w ItemReceiptMethod : CMP.b #$01 : BNE +
LDA.b LinkDirection : BEQ +
JSL.l IncrementChestTurnCounter
+
REP #$20
PEA.w $7E00
PLB : PLB
LDA.w TransparencyFlag : BNE .SP05
LDA.l PalettesCustom_off_black+$00 : STA.w PaletteBuffer+$0170 : STA.w PaletteBufferAux+$0170
LDA.l PalettesCustom_off_black+$02 : STA.w PaletteBuffer+$0172 : STA.w PaletteBufferAux+$0172
STA.w PaletteBuffer+$0174 : STA.w PaletteBufferAux+$0174
STA.w PaletteBuffer+$0176 : STA.w PaletteBufferAux+$0176
STA.w PaletteBuffer+$0178 : STA.w PaletteBufferAux+$0178
STA.w PaletteBuffer+$017A : STA.w PaletteBufferAux+$017A
STA.w PaletteBuffer+$017C : STA.w PaletteBufferAux+$017C
STA.w PaletteBuffer+$017E : STA.w PaletteBufferAux+$017E
BRA .done
.SP05
LDA.l PalettesCustom_off_black+$00 : STA.w PaletteBuffer+$01B0 : STA.w PaletteBufferAux+$01B0
LDA.l PalettesCustom_off_black+$02 : STA.w PaletteBuffer+$01B2 : STA.w PaletteBufferAux+$01B2
STA.w PaletteBuffer+$01B4 : STA.w PaletteBufferAux+$01B4
STA.w PaletteBuffer+$01B6 : STA.w PaletteBufferAux+$01B6
STA.w PaletteBuffer+$01B8 : STA.w PaletteBufferAux+$01B8
STA.w PaletteBuffer+$01BA : STA.w PaletteBufferAux+$01BA
STA.w PaletteBuffer+$01BC : STA.w PaletteBufferAux+$01BC
STA.w PaletteBuffer+$01BE : STA.w PaletteBufferAux+$01BE
.done
INC.b NMICGRAM
SEP #$20
LDA.l TextBoxDefer : BEQ +
STZ.w TextID : STZ.w TextID+1 ; reset decompression buffer
JSL.l Main_ShowTextMessage_Alt
LDA.b #$00 : STA.l TextBoxDefer
+
LDA.l RewindTrigger
BEQ +
LDA.b #$19
STA.b $11
STZ.b $B0
LDA.w ItemReceiptMethod : CMP.b #$01 : BNE +
LDA.b LinkDirection : BEQ +
JSL.l IncrementChestTurnCounter
+
LDA.b #$33
STA.w $012E
+
STZ.w ItemReceiptMethod : LDA.w AncillaGet, X ; thing we wrote over to get here
STZ.w ItemReceiptMethod : LDA.w AncillaGet, X ; thing we wrote over to get here
PLB
RTL
;--------------------------------------------------------------------------------

View File

@@ -1,4 +1,4 @@
org $298000 ; 0x148000
org $A98000 ; 0x148000
Ext_OnFileCreate: ;x
RTL : RTL : RTL : RTL : RTL
Ext_OnFileLoad: ;x immediately after load

View File

@@ -1,3 +1,18 @@
CheckZSNES:
SEP #$28
LDA.b #$FF
CLC
ADC.b #$FF
CMP.b #$64
REP #$28
BEQ .zsnes
LDA.w #$01FF : TCS ; thing we wrote over - initialize stack
JML ReturnCheckZSNES
.zsnes
JML DontUseZSNES
;===================================================================================================
pushtable
table "data/bsodencode.txt"

View File

@@ -1,21 +1,51 @@
FastCreditsActive = $50
;===================================================================================================
FlagFastCredits:
LDA.b #$40
TRB.b FastCreditsActive
AND.b Joy1B_All
TSB.b FastCreditsActive
LDA.b #$20
AND.b Joy1A_New
EOR.b FastCreditsActive
STA.b FastCreditsActive
LDA.b FastCreditsActive
AND.b #$60
BEQ .slow
LDA.b #$01
TSB.b FastCreditsActive
.slow
LDA.b $11
ASL
TAX
RTL
;===================================================================================================
FastCreditsCutsceneTimer:
BIT.b Joy1B_All-1 : BVC .slow
LDA.w #$0001 : STA.b $50
LDA.b ScrapBufferBD+$0B
CLC
ADC.w #$0004
INC
JSR IsFastCredits
BCC .slow
INC
INC
INC
AND.w #$FFFE
STA.b ScrapBufferBD+$0B
SEP #$20
RTL
.slow
INC.b ScrapBufferBD+$0B
STA.b ScrapBufferBD+$0B
SEP #$20
RTL
@@ -49,18 +79,20 @@ FastCreditsCutsceneScrollY:
FastCreditsCutsceneScroll:
LDA.w $00E2,Y
CMP.l $0EC308,X ; compare to target
CMP.l $8EC308,X ; compare to target
ROL.b Scrap00 ; put carry in here
LDA.l $0EC348,X ; get movement
LDA.l $8EC348,X ; get movement
BPL ++ ; if positive, leave saved carry alone
INC.b Scrap00 ; otherwise, flip it
++ ROR.b Scrap00 ; recover carry
BCC ++ ; scroll if carry not set
LDA.w #$0000
++ BIT.b Joy1B_All-1 : BVC .slow ; check for X held
++ JSR IsFastCredits
BCC .slow
AND.w #$FFFF ; get sign of A
BPL .positive
@@ -77,16 +109,9 @@ FastCreditsCutsceneScroll:
ASL
ASL
.slow
RTS
FastCreditsCutsceneUnderworldX:
JSR FastCreditsCutsceneScrollX
CLC
@@ -106,19 +131,27 @@ FastCreditsCutsceneUnderworldY:
FastTextScroll:
LDA.b FrameCounter
BIT.b Joy1B_All-1 : BVC .slow
LDA.b FrameCounter
SEP #$10
JSR IsFastCredits
BCC .slow
AND.w #$0000
REP #$10
RTL
.slow
AND.w #$0003
REP #$10
RTL
DumbFlagForMSU:
STA.l CurrentWorld
STZ.b $50
STZ.b FastCreditsActive
RTL
IsFastCredits:
LDY.b FastCreditsActive
CPY.b #$20
RTS

6591
fastrom.asm Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,4 @@
;FS prefix means file_select, since these defines and macros are specific to this screen
!FS_COLOR_BROWN = $0000 ;(only used for: Shovel, hammer, powder)
!FS_COLOR_RED = $0400
!FS_COLOR_YELLOW = $0800
@@ -110,6 +108,7 @@ JMP DrawItem
DrawPlayerFile:
LDA.b FrameCounter : AND.w #$0001 : BNE .normal
JSR DrawPlayerFileShared
INC.w SkipOAM ; Suppress animated tile updates for this frame
; re-enable Stripe Image format upload on this frame
@@ -146,7 +145,7 @@ DrawPlayerFile:
AND.w #$00FF
BEQ .flashing
LDA.w #$26BE
LDA.w #$26FE
BRA .draw_access_icon
.flashing
@@ -155,10 +154,8 @@ DrawPlayerFile:
.draw_access_icon
STA.w GFXStripes+$0412
LDA.w #$FFFF
STA.w GFXStripes+$0414
BRA .done
.normal
STZ.w SkipOAM ; ensure core animated tile updates are not suppressed
@@ -302,7 +299,15 @@ DrawPlayerFileShared:
%fs_drawItemBasic(EquipmentSRAM+$12,9,18,FileSelectItems_cape)
; Mirror
%fs_drawItemBasic(EquipmentSRAM+$13,9,20,FileSelectItems_mirror)
LDA.l EquipmentSRAM+$13 : AND.w #$00FF : BNE +
%fs_drawItemGray(9,20,FileSelectItems_mirror)
BRA ++
+ : DEC : BNE +
%fs_drawItem(9,20,FileSelectItems_mirror)
BRA ++
+
%fs_drawItem(9,20,FileSelectItems_mirror_2)
++
; Bottles
%fs_drawBottle(EquipmentSRAM+$1C,3,23)
@@ -311,16 +316,15 @@ DrawPlayerFileShared:
%fs_drawBottle(EquipmentSRAM+$1F,9,23)
; Sword
LDA.l SpecialWeapons : AND.w #$00FF : CMP #$0001 : BEQ .bombSword
LDA.l EquipmentSRAM+$19 : AND.w #$00FF : BNE +
%fs_drawItemGray(3,26,FileSelectItems_fighters_sword)
JMP ++
BRA ++
+ : DEC : BNE +
%fs_drawItem(3,26,FileSelectItems_fighters_sword)
JMP ++
BRA ++
+ : DEC : BNE +
%fs_drawItem(3,26,FileSelectItems_master_sword)
JMP ++
BRA ++
+ : DEC : BNE +
%fs_drawItem(3,26,FileSelectItems_tempered_sword)
BRA ++
@@ -330,29 +334,6 @@ DrawPlayerFileShared:
+
; a sword value above 4 is either corrupted or 0xFF (a.k.a. swordless)
%fs_drawItemGray(3,26,FileSelectItems_fighters_sword)
BRA ++
.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
@@ -381,31 +362,57 @@ DrawPlayerFileShared:
++
; Heart Pieces
LDA.l HUDHeartColors_index : ASL : TAX
LDA.l EquipmentSRAM+$2B : AND.w #$00FF : BNE +
%fs_drawItem(9,26,FileSelectItems_heart_piece_0_of_4)
BRA ++
LDY.w #9*$20+26*2+$1004
LDA.w #$02C0 : ORA.l HUDHeartColors_masks_file_select,X : STA.w $0000, Y
LDA.w #$42C0 : ORA.l HUDHeartColors_masks_file_select,X : STA.w $0002, Y
LDA.w #$02D0 : ORA.l HUDHeartColors_masks_file_select,X : STA.w $0040, Y
LDA.w #$42D0 : ORA.l HUDHeartColors_masks_file_select,X : STA.w $0042, Y
JMP ++
+ : DEC : BNE +
%fs_drawItem(9,26,FileSelectItems_heart_piece_1_of_4)
BRA ++
LDY.w #9*$20+26*2+$1004
LDA.w #$02C1 : ORA.l HUDHeartColors_masks_file_select,X : STA.w $0000, Y
LDA.w #$42C0 : ORA.l HUDHeartColors_masks_file_select,X : STA.w $0002, Y
LDA.w #$02D0 : ORA.l HUDHeartColors_masks_file_select,X : STA.w $0040, Y
LDA.w #$42D0 : ORA.l HUDHeartColors_masks_file_select,X : STA.w $0042, Y
JMP ++
+ : DEC : BNE +
%fs_drawItem(9,26,FileSelectItems_heart_piece_2_of_4)
BRA ++
LDY.w #9*$20+26*2+$1004
LDA.w #$02C1 : ORA.l HUDHeartColors_masks_file_select,X : STA.w $0000, Y
LDA.w #$42C0 : ORA.l HUDHeartColors_masks_file_select,X : STA.w $0002, Y
LDA.w #$02D1 : ORA.l HUDHeartColors_masks_file_select,X : STA.w $0040, Y
LDA.w #$42D0 : ORA.l HUDHeartColors_masks_file_select,X : STA.w $0042, Y
JMP ++
+
%fs_drawItem(9,26,FileSelectItems_heart_piece_3_of_4)
LDY.w #9*$20+26*2+$1004
LDA.w #$02C1 : ORA.l HUDHeartColors_masks_file_select,X : STA.w $0000, Y
LDA.w #$42C1 : ORA.l HUDHeartColors_masks_file_select,X : STA.w $0002, Y
LDA.w #$02D1 : ORA.l HUDHeartColors_masks_file_select,X : STA.w $0040, Y
LDA.w #$42D0 : ORA.l HUDHeartColors_masks_file_select,X : STA.w $0042, Y
++
LDA.l EquipmentSRAM+$0108 : AND.w #$00FF
LDA.l EquipmentSRAM+$0130 : AND.w #$00FF
JSL.l HexToDec
LDA.l HexToDecDigit4 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(11,26)
LDA.l HexToDecDigit5 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(11,27)
LDA.l HexToDecDigit4 : AND.w #$00FF : ORA.w #!FS_COLOR_BW|$02E0 : %fs_draw8x8(11,26)
LDA.l HexToDecDigit5 : AND.w #$00FF : ORA.w #!FS_COLOR_BW|$02E0 : %fs_draw8x8(11,27)
; Boots
%fs_drawItemBasic(EquipmentSRAM+$15,3,28,FileSelectItems_boots)
LDA.l EquipmentSRAM+$15 : AND.w #$00FF : BNE +
LDA.l FakeBoots : AND.w #$00FF : BEQ +
%fs_drawItem(3,28,FileSelectItems_fakeBoots)
BRA ++
+
%fs_drawItemBasic(EquipmentSRAM+$15,3,28,FileSelectItems_boots)
++
; Gloves
LDA.l EquipmentSRAM+$14 : AND.w #$00FF : BNE +
%fs_drawItemGray(5,28,FileSelectItems_gloves)
BRA ++
+ : DEC : BNE +
%fs_drawItem(5,28,FileSelectItems_weak_gloves)
BRA ++
+ : DEC : BNE +
%fs_drawItem(5,28,FileSelectItems_gloves)
BRA ++
@@ -443,52 +450,52 @@ DrawPlayerFileShared:
; Crystals
LDA.l EquipmentSRAM+$3A : AND.w #$0002 : BEQ +
LDA.w #$0297|!FS_COLOR_BLUE
LDA.w #$02D7|!FS_COLOR_BLUE
BRA ++
+
LDA.w #$0287|!FS_COLOR_GRAY
LDA.w #$02C7|!FS_COLOR_GRAY
++ : %fs_draw16x8(13,18)
LDA.l EquipmentSRAM+$3A : AND.w #$0010 : BEQ +
LDA.w #$0297|!FS_COLOR_BLUE
LDA.w #$02D7|!FS_COLOR_BLUE
BRA ++
+
LDA.w #$0287|!FS_COLOR_GRAY
LDA.w #$02C7|!FS_COLOR_GRAY
++ : %fs_draw16x8(12,19)
LDA.l EquipmentSRAM+$3A : AND.w #$0040 : BEQ +
LDA.w #$0297|!FS_COLOR_BLUE
LDA.w #$02D7|!FS_COLOR_BLUE
BRA ++
+
LDA.w #$0287|!FS_COLOR_GRAY
LDA.w #$02C7|!FS_COLOR_GRAY
++ : %fs_draw16x8(13,20)
LDA.l EquipmentSRAM+$3A : AND.w #$0020 : BEQ +
LDA.w #$0297|!FS_COLOR_BLUE
LDA.w #$02D7|!FS_COLOR_BLUE
BRA ++
+
LDA.w #$0287|!FS_COLOR_GRAY
LDA.w #$02C7|!FS_COLOR_GRAY
++ : %fs_draw16x8(12,21)
LDA.l EquipmentSRAM+$3A : AND.w #$0004 : BEQ +
LDA.w #$0297|!FS_COLOR_RED
LDA.w #$02D7|!FS_COLOR_RED
BRA ++
+
LDA.w #$0287|!FS_COLOR_GRAY
LDA.w #$02C7|!FS_COLOR_GRAY
++ : %fs_draw16x8(13,22)
LDA.l EquipmentSRAM+$3A : AND.w #$0001 : BEQ +
LDA.w #$0297|!FS_COLOR_RED
LDA.w #$02D7|!FS_COLOR_RED
BRA ++
+
LDA.w #$0287|!FS_COLOR_GRAY
LDA.w #$02C7|!FS_COLOR_GRAY
++ : %fs_draw16x8(12,23)
LDA.l EquipmentSRAM+$3A : AND.w #$0008 : BEQ +
LDA.w #$0297|!FS_COLOR_BLUE
LDA.w #$02D7|!FS_COLOR_BLUE
BRA ++
+
LDA.w #$0287|!FS_COLOR_GRAY
LDA.w #$02C7|!FS_COLOR_GRAY
++ : %fs_draw16x8(13,24)
@@ -498,187 +505,154 @@ RTS
FileSelectItems:
.empty_bow ;for an eventual update for retro mode
dw #$0201|!FS_COLOR_YELLOW, #$02B8|!FS_COLOR_YELLOW, #$02B7|!FS_COLOR_YELLOW, #$0212|!FS_COLOR_YELLOW
dw #$0241|!FS_COLOR_YELLOW, #$02F8|!FS_COLOR_YELLOW, #$02F7|!FS_COLOR_YELLOW, #$0252|!FS_COLOR_YELLOW
.bow
dw #$0201|!FS_COLOR_YELLOW, #$0202|!FS_COLOR_YELLOW, #$0211|!FS_COLOR_YELLOW, #$0212|!FS_COLOR_YELLOW
dw #$0241|!FS_COLOR_YELLOW, #$0242|!FS_COLOR_YELLOW, #$0251|!FS_COLOR_YELLOW, #$0252|!FS_COLOR_YELLOW
.silver_bow
dw #$0201|!FS_COLOR_YELLOW, #$0204|!FS_COLOR_YELLOW, #$0203|!FS_COLOR_RED, #$0212|!FS_COLOR_YELLOW
dw #$0241|!FS_COLOR_YELLOW, #$0244|!FS_COLOR_YELLOW, #$0243|!FS_COLOR_RED, #$0252|!FS_COLOR_YELLOW
.regular_arrow ;for an eventual update for retro mode
dw #$0200|!FS_COLOR_YELLOW, #$02BA|!FS_COLOR_YELLOW, #$02B9|!FS_COLOR_RED, #$0200|!FS_COLOR_YELLOW
dw #$0240|!FS_COLOR_YELLOW, #$02FA|!FS_COLOR_YELLOW, #$02F9|!FS_COLOR_RED, #$0240|!FS_COLOR_YELLOW
.silver_arrow
dw #$0200|!FS_COLOR_YELLOW, #$0214|!FS_COLOR_YELLOW, #$0213|!FS_COLOR_RED, #$0200|!FS_COLOR_YELLOW
dw #$0240|!FS_COLOR_YELLOW, #$0254|!FS_COLOR_YELLOW, #$0253|!FS_COLOR_RED, #$0240|!FS_COLOR_YELLOW
.blue_boomerang
dw #$0205|!FS_COLOR_BLUE, #$0206|!FS_COLOR_BLUE, #$0200|!FS_COLOR_BW, #$0216|!FS_COLOR_BLUE
dw #$0245|!FS_COLOR_BLUE, #$0246|!FS_COLOR_BLUE, #$0240|!FS_COLOR_BW, #$0256|!FS_COLOR_BLUE
.red_boomerang
dw #$0205|!FS_COLOR_RED, #$0206|!FS_COLOR_RED, #$0200|!FS_COLOR_BW, #$0216|!FS_COLOR_RED
dw #$0245|!FS_COLOR_RED, #$0246|!FS_COLOR_RED, #$0240|!FS_COLOR_BW, #$0256|!FS_COLOR_RED
.both_boomerang
dw #$02B6|!FS_COLOR_BLUE, #$02B6|!FS_COLOR_RED, #$02B6|!FS_COLOR_BLUE|!FS_VFLIP, #$02B6|!FS_COLOR_RED|!FS_VFLIP
dw #$02F6|!FS_COLOR_BLUE, #$02F6|!FS_COLOR_RED, #$02F6|!FS_COLOR_BLUE|!FS_VFLIP, #$02F6|!FS_COLOR_RED|!FS_VFLIP
.hookshot
dw #$0200|!FS_COLOR_RED, #$0215|!FS_COLOR_RED, #$0230|!FS_COLOR_RED, #$0200|!FS_COLOR_BW
dw #$0240|!FS_COLOR_RED, #$0255|!FS_COLOR_RED, #$0270|!FS_COLOR_RED, #$0240|!FS_COLOR_BW
.bombs
dw #$020C|!FS_COLOR_BLUE, #$020D|!FS_COLOR_BLUE, #$021C|!FS_COLOR_BLUE, #$021C|!FS_COLOR_BLUE|!FS_HFLIP
dw #$024C|!FS_COLOR_BLUE, #$024D|!FS_COLOR_BLUE, #$025C|!FS_COLOR_BLUE, #$025C|!FS_COLOR_BLUE|!FS_HFLIP
.fire_rod
dw #$0220|!FS_COLOR_RED, #$0210|!FS_COLOR_RED, #$0230|!FS_COLOR_RED, #$0231|!FS_COLOR_RED
dw #$0260|!FS_COLOR_RED, #$0250|!FS_COLOR_RED, #$0270|!FS_COLOR_RED, #$0271|!FS_COLOR_RED
.ice_rod
dw #$0220|!FS_COLOR_BLUE, #$0221|!FS_COLOR_BLUE, #$0230|!FS_COLOR_BLUE, #$0231|!FS_COLOR_BLUE
dw #$0260|!FS_COLOR_BLUE, #$0261|!FS_COLOR_BLUE, #$0270|!FS_COLOR_BLUE, #$0271|!FS_COLOR_BLUE
.bombos
dw #$0207|!FS_COLOR_YELLOW, #$0217|!FS_COLOR_YELLOW|!FS_HFLIP|!FS_VFLIP, #$0217|!FS_COLOR_YELLOW, #$0207|!FS_COLOR_YELLOW|!FS_HFLIP|!FS_VFLIP
dw #$0247|!FS_COLOR_YELLOW, #$0257|!FS_COLOR_YELLOW|!FS_HFLIP|!FS_VFLIP, #$0257|!FS_COLOR_YELLOW, #$0247|!FS_COLOR_YELLOW|!FS_HFLIP|!FS_VFLIP
.ether
dw #$0208|!FS_COLOR_YELLOW, #$0218|!FS_COLOR_YELLOW|!FS_HFLIP|!FS_VFLIP, #$0218|!FS_COLOR_YELLOW, #$0208|!FS_COLOR_YELLOW|!FS_HFLIP|!FS_VFLIP
dw #$0248|!FS_COLOR_YELLOW, #$0258|!FS_COLOR_YELLOW|!FS_HFLIP|!FS_VFLIP, #$0258|!FS_COLOR_YELLOW, #$0248|!FS_COLOR_YELLOW|!FS_HFLIP|!FS_VFLIP
.quake
dw #$0209|!FS_COLOR_YELLOW, #$0219|!FS_COLOR_YELLOW|!FS_HFLIP|!FS_VFLIP, #$0219|!FS_COLOR_YELLOW, #$0209|!FS_COLOR_YELLOW|!FS_HFLIP|!FS_VFLIP
dw #$0249|!FS_COLOR_YELLOW, #$0259|!FS_COLOR_YELLOW|!FS_HFLIP|!FS_VFLIP, #$0259|!FS_COLOR_YELLOW, #$0249|!FS_COLOR_YELLOW|!FS_HFLIP|!FS_VFLIP
.lamp
dw #$022C|!FS_COLOR_RED, #$022C|!FS_COLOR_RED|!FS_HFLIP, #$023C|!FS_COLOR_RED, #$023D|!FS_COLOR_RED
dw #$026C|!FS_COLOR_RED, #$026C|!FS_COLOR_RED|!FS_HFLIP, #$027C|!FS_COLOR_RED, #$027D|!FS_COLOR_RED
.hammer
dw #$0222|!FS_COLOR_BROWN, #$0223|!FS_COLOR_BROWN, #$0232|!FS_COLOR_BROWN, #$0233|!FS_COLOR_BROWN
dw #$0262|!FS_COLOR_BROWN, #$0263|!FS_COLOR_BROWN, #$0272|!FS_COLOR_BROWN, #$0273|!FS_COLOR_BROWN
.bugnet
dw #$0228|!FS_COLOR_YELLOW, #$0229|!FS_COLOR_YELLOW, #$0238|!FS_COLOR_YELLOW, #$0239|!FS_COLOR_YELLOW
dw #$0268|!FS_COLOR_YELLOW, #$0269|!FS_COLOR_YELLOW, #$0278|!FS_COLOR_YELLOW, #$0279|!FS_COLOR_YELLOW
.shovel
dw #$0224|!FS_COLOR_BROWN, #$0225|!FS_COLOR_BROWN, #$0234|!FS_COLOR_BROWN, #$0235|!FS_COLOR_BROWN
dw #$0264|!FS_COLOR_BROWN, #$0265|!FS_COLOR_BROWN, #$0274|!FS_COLOR_BROWN, #$0275|!FS_COLOR_BROWN
.flute
dw #$0226|!FS_COLOR_BLUE, #$0227|!FS_COLOR_BLUE, #$0236|!FS_COLOR_BLUE, #$0237|!FS_COLOR_BLUE
dw #$0266|!FS_COLOR_BLUE, #$0267|!FS_COLOR_BLUE, #$0276|!FS_COLOR_BLUE, #$0277|!FS_COLOR_BLUE
.book
dw #$022A|!FS_COLOR_GREEN, #$022B|!FS_COLOR_GREEN, #$023A|!FS_COLOR_GREEN, #$023B|!FS_COLOR_GREEN
dw #$026A|!FS_COLOR_GREEN, #$026B|!FS_COLOR_GREEN, #$027A|!FS_COLOR_GREEN, #$027B|!FS_COLOR_GREEN
.redcane
dw #$021D|!FS_COLOR_RED, #$021E|!FS_COLOR_RED, #$022D|!FS_COLOR_RED, #$022E|!FS_COLOR_RED
dw #$025D|!FS_COLOR_RED, #$025E|!FS_COLOR_RED, #$026D|!FS_COLOR_RED, #$026E|!FS_COLOR_RED
.bluecane
dw #$021D|!FS_COLOR_BLUE, #$021E|!FS_COLOR_BLUE, #$022D|!FS_COLOR_BLUE, #$022E|!FS_COLOR_BLUE
dw #$025D|!FS_COLOR_BLUE, #$025E|!FS_COLOR_BLUE, #$026D|!FS_COLOR_BLUE, #$026E|!FS_COLOR_BLUE
.cape
dw #$0248|!FS_COLOR_RED, #$0249|!FS_COLOR_RED, #$0258|!FS_COLOR_RED, #$0259|!FS_COLOR_RED
dw #$0288|!FS_COLOR_RED, #$0289|!FS_COLOR_RED, #$0298|!FS_COLOR_RED, #$0299|!FS_COLOR_RED
.mirror
dw #$024A|!FS_COLOR_BLUE, #$024B|!FS_COLOR_BLUE, #$025A|!FS_COLOR_BLUE, #$025B|!FS_COLOR_BLUE
dw #$028A|!FS_COLOR_BLUE, #$028B|!FS_COLOR_BLUE, #$029A|!FS_COLOR_BLUE, #$029B|!FS_COLOR_BLUE
.mirror_2
dw #$028A|!FS_COLOR_BLUE, #$028B|!FS_COLOR_BLUE, #$029A|!FS_COLOR_BLUE, #$02E2|!FS_COLOR_BLUE
.flippers
dw #$020E|!FS_COLOR_BLUE, #$020F|!FS_COLOR_BLUE, #$021F|!FS_COLOR_BLUE|!FS_HFLIP, #$021F|!FS_COLOR_BLUE
dw #$024E|!FS_COLOR_BLUE, #$024F|!FS_COLOR_BLUE, #$025F|!FS_COLOR_BLUE|!FS_HFLIP, #$025F|!FS_COLOR_BLUE
.boots
dw #$024C|!FS_COLOR_BOOTS, #$024D|!FS_COLOR_BOOTS, #$025C|!FS_COLOR_BOOTS, #$025D|!FS_COLOR_BOOTS
dw #$028C|!FS_COLOR_BOOTS, #$028D|!FS_COLOR_BOOTS, #$029C|!FS_COLOR_BOOTS, #$029D|!FS_COLOR_BOOTS
.fakeBoots
dw #$028C|!FS_COLOR_BLUE, #$028D|!FS_COLOR_BLUE, #$029C|!FS_COLOR_BLUE, #$029D|!FS_COLOR_BLUE
.pearl
dw #$0264|!FS_COLOR_RED, #$0265|!FS_COLOR_RED, #$0274|!FS_COLOR_RED, #$0275|!FS_COLOR_RED
dw #$02A4|!FS_COLOR_RED, #$02A5|!FS_COLOR_RED, #$02B4|!FS_COLOR_RED, #$02B5|!FS_COLOR_RED
.no_pendant
dw #$0285|!FS_COLOR_GRAY, #$0286|!FS_COLOR_GRAY, #$02B2|!FS_COLOR_GRAY, #$0296|!FS_COLOR_GRAY
dw #$02C5|!FS_COLOR_GRAY, #$02C6|!FS_COLOR_GRAY, #$02F2|!FS_COLOR_GRAY, #$02D6|!FS_COLOR_GRAY
.green_pendant
dw #$0285|!FS_COLOR_GREEN, #$0286|!FS_COLOR_GREEN, #$0295|!FS_COLOR_GREEN, #$0296|!FS_COLOR_GREEN
dw #$02C5|!FS_COLOR_GREEN, #$02C6|!FS_COLOR_GREEN, #$02D5|!FS_COLOR_GREEN, #$02D6|!FS_COLOR_GREEN
.blue_pendant
dw #$0285|!FS_COLOR_BLUE, #$0286|!FS_COLOR_BLUE, #$0295|!FS_COLOR_BLUE, #$0296|!FS_COLOR_BLUE
dw #$02C5|!FS_COLOR_BLUE, #$02C6|!FS_COLOR_BLUE, #$02D5|!FS_COLOR_BLUE, #$02D6|!FS_COLOR_BLUE
.red_pendant
dw #$0285|!FS_COLOR_RED, #$0286|!FS_COLOR_RED, #$0295|!FS_COLOR_RED, #$0296|!FS_COLOR_RED
dw #$02C5|!FS_COLOR_RED, #$02C6|!FS_COLOR_RED, #$02D5|!FS_COLOR_RED, #$02D6|!FS_COLOR_RED
.weak_gloves
dw #$02A0|!FS_COLOR_GREEN, #$02A1|!FS_COLOR_GREEN, #$02B0|!FS_COLOR_GREEN, #$02B1|!FS_COLOR_GREEN
.gloves
dw #$024E|!FS_COLOR_BROWN, #$024F|!FS_COLOR_BROWN, #$025E|!FS_COLOR_BROWN, #$025F|!FS_COLOR_BROWN
dw #$028E|!FS_COLOR_BROWN, #$028F|!FS_COLOR_BROWN, #$029E|!FS_COLOR_BROWN, #$029F|!FS_COLOR_BROWN
.mitts
dw #$0260|!FS_COLOR_YELLOW, #$0261|!FS_COLOR_YELLOW, #$0270|!FS_COLOR_YELLOW, #$0271|!FS_COLOR_YELLOW
dw #$02A0|!FS_COLOR_YELLOW, #$02A1|!FS_COLOR_YELLOW, #$02B0|!FS_COLOR_YELLOW, #$02B1|!FS_COLOR_YELLOW
.mushroom
dw #$0262|!FS_COLOR_RED, #$0263|!FS_COLOR_RED, #$0272|!FS_COLOR_RED, #$0273|!FS_COLOR_RED
dw #$02A2|!FS_COLOR_RED, #$02A3|!FS_COLOR_RED, #$02B2|!FS_COLOR_RED, #$02B3|!FS_COLOR_RED
.powder
dw #$020A|!FS_COLOR_BROWN, #$020B|!FS_COLOR_BROWN, #$021A|!FS_COLOR_BROWN, #$021B|!FS_COLOR_BROWN
dw #$024A|!FS_COLOR_BROWN, #$024B|!FS_COLOR_BROWN, #$025A|!FS_COLOR_BROWN, #$025B|!FS_COLOR_BROWN
.fighters_sword
dw #$0266|!FS_COLOR_BLUE, #$0267|!FS_COLOR_BLUE, #$0276|!FS_COLOR_BLUE, #$0277|!FS_COLOR_BLUE
dw #$02A6|!FS_COLOR_BLUE, #$02A7|!FS_COLOR_BLUE, #$02B6|!FS_COLOR_BLUE, #$02B7|!FS_COLOR_BLUE
.master_sword
dw #$0268|!FS_COLOR_BLUE, #$0269|!FS_COLOR_BLUE, #$0278|!FS_COLOR_RED, #$0279|!FS_COLOR_BLUE
dw #$02A8|!FS_COLOR_BLUE, #$02A9|!FS_COLOR_BLUE, #$02B8|!FS_COLOR_RED, #$02B9|!FS_COLOR_BLUE
.tempered_sword
dw #$0268|!FS_COLOR_RED, #$0269|!FS_COLOR_RED, #$0278|!FS_COLOR_GREEN, #$026A|!FS_COLOR_RED
dw #$02A8|!FS_COLOR_RED, #$02A9|!FS_COLOR_RED, #$02B8|!FS_COLOR_GREEN, #$02AA|!FS_COLOR_RED
.gold_sword
dw #$0268|!FS_COLOR_YELLOW, #$0269|!FS_COLOR_YELLOW, #$0278|!FS_COLOR_BLUE, #$027A|!FS_COLOR_YELLOW
dw #$02A8|!FS_COLOR_YELLOW, #$02A9|!FS_COLOR_YELLOW, #$02B8|!FS_COLOR_BLUE, #$02BA|!FS_COLOR_YELLOW
.fighters_shield
dw #$026B|!FS_COLOR_BLUE, #$026B|!FS_COLOR_BLUE|!FS_HFLIP, #$027B|!FS_COLOR_BLUE, #$027B|!FS_COLOR_BLUE|!FS_HFLIP
dw #$02AB|!FS_COLOR_BLUE, #$02AB|!FS_COLOR_BLUE|!FS_HFLIP, #$02BB|!FS_COLOR_BLUE, #$02BB|!FS_COLOR_BLUE|!FS_HFLIP
.fire_shield
dw #$026C|!FS_COLOR_BOOTS, #$026C|!FS_COLOR_BOOTS|!FS_HFLIP, #$027C|!FS_COLOR_BOOTS, #$027C|!FS_COLOR_BOOTS|!FS_HFLIP
dw #$02AC|!FS_COLOR_BOOTS, #$02AC|!FS_COLOR_BOOTS|!FS_HFLIP, #$02BC|!FS_COLOR_BOOTS, #$02BC|!FS_COLOR_BOOTS|!FS_HFLIP
.mirror_shield
dw #$026D|!FS_COLOR_YELLOW, #$026E|!FS_COLOR_YELLOW, #$027D|!FS_COLOR_YELLOW, #$027E|!FS_COLOR_YELLOW
dw #$02AD|!FS_COLOR_YELLOW, #$02AE|!FS_COLOR_YELLOW, #$02BD|!FS_COLOR_YELLOW, #$02BE|!FS_COLOR_YELLOW
.green_mail
dw #$026F|!FS_COLOR_GREEN, #$026F|!FS_COLOR_GREEN|!FS_HFLIP, #$027F|!FS_COLOR_GREEN, #$02B3|!FS_COLOR_GREEN
dw #$02AF|!FS_COLOR_GREEN, #$02AF|!FS_COLOR_GREEN|!FS_HFLIP, #$02BF|!FS_COLOR_GREEN, #$02F3|!FS_COLOR_GREEN
.blue_mail
dw #$026F|!FS_COLOR_BLUE, #$026F|!FS_COLOR_BLUE|!FS_HFLIP, #$027F|!FS_COLOR_BLUE, #$02B4|!FS_COLOR_BLUE
dw #$02AF|!FS_COLOR_BLUE, #$02AF|!FS_COLOR_BLUE|!FS_HFLIP, #$02BF|!FS_COLOR_BLUE, #$02F4|!FS_COLOR_BLUE
.red_mail
dw #$026F|!FS_COLOR_RED, #$026F|!FS_COLOR_RED|!FS_HFLIP, #$027F|!FS_COLOR_RED, #$02B5|!FS_COLOR_RED
.heart_piece_0_of_4
dw #$0280|!FS_COLOR_RED, #$0280|!FS_COLOR_RED|!FS_HFLIP, #$0290|!FS_COLOR_RED, #$0290|!FS_COLOR_RED|!FS_HFLIP
.heart_piece_1_of_4
dw #$0281|!FS_COLOR_RED, #$0280|!FS_COLOR_RED|!FS_HFLIP, #$0290|!FS_COLOR_RED, #$0290|!FS_COLOR_RED|!FS_HFLIP
.heart_piece_2_of_4
dw #$0281|!FS_COLOR_RED, #$0280|!FS_COLOR_RED|!FS_HFLIP, #$0291|!FS_COLOR_RED, #$0290|!FS_COLOR_RED|!FS_HFLIP
.heart_piece_3_of_4
dw #$0281|!FS_COLOR_RED, #$0281|!FS_COLOR_RED|!FS_HFLIP, #$0291|!FS_COLOR_RED, #$0290|!FS_COLOR_RED|!FS_HFLIP
dw #$02AF|!FS_COLOR_RED, #$02AF|!FS_COLOR_RED|!FS_HFLIP, #$02BF|!FS_COLOR_RED, #$02F5|!FS_COLOR_RED
.empty_bottle
dw #$0240|!FS_COLOR_BW, #$0241|!FS_COLOR_BW, #$0250|!FS_COLOR_BW, #$0251|!FS_COLOR_BW
dw #$0280|!FS_COLOR_BW, #$0281|!FS_COLOR_BW, #$0290|!FS_COLOR_BW, #$0291|!FS_COLOR_BW
.red_potion
dw #$0242|!FS_COLOR_RED, #$0242|!FS_COLOR_RED|!FS_HFLIP, #$0252|!FS_COLOR_RED, #$0243|!FS_COLOR_RED
dw #$0282|!FS_COLOR_RED, #$0282|!FS_COLOR_RED|!FS_HFLIP, #$0292|!FS_COLOR_RED, #$0283|!FS_COLOR_RED
.green_potion
dw #$0242|!FS_COLOR_GREEN, #$0242|!FS_COLOR_GREEN|!FS_HFLIP, #$0252|!FS_COLOR_GREEN, #$0244|!FS_COLOR_GREEN
dw #$0282|!FS_COLOR_GREEN, #$0282|!FS_COLOR_GREEN|!FS_HFLIP, #$0292|!FS_COLOR_GREEN, #$0284|!FS_COLOR_GREEN
.blue_potion
dw #$0242|!FS_COLOR_BLUE, #$0242|!FS_COLOR_BLUE|!FS_HFLIP, #$0252|!FS_COLOR_BLUE, #$0245|!FS_COLOR_BLUE
dw #$0282|!FS_COLOR_BLUE, #$0282|!FS_COLOR_BLUE|!FS_HFLIP, #$0292|!FS_COLOR_BLUE, #$0285|!FS_COLOR_BLUE
.fairy_bottle
dw #$0247|!FS_COLOR_YELLOW|!FS_HFLIP, #$0247|!FS_COLOR_YELLOW, #$0256|!FS_COLOR_BLUE, #$0257|!FS_COLOR_BLUE
dw #$0287|!FS_COLOR_YELLOW|!FS_HFLIP, #$0287|!FS_COLOR_YELLOW, #$0296|!FS_COLOR_BLUE, #$0297|!FS_COLOR_BLUE
.bee_bottle
dw #$0240|!FS_COLOR_BW, #$0241|!FS_COLOR_BW, #$0254|!FS_COLOR_YELLOW, #$0255|!FS_COLOR_YELLOW
dw #$0280|!FS_COLOR_BW, #$0281|!FS_COLOR_BW, #$0294|!FS_COLOR_YELLOW, #$0295|!FS_COLOR_YELLOW
.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
dw #$0280|!FS_COLOR_BW, #$0281|!FS_COLOR_BW, #$0294|!FS_COLOR_YELLOW, #$0286|!FS_COLOR_YELLOW
;--------------------------------------------------------------------------------
FileSelectDrawHudBar:
LDA.w #$029B|!FS_COLOR_GREEN : %fs_draw16x8(0,10)
LDA.l DisplayRupeesSRAM
JSL.l HexToDec
LDA.l HexToDecDigit2 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(1,9)
LDA.l HexToDecDigit3 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(1,10)
LDA.l HexToDecDigit4 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(1,11)
LDA.l HexToDecDigit5 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(1,12)
LDA.w #$02DB|!FS_COLOR_GREEN : %fs_draw16x8(0,10)
LDA.l DisplayRupeesSRAM
JSL.l HUDHex4Digit_Long
LDA.b Scrap04 : AND.w #$00FF : !ADD.w #$0250+!FS_COLOR_BW : %fs_draw8x8(1,9)
LDA.b Scrap05 : AND.w #$00FF : !ADD.w #$0250+!FS_COLOR_BW : %fs_draw8x8(1,10)
LDA.b Scrap06 : AND.w #$00FF : !ADD.w #$0250+!FS_COLOR_BW : %fs_draw8x8(1,11)
LDA.b Scrap07 : AND.w #$00FF : !ADD.w #$0250+!FS_COLOR_BW : %fs_draw8x8(1,12)
LDA.l SpecialWeapons : AND.w #$00FF : CMP #$0001 : BEQ .colorBombs
LDA.w #$028B|!FS_COLOR_BLUE : %fs_draw16x8(0,14)
LDA.l BombsEquipmentSRAM : AND.w #$00FF
JSL.l HexToDec
LDA.l HexToDecDigit4 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(1,14)
LDA.l HexToDecDigit5 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(1,15)
BRA ++
.colorBombs
LDA.l $70038F : AND.w #$00FF : BNE +
; no bombs, draw no icon
BRA ++
+ : DEC : BNE +
LDA.w #$028B|!FS_COLOR_GREEN : %fs_draw16x8(0,14)
BRA ++
+ : DEC : BNE +
LDA.w #$028B|!FS_COLOR_BLUE : %fs_draw16x8(0,14)
BRA ++
+ : DEC : BNE +
LDA.w #$028B|!FS_COLOR_RED : %fs_draw16x8(0,14)
BRA ++
+
LDA.w #$028B|!FS_COLOR_YELLOW : %fs_draw16x8(0,14)
++
LDA.w #$02CB|!FS_COLOR_BLUE : %fs_draw16x8(0,14)
LDA.l BombsEquipmentSRAM : AND.w #$00FF
JSL.l HUDHex2Digit_Long
TYA : AND.w #$00FF : !ADD.w #$0250+!FS_COLOR_BW : %fs_draw8x8(1,14)
TXA : AND.w #$00FF : !ADD.w #$0250+!FS_COLOR_BW : %fs_draw8x8(1,15)
LDA.l BowTrackingSRAM : AND.w #$0040 : BEQ +
LDA.w #$0299|!FS_COLOR_RED : %fs_draw16x8(0,17)
BRA ++
+
LDA.w #$0289|!FS_COLOR_BROWN : %fs_draw16x8(0,17)
++
LDA.l CurrentArrowsSRAM : AND.w #$00FF
JSL.l HexToDec
LDA.l HexToDecDigit4 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(1,17)
LDA.l HexToDecDigit5 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(1,18)
LDA.l BowTrackingSRAM : AND.w #$0040 : BEQ +
LDA.w #$02D9|!FS_COLOR_RED : %fs_draw16x8(0,17)
BRA ++
+
LDA.w #$02C9|!FS_COLOR_BROWN : %fs_draw16x8(0,17)
++
LDA.l CurrentArrowsSRAM : AND.w #$00FF
JSL.l HUDHex2Digit_Long
TYA : AND.w #$00FF : !ADD.w #$0250+!FS_COLOR_BW : %fs_draw8x8(1,17)
TXA : AND.w #$00FF : !ADD.w #$0250+!FS_COLOR_BW : %fs_draw8x8(1,18)
RTS
;--------------------------------------------------------------------------------
AltBufferTable:
@@ -813,44 +787,61 @@ RTL
;--------------------------------------------------------------------------------
LoadFullItemTiles:
PHA : PHX
LDA.w DMAP0 : PHA ; preserve DMA parameters
LDA.w BBAD0 : PHA ; preserve DMA parameters
LDA.w A1T0L : PHA ; preserve DMA parameters
LDA.w A1T0H : PHA ; preserve DMA parameters
LDA.w A1B0 : PHA ; preserve DMA parameters
LDA.w DAS0L : PHA ; preserve DMA parameters
LDA.w DAS0H : PHA ; preserve DMA parameters
;--------------------------------------------------------------------------------
LDA.b #$80 : STA.w VMAIN ; write read increment on $2119
LDA.b #$01 : STA.w DMAP0 ; set DMA transfer direction A -> B, bus A auto increment, double-byte mode
LDA.b #$18 : STA.w BBAD0 ; set bus B destination to VRAM register
LDA.b #$00 : STA.w VMADDL ; write VRAM destination address
LDA.b #$30 : STA.w VMADDH ; write VRAM destination address
LDA.b #$31 : STA.w A1B0 ; set bus A source bank
LDA.b #FileSelectNewGraphics : STA.w A1T0L ; set bus A source address to ROM
LDA.b #FileSelectNewGraphics>>8 : STA.w A1T0H ; set bus A source address to ROM
LDA.w INIDISP : PHA : LDA.b #$80 : STA.w INIDISP ; save screen state & turn screen off
STZ.w DAS0L : LDA.b #$10 : STA.w DAS0H ; set transfer size to 0x1000
LDA.b #$01 : STA.w MDMAEN ; begin DMA transfer
PLA : STA.w INIDISP ; put screen back however it was before
;--------------------------------------------------------------------------------
PLA : STA.w DAS0H ; restore DMA parameters
PLA : STA.w DAS0L ; restore DMA parameters
PLA : STA.w A1B0 ; restore DMA parameters
PLA : STA.w A1T0H ; restore DMA parameters
PLA : STA.w A1T0L ; restore DMA parameters
PLA : STA.w BBAD0 ; restore DMA parameters
PLA : STA.w DMAP0 ; restore DMA parameters
PLX : PLA
LDA.b #$80 : STA.w VMAIN
LDA.b #$01 : STA.w DMAP0
LDA.b #$18 : STA.w BBAD0
LDX.w #$3200 : STX.w VMADDL
LDA.b #FileSelectNewGraphics>>16 : STA.w A1B0
LDX.w #FileSelectNewGraphics : STX.w A1T0L
LDX.w #$0C00 : STX.w DAS0L
LDA.b #$01 : STA.w MDMAEN
RTL
;--------------------------------------------------------------------------------
; z colon @
; length $340
; target vram $6C00
; NewFont+$400
LoadLowerCaseLettersSymbols:
LDA.b #$80 : STA.w VMAIN
LDA.b #$01 : STA.w DMAP0
LDA.b #$18 : STA.w BBAD0
; Lower case letters
LDA.b #NewFont>>16 : STA.w A1B0
LDX.w #NewFont+$400 : STX.w A1T0L
LDX.w #$0400 : STX.w DAS0L
LDX.w #$2D00 : STX.w VMADDL
LDA.b #$01 : STA.w MDMAEN
; : @ #
LDA.b #NewFont>>16 : STA.w A1B0
LDX.w #NewFont+$A80 : STX.w A1T0L
LDA.b #NewFont>>16 : STA.w A1B1
LDX.w #NewFont+$B80 : STX.w A1T1L
LDX.w #$0030 : STX.w DAS0L : STX.w DAS1L
LDX.w #$2E50 : STX.w VMADDL
LDA.b #$01 : STA.w MDMAEN
LDX.w #$2ED0 : STX.w VMADDL
LDA.b #$02 : STA.w MDMAEN
RTL
;--------------------------------------------------------------------------------
LoadFileSelectVanillaItems:
REP #$10
LDA.b #$80 : STA.w VMAIN
LDA.b #$01 : STA.w DMAP0
LDA.b #$18 : STA.w BBAD0
; Lower case letters
LDA.b #DecompBuffer2>>16 : STA.w A1B0
LDX.w #DecompBuffer2 : STX.w A1T0L
LDX.w #$0600 : STX.w DAS0L
LDX.w #$2F00 : STX.w VMADDL
LDA.b #$01 : STA.w MDMAEN
SEP #$10
RTL
;--------------------------------------------------------------------------------
SetFileSelectPalette:
LDA.b GameMode : CMP.b #$04 : BNE +
; load the vanilla file select screen BG3 palette for naming screen
@@ -894,13 +885,13 @@ DrawPlayerFile_credits:
LDA.l EquipmentSRAM+$2C : AND.w #$00FF : LSR #3 : STA.b Scrap02
%fs_LDY_screenpos(0,20)
LDA.w #$028F|!FS_COLOR_RED
LDA.l HUDHeartColors_index : ASL : TAX
LDA.l HUDHeartColors_masks_file_select,X
ORA.w #$02CF
LDX.w #$000A
.nextHeart
STA.w $0000, Y
INY #2 : DEX : BNE +
PHA
TYA : !ADD.w #$40-$14 : TAY

View File

@@ -4,10 +4,10 @@
; Written over and used by OnEnterWater hook.
UnequipCapeQuiet:
LDA.b #$20 : STA.w PoofTimer
STZ.w NoDamage
STZ.b CapeOn
STZ.w LinkZap
LDA.b #$20 : STA.w PoofTimer
STZ.w NoDamage
STZ.b CapeOn
STZ.w LinkZap
RTL
protectff:
@@ -43,7 +43,7 @@ protectff:
BMI .special_overworld
AND.b #$3F
CMP.l $02A4E3,X
CMP.l $82A4E3,X
BEQ ++
.protect

View File

@@ -5,9 +5,6 @@ SpawnHauntedGroveItem:
LDA.b OverworldIndex : CMP.b #$2A : BEQ + : RTL : + ; Skip if not the haunted grove
LDA.b IndoorsFlag : BEQ + : RTL : + ; Skip if indoors
%GetPossiblyEncryptedItem(HauntedGroveItem, HeartPieceOutdoorValues)
JSL.l PrepDynamicTile
LDA.b #$EB
STA.l MiniGameTime
JSL Sprite_SpawnDynamically

View File

@@ -2,7 +2,7 @@
; Frame Hook
;--------------------------------------------------------------------------------
FrameHookAction:
JSL $0080B5 ; Module_MainRouting
JSL $8080B5 ; Module_MainRouting
JSL CheckMusicLoadRequest
PHP : REP #$30 : PHA
SEP #$20
@@ -35,7 +35,31 @@ PostNMIHookAction:
.return
STZ.w NMIAux ; zero bank byte of NMI hook pointer
+
JSR.w TransferItemGFX
LDA.b INIDISPQ : STA.w INIDISP ; thing we wrote over, turn screen back on
JML.l PostNMIHookReturn
;--------------------------------------------------------------------------------
TransferItemGFX:
; Only used for shops now but could be used for anything. We should look at how door rando does this
; and try to unify one approach.
REP #$30
LDX.w ItemStackPtr : BEQ .done
TXA : BIT #$0040 : BNE .fail ; Crash if we have more than 16 queued (should never happen.)
DEX #2
-
LDA.l ItemGFXStack,X : STA.w ItemGFXPtr
LDA.l ItemTargetStack,X : STA.w ItemGFXTarget
PHX
JSL.l TransferItemToVRAM
REP #$10
PLX
DEX #2
BPL -
STZ.w ItemStackPtr
.done
SEP #$30
RTS
.fail
BRK #$00

View File

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

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

@@ -70,7 +70,7 @@ GetAgahnimLightning:
;1 = Forbid
AllowJoypadInput:
LDA.l PermitSQFromBosses : BEQ .fullCheck
LDA.w ItemsTaken : AND.b #$80 : BEQ .fullCheck
LDA.w RoomItemsTaken : AND.b #$80 : BEQ .fullCheck
LDA.w MedallionFlag : ORA.w CutsceneFlag ; we have heart container, do short check
RTL
.fullCheck

View File

@@ -1,10 +1,7 @@
GoalItemGanonCheck:
LDA.w SpriteTypeTable, X : CMP.b #$D6 : BNE .success ; skip if not ganon
LDA.w $0D80, X : CMP.b #$12 : BEQ .fail
JSL.l CheckGanonVulnerability
BCC .fail
JSL.l CheckMushroom
BCC .success
BCS .success
.fail
LDA.w SpriteActivity, X : CMP.b #17 : !BLT .success ; decmial 17 because Acmlm's chart is decimal
@@ -18,7 +15,7 @@ RTL
;Carry set = ganon vulnerable
CheckGanonVulnerability:
PHX
LDA.l InvincibleGanon
LDA.l GanonVulnerableMode
ASL
TAX
@@ -42,6 +39,8 @@ CheckGanonVulnerability:
dw .crystals_and_bosses
dw .bosses_only
dw .all_dungeons_no_agahnim
dw .all_items
dw .completionist
; 00 = always vulnerable
.vulnerable
@@ -95,80 +94,99 @@ CheckGanonVulnerability:
.bosses_only
JMP CheckForCrystalBossesDefeated
; 09 = 100% item collection rate
.all_items
REP #$20
LDA.l TotalItemCounter : CMP.l TotalItemCount
SEP #$20
RTS
; 0A = 100% item collection rate and all dungeons
.completionist
REP #$20
LDA.l TotalItemCounter : CMP.l TotalItemCount
SEP #$20
BCC .fail
BRA .all_dungeons
;--------------------------------------------------------------------------------
GetRequiredCrystalsForTower:
BEQ + : JSL.l BreakTowerSeal_ExecuteSparkles : + ; thing we wrote over
LDA.l NumberOfCrystalsRequiredForTower : CMP.b #$00 : BNE + : JML.l Ancilla_BreakTowerSeal_stop_spawning_sparkles : +
LDA.l NumberOfCrystalsRequiredForTower : CMP.b #$01 : BNE + : JML.l Ancilla_BreakTowerSeal_draw_single_crystal : +
LDA.l NumberOfCrystalsRequiredForTower : DEC #2 : TAX
LDA.l GanonsTowerOpenTarget : CMP.b #$00 : BNE + : JML.l Ancilla_BreakTowerSeal_stop_spawning_sparkles : +
LDA.l GanonsTowerOpenTarget : CMP.b #$01 : BNE + : JML.l Ancilla_BreakTowerSeal_draw_single_crystal : +
LDA.l GanonsTowerOpenTarget : DEC #2 : TAX
JML.l GetRequiredCrystalsForTower_continue
;--------------------------------------------------------------------------------
GetRequiredCrystalsInX:
LDA.l NumberOfCrystalsRequiredForTower : CMP.b #$00 : BNE +
LDA.l GanonsTowerOpenTarget : CMP.b #$00 : BNE +
TAX
RTL
+
TXA
- CMP.l NumberOfCrystalsRequiredForTower : BCC +
SBC.l NumberOfCrystalsRequiredForTower ; carry guaranteed set
- CMP.l GanonsTowerOpenTarget : BCC +
SBC.l GanonsTowerOpenTarget ; carry guaranteed set
BRA -
+ INC : CMP.l NumberOfCrystalsRequiredForTower : BNE +
+ INC : CMP.l GanonsTowerOpenTarget : BNE +
LDA.b #$08
+ : DEC : TAX
RTL
;--------------------------------------------------------------------------------
CheckEnoughCrystalsForGanon:
REP #$20
LDA.l CrystalCounter
CMP.l NumberOfCrystalsRequiredForGanon
CMP.l GanonVulnerableTarget
SEP #$20
RTL
;--------------------------------------------------------------------------------
CheckEnoughCrystalsForTower:
LDA.l CrystalCounter
CMP.l NumberOfCrystalsRequiredForTower
CheckTowerOpen:
LDA.l GanonsTowerOpenMode : ASL : TAX
JSR.w (.tower_open_modes,X)
RTL
.tower_open_modes
dw .vanilla
dw .arbitrary_cmp
.vanilla
LDA.l CrystalsField
AND.b #$7F : CMP.b #$7F
RTS
.arbitrary_cmp
REP #$30
LDA.l GanonsTowerOpenAddress : TAX
LDA.l $7E0000,X
CMP.l GanonsTowerOpenTarget
SEP #$30
RTS
;---------------------------------------------------------------------------------------------------
CheckAgaForPed:
LDA.l InvincibleGanon
CMP.b #$06 : BNE .vanilla
REP #$20
LDA.l GanonVulnerableMode
CMP.w #$0006 : BNE .vanilla
.light_speed
LDA.l OverworldEventDataWRAM+$80 ; check ped flag
AND.b #$40
BEQ .force_blue_ball
SEP #$20
LDA.l OverworldEventDataWRAM+$80 ; check ped flag
AND.b #$40
BEQ .force_blue_ball
.vanilla ; run vanilla check for phase
LDA.w SpriteAux, X
CMP.b #$02
RTL
SEP #$20
LDA.w SpriteAux, X
CMP.b #$02
RTL
.force_blue_ball
LDA.b #$01 : STA.w SpriteAuxTable, Y
LDA.b #$20 : STA.w SpriteTimer, Y
CLC ; skip the RNG check
RTL
LDA.b #$01 : STA.w SpriteAuxTable, Y
LDA.b #$20 : STA.w SpriteTimer, Y
CLC ; skip the RNG check
RTL
;---------------------------------------------------------------------------------------------------
KillGanon:
STA.l ProgressIndicator ; 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
.exit
RTL
;---------------------------------------------------------------------------------------------------
CheckForCrystalBossesDefeated:
PHB : PHX : PHY
@@ -206,8 +224,36 @@ CheckForCrystalBossesDefeated:
SEP #$30
PLY : PLX : PLB
LDA.b Scrap00 : CMP.l NumberOfCrystalsRequiredForGanon
LDA.b Scrap00 : CMP.l GanonVulnerableTarget
RTS
;---------------------------------------------------------------------------------------------------
CheckPedestalPull:
; Out: c - Successful ped pull if set, do nothing if unset.
PHX
LDA.l PedCheckMode : ASL : TAX
JSR.w (.pedestal_modes,X)
PLX
RTL
.pedestal_modes
dw .vanilla
dw .arbitrary_cmp
.vanilla
LDA.l PendantsField
AND.b #$07 : CMP.b #$07 : BNE ..nopull
SEC
RTS
..nopull
CLC
RTS
.arbitrary_cmp
REP #$30
LDA.l PedPullAddress : TAX
LDA.l $7E0000,X
CMP.l PedPullTarget
SEP #$30
RTS

View File

@@ -76,18 +76,12 @@ 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
LDA.l SpecialWeapons : CMP #$02 : BNE .normal
TXA : AND #$78 : CMP #$28 : BNE .normal
LDA $0DB8F1, X : BEQ .noDamage
LDA #$01
RTL
CPX.b #$3b : BEQ .hookshot
CPX.b #$3c : BEQ .hookshot
CPX.b #$3d : BEQ .hookshot
.normal
LDA.l $0DB8F1, X ; what we wrote over
LDA.l $8DB8F1,x ;what we wrote over
RTL
.boomerang
LDA.l StunItemAction : AND.b #$01 : BNE .normal

View File

@@ -69,110 +69,88 @@ RTL
; DMAAlphabetTilemap:
;--------------------------------------------------------------------------------
DMAAlphabetTilemap:
PHA : PHX
LDA.w DMAP0 : PHA ; preserve DMA parameters
LDA.w BBAD0 : PHA ; preserve DMA parameters
LDA.w A1T0L : PHA ; preserve DMA parameters
LDA.w A1T0H : PHA ; preserve DMA parameters
LDA.w A1B0 : PHA ; preserve DMA parameters
LDA.w DAS0L : PHA ; preserve DMA parameters
LDA.w DAS0H : PHA ; preserve DMA parameters
;--------------------------------------------------------------------------------
LDA.b #$01 : STA.w DMAP0 ; set DMA transfer direction A -> B, bus A auto increment, double-byte mode
LDA.b #$80 : STA.w VMAIN ; write read increment on $2119
LDA.b #$18 : STA.w BBAD0 ; set bus B destination to VRAM register
LDA.b #$60 : STA.w VMADDL ; write VRAM destination address
STA.w VMADDH ; write VRAM destination address
LDA.b #BigRAM : STA.w A1T0L ; set bus A source address to WRAM
LDA.b #BigRAM>>8 : STA.w A1T0H ; set bus A source address to WRAM
LDA.b #BigRAM>>16 : STA.w A1B0 ; set bus A source bank
LDA.b #$80 : STA.w DAS0L : STZ.w DAS0H ; set transfer size to 0x40
LDA.w INIDISP : PHA : LDA.b #$80 : STA.w INIDISP ; save screen state & turn screen off
LDA.b #$01 : STA.w MDMAEN ; begin DMA transfer
PLA : STA.w INIDISP ; put screen back however it was before
;--------------------------------------------------------------------------------
PLA : STA.w DAS0H ; restore DMA parameters
PLA : STA.w DAS0L ; restore DMA parameters
PLA : STA.w A1B0 ; restore DMA parameters
PLA : STA.w A1T0H ; restore DMA parameters
PLA : STA.w A1T0L ; restore DMA parameters
PLA : STA.w BBAD0 ; restore DMA parameters
PLA : STA.w DMAP0 ; restore DMA parameters
PLX : PLA
PHA : PHX
REP #$10
LDA.b #$01 : STA.w DMAP0
LDA.b #$80 : STA.w VMAIN
LDA.b #$18 : STA.w BBAD0
LDX.w #$6060 : STX.w VMADDL
LDA.b #BigRAM>>16 : STA.w A1B0
LDX.w #BigRAM : STX.w A1T0L
LDX.w #$0080 : STX.w DAS0L
LDA.b #$01 : STA.w MDMAEN
SEP #$10
PLX : PLA
RTS
;--------------------------------------------------------------------------------
HashAlphabetTilesWithBlank:
;BLANK
dw #$0186|!FS_COLOR_BW, #$0186|!FS_COLOR_BW, #$0196|!FS_COLOR_BW, #$0196|!FS_COLOR_BW
dw #$0188, #$0188, #$0188, #$0188
HashAlphabetTiles:
;BOW
dw #$0201|!FS_COLOR_YELLOW, #$0202|!FS_COLOR_YELLOW, #$0211|!FS_COLOR_YELLOW, #$0212|!FS_COLOR_YELLOW
dw #$0241|!FS_COLOR_YELLOW, #$0242|!FS_COLOR_YELLOW, #$0251|!FS_COLOR_YELLOW, #$0252|!FS_COLOR_YELLOW
;BOOM
dw #$0205|!FS_COLOR_BLUE, #$0206|!FS_COLOR_BLUE, #$0200|!FS_COLOR_BW, #$0216|!FS_COLOR_BLUE
dw #$0245|!FS_COLOR_BLUE, #$0246|!FS_COLOR_BLUE, #$0240|!FS_COLOR_BW, #$0256|!FS_COLOR_BLUE
;HOOK
dw #$0200|!FS_COLOR_RED, #$0215|!FS_COLOR_RED, #$0230|!FS_COLOR_RED, #$0200|!FS_COLOR_BW
dw #$0240|!FS_COLOR_RED, #$0255|!FS_COLOR_RED, #$0270|!FS_COLOR_RED, #$0240|!FS_COLOR_BW
;BOMB
dw #$020C|!FS_COLOR_BLUE, #$020D|!FS_COLOR_BLUE, #$021C|!FS_COLOR_BLUE, #$021C|!FS_COLOR_BLUE|!FS_HFLIP
dw #$024C|!FS_COLOR_BLUE, #$024D|!FS_COLOR_BLUE, #$025C|!FS_COLOR_BLUE, #$025C|!FS_COLOR_BLUE|!FS_HFLIP
;SHROOM
dw #$0262|!FS_COLOR_RED, #$0263|!FS_COLOR_RED, #$0272|!FS_COLOR_RED, #$0273|!FS_COLOR_RED
dw #$02A2|!FS_COLOR_RED, #$02A3|!FS_COLOR_RED, #$02B2|!FS_COLOR_RED, #$02B3|!FS_COLOR_RED
;POWDER
dw #$020A|!FS_COLOR_BROWN, #$020B|!FS_COLOR_BROWN, #$021A|!FS_COLOR_BROWN, #$021B|!FS_COLOR_BROWN
dw #$024A|!FS_COLOR_BROWN, #$024B|!FS_COLOR_BROWN, #$025A|!FS_COLOR_BROWN, #$025B|!FS_COLOR_BROWN
;ROD
dw #$0220|!FS_COLOR_BLUE, #$0221|!FS_COLOR_BLUE, #$0230|!FS_COLOR_BLUE, #$0231|!FS_COLOR_BLUE
dw #$0260|!FS_COLOR_BLUE, #$0261|!FS_COLOR_BLUE, #$0270|!FS_COLOR_BLUE, #$0271|!FS_COLOR_BLUE
;PENDANT
dw #$0285|!FS_COLOR_GREEN, #$0286|!FS_COLOR_GREEN, #$0295|!FS_COLOR_GREEN, #$0296|!FS_COLOR_GREEN
dw #$02C5|!FS_COLOR_GREEN, #$02C6|!FS_COLOR_GREEN, #$02D5|!FS_COLOR_GREEN, #$02D6|!FS_COLOR_GREEN
;BOMBOS
dw #$0207|!FS_COLOR_YELLOW, #$0217|!FS_COLOR_YELLOW|!FS_HFLIP|!FS_VFLIP, #$0217|!FS_COLOR_YELLOW, #$0207|!FS_COLOR_YELLOW|!FS_HFLIP|!FS_VFLIP
dw #$0247|!FS_COLOR_YELLOW, #$0257|!FS_COLOR_YELLOW|!FS_HFLIP|!FS_VFLIP, #$0257|!FS_COLOR_YELLOW, #$0247|!FS_COLOR_YELLOW|!FS_HFLIP|!FS_VFLIP
;ETHER
dw #$0208|!FS_COLOR_YELLOW, #$0218|!FS_COLOR_YELLOW|!FS_HFLIP|!FS_VFLIP, #$0218|!FS_COLOR_YELLOW, #$0208|!FS_COLOR_YELLOW|!FS_HFLIP|!FS_VFLIP
dw #$0248|!FS_COLOR_YELLOW, #$0258|!FS_COLOR_YELLOW|!FS_HFLIP|!FS_VFLIP, #$0258|!FS_COLOR_YELLOW, #$0248|!FS_COLOR_YELLOW|!FS_HFLIP|!FS_VFLIP
;QUAKE
dw #$0209|!FS_COLOR_YELLOW, #$0219|!FS_COLOR_YELLOW|!FS_HFLIP|!FS_VFLIP, #$0219|!FS_COLOR_YELLOW, #$0209|!FS_COLOR_YELLOW|!FS_HFLIP|!FS_VFLIP
dw #$0249|!FS_COLOR_YELLOW, #$0259|!FS_COLOR_YELLOW|!FS_HFLIP|!FS_VFLIP, #$0259|!FS_COLOR_YELLOW, #$0249|!FS_COLOR_YELLOW|!FS_HFLIP|!FS_VFLIP
;LAMP
dw #$022C|!FS_COLOR_RED, #$022C|!FS_COLOR_RED|!FS_HFLIP, #$023C|!FS_COLOR_RED, #$023D|!FS_COLOR_RED
dw #$026C|!FS_COLOR_RED, #$026C|!FS_COLOR_RED|!FS_HFLIP, #$027C|!FS_COLOR_RED, #$027D|!FS_COLOR_RED
;HAMMER
dw #$0222|!FS_COLOR_BROWN, #$0223|!FS_COLOR_BROWN, #$0232|!FS_COLOR_BROWN, #$0233|!FS_COLOR_BROWN
dw #$0262|!FS_COLOR_BROWN, #$0263|!FS_COLOR_BROWN, #$0272|!FS_COLOR_BROWN, #$0273|!FS_COLOR_BROWN
;SHOVEL
dw #$0224|!FS_COLOR_BROWN, #$0225|!FS_COLOR_BROWN, #$0234|!FS_COLOR_BROWN, #$0235|!FS_COLOR_BROWN
dw #$0264|!FS_COLOR_BROWN, #$0265|!FS_COLOR_BROWN, #$0274|!FS_COLOR_BROWN, #$0275|!FS_COLOR_BROWN
;FLUTE
dw #$0226|!FS_COLOR_BLUE, #$0227|!FS_COLOR_BLUE, #$0236|!FS_COLOR_BLUE, #$0237|!FS_COLOR_BLUE
dw #$0266|!FS_COLOR_BLUE, #$0267|!FS_COLOR_BLUE, #$0276|!FS_COLOR_BLUE, #$0277|!FS_COLOR_BLUE
;NET
dw #$0228|!FS_COLOR_YELLOW, #$0229|!FS_COLOR_YELLOW, #$0238|!FS_COLOR_YELLOW, #$0239|!FS_COLOR_YELLOW
dw #$0268|!FS_COLOR_YELLOW, #$0269|!FS_COLOR_YELLOW, #$0278|!FS_COLOR_YELLOW, #$0279|!FS_COLOR_YELLOW
;BOOK
dw #$022A|!FS_COLOR_GREEN, #$022B|!FS_COLOR_GREEN, #$023A|!FS_COLOR_GREEN, #$023B|!FS_COLOR_GREEN
dw #$026A|!FS_COLOR_GREEN, #$026B|!FS_COLOR_GREEN, #$027A|!FS_COLOR_GREEN, #$027B|!FS_COLOR_GREEN
;BOTTLE
dw #$0240|!FS_COLOR_BW, #$0241|!FS_COLOR_BW, #$0250|!FS_COLOR_BW, #$0251|!FS_COLOR_BW
dw #$0280|!FS_COLOR_BW, #$0281|!FS_COLOR_BW, #$0290|!FS_COLOR_BW, #$0291|!FS_COLOR_BW
;POTION
dw #$0242|!FS_COLOR_GREEN, #$0242|!FS_COLOR_GREEN|!FS_HFLIP, #$0252|!FS_COLOR_GREEN, #$0253|!FS_COLOR_GREEN
dw #$0282|!FS_COLOR_GREEN, #$0282|!FS_COLOR_GREEN|!FS_HFLIP, #$0292|!FS_COLOR_GREEN, #$0293|!FS_COLOR_GREEN
;CANE
dw #$021D|!FS_COLOR_RED, #$021E|!FS_COLOR_RED, #$022D|!FS_COLOR_RED, #$022E|!FS_COLOR_RED
dw #$025D|!FS_COLOR_RED, #$025E|!FS_COLOR_RED, #$026D|!FS_COLOR_RED, #$026E|!FS_COLOR_RED
;CAPE
dw #$0248|!FS_COLOR_RED, #$0249|!FS_COLOR_RED, #$0258|!FS_COLOR_RED, #$0259|!FS_COLOR_RED
dw #$0288|!FS_COLOR_RED, #$0289|!FS_COLOR_RED, #$0298|!FS_COLOR_RED, #$0299|!FS_COLOR_RED
;MIRROR
dw #$024A|!FS_COLOR_BLUE, #$024B|!FS_COLOR_BLUE, #$025A|!FS_COLOR_BLUE, #$025B|!FS_COLOR_BLUE
dw #$028A|!FS_COLOR_BLUE, #$028B|!FS_COLOR_BLUE, #$029A|!FS_COLOR_BLUE, #$029B|!FS_COLOR_BLUE
;BOOTS
dw #$024C|!FS_COLOR_BOOTS, #$024D|!FS_COLOR_BOOTS, #$025C|!FS_COLOR_BOOTS, #$025D|!FS_COLOR_BOOTS
dw #$028C|!FS_COLOR_BOOTS, #$028D|!FS_COLOR_BOOTS, #$029C|!FS_COLOR_BOOTS, #$029D|!FS_COLOR_BOOTS
;GLOVES
dw #$024E|!FS_COLOR_BROWN, #$024F|!FS_COLOR_BROWN, #$025E|!FS_COLOR_BROWN, #$025F|!FS_COLOR_BROWN
dw #$028E|!FS_COLOR_BROWN, #$028F|!FS_COLOR_BROWN, #$029E|!FS_COLOR_BROWN, #$029F|!FS_COLOR_BROWN
;FLIPPERS
dw #$020E|!FS_COLOR_BLUE, #$020F|!FS_COLOR_BLUE, #$021F|!FS_COLOR_BLUE|!FS_HFLIP, #$021F|!FS_COLOR_BLUE
dw #$024E|!FS_COLOR_BLUE, #$024F|!FS_COLOR_BLUE, #$025F|!FS_COLOR_BLUE|!FS_HFLIP, #$025F|!FS_COLOR_BLUE
;PEARL
dw #$0264|!FS_COLOR_RED, #$0265|!FS_COLOR_RED, #$0274|!FS_COLOR_RED, #$0275|!FS_COLOR_RED
dw #$02A4|!FS_COLOR_RED, #$02A5|!FS_COLOR_RED, #$02B4|!FS_COLOR_RED, #$02B5|!FS_COLOR_RED
;SHIELD
dw #$026D|!FS_COLOR_YELLOW, #$026E|!FS_COLOR_YELLOW, #$027D|!FS_COLOR_YELLOW, #$027E|!FS_COLOR_YELLOW
dw #$02AD|!FS_COLOR_YELLOW, #$02AE|!FS_COLOR_YELLOW, #$02BD|!FS_COLOR_YELLOW, #$02BE|!FS_COLOR_YELLOW
;TUNIC
dw #$026F|!FS_COLOR_GREEN, #$026F|!FS_COLOR_GREEN|!FS_HFLIP, #$027F|!FS_COLOR_GREEN, #$027F|!FS_COLOR_GREEN|!FS_HFLIP
dw #$02AF|!FS_COLOR_GREEN, #$02AF|!FS_COLOR_GREEN|!FS_HFLIP, #$02BF|!FS_COLOR_GREEN, #$02BF|!FS_COLOR_GREEN|!FS_HFLIP
;HEART
dw #$0281|!FS_COLOR_RED, #$0281|!FS_COLOR_RED|!FS_HFLIP, #$0291|!FS_COLOR_RED, #$0291|!FS_COLOR_RED|!FS_HFLIP
dw #$02C1|!FS_COLOR_RED, #$02C1|!FS_COLOR_RED|!FS_HFLIP, #$02D1|!FS_COLOR_RED, #$02D1|!FS_COLOR_RED|!FS_HFLIP
;MAP
dw #$0282|!FS_COLOR_YELLOW, #$0283|!FS_COLOR_YELLOW, #$0292|!FS_COLOR_YELLOW, #$0293|!FS_COLOR_YELLOW
dw #$02C2|!FS_COLOR_YELLOW, #$02C3|!FS_COLOR_YELLOW, #$02D2|!FS_COLOR_YELLOW, #$02D3|!FS_COLOR_YELLOW
;COMPASS
dw #$0284|!FS_COLOR_RED, #$0284|!FS_COLOR_RED|!FS_HFLIP, #$0294|!FS_COLOR_RED, #$0294|!FS_COLOR_RED|!FS_HFLIP
dw #$02C4|!FS_COLOR_RED, #$02C4|!FS_COLOR_RED|!FS_HFLIP, #$02D4|!FS_COLOR_RED, #$02D4|!FS_COLOR_RED|!FS_HFLIP
;KEY
dw #$022F|!FS_COLOR_YELLOW|!FS_HFLIP, #$022F|!FS_COLOR_YELLOW, #$023E|!FS_COLOR_YELLOW, #$023F|!FS_COLOR_YELLOW
dw #$026F|!FS_COLOR_YELLOW|!FS_HFLIP, #$026F|!FS_COLOR_YELLOW, #$027E|!FS_COLOR_YELLOW, #$027F|!FS_COLOR_YELLOW
;--------------------------------------------------------------------------------
FileSelect_PlayerSelectText_Top:
;db $60, $62, $00, $37

View File

@@ -55,76 +55,76 @@
!FSTILE_Y_TOP = $1D82
!FSTILE_Y_BOTTOM = $1D92
;--------------------------------------------------------------------------------
org $0CDE60 ; <- 65E60
org $8CDE60 ; <- 65E60
FileSelect_CopyFile_Top:
db $62, $A5, $00, $15
dw !FSTILE_SPACE,!FSTILE_SPACE,!FSTILE_SPACE,!FSTILE_SPACE,!FSTILE_SPACE,!FSTILE_SPACE,!FSTILE_SPACE,!FSTILE_SPACE,!FSTILE_SPACE,!FSTILE_SPACE,!FSTILE_SPACE
;--------------------------------------------------------------------------------
org $0CDE7A ; <- 65E7A
org $8CDE7A ; <- 65E7A
FileSelect_CopyFile_Bottom:
db $62, $C5, $00, $15
dw !FSTILE_SPACE,!FSTILE_SPACE,!FSTILE_SPACE,!FSTILE_SPACE,!FSTILE_SPACE,!FSTILE_SPACE,!FSTILE_SPACE,!FSTILE_SPACE,!FSTILE_SPACE,!FSTILE_SPACE,!FSTILE_SPACE
;--------------------------------------------------------------------------------
org $0CDE94 ; <- 65E94
org $8CDE94 ; <- 65E94
FileSelect_KillFile_Top:
db $63, $25, $00, $19
dw !FSTILE_D_TOP, !FSTILE_E_TOP, !FSTILE_L_TOP, !FSTILE_E_TOP, !FSTILE_T_TOP, !FSTILE_E_TOP, !FSTILE_SPACE, !FSTILE_F_TOP, !FSTILE_I_TOP, !FSTILE_L_TOP, !FSTILE_E_TOP, !FSTILE_SPACE, !FSTILE_SPACE
org $0CDEB2 ; <- 65EB2
org $8CDEB2 ; <- 65EB2
FileSelect_KillFile_Bottom:
db $63, $45, $00, $19
dw !FSTILE_D_BOTTOM, !FSTILE_E_BOTTOM, !FSTILE_L_BOTTOM, !FSTILE_E_BOTTOM, !FSTILE_T_BOTTOM, !FSTILE_E_BOTTOM, !FSTILE_SPACE, !FSTILE_F_BOTTOM, !FSTILE_I_BOTTOM, !FSTILE_L_BOTTOM, !FSTILE_E_BOTTOM, !FSTILE_SPACE, !FSTILE_SPACE
;CopyFile_Header:
org $0CE228 ; <- 66228
org $8CE228 ; <- 66228
dw !FSTILE_BRACKET_OPEN_TOP, !FSTILE_SPACE, !FSTILE_SPACE, !FSTILE_C_TOP, !FSTILE_O_TOP, !FSTILE_P_TOP, !FSTILE_Y_TOP, !FSTILE_SPACE, !FSTILE_F_TOP, !FSTILE_I_TOP, !FSTILE_L_TOP, !FSTILE_E_TOP, !FSTILE_SPACE, !FSTILE_SPACE, !FSTILE_BRACKET_CLOSE_TOP
org $0CE24A ; <- 6624A
org $8CE24A ; <- 6624A
dw !FSTILE_BRACKET_OPEN_BOTTOM, !FSTILE_SPACE, !FSTILE_SPACE, !FSTILE_C_BOTTOM, !FSTILE_O_BOTTOM, !FSTILE_P_BOTTOM, !FSTILE_Y_BOTTOM, !FSTILE_SPACE, !FSTILE_F_BOTTOM, !FSTILE_I_BOTTOM, !FSTILE_L_BOTTOM, !FSTILE_E_BOTTOM, !FSTILE_SPACE, !FSTILE_SPACE, !FSTILE_BRACKET_CLOSE_BOTTOM
;CopyFile_Which:
org $0CE2DB ; <- 662DB
org $8CE2DB ; <- 662DB
dw $0D80, $0D61, $0D62, $0D4C, $0D61, $0D86, !FSTILE_SPACE
org $0CE2ED ; <- 662ED
org $8CE2ED ; <- 662ED
dw $0D90, $0D71, $0D72, $0D5C, $0D71, $0D96, !FSTILE_SPACE
;CopyFile_Where:
org $0CE39C ; <- 6639C
org $8CE39C ; <- 6639C
dw $0D80, $0D61, $0D4E, $0D6B, $0D4E, $0D86, !FSTILE_SPACE
org $0CE3AE ; <- 663AE
org $8CE3AE ; <- 663AE
dw $0D90, $0D71, $0D5E, $0D7B, $0D5E, $0D96, !FSTILE_SPACE
;CopyFile_Execute:
org $0CD13A ; <- 6513A
org $8CD13A ; <- 6513A
dw !FSTILE_C_TOP, !FSTILE_SPACE, !FSTILE_O_TOP, !FSTILE_SPACE, !FSTILE_P_TOP, !FSTILE_SPACE, !FSTILE_Y_TOP, !FSTILE_SPACE, !FSTILE_SPACE
org $0CD150 ; <- 65150
org $8CD150 ; <- 65150
dw !FSTILE_C_BOTTOM, !FSTILE_SPACE, !FSTILE_O_BOTTOM, !FSTILE_SPACE, !FSTILE_P_BOTTOM, !FSTILE_SPACE, !FSTILE_Y_BOTTOM, !FSTILE_SPACE, !FSTILE_SPACE
;CopyFile_Cancel:
org $0CE29A ; <- 6629A
org $8CE29A ; <- 6629A
dw !FSTILE_C_TOP, !FSTILE_SPACE, !FSTILE_A_TOP, !FSTILE_SPACE, !FSTILE_N_TOP, !FSTILE_SPACE, !FSTILE_C_TOP, !FSTILE_SPACE, !FSTILE_E_TOP, !FSTILE_SPACE, !FSTILE_L_TOP, !FSTILE_SPACE, !FSTILE_SPACE, !FSTILE_SPACE
org $0CE2BA ; <- 662BA
org $8CE2BA ; <- 662BA
dw !FSTILE_C_BOTTOM, !FSTILE_SPACE, !FSTILE_A_BOTTOM, !FSTILE_SPACE, !FSTILE_N_BOTTOM, !FSTILE_SPACE, !FSTILE_C_BOTTOM, !FSTILE_SPACE, !FSTILE_E_BOTTOM, !FSTILE_SPACE, !FSTILE_L_BOTTOM, !FSTILE_SPACE, !FSTILE_SPACE, !FSTILE_SPACE
;KillFile_Header:
org $0CE002 ; <- 66002
org $8CE002 ; <- 66002
dw !FSTILE_BRACKET_OPEN_TOP, !FSTILE_SPACE, !FSTILE_D_TOP, !FSTILE_E_TOP, !FSTILE_L_TOP, !FSTILE_E_TOP, !FSTILE_T_TOP, !FSTILE_E_TOP, !FSTILE_SPACE, !FSTILE_F_TOP, !FSTILE_I_TOP, !FSTILE_L_TOP, !FSTILE_E_TOP, !FSTILE_SPACE, !FSTILE_BRACKET_CLOSE_TOP, !FSTILE_SPACE, !FSTILE_SPACE
org $0CE028 ; <- 66028
org $8CE028 ; <- 66028
dw !FSTILE_BRACKET_OPEN_BOTTOM, !FSTILE_SPACE, !FSTILE_D_BOTTOM, !FSTILE_E_BOTTOM, !FSTILE_L_BOTTOM, !FSTILE_E_BOTTOM, !FSTILE_T_BOTTOM, !FSTILE_E_BOTTOM, !FSTILE_SPACE, !FSTILE_F_BOTTOM, !FSTILE_I_BOTTOM, !FSTILE_L_BOTTOM, !FSTILE_E_BOTTOM, !FSTILE_SPACE, !FSTILE_BRACKET_CLOSE_BOTTOM, !FSTILE_SPACE, !FSTILE_SPACE
;KillFile_Which:
org $0CE04E ; <- 6604E
org $8CE04E ; <- 6604E
dw !FSTILE_SPACE, !FSTILE_SPACE, !FSTILE_SPACE, !FSTILE_SPACE, !FSTILE_SPACE, !FSTILE_SPACE, !FSTILE_SPACE, !FSTILE_SPACE, !FSTILE_SPACE, !FSTILE_SPACE, !FSTILE_SPACE, !FSTILE_SPACE, !FSTILE_SPACE, !FSTILE_SPACE, !FSTILE_SPACE, !FSTILE_SPACE, !FSTILE_SPACE, !FSTILE_SPACE, !FSTILE_SPACE, !FSTILE_SPACE, !FSTILE_SPACE, !FSTILE_SPACE, !FSTILE_SPACE, !FSTILE_SPACE, !FSTILE_SPACE
org $0CE084 ; <- 66084
org $8CE084 ; <- 66084
dw !FSTILE_SPACE, !FSTILE_SPACE, !FSTILE_SPACE, !FSTILE_SPACE, !FSTILE_SPACE, !FSTILE_SPACE, !FSTILE_SPACE, !FSTILE_SPACE, !FSTILE_SPACE, !FSTILE_SPACE, !FSTILE_SPACE, !FSTILE_SPACE, !FSTILE_SPACE, !FSTILE_SPACE, !FSTILE_SPACE, !FSTILE_SPACE, !FSTILE_SPACE, !FSTILE_SPACE, !FSTILE_SPACE, !FSTILE_SPACE, !FSTILE_SPACE, !FSTILE_SPACE, !FSTILE_SPACE, !FSTILE_SPACE, !FSTILE_SPACE
;KillFile_Execute:
org $0CD328 ; <- 65328
org $8CD328 ; <- 65328
dw !FSTILE_D_TOP, !FSTILE_E_TOP, !FSTILE_L_TOP, !FSTILE_E_TOP, !FSTILE_T_TOP, !FSTILE_E_TOP, !FSTILE_SPACE, !FSTILE_SPACE, !FSTILE_SPACE, !FSTILE_SPACE, !FSTILE_SPACE, !FSTILE_SPACE
org $0CD344 ; <- 65344
org $8CD344 ; <- 65344
dw !FSTILE_D_BOTTOM, !FSTILE_E_BOTTOM, !FSTILE_L_BOTTOM, !FSTILE_E_BOTTOM, !FSTILE_T_BOTTOM, !FSTILE_E_BOTTOM, !FSTILE_SPACE, !FSTILE_SPACE, !FSTILE_SPACE, !FSTILE_SPACE, !FSTILE_SPACE, !FSTILE_SPACE
;KillFile_Cancel:
org $0CE0BA ; <- 660BA
org $8CE0BA ; <- 660BA
dw !FSTILE_C_TOP, !FSTILE_A_TOP, !FSTILE_N_TOP, !FSTILE_C_TOP, !FSTILE_E_TOP, !FSTILE_L_TOP, !FSTILE_SPACE, !FSTILE_SPACE, !FSTILE_SPACE, !FSTILE_SPACE, !FSTILE_SPACE, !FSTILE_SPACE, !FSTILE_SPACE, !FSTILE_SPACE
org $0CE0DA ; <- 660DA
org $8CE0DA ; <- 660DA
dw !FSTILE_C_BOTTOM, !FSTILE_A_BOTTOM, !FSTILE_N_BOTTOM, !FSTILE_C_BOTTOM, !FSTILE_E_BOTTOM, !FSTILE_L_BOTTOM, !FSTILE_SPACE, !FSTILE_SPACE, !FSTILE_SPACE, !FSTILE_SPACE, !FSTILE_SPACE, !FSTILE_SPACE, !FSTILE_SPACE, !FSTILE_SPACE

View File

@@ -3,31 +3,18 @@
;--------------------------------------------------------------------------------
HeartPieceGet:
PHX : PHY
LDY.w SpriteItemType, X ; load item value into Y register
BNE +
; if for any reason the item value is 0 reload it, just in case
JSL.l LoadHeartPieceRoomValue : TAY
+
JSL.l LoadHeartPieceRoomValue
JSL.l AttemptItemSubstitution
JSL.l ResolveLootIDLong
TAY
JSL.l MaybeMarkDigSpotCollected
.skipLoad
CPY.b #$26 : BNE .not_heart ; don't add a 1/4 heart if it's not a heart piece
LDA.l HeartPieceQuarter : INC A : AND.b #$03 : STA.l HeartPieceQuarter
.not_heart
JSL.l $8791B3 ; Player_HaltDashAttackLong
STZ.w ItemReceiptMethod ; 0 = Receiving item from an NPC or message
CPY.b #$26 : BNE .notHeart ; don't add a 1/4 heart if it's not a heart piece
LDA.l HeartPieceQuarter : INC A : AND.b #$03 : STA.l HeartPieceQuarter : BNE .unfinished_heart ; add up heart quarters
BRA .giveItem
.notHeart
.giveItem
JSL.l $0791B3 ; Player_HaltDashAttackLong
JSL.l Link_ReceiveItem
CLC ; return false
JMP .done ; finished
.unfinished_heart
SEC ; return true
.done
JSL MaybeUnlockTabletAnimation
PLY : PLX
@@ -35,42 +22,45 @@ RTL
;--------------------------------------------------------------------------------
HeartContainerGet:
PHX : PHY
JSL.l AddInventory_incrementBossSwordLong
LDY.w SpriteItemType, X ; load item value into Y register
BNE +
; if for any reason the item value is 0 reload it, just in case
JSL.l IncrementBossSword
LDY.w SpriteID, X : BNE +
JSL.l LoadHeartContainerRoomValue : TAY
+
BRA HeartPieceGet_skipLoad
;--------------------------------------------------------------------------------
DrawHeartPieceGFX:
PHP
JSL.l Sprite_IsOnscreen : BCC .offscreen
PHA : PHY
LDA.l RedrawFlag : BEQ .skipInit ; skip init if already ready
JSL.l HeartPieceSpritePrep
JMP .done ; don't draw on the init frame
.skipInit
LDA.w SpriteItemType, X ; Retrieve stored item type
.skipLoad
PHA
JSL.l IsNarrowSprite : BCC +
LDA.w SpriteControl, X : ORA.b #$20 : STA.w SpriteControl, X
+
PLA
JSL.l DrawDynamicTile
JSL.l Sprite_DrawShadowLong
.done
PLY : PLA
.offscreen
PLP
PHP
JSL.l Sprite_IsOnscreen : BCC .offscreen
PHA : PHY
LDA.l RedrawFlag : BEQ .skipInit ; skip init if already ready
JSL.l HeartPieceSpritePrep
JMP .done ; don't draw on the init frame
.skipInit
LDA.w SpriteID, X ; Retrieve stored item type
.skipLoad
PHA : PHX
TAX
LDA.l SpriteProperties_standing_width,X : BNE +
PLX
LDA.w SpriteControl, X : ORA.b #$20 : STA.w SpriteControl, X
PLA
JSL.l DrawDynamicTile
REP #$21
LDA.b Scrap00
ADC.w #$0004
STA.b Scrap00
SEP #$20
JSL.l Sprite_DrawShadowLong
BRA .done
+
PLX
PLA
JSL.l DrawDynamicTile
JSL.l Sprite_DrawShadowLong
.done
PLY : PLA
.offscreen
PLP
RTL
;--------------------------------------------------------------------------------
DrawHeartContainerGFX:
@@ -83,37 +73,36 @@ DrawHeartContainerGFX:
BRA DrawHeartPieceGFX_done ; don't draw on the init frame
.skipInit
LDA.w SpriteItemType, X ; Retrieve stored item type
LDA.w SpriteID, X ; Retrieve stored item type
BRA DrawHeartPieceGFX_skipLoad
;--------------------------------------------------------------------------------
HeartContainerSound:
CPY.b #$20 : BEQ + ; Skip for Crystal
CPY.b #$37 : BEQ + ; Skip for Pendants
CPY.b #$38 : BEQ +
CPY.b #$39 : BEQ +
JSL.l CheckIfBossRoom : BCC + ; Skip if not in a boss room
LDA.b #$2E
SEC
RTL
LDA.w ItemReceiptMethod : CMP.b #$03 : BEQ +
JSL.l CheckIfBossRoom : BCC + ; Skip if not in a boss room
LDA.b #$2E
SEC
RTL
+
CLC
RTL
;--------------------------------------------------------------------------------
NormalItemSkipSound:
LDA.w AncillaGet, X ; thing we wrote over
CPY.b #$20 : BEQ + ; Skip for Crystal
CPY.b #$37 : BEQ + ; Skip for Pendants
CPY.b #$38 : BEQ +
CPY.b #$39 : BEQ +
PHA
JSL.l CheckIfBossRoom
PLA
; Out: C - skip sounds if set
JSL.l CheckIfBossRoom : BCS .boss_room
TDC
CPY #$17 : BEQ .skip
CLC
RTL
+
CLC
.boss_room
LDA.w ItemReceiptMethod : CMP.b #$03 : BEQ +
.skip
SEC
RTL
+
LDA.b #$20
.dont_skip
CLC
RTL
;--------------------------------------------------------------------------------
HeartPieceSpritePrep:
@@ -125,9 +114,11 @@ HeartPieceSpritePrep:
LDA.b LinkState : CMP.b #$14 : BEQ .skip ; skip if we're mid-mirror
LDA.b #$00 : STA.l RedrawFlag
JSL.l LoadHeartPieceRoomValue ; load item type
STA.w SpriteItemType, X ; Store item type
JSL.l PrepDynamicTile
JSL.l LoadHeartPieceRoomValue
JSL.l AttemptItemSubstitution
JSL.l ResolveLootIDLong
STA.w SpriteID, X
JSL.l PrepDynamicTile_loot_resolved
.skip
PLA
@@ -138,8 +129,10 @@ HeartContainerSpritePrep:
LDA.b #$00 : STA.l RedrawFlag
JSL.l LoadHeartContainerRoomValue ; load item type
STA.w SpriteItemType, X ; Store item type
JSL.l PrepDynamicTile
JSL.l AttemptItemSubstitution
JSL.l ResolveLootIDLong
STA.w SpriteID, X
JSL.l PrepDynamicTile_loot_resolved
PLA
RTL
@@ -155,7 +148,7 @@ LoadHeartPieceRoomValue:
RTL
;--------------------------------------------------------------------------------
HPItemReset:
JSL $09AD58 ; GiveRupeeGift - thing we wrote over
JSL $89AD58 ; GiveRupeeGift - thing we wrote over
PHA : LDA.b #$01 : STA.l RedrawFlag : PLA
RTL
;--------------------------------------------------------------------------------
@@ -220,7 +213,10 @@ LoadIndoorValue:
LDA.l StandingKey_Hera
JMP .done
+
LDA.w #$0017 ; default to a normal hp
PHX
LDX.w CurrentSpriteSlot ; If we're on a different screen ID via glitches load the sprite
LDA.w SpriteID,X ; we can see and are interacting with
PLX
.done
AND.w #$00FF ; the loads are words but the values are 1-byte so we need to clear the top half of the accumulator - no guarantee it was 8-bit before
PLP
@@ -283,7 +279,10 @@ LoadOutdoorValue:
%GetPossiblyEncryptedItem(HeartPiece_Zora, HeartPieceOutdoorValues)
JMP .done
+
LDA.w #$0017 ; default to a normal hp
PHX
LDX.w CurrentSpriteSlot ; If we're on a different screen ID via glitches load the sprite
LDA.w SpriteID,X ; we can see and are interacting with.
PLX
.done
AND.w #$00FF ; the loads are words but the values are 1-byte so we need to clear the top half of the accumulator - no guarantee it was 8-bit before
PLP
@@ -378,9 +377,9 @@ RTL
;#13 - Ganon's Tower - Agahnim II
;#0 - Pyramid of Power - Ganon
;--------------------------------------------------------------------------------
;JSL $06DD40 ; DashKey_Draw
;JSL $06DBF8 ; Sprite_PrepAndDrawSingleLargeLong
;JSL $06DC00 ; Sprite_PrepAndDrawSingleSmallLong ; draw first cell correctly
;JSL $00D51B ; GetAnimatedSpriteTile
;JSL $00D52D ; GetAnimatedSpriteTile.variable
;JSL $86DD40 ; DashKey_Draw
;JSL $86DBF8 ; Sprite_PrepAndDrawSingleLargeLong
;JSL $86DC00 ; Sprite_PrepAndDrawSingleSmallLong ; draw first cell correctly
;JSL $80D51B ; GetAnimatedSpriteTile
;JSL $80D52D ; GetAnimatedSpriteTile.variable
;================================================================================

215
hextodec.asm Normal file
View File

@@ -0,0 +1,215 @@
;===================================================================================================
; New file because of the enormous table
;===================================================================================================
;--------------------------------------------------------------------------------
; HexToDec
; in: A(w) - Word to Convert
; out: HexToDecDigit1 - HexToDecDigit5 (high - low)
;--------------------------------------------------------------------------------
HexToDec:
PHP
REP #$30
PHX
PHA
CMP.w #1000
BCS .over_1000
ASL
TAX
LDA.l FastHexTable,X
SEP #$20
AND.b #$0F
STA.l HexToDecDigit5
LDA.l FastHexTable,X
LSR
LSR
LSR
LSR
STA.l HexToDecDigit4
XBA
AND.b #$0F
STA.l HexToDecDigit3
REP #$20
LDA.l #$0000
STA.l HexToDecDigit1
PLA
PLX
PLP
RTL
;---------------------------------------------------------------------------------------------------
.over_1000
; get remainder mod100
STA.l $4204
SEP #$20
LDA.b #100
STA.l $4206
PHD
PLD
REP #$20
XBA
LDA.l $4216
AND.w #$7F
ASL
TAX
SEP #$20
LDA.l FastHexTable,X
AND.b #$0F
STA.l HexToDecDigit5
LDA.l FastHexTable,X
AND.b #$F0
LSR
LSR
LSR
LSR
STA.l HexToDecDigit4
REP #$20
LDA.l $4214
ASL
TAX
LDA.l FastHexTable,X
SEP #$20
AND.b #$0F
STA.l HexToDecDigit3
LDA.l FastHexTable,X
LSR
LSR
LSR
LSR
STA.l HexToDecDigit2
XBA
AND.b #$0F
STA.l HexToDecDigit1
REP #$20
PLA
PLX
PLP
RTL
;===================================================================================================
FastHexTable:
dw $000, $001, $002, $003, $004, $005, $006, $007, $008, $009
dw $010, $011, $012, $013, $014, $015, $016, $017, $018, $019
dw $020, $021, $022, $023, $024, $025, $026, $027, $028, $029
dw $030, $031, $032, $033, $034, $035, $036, $037, $038, $039
dw $040, $041, $042, $043, $044, $045, $046, $047, $048, $049
dw $050, $051, $052, $053, $054, $055, $056, $057, $058, $059
dw $060, $061, $062, $063, $064, $065, $066, $067, $068, $069
dw $070, $071, $072, $073, $074, $075, $076, $077, $078, $079
dw $080, $081, $082, $083, $084, $085, $086, $087, $088, $089
dw $090, $091, $092, $093, $094, $095, $096, $097, $098, $099
dw $100, $101, $102, $103, $104, $105, $106, $107, $108, $109
dw $110, $111, $112, $113, $114, $115, $116, $117, $118, $119
dw $120, $121, $122, $123, $124, $125, $126, $127, $128, $129
dw $130, $131, $132, $133, $134, $135, $136, $137, $138, $139
dw $140, $141, $142, $143, $144, $145, $146, $147, $148, $149
dw $150, $151, $152, $153, $154, $155, $156, $157, $158, $159
dw $160, $161, $162, $163, $164, $165, $166, $167, $168, $169
dw $170, $171, $172, $173, $174, $175, $176, $177, $178, $179
dw $180, $181, $182, $183, $184, $185, $186, $187, $188, $189
dw $190, $191, $192, $193, $194, $195, $196, $197, $198, $199
dw $200, $201, $202, $203, $204, $205, $206, $207, $208, $209
dw $210, $211, $212, $213, $214, $215, $216, $217, $218, $219
dw $220, $221, $222, $223, $224, $225, $226, $227, $228, $229
dw $230, $231, $232, $233, $234, $235, $236, $237, $238, $239
dw $240, $241, $242, $243, $244, $245, $246, $247, $248, $249
dw $250, $251, $252, $253, $254, $255, $256, $257, $258, $259
dw $260, $261, $262, $263, $264, $265, $266, $267, $268, $269
dw $270, $271, $272, $273, $274, $275, $276, $277, $278, $279
dw $280, $281, $282, $283, $284, $285, $286, $287, $288, $289
dw $290, $291, $292, $293, $294, $295, $296, $297, $298, $299
dw $300, $301, $302, $303, $304, $305, $306, $307, $308, $309
dw $310, $311, $312, $313, $314, $315, $316, $317, $318, $319
dw $320, $321, $322, $323, $324, $325, $326, $327, $328, $329
dw $330, $331, $332, $333, $334, $335, $336, $337, $338, $339
dw $340, $341, $342, $343, $344, $345, $346, $347, $348, $349
dw $350, $351, $352, $353, $354, $355, $356, $357, $358, $359
dw $360, $361, $362, $363, $364, $365, $366, $367, $368, $369
dw $370, $371, $372, $373, $374, $375, $376, $377, $378, $379
dw $380, $381, $382, $383, $384, $385, $386, $387, $388, $389
dw $390, $391, $392, $393, $394, $395, $396, $397, $398, $399
dw $400, $401, $402, $403, $404, $405, $406, $407, $408, $409
dw $410, $411, $412, $413, $414, $415, $416, $417, $418, $419
dw $420, $421, $422, $423, $424, $425, $426, $427, $428, $429
dw $430, $431, $432, $433, $434, $435, $436, $437, $438, $439
dw $440, $441, $442, $443, $444, $445, $446, $447, $448, $449
dw $450, $451, $452, $453, $454, $455, $456, $457, $458, $459
dw $460, $461, $462, $463, $464, $465, $466, $467, $468, $469
dw $470, $471, $472, $473, $474, $475, $476, $477, $478, $479
dw $480, $481, $482, $483, $484, $485, $486, $487, $488, $489
dw $490, $491, $492, $493, $494, $495, $496, $497, $498, $499
dw $500, $501, $502, $503, $504, $505, $506, $507, $508, $509
dw $510, $511, $512, $513, $514, $515, $516, $517, $518, $519
dw $520, $521, $522, $523, $524, $525, $526, $527, $528, $529
dw $530, $531, $532, $533, $534, $535, $536, $537, $538, $539
dw $540, $541, $542, $543, $544, $545, $546, $547, $548, $549
dw $550, $551, $552, $553, $554, $555, $556, $557, $558, $559
dw $560, $561, $562, $563, $564, $565, $566, $567, $568, $569
dw $570, $571, $572, $573, $574, $575, $576, $577, $578, $579
dw $580, $581, $582, $583, $584, $585, $586, $587, $588, $589
dw $590, $591, $592, $593, $594, $595, $596, $597, $598, $599
dw $600, $601, $602, $603, $604, $605, $606, $607, $608, $609
dw $610, $611, $612, $613, $614, $615, $616, $617, $618, $619
dw $620, $621, $622, $623, $624, $625, $626, $627, $628, $629
dw $630, $631, $632, $633, $634, $635, $636, $637, $638, $639
dw $640, $641, $642, $643, $644, $645, $646, $647, $648, $649
dw $650, $651, $652, $653, $654, $655, $656, $657, $658, $659
dw $660, $661, $662, $663, $664, $665, $666, $667, $668, $669
dw $670, $671, $672, $673, $674, $675, $676, $677, $678, $679
dw $680, $681, $682, $683, $684, $685, $686, $687, $688, $689
dw $690, $691, $692, $693, $694, $695, $696, $697, $698, $699
dw $700, $701, $702, $703, $704, $705, $706, $707, $708, $709
dw $710, $711, $712, $713, $714, $715, $716, $717, $718, $719
dw $720, $721, $722, $723, $724, $725, $726, $727, $728, $729
dw $730, $731, $732, $733, $734, $735, $736, $737, $738, $739
dw $740, $741, $742, $743, $744, $745, $746, $747, $748, $749
dw $750, $751, $752, $753, $754, $755, $756, $757, $758, $759
dw $760, $761, $762, $763, $764, $765, $766, $767, $768, $769
dw $770, $771, $772, $773, $774, $775, $776, $777, $778, $779
dw $780, $781, $782, $783, $784, $785, $786, $787, $788, $789
dw $790, $791, $792, $793, $794, $795, $796, $797, $798, $799
dw $800, $801, $802, $803, $804, $805, $806, $807, $808, $809
dw $810, $811, $812, $813, $814, $815, $816, $817, $818, $819
dw $820, $821, $822, $823, $824, $825, $826, $827, $828, $829
dw $830, $831, $832, $833, $834, $835, $836, $837, $838, $839
dw $840, $841, $842, $843, $844, $845, $846, $847, $848, $849
dw $850, $851, $852, $853, $854, $855, $856, $857, $858, $859
dw $860, $861, $862, $863, $864, $865, $866, $867, $868, $869
dw $870, $871, $872, $873, $874, $875, $876, $877, $878, $879
dw $880, $881, $882, $883, $884, $885, $886, $887, $888, $889
dw $890, $891, $892, $893, $894, $895, $896, $897, $898, $899
dw $900, $901, $902, $903, $904, $905, $906, $907, $908, $909
dw $910, $911, $912, $913, $914, $915, $916, $917, $918, $919
dw $920, $921, $922, $923, $924, $925, $926, $927, $928, $929
dw $930, $931, $932, $933, $934, $935, $936, $937, $938, $939
dw $940, $941, $942, $943, $944, $945, $946, $947, $948, $949
dw $950, $951, $952, $953, $954, $955, $956, $957, $958, $959
dw $960, $961, $962, $963, $964, $965, $966, $967, $968, $969
dw $970, $971, $972, $973, $974, $975, $976, $977, $978, $979
dw $980, $981, $982, $983, $984, $985, $986, $987, $988, $989
dw $990, $991, $992, $993, $994, $995, $996, $997, $998, $999
;===================================================================================================

2600
hooks.asm

File diff suppressed because it is too large Load Diff

86
hud.asm
View File

@@ -1,47 +1,47 @@
;org $0DFE97 ; <- 6FE97 - headsup_display.asm:1009 (.hud_tilemap)
;org $8DFE97 ; <- 6FE97 - headsup_display.asm:1009 (.hud_tilemap)
; DO NOT EXCEED 0x150
HUD_TileMap:
dw $207F, $207F, $2850, $A856
dw $2852, $285B, $285B, $285C
;dw $207F, $3CA8, $207F, $207F, $207F
dw $207F, $207F, $2850, $A856
dw $2852, $285B, $285B, $285C
;dw $207F, $3CA8, $207F, $207F, $207F
dw $207F, $3C02, $3C03, $207F, $207F ; normal mode
;dw $3C02, $3C03, $207F, $207F, $207F ; rupee arrows
dw $2C88, $2C89, $207F, $20A7
dw $20A9, $207F, $2871 ;, $207F
dw $207F, $207F, $288B, $288F
dw $24AB, $24AC, $688F, $688B
dw $207F, $207F, $207F, $207F
dw $207F, $207F, $2854, $2871
dw $2858, $207F, $207F, $285D
dw $207F, $207F, $207F, $207F
dw $207F, $207F, $207F, $207F
dw $207F, $207F, $207F, $207F
dw $207F, $207F, $207F, $207F
dw $207F, $207F, $207F, $207F
dw $207F, $207F, $207F, $207F
dw $207F, $207F, $2854, $304E
dw $2858, $207F, $207F, $285D
dw $207F, $207F, $207F, $207F
dw $207F, $207F, $207F, $207F
dw $207F, $207F, $207F, $207F
dw $207F, $207F, $207F, $207F
dw $207F, $207F, $207F, $207F
dw $207F, $207F, $207F, $207F
dw $207F, $207F, $2854, $305E
dw $2859, $A85B, $A85B, $A85C
dw $207F, $207F, $207F, $207F
dw $207F, $207F, $207F, $207F
dw $207F, $207F, $207F, $207F
dw $207F, $207F, $207F, $207F
dw $207F, $207F, $207F, $207F
dw $207F, $207F, $207F, $207F
dw $207F, $207F, $2854, $305E
dw $6854, $207F, $207F, $207F
dw $207F, $207F, $207F, $207F
dw $207F, $207F, $207F, $207F
dw $207F, $207F, $207F, $207F
dw $207F, $207F, $207F, $207F
dw $207F, $207F, $207F, $207F
dw $207F, $207F, $207F, $207F
dw $207F, $207F, $A850, $2856
dw $E850
dw $2C88, $2C89, $207F, $20A7
dw $20A9, $207F, $2871 ;, $207F
dw $207F, $207F, $288B, $288F
dw $24AB, $24AC, $688F, $688B
dw $207F, $207F, $207F, $207F
dw $207F, $207F, $2854, $2871
dw $2858, $207F, $207F, $285D
dw $207F, $207F, $207F, $207F
dw $207F, $207F, $207F, $207F
dw $207F, $207F, $207F, $207F
dw $207F, $207F, $207F, $207F
dw $207F, $207F, $207F, $207F
dw $207F, $207F, $207F, $207F
dw $207F, $207F, $2854, $304E
dw $2858, $207F, $207F, $285D
dw $207F, $207F, $207F, $207F
dw $207F, $207F, $207F, $207F
dw $207F, $207F, $207F, $207F
dw $207F, $207F, $207F, $207F
dw $207F, $207F, $207F, $207F
dw $207F, $207F, $207F, $207F
dw $207F, $207F, $2854, $305E
dw $2859, $A85B, $A85B, $A85C
dw $207F, $207F, $207F, $207F
dw $207F, $207F, $207F, $207F
dw $207F, $207F, $207F, $207F
dw $207F, $207F, $207F, $207F
dw $207F, $207F, $207F, $207F
dw $207F, $207F, $207F, $207F
dw $207F, $207F, $2854, $305E
dw $6854, $207F, $207F, $207F
dw $207F, $207F, $207F, $207F
dw $207F, $207F, $207F, $207F
dw $207F, $207F, $207F, $207F
dw $207F, $207F, $207F, $207F
dw $207F, $207F, $207F, $207F
dw $207F, $207F, $207F, $207F
dw $207F, $207F, $A850, $2856
dw $E850

45
iframes.asm Normal file
View File

@@ -0,0 +1,45 @@
pushpc
org $8780B9
JSL CalcIFrames
NOP
pullpc
CalcIFrames:
LDA.l IFrames
STA.w $031F
RTL
DrawIFrames:
LDA.l IFrames
AND.w #$00FF
JSL HexToDec
LDY.w #$16EE
LDA.w #$253B
STA.w $0000, Y
LDA.w #$253C
STA.w $0002, Y
LDA.l HexToDecDigit3
AND.w #$00FF
BEQ +
CLC : ADC.w #$2416
STA.w $003E, Y
+
LDA.l HexToDecDigit4
AND.w #$00FF
BNE +
LDA.w #$0011
+ CLC : ADC.w #$2416
STA.w $0040, Y
LDA.l HexToDecDigit5
AND.w #$00FF
BNE +
LDA.w #$0011
+ CLC : ADC.w #$2416
STA.w $0042, Y
RTL

116
improve_items.asm Normal file
View File

@@ -0,0 +1,116 @@
pushpc
org $8DE4FE
JSR.w ItemMenu_DrawEnhanced_Short
org $8DE514
JSR.w ItemMenu_DrawEnhanced_Short
org $8DE52A
JSR.w ItemMenu_DrawEnhanced_Short
org $8DE540
JSR.w ItemMenu_DrawEnhanced_Short
org $8DE556
JSR.w ItemMenu_DrawEnhanced_Short
org $8DE56C
JSR.w ItemMenu_DrawEnhanced_Short
org $8DE5FF
JSR.w ItemMenu_DrawEnhanced_Short
org $8DE615
JSR.w ItemMenu_DrawEnhanced_Short
org $8DE62B
JSR.w ItemMenu_DrawEnhanced_Short
org $8DFB63
JSL.l GetItemLevelForHud
org $8DFFFB
ItemMenu_DrawEnhanced_Short:
JSL.l ItemMenu_DrawEnhanced
RTS
pullpc
ItemMenu_DrawEnhanced:
LDA.b $02
BEQ +
LDA.w #$0008
+ TAY
LDX.b $00
LDA.b ($04),Y
STA.w $0000,X
INY : INY
LDA.b ($04),Y
STA.w $0002,X
INY : INY
LDA.b ($04),Y
STA.w $0040,X
INY : INY
LDA.b ($04),Y
STA.w $0042,X
RTL
AddMagicMarker:
LDA.w ItemCursor : AND.w #$00FF ; load item value
PHX
TAX
LDA.l CanReduceMagic, X : AND.w #$00FF
BEQ .done
LDA.l EquipmentWRAM-1, X : AND.w #$00FF
DEC : DEC
BMI .done
BEQ .half
.quarter
LDA.w #$3D4C
BRA .write
.half
LDA.w #$3D3F
.write
STA.w $FFC2, Y
LDA.w #$3D37
STA.w $FFC0, Y
.done
PLX
RTL
GetItemLevelForHud:
LDA.l CanReduceMagic, X : AND.w #$00FF
BNE + ; it's already $0001, so we can return
LDA.l EquipmentWRAM-1, X ; normal, what we wrote over
+ RTL
CheckMagicLevel:
PHP : SEP #$30
LDA.w ItemCursor ; load item value
TAX
LDA.l CanReduceMagic, X
BEQ .normal
LDA.l EquipmentWRAM-1, X
DEC : DEC
BMI .normal
BEQ .half
.quarter
LDA.b #$02
BRA .write
.half
LDA.b #$01
BRA .write
.normal
LDA.b #$00
.write
STA.l MagicConsumption
PLP
RTL
CanReduceMagic:
db $00
db $00, $00, $00, $00, $00
db $01, $01, $01, $01, $01
db $01, $00, $00, $00, $00
db $00, $01, $01, $01, $00

View File

@@ -48,12 +48,16 @@ Init_Primary:
LDA.l OneMindTimerInit : STA.l OneMindTimerRAM
SEP #$30
LDA.b #$01 : STA.w MEMSEL ; enable fastrom access on upper banks
STA.l OneMindId
LDA.l RomSpeed : STA.w MEMSEL ; enable fastrom access on upper banks
LDA.b #$01 : STA.l OneMindId
LDA.b #$10 : STA.b PlayerSpriteBank ; set default player sprite bank
LDA.b #$81 : STA.w NMITIMEN ; thing we wrote over, turn on NMI & gamepad
RTL
LDA.b #(ReturnFromInit>>16)|$80 : PHA : PLB
JML ReturnFromInit
;--------------------------------------------------------------------------------
; Init_PostRAMClear
;--------------------------------------------------------------------------------
@@ -64,6 +68,35 @@ Init_PostRAMClear:
JSL MSUInit
JSL InitRNGPointerTable
JSL InitDungeonCounts
JSL DecompressAllItemGraphics
JSR InitDungeonCounts
JML $00D463 ; The original target of the jump table that we hijacked
JML $80D463 ; The original target of the jump table that we hijacked
;===================================================================================================
InitDungeonCounts:
PHB
LDX.b #$0F
-
LDA.l CompassTotalsROM, X : STA.l CompassTotalsWRAM, X
DEX
BPL -
LDX.b #$0F
-
LDA.l ChestKeys, X : STA.l MapTotalsWRAM, X
DEX
BPL -
LDA.b #$7E
PHA : PLB
REP #$30
LDA.l TotalItemCount
JSL.l HUDHex4Digit_Long
SEP #$20
LDA.b Scrap04 : TAX : STX.w TotalItemCountTiles+$00
LDA.b Scrap05 : TAX : STX.w TotalItemCountTiles+$02
LDA.b Scrap06 : TAX : STX.w TotalItemCountTiles+$04
LDA.b Scrap07 : TAX : STX.w TotalItemCountTiles+$06
SEP #$10
PLB
RTS

View File

@@ -14,30 +14,30 @@
fillword $0000 ; Zero out the table
fill $500 ;
org $30B000 ; PC 0x183000
org $B0B000 ; PC 0x183000
InitSRAMTable:
InitRoomDataWRAM:
org $30B060 ; PC 0x183060
org $B0B060 ; PC 0x183060
InitATAltarRoom: dw $0000 ; aga curtains
org $30B092 ; PC 0x183092
org $B0B092 ; PC 0x183092
InitSWBackEntryRoom: dw $0000 ; skull woods curtains
org $30B20C
org $B0B20C
dw $F000, $F000 ; Pre-open kak bomb hut & brewery
org $30B280 ; PC 0x183280 - 0x1832FF
org $B0B280 ; PC 0x183280 - 0x1832FF
InitOverworldEvents:
org $30B282 ; PC 0x183282 - Lumberjacks
org $B0B282 ; PC 0x183282 - Lumberjacks
InitLumberjackOW: db $00
org $30B29B ; PC 0x18329B - Open castle gate
org $B0B29B ; PC 0x18329B - Open castle gate
InitHyruleCastleOW: db $20
org $30B2DB ; PC 0x1832DB - Pyramid hole
org $B0B2DB ; PC 0x1832DB - Pyramid hole
InitPyramidOW: db $00
org $30B2C3 ; PC 0x1832C3 - GT
org $B0B2C3 ; PC 0x1832C3 - GT
InitDDMWestOW: db $00
org $30B340 ; PC 0x183340
org $B0B340 ; PC 0x183340
StartingEquipment:
StartingBow: skip 1 ; PC 0x183340
StartingBoomerang: skip 1 ; PC 0x183341
@@ -129,13 +129,13 @@ InitDroppedFollowerIndoors: skip 1 ; PC 0x1833D1
InitDroppedFollowerLayer: skip 1 ; PC 0x1833D2
InitFollowerDropped: skip 1 ; PC 0x1833D3
org $30B3D9 ; PC 0x1833D9 - 0x1833F0
org $B0B3D9 ; PC 0x1833D9 - 0x1833F0
StaticFileName: ; The validity value ($55AA) must be written manually on SRAM init at $7003E1
dw $0181, $0068, $006E, $018C
dw $0166, $0064, $0068, $018C
dw $0165, $0068, $006D, $018C
org $30B401 ; PC 0x183401
org $B0B401 ; PC 0x183401
InitDeathCounter:
dw $FFFF
@@ -147,29 +147,29 @@ dw $FFFF
; excluding ~28 bytes (File name, validity value, and checksum.)
;--------------------------------------------------------------------------------
org $30B414 ; PC 0x183414-0x183416
org $B0B414 ; PC 0x183414-0x183416
InitMapOverlay: dw $0000
org $30B417 ; PC 0x183417
org $B0B417 ; PC 0x183417
InitHighestSword: db $00
org $30B414 ; PC 0x183418-0x183419
org $B0B414 ; PC 0x183418-0x183419
InitGoalCounter: dw $0000
org $30B422 ; PC 0x183422
org $B0B422 ; PC 0x183422
InitHighestShield: db $00
org $30B428 ; PC 0x183428
org $B0B428 ; PC 0x183428
InitMapsCompasses: db $00
org $30B429 ; PC 0x183429
org $B0B429 ; PC 0x183429
InitPendantCounter: db $00
org $30B454 ; PC 0x183454-0x183457
org $B0B454 ; PC 0x183454-0x183457
InitChallengeTimer: dw $0000, $0000
org $30B46E ; PC 0x18346E
org $B0B46E ; PC 0x18346E
InitHighestMail: db $00
org $30B471 ; PC 0x183471
org $B0B471 ; PC 0x183471
InitCrystalCounter: db $00

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

1483
itemdatatables.asm Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -2,39 +2,34 @@
; Item Downgrade Fix
;--------------------------------------------------------------------------------
ItemDowngradeFix:
JSR ItemDowngradeFixMain
JSL CountChestKeyLong
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 #$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
.done
STA.b [Scrap00] ; thing we wrote over part 2
.dontWrite
RTS
RTL
.isPowerGloves
.isBlueShield
.isRedShield
@@ -43,7 +38,7 @@ RTS
.isBowAndArrows
CMP.b [$00] : !BGE .done ; finished if we're upgrading
LDA.b [$00] ; reload old value
RTS
RTL
.isSilverArrowBow
.isRedBoomerang
.isMagicPowder
@@ -54,13 +49,13 @@ RTS
LDA.b [Scrap00] : BNE + ; don't upgrade if we already have the toggle for it
PLA
STA.b [Scrap00]
RTS
RTL
+
PLA
RTS
RTL
.isSword
PHA
LDA.l HighestSword : STA.b Scrap04
LDA.l HighestSword : STA.b Scrap04
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
@@ -71,11 +66,11 @@ RTS
+
PLA
JMP .done
.isUncleSwordShield
.isUncleSwordShield
PHA
LDA.l HighestSword : STA.b [Scrap00] ; already set to 1 if we had no sword, always keep highest
INC.b Scrap00
LDA.l HighestShield : STA.b [Scrap00]
LDA.l HighestSword : STA.b [Scrap00] ; already set to 1 if we had no sword, always keep highest
INC.b Scrap00
LDA.l HighestShield : STA.b [Scrap00]
PLA
RTS
RTL
;================================================================================

View File

@@ -1,113 +1,149 @@
org $328000
table "data/textwordcharmap.txt"
org $B28000
; You have found
; the map of
Notice_MapOf:
db $74, $00, $C2, $00, $B8, $00, $BE, $00, $FF, $00, $B1, $00, $AA, $00, $BF, $00, $AE, $00, $FF, $00, $AF, $00, $B8, $00, $BE, $00, $B7, $00, $AD
db $75, $00, $BD, $00, $B1, $00, $AE, $00, $FF, $00, $B6, $00, $AA, $00, $B9, $00, $FF, $00, $B8, $00, $AF
dw #$7F7F
db $74 : dw "You have found"
db $75 : dw "the map of"
dw $7F7F
; You have found
; the compass of
Notice_CompassOf:
db $74, $00, $C2, $00, $B8, $00, $BE, $00, $FF, $00, $B1, $00, $AA, $00, $BF, $00, $AE, $00, $FF, $00, $AF, $00, $B8, $00, $BE, $00, $B7, $00, $AD
db $75, $00, $BD, $00, $B1, $00, $AE, $00, $FF, $00, $AC, $00, $B8, $00, $B6, $00, $B9, $00, $AA, $00, $BC, $00, $BC, $00, $FF, $00, $B8, $00, $AF
dw #$7F7F
db $74 : dw "You have found"
db $75 : dw "the compass of"
dw $7F7F
; Oh look! it's
; the big key of
Notice_BigKeyOf:
db $74, $00, $B8, $00, $B1, $00, $FF, $00, $B5, $00, $B8, $00, $B8, $00, $B4, $00, $C7, $00, $FF, $00, $B2, $00, $BD, $00, $D8, $00, $BC
db $75, $00, $BD, $00, $B1, $00, $AE, $00, $FF, $00, $AB, $00, $B2, $00, $B0, $00, $FF, $00, $B4, $00, $AE, $00, $C2, $00, $FF, $00, $B8, $00, $AF
dw #$7F7F
db $74 : dw "Oh look! it's"
db $75 : dw "the big key of"
dw $7F7F
; this is a
; This is a
; small key to
Notice_SmallKeyOf:
db $74, $00, $BD, $00, $B1, $00, $B2, $00, $BC, $00, $FF, $00, $B2, $00, $BC, $00, $FF, $00, $AA
db $75, $00, $BC, $00, $B6, $00, $AA, $00, $B5, $00, $B5, $00, $FF, $00, $B4, $00, $AE, $00, $C2, $00, $FF, $00, $BD, $00, $B8
dw #$7F7F
db $74 : dw "This is a"
db $75 : dw "small key to"
dw $7F7F
; light world
; You picked up
Notice_Crystal:
db $74 : dw "You picked up"
dw $7F7F
; Light World
Notice_LightWorld:
db $76, $00, $B5, $00, $B2, $00, $B0, $00, $B1, $00, $BD, $00, $FF, $00, $C0, $00, $B8, $00, $BB, $00, $B5, $00, $AD
dw #$7F7F
db $76 : dw "Light World"
dw $7F7F
; dark world
; Dark World
Notice_DarkWorld:
db $76, $00, $AD, $00, $AA, $00, $BB, $00, $B4, $00, $FF, $00, $C0, $00, $B8, $00, $BB, $00, $B5, $00, $AD
dw #$7F7F
db $76 : dw "Dark World"
dw $7F7F
; Ganons Tower
Notice_GTower:
db $76, $00, $B0, $00, $AA, $00, $B7, $00, $B8, $00, $B7, $00, $BC, $00, $FF, $00, $BD, $00, $B8, $00, $C0, $00, $AE, $00, $BB
dw #$7F7F
db $76 : dw "Ganons Tower"
dw $7F7F
; Turtle Rock
Notice_TRock:
db $76, $00, $BD, $00, $BE, $00, $BB, $00, $BD, $00, $B5, $00, $AE, $00, $FF, $00, $BB, $00, $B8, $00, $AC, $00, $B4
dw #$7F7F
db $76 : dw "Turtle Rock"
dw $7F7F
; Thieves Town
Notice_Thieves:
db $76, $00, $BD, $00, $B1, $00, $B2, $00, $AE, $00, $BF, $00, $AE, $00, $BC, $00, $FF, $00, $BD, $00, $B8, $00, $C0, $00, $B7
dw #$7F7F
db $76 : dw "Thieves Town"
dw $7F7F
; Tower of Hera
Notice_Hera:
db $76, $00, $BD, $00, $B8, $00, $C0, $00, $AE, $00, $BB, $00, $FF, $00, $B8, $00, $AF, $00, $FF, $00, $B1, $00, $AE, $00, $BB, $00, $AA
dw #$7F7F
db $76 : dw "Tower of Hera"
dw $7F7F
; Ice Palace
Notice_Ice:
db $76, $00, $B2, $00, $AC, $00, $AE, $00, $FF, $00, $B9, $00, $AA, $00, $B5, $00, $AA, $00, $AC, $00, $AE
dw #$7F7F
db $76 : dw "Ice Palace"
dw $7F7F
; Skull Woods
Notice_Skull:
db $76, $00, $BC, $00, $B4, $00, $BE, $00, $B5, $00, $B5, $00, $FF, $00, $C0, $00, $B8, $00, $B8, $00, $AD, $00, $BC
dw #$7F7F
db $76 : dw "Skull Woods"
dw $7F7F
; Misery Mire
Notice_Mire:
db $76, $00, $B6, $00, $B2, $00, $BC, $00, $AE, $00, $BB, $00, $C2, $00, $FF, $00, $B6, $00, $B2, $00, $BB, $00, $AE
dw #$7F7F
db $76 : dw "Misery Mire"
dw $7F7F
; Dark Palace
Notice_PoD:
db $76, $00, $AD, $00, $AA, $00, $BB, $00, $B4, $00, $FF, $00, $B9, $00, $AA, $00, $B5, $00, $AA, $00, $AC, $00, $AE
dw #$7F7F
db $76 : dw "Dark Palace"
dw $7F7F
; Swamp Palace
Notice_Swamp:
db $76, $00, $BC, $00, $C0, $00, $AA, $00, $B6, $00, $B9, $00, $FF, $00, $B9, $00, $AA, $00, $B5, $00, $AA, $00, $AC, $00, $AE
dw #$7F7F
db $76 : dw "Swamp Palace"
dw $7F7F
; Castle Tower
Notice_AgaTower:
db $76, $00, $AC, $00, $AA, $00, $BC, $00, $BD, $00, $B5, $00, $AE, $00, $FF, $00, $BD, $00, $B8, $00, $C0, $00, $AE, $00, $BB
dw #$7F7F
db $76 : dw "Castle Tower"
dw $7F7F
; Desert Palace
Notice_Desert:
db $76, $00, $AD, $00, $AE, $00, $BC, $00, $AE, $00, $BB, $00, $BD, $00, $FF, $00, $B9, $00, $AA, $00, $B5, $00, $AA, $00, $AC, $00, $AE
dw #$7F7F
db $76 : dw "Desert Palace"
dw $7F7F
; Eastern Palace
Notice_Eastern:
db $76, $00, $AE, $00, $AA, $00, $BC, $00, $BD, $00, $AE, $00, $BB, $00, $B7, $00, $FF, $00, $B9, $00, $AA, $00, $B5, $00, $AA, $00, $AC, $00, $AE
dw #$7F7F
db $76 : dw "Eastern Palace"
dw $7F7F
; Hyrule Castle
Notice_Castle:
db $76, $00, $B1, $00, $C2, $00, $BB, $00, $BE, $00, $B5, $00, $AE, $00, $FF, $00, $AC, $00, $AA, $00, $BC, $00, $BD, $00, $B5, $00, $AE
dw #$7F7F
db $76 : dw "Hyrule Castle"
dw $7F7F
; Hyrule Castle
Notice_Sewers:
db $76, $00, $B1, $00, $C2, $00, $BB, $00, $BE, $00, $B5, $00, $AE, $00, $FF, $00, $AC, $00, $AA, $00, $BC, $00, $BD, $00, $B5, $00, $AE
dw #$7F7F
db $76 : dw "Hyrule Castle"
dw $7F7F
; This Dungeon
Notice_Self:
db $76, $00, $BD, $00, $B1, $00, $B2, $00, $BC, $00, $FF, $00, $AD, $00, $BE, $00, $B7, $00, $B0, $00, $AE, $00, $B8, $00, $B7
dw #$7F7F
db $76 : dw "this dungeon"
dw $7F7F
; Crystal numbers
Notice_One:
db $75 : dw "crystal one"
dw $7F7F
Notice_Two:
db $75 : dw "crystal two"
dw $7F7F
Notice_Three:
db $75 : dw "crystal three"
dw $7F7F
Notice_Four:
db $75 : dw "crystal four"
dw $7F7F
Notice_Five:
db $75 : dw "crystal five"
dw $7F7F
Notice_Six:
db $75 : dw "crystal six"
dw $7F7F
Notice_Seven:
db $75 : dw "crystal seven"
dw $7F7F

View File

@@ -1,113 +0,0 @@
org $328000
; You have found
; the map of
Notice_MapOf:
db $74, $00, $C2, $00, $3E, $00, $44, $00, $FF, $00, $37, $00, $30, $00, $45, $00, $34, $00, $FF, $00, $35, $00, $3E, $00, $44, $00, $3D, $00, $33
db $75, $00, $43, $00, $37, $00, $34, $00, $FF, $00, $3C, $00, $30, $00, $3F, $00, $FF, $00, $3E, $00, $35
dw #$7F7F
; You have found
; the compass of
Notice_CompassOf:
db $74, $00, $C2, $00, $3E, $00, $44, $00, $FF, $00, $37, $00, $30, $00, $45, $00, $34, $00, $FF, $00, $35, $00, $3E, $00, $44, $00, $3D, $00, $33
db $75, $00, $43, $00, $37, $00, $34, $00, $FF, $00, $32, $00, $3E, $00, $3C, $00, $3F, $00, $30, $00, $42, $00, $42, $00, $FF, $00, $3E, $00, $35
dw #$7F7F
; Oh look! it's
; the big key of
Notice_BigKeyOf:
db $74, $00, $B8, $00, $37, $00, $FF, $00, $3B, $00, $3E, $00, $3E, $00, $3A, $00, $C7, $00, $FF, $00, $38, $00, $43, $00, $D8, $00, $42
db $75, $00, $43, $00, $37, $00, $34, $00, $FF, $00, $31, $00, $38, $00, $36, $00, $FF, $00, $3A, $00, $34, $00, $48, $00, $FF, $00, $3E, $00, $35
dw #$7F7F
; this is a
; small key to
Notice_SmallKeyOf:
db $74, $00, $BD, $00, $37, $00, $38, $00, $42, $00, $FF, $00, $38, $00, $42, $00, $FF, $00, $30
db $75, $00, $42, $00, $3C, $00, $30, $00, $3B, $00, $3B, $00, $FF, $00, $3A, $00, $34, $00, $48, $00, $FF, $00, $43, $00, $3e
dw #$7F7F
; light world
Notice_LightWorld:
db $76, $00, $B5, $00, $38, $00, $36, $00, $37, $00, $43, $00, $FF, $00, $C0, $00, $3E, $00, $41, $00, $3B, $00, $33
dw #$7F7F
; dark world
Notice_DarkWorld:
db $76, $00, $AD, $00, $30, $00, $41, $00, $3A, $00, $FF, $00, $C0, $00, $3E, $00, $41, $00, $3B, $00, $33
dw #$7F7F
; Ganons Tower
Notice_GTower:
db $76, $00, $B0, $00, $30, $00, $3D, $00, $3E, $00, $3D, $00, $42, $00, $FF, $00, $BD, $00, $3E, $00, $46, $00, $34, $00, $41
dw #$7F7F
; Turtle Rock
Notice_TRock:
db $76, $00, $BD, $00, $44, $00, $41, $00, $43, $00, $3B, $00, $34, $00, $FF, $00, $BB, $00, $3E, $00, $32, $00, $3a
dw #$7F7F
; Thieves Town
Notice_Thieves:
db $76, $00, $BD, $00, $37, $00, $38, $00, $34, $00, $45, $00, $34, $00, $42, $00, $FF, $00, $BD, $00, $3E, $00, $46, $00, $3d
dw #$7F7F
; Tower of Hera
Notice_Hera:
db $76, $00, $BD, $00, $3E, $00, $46, $00, $34, $00, $41, $00, $FF, $00, $3E, $00, $35, $00, $FF, $00, $B1, $00, $34, $00, $41, $00, $30
dw #$7F7F
; Ice Palace
Notice_Ice:
db $76, $00, $B2, $00, $32, $00, $34, $00, $FF, $00, $B9, $00, $30, $00, $3B, $00, $30, $00, $32, $00, $34
dw #$7F7F
; Skull Woods
Notice_Skull:
db $76, $00, $BC, $00, $3A, $00, $44, $00, $3B, $00, $3B, $00, $FF, $00, $C0, $00, $3E, $00, $3E, $00, $33, $00, $42
dw #$7F7F
; Misery Mire
Notice_Mire:
db $76, $00, $B6, $00, $38, $00, $42, $00, $34, $00, $41, $00, $48, $00, $FF, $00, $B6, $00, $38, $00, $41, $00, $34
dw #$7F7F
; Dark Palace
Notice_PoD:
db $76, $00, $AD, $00, $30, $00, $41, $00, $3A, $00, $FF, $00, $B9, $00, $30, $00, $3B, $00, $30, $00, $32, $00, $34
dw #$7F7F
; Swamp Palace
Notice_Swamp:
db $76, $00, $BC, $00, $46, $00, $30, $00, $3C, $00, $3F, $00, $FF, $00, $B9, $00, $30, $00, $3B, $00, $30, $00, $32, $00, $34
dw #$7F7F
; Castle Tower
Notice_AgaTower:
db $76, $00, $AC, $00, $30, $00, $42, $00, $43, $00, $3B, $00, $34, $00, $FF, $00, $BD, $00, $3E, $00, $46, $00, $34, $00, $41
dw #$7F7F
; Desert Palace
Notice_Desert:
db $76, $00, $AD, $00, $34, $00, $42, $00, $34, $00, $41, $00, $43, $00, $FF, $00, $B9, $00, $30, $00, $3B, $00, $30, $00, $32, $00, $34
dw #$7F7F
; Eastern Palace
Notice_Eastern:
db $76, $00, $AE, $00, $30, $00, $42, $00, $43, $00, $34, $00, $41, $00, $3D, $00, $FF, $00, $B9, $00, $30, $00, $3B, $00, $30, $00, $32, $00, $34
dw #$7F7F
; Hyrule Castle
Notice_Castle:
db $76, $00, $B1, $00, $48, $00, $41, $00, $44, $00, $3B, $00, $34, $00, $FF, $00, $AC, $00, $30, $00, $42, $00, $43, $00, $3B, $00, $34
dw #$7F7F
; Hyrule Castle
Notice_Sewers:
db $76, $00, $B1, $00, $48, $00, $41, $00, $44, $00, $3B, $00, $34, $00, $FF, $00, $AC, $00, $30, $00, $42, $00, $43, $00, $3B, $00, $34
dw #$7F7F
; This Dungeon
Notice_Self:
db $76, $00, $43, $00, $37, $00, $38, $00, $42, $00, $FF, $00, $33, $00, $44, $00, $3D, $00, $36, $00, $34, $00, $3E, $00, $3d
dw #$7F7F

View File

@@ -5,28 +5,28 @@
;--------------------------------------------------------------------------------
LampCheck:
LDA.l LightConeModifier : CMP.b #$01 : BNE + : RTL : +
CMP.b #$FF : BNE + : INC : RTL : +
LDA.l LampEquipment : BNE .lamp ; skip if we already have lantern
LDA.w DungeonID : BNE + ; check if we're in sewers
LDA.l LampConeSewers : RTL
+ : TDC
.lamp
CMP.b #$FF : BNE + : INC : RTL : +
LDA.l LampEquipment : BNE .lamp ; skip if we already have lantern
LDA.w DungeonID : BNE + ; check if we're in sewers
LDA.l LampConeSewers : RTL
+ : TDC
.lamp
RTL
;================================================================================
;--------------------------------------------------------------------------------
; Output: 0 locked, 1 open
;--------------------------------------------------------------------------------
CheckForZelda:
LDA.l ProgressIndicator : CMP.b #$02 : !BLT + ; Skip if rain is falling
LDA.b #$01 ; pretend we have zelda anyway
RTL
+
LDA.l FollowerIndicator
LDA.l ProgressIndicator : CMP.b #$02 : !BLT + ; Skip if rain is falling
LDA.b #$01 ; pretend we have zelda anyway
RTL
+
LDA.l FollowerIndicator
RTL
;================================================================================
SetOverlayIfLamp:
JSL.l LampCheck
STA.b SUBDESQ ; write it directly to the overlay, this isn't a terrible idea at all
JSL.l LampCheck
STA.b SUBDESQ ; write it directly to the overlay, this isn't a terrible idea at all
RTL
;================================================================================
; Mantle Object Changes

51
lift.asm Normal file
View File

@@ -0,0 +1,51 @@
pushpc
org $87D35E
db $01, $02, $01, $01, $03, $02, $03
org $8DF809
MenuEquipmentIcons:
.gloves
dw $2121, $2122, $2123, $2124 ; No glove
dw $3CDA, $3CDB, $3CEA, $3CEB ; Weak glove
dw $2130, $2131, $2140, $2141 ; Power glove
dw $28DA, $28DB, $28EA, $28EB ; Titan's mitt
.boots
dw $20F5, $20F5, $20F5, $20F5 ; No boots
dw $3429, $342A, $342B, $342C ; Pegasus boots
.flippers
dw $20F5, $20F5, $20F5, $20F5 ; No flippers
dw $2C9A, $2C9B, $2C9D, $2C9E ; Flippers
.pearl
dw $20F5, $20F5, $20F5, $20F5 ; No pearl
dw $2433, $2434, $2435, $2436 ; Moon pearl
org $8DE7C7
LDA.w #MenuEquipmentIcons_gloves
org $8DE7DD
LDA.w #MenuEquipmentIcons_boots
org $8DE7F3
LDA.w #MenuEquipmentIcons_flippers
org $8DECF9
LDA.w #MenuEquipmentIcons_pearl
org $8DFADB
dw MenuEquipmentIcons_gloves
dw MenuEquipmentIcons_boots
dw MenuEquipmentIcons_flippers
dw MenuEquipmentIcons_pearl
pullpc
LoadModifiedGloveValue:
LDA.l GloveEquipment : AND.w #$00FF
BEQ .done
DEC
.done
RTL

View File

@@ -14,5 +14,5 @@ MaidenCrystalScript:
LDA.l CrystalsField : AND.b #$7F : CMP.b #$7F : BNE + ; check if we have all crystals
LDA.b #$08 : STA.l MapIcons ; Update the map icon to just be Ganon's Tower
+
JML.l $1ECF35 ; <- F4F35 - sprite_crystal_maiden.asm : 426
JML.l $9ECF35 ; <- F4F35 - sprite_crystal_maiden.asm : 426
;--------------------------------------------------------------------------------

17
mothula.asm Normal file
View File

@@ -0,0 +1,17 @@
pushpc
org $9EBF01 ; z_speed
db 2, -2
org $9EBF03 ; y_speed and x_speed
db -32, -24, 0, 24, 32, 24, 0, -24, -32, -24
org $9EBFD3 ; beam speeds
db -24, 0, 24
db 36, 48, 36
org $9EBD6E ; spike max speed and acceleration
db 64, -64, 0, 0, 64, -64
db 2, -2, 0, 0, 2, -2
pullpc

90
msu.asm
View File

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

View File

@@ -103,7 +103,7 @@ Overworld_FinishMirrorWarp:
LDA.w #$0000 : STA.l FadeTimer : STA.l FadeDirection
SEP #$20
JSL $00D7C8
JSL $80D7C8
LDA.b #$80 : STA.b HDMAENQ
LDX.b #$04 ; bunny theme
@@ -245,10 +245,10 @@ RTL
;
; On entry, A = $8A (overworld area being loaded)
Overworld_MosaicDarkWorldChecks:
CMP.b #$40 : beq .checkCrystals
CMP.b #$42 : beq .checkCrystals
CMP.b #$50 : beq .checkCrystals
CMP.b #$51 : bne .doFade
CMP.b #$40 : BEQ .checkCrystals
CMP.b #$42 : BEQ .checkCrystals
CMP.b #$50 : BEQ .checkCrystals
CMP.b #$51 : BNE .doFade
.checkCrystals
LDA.l CrystalsField : CMP.b #$7F : BEQ .done

View File

@@ -1,273 +1,508 @@
!InfiniteTile = $2431
!BlankTile = $207F
!SlashTile = $2830
!PTile = $296C
!CTile = $295F
NewDrawHud:
SEP #$30
;================================================================================
; Draw bomb count
;================================================================================
PHB
JSL CheckInfiniteBombs : BNE .infinite_bombs
.finite_bombs
LDA.l SpecialWeapons : CMP #$01 : BNE .normal
LDA.l SpecialWeaponLevel : BEQ .no_bombs
.normal
LDA.l BombsEquipment ; bombs
JSR HudHexToDec2Digit ; requires 8 bit registers!
REP #$20
LDX.b Scrap06 : TXA : ORA.w #$2400 : STA.l HUDBombCount ; Draw bombs 10 digit
LDX.b Scrap07 : TXA : ORA.w #$2400 : STA.l HUDBombCount+2 ; Draw bombs 1 digit
BRA +
SEP #$30
REP #$10
.no_bombs
REP #$20
LDA.w #$207F : STA HUDBombCount
STA HUDBombCount+2
BRA +
.infinite_bombs
REP #$20
LDA.w #$2431 : STA.l HUDBombCount ; infinity (left half)
INC A : STA.l HUDBombCount+2 ; infinity (right half)
+
LDA.b #$7E
PHA : PLB
;================================================================================
; Draw rupee counter
;================================================================================
LDA.l DisplayRupees ; Drawing bombs (above) always ends with 16-bit A, so, no need to REP here
JSR HudHexToDec4Digit
LDX.b Scrap04 : TXA : ORA.w #$2400 : STA.l HUDRupees ; 1000s
LDX.b Scrap05 : TXA : ORA.w #$2400 : STA.l HUDRupees+2 ; 100s
LDX.b Scrap06 : TXA : ORA.w #$2400 : STA.l HUDRupees+4 ; 10s
LDX.b Scrap07 : TXA : ORA.w #$2400 : STA.l HUDRupees+6 ; 1s
;================================================================================
; Draw arrow count
;================================================================================
NewHUD_DrawBombs:
LDA.l InfiniteBombs : BEQ .finite
SEP #$20
LDA.l ArrowMode : BNE +
LDA.l InfiniteArrows : BNE .infinite_arrows
.finite_arrows
LDA.l CurrentArrows ; arrows
JSR HudHexToDec2Digit
REP #$20
LDX.b Scrap06 : TXA : ORA.w #$2400 : STA.l HUDArrowCount ; Draw arrows 10 digit
LDX.b Scrap07 : TXA : ORA.w #$2400 : STA.l HUDArrowCount+2 ; Draw arrows 1 digit
BRA +
.infinite_arrows
REP #$20
LDA.w #$2431 : STA.l HUDArrowCount ; infinity (left half)
INC A : STA.l HUDArrowCount+2 ; infinity (right half)
+
;================================================================================
; Draw Goal Item Indicator
;================================================================================
.infinite
LDY.w #!InfiniteTile+0
LDX.w #!InfiniteTile+1
BRA .draw
REP #$20
LDA.l GoalItemRequirement : BNE + : JMP .done : + ; Star Meter
.finite
LDA.w BombsEquipment
JSR HUDHex2Digit
.draw
STY.w HUDBombCount+0
STX.w HUDBombCount+2
;================================================================================
NewHUD_DrawRupees:
REP #$20
LDA.w DisplayRupees
JSR HUDHex4Digit
LDA.b Scrap04 : TAX : STX.w HUDRupees+0 ; 1000s
LDA.b Scrap05 : TAX : STX.w HUDRupees+2 ; 100s
LDA.b Scrap06 : TAX : STX.w HUDRupees+4 ; 10s
LDA.b Scrap07 : TAX : STX.w HUDRupees+6 ; 1s
;================================================================================
NewHUD_DrawArrows:
SEP #$20
LDA.l ArrowMode : BNE NewHUD_DrawGoal
LDA.l InfiniteArrows : BEQ .finite
.infinite
LDY.w #!InfiniteTile+0
LDX.w #!InfiniteTile+1
BRA .draw
.finite
LDA.w CurrentArrows
JSR HUDHex2Digit
.draw
STY.w HUDArrowCount+0
STX.w HUDArrowCount+2
;================================================================================
NewHUD_DrawGoal:
REP #$20
LDA.l UpdateHUDFlag : BEQ .no_goal
LDA.l GoalItemRequirement : BEQ .no_goal
LDA.l GoalItemIcon : STA.w HUDGoalIndicator
LDA.w #!SlashTile : STA.w HUDGoalIndicator+8
LDA.l GoalCounter
JSR HudHexToDec4Digit
JSR HUDHex4Digit
LDA.b Scrap05 : TAX : STX.w HUDGoalIndicator+2 ; draw 100's digit
LDA.b Scrap06 : TAX : STX.w HUDGoalIndicator+4 ; draw 10's digit
LDA.b Scrap07 : TAX : STX.w HUDGoalIndicator+6 ; draw 1's digit
REP #$20
LDA.l GoalItemRequirement : CMP.w #$FFFF : BNE .real_goal
LDX.w #!BlankTile
STX.w HUDGoalIndicator+10
STX.w HUDGoalIndicator+12
STX.w HUDGoalIndicator+14
.no_goal
SEP #$20
BRA NewHUD_DrawKeys
.real_goal
JSR HUDHex4Digit
LDA.b Scrap05 : TAX : STX.w HUDGoalIndicator+10 ; draw 100's digit
LDA.b Scrap06 : TAX : STX.w HUDGoalIndicator+12 ; draw 10's digit
LDA.b Scrap07 : TAX : STX.w HUDGoalIndicator+14 ; draw 1's digit
LDA.l GoalItemIcon : STA.l HUDGoalIndicator ; draw star icon
LDX.b Scrap05 : TXA : ORA.w #$2400 : STA.l HUDGoalIndicator+2 ; draw 100's digit
LDX.b Scrap06 : TXA : ORA.w #$2400 : STA.l HUDGoalIndicator+4 ; draw 10's digit
LDX.b Scrap07 : TXA : ORA.w #$2400 : STA.l HUDGoalIndicator+6 ; draw 1's digit
LDA.l GoalItemRequirement : CMP.w #$FFFF : BEQ .skip
LDA.l GoalItemRequirement
JSR HudHexToDec4Digit
LDA.w #$2830 : STA.l HUDGoalIndicator+8 ; draw slash
LDX.b Scrap05 : TXA : ORA.w #$2400 : STA.l HUDGoalIndicator+10 ; draw 100's digit
LDX.b Scrap06 : TXA : ORA.w #$2400 : STA.l HUDGoalIndicator+12 ; draw 10's digit
LDX.b Scrap07 : TXA : ORA.w #$2400 : STA.l HUDGoalIndicator+14 ; draw 1's digit
BRA .done
.skip
LDA.w #$207F ; transparent tile
STA.l HUDGoalIndicator+8
STA.l HUDGoalIndicator+10
STA.l HUDGoalIndicator+12
.done
;================================================================================
; Draw Dungeon Compass Counts
NewHUD_DrawKeys:
LDA.l CurrentSmallKeys
CMP.b #$FF
BNE .in_dungeon
LDY.w #!BlankTile
STY.w HUDKeyIcon
STY.w HUDKeyDigits+0
STY.w HUDKeyDigits+2
BRA NewHUD_DrawDungeonCounters
.in_dungeon
JSR HUDHex2Digit
CPY.w #$2490
BNE .real_10s
LDY.w #!BlankTile
.real_10s
STY.w HUDKeyDigits+0
STX.w HUDKeyDigits+2
;================================================================================
LDA.l CompassMode : ORA.l MapHUDMode : BIT #$0003 : BEQ +
JSL.l DrawDungeonItemCounts ; compasses.asm
NewHUD_DrawDungeonCounters:
LDA.l UpdateHUDFlag : BEQ NewHUD_DrawPrizeIcon
LDA.l CompassMode : ORA.l MapHUDMode : BIT.b #$03 : BEQ NewHUD_DrawPrizeIcon
LDX.b IndoorsFlag : BNE +
JMP.w NewHUD_DrawMagicMeter
+
SEP #$30
; extra hard safeties for getting dungeon ID to prevent crashes
LDA.w DungeonID
CMP.b #$1B : BCS NewHUD_DrawPrizeIcon ; Skip if not in a valid dungeon ID
AND.b #$FE : TAX
LSR : TAY
PHX : PHY
JSR.w DrawCompassCounts
SEP #$10
PLY : PLX
JSR.w DrawMapCounts
;================================================================================
; Draw key count
;================================================================================
SEP #$20
LDA.l CurrentSmallKeys : CMP.b #$FF : BEQ .not_in_dungeon
.in_dungeon
JSR HudHexToDec2Digit : REP #$20
; if 10s digit is 0, draw transparent tile instead of 0
LDX.b Scrap06 : TXA : CPX.b #$90 : BNE +
LDA.w #$007F
+
ORA.w #$2400 : STA.l HUDKeyDigits
; 1s digit
LDX.b Scrap07 : TXA : ORA.w #$2400 : STA.l HUDKeyDigits+2
BRA .done_keys
.not_in_dungeon
REP #$20
;in the overworld, draw transparent tiles instead of key count
LDA.w #$247F : STA.l HUDKeyDigits : STA.l HUDKeyDigits+2
STA.l HUDKeyIcon
.done_keys
NewHUD_DrawPrizeIcon:
REP #$10
SEP #$20
LDA.b GameMode
CMP.b #$12 : BEQ .no_prize
CMP.b #$0E : BEQ +
LDA.l UpdateHUDFlag : BEQ NewHUD_DrawItemCounter
+
LDA.w DungeonID
CMP.b #$1A : BCS .no_prize
CMP.b #$04 : BCC .no_prize
CMP.b #$08 : BNE .dungeon
.no_prize
LDY.w #!BlankTile
BRA .draw_prize
;--------------------------------------------------------------------------------
; Draw pendant/crystal icon
;--------------------------------------------------------------------------------
!P_ICON = $296C
!C_ICON = $295F
SEP #$20
LDA.b IndoorsFlag : BEQ .noprize
LDX.w DungeonID
CPX #$1A : !BGE .noprize
CPX #$04 : !BLT .noprize
CPX #$08 : BEQ .noprize
LDA.b GameMode : CMP.b #$12 : BEQ .noprize
.dungeon
SEP #$30
TAX
LSR
TAY
LDA.l MapMode
REP #$20
BEQ .drawprize
REP #$30
BEQ .prize
LDA.l MapField
AND.l DungeonItemMasks,X
BEQ .noprize
BEQ .no_prize
.drawprize
TXA : LSR : TAX
LDA.l CrystalPendantFlags_2, X
AND.w #$0040 : BNE .is_crystal
.prize
TYX
LDA.l CrystalPendantFlags_2,X
BIT.w #$0080
BNE .no_icon
LDA.w #!P_ICON
BRA .doneprize
BIT.w #$0040
BNE .crystal
.is_crystal
LDA.w #!C_ICON
BRA .doneprize
LDY.w #!PTile
BRA .draw_prize
.noprize
REP #$20
LDA.w #$207F
.crystal
LDY.w #!CTile
BRA .draw_prize
.doneprize
STA.l HUDPrizeIcon
.no_icon
LDY.w #!BlankTile
;--------------------------------------------------------------------------------
; Draw Magic Meter
.draw_prize
STY.w HUDPrizeIcon
;================================================================================
NewHUD_DrawItemCounter:
REP #$20
LDA.l UpdateHUDFlag : BEQ NewHUD_DrawMagicMeter
LDA.l ItemCounterHUD : AND.w #$00FF : BEQ NewHUD_DrawMagicMeter
LDA.w #!SlashTile : STA.w HUDGoalIndicator+$08
LDA.l TotalItemCount : CMP.w #1000 : BCS .item_four_digits
LDA.w TotalItemCountTiles+$02 : STA.w HUDGoalIndicator+$0A
LDA.w TotalItemCountTiles+$04 : STA.w HUDGoalIndicator+$0C
LDA.w TotalItemCountTiles+$06 : STA.w HUDGoalIndicator+$0E
LDA.w TotalItemCounter
JSR.w HUDHex4Digit
LDA.b $05 : TAX : STX.w HUDGoalIndicator+$02
LDA.b $06 : TAX : STX.w HUDGoalIndicator+$04
LDA.b $07 : TAX : STX.w HUDGoalIndicator+$06
BRA NewHUD_DrawMagicMeter
.item_four_digits
LDA.w TotalItemCountTiles+$00 : STA.w HUDGoalIndicator+$0A
LDA.w TotalItemCountTiles+$02 : STA.w HUDGoalIndicator+$0C
LDA.w TotalItemCountTiles+$04 : STA.w HUDGoalIndicator+$0E
LDA.w TotalItemCountTiles+$06 : STA.w HUDGoalIndicator+$10
LDA.w TotalItemCounter
JSR.w HUDHex4Digit
LDA.b $04 : TAX : STX.w HUDGoalIndicator+$00
LDA.b $05 : TAX : STX.w HUDGoalIndicator+$02
LDA.b $06 : TAX : STX.w HUDGoalIndicator+$04
LDA.b $07 : TAX : STX.w HUDGoalIndicator+$06
;================================================================================
DrawMagicMeter_mp_tilemap = $0DFE0F
;--------------------------------------------------------------------------------
LDA.l CurrentMagic : AND.w #$00FF ; crap we wrote over when placing the hook for OnDrawHud
!ADD #$0007
AND.w #$FFF8
TAX ; end of crap
LDA.l InfiniteMagic : AND.w #$00FF : BNE + : JMP .green : +
SEP #$20 : LDA.b #$80 : STA.l CurrentMagic : REP #$30 ; set magic to max
LDX.w #$0080 ; load full magic meter graphics
LDA.b FrameCounter : AND.w #$000C : LSR #2
BEQ .red
CMP.w #0001 : BEQ .yellow
CMP.w #0002 : BNE + : JMP .green : +
.blue
LDA.l DrawMagicMeter_mp_tilemap+0, X : AND.w #$EFFF : STA.l HUDTileMapBuffer+$46
LDA.l DrawMagicMeter_mp_tilemap+2, X : AND.w #$EFFF : STA.l HUDTileMapBuffer+$86
LDA.l DrawMagicMeter_mp_tilemap+4, X : AND.w #$EFFF : STA.l HUDTileMapBuffer+$C6
LDA.l DrawMagicMeter_mp_tilemap+6, X : AND.w #$EFFF : STA.l HUDTileMapBuffer+$06
RTL
.red
LDA.l DrawMagicMeter_mp_tilemap+0, X : AND.w #$E7FF : STA.l HUDTileMapBuffer+$46
LDA.l DrawMagicMeter_mp_tilemap+2, X : AND.w #$E7FF : STA.l HUDTileMapBuffer+$86
LDA.l DrawMagicMeter_mp_tilemap+4, X : AND.w #$E7FF : STA.l HUDTileMapBuffer+$C6
LDA.l DrawMagicMeter_mp_tilemap+6, X : AND.w #$E7FF : STA.l HUDTileMapBuffer+$06
RTL
.yellow
LDA.l DrawMagicMeter_mp_tilemap+0, X : AND.w #$EBFF : STA.l HUDTileMapBuffer+$46
LDA.l DrawMagicMeter_mp_tilemap+2, X : AND.w #$EBFF : STA.l HUDTileMapBuffer+$86
LDA.l DrawMagicMeter_mp_tilemap+4, X : AND.w #$EBFF : STA.l HUDTileMapBuffer+$C6
LDA.l DrawMagicMeter_mp_tilemap+6, X : AND.w #$EBFF : STA.l HUDTileMapBuffer+$0106
RTL
.orange
LDA.l DrawMagicMeter_mp_tilemap+0, X : AND.w #$E3FF : STA.l HUDTileMapBuffer+$46
LDA.l DrawMagicMeter_mp_tilemap+2, X : AND.w #$E3FF : STA.l HUDTileMapBuffer+$86
LDA.l DrawMagicMeter_mp_tilemap+4, X : AND.w #$E3FF : STA.l HUDTileMapBuffer+$C6
LDA.l DrawMagicMeter_mp_tilemap+6, X : AND.w #$E3FF : STA.l HUDTileMapBuffer+$0106
RTL
.green
LDA.l DrawMagicMeter_mp_tilemap+0, X : STA.l HUDTileMapBuffer+$46
LDA.l DrawMagicMeter_mp_tilemap+2, X : STA.l HUDTileMapBuffer+$86
LDA.l DrawMagicMeter_mp_tilemap+4, X : STA.l HUDTileMapBuffer+$C6
LDA.l DrawMagicMeter_mp_tilemap+6, X : STA.l HUDTileMapBuffer+$0106
RTL
NewHUD_DrawMagicMeter:
SEP #$31
LDA.l CurrentMagic
ADC.b #$06 ; carry set by above for +1 to get +7
AND.b #$F8
TAY
LDA.l InfiniteMagic
BEQ .set_index
.infinite_magic
LDA.b #$80
STA.w CurrentMagic
TAY
LDA.b FrameCounter
REP #$30
AND.w #$000C
LSR
BRA .recolor
.set_index ; this branch is always 0000 when taken
REP #$30
TDC
.recolor
TAX
LDA.l MagicMeterColorMasks,X
TYX
TAY : AND.l DrawMagicMeter_mp_tilemap+0,X : STA.w HUDTileMapBuffer+$046
TYA : AND.l DrawMagicMeter_mp_tilemap+2,X : STA.w HUDTileMapBuffer+$086
TYA : AND.l DrawMagicMeter_mp_tilemap+4,X : STA.w HUDTileMapBuffer+$0C6
TYA : AND.l DrawMagicMeter_mp_tilemap+6,X : STA.w HUDTileMapBuffer+$106
;================================================================================
; 16-bit A, 8-bit X
; in: A(b) - Byte to Convert
; out: $04 - $07 (high - low)
NewHUD_DoneDrawing:
LDA.w #$0000 : STA.l UpdateHUDFlag
PLB
RTL
;================================================================================
HudHexToDec4Digit:
LDY.b #$90
-
CMP.w #1000 : !BLT +
INY
SBC.w #1000 : BRA -
+
STY.b Scrap04 : LDY.b #$90 ; Store 1000s digit & reset Y
-
CMP.w #100 : !BLT +
INY
SBC.w #100 : BRA -
+
STY.b Scrap05 : LDY.b #$90 ; Store 100s digit & reset Y
-
CMP.w #10 : !BLT +
INY
SBC.w #10 : BRA -
+
STY.b Scrap06 : LDY.b #$90 ; Store 10s digit & reset Y
CMP.w #1 : !BLT +
-
INY
DEC : BNE -
+
STY.b Scrap07 ; Store 1s digit
MagicMeterColorMasks:
dw $FFFF ; green - KEEP GREEN FIRST
dw $EFFF ; blue
dw $E7FF ; red
dw $EBFF ; yellow
dw $E3FF ; orange
;================================================================================
DrawCompassCounts:
LDA.l CompassMode : BEQ .done
; no compass needed if this bit is set
BIT.b #$02 : BNE .draw_compass_count
REP #$20
LDA.l CompassField : AND.l DungeonItemMasks,X : BEQ .done
.draw_compass_count
SEP #$20
TYX : BNE .not_sewers
INX
.not_sewers
LDA.l DungeonLocationsChecked, X
PHA
LDA.l CompassTotalsWRAM,X
JSR HUDHex2Digit
STY.w HUDTileMapBuffer+$9A : STX.w HUDTileMapBuffer+$9C
LDX.w #!BlankTile : STX.w HUDTileMapBuffer+$92
LDX.w #!SlashTile : STX.w HUDTileMapBuffer+$98
PLA
JSR HUDHex2Digit
STY.w HUDTileMapBuffer+$94 : STX.w HUDTileMapBuffer+$96
.done
SEP #$20
RTS
;================================================================================
DrawMapCounts:
LDA.l MapHUDMode : BEQ .done
; no map needed if this bit is set
BIT.b #$02 : BNE .draw_map_count
REP #$20
LDA.l MapField : AND.l DungeonItemMasks,X : BEQ .done
.draw_map_count
SEP #$20
TYX : BNE .not_sewers
INX
.not_sewers
LDA.l DungeonCollectedKeys, X
PHA
LDA.l MapTotalsWRAM,X
JSR HUDHex2Digit
STX.w HUDTileMapBuffer+$A6
LDX.w #!SlashTile : STX.w HUDTileMapBuffer+$A4
PLA
JSR HUDHex2Digit
STX.w HUDTileMapBuffer+$A2
.done
SEP #$20
RTS
;================================================================================
; 8-bit registers
; in: A(b) - Byte to Convert
; out: $06 - $07 (high - low)
; Exits with:
; X - ones place tile
; Y - tens place tile
;===================================================================================================
HUDHex2Digit:
SEP #$30 ; clear high byte of X and Y and make it so they don't get B
ASL : TAX
REP #$10
LDA.b #$24 : XBA ; tile props in high byte
LDA.l FastHexTable,X : LSR #4 : ORA.b #$90
TAY
LDA.l FastHexTable,X : AND.b #$0F : ORA.b #$90
TAX
RTS
HUDHex4Digit:
JSL HexToDec
REP #$30
LDA.l HexToDecDigit2 : ORA.w #$9090 : STA.b Scrap04
LDA.l HexToDecDigit4 : ORA.w #$9090 : STA.b Scrap06
LDA.w #$2400
SEP #$20
RTS
HUDHex2Digit_Long:
JSR HUDHex2Digit
REP #$20
RTL
HUDHex4Digit_Long:
JSR HUDHex4Digit
REP #$20
RTL
;================================================================================
HudHexToDec2Digit:
LDY.b #$90
-
CMP.b #10 : !BLT +
INY
SBC.b #10 : BRA -
+
STY.b Scrap06 : LDY.b #$90 ; Store 10s digit and reset Y
CMP.b #1 : !BLT +
-
INY
DEC : BNE -
+
STY.b Scrap07 ; Store 1s digit
UpdateHearts:
PHB
REP #$20
SEP #$10
LDX.b #$7E
PHX
PLB
LDA.w MaximumHealth
LSR
LSR
LSR
AND.w #$1F1F
TAX
XBA
TAY
LDA.w #HUDTileMapBuffer+$068
STA.b $07
STA.b $09
.next_filled_heart
CPX.b #$01
BMI .done_hearts
PHX
LDA.l HUDHeartColors_index : ASL : TAX
LDA.l HUDHeartColors_masks_game_hud,X
PLX
ORA.w #$20A0
CPY.b #$01
BPL .add_heart
INC
INC
.add_heart
STA.b ($07)
DEY
DEX
LDA.b $07
INC
INC
CMP.w #HUDTileMapBuffer+$07C
BEQ .next_row
CMP.w #HUDTileMapBuffer+$0BC
BNE .fine
.next_row
ADC.w #$002B
.fine
STA.b $07
CPY.b #$00
BNE .next_filled_heart
STA.b $09
BRA .next_filled_heart
.done_hearts
LDA.w CurrentHealth
AND.w #$0007
BEQ .skip_partial
CMP.w #$0005
BCS .more_than_half
LDA.l HUDHeartColors_index : ASL : TAX
LDA.l HUDHeartColors_masks_game_hud,X
ORA.w #$20A1
STA.b ($09)
BRA .skip_partial
.more_than_half
LDA.l HUDHeartColors_index : ASL : TAX
LDA.l HUDHeartColors_masks_game_hud,X
ORA.w #$20A0
STA.b ($09)
.skip_partial
SEP #$30
PLB
RTL
CheckHeartPaletteFileSelect:
LDA.l HUDHeartColors_index : ASL : TAX
LDA.l HUDHeartColors_masks_file_select,X
ORA.w #$0200
LDX.w #$000A
RTL
CheckHeartPalette:
PHX
LDA.l HUDHeartColors_index : ASL : TAX
LDA.l HUDHeartColors_masks_game_hud,X
ORA.w #$20A0
PLX
RTS
ColorAnimatedHearts:
PHX
REP #$20
LDA.l HUDHeartColors_index : ASL : TAX
LDA.l HUDHeartColors_masks_game_hud,X
PLX
ORA.l HeartFramesBaseTiles,X
STA.b [Scrap00],Y
SEP #$20
RTL
HeartFramesBaseTiles:
dw $20A3, $20A4, $20A3, $20A0

1862
newitems.asm Executable file → Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -47,23 +47,23 @@ ItemCheck_SickKid:
RTL
ItemCheck_TreeKid:
LDA.l NpcFlags : AND.b #$08 ; FluteBoy_Chillin - 73: LDA FluteEquipment
LDA.l NpcFlags : AND.b #$08
RTL
ItemCheck_TreeKid2:
LDA.l NpcFlags : AND.b #$08 : LSR #$02 ; FluteAardvark_InitialStateFromFluteState - 225: LDA FluteEquipment : AND.b #$03
LDA.l NpcFlags : AND.b #$08
LSR #2
RTL
ItemCheck_TreeKid3:
JSL $0DD030 ; FluteAardvark_Draw - thing we wrote over
JSL $8DD030 ; FluteAardvark_Draw - thing we wrote over
LDA.l NpcFlags : AND.b #$08
BEQ .normal
BRA .done
BNE .done
LDA.b #$05
.normal
.normal
LDA.w SpriteActivity, X
.done
RTL
.done
RTL
ItemCheck_Sahasrala:
LDA.l NpcFlags : AND.b #$10
@@ -74,7 +74,7 @@ ItemCheck_Library:
RTL
ItemCheck_Mushroom:
LDA.l NpcFlags+1 : ROL #4 ; does the same thing as below
LDA.l NpcFlags+1 : AND.b #$10 : CMP.b #$10 ; does the same thing as below
RTL
ItemCheck_Powder:
@@ -133,7 +133,7 @@ RTL
ItemSet_Mushroom:
PHA
LDA.l NpcFlags+1 : ORA.b #$10 : STA.l NpcFlags+1
LDY.w SpriteItemType, X ; Retrieve stored item type
LDY.w SpriteID, X ; Retrieve stored item type
BNE +
; if for any reason the item value is 0 reload it, just in case
%GetPossiblyEncryptedItem(MushroomItem, SpriteItemValues) : TAY
@@ -174,8 +174,12 @@ RTL
; Randomize Zora King
;--------------------------------------------------------------------------------
LoadZoraKingItemGFX:
LDA.l $1DE1C3 ; location randomizer writes zora item to
JML.l PrepDynamicTile
LDA.l $9DE1C3 ; location randomizer writes zora item to
JSL.l AttemptItemSubstitution
JSL.l ResolveLootIDLong
STA.w SpriteID,Y
TYX
JML.l PrepDynamicTile_loot_resolved
;--------------------------------------------------------------------------------
JumpToSplashItemTarget:
LDA.w SpriteMovement, X
@@ -186,18 +190,21 @@ JumpToSplashItemTarget:
; Randomize Catfish
;--------------------------------------------------------------------------------
LoadCatfishItemGFX:
LDA.l $1DE185 ; location randomizer writes catfish item to
JML PrepDynamicTile
LDA.l $9DE185 ; location randomizer writes catfish item to
JSL.l AttemptItemSubstitution
JSL.l ResolveLootIDLong
STA.w SpriteID, Y
TYX
JML.l PrepDynamicTile_loot_resolved
;--------------------------------------------------------------------------------
DrawThrownItem:
LDA.b OverworldIndex : CMP.b #$81 : BNE .catfish
.zora
LDA.b #$01 : STA.l RedrawFlag
LDA.l $1DE1C3 ; location randomizer writes zora item to
BRA .draw
.catfish
LDA.l $1DE185 ; location randomizer writes catfish item to
.draw
LDA.w SpriteID,X
JML DrawDynamicTile
;--------------------------------------------------------------------------------
MarkThrownItem:

143
overworldmap.asm Normal file
View File

@@ -0,0 +1,143 @@
pushpc
org $0AC02B
DrawPrizesOverride:
LDX.b #$FF
.loopStart
INX : PHX
JSR OverworldMap_CheckForPrize
BCC + : JMP .skip_draw : +
TXA : ASL A : TAX
LDA.l MapCompassFlag
AND #$01 : BNE +
LDA.l WorldMapIcon_posx_vanilla+1, X : STA.l $7EC10B
LDA.l WorldMapIcon_posx_vanilla, X : STA.l $7EC10A
LDA.l WorldMapIcon_posy_vanilla+1, X : STA.l $7EC109
LDA.l WorldMapIcon_posy_vanilla, X : STA.l $7EC108
BRA .adjustment
+ LDA.l WorldMapIcon_posx_located+1, X : STA.l $7EC10B
LDA.l WorldMapIcon_posx_located, X : STA.l $7EC10A
LDA.l WorldMapIcon_posy_located+1, X : STA.l $7EC109
LDA.l WorldMapIcon_posy_located, X : STA.l $7EC108
.adjustment
LDA.l WorldMapIcon_tile, X : CMP #$FF : BEQ .skip_draw
LDA.l WorldMapIcon_tile+1, X : BEQ .dont_adjust
CMP.b #$64 : BEQ .is_crystal
LDA.b $1A : AND.b #$10 : BNE .skip_draw
.is_crystal
JSR.w WorldMapIcon_AdjustCoordinate
.dont_adjust
JSR.w WorldMap_CalculateOAMCoordinates
BCC .skip_draw
PLX : PHX : TXA : ASL A : TAX
LDA.l WorldMapIcon_tile+1, X : BEQ .is_red_x
LDA.l MapCompassFlag : CMP.b #$01 : BEQ .is_red_x
LDA.l WorldMapIcon_tile+1, X : STA.b $0D
LDA.l WorldMapIcon_tile, X : STA.b $0C
LDA.b #$02 : BRA .continue
.is_red_x
LDA.b $1A : LSR #3 : AND.b #$03 : TAX
LDA.l WorldMap_RedXChars,X : STA.b $0D
LDA.b #$32 : STA.b $0C : LDA.b #$00
.continue
STA.b $0B
PLX : PHX
INX : JSR.w WorldMap_HandleSpriteBlink
.skip_draw
; end of loop
PLX : CPX #12 : BCS + : JMP .loopStart : +
PLA : STA.l $7EC10B
PLA : STA.l $7EC10A
PLA : STA.l $7EC109
PLA : STA.l $7EC108
RTS
; X - the index of the prize marker
OverworldMap_CheckForPrize:
PHX
LDA #$00 : STA.l MapCompassFlag
JSR OverworldMap_CheckForCompass
BCC +
LDA.l MapCompassFlag : ORA #$01 : STA.l MapCompassFlag
LDA CurrentWorld : AND #$40 : BNE ++ ; is the compass position on LW or DW?
LDA.l WorldCompassMask, X : BEQ + : JMP .fail
++ LDA.l WorldCompassMask, X : BNE + : JMP .fail
+ JSR OverworldMap_CheckForMap
BCC +
LDA.l MapCompassFlag : ORA #$02 : STA.l MapCompassFlag
+
LDA.l MapCompassFlag : BEQ .fail
CMP #$02 : BNE .checkIfObtained
LDA CurrentWorld : AND #$40 : BNE +
CPX #3 : BCS .fail : BRA .checkIfObtained
+ CPX #10 : BCS .fail
CPX #3 : BCC .fail
.checkIfObtained
LDA.l MC_DungeonIdsForPrize, X
BPL +++ : CLC : BRA .done : +++ ; non-prize flags
CMP.b #$02 : BCC .hyrule_castle
ASL : TAX
REP #$20
LDA.l DungeonsCompleted : AND.l DungeonItemMasks,X : BNE .fail
CLC : BRA .done
; see if hyrule castle has been completely cleared
.hyrule_castle
LDA.l CompassTotalsWRAM, X : SEC : SBC DungeonLocationsChecked, X : BEQ .fail
CLC : BRA .done
.fail
SEC
.done
SEP #$20
PLX
RTS
; X - which compass in question
; CLC - should not move indicator
; SEC - yep indicator can move
OverworldMap_CheckForCompass:
LDA.l CompassMode : AND #$80 : BEQ .unset ; should I check for compass logic
LDA.l CompassMode : AND #$40 : BEQ .set ; compasses/maps aren't shuffled
LDA.l CompassMode : AND #$20 : BNE +
JSR OverworldMap_CheckForMap : BCC .unset : BRA .set
+ LDA.l CompassExists, X : BEQ .set ; compass doesn't exist
PHX
LDA.l MC_SRAM_Offsets, X : TAX ; put compass offset into X
LDA CompassField, X : ORA MapOverlay, X
PLX
AND.l MC_Masks, X : BNE .set ; is the compass obtained
.unset
CLC
RTS
.set
SEC
RTS
; map - which map in question
; CLC - should not show exact prize
; SEC - yep should show exact prize
OverworldMap_CheckForMap:
LDA.l MapMode : BEQ .set ; obtaining map doesn't change anything
LDA CurrentWorld : AND #$40 : BNE + ; not really sure on this check
LDA MapField : ORA MapOverlay : AND.b #$01 : BNE .set : BRA .continue
+ LDA MapField : ORA MapOverlay : AND.b #$02 : BNE .set
.continue
PHX
LDA.l MC_SRAM_Offsets, X : TAX ; put map offset into X
LDA MapField, X : ORA MapOverlay, X
PLX
AND.l MC_Masks, X : BNE .set ; is the map obtained?
.unset
CLC
RTS
.set
SEC
RTS
pullpc

View File

@@ -1,7 +1,7 @@
Module_Password:
LDA.b GameSubMode
JSL.l UseImplicitRegIndexedLongJumpTable
JSL.l JumpTableLong
dl Password_BeginInit ; 0
dl Password_EndInit ; 1

View File

@@ -17,18 +17,20 @@ RTL
;================================================================================
HUDRebuildIndoorHole:
PHA
LDA.b #$01 : STA.l UpdateHUDFlag
LDA.l GenericKeys : BEQ .normal
.generic
PLA
LDA.l CurrentGenericKeys ; generic key count
JSL.l HUD_RebuildIndoor_Palace
JSL.l HUD_RebuildIndoor_Palace
RTL
.normal
PLA
JSL.l HUD_RebuildIndoor_Palace
JSL.l HUD_RebuildIndoor_Palace
RTL
;================================================================================
HUDRebuildIndoor:
LDA.b #$01 : STA.l UpdateHUDFlag
LDA.l GenericKeys : BEQ .normal
.generic
LDA.b #$00 : STA.l RoomDarkness
@@ -49,70 +51,6 @@ GetCrystalNumber:
PLX
RTL
;================================================================================
OverworldMap_CheckObject:
PHX
;CPX.b #$01 : BNE + : JMP ++ : + : JMP .fail
LDA.l CurrentWorld : AND.b #$40 : BNE +
;LW Map
LDA.l MapMode : BEQ +++
LDA.l MapField : ORA.l MapOverlay : AND.b #$01 : BNE +++
PHX
LDA.l .lw_map_offsets, X : TAX ; put map offset into X
LDA.l MapField, X : ORA.l MapOverlay, X
PLX
AND.l .lw_map_masks, X : BNE +++
JMP .fail
+++
LDA.l .lw_offsets, X
BPL +++ : CLC : BRA .done : +++ ; don't display master sword
TAX : BRA ++
+
;DW Map
LDA.l MapMode : BEQ +++
LDA.l MapField : ORA.l MapOverlay : AND.b #$02 : BNE +++
PHX
LDA.l .dw_map_offsets, X : TAX ; put map offset into X
LDA.l MapField, X : ORA.l MapOverlay, X
PLX
AND.l .dw_map_masks, X : BNE +++
JMP .fail
+++
LDA.l .dw_offsets, X
TAX : BRA ++
SEC
PLX
RTL
++
LDA.l CrystalPendantFlags_2, X
AND.b #$40 : BNE .checkCrystal
.checkPendant
LDA.l PendantsField : AND.l CrystalPendantFlags, X : BNE .fail
CLC : BRA .done
.checkCrystal
LDA.l CrystalsField : AND.l CrystalPendantFlags, X : BNE .fail
CLC : BRA .done
.fail
SEC
.done
PLX
RTL
.lw_offsets
db $02, $0A, $03, $FF
.dw_offsets
db $06, $08, $0C, $0B, $07, $09, $05
.lw_map_offsets
db $01, $00, $01
; pod skull trock thieves mire ice swamp
.dw_map_offsets
db $01, $00, $00, $00, $01, $00, $01
.lw_map_masks
db $20, $20, $10, $00
.dw_map_masks
db $02, $80, $08, $10, $01, $40, $04
;================================================================================
SetLWDWMap:
PHP
SEP #$20 ; set 8-bit accumulator
@@ -173,30 +111,35 @@ CheckCloseItemMenu:
LDA.l MenuCollapse : BNE +
LDA.b Joy1A_New : AND.b #$10 : RTL
+
LDA.b Joy1A_All : AND.b #$10 : EOR.b #$10
LDA.b Joy1A_All : EOR.b #$10
RTL
;================================================================================
ShowDungeonItems:
REP #$30
LDA.w DungeonID : AND.w #$00FF : CMP.w #$00FF : BNE + : RTL : + ; return normal result if outdoors or in a cave
LDA.l HudFlag : AND.w #$0020 ; check hud flag
BEQ + : LDA.w #$0000 : RTL : + ; if set, send the zero onwards
LDA.w DungeonID : AND.w #$00FF : CMP.w #$00FF ; original logic
LDA.w DungeonID-1 : BMI .no_dungeon
LDA.l HudFlag : AND.w #$0040 : BEQ +
.no_dungeon
LDA.w #$0000
RTL
+
LDA.w DungeonID
REP #$02
.done
RTL
;--------------------------------------------------------------------------------
UpdateKeys:
PHX : PHP
SEP #$30 ; set 8-bit accumulator & index registers
LDA.w DungeonID : CMP.b #$1F : !BGE .skip
LSR : TAX ; get dungeon index and store to X
LDA.l CurrentSmallKeys : STA.l DungeonKeys, X
CPX.b #$00 : BNE +
STA.l HyruleCastleKeys ; copy HC to sewers
+ : CPX.b #$01 : BNE +
STA.l SewerKeys ; copy sewers to HC
+
.skip
SEP #$30
LDA.l GenericKeys : BNE .skip
LDA.w DungeonID : CMP.b #$1F : BCS .skip
LSR : TAX
LDA.l CurrentSmallKeys
CPX.b #$02 : BCC .castle_sewers
STA.l DungeonKeys, X
BRA .skip
.castle_sewers
STA.l HyruleCastleKeys : STA.l SewerKeys
.skip
JSL.l PostItemGet
PLP : PLX
RTL
;$37C = Sewer Passage
@@ -248,7 +191,7 @@ RTL
;--------------------------------------------------------------------------------
DrawHUDDungeonItems:
LDA.l HUDDungeonItems : BNE .continue
RTL
RTL
.dungeon_positions
dw 0 ; Hyrule Castle
@@ -282,7 +225,7 @@ DrawHUDDungeonItems:
.dungeon_bitmasks
dw $4000 ; Hyrule Castle
dw $C000 ; Hyrule Castle
dw $2000 ; Eastern
dw $1000 ; Desert
dw $0020 ; Hera
@@ -311,28 +254,19 @@ DrawHUDDungeonItems:
dw $A4*2 ; ; Turtle Rock
dw $0D*2 ; ; Ganon's Tower
.continue
PHP
PHB
PHK
PLB
REP #$30
.continue
PHP : PHB
PHK : PLB
REP #$30
;-------------------------------------------------------------------------------
; dungeon names
LDA.w #$2D50
LDY.w #00
.next_dungeon_name
.next_dungeon_name
LDX.w .dungeon_positions,Y
STA.w GFXStripes+$0646,X
INC
INY : INY
CPY.w #26 : BCC .next_dungeon_name
@@ -344,163 +278,138 @@ DrawHUDDungeonItems:
STA.w GFXStripes+$06C6,X
STA.w GFXStripes+$0706,X
DEX : DEX : BPL --
DEX : DEX
BPL --
LDA.l HudFlag : AND.w #$0020 : BEQ +
JMP .maps_and_compasses
+
JMP .maps_and_compasses
;-------------------------------------------------------------------------------
+
LDA.l HUDDungeonItems : AND.w #$0001 : BNE +
LDA.w #$24F5 : STA.w GFXStripes+$0684 ; blank tile
BRA .skip_small_keys
+
.draw_small_keys
LDA.w #$2810 : STA.w GFXStripes+$0684 ; small keys icon
LDY.w #0
CLC
LDA.l HUDDungeonItems : AND.w #$0001 : BEQ .skip_small_keys
.next_small_key
LDX.w .small_key_x_offset,Y
LDA.l DungeonKeys,X
AND.w #$00FF
.draw_small_keys
LDA.w #$2810 : STA.w GFXStripes+$0684 ; small keys icon
LDX.w .dungeon_positions,Y
ADC.w #$2816
STA.w GFXStripes+$0686,X
LDY.w #0
; Clear the carry only once
; it will be cleared by looping condition afterwards
CLC
.next_small_key
LDX.w .small_key_x_offset,Y
LDA.l DungeonKeys,X
AND.w #$00FF
LDX.w .dungeon_positions,Y
ADC.w #$2816
STA.w GFXStripes+$0686,X
INY : INY
CPY.w #26 : BCC .next_small_key
INY : INY
CPY.w #26 : BCC .next_small_key
;-------------------------------------------------------------------------------
.skip_small_keys
.skip_small_keys
; Big Keys
LDA.l HUDDungeonItems : AND.w #$0002 : BNE +
LDA.w #$24F5 : STA.w GFXStripes+$06C4 ; blank tile
BRA .skip_big_keys
+
LDA.w #$2811 : STA.w GFXStripes+$06C4 ; big key icon
LDX.w #0
LDA.l BigKeyField
; Big Keys
LDA.l HUDDungeonItems : AND.w #$0002 : BEQ .skip_big_keys
.next_big_key
BIT.w .dungeon_bitmasks,X
BEQ ..skip_key
LDY.w .dungeon_positions,X
LDA.w #$2826
STA.w GFXStripes+$06C6,Y
LDA.l BigKeyField
LDA.w #$2811 : STA.w GFXStripes+$06C4 ; big key icon
; use X so we can BIT
LDX.w #0
; load once and test multiple times
LDA.l BigKeyField
.next_big_key
BIT.w .dungeon_bitmasks,X
BEQ ..skip_key
LDY.w .dungeon_positions,X
LDA.w #$2826
STA.w GFXStripes+$06C6,Y
; reload
LDA.l BigKeyField
..skip_key
INX : INX
CPX.w #26 : BCC .next_big_key
..skip_key
INX : INX
CPX.w #26 : BCC .next_big_key
;-------------------------------------------------------------------------------
.skip_big_keys
.skip_big_keys
LDA.l HUDDungeonItems : AND.w #$0010 : BNE +
LDA.w #$24F5 : STA.w GFXStripes+$0704 ; blank tile
BRA .skip_boss_kills
+
LDA.w #$280F : STA.w GFXStripes+$0704 ; skull icon
LDY.w #0
LDA.l HUDDungeonItems : AND.w #$0010 : BEQ .skip_boss_kills
LDA.w #$280F : STA.w GFXStripes+$0704 ; skull icon
LDY.w #0
.next_boss_kill
LDX.w .boss_room_ids,Y
LDA.l RoomDataWRAM.l,X
AND.w #$0800
BEQ ..skip_boss_kill
LDA.w #$2826
LDX.w .dungeon_positions,Y
STA.w GFXStripes+$0706,X
..skip_boss_kill
INY : INY
CPY.w #26 : BCC .next_boss_kill
.next_boss_kill
LDX.w .boss_room_ids,Y
LDA.l RoomDataWRAM.l,X
AND.w #$0800
BEQ ..skip_boss_kill
;-------------------------------------------------------------------------------
.skip_boss_kills
LDA.l HUDDungeonItems : BIT.w #$00F3 : BEQ .maps_and_compasses
JMP .exit
;-------------------------------------------------------------------------------
.maps_and_compasses
LDA.w #$24F5 : STA.w GFXStripes+$0704 ; blank tile boss icon
; Maps
LDA.l HUDDungeonItems : AND.w #$0004 : BNE +
LDA.w #$24F5 : STA.w GFXStripes+$0684 ; map icon
BRA .skip_maps
+
LDA.w #$2821 : STA.w GFXStripes+$0684 ; map icon
LDX.w #0
LDA.l MapField
LDA.w #$2826
LDX.w .dungeon_positions,Y
STA.w GFXStripes+$0706,X
.next_map
BIT.w .dungeon_bitmasks,X
BEQ ..skip_map
..skip_boss_kill
INY : INY
CPY.w #26 : BCC .next_boss_kill
LDY.w .dungeon_positions,X
LDA.w #$2826
STA.w GFXStripes+$0686,Y
LDA.l MapField
..skip_map
INX : INX
CPX.w #26 : BCC .next_map
.skip_maps
LDA.l HUDDungeonItems : AND.w #$0008 : BNE +
LDA.w #$24F5 : STA.w GFXStripes+$06C4 ; blank tile
BRA .skip_compasses
+
LDA.w #$2C20 : STA.w GFXStripes+$06C4 ; compass icon
LDX.w #0
LDA.l CompassField
.next_compass
BIT.w .dungeon_bitmasks,X
BEQ ..skip_compass
LDY.w .dungeon_positions,X
LDA.w #$2826
STA.w GFXStripes+$06C6,Y
LDA.l CompassField
..skip_compass
INX : INX
CPX.w #26 : BCC .next_compass
;-------------------------------------------------------------------------------
.skip_boss_kills
JMP .exit
;-------------------------------------------------------------------------------
; This should only display if select is pressed in hud
.maps_and_compasses
; Maps
LDA.l HUDDungeonItems : AND.w #$0004 : BEQ .skip_maps
LDA.w #$2821 : STA.w GFXStripes+$0684 ; map icon
; use X so we can BIT
LDX.w #0
; load once and test multiple times
LDA.l MapField
.next_map
BIT.w .dungeon_bitmasks,X
BEQ ..skip_map
LDY.w .dungeon_positions,X
LDA.w #$2826
STA.w GFXStripes+$0686,Y
; reload
LDA.l MapField
..skip_map
INX : INX
CPX.w #26 : BCC .next_map
;-------------------------------------------------------------------------------
.skip_maps
; Compasses
LDA.l HUDDungeonItems : AND.w #$0008 : BEQ .skip_compasses
LDA.w #$2C20 : STA.w GFXStripes+$06C4 ; compass icon
; use X so we can BIT
LDX.w #0
; load once and test multiple times
LDA.l CompassField
.next_compass
BIT.w .dungeon_bitmasks,X
BEQ ..skip_compass
LDY.w .dungeon_positions,X
LDA.w #$2826
STA.w GFXStripes+$06C6,Y
; reload
LDA.l CompassField
..skip_compass
INX : INX
CPX.w #26 : BCC .next_compass
;-------------------------------------------------------------------------------
.skip_compasses
.exit
PLB
PLP
.skip_compasses
.exit
PLB
PLP
RTL
;--------------------------------------------------------------------------------
;================================================================================
@@ -656,15 +565,19 @@ HandleEmptyMenu:
LDA.b Joy1A_New : BIT.b #$DF : BNE .close_menu ; Not select, close menu
BIT.b #$20 : BNE .sel_pressed
LDA.b Joy1A_All : BIT.b #$20 : BNE .wait_for_change
LDA.l HudFlag : AND.b #$20 : BEQ .wait_for_change ; HUD flag off, skip drawing work
LDA.l HudFlag : AND.b #$DF : STA.l HudFlag ; Unset without select
LDA.b IndoorsFlag : BEQ ++ ; skip if outdoors
LDA.b #$20 : STA.w SFX3
++
LDA.b #$0C : BRA .done
LDA.l HudFlag : AND.b #$60 : BEQ .wait_for_change
LDA.l HudFlag : AND.b #$9F : STA.l HudFlag ; Unset without select
JSL.l MaybePlaySelectSFX
LDA.b #$0C : BRA .done
.sel_pressed
LDA.l HudFlag : ORA.b #$20 : STA.l HudFlag
LDA.b #$20 : STA.w SFX3
LDA.l HUDDungeonItems : BIT.b #$0C : BNE +
LDA.b #$40
BRA .store_flag
+
LDA.b #$60
.store_flag
STA.l HudFlag
JSL.l MaybePlaySelectSFX
LDA.b #$0C : BRA .done
.wait_for_change
LDA.b #$03 : BRA .done
@@ -687,3 +600,42 @@ RestoreMenu_SetSubModule:
+
LDA.b #$03 : STA.w SubModuleInterface
RTL
;-------------------------------------------------------------------------------
DrawHeartPiecesMenu:
JSL DrawIFrames
LDA.l HUDHeartColors_index : AND.w #$00FF
ASL : TAX
LDA.l HUDHeartColors_masks_game_hud,X
STA.b Scrap0D
LDA.l HeartPieceQuarter : AND.w #$00FF
ASL #3 : TAX
LDY.w #$16F6
LDA.l HeartPieceMenuBaseTiles,X
ORA.b Scrap0D
STA.w $0000,Y
INX #2
LDA.l HeartPieceMenuBaseTiles,X
ORA.b Scrap0D
STA.w $0002,Y
INX #2
LDA.l HeartPieceMenuBaseTiles,X
ORA.b Scrap0D
STA.w $0040,Y
INX #2
LDA.l HeartPieceMenuBaseTiles,X
ORA.b Scrap0D
STA.w $0042,Y
RTL
HeartPieceMenuBaseTiles:
dw $2084, $6084, $2085, $6085 ; 0 heart pieces
dw $20AD, $6084, $2085, $6085 ; 1 heart piece
dw $20AD, $6084, $20AE, $6085 ; 2 heart pieces
dw $20AD, $60AD, $20AE, $6085 ; 3 heart pieces
;-------------------------------------------------------------------------------

View File

@@ -26,7 +26,7 @@ WriteCharacterToPlayerName:
RTL
ReadCharacterFromPlayerName: ;Only for use on Name Screen
LDA.l ExtendedFileNameSRAM, X
LDA.l ExtendedFileNameSRAM, X
CPX.w #$0008 : !BGE +
LDA.l FileNameVanillaSRAM, X ;what we wrote over
+
@@ -59,7 +59,7 @@ db $98, $a0, $a8, $b0
db $c0, $c8, $d0, $d8
NumberStripes:
NewNameStripes:
dw $AB66, $1100 ; 0-4 top
dw $1D40, $0188, $1D41, $0188, $1D42, $0188, $1D43, $0188
dw $1D44
@@ -72,15 +72,36 @@ dw $1D49
dw $0B67, $1100 ; 5-9 bottom
dw $1D55, $0188, $1D56, $0188, $1D57, $0188, $1D58, $0188
dw $1D59
; Move JP characters where a-z are to column where second END button was
dw $B162, $1100
dw $1CEE, $0188, $1CEF, $0188, $1D05, $0188, $1D06, $0188
dw $1D07
dw $D162, $1100
dw $1CFE, $0188, $1CFF, $0188, $1D15, $0188, $1D16, $0188
dw $1D17
dw $F162, $1100
dw $1D0D, $0188, $1D0E, $0188, $1D0F, $0188, $1D20, $0188
dw $1D21
dw $1163, $1100
dw $1D1D, $0188, $1D1E, $0188, $1D1F, $0188, $1D30, $0188
dw $1D31
dw $3163, $1100
dw $1D22, $0188, $1D23, $0188, $1D24, $0188, $1D25, $0188
dw $1D26
dw $5163, $1100
dw $1D32, $0188, $1D33, $0188, $1D34, $0188, $1D35, $0188
dw $1D36
db $80 ; termination
TransferNumericStripes:
TransferNewNameStripes:
REP #$30
LDA.w GameMode : CMP.w #$0204 : BNE .exit
SEP #$20
LDA.b #NumberStripes>>0 : STA.b $00
LDA.b #NumberStripes>>8 : STA.b $01
LDA.b #NumberStripes>>16 : STA.b $02 : STA.w DMA1ADDRB
LDA.b #NewNameStripes>>0 : STA.b $00
LDA.b #NewNameStripes>>8 : STA.b $01
LDA.b #NewNameStripes>>16 : STA.b $02 : STA.w DMA1ADDRB
STZ.b $06 : LDY.w #$0000
.check_next
LDA.b [$00],Y : BPL .next_stripe

View File

@@ -10,7 +10,7 @@ QuickSwap:
LDA.l QuickSwapFlag : BEQ .done
LDA.w ItemCursor : BEQ .done ; Skip everything if we don't have any items
LDA.b #$01 : STA.l UpdateHUDFlag
LDY.b #$14
PHX
XBA ; restore the stashed value
@@ -59,10 +59,10 @@ RCode:
-
+ CPX.b #$14 : BNE + : LDX.b #$00 ;will wrap around to 1
+ INX
DEY : BEQ +
DEY : BEQ +
.nextItem
JSL.l IsItemAvailable : BEQ -
+
+
RTS
LCode:
@@ -76,14 +76,17 @@ LCode:
-
+ CPX.b #$01 : BNE + : LDX.b #$15 ; will wrap around to $14
+ DEX
DEY : BEQ +
DEY : BEQ +
.nextItem
JSL.l IsItemAvailable : BEQ -
+
+
RTS
IsItemAvailable:
JSL CheckInfiniteBombs : BEQ .finite
CPX.b #$14 : BNE .not_mirror
LDA.b #$01 : RTL
.not_mirror
LDA.l InfiniteBombs : BEQ .finite
.infinite
CPX.b #$04 : BNE .finite
LDA.b #$01 : RTL

151
ram.asm
View File

@@ -48,6 +48,8 @@ NMIHUD = $7E0016 ; during NMI.
NMIINCR = $7E0017 ;
NMIUP1100 = $7E0018 ;
UPINCVH = $7E0019 ; Incremental upload VRAM high byte
LinkAbsoluteY = $7E0020 ; Link's absolute coordinates. Word length
LinkAbsoluteX = $7E0022 ;
FrameCounter = $7E001A ; Increments every frame that the game isn't lagging
IndoorsFlag = $7E001B ; $00 = Outdoors | $01 = Indoors
MAINDESQ = $7E001C ; PPU register queues written during NMI
@@ -186,6 +188,16 @@ RaceGameFlag = $7E021B ;
;
MessageJunk = $7E0223 ; Zeroed but never used (?)
;
ShopPurchaseFlag = $7E0224 ; $01 = Shop purchase item receipt.
;CoolScratch = $7E0224 ; 0x5C bytes of free ram
ItemStackPtr = $7E0226 ; Pointer into Item GFX and VRAM target queues. Word length.
; If not zero, pointer should always be left pointing at the
; next available slot in the stack during the frame.
SpriteID = $7E0230 ; 0x10 bytes. Receipt ID for main loop sprite we're handling.
SpriteMetaData = $7E0240 ; 0x10 bytes. Sprite metadata. Used for prog bow tracking.
AncillaVelocityZ = $7E0294 ; 0x0A bytes
AncillaZCoord = $7E029E ; 0x0A bytes
;
ItemReceiptID = $7E02D8 ;
ItemReceiptPose = $7E02DA ; $00 = No pose | $01 = One hand up | $02 = Two hands up
;
@@ -193,7 +205,7 @@ BunnyFlag = $7E02E0 ; $00 = Link | $01 = Bunny
Poofing = $7E02E1 ; Flags cape and bunny poof.
PoofTimer = $7E02E2 ; Countdown timer for poofing.
SwordCooldown = $7E02E3 ; Cooldown for sword after dashing through an enemy.
CutsceneFlag = $7E02E4 ; Flags various cutscenes. All non-zero behave the same.
CutsceneFlag = $7E02E4 ; Flags various cutscenes.
;
ItemReceiptMethod = $7E02E9 ;
;
@@ -221,6 +233,8 @@ NoDamage = $7E037B ; Prevents Link from receiving damage.
;
AncillaGeneral = $7E039F ; General use buffer for front slot ancillae. $0F bytes.
;
AncillaTimer = $7E03B1 ; Used as a timer for ancilla.
;
AncillaSearch = $7E03C4 ; Used to search through ancilla when every front slot is occupied.
;
ForceSwordUp = $7E03EF ; $01 = Force sword up pose.
@@ -228,7 +242,7 @@ FluteTimer = $7E03F0 ; Countdown timer for being able to use the fl
;
YButtonOverride = $7E03FC ; Y override for minigames. $00 = Selected item | $01 = Shovel | $02 = Bow
;
ItemsTaken = $7E0403 ; Items taken in a room: b k u t s e h c
RoomItemsTaken = $7E0403 ; Items taken in a room: b k u t s e h c
; b = boss kill/item | k = key/heart piece (prevents crystals)
; u = 2nd key/heart piece | t = chest 4/rupees/swamp drain/bomb floor/mire wall
; s = chest 3/pod or dp wall | e, h, c = chest 2, 1, 0
@@ -262,8 +276,19 @@ TileMapTile32 = $7E0698 ; Tilemap location of new tile32 objects, such
SkipOAM = $7E0710 ; Set to skip OAM updates. High byte written $FF with exploding walls
OWScreenSize = $7E0712 ; Flags overworld screen size.
;
OAMBuffer = $7E0800 ; Main OAM buffer sent to OAM. $200 bytes.
OAMBuffer2 = $7E0A00 ;
;
TransparencyFlag = $7E0ABD ; Flags transparency effects e.g. in Thieves Town Hellway
;
OWTransitionFlag = $7E0ABF ; Used for certain transitions like smith, witch, etc.
;
ItemGFXPtr = $7E0AFA ; Pointer for item receipt graphics transfers
; $0000 - no transfer, do nothing
; bit 7 reset - offset into ROM table
; bit 7 set - explicit bank7 address
ItemGFXTarget = $7E0AFC ; target VRAM address
;
ArcVariable = $7E0B08 ; Arc variable. Word length.
OverlordXLow = $7E0B08 ; $08 bytes.
OverlordXHigh = $7E0B10 ; $08 bytes.
@@ -279,6 +304,11 @@ SaveFileIndex = $7E0B9D ;
;
SpriteAncillaInteract = $7E0BA0 ; If nonzero, ancillae do not interact with the sprite. $10 bytes.
;
AncillaCoordYLow = $7E0BFA ;
AncillaCoordXLow = $7E0C04 ;
AncillaCoordYHigh = $7E0C0E ;
AncillaCoordXHigh = $7E0C18 ;
;
AncillaVelocityY = $7E0C22 ; $0A bytes.
AncillaVelocityX = $7E0C2C ; $0A bytes.
;
@@ -286,6 +316,8 @@ AncillaID = $7E0C4A ; $0A bytes.
;
AncillaGet = $7E0C5E ; Used by varius ancilla in various ways. $0F bytes.
;
AncillaLayer = $7E0C7C ;
;
SpriteBump = $7E0CD2 ; See symbols_wram.asm. $10 bytes.
;
TreePullKills = $7E0CFB ; Kills for tree pulls.
@@ -316,7 +348,7 @@ SpriteOAMProperties = $7E0E40 ; h m w o o o o o | h = Harmless | m = m
SpriteHitPoints = $7E0E50 ; Set from $0DB173
SpriteControl = $7E0E60 ; n i o s p p p t | n = Death animation? | i = Immune to attack/collion?
; o = Shadow | p = OAM prop palette | t = OAM prop name table
SpriteItemType = $7E0E80 ; Sprite Item Type. $10 bytes.
SpriteItemType = $7E0E80 ; Sprite Item Type. Also used for jump table local. $10 bytes.
;
SpriteSpawnStep = $7E0ED0 ; Related to enemies spawning other sprites (eg pikit, zirro)
;
@@ -333,6 +365,8 @@ SpriteZCoord = $7E0F70 ;
SpriteVelocityZ = $7E0F80 ;
SpriteSubPixelZ = $7E0F90 ;
;
CurrentSpriteSlot = $7E0FA0 ; Holds the current sprite/ancilla's index
;
FreezeSprites = $7E0FC1 ; "Seems to freeze sprites"
;
PrizePackIndexes = $7E0FC7 ; $07 bytes. One for each prize pack.
@@ -342,6 +376,13 @@ SpriteCoordCacheY = $7E0FDA ;
;
NoMenu = $7E0FFC ; When set prevents menu, mirror, medallions
;
;===================================================================================================
;===================================================================================================
; DO NOT ADD ANY RANDOMIZER VARIABLES TO THE SPACE FROM $1100 to $1FFF
;---------------------------------------------------------------------------------------------------
; It causes isses with major glitches
;===================================================================================================
;===================================================================================================
GFXStripes = $7E1000 ; Used by stripes for arbitrary VRAM transfers. $100 bytes.
RoomStripes = $7E1100 ; Used for room drawing.
;
@@ -354,24 +395,7 @@ DelayTimer = $7E1CE9 ;
;
TextID = $7E1CF0 ; Message ID and page. Word length.
;
ToastBuffer = $7E1E0E ; Multiworld buffer. Word length.
;
MSUResumeTime = $7E1E6B ; Mirrored MSU block
MSUResumeControl = $7E1E6F ;
MSUFallbackTable = $7E1E70 ;
MSUDelayedCommand = $7E1E79 ;
MSUPackCount = $7E1E7A ;
MSUPackCurrent = $7E1E7B ;
MSUPackRequest = $7E1E7C ;
MSULoadedTrack = $7E1E7D ;
MSUResumeTrack = $7E1E7F ;
ClockHours = $7E1E90 ; Clock Hours
ClockMinutes = $7E1E94 ; Clock Minutes
ClockSeconds = $7E1E98 ; Clock Seconds
ClockBuffer = $7E1E9C ; Clock Temporary
ScratchBufferNV = $7E1EA0 ; Non-volatile scratch buffer. Must preserve values through return.
ScratchBufferV = $7E1EB0 ; Volatile scratch buffer. Can clobber at will.
;================================================================================
; UNMIRRORED WRAM
@@ -381,6 +405,30 @@ ScratchBufferV = $7E1EB0 ; Volatile scratch buffer. Can clobber at will
TileUploadBuffer = $7EA180 ; 0x300 bytes
;
ItemGetGFX = $7EBD40 ; Item receipt graphics location
;
UpdateHUDFlag = $7EBE00 ; Flag used to mark HUD updates and avoid heavy code segments.
;
ToastBuffer = $7EBE02 ; Multiworld buffer. Word length.
;
MSUResumeTime = $7EBE6B ; Mirrored MSU block
MSUResumeControl = $7EBE6F ;
MSUFallbackTable = $7EBE70 ;
MSUDelayedCommand = $7EBE79 ;
MSUPackCount = $7EBE7A ;
MSUPackCurrent = $7EBE7B ;
MSUPackRequest = $7EBE7C ;
MSULoadedTrack = $7EBE7D ;
MSUResumeTrack = $7EBE7F ;
ClockHours = $7EBE90 ; Clock Hours
ClockMinutes = $7EBE94 ; Clock Minutes
ClockSeconds = $7EBE98 ; Clock Seconds
ClockBuffer = $7EBE9C ; Clock Temporary
ScratchBufferNV = $7EBEA0 ; Non-volatile scratch buffer. Must preserve values through return.
ScratchBufferV = $7EBEB0 ; Volatile scratch buffer. Can clobber at will.
RoomFade = $7EC005 ; Flags fade to black on room transitions. Word length.
FadeTimer = $7EC007 ; Timer for transition fading and mosaics. Word length.
FadeDirection = $7EC009 ; Word length
@@ -439,12 +487,18 @@ HUDArrowCount = $7EC760 ;
HUDKeyDigits = $7EC764 ;
;
BigRAM = $7EC900 ; Big buffer of free ram (0x1F00)
ItemGFXStack = $7ECB00 ; Pointers to source of decompressed item tiles deferred to NMI loading.
ItemGFXSBankStack = $7ECB20 ; Source bank byte for above.
ItemTargetStack = $7ECB40 ; Pointers to VRAM targets for ItemGFXStack.
TotalItemCountTiles = $7ECF00 ; Cached total item count tiles for HUD. Four words high to low.
;================================================================================
; Bank 7F
;--------------------------------------------------------------------------------
DecompressionBuffer = $7F0000 ; Decompression Buffer. $2000 bytes.
DecompBuffer2 = $7F4000 ; Another buffer
base $7F5000
RedrawFlag: skip 1 ;
skip 2 ; Unused
@@ -461,15 +515,16 @@ BossKills: skip 1 ;
LagTime: skip 4 ; Computed during stats preparation for display
RupeesCollected: skip 2 ; Computed during stats preparation for display
NonChestCounter: skip 2 ; Computed during stats preparation for display
skip 2 ; Unused
BowTrackingFlags: skip 2 ; Stores tracking bits for progressive bows before resolution to concrete item.
TileUploadOffsetOverride: skip 2 ; Offset override for loading sprite gfx
skip 3 ;
skip 9 ;
; Shop Block $7F5050 - $7F506F
ShopId: skip 1 ; Shop ID. Used for indexing and loading inventory for custom shops
ShopType: skip 1 ; Shop type. $FF = vanilla shop
; t - - - - - - -
; t = Take-any
; t d a v - - q q
; t = $01 - Take-any | d = $01 - Door check | a = $01 = Take-all
; v = Use alt vram | q = Number of items
ShopInventory: skip $0D ; For three possible shop items, row major:
; [Item ID][Price low][Price High][Purchase Count]
ShopState: skip 1 ; - - - - - l c r | Bitfield that determines whether to draw an item
@@ -525,7 +580,7 @@ OHKOFlag: skip 1 ; Any non-zero write sets OHKO mode
SpriteSwapper: skip 1 ; Loads new link sprite and glove/armor palette. No gfx or
; code currently in base ROM for this.
BootsModifier: skip 1 ; $01 = Give dash ability
GanonVulnerabilityItem: skip 1 ; Item Ganon is vulnerable to while stunned
OHKOCached: skip 1 ; "Old" OHKO flag state. Used to detect changes.
; Crypto Block ($7F50D0 - $7F51FF)
KeyBase: skip $10 ;
y: skip 4 ;
@@ -548,13 +603,17 @@ CompassTotalsWRAM: skip $10 ; \ Compass and map dungeon HUD display total
MapTotalsWRAM: skip $10 ; / on boot for tracking.
skip $30 ; Reserved for general dungeon tracking data. May have over
; allocated here. Feel free to reassign.
skip $40 ; Unused
MapCompassFlag: skip 2 ; Used to flag overworld map drawing.
skip $3E ; Unused
skip $260 ; Unused
DialogBuffer: skip $100 ; Dialog Buffer
;
PrivateBlockWRAM = $7F7700 ; Reserved for 3rd party use. $500 bytes.
; See also: $200 bytes at PrivateBlockPersistent, copied to SRAM.
BigDecompressionBuffer = $7F8000 ; Reserved for large gfx decompression buffer. $5000 bytes.
; KEEP THIS AT $8000+
; its location at an address with bit 7 set is used for detecting
; ROM location versus RAM locations
;
MiniGameTime = $7FFE00 ; Time spent in mini game. 32-bits.
MiniGameTimeFinal = $7FFE04 ; Final mini game time. 32 bits.
@@ -703,7 +762,7 @@ endmacro
%assertRAM(ForceSwordUp, $7E03EF)
%assertRAM(FluteTimer, $7E03F0)
%assertRAM(YButtonOverride, $7E03FC)
%assertRAM(ItemsTaken, $7E0403)
%assertRAM(RoomItemsTaken, $7E0403)
%assertRAM(DungeonID, $7E040C)
%assertRAM(LayerAdjustment, $7E047A)
%assertRAM(RoomIndexMirror, $7E048E)
@@ -722,6 +781,9 @@ endmacro
%assertRAM(TileMapTile32, $7E0698)
%assertRAM(SkipOAM, $7E0710)
%assertRAM(OWScreenSize, $7E0712)
%assertRAM(OAMBuffer, $7E0800)
%assertRAM(OAMBuffer2, $7E0A00)
%assertRAM(TransparencyFlag, $7E0ABD)
%assertRAM(OWTransitionFlag, $7E0ABF)
%assertRAM(TreePullKills, $7E0CFB)
%assertRAM(TreePullHits, $7E0CFC)
@@ -738,6 +800,7 @@ endmacro
%assertRAM(AncillaVelocityX, $7E0C2C)
%assertRAM(AncillaID, $7E0C4A)
%assertRAM(AncillaGet, $7E0C5E)
%assertRAM(AncillaLayer, $7E0C7C)
%assertRAM(SpriteBump, $7E0CD2)
%assertRAM(SpritePosYLow, $7E0D00)
%assertRAM(SpritePosXLow, $7E0D10)
@@ -796,6 +859,7 @@ endmacro
%assertRAM(SpriteZCoord, $7E0F70)
%assertRAM(SpriteVelocityZ, $7E0F80)
%assertRAM(SpriteSubPixelZ, $7E0F90)
%assertRAM(CurrentSpriteSlot, $7E0FA0)
%assertRAM(FreezeSprites, $7E0FC1)
%assertRAM(PrizePackIndexes, $7E0FC7)
%assertRAM(SpriteCoordCacheX, $7E0FD8)
@@ -807,23 +871,23 @@ endmacro
%assertRAM(MessageSubModule, $7E1CD8)
%assertRAM(MessageCursor, $7E1CE8)
%assertRAM(DelayTimer, $7E1CE9)
%assertRAM(TextID, $7E1CF0)
%assertRAM(ToastBuffer, $7E1E0E)
%assertRAM(MSUResumeTime, $7E1E6B)
%assertRAM(MSUResumeControl, $7E1E6F)
%assertRAM(MSUFallbackTable, $7E1E70)
%assertRAM(MSUDelayedCommand, $7E1E79)
%assertRAM(MSUPackCount, $7E1E7A)
%assertRAM(MSUPackCurrent, $7E1E7B)
%assertRAM(MSUPackRequest, $7E1E7C)
%assertRAM(MSULoadedTrack, $7E1E7D)
%assertRAM(MSUResumeTrack, $7E1E7F)
%assertRAM(ClockHours, $7E1E90)
%assertRAM(ClockMinutes, $7E1E94)
%assertRAM(ClockSeconds, $7E1E98)
%assertRAM(ClockBuffer, $7E1E9C)
%assertRAM(ScratchBufferNV, $7E1EA0)
%assertRAM(ScratchBufferV, $7E1EB0)
;%assertRAM(TextID, $7E1CF0)
;%assertRAM(ToastBuffer, $7E1E0E)
;%assertRAM(MSUResumeTime, $7E1E6B)
;%assertRAM(MSUResumeControl, $7E1E6F)
;%assertRAM(MSUFallbackTable, $7E1E70)
;%assertRAM(MSUDelayedCommand, $7E1E79)
;%assertRAM(MSUPackCount, $7E1E7A)
;%assertRAM(MSUPackCurrent, $7E1E7B)
;%assertRAM(MSUPackRequest, $7E1E7C)
;%assertRAM(MSULoadedTrack, $7E1E7D)
;%assertRAM(MSUResumeTrack, $7E1E7F)
;%assertRAM(ClockHours, $7E1E90)
;%assertRAM(ClockMinutes, $7E1E94)
;%assertRAM(ClockSeconds, $7E1E98)
;%assertRAM(ClockBuffer, $7E1E9C)
;%assertRAM(ScratchBufferNV, $7E1EA0)
;%assertRAM(ScratchBufferV, $7E1EB0)
%assertRAM(TileUploadBuffer, $7EA180)
%assertRAM(RoomFade, $7EC005)
%assertRAM(FadeTimer, $7EC007)
@@ -915,6 +979,7 @@ endmacro
%assertRAM(TxStatus, $7F53FF)
%assertRAM(CompassTotalsWRAM, $7F5410)
%assertRAM(MapTotalsWRAM, $7F5420)
%assertRAM(MapCompassFlag, $7F5460)
%assertRAM(DialogBuffer, $7F5700)
%assertRAM(MiniGameTime, $7FFE00)
%assertRAM(MiniGameTimeFinal, $7FFE04)

View File

@@ -1,28 +1,30 @@
LoadBombCount:
JSL CheckInfiniteBombs : BNE .infinite
LDA.l InfiniteBombs : BNE .infinite
.finite
LDA.l BombsEquipment
.infinite
RTL
LoadBombCount16:
JSL CheckInfiniteBombs16 : BNE .infinite
LDA.l InfiniteBombs : AND.w #$00FF : BNE .infinite
.finite
LDA.l BombsEquipment
.infinite
RTL
StoreBombCount:
JSL IncrementBombsPlacedCounter
PHA : JSL CheckInfiniteBombs : BEQ .finite
PHA
LDA.b #$01 : STA.l UpdateHUDFlag
LDA.l InfiniteBombs : BEQ .finite
.infinite
PLA : LDA.b #$01 : RTL
.finite
PLA : STA.l BombsEquipment
RTL
SearchForEquippedItem:
JSL CheckInfiniteBombs : BEQ +
LDA.b #$01 : LDX.b #$00 : RTL
+
LDA.l BowEquipment ; thing we wrote over
LDA.b #$01 : LDX.b #$00 : RTL
; LDA.l InfiniteBombs : BEQ +
; LDA.b #$01 : LDX.b #$00 : RTL
; +
; LDA.l BowEquipment ; thing we wrote over
RTL
DecrementArrows:
@@ -40,11 +42,11 @@ DecrementArrows:
LDA.b IndoorsFlag : BEQ .not_archery_game ; in overworld
LDA.w $0B9A : BEQ .shoot_arrow ; arrow game active
LDA.b #$00 : BRA .done
.not_archery_game
LDA.l CurrentArrows : BNE .shoot_arrow ; check if we have arrows
BRA .done
.shoot_arrow
PHX
REP #$20

281
rewind.asm Normal file
View File

@@ -0,0 +1,281 @@
pushpc
org $82D6E2
JSL CheckLoadRewind
BCC +
JMP.w $D83F
+
pullpc
CheckLoadRewind:
; what we wrote over
STZ.w $011A
STZ.w $011C
; STZ.w $010A ; removed for MSU patch anyway
LDA.l RewindTrigger
AND.w #$00FF
BEQ .no_state
JSR.w LoadRewind
SEC
RTL
.no_state
LDA.l $7EF3CC ; rest of what we wrote over
CLC
RTL
LoadRewind:
LDA.l RewindDungeonEntrance
STA.w $010E
LDA.l RewindRoomId
STA.b $A0
STA.w $048E
LDA.l RewindVerticalScroll
STA.b $E8
STA.b $E6
STA.w $0122
STA.w $0124
LDA.l RewindHorizontalScroll
STA.b $E2
STA.b $E0
STA.w $011E
STA.w $0120
LDA.l RewindYCoordinate
STA.b $20
LDA.l RewindXCoordinate
STA.b $22
LDA.l RewindCameraTriggerY
STA.w $0618
INC A
INC A
STA.w $061A
LDA.l RewindCameraTriggerX
STA.w $061C
INC A
INC A
STA.w $061E
LDA.w #$01F8
STA.b $EC
LDA.l RewindOverworldDoorTilemap
STA.w $0696
STZ.w $0698
LDA.w #$0000
STA.w $0610
LDA.w #$0110
STA.w $0612
LDA.w #$0000
STA.w $0614
LDA.w #$0100
STA.w $0616
SEP #$20
LDA.l RewindCameraScrollBoundaries
STA.w $0601
LDA.l RewindCameraScrollBoundaries+1
STA.w $0603
LDA.l RewindCameraScrollBoundaries+2
STA.w $0605
LDA.l RewindCameraScrollBoundaries+3
STA.w $0607
LDA.l RewindCameraScrollBoundaries+4
STA.w $0609
LDA.l RewindCameraScrollBoundaries+5
STA.w $060B
LDA.l RewindCameraScrollBoundaries+6
STA.w $060D
LDA.l RewindCameraScrollBoundaries+7
STA.w $060F
STZ.w $0600
STZ.w $0602
LDA.b #$10
STA.w $0604
STA.w $0606
STZ.w $0608
STZ.w $060A
STZ.w $060C
STZ.w $060E
LDA.l RewindLinkFacing
STA.b $2F
LDA.l RewindMainGFX
STA.w $0AA1
LDA.l RewindSong
STA.w $0132
LDA.l RewindFloor
STA.b $A4
LDA.l RewindDungeonId
STA.w $040C
LDA.l Rewind_6C
STA.b $6C
LDA.l Rewind_EE
STA.b $EE
LDA.l Rewind_0476
STA.w $0476
LDA.l Rewind_A6
STA.b $A6
LDA.l Rewind_A7
STA.b $A7
LDA.l Rewind_A9
STA.b $A9
LDA.l Rewind_AA
STA.b $AA
STZ.w $02E4
PHP
REP #$30
LDA.w #$0000
STA.l RewindTrigger
LDA.w #$FFFF
STA.l RewindRoomId
PHB
LDX.w #RewindEntranceCache
LDY.w #$C140
LDA.w #$27
MVN $7E, RewindEntranceCache>>16
PLB
PLP
RTS
SaveRewind:
PHP
REP #$20
LDA.w $010E
STA.l RewindDungeonEntrance
LDA.b $A0
STA.l RewindRoomId
LDA.b $E8
STA.l RewindVerticalScroll
LDA.b $E2
STA.l RewindHorizontalScroll
LDA.b $20
STA.l RewindYCoordinate
LDA.b $22
STA.l RewindXCoordinate
LDA.w $0618
STA.l RewindCameraTriggerY
LDA.w $061C
STA.l RewindCameraTriggerX
LDA.w $0696
STA.l RewindOverworldDoorTilemap
SEP #$20
LDA.w $0601
STA.l RewindCameraScrollBoundaries
LDA.w $0603
STA.l RewindCameraScrollBoundaries+1
LDA.w $0605
STA.l RewindCameraScrollBoundaries+2
LDA.w $0607
STA.l RewindCameraScrollBoundaries+3
LDA.w $0609
STA.l RewindCameraScrollBoundaries+4
LDA.w $060B
STA.l RewindCameraScrollBoundaries+5
LDA.w $060D
STA.l RewindCameraScrollBoundaries+6
LDA.w $060F
STA.l RewindCameraScrollBoundaries+7
LDA.b $2F
STA.l RewindLinkFacing
LDA.w $0AA1
STA.l RewindMainGFX
LDA.w $0132
STA.l RewindSong
LDA.b $A4
STA.l RewindFloor
LDA.w $040C
STA.l RewindDungeonId
LDA.b $6C
STA.l Rewind_6C
LDA.b $EE
STA.l Rewind_EE
LDA.w $0476
STA.l Rewind_0476
LDA.b $A6
STA.l Rewind_A6
LDA.b $A7
STA.l Rewind_A7
LDA.b $A9
STA.l Rewind_A9
LDA.b $AA
STA.l Rewind_AA
PHB
REP #$30
LDX.w #$C140
LDY.w #RewindEntranceCache
LDA.w #$27
MVN RewindEntranceCache>>16, $7E
PLB
PLP
RTL

View File

@@ -21,7 +21,7 @@ RigChestRNG:
RTL
.forceHeart
LDA.b #$33 : STA.b ScrapBufferBD+$0B ; assure the correct state if player talked to shopkeeper
LDA.w ItemsTaken : AND.b #$40 : BNE .notHeart
LDA.w RoomItemsTaken : AND.b #$40 : BNE .notHeart
LDA.b #$07 ; give prize item
RTL
.notHeart
@@ -35,9 +35,8 @@ RTL
RTL
;--------------------------------------------------------------------------------
FixChestCounterForChestGame:
JSL.l DecrementItemCounter
JSL.l $0DBA71
RTL
JSL DecrementItemCounter
JML $8DBA71
;--------------------------------------------------------------------------------
RNG_Lanmolas1:
LDA.b #$00 : BRA _rng_done
@@ -108,10 +107,6 @@ RTL
; Out: A = RNG Result
;--------------------------------------------------------------------------------
GetStaticRNG:
LDA.l SeededRNG : BNE .seeded
JML GetRandomInt
RTL
.seeded
PHX : PHP
REP #$30 ; set 16-bit accumulator and index registers
AND.w #$000F
@@ -133,20 +128,20 @@ InitRNGPointerTable:
PLP : PLX
RTL
.rngDefaults
dw #$0000 ; 00 = Lanmolas 1
dw #$0040 ; 01 = Moldorm 1
dw #$0080 ; 02 = Agahnim 1
dw #$00C0 ; 03 = Helmasaur
dw #$0100 ; 04 = Arrghus
dw #$0140 ; 05 = Mothula
dw #$0180 ; 06 = Kholdstare
dw #$01C0 ; 07 = Vitreous
dw #$0200 ; 08 = Trinexx
dw #$0240 ; 09 = Lanmolas 2
dw #$0280 ; 10 = Moldorm 2
dw #$02C0 ; 11 = Agahnim 2
dw #$0300 ; 12 = Agahnim 2 Phantoms
dw #$0340 ; 13 = Ganon
dw #$0380 ; 14 = Ganon Extra Warp
dw #$03C0 ; 15 = Standard Escape Enemy Drops
dw $0000 ; 00 = Lanmolas 1
dw $0040 ; 01 = Moldorm 1
dw $0080 ; 02 = Agahnim 1
dw $00C0 ; 03 = Helmasaur
dw $0100 ; 04 = Arrghus
dw $0140 ; 05 = Mothula
dw $0180 ; 06 = Kholdstare
dw $01C0 ; 07 = Vitreous
dw $0200 ; 08 = Trinexx
dw $0240 ; 09 = Lanmolas 2
dw $0280 ; 10 = Moldorm 2
dw $02C0 ; 11 = Agahnim 2
dw $0300 ; 12 = Agahnim 2 Phantoms
dw $0340 ; 13 = Ganon
dw $0380 ; 14 = Ganon Extra Warp
dw $03C0 ; 15 = Standard Escape Enemy Drops
;--------------------------------------------------------------------------------

Some files were not shown because too many files have changed in this diff Show More