533 Commits

Author SHA1 Message Date
e5420fc651 Sidnexx damage modify? 2023-03-17 11:36:24 -05:00
9f441108e0 Moldorm stunnable with hookshot/boomerang; only damagable when stunned 2023-03-17 11:16:29 -05:00
e3afa34088 Sword swing slight delay as sword is upgraded 2023-03-16 23:15:55 -05:00
5139f6d857 Fix bunny pot-throwing 2023-03-16 19:10:46 -05:00
e55af7e610 Using shovel indoors bunnies link 2023-03-15 23:13:58 -05:00
e11ac2c130 Initial trolls:
- random dash timer
- random bomb timer
- flute sometimes summons chickens
- ice physics while carrying things
- lowered i-frames with increased hearts/armor
- Blind impervious (TODO: allow hitting with bunny pots)
2023-03-15 22:06:02 -05:00
015f769521 Move kara-branch code to bank A2 so there's space 2023-02-26 14:31:51 -06:00
bfbc180ff3 Merge branch 'OWMain' into overworld_kara 2023-02-26 14:30:05 -06:00
codemann8
750c412f59 Minor comment change 2023-02-25 21:37:44 -06:00
codemann8
b1f23151a2 Disable flute in rain state 2023-02-25 21:37:25 -06:00
codemann8
09b75c3bf6 Merged in DR v1.2.0.9 2023-02-24 16:00:54 -06:00
aerinon
096157e981 Changes graphical status of standard exits when blocking exits in rain
Fixes graphical issues with sanctuary and swamp hub lobbies
Major fix for decoupled doors landing area
Fix for multiworld absorbables
2023-02-24 14:22:42 -07:00
codemann8
2136de4928 Merge pull request #9 from Catobat/HoboFix 2023-02-24 10:46:32 -06:00
Catobat
aa5c3b63a2 Fix swim state when leaving Hobo area 2023-02-24 13:14:19 +01:00
codemann8
3f13cee945 Improved door landing 2023-02-18 10:36:40 -06:00
aerinon
2411d0344e Minor optimization on handling special door landing 2023-02-17 23:48:08 -07:00
aerinon
ff6b8b996b Merge branch 'DRFixes' of github.com:codemann8/z3randomizer into codemann8-DRFixes 2023-02-17 23:43:07 -07:00
codemann8
bfb131be81 Merged in DR v1.2.0.8 2023-02-17 18:47:36 -06:00
aerinon
4a8b8b7691 Standard save and quit change for DR 2023-02-17 16:58:50 -07:00
codemann8
aaff8a1975 Improved door landing
Improved door landing
2023-02-02 18:37:13 -06:00
codemann8
7fdc59bb08 Improved door landing 2023-02-01 22:14:38 -06:00
ec6231955d Merge remote-tracking branch 'codemann/OWMain' into overworld_kara 2023-01-30 19:47:34 -06:00
codemann8
fd53cea697 Merge branch 'DRUnstable' into OWMain 2023-01-30 11:59:05 -06:00
codemann8
468fe5f2af Improved door landing 2023-01-30 10:34:48 -06:00
aerinon
296c311b0a Fix for lamp check in escape if entering from dark world. Also fixes the torch going out bug. 2023-01-27 15:12:30 -07:00
codemann8
bae7c6175c Merge branch 'DRUnstable' into OWMain 2023-01-06 21:20:56 -06:00
aerinon
8957b8db7b Fast ROM updates 2023-01-06 15:02:22 -07:00
codemann8
782f18d9d9 Merge branch 'DRUnstable' into OWMain 2022-12-16 17:16:08 -06:00
aerinon
83465e39af Fix for blocked entrance doors 2022-12-16 15:14:33 -07:00
aerinon
955766dc2a Door state fix attempt2 2022-12-05 08:19:59 -07:00
aerinon
46272e7fad New goal "completionist" 2022-12-01 14:04:09 -07:00
aerinon
9e50d5f02c Aga fix for door state (no trap door) 2022-12-01 14:03:39 -07:00
codemann8
4af93256a5 Merged DR v1.2.0.0 2022-12-01 14:10:35 -06:00
aerinon
612597be12 Merge branch 'Synthesis' into DRUnstable 2022-12-01 10:01:57 -07:00
aerinon
3af9e75dbd Possible fix for standing items after Aga transition 2022-12-01 10:01:37 -07:00
9699c4d731 Fix swordless boss counter 2022-11-19 21:09:34 -08:00
846ad798cf Fix conflict between hammer-on-B code with bunny-pressing-A code 2022-11-19 10:06:37 -08:00
44e2ccf7f7 Fix bomb on file select screen in swordless 2022-11-16 14:39:47 -08:00
5d4e7fa62d Add Hammer-On-B mode 2022-11-16 14:39:05 -08:00
be81787446 Bee Mode 2022-11-16 14:37:42 -08:00
682583c215 Merge branch 'OWMain' into overworld_kara 2022-11-16 14:24:25 -08:00
codemann8
1e2a0c7774 Remove the sprite spawn delay when bonking prizes 2022-11-08 18:52:11 -06:00
codemann8
0174e5dbf5 Fixed fake world handling for IB transitions 2022-10-26 13:45:19 -05:00
codemann8
01475f313a Fixed fake world handling for IB transitions 2022-10-26 07:54:05 -05:00
codemann8
74b01030e0 Fixed Murahduhla freeze issue 2022-10-24 17:56:32 -05:00
codemann8
bf034c0f7c Setting World flag on initial spawn 2022-10-22 09:12:20 -05:00
codemann8
43448cc5b6 Fixed OOB transition behavior in Mixed OWR 2022-10-21 00:11:45 -05:00
codemann8
33cfd010a0 Renamed/used some labels 2022-10-20 10:25:08 -05:00
codemann8
3ed0ec0835 Merge pull request #8 from Catobat/Terrain 2022-10-12 21:18:18 -05:00
3cec56c5d8 Revert "Fix mixing progressive/non-progressive swords and shields"
This reverts commit d05169d5e2.
2022-10-12 15:55:48 -07:00
Catobat
d8e11838c1 Fix direction Link is facing 2022-10-13 00:55:20 +02:00
Catobat
304cb34478 Consistent handling of glitched states 2022-10-13 00:46:24 +02:00
codemann8
36feaff153 Merge pull request #7 from Catobat/Terrain 2022-10-08 18:56:47 -05:00
d05169d5e2 Fix mixing progressive/non-progressive swords and shields 2022-10-08 15:43:28 -07:00
Catobat
10567536a1 Add free RAM notes 2022-10-08 18:18:50 +02:00
Catobat
4ccca38888 Implement forced transitions 2022-10-08 18:09:44 +02:00
aerinon
686bb0c064 Big key door fix 2022-09-30 15:29:00 -06:00
f93a817ed3 Show chest keys count always 2022-09-18 23:21:55 -07:00
d6f3aee02b Remove non-progressive bomb/cane upgrades 2022-09-18 18:18:12 -07:00
4817fa2013 Fix up labels
still WIP

still do not use
2022-09-18 18:11:21 -07:00
6f138825d9 Merge remote-tracking branch 'codemann/OWMain' into overworld_kara
WIP, Broken, Do Not Use
2022-09-18 17:36:49 -07:00
codemann8
f0a15dce36 Fixed incorrect comment 2022-09-07 19:41:39 -05:00
codemann8
3c6c089323 Added warning if overworld map code exceeds original bounds 2022-09-07 19:41:01 -05:00
codemann8
223c086c82 Merge branch 'DRUnstable' into OWMain 2022-09-07 19:38:34 -05:00
aerinon
9cdca6edb3 Fix for rain prevented doors and key door numbering 2022-09-07 16:51:57 -06:00
aerinon
6b853222f2 Fix for rain prevented doors and key door numbering 2022-09-07 16:51:29 -06:00
aerinon
2acee4abb9 Flute activated pickup sfx 2022-09-07 15:09:04 -06:00
codemann8
ee7e08f46c Merge branch 'DRUnstable' into OWMain 2022-08-25 16:14:08 -05:00
codemann8
348da3ac99 Chickens now spawn on same layer as Link 2022-08-25 00:27:25 -05:00
aerinon
8a18566da1 Merge branch 'DRUnstable' into Synthesis
# Conflicts:
#	doorrando/overrides.asm
2022-08-24 14:27:34 -06:00
aerinon
0e15eb3560 Merge branch 'BlindZeldaDespawn' into DRUnstable 2022-08-24 14:26:48 -06:00
aerinon
0941cd321e Merge branch 'DRUnstable' into Synthesis 2022-08-24 14:24:37 -06:00
aerinon
2457c67d0e Bank map update 2022-08-24 13:13:24 -06:00
codemann8
93b1949c71 Merged DR v1.0.1.1 2022-08-18 20:51:22 -05:00
codemann8
bfa105fd62 Minor MSU change for bunny music 2022-08-18 20:48:51 -05:00
aerinon
e1fa3aa7b7 Merge branch 'DRUnstable' into Synthesis 2022-08-11 15:28:38 -06:00
aerinon
ca70d8c2a3 Merge branch 'DRVolatile' into Synthesis 2022-08-11 15:28:32 -06:00
aerinon
ad6a2ed2fe Merge remote-tracking branch 'origin/DRVolatile' into DRVolatile 2022-08-11 15:28:00 -06:00
aerinon
2309b88545 Standing items fix for reloading pot items 2022-08-11 15:27:38 -06:00
aerinon
22b5524a4c Merge pull request #22 from Catobat/Tavern
Shuffle Back of Tavern
2022-08-11 15:27:00 -06:00
aerinon
e321299603 Fix for crash 2022-08-08 10:33:01 -06:00
aerinon
a6577b4e4b Output for collection rate config 2022-08-05 13:31:18 -06:00
aerinon
196905a83f Merge branch 'DRUnstable' into Synthesis 2022-08-05 13:29:54 -06:00
codemann8
f60b03ba42 Fixed TR Peg Puzzle Not Spawning Portal Overlay 2022-07-31 21:46:54 -05:00
codemann8
c029de9cdc Fixed disappearing mirror portal in Inverted 2022-07-31 21:12:54 -05:00
codemann8
25761a1aa6 Changed MSU-1 in Inverted to flip the triggers for the secondary OW tracks 2022-07-31 21:11:40 -05:00
codemann8
c209abd2a5 Fixed Sprite Author in credits to have same gap as other groups 2022-07-31 09:06:35 -05:00
codemann8
bbc7197933 Adding print statements to help with Credits Debugging 2022-07-29 16:10:36 -05:00
codemann8
8aeeb5efa3 Changed to spawn sprites in chests to nearest 8 pixel boundary 2022-07-29 13:13:03 -05:00
aerinon
53f89790a7 Fix for floodgates in vanilla mode 2022-07-29 12:08:36 -06:00
codemann8
9cca3adb8e Reserving space for the excluded Murahduhla tree sprite in Bonk Drop shuffle 2022-07-28 19:23:43 -05:00
codemann8
324014bb54 Added struct for OW Bonk Prize data table 2022-07-28 18:53:01 -05:00
codemann8
6f58eb7c2c Update OW Event Data documentation for newly occupied Bonk Drop Shuffle bitflag slots 2022-07-28 16:54:02 -05:00
codemann8
5d65ae09da Fixed SP floodgate issue 2022-07-28 16:53:17 -05:00
codemann8
da85032de2 Fixed disappearing mirror portal in Inverted+CrossedOWR 2022-07-28 16:03:53 -05:00
codemann8
959f5ce5ab Fixed all goals requiring Aga2 to look at the Aga2 boss flag instead of pyramid hole 2022-07-27 17:53:15 -05:00
codemann8
b107297705 Moving some of the bonk sprite offsets up so the item is collectable without boots 2022-07-26 18:43:06 -05:00
codemann8
cce3594532 Fixed issue with Inverted Aga portal not displaying tile correctly pre-Aga 2022-07-26 18:30:04 -05:00
codemann8
b25c477958 Bonk Trees will revert color after collection 2022-07-26 18:13:20 -05:00
codemann8
1be10e5e12 Fixed issue with Inverted Aga portal not displaying tile correctly pre-Aga 2022-07-26 17:51:15 -05:00
codemann8
2cee6ea4ee Fixed issue with Inverted Aga portal not displaying tile correctly pre-Aga 2022-07-26 17:34:59 -05:00
codemann8
fff99a2f6b Fixed issue with bonk prize on screen 2B 2022-07-24 14:56:03 -05:00
codemann8
1716b4583c Fixed wrong loot ID reference 2022-07-24 13:55:39 -05:00
codemann8
5e6038b464 Shift AddReceivedItemExpanded data section down, sorry Fish 2022-07-24 13:44:11 -05:00
codemann8
8ccf8ecd66 Adding alternate tree colors for Bonk Drops 2022-07-24 11:30:46 -05:00
codemann8
ed72830397 Implemented Bonk Drop Shuffle 2022-07-24 11:29:28 -05:00
codemann8
6696f4bc24 Add new items from Bonk/Pot pool 2022-07-24 11:23:48 -05:00
codemann8
ac934dde3b Formatting improvements 2022-07-19 14:08:22 -05:00
codemann8
c64d0266d5 Move owrando hook out of DR and into main rando 2022-07-18 07:10:49 -05:00
codemann8
7ae2102a16 Revert "Merged DR v1.0.1.0"
This reverts commit 7ddca582e5.
2022-07-08 10:25:00 -05:00
codemann8
7ddca582e5 Merged DR v1.0.1.0 2022-07-08 10:15:00 -05:00
codemann8
7c7664224e Merged DR v1.0.1.0 2022-07-08 05:32:08 -05:00
aerinon
17d1b12890 Merge branch 'master' into DRVolatile
# Conflicts:
#	compasses.asm
2022-07-06 10:03:01 -06:00
aerinon
4e6acaf7b9 Big key door double-sided check 2022-07-06 09:48:42 -06:00
aerinon
7f8e560b76 Merge branch 'DRVolatile' into StandardThrone 2022-07-01 15:15:22 -06:00
aerinon
3b5ccc7dfa Enemizer fix for pot substitution. 2022-06-30 11:52:02 -06:00
aerinon
3e6da34c71 Pot substitution for certain ammo and rupee items. 2022-06-29 11:32:51 -06:00
aerinon
92c155f5c0 Re-implemented mirror scroll during escape behavior to not affect entrance and include the throne spawn point 2022-06-16 12:32:31 -06:00
aerinon
ae1fde65f4 Fix for followers despawning near maiden cell 2022-06-16 06:45:11 -06:00
aerinon
a36068fb04 Fix for Zelda despawning near maiden cell 2022-06-15 23:49:20 -06:00
aerinon
6f1eda9296 Fix for pottery/shopsanity conflict 2022-06-15 16:53:49 -06:00
aerinon
2579038832 Mirror scroll spawns in Zelda's cell instead of last entrance (mirror remains unchanged)
Tapestry is open when spawning in the throne room.
2022-06-14 12:36:04 -06:00
Catobat
87cac1a113 Shuffle Back of Tavern 2022-06-13 20:37:59 +02:00
codemann8
2298148206 Added new DPad invert options for just L/R and just U/D 2022-05-25 14:52:50 -05:00
codemann8
f86780913f Fixed issue with mirror portals showing up in DW in Crossed OW 2022-05-21 20:53:00 -05:00
codemann8
9b846498a2 Moved some mirror code out to new function 2022-05-21 20:51:54 -05:00
codemann8
9b48477418 Adding explicit notation to ASM commands for asar 2022-05-21 20:48:44 -05:00
codemann8
5842cecf0d Replacing hardcoded jumps and references to labels 2022-05-21 20:47:01 -05:00
codemann8
74f66abf51 Replacing hardcoded jumps and references to labels 2022-05-21 20:44:38 -05:00
codemann8
c157708769 For moving mirror portals in Crossed OW, changing EOR to ORA 2022-05-21 17:46:29 -05:00
codemann8
478d4fc7f3 Fix issue with mirror portals showing up on map checks when they shouldn't 2022-05-21 14:55:42 -05:00
codemann8
57bc6a1f59 Fixed crash in Crossed OW when performing mirror superbunny 2022-05-21 11:04:15 -05:00
aerinon
9779f91ce9 Fix dungeon completion bitfield (16-bit) 2022-05-19 10:36:20 -06:00
aerinon
003278f7e0 Fix dungeon completion bitfield 2022-05-18 14:52:47 -06:00
aerinon
15cc72c1e0 Correct the width on the AND for MaybeFlagCompassTotalPickup 2022-05-18 14:52:34 -06:00
aerinon
db2fe4cf39 Fix compass compare 2022-05-17 13:05:34 -06:00
aerinon
ed3ce6af6f Merge pull request #20 from cassidoxa/compasses_dr
Fix checking compass mode for compass count display bitfield
2022-05-17 13:03:06 -06:00
codemann8
04948c72f6 Adding Catobat to OWR credits 2022-05-17 08:04:37 -05:00
cassidoxa
336931fb02 Fix checking compass mode for compass count display bitfield 2022-05-15 18:54:52 -04:00
codemann8
a62fcff30a Add lowercase letters to credits end screen 2022-05-05 23:24:32 -05:00
codemann8
31e98903bc Unscramble lowercase letters for new font 2022-05-05 18:26:11 -05:00
codemann8
34f4b72524 Adding labels and rearrange some of the Special Transition code 2022-05-04 16:31:32 -05:00
codemann8
e1a17fa945 Merge pull request #6 from Catobat/Special
Randomize Special Transitions
2022-05-04 15:58:45 -05:00
aerinon
4cdd41dbf5 Fix for standing item, all enemy drops and pot item converted to new system 2022-05-03 13:51:11 -06:00
Catobat
c62b69d1a8 Randomize Special Transitions 2022-05-01 01:25:21 +02:00
aerinon
5863f9783f Minor fix up on CrystalPendantFlags_3 2022-04-30 15:20:53 -06:00
aerinon
445a91c2aa Merge pull request #19 from cassidoxa/keyfix
Fix key door indexing
2022-04-30 15:17:59 -06:00
cassidoxa
e804455743 Fix key door indexing 2022-04-30 13:35:20 -04:00
aerinon
675d68175c Delete test file 2022-04-28 16:39:06 -06:00
aerinon
3685d8194e SRAM fix for MultiClient. Only set SRAM flag on locations that count toward collection rate.
Shifted uppercase font.
2022-04-28 16:06:31 -06:00
aerinon
71d26eb109 Lowercase font 2022-04-27 14:14:54 -06:00
aerinon
0960dcaac9 Merge branch 'master' into DRVolatile 2022-04-27 13:50:42 -06:00
aerinon
eb0bc2b7f6 Moved doorrando code. Fixed a multiclient issue with pot switches. 2022-04-27 13:47:12 -06:00
aerinon
f0b767885c Fix bug with .checkAga2 in overworld map with new SRAM constants 2022-04-26 12:16:07 -06:00
aerinon
e088a040f8 Merge branch 'dr_sram' of https://github.com/cassidoxa/z3randomizer into cassidoxa-dr_sram
# Conflicts:
#	hooks.asm
#	menu/overworldmap.asm
#	music.asm
2022-04-26 11:57:51 -06:00
aerinon
53f723a196 Letters/Crystal numbers 2022-04-21 15:42:32 -06:00
codemann8
a26b128b52 Merge remote-tracking branch 'upstream/DRUnstable' into OWMain 2022-04-21 13:11:31 -05:00
cassidoxa
352d1e8a22 Re-add accidentally deleted HUD stuff
Fix some processor flags
2022-04-20 20:33:40 -04:00
codemann8
405edc51b5 Merge pull request #5 from Catobat/MixedMap
Implement new overworld map draw routine for Mixed
2022-04-20 16:51:23 -05:00
Catobat
d1a874cd7f Implement new overworld map draw routine for Mixed 2022-04-20 23:38:20 +02:00
aerinon
4b68406be0 Merge branch 'DRUnstable' into DRVolatile 2022-04-20 13:56:31 -06:00
aerinon
a017c98c4e Map bug with prizes 2022-04-20 09:07:59 -06:00
aerinon
e8f06f2da6 Pottery fix for vanilla hera key 2022-04-20 08:52:01 -06:00
cassidoxa
9c41ffb55b Merge branch 'sram_rework' into dr_sram 2022-04-20 00:30:35 -04:00
codemann8
0a7b886978 Merge remote-tracking branch 'upstream/DRUnstable' into OWMain 2022-04-19 21:32:47 -05:00
aerinon
3114223a04 Can force the drawing algorithm to skip 2022-04-19 14:35:16 -06:00
aerinon
f6015a8569 New colorized pot and bitfields 2022-04-19 14:04:12 -06:00
codemann8
0a57153762 Changed OW map in attract mode to show LW map always 2022-04-15 10:48:33 -05:00
codemann8
436ecbb17d Merged DR v1.0.0.3 2022-04-15 10:34:10 -05:00
aerinon
d116249412 Merge branch 'DRUnstable' into DRVolatile 2022-04-13 13:32:31 -06:00
aerinon
4239e7204e Check Aga2's boss defeat flag instead of pyramid hole
New flag on compass mode to indicate maps should be used instead for showing the location
2022-04-13 13:30:15 -06:00
codemann8
ed03692bef Fix from Aerinon for map/compass dungeon locations on map check 2022-04-10 19:16:24 -05:00
codemann8
c7f9b5c3a0 Fixed map check for GT skull icon to check if Aga2 defeated rather than pyramid hole opened 2022-04-05 11:29:46 -05:00
6400a563ea unscramble lowercase letters for new font 2022-04-02 10:07:39 -07:00
9c30e3cdf9 Merge commit '697a742e0937780d3e6d1193876c8096ef1e2200' into HEAD 2022-04-01 18:28:29 -07:00
aerinon
281beeeb58 Switch standing item gfx to a different slot
Rain state fix
2022-03-29 14:29:04 -06:00
codemann8
7dabea9f8b Update events.asm 2022-03-26 07:03:54 -05:00
codemann8
da788dadcd Merge remote-tracking branch 'upstream/DRUnstable' into OWMain 2022-03-26 07:00:13 -05:00
aerinon
93fe175cab Don't delete hammer when hammer dashing through pots and the sprite limit is reached
Hook for frozen enemies killed with hammer (if there's an item they won't automatically drop the freeze prize now)
2022-03-23 14:24:36 -06:00
codemann8
697a742e09 Minor fix to flute SFX for pre-activated flute 2022-03-18 23:21:45 -05:00
aerinon
c687157882 Fix the Y index for ShouldCountNormalPot 2022-03-08 08:53:23 -07:00
codemann8
eb30242920 Fixed mirror bonk issue incorrectly leaving a mirror portal behind 2022-03-07 20:12:32 -06:00
codemann8
bd8b79ae5c Fixed issue with mirror portal not spawning when entering OW from the DW in Crossed OWR 2022-03-07 19:03:52 -06:00
aerinon
60026bea50 Pottery refinements 2022-03-07 10:44:53 -07:00
aerinon
66657eb956 Missed a line 2022-03-04 17:56:07 -07:00
aerinon
a0ebf72d59 Lifting normal pots increases location count
Pot despawn protection
Hud updates
2022-03-04 15:24:22 -07:00
aerinon
c83185c1b2 Minor bug fix 2022-02-24 14:04:33 -07:00
codemann8
4958d43d71 Some additional changes to lowercase dungeon text 2022-02-24 06:05:23 -06:00
codemann8
cb48137fa7 Fixed issue with mirror portal deleting after mirror bonk in Crossed OW 2022-02-22 19:55:02 -06:00
aerinon
2c8299bac3 Standing item key for hera basement cage 2022-02-15 12:13:29 -07:00
aerinon
fe66c67d07 Fixing up the hud to indicate Pendant/Crystal etc 2022-02-15 12:12:42 -07:00
7da5e6257a Merge branch 'OWMain' of github.com:codemann8/z3randomizer into overworld_kara 2022-02-11 13:36:00 -08:00
aerinon
a80171ba9b Revert SRAM changes (not yet ready) 2022-02-10 08:37:05 -07:00
aerinon
57dec5651f Merge branch 'DRMain' into DRUnstable 2022-02-09 14:34:58 -07:00
aerinon
5bd4d36cd9 Fix for standing item palette 2022-02-09 14:17:42 -07:00
aerinon
e8b85e4815 Lowercase item text 2022-02-09 10:06:16 -07:00
aerinon
93fe72466d Merge branch 'master' into DRMain
# Conflicts:
#	LTTP_RND_GeneralBugfixes.asm
#	hooks.asm
#	music.asm
2022-02-09 09:59:56 -07:00
aerinon
7db582d894 Moved SRAM to reserved locations 2022-02-09 09:02:17 -07:00
codemann8
e01e8569d7 Fixed issue with TR Peg Puzzle Portal not working 2022-02-07 19:20:32 -06:00
codemann8
ea8f4dbc57 Fixed issue with TR Peg Puzzle Portal not working 2022-02-07 18:00:10 -06:00
codemann8
ece66e38df Added lowercase version of dungeon item text 2022-02-06 01:00:16 -06:00
codemann8
ba8a9aeb90 Merged in Upstream ER changes 2022-02-04 06:04:26 -06:00
codemann8
98949be9bc Changed GT/AT swap in Mixed OW to prioritize leaving AT vanilla unless GT is the only one in the starting world 2022-02-03 06:13:13 -06:00
codemann8
ddd86a96cf Minor code improvement 2022-02-02 20:00:49 -06:00
aerinon
725f6c110a Couple of fixes for Standing Items counts and generic keys in caves 2022-01-24 16:06:04 -07:00
8dfdd3ee87 Merge branch 'main' into overworld_kara 2022-01-24 14:07:50 -08:00
ede8760b5c Make non-seeded rng a rom flag instead of compile flag 2022-01-24 13:55:29 -08:00
2a15f39e65 Fix boomerang instakilling Armos Knights 2022-01-24 13:55:19 -08:00
aerinon
3c9b04f30a Fixed up the anti-soft lock in swamp
Combined flags and fixed a couple of bugs
2022-01-21 16:07:03 -07:00
codemann8
c7718e7a47 Fixed Hera boss music to correctly read boss defeated flag 2022-01-19 14:39:19 -06:00
codemann8
335744f7b6 Restored vanilla Ice Palace terrain for Inverted 2022-01-19 03:18:31 -06:00
codemann8
7633c8b586 Fixed Hera boss music to correctly read boss defeated flag 2022-01-19 02:31:38 -06:00
codemann8
1677b95744 Restoring vanilla terrain for glitched Inverted modes 2022-01-19 01:42:16 -06:00
codemann8
14748b7788 Fixed world flag on Mountain Cave start 2022-01-19 01:39:24 -06:00
codemann8
bfbc7f16b1 Fixed issue with spawning on Pyramid/HC Ledge with old man 2022-01-19 00:23:24 -06:00
codemann8
c79863aad2 Fixed issue with Inverted Mirror Bonks not getting applied appropriately 2022-01-18 03:14:09 -06:00
codemann8
b72f89ff87 Made flute SFX louder for preactivated flute item get 2022-01-15 20:56:16 -06:00
codemann8
51d7f663c3 Restored vanilla ladder to Dark Graveyard in Inverted 2022-01-15 13:28:45 -06:00
codemann8
49b0cf0669 Inverted TR Peg screen terrain changes 2022-01-15 12:40:51 -06:00
codemann8
cbc4bbd6f3 Removed ladder from DDM 2022-01-15 12:22:01 -06:00
codemann8
3e9f598fe1 Added flute SFX to itemget if collecting a pre-activated flute 2022-01-15 04:07:27 -06:00
codemann8
f2a03f0bda Reorganized and reserved new starting data section 2022-01-14 12:59:14 -06:00
codemann8
fdea61fbf3 Added Starting OW Flag Table 2022-01-13 22:09:01 -06:00
codemann8
b5e313d709 Added Starting OW Flag Table 2022-01-13 21:56:03 -06:00
codemann8
5589127f81 ER Fix by cassidy 2022-01-13 21:54:56 -06:00
aerinon
50dd0c7be4 Fixing bugs with pottery lottery 2022-01-13 15:03:20 -07:00
aerinon
149f19df83 Merge branch 'DRVolatile' into Potsanity 2022-01-06 16:08:02 -07:00
aerinon
8698c3e109 Merge branch 'DRMain' into DRVolatile 2022-01-06 16:04:08 -07:00
codemann8
d71e873d72 Extended Spiral/Mimic Ledge in Inverted 2022-01-06 12:45:27 -06:00
codemann8
c5ff897be6 Inverted TR Peg screen terrain changes 2022-01-06 11:39:21 -06:00
codemann8
b20f9ddd67 Merged DR v0.5.1.7 2022-01-06 02:13:05 -06:00
codemann8
67b96b3051 Extended Spiral/Mimic Ledge in Inverted 2022-01-06 01:52:58 -06:00
aerinon
7bf2a259a4 Merge remote-tracking branch 'origin/DRMain' into DRMain 2022-01-05 14:32:48 -07:00
aerinon
83ce4bf566 Merge pull request #17 from codemann8/MSUMuteFix
Preserve original Sanc/HC music track change if Zelda isn't delivered yet
2022-01-05 14:32:37 -07:00
aerinon
fc5e6191eb Merge remote-tracking branch 'origin/DRMain' into DRMain 2022-01-05 14:29:03 -07:00
aerinon
52c40ba0ca Merge pull request #16 from Catobat/DRFix
General fixes
2022-01-05 14:28:36 -07:00
aerinon
c88a301708 Merge branch 'master' into DRMain
# Conflicts:
#	tables.asm
2022-01-05 14:26:48 -07:00
aerinon
e5d3ebf3cd Minor potsanity refinements 2022-01-04 15:49:00 -07:00
Thomas Prescott
c416bfa917 update credits 2022-01-03 12:29:04 -08:00
b2043ef15e Adjust credits to match layout of base randomizer fork 2022-01-03 12:26:15 -08:00
74c55cf048 Merge remote-tracking branch 'codemann/OWMain' into overworld_kara 2022-01-01 15:30:19 -08:00
spannerisms
e78c41ef38 match expected usage 2021-12-29 18:58:15 -08:00
6db6733d80 Add permanent ice physics bit 2021-12-29 18:51:42 -08:00
8ffef89fb8 Fix bee damage 2021-12-27 14:04:20 -08:00
8c6d2ac26d Fix moldorm/somaria issue and add both-canes mode 2021-12-23 22:13:30 -08:00
0f26e5aaa5 Fix width of special cane freestanding sprites 2021-12-23 22:13:30 -08:00
8a25dc9d52 Prevent hitting stunned ganon in cane-mode with default vulnerability 2021-12-23 22:13:30 -08:00
d2ad452170 Fix mothula/ganon breaking things (hopefully) 2021-12-23 22:13:30 -08:00
b1e3a7999c Remove bomb damage in cane modes 2021-12-23 22:13:30 -08:00
53792aea25 Add cane-only modes 2021-12-23 22:13:26 -08:00
codemann8
d75325e1c5 Move mirror portal off screen during mirror bonk in Crossed OW 2021-12-22 10:51:26 -06:00
codemann8
0a4c624f2f Move mirror portal off screen during mirror bonk in Crossed OW 2021-12-22 10:49:12 -06:00
aerinon
7cf57a7a37 Merge branch 'DRVolatile' into Potsanity 2021-12-16 16:03:23 -07:00
aerinon
6821648443 potsanity advancement 2021-12-16 16:03:10 -07:00
codemann8
9c3d85e360 Improvement to FF damage fix to insta-warp Link to destination once Link has exceeded the bounds of the current screen 2021-12-13 23:16:29 -06:00
codemann8
c3df5f6cb1 Fixed mirror portals showing in DW 2021-12-06 07:43:04 -06:00
0ab9095222 Merge branch 'OWMain' into overworld_kara 2021-11-29 00:04:13 -08:00
codemann8
a1fff4ff76 Fix mirror portals getting erased when changing worlds 2021-11-24 15:58:39 -06:00
codemann8
10ad8ab834 Fix mirror portals getting erased when changing worlds 2021-11-22 09:07:38 -06:00
codemann8
3262c6ff1a Fix mirror portals getting erased when changing worlds 2021-11-20 00:34:57 -06:00
codemann8
9094d118df Fixed Inverted Double-Swap issue 2021-11-14 17:08:06 -06:00
e96d802ed1 Shorten duration of boomerang stun 2021-11-10 00:08:35 -08:00
b515b59a38 Make boomerang in bomb-only mode stun enemies it would normally damage 2021-11-08 16:38:03 -08:00
69a669e16e Merge branch 'OWMain' into overworld_kara 2021-11-08 00:09:02 -08:00
4896985493 Fix bomb icons on file select/endgame screens 2021-11-07 23:58:40 -08:00
2fd459d8ca Show bomb level on file select screen in bomb-only mode 2021-11-07 19:32:27 -08:00
918eefc3bd Minor fixes 2021-11-07 19:31:53 -08:00
codemann8
7d80b8087a Allow normal Link speed with Old Man if not in his cave or on WDM 2021-11-07 16:24:45 -06:00
2b241b2340 Unify handling of bomb colors in bomb-only mode 2021-11-07 12:47:13 -08:00
codemann8
2c6db075a9 Fixed boss music 2021-11-06 16:19:48 -05:00
codemann8
ad5b78b3d1 Preserve Sanc music change in Standard 2021-11-06 16:18:09 -05:00
codemann8
e8d5a9635d Play Sanc music on arrival in Sanc in Standard 2021-11-06 16:17:37 -05:00
codemann8
15a381769c Merge branch 'DRMain' into OWMain 2021-11-02 17:20:03 -05:00
codemann8
582abf3d32 Fixed boss music 2021-11-02 17:17:37 -05:00
aerinon
f19b65b86c Merge branch 'DRMain' into DRVolatile 2021-11-02 15:29:20 -06:00
aerinon
6757e35dca Straight Stair fixes 2021-11-02 15:24:21 -06:00
codemann8
ff6a553a0d Fake flipper autokill reversal 2021-11-01 10:59:37 -05:00
codemann8
dd57b4be79 Preserve Sanc music change in Standard 2021-11-01 02:09:05 -05:00
codemann8
4bcc76e83b Play Sanc music on arrival in Sanc in Standard 2021-10-31 20:56:27 -05:00
Catobat
1e6d79badc Fix bug with straight stairs and vanilla doors 2021-10-31 23:16:47 +01:00
Catobat
3f34e50a62 Improve transition animation from straight stairs 2021-10-31 21:17:18 +01:00
Catobat
a1fafb72cd Keep dungeon tileset after opening the map 2021-10-31 21:16:09 +01:00
0c6ba20470 Merge branch 'main' into overworld_kara 2021-10-30 16:38:09 -07:00
82c5190f63 Merge branch 'OWMain' into overworld_kara 2021-10-30 11:55:08 -07:00
aeec3fe6c6 Allow early detonation of bombs and add build flag to remove static RNG 2021-10-30 09:11:36 -07:00
codemann8
2e9f4c5abb Fixed issue with whirlpools not changing world in Crossed OW 2021-10-28 21:40:51 -05:00
codemann8
86212c8d25 Adding cross-world behavior for Whirlpool Shuffle 2021-10-27 01:09:53 -05:00
codemann8
4e67ebd959 Make Smith deletion on S+Q dependent of a new flag 2021-10-22 00:21:22 -05:00
codemann8
7819e80051 Fixed portal to match grass in Inverted 2021-10-21 22:18:23 -05:00
codemann8
2215b16240 Merge branch 'DRMain' into OWMain 2021-10-21 21:26:38 -05:00
aerinon
85d799ba67 Merge branch 'DRMain' into DRVolatile 2021-10-21 16:35:09 -06:00
aerinon
620c672fe1 Turn off Terrorpin AI fix by default - can be a post-gen option 2021-10-21 16:18:51 -06:00
aerinon
f95bce282b Removed some comment cruft 2021-10-21 16:15:34 -06:00
aerinon
415e2cae41 Merge pull request #15 from spannerisms/master
Quadrant glitch fix
2021-10-21 16:09:45 -06:00
aerinon
9bf662642b Merge branch 'DRMain' into OverworldMapRefactor 2021-10-21 14:53:55 -06:00
aerinon
27654b9ac9 Merge remote-tracking branch 'baserom/master' into DRMain
# Conflicts:
#	hooks.asm
#	newhud.asm
#	utilities.asm
2021-10-21 14:15:54 -06:00
aerinon
aee5fe506a Standing items start 2021-10-21 14:11:57 -06:00
aerinon
c503e3eb61 Overworld Map Refactor 2021-10-21 14:05:59 -06:00
aerinon
319aba5e4d EG disarmament on mirror 2021-10-05 14:15:38 -06:00
825d4a1ead Merge branch 'overworld_kara' of github.com:ardnaxelarak/z3randomizer into overworld_kara 2021-10-02 21:19:06 -07:00
6d9cbc85b7 Merge branch 'OWMain' of github.com:codemann8/z3randomizer into overworld_kara 2021-10-02 20:46:14 -07:00
f6f6383913 Merge remote-tracking branch 'codemann/OWMain' into overworld_kara 2021-09-21 14:10:23 -07:00
fb4068a3e1 Merge branch 'main' into overworld_kara 2021-09-21 11:55:33 -07:00
codemann8
a30e459dbb Merge branch 'DRMain' into OWMain 2021-09-17 10:54:00 -05:00
aerinon
cc502c7524 Removed stonewall pre-opens 2021-09-16 16:01:51 -06:00
aerinon
f9e3bec5cb Removed rails using a dynamic flag 2021-09-07 16:24:18 -06:00
codemann8
200c1ff334 Merge branch 'DRMain' into OWMain 2021-08-31 19:21:19 -05:00
aerinon
07a3a9ad03 Catobat map fix
Cutoff table updated
Mutliworld mem location added for item ids
2021-08-31 15:35:19 -06:00
42002ae839 Merge branch 'main' into overworld_kara 2021-08-26 08:44:15 -07:00
codemann8
53dd7ba820 Fix for TR Pegs issue when fluting direct to TR from a screen with hammerpegs 2021-08-26 00:53:02 -05:00
codemann8
5d6d509bd9 Update Crossed OW to only perform Link/Bunny state changes when world changes 2021-08-26 00:51:41 -05:00
codemann8
fe24f6f865 Play SFX on crossworld transition in Crossed OW 2021-08-25 02:21:56 -05:00
codemann8
9b48a88df6 Retain Link state on transition unless bunny in Crossed OW 2021-08-21 18:02:59 -05:00
codemann8
aed1506114 Fixed issue with waterwalking in Crossed 2021-08-21 15:16:21 -05:00
codemann8
11be05c65a Fix Bunny/Lonk issues in Crossed OW 2021-08-20 22:47:17 -05:00
codemann8
f7525866c7 Fixed Flute crash 2021-08-20 20:43:48 -05:00
codemann8
a8e119285e Actually fixed Mixed flag problems 2021-08-19 21:53:26 -05:00
codemann8
58bf92ba04 Moved OW flag checks to global variable 2021-08-19 20:01:48 -05:00
codemann8
94a987f23f Fixed missing OW flag check changes 2021-08-19 18:47:29 -05:00
codemann8
ad8c4e8e70 ROM changes to support Crossed OW changes 2021-08-16 22:52:04 -05:00
codemann8
1210264294 Changed LW2 track in MSU-1 to play after Aga1 kill instead of ped pull 2021-08-11 06:04:09 -05:00
codemann8
c399f8c77b Separated ambient SFX from music track selection
Fixes issue with ambient SFX stopping and starting
2021-08-11 05:53:27 -05:00
0816bb7cab Merge branch 'fix_ohko' into overworld_kara 2021-08-09 15:33:03 -07:00
a12b5a9188 Merge branch 'OWMain' into overworld_kara 2021-08-02 19:00:33 -07:00
f14fea3699 Merge branch 'main' into overworld_kara 2021-08-02 19:00:13 -07:00
codemann8
06a7b7bead Fixed SW MSU track to play regardless of world 2021-08-02 04:20:02 -05:00
codemann8
677ad64419 Rewrote music calculation 2021-08-01 23:41:24 -05:00
codemann8
634764d4fc Merge branch 'DRMain' into OWMain 2021-07-28 16:24:02 -05:00
07f0ee9962 Merge branch 'OWMain' into overworld_kara 2021-07-28 12:54:14 -07:00
aerinon
fa516b58d4 Merge pull request #14 from codemann8/MSUMuteFix
Fix for boss music not playing in non-DR modes
2021-07-27 08:53:08 -06:00
codemann8
9cecd30e89 Fix for boss music not playing in non-DR modes 2021-07-27 02:42:36 -05:00
codemann8
6e721fb069 Fix for boss music not playing in non-DR modes 2021-07-27 02:40:12 -05:00
7aac3970d1 Add pseudo-sword mode 2021-07-25 01:42:21 -07:00
b663bb982f Merge branch 'OWMain' into overworld_kara 2021-07-23 15:42:41 -07:00
73ac8d8c25 Merge branch 'main' into overworld_kara 2021-07-23 15:28:30 -07:00
codemann8
11099f53b0 Merging DRMain 2021-07-23 15:49:10 -05:00
aerinon
15337a1382 Collection Rate moved to arbline marco 2021-07-23 09:14:43 -07:00
aerinon
9861c76d23 Minor refactor to keep dr hooks in DR 2021-07-23 09:13:35 -07:00
aerinon
5b8c90e069 Merge pull request #12 from codemann8/MSUMuteFix
Some music fixes
2021-07-23 07:44:01 -07:00
aerinon
e038b0bb18 Merge pull request #13 from ardnaxelarak/DR_statCountersFix
Fix counters for damage taken and magic used
2021-07-23 07:42:18 -07:00
8e12033105 Fix counters for damage taken and magic used 2021-07-23 00:07:51 -07:00
6df8dca127 Fix Stalfos Knights in bomb-mode to have bombs instakill while collapsed 2021-07-20 20:34:08 -07:00
faf05fb9a9 Merge branch 'OWMain' into overworld_kara 2021-07-17 12:19:56 -07:00
6da1227578 Color bombs in the HUD according to bomb level in bomb-only mode 2021-07-17 12:11:25 -07:00
59affe8b93 Adjust things for replacing sword stats with bomb stats 2021-07-17 12:11:25 -07:00
codemann8
b06492d419 Merge branch 'DRMain' into OWMain 2021-07-16 01:15:39 -05:00
aerinon
bfbe3fbcc0 Addition to Cutoff room table 2021-07-15 10:33:47 -07:00
codemann8
0cd7986318 Merge branch 'DRMain' into OWMain 2021-07-14 00:06:51 -05:00
bdd665db24 move storage of BOMB_LEVEL to make it play nicely with starting equipment 2021-07-13 11:28:04 -07:00
aerinon
641ec0ffa0 Minor fix to credits
Default to AgaDoor to Std/Open state
2021-07-13 10:51:01 -07:00
aerinon
e35c437fe3 Merge pull request #10 from ardnaxelarak/DRMain
Fix junk graphics appearing during GAME OVER screen
2021-07-13 10:44:51 -07:00
codemann8
c01c6f337a Fixed boss music when boss room entered thru Straight Stairs in DR 2021-07-12 20:59:57 -05:00
codemann8
a05b148261 Fixed boss music when boss room entered thru Straight Stairs in DR 2021-07-12 20:59:47 -05:00
codemann8
30d8bdd813 Suppressed awkward/abrupt music changes in dungeons when DR is enabled 2021-07-12 19:23:13 -05:00
codemann8
dc2a468acb Suppressed awkward/abrupt music changes in dungeons when DR is enabled 2021-07-12 19:22:57 -05:00
codemann8
9209153643 Supressed awkward/abrupt music changes in dungeons when DR is enabled 2021-07-12 16:44:03 -05:00
codemann8
0bce51af4e Supressed awkward/abrupt music changes in dungeons when DR is enabled 2021-07-12 15:41:59 -05:00
e81905a517 Fix bomb downgrades and track bomb stats in bomb-mode 2021-07-12 02:35:24 -07:00
da14e440c7 Add L-1 bombs as separate from no bombs in bomb-only mode 2021-07-12 02:34:57 -07:00
8d92e39451 Fix extra space in credits 2021-07-12 02:13:08 -07:00
2c221dfa37 Allow bombing barrier and getting tablet checks with L2+ bombs 2021-07-10 23:47:27 -07:00
codemann8
ec04d05c37 Merge branch 'DRMain' into OWMain 2021-07-10 13:46:57 -05:00
a6a8cda041 Fix junk graphics appearing during GAME OVER screen 2021-07-10 11:32:48 -07:00
2be05eed33 Fix junk graphics appearing during GAME OVER screen 2021-07-10 11:30:48 -07:00
aerinon
1c9936d231 Merge pull request #9 from ardnaxelarak/DRMain
Fix drawing C/P indicator and Stat Tracking
2021-07-09 10:38:20 -07:00
0054be1e4b Fix some stat tracking
- move chest turn counter to not overlap locations before mirror
- correctly print from correct memory in credits for damage/magic counter
2021-07-08 19:47:37 -07:00
2c931527e9 Merge branch 'DRMain' into overworld_kara 2021-07-08 19:39:10 -07:00
02e66ba9e3 Fix drawing C/P indicator
- no longer show icon for sewer, HC, AT, or GT
- no longer show junk in map shuffle for dungeons without the map
2021-07-08 18:34:39 -07:00
codemann8
195fd74e0b Reverting Dark Bonk Rocks rain state sprite fix 2021-07-08 20:26:18 -05:00
codemann8
a474212475 Added Rain state guards for Dark Bonk Rocks 2021-07-08 14:08:34 -05:00
8b173ac27b Fix printing damage and magic to stat counters in credits 2021-07-08 01:57:12 -07:00
codemann8
6cd0d15abf Merge branch 'DRMain' into OWMain 2021-07-07 19:11:36 -05:00
aerinon
aee82fa319 Merge branch 'master' into DRMain
# Conflicts:
#	LTTP_RND_GeneralBugfixes.asm
#	events.asm
#	hooks.asm
#	stats.asm
#	stats/creditsnew.asm
#	stats/statConfig.asm
#	swordswap.asm
#	utilities.asm
2021-07-07 11:15:11 -07:00
d960103e86 Merge branch 'main' into overworld_kara 2021-07-07 09:15:29 -07:00
7022b8768a Merge branch 'OWMain' of github.com:codemann8/z3randomizer into overworld_kara 2021-07-06 19:00:52 -07:00
codemann8
e5ec4f8393 Fixed Stumpy 2021-07-06 14:44:55 -05:00
codemann8
a87ae37eab Minor reformatting comments 2021-07-06 14:29:48 -05:00
codemann8
7f4d783870 Fixed Stumpy sprite loading 2021-07-06 14:29:10 -05:00
codemann8
17b7a23550 Fixed Frogsmith spawning as a bad sprite 2021-07-06 11:57:34 -05:00
d4e1337471 Add bombs-placed counter to stat screen 2021-07-05 17:56:56 -07:00
b8545ca055 Fix quake not blobbifying certain enemies 2021-07-05 16:15:26 -07:00
f4e7d412ed Fix hookshot and armos knights:
- hookshot now stuns enemies it would normally damage
- armos knights now take same damage from L-2 bombs as L-1/L-3
2021-07-04 18:34:10 -07:00
28b84484e0 NO BOMBOS DAMAGE 2021-07-04 15:40:57 -07:00
codemann8
6f7f9d2a39 Adding OW Rando credits 2021-07-04 11:38:24 -05:00
codemann8
f2f53e8999 Adding OW Rando credits 2021-07-04 11:29:21 -05:00
2fec3f7484 Merge commit 'f403ca10da9e009599a531be8cdcd20a61b4801c' of github.com:spannerisms/z3randomizer into overworld_kara 2021-07-01 23:05:48 -07:00
01abf889d7 Merge branch 'main' into overworld_kara 2021-07-01 23:02:23 -07:00
b8dc86d7c5 Allow Ganon to be vulnerable to arbitrary item 2021-06-29 16:43:01 -07:00
8b0f0464f8 Implement always-allowed medallions 2021-06-29 16:43:01 -07:00
b3d649a0fb Add bomb-only mode 2021-06-29 16:43:01 -07:00
codemann8
b9193d2fbf Added ability to cancel out of flute menu by pressing X 2021-06-27 19:02:19 -05:00
codemann8
8df468840f Added ability to cancel out of flute menu by pressing X 2021-06-27 14:49:28 -05:00
codemann8
7e615bc033 Fixed Aga portal mirror bonk issue 2021-06-25 13:02:40 -05:00
codemann8
3bb6f78491 Fixed VRAM issue 2021-06-24 14:47:40 -05:00
codemann8
7ba76d4a5c Partial revert of VRAM adjustment 2021-06-24 14:35:31 -05:00
codemann8
92c3448ac2 Merge branch 'DRMain' into OWMain 2021-06-23 10:58:18 -05:00
codemann8
04ffd3a00d Fixed horizontal VRAM loading glitch on megatiles 2021-06-23 08:41:43 -05:00
codemann8
5d06322bd3 Whoops 2021-06-23 05:33:43 -05:00
codemann8
17eb8073ab Initial Mixed/Crossed OW shuffle implementation 2021-06-23 03:05:13 -05:00
codemann8
b03283efd2 Various inverted map changes, including adding correct tiles to GT entrance 2021-06-22 23:09:22 -05:00
codemann8
da0b2c62e2 Added default music track to avoid game crash 2021-06-22 22:52:14 -05:00
aerinon
e9aec2ba86 Merge branch 'master' into DRMain
# Conflicts:
#	LTTP_RND_GeneralBugfixes.asm
#	hooks.asm
2021-06-22 13:12:07 -06:00
aerinon
717434bd88 Bank notes added 2021-06-22 13:05:40 -06:00
codemann8
6f0d52f70e Merge pull request #4 from m0zes/OWMain
Cherry Picked Bank fixes
2021-06-21 20:29:10 -05:00
qwertymodo
b0b65f2131 More robust bank fix
Shouldn't crash on crystal/pendant anymore
2021-06-21 20:25:05 -05:00
qwertymodo
18422922e2 Set DB/DP to 0 in frame hook
Possible fix for hole transition crashes
2021-06-21 20:24:53 -05:00
codemann8
5a7bcfe9f5 Renamed inverted map subroutines to be consistent with OWID 2021-06-19 04:06:34 -05:00
codemann8
a6dafc5fa6 Add HUD indicator if LW/DW in Mixed OW mode 2021-06-13 12:17:51 -05:00
codemann8
c1ecc4c891 Merge branch 'DRMain' into OWMain 2021-06-04 21:49:55 -05:00
aerinon
050ce5e20e Changes from DR 0.4.0.6 2021-06-04 17:02:23 -06:00
codemann8
4846bcbb58 Merge branch 'DRMain' into OWMain 2021-06-03 10:56:15 -05:00
codemann8
22f761a6c5 Added map terrain changes specific to OW Shuffle 2021-06-03 10:54:30 -05:00
codemann8
5cb8b68e8a Added convenient portals on WDM for OW Shuffle 2021-06-03 08:05:41 -05:00
codemann8
53d3fc3737 Added convenient portals on WDM for OW Shuffle 2021-06-03 07:36:59 -05:00
codemann8
6c616a20b2 Made world checks table-based rather than based on OW ID 2021-06-03 00:50:25 -05:00
codemann8
ff87b09d4b Minor reorganization of code/data placement 2021-05-30 06:44:34 -05:00
aerinon
429649bde8 Merge pull request #8 from codemann8/MSUMuteFix
Msu mute fix
2021-05-29 21:51:08 -06:00
codemann8
dd2110f91d Moved Inverted Pyramid Entrance to HC Ledge 2021-05-26 21:07:16 -05:00
codemann8
1f37695fe0 Merge branch 'DRMain' into OWMain 2021-05-24 17:52:01 -05:00
aerinon
c7a4d817c0 Changes from DR 2021-05-24 15:12:09 -06:00
aerinon
5672e2f090 Merge branch 'master' into DRMain 2021-05-24 14:52:26 -06:00
codemann8
60ab0fcae2 Merge branch 'MSUMuteFix' into OWMain 2021-05-19 04:32:10 -05:00
codemann8
9d64b5edd1 Whoops, lines got swapped 2021-05-19 04:31:55 -05:00
codemann8
2e91981a1e Merge branch 'MSUMuteFix' into OWMain 2021-05-19 04:30:05 -05:00
codemann8
6e86c5c9b8 Fixed GT/ToH MSU muting when playing Door Shuffle 2021-05-18 00:21:32 -05:00
codemann8
89881f3bee Merge remote-tracking branch 'upstream/DRMain' into OWMain 2021-05-16 04:51:57 -05:00
aerinon
e9a376d92a Bugfixes 2021-05-14 16:49:49 -06:00
aerinon
842bb043e6 Merge branch 'master' into DRMain
# Conflicts:
#	LTTP_RND_GeneralBugfixes.asm
#	catfish.asm
#	compasses.asm
#	darkworldspawn.asm
#	hooks.asm
#	inventory.asm
#	newitems.asm
#	shopkeeper.asm
#	stats.asm
#	tables.asm

Adn some updates from DR
2021-05-13 12:11:40 -06:00
codemann8
99a695c1a2 Removed unnecessary data 2021-05-02 20:28:55 -05:00
codemann8
fd3f27adb1 Minor formatting changes 2021-05-02 19:16:02 -05:00
codemann8
a0b731ffbd Moved VRAM adjustment back to original spot 2021-05-02 19:15:42 -05:00
codemann8
fd3aed6d60 Preserve Link's position if within incoming gap 2021-05-02 18:30:49 -05:00
codemann8
ff08965ce5 Minor efficiency improvements 2021-05-01 19:50:46 -05:00
codemann8
e1a763c29f Minor formatting/labeling 2021-04-29 01:18:10 -05:00
codemann8
42f77472c5 Merge pull request #3 from Catobat/OWFix3
Fix camera unlocking
2021-04-28 18:39:32 -05:00
codemann8
8be83d6f94 Merge pull request #2 from Catobat/OWFix2
Fix transitions for real
2021-04-28 18:37:44 -05:00
Catobat
0abda3e210 Fix camera unlocking 2021-04-27 22:41:32 +02:00
codemann8
e8cba03156 Updated gitignore 2021-04-26 23:15:59 -05:00
codemann8
340a3c1c9d Catobat fix for transition bugs 2021-04-26 18:06:01 -05:00
Catobat
2b65123802 Fix transitions for real 2021-04-26 21:52:06 +02:00
codemann8
7333bf7f92 Minor efficiency 2021-04-24 15:25:17 -05:00
codemann8
619185e1e0 Fixed vanilla/ID-0 transition bug 2021-04-24 15:09:13 -05:00
codemann8
cd4949ce65 Disabled setting LW/DW flag on trans 2021-04-24 15:08:39 -05:00
codemann8
e72193a6be Fixed incorrect data for special areas 2021-04-21 00:11:20 -05:00
codemann8
de637242fc Fixed bad transition data 2021-04-21 00:11:00 -05:00
codemann8
f294773832 Fixed issue with DW transitions causing hardlocking mapwrap crashes 2021-04-21 00:10:45 -05:00
codemann8
5062da19d4 Fixed visual issue with megatiles with VRAM 2021-04-21 00:09:43 -05:00
codemann8
b242f6ae9d Fixed DW hardlocks 2021-04-20 02:14:46 -05:00
codemann8
c43fb64878 Fixed incorrect transition data 2021-04-20 02:14:28 -05:00
codemann8
eb11bb455d Milestone update, all transitions work, megatiles have a visual issue 2021-04-18 13:57:57 -05:00
codemann8
9089a9eb40 Merge remote-tracking branch 'upstream/DRMain' into OWMain 2021-04-12 13:33:04 -05:00
codemann8
9a5448e1bb Fixed bad data 2021-04-12 12:13:27 -05:00
codemann8
174b17d9a2 Not quite accurate transitions, opposite coordinate incorrect still 2021-04-11 21:10:30 -05:00
codemann8
deccdfb630 Milestone successful transition to midpoint 2021-04-07 12:17:03 -05:00
aerinon
d015310e4d Blind boss checks for maiden sequence 2021-02-27 15:30:28 -07:00
aerinon
f6cc3607df Refactored Potion shop hooks to allow old behaviors 2021-02-22 14:48:10 -07:00
codemann8
fd13889f68 Merge remote-tracking branch 'upstream/DRMain' into DRMain 2021-02-18 22:45:56 -06:00
aerinon
8b622dd841 Multiclient flags
Multi Sprite Player set to skip progressive limits
2021-02-18 13:37:33 -07:00
aerinon
ddf56a9ed1 Merge branch 'DRMain2' into DRMain 2021-02-18 13:13:44 -07:00
codemann8
3dd2e7892d Initial OW Shuffle Hook 2021-02-18 09:57:54 -06:00
aerinon
4ae59ad1e6 Double count hera basement cage in keydropshuffle 2021-02-17 11:50:51 -07:00
aerinon
9d607b7caa Inverted fix - no longer a bunny in DW sanc
Standard fix - can't kill Aga1 before rescuing Zelda
Total locations to check set on file load, and displayed in HUD
2021-02-16 13:36:44 -07:00
aerinon
d15dc91db4 Fix for BallnChain guard when keydropshuffle is off 2021-02-13 20:48:51 -07:00
aerinon
9b33530dba Merge branch 'DRStairFix' into DRMain2 2021-02-13 20:45:24 -07:00
aerinon
c9d42587a4 Merge branch '16_bit_collection_rate' of https://github.com/CaitSith2/z3randomizer into InvCountMerge 2021-02-13 20:44:25 -07:00
aerinon
7fee6ce440 Merge branch '16_bit_collection_rate' of https://github.com/CaitSith2/z3randomizer into InventoryCountMerge 2021-02-12 20:45:59 -07:00
Catobat
f68a635e2b Minor fixes for in-room stairs 2021-02-12 23:00:24 +01:00
CaitSith2
a83608366c document full usage of 7EF420-7EF4FF in stats.asm 2021-02-12 07:48:09 -08:00
CaitSith2
d3af10649c Dungeon completion flags, that indicate for which dungeons the prize was collected from. 2021-02-12 07:45:32 -08:00
CaitSith2
244b622074 Move stats that were not compass related out of the former compass counters. 2021-02-12 07:27:21 -08:00
aerinon
2f5b555e0e Merge branch 'DRMain' into ShopBranch 2021-02-02 14:42:03 -07:00
aerinon
96d7a6a9ae Merge branch 'InventoryCount' into DRMain 2021-02-02 10:12:44 -07:00
aerinon
6fe4132564 Merge pull request #4 from Catobat/DRStairs
Shuffle in-room stairs
2021-02-01 16:29:51 -07:00
aerinon
a63aa6f5fe Shop fixes 2021-02-01 16:29:09 -07:00
aerinon
2a08959229 Shop counting items 2021-02-01 10:11:38 -07:00
Catobat
dab4d58f12 Shuffle in-room stairs 2021-01-30 00:07:50 +01:00
aerinon
b1d4ef3252 Merge branch 'InventoryCount' into ShopBranch 2021-01-29 15:13:14 -07:00
aerinon
05e7f8eb96 Ported over pepper's shop code 2021-01-29 13:55:13 -07:00
CaitSith2
356bfb3a05 Need more bits for end game stats 2021-01-18 12:23:18 -08:00
CaitSith2
7266706315 Make inventory count stats 16 bit. 2021-01-18 12:02:44 -08:00
aerinon
a9bddea1b4 Change how hera basement key is counted to not count Byrna 2020-12-09 14:28:12 -07:00
aerinon
b3fcd2192e Some DR changes (outdoor check for hub and keydrop correct KeyTable address)
Shop VRAM issue investigated but not solved
2020-12-08 10:57:37 -07:00
aerinon
443070fe2c Merge branch 'ChestKeyCounter' into DRMain
# Conflicts:
#	LTTP_RND_GeneralBugfixes.asm
#	build.sh
#	darkworldspawn.asm
#	events.asm
#	itemdowngrade.asm
#	shopkeeper.asm
#	stats.asm
2020-11-30 09:34:18 -07:00
aerinon
264e9f337d Keysanity menu bug fix 2020-11-20 13:57:49 -07:00
aerinon
6c7f5e46a3 Support for GT Big Key Credit
Support for Rain state prevention without rails
2020-11-19 16:27:47 -07:00
aerinon
94561e01c2 Bugfixes for lobby stuff 2020-11-12 12:18:23 -07:00
aerinon
8d9775c3de Change Compass addresses 2020-11-09 16:07:34 -07:00
aerinon
4c4fa74f1a Invisible Bunny fix
Double count Hera Basement Cage fix
2020-11-09 13:59:00 -07:00
aerinon
5310569aa3 Minor fixes 2020-11-03 10:15:41 -07:00
aerinon
5c2df8b6a6 Scroll fix 2020-11-03 10:12:48 -07:00
aerinon
b5bcc13806 Merge remote-tracking branch 'origin/DRMain' into DRMain 2020-11-03 10:12:21 -07:00
aerinon
717913b8fb Compass Refactor 2020-11-03 10:12:08 -07:00
CaitSith2
fcebea97af Don't count chest keys if they are for another player. 2020-10-30 16:53:44 -07:00
CaitSith2
44485fc02a Use defined labels instead of hard-coding the addresses. 2020-10-30 16:42:50 -07:00
aerinon
0dba58c194 Support for Mirror Scroll
DR Hud Additions
2020-10-30 16:26:28 -06:00
aerinon
6fe8496fde Create README.md 2020-10-29 16:07:44 -06:00
aerinon
49dc0f4037 DR Code Init Commit
Rails for Mixed Travel
2020-10-29 15:58:05 -06:00
randall.rupper
233afa1e38 Chest Key counters 2020-09-18 11:06:02 -06:00
CaitSith2
94722d452e Fix glitch where you can bomb yourself at high stakes chest game to get on top of pyramid/castle.
Since this is not a vanilla glitch, it has to be fixed, as it wasn't intended.
2020-09-18 11:04:48 -06:00
CaitSith2
820b5d5357 Low stakes and high stakes chest game no longer increments item counter. 2020-09-18 11:04:22 -06:00
CaitSith2
a892ff39b2 Backport terrorpin ai fix from enemizer. (and fix a bug with it.) 2020-08-05 08:48:25 -07:00
Zarby89
dad73fc883 ganon room fix for multiworld 2020-07-29 21:46:01 -07:00
caitsith2
65bd0df346 Labels added for Door rando hook points. 2020-07-15 01:27:33 -07:00
caitsith2
ff3bdc1326 Check for door rando before doing safety checks to and possibly draining room 55 (the hammer locked room) 2020-07-14 21:07:21 -07:00
caitsith2
715ba87517 Reserve the space for berserkermulti.world seed guid. 2020-07-14 11:12:25 -07:00
compiling
5a10017747 Triforce Hunt + Kill Ganon goal. 2020-06-25 07:40:53 -07:00
caitsith2
6b6bce9b78 Print hook address helpers for doors 2020-06-24 07:07:38 -07:00
caitsith2
c78559ec0f Merge branch 'master' into multiworld 2020-06-23 17:24:24 -07:00
caitsith2
c4e21be268 Merge branch 'patch-1' into multiworld 2020-06-23 01:31:50 -07:00
caitsith2
594e4e56c0 Output addresses for doors compass_r_addr and compass_w_addr hooks. 2020-06-22 06:47:33 -07:00
caitsith2
9c8e531d20 Fix asar relative path warning. 2020-06-22 06:46:34 -07:00
caitsith2
7b3e200d22 Output warnings and prints on build. 2020-06-22 06:45:58 -07:00
compiling
3cae3a66a5 Fix fake world when fluting to pyramid twice 2020-06-20 19:43:45 -07:00
caitsith2
59f851395c Merge branch 'master' into multiworld 2020-06-20 18:35:48 -07:00
caitsith2
ffc190e3cf reinstate build.bat 2020-06-13 22:04:59 -07:00
caitsith2
ea477878fc Add __pycache__ to .gitignore, rename utils.py to build.py 2020-06-09 09:14:46 -07:00
caitsith2
47091dfd68 Patch and build base2current.json in one go.
Just need to provide a linux asar library when the time comes to build on linux.
2020-06-09 09:11:02 -07:00
randall.rupper
8cf3ccb13e Add PHX/PLX in a better spot to prevent CountBottles from overwritting X 2020-06-08 09:58:46 -07:00
caitsith2
b5c7846c40 Make it a tiny bit easier to build the baserom for inclusion in multiworld and get the updated hash while at it. 2020-06-08 09:30:49 -07:00
caitsith2
4530021fea Revert exetend msu flag as it is no longer needed. 2020-06-08 09:30:49 -07:00
caitsith2
1b3a586a57 Update multiworld to be compatible with save & quit delay fix. 2020-06-08 09:30:49 -07:00
caitsith2
65db6eefb7 update windows build process to asar 2020-06-08 09:29:31 -07:00
caitsith2
e8a384200f Only launch cmd /k if the batch file was doubleclicked. 2020-06-08 09:27:32 -07:00
caitsith2
0bdc88d13a Flag for adjuster to know if extended MSU is present in rom or not. 2020-06-08 09:26:58 -07:00
caitsith2
80bc9c2028 Move player names and max them out at 255. 2020-06-08 09:26:25 -07:00
Bonta-kun
2a5e305fc6 implement remote item checks 2020-06-08 09:25:25 -07:00
Bonta-kun
c3c5ba9d53 move clock.asm from bank A0 to A4 2020-06-08 09:24:56 -07:00
Bonta-kun
af4c84c1aa fix unusable infinite bombs with empty inventory 2020-06-08 09:24:36 -07:00
Bonta-kun
f843ef9eb8 bee trap 2020-06-08 09:24:07 -07:00
Bonta-kun
49ba8e064d Make sword upgrade appear as fighter sword for swordless players 2020-06-08 09:20:42 -07:00
Bonta-kun
94218b048b Dont replace multiworld items 2020-06-08 09:20:17 -07:00
Bonta-kun
6818c3e119 free some space in bank A0 2020-06-08 09:20:00 -07:00
Bonta-kun
ddd456c04e multiworld 2020-06-08 09:19:18 -07:00
195 changed files with 20234 additions and 11602 deletions

2
.gitignore vendored
View File

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

0
data/99ff1_bombos.gfx → 99ff1_bombos.gfx Normal file → Executable file
View File

0
data/99ff1_quake.gfx → 99ff1_quake.gfx Normal file → Executable file
View File

View File

@@ -36,11 +36,41 @@ dw !ROM_VERSION_LOW
dw !ROM_VERSION_HIGH
;================================================================================
!ADD = "CLC : ADC"
!SUB = "SEC : SBC"
!BLT = "BCC"
!BGE = "BCS"
!MS_GOT = "$7F5031"
!REDRAW = "$7F5000"
!GANON_WARP_CHAIN = "$7F5032";
!TILE_UPLOAD_BUFFER = "$7EA180";
!FORCE_HEART_SPAWN = "$7F5033";
!SKIP_HEART_SAVE = "$7F5034";
; MSU-1
!REG_MSU_FALLBACK_TABLE = $7F50A0 ; 8 bytes
!REG_MSU_DELAYED_COMMAND = $7F50A9
!REG_MSU_PACK_COUNT = $7F50AA
!REG_MSU_PACK_CURRENT = $7F50AB
!REG_MSU_PACK_REQUEST = $7F50AC
!REG_MSU_LOADED_TRACK = $7F50AD ; 2 bytes
!REG_SPC_LOADING = $7F50AF
!MSU_LOADED_TRACK = $7F5400
!MSU_RESUME_TRACK = $7F5401
!MSU_RESUME_TIME = $7F5402 ; 4 bytes
!MSU_RESUME_CONTROL = $7F5406
!REG_MUSIC_CONTROL = $012B
;!REG_MUSIC_CONTROL = $012C
!REG_MUSIC_CONTROL_REQUEST = $012C
!ONEMIND_ID = $7F5072
!ONEMIND_TIMER = $7F5073
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
@@ -48,14 +78,33 @@ function hexto555(h) = ((((h&$FF)/8)<<10)|(((h>>8&$FF)/8)<<5)|(((h>>16&$FF)/8)<<
;================================================================================
!MULTIWORLD_ITEM = "$7EF4D2"
!MULTIWORLD_ITEM_FROM = "$7EF4D3"
!MULTIWORLD_ROOMID = "$7EF4D4"
!MULTIWORLD_ROOMDATA = "$7EF4D6"
!MULTIWORLD_SCOUT_LOCATION = "$7EF4D7"
!MULTIWORLD_SCOUTREPLY_LOCATION = "$7EF4D8"
!MULTIWORLD_SCOUTREPLY_ITEM = "$7EF4D9"
!MULTIWORLD_SCOUTREPLY_PLAYER = "$7EF4DA"
!MULTIWORLD_RECEIVING_ITEM = "$7EC057" ; 0 = default | 1 = receiving
!MULTIWORLD_HUD_CHARACTER_DATA = "$7EC058" ; 0x40 bytes
!MULTIWORLD_ITEM_PLAYER_ID = "$7EC098" ; 0 = disabled
!MULTIWORLD_SPRITEITEM_PLAYER_ID = "$7EC099"
!MULTIWORLD_HUD_TIMER = "$7EC09A"
!MULTIWORLD_HUD_DELAY = "#120"
!MULTIWORLD_ITEM_ID = "$7EC09B" ; for lua scripts?
!Dungeon_ChestData = "$01E96C"
!FLAG_OW_MIXED = $04
!FLAG_OW_CROSSED = $02
incsrc hooks.asm
incsrc treekid.asm
incsrc spriteswap.asm
incsrc hashalphabethooks.asm
incsrc sharedplayerpalettefix.asm
incsrc ram.asm
incsrc sram.asm
incsrc registers.asm
incsrc vanillalabels.asm
;org $208000 ; bank #$20
org $A08000 ; bank #$A0
@@ -79,27 +128,28 @@ incsrc fairyfixes.asm
incsrc rngfixes.asm
incsrc medallions.asm
incsrc inventory.asm
incsrc ganonfixes.asm
incsrc zelda.asm
incsrc maidencrystals.asm
incsrc zoraking.asm
incsrc catfish.asm
incsrc flute.asm
incsrc dungeondrops.asm
incsrc halfmagicbat.asm
incsrc mantle.asm
incsrc swordswap.asm
incsrc stats.asm
incsrc scratchpad.asm
incsrc map.asm
incsrc dialog.asm
incsrc entrances.asm
incsrc clock.asm
incsrc accessibility.asm
incsrc heartbeep.asm
incsrc capacityupgrades.asm
incsrc timer.asm
incsrc doorframefixes.asm
incsrc music.asm
incsrc roomloading.asm
incsrc icepalacegraphics.asm
warnpc $A18000
org $1C8000 ; text tables for translation
incbin "data/i18n_en.bin"
incbin i18n_en.bin
warnpc $1CF356
org $A18000 ; static mapping area
@@ -127,12 +177,19 @@ org $A1FF00 ; static mapping area
incsrc init.asm
org $A48000 ; code bank - PUT NEW CODE HERE
incsrc timer.asm
incsrc doorframefixes.asm
incsrc music.asm
incsrc roomloading.asm
incsrc icepalacegraphics.asm
incsrc firebarlayer.asm
incsrc glitched.asm
incsrc hardmode.asm
incsrc goalitem.asm
incsrc quickswap.asm
incsrc endingsequence.asm
incsrc cuccostorm.asm
incsrc compression.asm
incsrc retro.asm
incsrc controllerjank.asm
incsrc boots.asm
@@ -143,12 +200,14 @@ incsrc decryption.asm
incsrc hashalphabet.asm
incsrc inverted.asm
incsrc invertedmaps.asm
incsrc bonktreemaps.asm
incsrc newhud.asm
incsrc compasses.asm
incsrc save.asm
incsrc password.asm
incsrc enemy_adjustments.asm
incsrc hudtext.asm
incsrc stats.asm
;incsrc hudtext.asm
incsrc servicerequest.asm
incsrc elder.asm
incsrc toast.asm
@@ -156,79 +215,95 @@ incsrc darkroomitems.asm
incsrc fastcredits.asm
incsrc msu.asm
incsrc dungeonmap.asm
incsrc special_weapons.asm
incsrc variable_ganon_vulnerability.asm
incsrc trolls.asm
incsrc multiworld.asm
incsrc terrorpin.asm
if !FEATURE_NEW_TEXT
incsrc textrenderer.asm
endif
warnpc $A58000
org $A28000
;org $228000 ; contrib area
org $A28000 ; contrib area
incsrc contrib.asm
incsrc special_weapons.asm
incsrc variable_ganon_vulnerability.asm
incsrc trolls.asm
warnpc $A38000
org $A38000
incsrc stats/main.asm
incsrc menu/overworldmap.asm ; overwrites some code in bank 0A
incsrc doorrando/doorrando.asm ; bank 27 likely A7 in the future
;bank 28/A8 for keydropshuffle / standing items
incsrc keydrop/standing_items.asm
incsrc owrando.asm ; bank AA
incsrc enemizer/main.asm ; this is originally in bank 36, but is currently in migratory status in bank 37
org $308000 ; bank #$30
incsrc tables.asm
warnpc $318000
org $348000
incsrc spc.asm
; uncomment for inverted adjustments
;incsrc sandbox.asm
org $318000 ; bank #$31
GFX_Mire_Bombos:
incbin "data/99ff1_bombos.gfx"
incbin 99ff1_bombos.gfx
warnpc $318800
org $318800
GFX_Mire_Quake:
incbin "data/99ff1_quake.gfx"
incbin 99ff1_quake.gfx
warnpc $319000
org $319000
GFX_TRock_Bombos:
incbin "data/a6fc4_bombos.gfx"
incbin a6fc4_bombos.gfx
warnpc $319800
org $319800
GFX_TRock_Ether:
incbin "data/a6fc4_ether.gfx"
incbin a6fc4_ether.gfx
warnpc $31A000
org $31A000
GFX_HUD_Items:
incbin "data/c2807_v4.gfx"
incbin c2807_v4.gfx
warnpc $31A800
org $31A800
GFX_New_Items:
incbin "data/newitems.gfx"
incbin newitems.gfx
;incbin eventitems.gfx ; *EVENT*
warnpc $31B000
org $31B000
GFX_HUD_Main:
incbin "data/c2e3e.gfx"
incbin c2e3e.gfx
warnpc $31B800
org $31C000
IcePalaceFloorGfx:
incbin "data/ice_palace_floor.bin"
incbin ice_palace_floor.bin
warnpc $31C801
org $31C800
Damage_Table:
incbin "data/damage_table.bin"
incbin damage_table.bin
warnpc $31D001
org $31D000
FileSelectNewGraphics:
incbin "data/fileselectgfx.2bpp"
incbin fileselect.chr.gfx
warnpc $31E001
org $31E000
InvertedCastleHole: ;address used by front end. DO NOT MOVE!
incbin "data/sheet73.gfx"
incbin sheet73.gfx
warnpc $31E501
org $31E800
@@ -243,28 +318,28 @@ warnpc $31F800
org $338000
GFX_HUD_Palette:
incbin "data/hudpalette.pal"
incbin hudpalette.pal
warnpc $338041
org $339000
incbin "data/sheet178.gfx"
incbin sheet178.gfx
warnpc $339600
org $339600
BossMapIconGFX:
incbin "data/bossicons.4bpp"
incbin bossicons.4bpp
if !FEATURE_NEW_TEXT
org $339C00
NewFont:
incbin "data/newfont.bin"
incbin newfont.bin
NewFontInverted:
incbin "data/newfont_inverted.bin"
incbin newfont_inverted.bin
org $0CD7DF
incbin "data/text_unscramble1.bin"
incbin text_unscramble1.bin
org $0CE4D5
incbin "data/text_unscramble2.bin"
incbin text_unscramble2.bin
endif
org $328000
@@ -274,11 +349,16 @@ if !FEATURE_NEW_TEXT
else
incsrc itemtext.asm
endif
warnpc $32E000
org $32DFD0 ; PC 0x195FD0
incsrc multiworldplayernames.asm
warnpc $330000
incsrc externalhooks.asm
;================================================================================
org $119100 ; PC 0x89100
incbin "data/map_icons.gfx"
incbin map_icons.gfx
warnpc $119401
;================================================================================
org $AF8000 ; PC 0x178000
@@ -294,10 +374,14 @@ warnpc $B08000
;Bank Map
;$20 Code Bank
;$21 Reserved (Frame Hook & Init)
;$22 Unused
;$22 Contrib Code
;$23 Stats & Credits
;$24 Code Bank
;$27 DR Code Bank
;$28 Keydrop / Standing Items Code bank
;$29 External hooks (rest of bank not used)
;$2A Reserved for OWR
;$2B Room Data migration
;$2E Reserved for Tournament Use
;$2F Static RNG (rest is reserved for tournament use)
;$30 Main Configuration Table
@@ -310,18 +394,18 @@ warnpc $B08000
;$3F reserved for internal debugging
;================================================================================
;RAM
;See ram.asm for label assignments
;$7EC900[0x1F00]: BigRAM buffer
;$7E021B[0x1]: Used by race game instead of $0ABF to avoid witch item conflict
;$7EC900[0x1F00]: BIGRAM buffer
;$7EF000[0x500]: SRAM mirror First 0x500 bytes of SRAM
; See sram.asm for labels and assignments
;$7F5000[0x800]: Rando's main free ram region
; See ram.asm for specific assignments
; See tables.asm for specific assignments
;$7F6000[0x1000]: SRAM buffer mapped to vanilla save slots 1 and 2
; See sram.asm for labels and assignments
;$7F7667[0x6719] - free ram
;================================================================================
;SRAM Map
;See sram.asm for label assignments and documentation
;See sram.asm for rando-specific assignments
;$70:0000 (5K) Game state
; 0000-04FF Vanilla Slot 1 (mirrored at $7EF000)
; 0500-14FF Ext Slot 1 (mirrored at $7F6000)
@@ -329,6 +413,44 @@ warnpc $B08000
;$70:3000 (0x16) Password
;$70:6000 (8K) Scratch buffers
;================================================================================
;org $0080DC ; <- 0xDC - Bank00.asm:179 - Kill Music
;db #$A9, #$00, #$EA
;LDA.b #$00 : NOP
;================================================================================
;org $0AC53E ; <- 5453E - Bank0A.asm:1103 - (LDA $0AC51F, X) - i have no idea what this is for anymore
;LDA.b #$7F
;NOP #2
;================================================================================
;org $05DF8B ; <- 2DF8B - Bank05.asm : 2483
;AND.w #$0100 ; allow Sprite_DrawMultiple to access lower half of sprite tiles
;================================================================================
;org $0DF8F1 ; this is required for the X-indicator in the HUD except not anymore obviously
;
;;red pendant
;db $2B, $31, $2C, $31, $3D, $31, $2E, $31
;db $2B, $25, $2C, $25, $2D, $25, $2E, $25
;
;;blue pendant
;db $2B, $31, $2C, $31, $3D, $31, $2E, $31
;db $2B, $2D, $2C, $2D, $2D, $2D, $2E, $2D
;
;;green pendant
;db $2B, $31, $2C, $31, $3D, $31, $2E, $31
;db $2B, $3D, $2C, $3D, $2D, $3D, $2E, $3D
;================================================================================
;org $00CFF2 ; 0x4FF2 - Mire H
;db GFX_Mire_Bombos>>16
;org $00D0D1 ; 0x50D1 - Mire M
;db GFX_Mire_Bombos>>8
;org $00D1B0 ; 0x51B0 - Mire L
;db GFX_Mire_Bombos
;org $00D020 ; 0x5020 - Trock H
;db GFX_TRock_Bombos>>16
;org $00D0FF ; 0x50FF - Trock M
;db GFX_TRock_Bombos>>8
;org $00D1DE ; 0x51DE - Trock L
;db GFX_TRock_Bombos
org $00D09C ; 0x509C - HUD Items H
db GFX_HUD_Items>>16
@@ -352,3 +474,362 @@ db GFX_HUD_Main>>8
org $00D25B ; 0x525B - HUD Main L
db GFX_HUD_Main
;================================================================================
org $008781
UseImplicitRegIndexedLocalJumpTable:
org $00879c
UseImplicitRegIndexedLongJumpTable:
org $008333
Vram_EraseTilemaps_triforce:
org $008913
Sound_LoadLightWorldSongBank:
org $00891D
.do_load
org $00893D
EnableForceBlank:
DungeonMask = $0098C0
org $00D308
DecompSwordGfx:
org $00D348
DecompShieldGfx:
org $00D463
Tagalong_LoadGfx:
org $00D51B
GetAnimatedSpriteTile:
org $00D52D
GetAnimatedSpriteTile_variable:
org $00D84E
Attract_DecompressStoryGfx:
org $00E529
LoadSelectScreenGfx:
org $00F945
PrepDungeonExit:
org $00FDEE
Mirror_InitHdmaSettings:
org $01873A
Dungeon_LoadRoom:
org $02821E
Module_PreDungeon:
org $028296
.setAmbientSfx
org $02A0A8
Dungeon_SaveRoomData:
org $02A0BE
Dungeon_SaveRoomData_justKeys:
org $02A4E3
Overworld_ActualScreenID:
org $02B861
Dungeon_SaveRoomQuadrantData:
org $02C11D
CalculateTransitionLanding:
org $02C176
Overworld_FinalizeEntryOntoScreen_Data:
org $02D9B9
Underworld_LoadSpawnEntrance:
org $02E99D
FluteMenu_LoadTransport:
org $02FD8A ; 17D8A - Bank0E.asm: 3732 Note: Different bank
LoadGearPalettes_bunny:
org $02FD95 ; 17D95 - Bank0E.asm: 3742 Note: Different bank
LoadGearPalettes_variable:
org $02FEAB
Filter_Majorly_Whiten_Color:
org $04E780
Overworld_MemorizeMap16Change:
org $04E879
Overworld_CheckForSpecialOverworldTrigger_Direction:
org $05A51D
Sprite_SpawnFallingItem:
org $05AFF1
Sprite_6C_MirrorPortal_dont_do_warp:
org $05DF6C ; 02DF6C - Bank05.asm : 2445
Sprite_DrawMultiple:
org $05DF70 ; 02DF70 - Bank05.asm : 2454
Sprite_DrawMultiple_quantity_preset:
org $05DF75 ; 02DF75 - Bank05.asm : 2461
Sprite_DrawMultiple_player_deferred:
org $05E1A7 ; 02E1A7 - Bank05.asm : 2592
Sprite_ShowSolicitedMessageIfPlayerFacing:
org $05E1F0
Sprite_ShowMessageFromPlayerContact:
org $05E219
Sprite_ShowMessageUnconditional:
org $05EC96
Sprite_ZeldaLong:
org $0680FA
Player_ApplyRumbleToSprites:
org $0683E6
Utility_CheckIfHitBoxesOverlapLong:
org $06A7DB
Chicken_SpawnAvengerChicken: ; returns short
org $06AD58
Sprite_TransmuteToBomb:
org $06DC5C
Sprite_DrawShadowLong:
org $06DD40
DashKey_Draw:
org $06DBF8
Sprite_PrepAndDrawSingleLargeLong:
org $06DC00
Sprite_PrepAndDrawSingleSmallLong:
org $06EA18
Sprite_ApplySpeedTowardsPlayerLong:
org $06EAA6
Sprite_DirectionToFacePlayerLong:
org $06F12F
Sprite_CheckDamageToPlayerSameLayerLong:
org $06F86A
OAM_AllocateDeferToPlayerLong:
org $0791B3
Player_HaltDashAttackLong:
org $07999D
Link_ReceiveItem:
org $079F82
Link_UseHammer:
org $07A985
SetGameModeLikeMirror:
org $07E68F
Unknown_Method_0: ; In US version disassembly simply called "$3E6A6 IN ROM"
org $07F413
Link_CheckForEdgeScreenTransition:
org $07F4AA
Sprite_CheckIfPlayerPreoccupied:
org $08C3AE
Ancilla_ReceiveItem:
org $08C505
Ancilla_ReceiveItem_objectFinished:
org $08CE93
Ancilla_BreakTowerSeal_draw_single_crystal:
org $08CEC3
Ancilla_BreakTowerSeal_stop_spawning_sparkles:
org $08CF59
BreakTowerSeal_ExecuteSparkles:
org $08F710
Ancilla_SetOam_XY_Long:
org $0985E2 ; (break on $0985E4)
AddReceivedItem:
org $098605
AddReceivedItem_notCrystal:
org $098766
AddReceivedItem_gfxHandling:
org $098BAD
AddPendantOrCrystal:
org $098CFD
AddWeathervaneExplosion:
org $0993DF
AddDashTremor:
org $099D04
AddAncillaLong:
org $099D1A
Ancilla_CheckIfAlreadyExistsLong:
org $09AC57
Ancilla_TerminateSelectInteractives:
org $09AE64
Sprite_SetSpawnedCoords:
org $09AD58
GiveRupeeGift:
org $0AB7BD
FluteMenu_HandleSelection_NoSelection:
org $0ABA4F
OverworldMap_InitGfx:
org $0ABA99
OverworldMap_DarkWorldTilemap:
org $0ABAB9
OverworldMap_LoadSprGfx:
org $8AE817
DungeonMapBossRooms:
org $0CD7D1
NameFile_MakeScreenVisible:
org $0CDB3E
InitializeSaveFile:
org $0CDBC0
InitializeSaveFile_build_checksum:
org $0DBA71
GetRandomInt:
org $0DBA80
OAM_AllocateFromRegionA:
org $0DBA84
OAM_AllocateFromRegionB:
org $0DBA88
OAM_AllocateFromRegionC:
org $0DBA8C
OAM_AllocateFromRegionD:
org $0DBA90
OAM_AllocateFromRegionE:
org $0DBA94
OAM_AllocateFromRegionF:
org $0DBB67
Sound_SetSfxPanWithPlayerCoords:
org $0DBB6E
Sound_SetSfx1PanLong:
org $0DBB7C
Sound_SetSfx2PanLong:
org $0DBB8A
Sound_SetSfx3PanLong:
org $0DDB7F
HUD_RefreshIconLong:
org $0DDD32
Equipment_UpdateEquippedItemLong:
org $0DE01E ; 6E10E - equipment.asm : 787
BottleMenu_movingOn:
org $0DE346
RestoreNormalMenu:
org $0DE395
Equipment_SearchForEquippedItemLong:
org $0DE9C8
DrawProgressIcons: ; this returns short
org $0DED29
DrawEquipment: ; this returns short
org $0DFA78
HUD_RebuildLong:
org $0DFA88
HUD_RebuildIndoor_Palace:
org $0DFA88
HUD_RebuildLong2:
org $0EEE10
Messaging_Text:
org $0FFD94
Overworld_TileAttr:
org $1BC97C
Overworld_DrawPersistentMap16:
org $1BED03
Palette_Sword:
org $1BED29
Palette_Shield:
org $1BEDF9
Palette_ArmorAndGloves:
org $1BEE52
Palette_Hud:
org $1BEF96
Palette_SelectScreen:
org $1CFAAA
ShopKeeper_RapidTerminateReceiveItem:
org $1CF500
Sprite_NullifyHookshotDrag:
org $1CF537
Ancilla_CheckForAvailableSlot:
org $1DE9B6
Filter_MajorWhitenMain:
org $1DF65D
Sprite_SpawnDynamically:
org $1DF65F
Sprite_SpawnDynamically_arbitrary:
org $1DFD4B
DiggingGameGuy_AttemptPrizeSpawn:
org $1EDE28
Sprite_GetEmptyBottleIndex: ; this is totally in sprite_bees.asm
org $1EF4E7
Sprite_PlayerCantPassThrough:
;================================================================================

15
README.md Normal file
View File

@@ -0,0 +1,15 @@
# z3randomizer
Zelda 3 Randomizer Template ASM
How to create the bps patch:
* Assemble the ROM with asar (recommend to use a copy of original rom)
`asar LTTP_RND_GeneralBugfixes.asm copy_original_rom.sfc`
(copy_orignal_rom.sfc is now assembled_rom.sfc)
* Use flips to create a bps file
`flips original_rom.sfc assembled_rom.sfc base2current.bps`
* Update RANDOMIZERBASEHASH in DR with the md5 sum of assembled_rom.sfc. And put base2current.bps in the data directory.

0
data/a6fc4_bombos.gfx → a6fc4_bombos.gfx Normal file → Executable file
View File

0
data/a6fc4_ether.gfx → a6fc4_ether.gfx Normal file → Executable file
View File

View File

@@ -1,118 +1,127 @@
;================================================================================
; Accessibility Fixes
;================================================================================
FlipGreenPendant:
LDA $0C : CMP #$38 : BNE + ; check if we have green pendant
ORA #$40 : STA $0C ; flip it
+
LDA $0D : STA $0802, X ; stuff we wrote over "Set CHR, palette, and priority of the sprite"
LDA $0C : STA $0803, X
RTL
;================================================================================
ConditionalLightning:
CMP.b #$05 : BEQ ++
CMP.b #$2C : BEQ ++
CMP.b #$5A : BEQ ++
LDA.l DisableFlashing : BNE ++
LDA.b #$32 : STA.w CGADSUBQ
LDA.b #$32 : STA.w $9A
RTL
++
LDA.b #$72
STA.b CGADSUBQ
STA $9A
RTL
;================================================================================
ConditionalWhitenBg:
LDX.b #$00
LDA.l DisableFlashing : REP #$20 : BNE +
LDA.b Scrap00,X
LDA $00,X
JSR WhitenLoopReal
RTL
+
LDA.b Scrap00
LDA $00
JSR WhitenLoopDummy
RTL
;================================================================================
WhitenLoopReal:
-
LDA.l PaletteBufferAux+$40, X : JSL Filter_Majorly_Whiten_Color : STA.l PaletteBuffer+$40, X
LDA.l PaletteBufferAux+$50, X : JSL Filter_Majorly_Whiten_Color : STA.l PaletteBuffer+$50, X
LDA.l PaletteBufferAux+$60, X : JSL Filter_Majorly_Whiten_Color : STA.l PaletteBuffer+$60, X
LDA.l PaletteBufferAux+$70, X : JSL Filter_Majorly_Whiten_Color : STA.l PaletteBuffer+$70, X
LDA.l PaletteBufferAux+$80, X : JSL Filter_Majorly_Whiten_Color : STA.l PaletteBuffer+$80, X
LDA.l PaletteBufferAux+$90, X : JSL Filter_Majorly_Whiten_Color : STA.l PaletteBuffer+$90, X
LDA.l PaletteBufferAux+$A0, X : JSL Filter_Majorly_Whiten_Color : STA.l PaletteBuffer+$A0, X
LDA.l PaletteBufferAux+$B0, X : JSL Filter_Majorly_Whiten_Color : STA.l PaletteBuffer+$B0, X
LDA.l PaletteBufferAux+$C0, X : JSL Filter_Majorly_Whiten_Color : STA.l PaletteBuffer+$C0, X
LDA.l PaletteBufferAux+$D0, X : JSL Filter_Majorly_Whiten_Color : STA.l PaletteBuffer+$D0, X
LDA.l PaletteBufferAux+$E0, X : JSL Filter_Majorly_Whiten_Color : STA.l PaletteBuffer+$E0, X
LDA $7EC340, X : JSL Filter_Majorly_Whiten_Color : STA $7EC540, X
LDA $7EC350, X : JSL Filter_Majorly_Whiten_Color : STA $7EC550, X
LDA $7EC360, X : JSL Filter_Majorly_Whiten_Color : STA $7EC560, X
LDA $7EC370, X : JSL Filter_Majorly_Whiten_Color : STA $7EC570, X
LDA $7EC380, X : JSL Filter_Majorly_Whiten_Color : STA $7EC580, X
LDA $7EC390, X : JSL Filter_Majorly_Whiten_Color : STA $7EC590, X
LDA $7EC3A0, X : JSL Filter_Majorly_Whiten_Color : STA $7EC5A0, X
LDA $7EC3B0, X : JSL Filter_Majorly_Whiten_Color : STA $7EC5B0, X
LDA $7EC3C0, X : JSL Filter_Majorly_Whiten_Color : STA $7EC5C0, X
LDA $7EC3D0, X : JSL Filter_Majorly_Whiten_Color : STA $7EC5D0, X
LDA $7EC3E0, X : JSL Filter_Majorly_Whiten_Color : STA $7EC5E0, X
INX #2 : CPX.b #$10 : BEQ +
JMP -
+
LDA.l PaletteBufferAux+$F0 : JSL Filter_Majorly_Whiten_Color : STA.l PaletteBuffer+$F0
LDA.l PaletteBufferAux+$F2 : JSL Filter_Majorly_Whiten_Color : STA.l PaletteBuffer+$F2
LDA.l PaletteBufferAux+$F4 : JSL Filter_Majorly_Whiten_Color : STA.l PaletteBuffer+$F4
LDA.b GameMode : CMP.w #$0007 : BNE +
LDA.b RoomIndex
CMP.w #$003C : BEQ ++
CMP.w #$009D : BEQ ++
CMP.w #$009C : BEQ ++
CMP.w #$00A5 : BEQ ++
LDA $7EC3F0 : JSL Filter_Majorly_Whiten_Color : STA $7EC5F0
LDA $7EC3F2 : JSL Filter_Majorly_Whiten_Color : STA $7EC5F2
LDA $7EC3F4 : JSL Filter_Majorly_Whiten_Color : STA $7EC5F4
LDA $10 : CMP.w #$07 : BNE +
LDA $048E
CMP.w #$3C : BEQ ++
CMP.w #$9D : BEQ ++
CMP.w #$9C : BEQ ++
CMP.w #$A5 : BEQ ++
+
LDA.l PaletteBufferAux+$F6 : JSL Filter_Majorly_Whiten_Color : STA.l PaletteBuffer+$F6
LDA.l PaletteBufferAux+$F8 : JSL Filter_Majorly_Whiten_Color : STA.l PaletteBuffer+$F8
LDA $7EC3F6 : JSL Filter_Majorly_Whiten_Color : STA $7EC5F6
LDA $7EC3F8 : JSL Filter_Majorly_Whiten_Color : STA $7EC5F8
BRA +++
++
LDA.l PaletteBuffer+$F6 : JSL Filter_Majorly_Whiten_Color : STA.l PaletteBuffer+$F6
LDA.l PaletteBuffer+$F8 : JSL Filter_Majorly_Whiten_Color : STA.l PaletteBuffer+$F8
LDA $7EC3F6 : JSL Filter_Majorly_Whiten_Color : STA $7EC5F6
LDA $7EC3F8 : JSL Filter_Majorly_Whiten_Color : STA $7EC5F8
BRA +++
+++
LDA.l PaletteBufferAux+$FA : JSL Filter_Majorly_Whiten_Color : STA.l PaletteBuffer+$FA
LDA.l PaletteBufferAux+$FC : JSL Filter_Majorly_Whiten_Color : STA.l PaletteBuffer+$FC
LDA.l PaletteBufferAux+$FE : JSL Filter_Majorly_Whiten_Color : STA.l PaletteBuffer+$FE
LDA $7EC3FA : JSL Filter_Majorly_Whiten_Color : STA $7EC5FA
LDA $7EC3FC : JSL Filter_Majorly_Whiten_Color : STA $7EC5FC
LDA $7EC3FE : JSL Filter_Majorly_Whiten_Color : STA $7EC5FE
REP #$10
LDA.l PaletteBuffer+$40 : TAY
LDA.l PaletteBufferAux : BNE +
LDA $7EC540 : TAY
LDA $7EC300 : BNE +
TAY
+
TYA : STA.l PaletteBuffer
TYA : STA $7EC500
SEP #$30
RTS
;================================================================================
WhitenLoopDummy:
-
LDA.l PaletteBufferAux+$40, X : JSL Filter_Majorly_Whiten_Color : LDA.l PaletteBuffer+$40, X
LDA.l PaletteBufferAux+$50, X : JSL Filter_Majorly_Whiten_Color : LDA.l PaletteBuffer+$50, X
LDA.l PaletteBufferAux+$60, X : JSL Filter_Majorly_Whiten_Color : LDA.l PaletteBuffer+$60, X
LDA.l PaletteBufferAux+$70, X : JSL Filter_Majorly_Whiten_Color : LDA.l PaletteBuffer+$70, X
LDA.l PaletteBufferAux+$80, X : JSL Filter_Majorly_Whiten_Color : LDA.l PaletteBuffer+$80, X
LDA.l PaletteBufferAux+$90, X : JSL Filter_Majorly_Whiten_Color : LDA.l PaletteBuffer+$90, X
LDA.l PaletteBufferAux+$A0, X : JSL Filter_Majorly_Whiten_Color : LDA.l PaletteBuffer+$A0, X
LDA.l PaletteBufferAux+$B0, X : JSL Filter_Majorly_Whiten_Color : LDA.l PaletteBuffer+$B0, X
LDA.l PaletteBufferAux+$C0, X : JSL Filter_Majorly_Whiten_Color : LDA.l PaletteBuffer+$C0, X
LDA.l PaletteBufferAux+$D0, X : JSL Filter_Majorly_Whiten_Color : LDA.l PaletteBuffer+$D0, X
LDA.l PaletteBufferAux+$E0, X : JSL Filter_Majorly_Whiten_Color : LDA.l PaletteBuffer+$E0, X
LDA $7EC340, X : JSL Filter_Majorly_Whiten_Color : LDA $7EC540, X
LDA $7EC350, X : JSL Filter_Majorly_Whiten_Color : LDA $7EC550, X
LDA $7EC360, X : JSL Filter_Majorly_Whiten_Color : LDA $7EC560, X
LDA $7EC370, X : JSL Filter_Majorly_Whiten_Color : LDA $7EC570, X
LDA $7EC380, X : JSL Filter_Majorly_Whiten_Color : LDA $7EC580, X
LDA $7EC390, X : JSL Filter_Majorly_Whiten_Color : LDA $7EC590, X
LDA $7EC3A0, X : JSL Filter_Majorly_Whiten_Color : LDA $7EC5A0, X
LDA $7EC3B0, X : JSL Filter_Majorly_Whiten_Color : LDA $7EC5B0, X
LDA $7EC3C0, X : JSL Filter_Majorly_Whiten_Color : LDA $7EC5C0, X
LDA $7EC3D0, X : JSL Filter_Majorly_Whiten_Color : LDA $7EC5D0, X
LDA $7EC3E0, X : JSL Filter_Majorly_Whiten_Color : LDA $7EC5E0, X
INX #2 : CPX.b #$10 : BEQ +
JMP -
+
LDA.l PaletteBufferAux+$F0 : JSL Filter_Majorly_Whiten_Color : LDA.l PaletteBuffer+$F0
LDA.l PaletteBufferAux+$F2 : JSL Filter_Majorly_Whiten_Color : LDA.l PaletteBuffer+$F2
LDA.l PaletteBufferAux+$F4 : JSL Filter_Majorly_Whiten_Color : LDA.l PaletteBuffer+$F4
LDA.b GameMode : CMP.w #$0007 : BNE + ; only light invisifloor if we're in dungeon submodule
LDA.b RoomIndex
CMP.w #$003C : BEQ ++ ; hookshot cave
CMP.w #$009D : BEQ ++ ; gt right
CMP.w #$009C : BEQ ++ ; gt big room
CMP.w #$00A5 : BEQ ++ ; wizzrobes 1
LDA $7EC3F0 : JSL Filter_Majorly_Whiten_Color : LDA $7EC5F0
LDA $7EC3F2 : JSL Filter_Majorly_Whiten_Color : LDA $7EC5F2
LDA $7EC3F4 : JSL Filter_Majorly_Whiten_Color : LDA $7EC5F4
LDA $10 : CMP.w #$07 : BNE + ; only light invisifloor if we're in dungeon submodule
LDA $048E
CMP.w #$3C : BEQ ++ ; hookshot cave
CMP.w #$9D : BEQ ++ ; gt right
CMP.w #$9C : BEQ ++ ; gt big room
CMP.w #$A5 : BEQ ++ ; wizzrobes 1
+
LDA.l PaletteBufferAux+$F6 : JSL Filter_Majorly_Whiten_Color : LDA.l PaletteBuffer+$F6
LDA.l PaletteBufferAux+$F8 : JSL Filter_Majorly_Whiten_Color : LDA.l PaletteBuffer+$F8
LDA $7EC3F6 : JSL Filter_Majorly_Whiten_Color : LDA $7EC5F6
LDA $7EC3F8 : JSL Filter_Majorly_Whiten_Color : LDA $7EC5F8
BRA +++
++
LDA.l PaletteBufferAux+$F6 : JSL Filter_Majorly_Whiten_Color : STA.l PaletteBuffer+$F6
LDA.l PaletteBufferAux+$F8 : JSL Filter_Majorly_Whiten_Color : STA.l PaletteBuffer+$F8
LDA $7EC3F6 : JSL Filter_Majorly_Whiten_Color : STA $7EC5F6
LDA $7EC3F8 : JSL Filter_Majorly_Whiten_Color : STA $7EC5F8
BRA +++
+++
LDA.l PaletteBufferAux+$FA : JSL Filter_Majorly_Whiten_Color : LDA.l PaletteBuffer+$FA
LDA.l PaletteBufferAux+$FC : JSL Filter_Majorly_Whiten_Color : LDA.l PaletteBuffer+$FC
LDA.l PaletteBufferAux+$FE : JSL Filter_Majorly_Whiten_Color : LDA.l PaletteBuffer+$FE
LDA $7EC3FA : JSL Filter_Majorly_Whiten_Color : LDA $7EC5FA
LDA $7EC3FC : JSL Filter_Majorly_Whiten_Color : LDA $7EC5FC
LDA $7EC3FE : JSL Filter_Majorly_Whiten_Color : LDA $7EC5FE
REP #$10
LDA.l PaletteBuffer+$40 : TAY
LDA.l PaletteBufferAux : BNE +
LDA $7EC540 : TAY
LDA $7EC300 : BNE +
TAY
+
TYA : STA.l PaletteBuffer
TYA : STA $7EC500
SEP #$30
RTS
;================================================================================
@@ -120,36 +129,36 @@ RestoreBgEther:
LDX.b #$00
LDA.l DisableFlashing : REP #$20 : BNE +
-
LDA.b Scrap00,X
LDA.l PaletteBufferAux+$40, X : STA.l PaletteBuffer+$40, X
LDA.l PaletteBufferAux+$50, X : STA.l PaletteBuffer+$50, X
LDA.l PaletteBufferAux+$60, X : STA.l PaletteBuffer+$60, X
LDA.l PaletteBufferAux+$70, X : STA.l PaletteBuffer+$70, X
LDA.l PaletteBufferAux+$80, X : STA.l PaletteBuffer+$80, X
LDA.l PaletteBufferAux+$90, X : STA.l PaletteBuffer+$90, X
LDA.l PaletteBufferAux+$A0, X : STA.l PaletteBuffer+$A0, X
LDA.l PaletteBufferAux+$B0, X : STA.l PaletteBuffer+$B0, X
LDA.l PaletteBufferAux+$C0, X : STA.l PaletteBuffer+$C0, X
LDA.l PaletteBufferAux+$D0, X : STA.l PaletteBuffer+$D0, X
LDA.l PaletteBufferAux+$E0, X : STA.l PaletteBuffer+$E0, X
LDA.l PaletteBufferAux+$F0, X : STA.l PaletteBuffer+$F0, X
LDA $00,X
LDA $7EC340, X : STA $7EC540, X
LDA $7EC350, X : STA $7EC550, X
LDA $7EC360, X : STA $7EC560, X
LDA $7EC370, X : STA $7EC570, X
LDA $7EC380, X : STA $7EC580, X
LDA $7EC390, X : STA $7EC590, X
LDA $7EC3A0, X : STA $7EC5A0, X
LDA $7EC3B0, X : STA $7EC5B0, X
LDA $7EC3C0, X : STA $7EC5C0, X
LDA $7EC3D0, X : STA $7EC5D0, X
LDA $7EC3E0, X : STA $7EC5E0, X
LDA $7EC3F0, X : STA $7EC5F0, X
INX #2 : CPX.b #$10 : BNE -
BRA ++
+
-
LDA.b Scrap00
LDA.l PaletteBufferAux+$40, X : LDA.l PaletteBuffer+$40, X
LDA.l PaletteBufferAux+$50, X : LDA.l PaletteBuffer+$50, X
LDA.l PaletteBufferAux+$60, X : LDA.l PaletteBuffer+$60, X
LDA.l PaletteBufferAux+$70, X : LDA.l PaletteBuffer+$70, X
LDA.l PaletteBufferAux+$80, X : LDA.l PaletteBuffer+$80, X
LDA.l PaletteBufferAux+$90, X : LDA.l PaletteBuffer+$90, X
LDA.l PaletteBufferAux+$A0, X : LDA.l PaletteBuffer+$A0, X
LDA.l PaletteBufferAux+$B0, X : LDA.l PaletteBuffer+$B0, X
LDA.l PaletteBufferAux+$C0, X : LDA.l PaletteBuffer+$C0, X
LDA.l PaletteBufferAux+$D0, X : LDA.l PaletteBuffer+$D0, X
LDA.l PaletteBufferAux+$E0, X : LDA.l PaletteBuffer+$E0, X
LDA.l PaletteBufferAux+$F0, X : LDA.l PaletteBuffer+$F0, X
LDA $00
LDA $7EC340, X : LDA $7EC540, X
LDA $7EC350, X : LDA $7EC550, X
LDA $7EC360, X : LDA $7EC560, X
LDA $7EC370, X : LDA $7EC570, X
LDA $7EC380, X : LDA $7EC580, X
LDA $7EC390, X : LDA $7EC590, X
LDA $7EC3A0, X : LDA $7EC5A0, X
LDA $7EC3B0, X : LDA $7EC5B0, X
LDA $7EC3C0, X : LDA $7EC5C0, X
LDA $7EC3D0, X : LDA $7EC5D0, X
LDA $7EC3E0, X : LDA $7EC5E0, X
LDA $7EC3F0, X : LDA $7EC5F0, X
INX #2 : CPX.b #$10 : BNE -
BRA ++
++
@@ -159,105 +168,105 @@ DDMConditionalLightning:
LDA.l DisableFlashing
REP #$20
BNE +
LDA.w Scrap
LDA.w $0000
LDX.b #$02
JML $07FA7F ; Bank0E.asm : 4738 vanilla loop equivalent to below beginning at LDY #$00
+
LDA.b Scrap00 : LDX.b #$02 : LDY.b #$00
LDA.b $00 : LDX.b #$02 : LDY #$00
-
LDA.w $F4EB, Y : LDA.l PaletteBuffer+$60, X
LDA.w $F4F9, Y : LDA.l PaletteBuffer+$70, X
LDA.w $F507, Y : LDA.l PaletteBuffer+$90, X
LDA.w $F515, Y : LDA.l PaletteBuffer+$E0, X
LDA.w $F523, Y : LDA.l PaletteBuffer+$F0, X
LDA $F4EB, Y : LDA $7EC560, X
LDA $F4F9, Y : LDA $7EC570, X
LDA $F507, Y : LDA $7EC590, X
LDA $F515, Y : LDA $7EC5E0, X
LDA $F523, Y : LDA $7EC5F0, X
INY #2
INX #2 : CPX.b #$10 : BNE -
JML $07FAAC ; Bank0E.asm : 4754 both branches converge here
;================================================================================
ConditionalGTFlash:
LDA.l DisableFlashing : REP #$20 : BNE +
LDA.w Scrap
LDA $0000
-
LDA.w $F9C1, Y : STA.l PaletteBuffer+$D0, X
LDA $F9C1, Y : STA $7EC5D0, X
INY #2
INX #2 : CPX.b #$10 : BNE -
RTL
+
LDA.b Scrap00
LDA $00
-
LDA.w $F9C1, Y : LDA.l PaletteBuffer+$D0, X
LDA $F9C1, Y : LDA $7EC5D0, X
INY #2
INX #2 : CPX.b #$10 : BNE -
RTL
;================================================================================
ConditionalRedFlash:
LDA.l DisableFlashing : REP #$20 : BNE +
LDA.b Scrap,X
LDA.w #$1D59 : STA.l PaletteBuffer+$DA
LDA.w #$25FF : STA.l PaletteBuffer+$DC
LDA $00,X
LDA.w #$1D59 : STA $7EC5DA
LDA.w #$25FF : STA $7EC5DC
LDA.w #$001A
RTL
+
LDA.b Scrap00
LDA.w #$1D59 : LDA.l PaletteBuffer+$DA
LDA.w #$25FF : LDA.l PaletteBuffer+$DC
LDA $00
LDA.w #$1D59 : LDA $7EC5DA
LDA.w #$25FF : LDA $7EC5DC
LDA.w #$0000
RTL
;================================================================================
ConditionalPedAncilla:
LDA.l DisableFlashing : REP #$20 : BNE +
LDA.b Scrap,X
LDA.b Scrap00 : STA.b Scrap04
LDA.b Scrap02 : STA.b Scrap06
LDA $00,X
LDA $00 : STA $04
LDA $02 : STA $06
RTL
+
LDA.b Scrap
LDA.b Scrap00 : LDA.b Scrap04
LDA.b Scrap02 : LDA.b Scrap06
LDA $00
LDA $00 : LDA $04
LDA $02 : LDA $06
RTL
;================================================================================
LoadElectroPalette:
REP #$20
LDA.w #$0202 : STA.b Scrap0C
LDA.w #$0404 : STA.b Scrap0E
LDA.w #$001B : STA.b Scrap02
LDA.w #$0202 : STA $0C
LDA.w #$0404 : STA $0E
LDA.w #$001B : STA $02
SEP #$10
LDX.b Scrap0C : LDA.l $1BEBB4, X : AND.w #$00FF : ADC.w #$D630
LDX $0C : LDA $1BEBB4, X : AND.w #$00FF : ADC #$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
LDX $0D
LDA $1BEBC1, X : AND.w #$00FF : ADC #$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
LDX $0E
LDA $1BEC06, X : AND.w #$00FF : ASL A : ADC #$D308
REP #$10 : LDX.w #$01E2 : LDY.w #$000E
JSR ConditionalLoadGearPalette
SEP #$30
INC.b NMICGRAM
INC $15
RTL
;================================================================================
ConditionalLoadGearPalette:
STA.b Scrap00
STA $00
SEP #$20
LDA.l DisableFlashing : REP #$20 : BNE +
LDA.b Scrap,X
LDA $00,X
-
LDA.b [Scrap00]
STA.l PaletteBuffer, X
INC.b Scrap00 : INC.b Scrap00
LDA [$00]
STA $7EC500, X
INC $00 : INC $00
INX #2
DEY
BPL -
RTS
+
LDA.b Scrap
LDA $00
-
LDA.b [Scrap00]
LDA.l PaletteBuffer, X
INC.b Scrap00 : INC.b Scrap00
LDA [$00]
LDA $7EC500, X
INC $00 : INC $00
INX #2
DEY
BPL -
@@ -272,13 +281,13 @@ RestoreElectroPalette:
LDX.w #$01E2 : LDY.w #$000E
JSR FillPaletteBufferFromAux
SEP #$30
INC.b NMICGRAM
INC $15
RTL
;================================================================================
FillPaletteBufferFromAux:
-
LDA.l PaletteBufferAux, X
STA.l PaletteBuffer, X
LDA $7EC300, X
STA $7EC500, X
INX #2
DEY
BPL -

BIN
asar Executable file

Binary file not shown.

BIN
asar-x64.dll Normal file

Binary file not shown.

BIN
asar.dll Normal file

Binary file not shown.

421
asar.py Normal file
View File

@@ -0,0 +1,421 @@
#!/usr/bin/env python3
"""
python interface for asar.dll
by randomdude999
Usage: import asar, call asar.init, call asar.patch, then use the various
functions to get info about the patch
"""
import ctypes
import enum
import sys
from ctypes import c_int, c_char_p, POINTER
c_int_ptr = POINTER(c_int)
__all__ = ["errordata", "writtenblockdata", "mappertype", "version",
"apiversion", "init", "reset", "patch", "maxromsize", "close",
"geterrors", "getwarnings", "getprints", "getalllabels",
"getlabelval", "getdefine", "getalldefines", "resolvedefines",
"math", "getwrittenblocks", "getmapper", "getsymbolsfile"]
_target_api_ver = 303
_asar = None
class AsarArithmeticError(ArithmeticError):
pass
class errordata(ctypes.Structure):
_fields_ = [("fullerrdata", c_char_p),
("rawerrdata", c_char_p),
("block", c_char_p),
("filename", c_char_p),
("line", c_int),
("callerfilename", c_char_p),
("callerline", c_int),
("errid", c_int)]
def __repr__(self):
return "<asar error: {!r}>".format(self.fullerrdata.decode())
# for internal use only. getalllabels() returns a dict.
class _labeldata(ctypes.Structure):
_fields_ = [("name", c_char_p),
("location", c_int)]
# for internal use only. getalldefines() returns a dict.
class _definedata(ctypes.Structure):
_fields_ = [("name", c_char_p),
("contents", c_char_p)]
class writtenblockdata(ctypes.Structure):
_fields_ = [("pcoffset", c_int),
("snesoffset", c_int),
("numbytes", c_int)]
def __repr__(self):
return "<written block ${:06x} 0x{:x} size:{}>".format(
self.snesoffset, self.pcoffset, self.numbytes)
# internal use only. patch() accepts a dict.
class _memoryfile(ctypes.Structure):
_fields_ = [("path", c_char_p),
("buffer", c_char_p),
("length", ctypes.c_size_t)]
# internal use only. patch() accepts a dict.
class _warnsetting(ctypes.Structure):
_fields_ = [("warnid", c_char_p),
("enabled", ctypes.c_bool)]
# For internal use only.
class _patchparams(ctypes.Structure):
_fields_ = [("structsize", c_int),
("patchloc", c_char_p),
("romdata", c_char_p),
("buflen", c_int),
("romlen", c_int_ptr),
("includepaths", POINTER(c_char_p)),
("numincludepaths", c_int),
("should_reset", ctypes.c_bool),
("additional_defines", POINTER(_definedata)),
("additional_define_count", c_int),
("stdincludesfile", c_char_p),
("stddefinesfile", c_char_p),
("warning_settings", POINTER(_warnsetting)),
("warning_setting_count", c_int),
("memory_files", POINTER(_memoryfile)),
("memory_file_count", c_int),
("override_checksum_gen", ctypes.c_bool),
("generate_checksum", ctypes.c_bool)]
class mappertype(enum.Enum):
invalid_mapper = 0
lorom = 1
hirom = 2
sa1rom = 3
bigsa1rom = 4
sfxrom = 5
exlorom = 6
exhirom = 7
norom = 8
def _getall(func):
"""Helper that does the work common to all the getall* functions."""
count = c_int()
raw_errs = func(ctypes.byref(count))
errs = []
for i in range(count.value):
errs.append(raw_errs[i])
return errs
class _AsarDLL:
def __init__(self, dllname):
dll = ctypes.CDLL(dllname)
self.dll = dll
self.funcs = {}
try:
# argument/return type setup
# (also verifies that those functions are exported from the DLL)
# this is directly from asardll.h
# setup_func(name, argtypes, returntype)
self.setup_func("version", (), c_int)
self.setup_func("apiversion", (), c_int)
self.setup_func("init", (), ctypes.c_bool)
self.setup_func("reset", (), ctypes.c_bool)
self.setup_func("patch", (c_char_p, c_char_p, c_int, c_int_ptr),
ctypes.c_bool)
self.setup_func("patch_ex", (POINTER(_patchparams),), ctypes.c_bool)
self.setup_func("maxromsize", (), c_int)
self.setup_func("close", (), None)
self.setup_func("geterrors", (c_int_ptr,), POINTER(errordata))
self.setup_func("getwarnings", (c_int_ptr,), POINTER(errordata))
self.setup_func("getprints", (c_int_ptr,), POINTER(c_char_p))
self.setup_func("getalllabels", (c_int_ptr,), POINTER(_labeldata))
self.setup_func("getlabelval", (c_char_p,), c_int)
self.setup_func("getdefine", (c_char_p,), c_char_p)
self.setup_func("getalldefines", (c_int_ptr,), POINTER(_definedata))
self.setup_func("resolvedefines", (c_char_p, ctypes.c_bool),
c_char_p)
self.setup_func("math", (c_char_p, POINTER(c_char_p)),
ctypes.c_double)
self.setup_func("getwrittenblocks", (c_int_ptr,),
POINTER(writtenblockdata))
self.setup_func("getmapper", (), c_int)
self.setup_func("getsymbolsfile", (c_char_p,), c_char_p)
except AttributeError:
raise OSError("Asar DLL is missing some functions")
api_ver = dll.asar_apiversion()
if api_ver < _target_api_ver or \
(api_ver // 100) > (_target_api_ver // 100):
raise OSError("Asar DLL version "+str(api_ver)+" unsupported")
def setup_func(self, name, argtypes, restype):
"""Setup argument and return types for a function.
name: name of the function in the DLL. "asar_" is added automatically
argtypes and restype: see ctypes documentation
"""
func = getattr(self.dll, "asar_" + name)
func.argtypes = argtypes
func.restype = restype
def init(dll_path=None):
"""Load the Asar DLL.
You must call this before calling any other Asar functions. Raises OSError
if there was something wrong with the DLL (not found, wrong version,
doesn't have all necessary functions).
You can pass a custom DLL path if you want. If you don't, some common names
for the asar dll are tried.
"""
global _asar
if _asar is not None:
return
if dll_path is not None:
_asar = _AsarDLL(dll_path)
else:
if sys.platform == "win32":
libnames = ["./asar.dll", "asar", "./asar-x64.dll", "asar-x64"]
elif sys.platform == "darwin":
libnames = ["./libasar.dylib", "libasar"]
else:
libnames = ["./libasar.so", "libasar"]
for x in libnames:
try:
_asar = _AsarDLL(x)
except OSError:
continue
if _asar is None:
# Nothing in the search path is valid
raise OSError("Could not find asar DLL")
if not _asar.dll.asar_init():
_asar = None
return False
else:
return True
def close():
"""Free all of Asar's structures and unload the module.
Only asar.init() may be called after calling this.
"""
global _asar
if _asar is None:
return
_asar.dll.asar_close()
_asar = None
def version():
"""Return the version, in the format major*10000+minor*100+bugfix*1.
This means that 1.2.34 would be returned as 10234.
"""
return _asar.dll.asar_version()
def apiversion():
"""Return the API version, in the format major*100+minor.
Minor is incremented on backwards compatible changes; major is incremented
on incompatible changes. Does not have any correlation with the Asar
version. It's not very useful directly, since asar.init() verifies this
automatically.
"""
return _asar.dll.asar_apiversion()
def reset():
"""Clear out errors, warnings, printed statements and the file cache.
Not really useful, since asar.patch() already does this.
"""
return _asar.dll.asar_reset()
def patch(patch_name, rom_data, includepaths=[], should_reset=True,
additional_defines={}, std_include_file=None, std_define_file=None,
warning_overrides={}, memory_files={}, override_checksum=None):
"""Applies a patch.
Returns (success, new_rom_data). If success is False you should call
geterrors() to see what went wrong. rom_data is assumed to be headerless.
If includepaths is specified, it lists additional include paths for asar
to search.
should_reset specifies whether asar should clear out all defines, labels,
etc from the last inserted file. Setting it to False will make Asar act
like the currently patched file was directly appended to the previous one.
additional_defines specifies extra defines to give to the patch
(similar to the -D option).
std_include_file and std_define_file specify files where to look for extra
include paths and defines, respectively.
warning_overrides is a dict of str (warning ID) -> bool. It overrides
enabling/disabling specific warnings.
memory_files is a dict of str (file name) -> bytes (file contents). It
specifies memory files to use.
override_checksum specifies whether to override checksum generation. True
forces Asar to update the ROM's checksum, False forces Asar to not update
it.
"""
romlen = c_int(len(rom_data))
rom_ptr = ctypes.create_string_buffer(bytes(rom_data), maxromsize())
pp = _patchparams()
pp.structsize = ctypes.sizeof(_patchparams)
pp.patchloc = patch_name.encode()
pp.romdata = ctypes.cast(rom_ptr, c_char_p)
pp.buflen = maxromsize()
pp.romlen = ctypes.pointer(romlen)
# construct an array type of len(includepaths) elements and initialize
# it with elements from includepaths
pp.includepaths = (c_char_p*len(includepaths))(*includepaths)
pp.numincludepaths = len(includepaths)
defines = (_definedata * len(additional_defines))()
for i, (k, v) in enumerate(additional_defines.items()):
defines[i].name = k.encode()
defines[i].contents = v.encode()
pp.additional_defines = defines
pp.additional_define_count = len(additional_defines)
pp.should_reset = should_reset
pp.stdincludesfile = std_include_file.encode() if std_include_file else None
pp.stddefinesfile = std_define_file.encode() if std_define_file else None
warnsettings = (_warnsetting * len(warning_overrides))()
for i, (k, v) in enumerate(warning_overrides.items()):
warnsettings[i].warnid = k.encode()
warnsettings[i].enabled = v
pp.warning_settings = warnsettings
pp.warning_setting_count = len(warnsettings)
memoryfiles = (_memoryfile * len(memory_files))()
for i, (k, v) in enumerate(memory_files.items()):
memoryfiles[i].path = k.encode()
memoryfiles[i].buffer = v
memoryfiles[i].length = len(v)
pp.memory_files = memoryfiles
pp.memory_file_count = len(memory_files)
if override_checksum is not None:
pp.override_checksum_gen = True
pp.generate_checksum = override_checksum
else:
pp.override_checksum_gen = False
pp.generate_checksum = False
result = _asar.dll.asar_patch_ex(ctypes.byref(pp))
return result, rom_ptr.raw[:romlen.value]
def maxromsize():
"""Return the maximum possible size of the output ROM."""
return _asar.dll.asar_maxromsize()
def geterrors():
"""Get a list of all errors."""
return _getall(_asar.dll.asar_geterrors)
def getwarnings():
"""Get a list of all warnings."""
return _getall(_asar.dll.asar_getwarnings)
def getprints():
"""Get a list of all printed data."""
return [x.decode() for x in _getall(_asar.dll.asar_getprints)]
def getalllabels():
"""Get a dictionary of label name -> SNES address."""
labeldatas = _getall(_asar.dll.asar_getalllabels)
return {x.name.decode(): x.location for x in labeldatas}
def getlabelval(name):
"""Get the ROM location of one label. None means "not found"."""
val = _asar.dll.asar_getlabelval(name.encode())
return None if (val == -1) else val
def getdefine(name):
"""Get the value of a define."""
return _asar.dll.asar_getdefine(name.encode()).decode()
def getalldefines():
"""Get the names and values of all defines."""
definedatas = _getall(_asar.dll.asar_getalldefines)
return {x.name.decode(): x.contents.decode() for x in definedatas}
def resolvedefines(data, learnnew):
"""Parse all defines in the given data.
Returns the data with all defines evaluated.
learnnew controls whether it'll learn new defines in this string if it
finds any. Note that it may emit errors.
"""
return _asar.dll.asar_resolvedefines(data, learnnew)
def math(to_calculate):
"""Parse a string containing math.
It automatically assumes global scope (no namespaces), and has access to
all functions and labels from the last call to asar.patch(). If there was
an error, ArithmeticError is raised with the message returned by Asar.
"""
error = ctypes.c_char_p()
result = _asar.dll.asar_math(to_calculate.encode(), ctypes.byref(error))
if not bool(error):
# Null pointer, means no error
return result
else:
raise AsarArithmeticError(error.value.decode())
def getwrittenblocks():
"""Get a list of all the blocks written to the ROM."""
return _getall(_asar.dll.asar_getwrittenblocks)
def getmapper():
"""Get the ROM mapper currently used by Asar."""
return mappertype(_asar.dll.asar_getmapper())
def getsymbolsfile(fmt="wla"):
"""Generates the contents of a symbols file for in a specific format.
Returns the textual contents of the symbols file.
format specified the format of the symbols file that gets generated.
"""
return _asar.dll.asar_getsymbolsfile(fmt.encode()).decode()

Binary file not shown.

Binary file not shown.

Binary file not shown.

1021
bonktreemaps.asm Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -2,21 +2,22 @@
; Randomize Book of Mudora
;--------------------------------------------------------------------------------
LoadLibraryItemGFX:
%GetPossiblyEncryptedItem(LibraryItem, SpriteItemValues)
STA.w SpriteItemType, X ; Store item type
JSL.l PrepDynamicTile
LDA.l LibraryItem_Player : STA !MULTIWORLD_SPRITEITEM_PLAYER_ID
%GetPossiblyEncryptedItem(LibraryItem, SpriteItemValues)
STA $0E80, X ; Store item type
JSL.l PrepDynamicTile
RTL
;--------------------------------------------------------------------------------
DrawLibraryItemGFX:
PHA
LDA.w SpriteItemType, X ; Retrieve stored item type
JSL.l DrawDynamicTile
PLA
PHA
LDA $0E80, X ; Retrieve stored item type
JSL.l DrawDynamicTile
PLA
RTL
;--------------------------------------------------------------------------------
SetLibraryItem:
LDY.w SpriteItemType, X ; Retrieve stored item type
JSL.l ItemSet_Library ; contains thing we wrote over
LDY $0E80, X ; Retrieve stored item type
JSL.l ItemSet_Library ; contains thing we wrote over
RTL
;--------------------------------------------------------------------------------
@@ -24,34 +25,39 @@ RTL
;================================================================================
; Randomize Bonk Keys
;--------------------------------------------------------------------------------
!REDRAW = "$7F5000"
;--------------------------------------------------------------------------------
LoadBonkItemGFX:
LDA.b #$08 : STA.w SpriteOAMProp, X ; thing we wrote over
LDA.b #$08 : STA $0F50, X ; thing we wrote over
LoadBonkItemGFX_inner:
LDA.b #$00 : STA.l RedrawFlag
LDA.b #$00 : STA !REDRAW
JSR LoadBonkItem_Player : STA !MULTIWORLD_SPRITEITEM_PLAYER_ID
JSR LoadBonkItem
JSL.l PrepDynamicTile
RTL
;--------------------------------------------------------------------------------
DrawBonkItemGFX:
PHA
LDA.l RedrawFlag : BEQ .skipInit ; skip init if already ready
JSL.l LoadBonkItemGFX_inner
BRA .done ; don't draw on the init frame
PHA
LDA !REDRAW : BEQ .skipInit ; skip init if already ready
JSL.l LoadBonkItemGFX_inner
BRA .done ; don't draw on the init frame
.skipInit
JSR LoadBonkItem
JSL.l DrawDynamicTileNoShadow
.done
PLA
JSR LoadBonkItem
JSL.l DrawDynamicTileNoShadow
.done
PLA
RTL
;--------------------------------------------------------------------------------
GiveBonkItem:
JSR LoadBonkItem_Player : STA !MULTIWORLD_ITEM_PLAYER_ID
JSR LoadBonkItem
CMP.b #$24 : BNE .notKey
CMP #$24 : BNE .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 CurrentSmallKeys : INC A : STA CurrentSmallKeys
LDA.b #$2F : JSL.l Sound_SetSfx3PanLong
JSL CountBonkItem
RTL
@@ -61,14 +67,27 @@ RTL
RTL
;--------------------------------------------------------------------------------
LoadBonkItem:
LDA.b RoomIndex ; check room ID - only bonk keys in 2 rooms so we're just checking the lower byte
CMP.b #115 : BNE + ; Desert Bonk Key
LDA $A0 ; check room ID - only bonk keys in 2 rooms so we're just checking the lower byte
CMP #115 : BNE + ; Desert Bonk Key
LDA.l BonkKey_Desert
BRA ++
+ : CMP.b #140 : BNE + ; GTower Bonk Key
LDA.l BonkKey_GTower
+ : CMP #140 : BNE + ; GTower Bonk Key
LDA.l BonkKey_GTower
BRA ++
+
LDA.b #$24 ; default to small key
++
RTS
;--------------------------------------------------------------------------------
LoadBonkItem_Player:
LDA $A0 ; check room ID - only bonk keys in 2 rooms so we're just checking the lower byte
CMP #115 : BNE + ; Desert Bonk Key
LDA.l BonkKey_Desert_Player
BRA ++
+ : CMP #140 : BNE + ; GTower Bonk Key
LDA.l BonkKey_GTower_Player
BRA ++
+
LDA.b #$00
++
RTS

View File

@@ -1,31 +1,28 @@
;================================================================================
; Boots State Modifier
;--------------------------------------------------------------------------------
!BOOTS_MODIFIER = "$7F50CE"
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
LDA !BOOTS_MODIFIER : CMP.b #$01 : BNE +
PLA : AND 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
++ : PLA : AND.l AbilityFlags : ORA.b #$04 : RTL ; yes boots, not hovering
PLA : AND AbilityFlags : AND.b #$FB : RTL ; no boots
+ : LDA FakeBoots : CMP.b #$01 : BNE +
LDA $5B : BEQ ++ : LDA $59 : BNE + ; hover check
++ : PLA : AND AbilityFlags : ORA.b #$04 : RTL ; yes boots, not hovering
+
PLA
AND.l AbilityFlags ; regular boots
AND AbilityFlags ; regular boots
RTL
;--------------------------------------------------------------------------------
AddBonkTremors:
PHA
LDA.b $46 : BNE + ; Check for incapacitated Link
LDA $46 : BNE + ; Check for incapacitated Link
JSL.l IncrementBonkCounter
+
LDA.l BootsModifier : CMP.b #$01 : BEQ +
LDA.l BootsEquipment : BNE + ; Check for Boots
LDA !BOOTS_MODIFIER : CMP.b #$01 : BEQ +
LDA BootsEquipment : BNE + ; Check for Boots
PLA : RTL
+
PLA
@@ -35,46 +32,46 @@ RTL
BonkBreakableWall:
PHX : PHP
SEP #$30 ; set 8-bit accumulator and index registers
LDA.l BootsModifier : CMP.b #$01 : BEQ +
LDA.l BootsEquipment : BNE + ; Check for Boots
LDA !BOOTS_MODIFIER : CMP.b #$01 : BEQ +
LDA BootsEquipment : BNE + ; Check for Boots
PLP : PLX : LDA.w #$0000 : RTL
+
PLP : PLX
LDA.w $0372 : AND.w #$00FF ; things we wrote over
LDA $0372 : AND.w #$00FF ; things we wrote over
RTL
;--------------------------------------------------------------------------------
BonkRockPile:
LDA.l BootsModifier : CMP.b #$01 : BEQ +
LDA.l BootsEquipment : BNE + ; Check for Boots
LDA !BOOTS_MODIFIER : CMP.b #$01 : BEQ +
LDA BootsEquipment : BNE + ; Check for Boots
LDA.b #$00 : RTL
+
LDA.w TileActBE : AND.b #$70 ; things we wrote over
LDA $02EF : AND.b #$70 ; things we wrote over
RTL
;--------------------------------------------------------------------------------
GravestoneHook:
LDA.l BootsModifier : CMP.b #$01 : BEQ +
LDA.l BootsEquipment : BEQ .done ; Check for Boots
LDA !BOOTS_MODIFIER : CMP.b #$01 : BEQ +
LDA BootsEquipment : BEQ .done ; Check for Boots
+
LDA.w $0372 : BEQ .done ; things we wrote over
LDA $0372 : BEQ .done ; things we wrote over
JML.l moveGravestone
.done
JML.l GravestoneHook_continue
;--------------------------------------------------------------------------------
JumpDownLedge:
LDA.l BootsModifier : CMP.b #$01 : BEQ +
LDA.l BootsEquipment : BNE + ; Check for Boots
LDA !BOOTS_MODIFIER : CMP.b #$01 : BEQ +
LDA BootsEquipment : BNE + ; Check for Boots
; Disarm Waterwalk
LDA.b LinkSlipping : CMP.b #$01 : BNE +
STZ.b LinkSlipping
LDA $5B : CMP.b #$01 : BNE +
STZ $5B
+
LDA.b IndoorsFlag : BNE .done : LDA.b #$02 : STA.b LinkLayer ; things we wrote over
LDA $1B : BNE .done : LDA.b #$02 : STA $EE ; things we wrote over
.done
RTL
;--------------------------------------------------------------------------------
BonkRecoil:
LDA.l BootsModifier : CMP.b #$01 : BEQ +
LDA.l BootsEquipment : BNE + ; Check for Boots
LDA.b #$16 : STA.b LinkRecoilZ : RTL
LDA !BOOTS_MODIFIER : CMP.b #$01 : BEQ +
LDA BootsEquipment : BNE + ; Check for Boots
LDA.b #$16 : STA $29 : RTL
+
LDA.b #$24 : STA.b LinkRecoilZ ; things we wrote over
LDA.b #$24 : STA $29 ; things we wrote over
RTL

View File

@@ -2,8 +2,8 @@
;--------------------------------------------------------------------------------
AssignKiki:
LDA.b #$00 : STA.l FollowerDropped ; defuse bomb
LDA.b #$0A : STA.l FollowerIndicator ; assign kiki as follower
LDA.b #$00 : STA FollowerDropped ; defuse bomb
LDA.b #$0A : STA FollowerIndicator ; assign kiki as follower
RTL
;--------------------------------------------------------------------------------
@@ -11,9 +11,10 @@ RTL
; Name: AllowSQ
; Returns: Accumulator = 0 if S&Q is disallowed, 1 if allowed
;--------------------------------------------------------------------------------
!ITEM_BUSY = "$7F5091"
AllowSQ:
LDA.l ProgressIndicator : BEQ .done ; thing we overwrote - check if link is in his bed
LDA.l BusyItem : EOR.b #$01
LDA ProgressIndicator : BEQ .done ; thing we overwrote - check if link is in his bed
LDA !ITEM_BUSY : EOR #$01
.done
RTL
;--------------------------------------------------------------------------------
@@ -22,8 +23,8 @@ RTL
;0 = Reset Music
;1 = Don't Reset Music
MSMusicReset:
LDA.b OverworldIndex : CMP.b #$80 : BNE +
LDA.b LinkPosX+1
LDA $8A : CMP.b #$80 : BNE +
LDA $23
+
RTL
;--------------------------------------------------------------------------------
@@ -31,11 +32,11 @@ RTL
;--------------------------------------------------------------------------------
;0 = Become (Perma)bunny
DecideIfBunny:
LDA.l MoonPearlEquipment : BNE .done
LDA.l CurrentWorld : AND.b #$40
LDA MoonPearlEquipment : BNE .done
LDA CurrentWorld : AND.b #$40
PHA : LDA.l InvertedMode : BNE .inverted
.normal
PLA : EOR.b #$40
PLA : EOR #$40
BRA .done
.inverted
PLA
@@ -46,9 +47,9 @@ RTL
DecideIfBunnyByScreenIndex:
; If indoors we don't have a screen index. Return non-bunny to make mirror-based
; superbunny work
LDA.b IndoorsFlag : BNE .done
LDA.l MoonPearlEquipment : BNE .done
LDA.b OverworldIndex : AND.b #$40 : PHA
LDA $1B : BNE .done
LDA MoonPearlEquipment : BNE .done
PHX : LDX $8A : LDA.l OWTileWorldAssoc, X : PLX : PHA
LDA.l InvertedMode : BNE .inverted
.normal
PLA : EOR #$40
@@ -57,12 +58,21 @@ DecideIfBunnyByScreenIndex:
PLA
.done
RTL
;--------------------------------------------------------------------------------
;--------------------------------------------------------------------------------
;ReadInventoryPond:
; CPX.b #$1B : BNE + : LDA.b #$01 : RTL : +
; LDA EquipmentWRAM, X
;RTL
;--------------------------------------------------------------------------------
;--------------------------------------------------------------------------------
FixBunnyOnExitToLightWorld:
LDA.w BunnyFlag : BEQ +
LDA.w $02E0 : BEQ +
JSL.l DecideIfBunny : BEQ +
STZ.b LinkState ; set player mode to Normal
STZ.w BunnyFlag : STZ.b BunnyFlagDP ; return player graphics to normal
STZ $5D ; set player mode to Normal
STZ $02E0 : STZ $56 ; return player graphics to normal
+
RTS
;--------------------------------------------------------------------------------
@@ -73,17 +83,17 @@ RTS
FixAga2Bunny:
LDA.l FixFakeWorld : BEQ + ; Only use this fix is fakeworld fix is in use
LDA.l InvertedMode : BEQ +++
LDA.b #$00 : STA.l CurrentWorld ; Switch to light world
LDA.b #$00 : STA CurrentWorld ; Switch to light world
BRA ++
+++
LDA.b #$40 : STA.l CurrentWorld ; Switch to dark world
LDA.b #$40 : STA CurrentWorld ; Switch to dark world
++
JSL DecideIfBunny : BNE +
JSR MakeBunny
LDA.b #$04 : STA.w MusicControlRequest ; play bunny music
LDA.b #$04 : STA.w $012C ; play bunny music
BRA .done
+
LDA.b #$09 : STA.w MusicControlRequest ; what we wrote over
LDA.b #$09 : STA.w $012C ; what we wrote over
.done
RTL
;--------------------------------------------------------------------------------
@@ -91,8 +101,8 @@ RTL
;--------------------------------------------------------------------------------
MakeBunny:
PHX : PHY
LDA.b #$17 : STA.b LinkState ; set player mode to permabunny
LDA.b #$01 : STA.w BunnyFlag : STA.b BunnyFlagDP ; make player look like bunny
LDA.b #$17 : STA $5D ; set player mode to permabunny
LDA.b #$01 : STA $02E0 : STA $56 ; make player look like bunny
JSL LoadGearPalettes_bunny
PLY : PLX
RTS
@@ -113,34 +123,34 @@ FixFrogSmith:
STA.l FollowerIndicator
JSL Tagalong_LoadGfx
.done
RTS
RTL
;--------------------------------------------------------------------------------
;--------------------------------------------------------------------------------
; Fix for SQ jumping causing accidental Exploration Glitch
SQEGFix:
LDA.l Bugfix_PodEG : BEQ ++
STZ.w LayerAdjustment ; disarm exploration glitch
STZ.w $047A ; disarm exploration glitch
++ RTL
;--------------------------------------------------------------------------------
; Fix crystal not spawning when using somaria vs boss
TryToSpawnCrystalUntilSuccess:
STX.w ItemReceiptID ; what we overwrote
STX $02D8 ; what we overwrote
JSL AddAncillaLong : BCS .failed ; a clear carry flag indicates success
.spawned
STZ.b RoomTag ; the "trying to spawn crystal" flag
STZ.b RoomTag+1 ; the "trying to spawn pendant" flag
STZ $AE ; the "trying to spawn crystal" flag
STZ $AF ; the "trying to spawn pendant" flag
.failed
RTL
;--------------------------------------------------------------------------------
; Fix crystal not spawning when using somaria vs boss
WallmasterCameraFix:
STZ.b CameraBoundV ; disable vertical camera scrolling for current room
STZ $A7 ; disable vertical camera scrolling for current room
REP #$20
STZ.w CameraScrollN ; something about scrolling, setting these to 0 tricks the game
STZ.w CameraScrollS ; into thinking we're at the edge of the room so it doesn't scroll.
STZ $0618 ; something about scrolling, setting these to 0 tricks the game
STZ $061A ; into thinking we're at the edge of the room so it doesn't scroll.
SEP #$20
JML Sound_SetSfx3PanLong ; what we wrote over, also this will RTL
@@ -148,8 +158,8 @@ WallmasterCameraFix:
; Fix losing glove colors
LoadActualGearPalettesWithGloves:
REP #$20
LDA.l SwordEquipment : STA.b Scrap0C
LDA.l ArmorEquipment : AND.w #$00FF
LDA SwordEquipment : STA $0C
LDA ArmorEquipment : AND.w #$00FF
JSL LoadGearPalettes_variable
JSL SpriteSwap_Palette_ArmorAndGloves_part_two
RTL
@@ -157,24 +167,24 @@ RTL
;--------------------------------------------------------------------------------
; Fix Bunny Palette Map Bug
LoadGearPalette_safe_for_bunny:
LDA.b GameMode
LDA $10
CMP.w #$030E : BEQ .new ; opening dungeon map
CMP.w #$070E : BEQ .new ; opening overworld map
.original
-
LDA.b [Scrap00]
STA.l PaletteBufferAux, X
STA.l PaletteBuffer, X
INC.b Scrap00 : INC.b Scrap00
LDA [$00]
STA $7EC300, X
STA $7EC500, X
INC $00 : INC $00
INX #2
DEY
BPL -
RTL
.new
-
LDA.b [Scrap00]
STA.l PaletteBuffer, X
INC.b Scrap00 : INC.b Scrap00
LDA [$00]
STA $7EC500, X
INC $00 : INC $00
INX #2
DEY
BPL -
@@ -183,16 +193,16 @@ RTL
;--------------------------------------------------------------------------------
; Fix pedestal pull overlay
PedestalPullOverlayFix:
LDA.b #$09 : STA.w AncillaGeneral, X ; the thing we wrote over
LDA.b IndoorsFlag : BNE +
LDA.b OverworldIndex : CMP.b #$80 : BNE +
LDA.b OverlayID : CMP.b #$97
LDA.b #$09 : STA $039F, X ; the thing we wrote over
LDA $1B : BNE +
LDA $8A : CMP.b #$80 : BNE +
LDA $8C : CMP.b #$97
+
RTL
;--------------------------------------------------------------------------------
FixJingleGlitch:
LDA.b GameSubMode
LDA.b $11
BEQ .set_doors
LDA.l AllowAccidentalMajorGlitch
@@ -200,7 +210,7 @@ FixJingleGlitch:
.set_doors
LDA.b #$05
STA.b GameSubMode
STA.b $11
.exit
RTL
@@ -212,36 +222,7 @@ pushpc
pullpc
;--------------------------------------------------------------------------------
SetOverworldTransitionFlags:
LDA.b #$01
STA.w OWTransitionFlag
STA.w RaceGameFlag
LDA #$01
STA $0ABF ; used by witch
STA $021B ; used by race game
RTL
;--------------------------------------------------------------------------------
ParadoxCaveGfxFix:
; Always upload line unless you're moving into paradox cave (0x0FF) from above (0x0EF)
LDA.b IndoorsFlag : BEQ .uploadLine
LDX.b RoomIndex : CPX.w #$00FF : BNE .uploadLine
LDX.b PreviousRoom : CPX.w #$00EF : BNE .uploadLine
;Ignore uploading four specific lines of tiles to VRAM
LDX.w VRAMUploadAddress
; Line 1
CPX.w #$1800 : BEQ .skipMostOfLine
; Line 2
CPX.w #$1A00 : BEQ .skipMostOfLine
; Line 3
CPX.w #$1C00 : BEQ .uploadLine
; Line 4
CPX.w #$1E00 : BEQ .uploadLine
.uploadLine
LDA.b #$01 : STA.w MDMAEN
.skipLine
RTL
.skipMostOfLine
; Set line length to 192 bytes (the first 6 8x8 tiles in the line)
LDX.w #$00C0 : STX.w DAS0L
BRA .uploadLine
;--------------------------------------------------------------------------------

View File

@@ -1,4 +1,2 @@
del ..\working.sfc
copy ..\alttp.sfc ..\working.sfc
%~dp0bin\windows\asar.exe LTTP_RND_GeneralBugfixes.asm ..\working.sfc
cmd /k
py -3 build.py
@echo %cmdcmdline%|find /i """%~f0""">nul && cmd /k

115
build.py Normal file
View File

@@ -0,0 +1,115 @@
import os
import sys
import hashlib
from asar import init as asar_init, close as asar_close, patch as asar_patch, geterrors as asar_errors, getprints as asar_prints, getwarnings as asar_warnings
JAP10HASH = '03a63945398191337e896e5771f77173'
try:
from yaml import CLoader as Loader
except ImportError:
from yaml import Loader
def int16_as_bytes(value):
value = value & 0xFFFF
return [value & 0xFF, (value >> 8) & 0xFF]
def int32_as_bytes(value):
value = value & 0xFFFFFFFF
return [value & 0xFF, (value >> 8) & 0xFF, (value >> 16) & 0xFF, (value >> 24) & 0xFF]
def is_bundled():
return getattr(sys, 'frozen', False)
def local_path(path):
if local_path.cached_path:
return os.path.join(local_path.cached_path, path)
elif is_bundled():
if hasattr(sys, "_MEIPASS"):
# we are running in a PyInstaller bundle
local_path.cached_path = sys._MEIPASS # pylint: disable=protected-access,no-member
else:
# cx_Freeze
local_path.cached_path = os.path.dirname(os.path.abspath(sys.argv[0]))
else:
# we are running in a normal Python environment
import __main__
local_path.cached_path = os.path.dirname(os.path.abspath(__main__.__file__))
return os.path.join(local_path.cached_path, path)
local_path.cached_path = None
def make_new_base2current(old_rom_data, new_rom_data):
from collections import OrderedDict
import json
# extend to 2 mb
old_rom_data.extend(bytearray([0x00]) * (2097152 - len(old_rom_data)))
out_data = OrderedDict()
for idx, old in enumerate(old_rom_data):
new = new_rom_data[idx]
if old != new:
out_data[idx] = [int(new)]
for offset in reversed(list(out_data.keys())):
if offset - 1 in out_data:
out_data[offset-1].extend(out_data.pop(offset))
with open('../base2current.json', 'wt') as outfile:
json.dump([{key: value} for key, value in out_data.items()], outfile, separators=(",", ":"))
basemd5 = hashlib.md5()
basemd5.update(new_rom_data)
return "New Rom Hash: " + basemd5.hexdigest()
if __name__ == '__main__':
try:
asar_init()
print("Asar DLL initialized")
print("Opening Base rom")
with open('../alttp.sfc', 'rb') as stream:
old_rom_data = bytearray(stream.read())
if len(old_rom_data) % 0x400 == 0x200:
old_rom_data = old_rom_data[0x200:]
basemd5 = hashlib.md5()
basemd5.update(old_rom_data)
if JAP10HASH != basemd5.hexdigest():
raise Exception("Base rom is not 'Zelda no Densetsu - Kamigami no Triforce (J) (V1.0)'")
print("Patching Base Rom")
result, new_rom_data = asar_patch(os.path.abspath('LTTP_RND_GeneralBugfixes.asm'), old_rom_data)
if result:
with open('../working.sfc', 'wb') as stream:
stream.write(new_rom_data)
print("Success\n")
print(make_new_base2current(old_rom_data, new_rom_data))
prints = asar_prints()
for p in prints:
print(p)
else:
errors = asar_errors()
print("\nErrors: " + str(len(errors)))
for error in errors:
print (error)
warnings = asar_warnings()
print("\nWarnings: " + str(len(warnings)))
for w in warnings:
print(w)
asar_close()
except:
import traceback
traceback.print_exc()

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
./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
asar LTTP_RND_GeneralBugfixes.asm ../working.sfc

0
data/c2807_v3.gfx → c2807_v3.gfx Normal file → Executable file
View File

View File

@@ -2,26 +2,36 @@
; Capacity Logic
;================================================================================
IncrementBombs:
LDA.l BombCapacity : BEQ + ; Skip if we can't have bombs
DEC
CMP.l BombsEquipment : !BLT +
LDA.l BombsEquipment
CMP.b #99 : !BGE +
INC : STA.l BombsEquipment
+
LDA BombCapacityUpgrades ; get bomb upgrades
!ADD.l StartingMaxBombs : BEQ + ; Skip if we can't have bombs
DEC
CMP BombsEquipment
!BLT +
LDA BombsEquipment
CMP.b #99 : !BGE +
INC : STA BombsEquipment
+
RTL
;--------------------------------------------------------------------------------
IncrementArrows:
LDA.l ArrowCapacity : DEC
CMP.l CurrentArrows : !BLT +
LDA.l CurrentArrows
CMP.b #99 : !BGE +
INC : STA.l CurrentArrows
+
LDA ArrowCapacityUpgrades ; get arrow upgrades
!ADD.l StartingMaxArrows : DEC
CMP CurrentArrows
!BLT +
LDA CurrentArrows
CMP.b #99 : !BGE +
INC : STA CurrentArrows
+
RTL
;--------------------------------------------------------------------------------
CompareBombsToMax:
LDA.l BombCapacity
CMP.l BombsEquipment
LDA BombCapacityUpgrades ; get bomb upgrades
!ADD.l StartingMaxBombs
CMP BombsEquipment
RTL
;--------------------------------------------------------------------------------

42
catfish.asm Normal file
View File

@@ -0,0 +1,42 @@
;================================================================================
; Randomize Catfish
;--------------------------------------------------------------------------------
!HEART_REDRAW = "$7F5000"
LoadCatfishItemGFX:
LDA.l CatfishItem_Player : STA !MULTIWORLD_SPRITEITEM_PLAYER_ID
LDA.l $1DE185 ; location randomizer writes catfish item to
JML PrepDynamicTile
;--------------------------------------------------------------------------------
DrawThrownItem:
LDA $8A : CMP.b #$81 : BNE .catfish
.zora
LDA.b #$01 : STA !HEART_REDRAW
LDA.l $1DE1C3 ; location randomizer writes zora item to
BRA .draw
.catfish
LDA.l $1DE185 ; location randomizer writes catfish item to
.draw
JML DrawDynamicTile
;--------------------------------------------------------------------------------
MarkThrownItem:
PHA
LDA $8A : CMP.b #$81 : BNE .catfish
.zora
JSL.l ItemSet_ZoraKing
LDA ZoraItem_Player : STA !MULTIWORLD_ITEM_PLAYER_ID
BRA .done
.catfish
JSL.l ItemSet_Catfish
LDA CatfishItem_Player : STA !MULTIWORLD_ITEM_PLAYER_ID
.done
PLA
JSL Link_ReceiveItem ; thing we wrote over
RTL
;--------------------------------------------------------------------------------

248
clock.asm Normal file
View File

@@ -0,0 +1,248 @@
;--------------------------------------------------------------------------------
; http://problemkaputt.de/fullsnes.htm
; 2800h-2801h S-RTC Real Time Clock I/O Ports
; cartridge type change from #$02 to #$55 to enable S-RTC
; SNES Cart S-RTC (Realtime Clock) (1 game)
;
; PCB "SHVC-LJ3R-01" with 24pin "Sharp S-RTC" chip. Used only by one japanese game:
; Dai Kaiju Monogatari 2 (1996) Birthday/Hudson Soft (JP)
;
; S-RTC I/O Ports
; 002800h S-RTC Read (R)
; 002801h S-RTC Write (W)
; Both registers are 4bits wide. When writing: Upper 4bit should be zero. When reading: Upper 4bit should be masked-off (they do possibly contain garbage, eg. open-bus).
;
; S-RTC Communication
; The sequence for setting, and then reading the time is:
; Send <0Eh,04h,0Dh,0Eh,00h,Timestamp(12 digits),0Dh> to [002801h]
; If ([002800h] AND 0F)=0Fh then read <Timestamp(13 digits)>
; If ([002800h] AND 0F)=0Fh then read <Timestamp(13 digits)>
; If ([002800h] AND 0F)=0Fh then read <Timestamp(13 digits)>
; If ([002800h] AND 0F)=0Fh then read <Timestamp(13 digits)>
; etc.
; The exact meaning of the bytes is unknown. 0Eh/0Dh seems to invoke/terminate commands, 04h might be some configuration stuff (like setting 24-hour mode). 00h is apparently the set-time command. There might be further commands (such like setting interrupts, alarm, 12-hour mode, reading battery low & error flags, etc.). When reading, 0Fh seems to indicate sth like "time available".
; The 12/13-digit "SSMMHHDDMYYY(D)" Timestamps are having the following format:
; Seconds.lo (BCD, 0..9)
; Seconds.hi (BCD, 0..5)
; Minutes.lo (BCD, 0..9)
; Minutes.hi (BCD, 0..5)
; Hours.lo (BCD, 0..9)
; Hours.hi (BCD, 0..2)
; Day.lo (BCD, 0..9)
; Day.hi (BCD, 0..3)
; Month (HEX, 01h..0Ch)
; Year.lo (BCD, 0..9)
; Year.hi (BCD, 0..9)
; Century (HEX, 09h..0Ah for 19xx..20xx)
; When READING the time, there is one final extra digit (the existing software doesn't transmit that extra digit on WRITING, though maybe it's possible to do writing, too):
; Day of Week? (0..6) (unknown if RTC assigns sth like 0=Sunday or 0=Monday)
;--------------------------------------------------------------------------------
;--------------------------------------------------------------------------------
macro A_x10()
ASL #1 : PHA
ASL #2 : !ADD 1,s
STA 1,s : PLA
endmacro
;--------------------------------------------------------------------------------
macro A_x24()
ASL #3 : PHA
ASL #1 : !ADD 1,s
STA 1,s : PLA
endmacro
;--------------------------------------------------------------------------------
macro A_x60()
ASL #2 : PHA
ASL #4 : !SUB 1,s
STA 1,s : PLA
endmacro
;--------------------------------------------------------------------------------
macro Clock_ReadBCD()
LDA $002800 : PHA
LDA $002800 : %A_x10() : !ADD 1,s
STA 1,s : PLA
endmacro
;--------------------------------------------------------------------------------
Clock_Test:
JSL.l Clock_Init
JML.l Clock_IsSupported
;--------------------------------------------------------------------------------
; Clock_Init
;--------------------------------------------------------------------------------
Clock_Init:
LDA.b #$0E : STA $002801
LDA.b #$04 : STA $002801
LDA.b #$0D : STA $002801
LDA.b #$0E : STA $002801
LDA.b #$00 : STA $002801
LDA.b #$00 : STA $002801
LDA.b #$00 : STA $002801
LDA.b #$00 : STA $002801
LDA.b #$00 : STA $002801
LDA.b #$00 : STA $002801
LDA.b #$00 : STA $002801
LDA.b #$01 : STA $002801
LDA.b #$00 : STA $002801
LDA.b #$01 : STA $002801
LDA.b #$00 : STA $002801
LDA.b #$00 : STA $002801
LDA.b #$0A : STA $002801
LDA.b #$0D : STA $002801
RTL
;--------------------------------------------------------------------------------
;--------------------------------------------------------------------------------
; Clock_IsSupported
;--------------------------------------------------------------------------------
; Input: None (8-bit accumulator)
;--------------------------------------------------------------------------------
; Output:
; Carry - unset if unsupported, set if supported
; Zero - Undefined
;--------------------------------------------------------------------------------
; Side Effects:
; S-RTC is ready for reading upon exit if supported
;--------------------------------------------------------------------------------
Clock_IsSupported:
PHA : PHX
LDX #$00;
-
LDA $002800 : AND.b #$0F : CMP #$0F : BEQ .done ; check for clock chip ready signal
CPX.b #$0E : BCC ++ : CLC : BRA .done ; if we've read 14 bytes with no success, unset carry and exit
++ INX
BRA -
.done
PLX : PLA
RTL
;--------------------------------------------------------------------------------
;--------------------------------------------------------------------------------
; Clock_QuickStamp
;--------------------------------------------------------------------------------
; Input: None
;--------------------------------------------------------------------------------
; Output:
; $00.b - 24-bit timestamp (low)
; $01.b - 24-bit timestamp (mid)
; $02.b - 24-bit timestamp (high)
; $03.b - zero
; Carry - Unset if error, Set if success
; Zero - Undefined
;--------------------------------------------------------------------------------
; Side Effects:
; Requires Mode-7 Matrix Registers
;--------------------------------------------------------------------------------
Clock_QuickStamp:
PHA : PHX : PHP
SEP #$30 ; set 8-bit accumulator and index registers
LDX #$00;
-
LDA $002800 : AND.b #$0F : CMP #$0F : BEQ .ready ; check for clock chip ready signal
CPX.b #$0E : !BLT ++ : CLC : JMP .done : ++ ; if we've read 14 bytes with no success, unset carry and exit
INX
BRA -
SEC ; indicate success
.ready
%Clock_ReadBCD() : STA $00 ; seconds
%Clock_ReadBCD() : STA $01 ; minutes
%Clock_ReadBCD() : STA $02 ; hours
%Clock_ReadBCD() : STA $03 ; days
REP $20 ; set 16-bit accumulator
LDA $01 : AND #$00FF : %A_x60() ; convert minutes to seconds
STZ $01 : !ADD $00 : STA $00 ; store running total seconds to $00
LDA $03 : AND #$00FF : %A_x24() ; convert days to hours
STZ $03 : !ADD $02 ; get total hours
%A_x60() ; get total minutes
LDY #$60
JSL.l Multiply_A16Y8
STY $02 : STZ $03
!ADD $00 : BCC + : INC $02 : +
.done
PLP : PLX : PLA
RTL
;--------------------------------------------------------------------------------
;--------------------------------------------------------------------------------
; Multiply_A16Y8:
;--------------------------------------------------------------------------------
; Expects:
; Accumulator - 16-bit
; Index Registers - 8-bit
;--------------------------------------------------------------------------------
; Notes:
; Found a (wrong) version of this on wikibooks. This is cleaned up and fixed.
;--------------------------------------------------------------------------------
Multiply_A16Y8:
SEP #$20 ; set 8-bit accumulator
STY $4202
STA $4203
NOP #4
LDA $4216
LDY $4217
XBA
STA $4203
NOP #2
TYA
CLC
ADC $4216
LDY $4217
BCC .carry_bit
INY
.carry_bit:
XBA
REP #$20 ; set 16-bit accumulator
RTL
;--------------------------------------------------------------------------------
;--------------------------------------------------------------------------------
; Clock_GetTime
;--------------------------------------------------------------------------------
; Input: None
;--------------------------------------------------------------------------------
; Output:
; $00.b - Seconds
; $01.b - Minutes
; $02.b - Hours
; $03.b - Days
; $04.b - Months
; $05.w - Years
; Carry - Unset if error, Set if success
; Zero - Undefined
;--------------------------------------------------------------------------------
Clock_GetTime:
PHA : PHX : PHY : PHP
SEP #$30 ; set 8-bit accumulator and index registers
LDX #$00;
-
LDA $002800 : AND.b #$0F : CMP #$0F : BEQ .ready ; check for clock chip ready signal
CPX.b #$0E : !BLT ++ : CLC : JMP .done : ++ ; if we've read 14 bytes with no success, unset carry and exit
INX
BRA -
SEC ; indicate success
.ready
%Clock_ReadBCD() : STA $00 ; seconds
%Clock_ReadBCD() : STA $01 ; minutes
%Clock_ReadBCD() : STA $02 ; hours
%Clock_ReadBCD() : STA $03 ; days
LDA $002800 : STA $04 ; months
%Clock_ReadBCD() : STA $05 ; years
LDA $002800 : STA $06 ; century
REP $20 ; set 16-bit accumulator
STA $06 : AND #$00FF : %A_x10() : %A_x10() : !ADD #1000 ; multiply century digit by 100 and add 1000
STZ $06 : !ADD $05 : STA $05 ; add lower 2 digits of the year and store
.done
PLP : PLY : PLX : PLA
RTL
;--------------------------------------------------------------------------------

View File

@@ -1,82 +1,72 @@
DrawDungeonItemCounts:
LDX.b IndoorsFlag : BNE + : RTL : + ; Skip if outdoors
;--------------------------------------------------------------------------------
; $7F5010 - Scratch Space
;--------------------------------------------------------------------------------
DrawDungeonCompassCounts:
SEP #$10
LDX $1B : 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
LDA.w $040C : 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
CPX.b #$1B : BCC + ; Skip if not in a valid dungeon ID
JMP .done
+
BIT.w #$0002 : BNE ++ ; if CompassMode==2, we don't check for the compass
TXY : TXA : LSR : TAX : LDA.l ExistsTransfer, X : TAX : LDA CompassExists, X : BEQ ++
TYX : LDA CompassField : AND.l DungeonItemMasks, X ; Load compass values to A, mask with dungeon item masks
BNE ++
JMP .done ; skip if we don't have compass
++
LDA $040C : LSR
BNE +
INC
+ TAX : LDA.l CompassTotalsWRAM, X : AND #$00FF
PHX
PHA
JSL HexToDec_fast
PLA : CMP.w #100 : !BLT .two_digit
LDX.b $05 : TXA : ORA #$2490 : STA $7EC79A
LDX.b $06 : TXA : ORA #$2490 : STA $7EC79C
LDX.b $07 : TXA : ORA #$2490 : STA $7EC79E
BRA .end_total
.two_digit
LDX.b $06 : TXA : ORA #$2490 : STA $7EC79A
LDX.b $07 : TXA : ORA #$2490 : STA $7EC79C
.end_total
PLX
LDA DungeonLocationsChecked, X : AND #$00FF
PHA
JSL HexToDec_fast
PLA : CMP.w #100 : !BLT +
LDX.b $05 : TXA : ORA #$2490 : STA $7EC792 ; Draw the 100's digit
+
LDX.b $06 : TXA : ORA #$2490 : STA $7EC794 ; Draw the item count
LDX.b $07 : TXA : ORA #$2490 : STA $7EC796
LDA.w #$2830 : STA $7EC798 ; draw the slash
.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 $8000, $4000, $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
; maps from $040C to the odd order used in overworld map
ExistsTransfer:
db $0C, $0C, $00, $02, $0B, $09, $03, $07, $04, $08, $01, $06, $05, $0A
;--------------------------------------------------------------------------------
; $7EF4C0-7EF4CF - item locations checked indexed by $040C >> 1
;--------------------------------------------------------------------------------
InitCompassTotalsRAM:
LDX #$00
-
LDA CompassTotalsROM, X : STA CompassTotalsWRAM, X
INX
CPX #$0F : !BLT -
RTL

29
compression.asm Normal file
View File

@@ -0,0 +1,29 @@
;--------------------------------------------------------------------------------
ParadoxCaveGfxFix:
; Always upload line unless you're moving into paradox cave (0x0FF) from above (0x0EF)
LDA $1B : BEQ .uploadLine
LDX $A0 : CPX #$00FF : BNE .uploadLine
LDX $A2 : CPX #$00EF : BNE .uploadLine
;Ignore uploading four specific lines of tiles to VRAM
LDX $0118
; Line 1
CPX #$1800 : BEQ .skipMostOfLine
; Line 2
CPX #$1A00 : BEQ .skipMostOfLine
; Line 3
CPX #$1C00 : BEQ .uploadLine
; Line 4
CPX #$1E00 : BEQ .uploadLine
.uploadLine
LDA.b #$01 : STA $420B
.skipLine
RTL
.skipMostOfLine
; Set line length to 192 bytes (the first 6 8x8 tiles in the line)
LDX.w #$00C0 : STX $4305
BRA .uploadLine
;--------------------------------------------------------------------------------

185
contrib.asm Normal file
View File

@@ -0,0 +1,185 @@
;================================================================
; Contributor: Myramong
;================================================================
;Sprite_ShowMessageFromPlayerContact_Edit:
;{
; STZ $1CE8
; JSL.l Sprite_CheckDamageToPlayerSameLayerLong : BCC .dont_show
;
; LDA $4D : CMP.b #$02 : BEQ .dont_show
;
; JSL.l Sprite_DirectionToFacePlayerLong : TYA : EOR.b #$03
; SEC
;RTL
;.dont_show
; LDA $0DE0, X
; CLC
;RTL
;}
;================================================================
;Sprite_ShowSolicitedMessageIfPlayerFacing_Edit:
;{
; JSL.l Sprite_CheckDamageToPlayerSameLayerLong : BCC .alpha
; JSL.l Sprite_CheckIfPlayerPreoccupied : BCS .alpha
; LDA $F6 : BPL .alpha
; LDA $0F10, X : BNE .alpha
;
; LDA $4D : CMP.b #$02 : BEQ .alpha
;
; STZ $1CE8 ; set text choice to 1st option (usually yes/confirm/etc)
; JSL.l Sprite_DirectionToFacePlayerLong : PHX : TYX
;
; ; Make sure that the sprite is facing towards the player, otherwise
; ; talking can't happen. (What sprites actually use this???)
; LDA $05E1A3, X : PLX : CMP $2F : BNE .not_facing_each_other
; PHY
; LDA.b #$40 : STA $0F10, X
; PLA : EOR.b #$03
; SEC
;RTL
;.not_facing_each_other
;.alpha
; LDA $0DE0, X
; CLC
;RTL
;}
;================================================================
;OldMountainMan_TransitionFromTagalong_Edit:
;{
; PHA
;
; LDA.b #$AD : JSL Sprite_SpawnDynamically
;
; PLA : PHX : TAX
;
; LDA $1A64, X : AND.b #$03 : STA $0EB0, Y
; STA $0DE0, Y
;
; LDA $1A00, X : CLC : ADC.b #$02 : STA $0D00, Y
; LDA $1A14, X : ADC.b #$00 : STA $0D20, Y
;
; LDA $1A28, X : CLC : ADC.b #$02 : STA $0D10, Y
; LDA $1A3C, X : ADC.b #$00 : STA $0D30, Y
;
; LDA $EE : STA $0F20, Y
;
; LDA.b #$01 : STA $0BA0, Y
; STA $0E80, Y
;
; LDA.b #$01 : STA $02E4 ; OldMountainMan_FreezePlayer
; STA $037B ; ^
;
; PLX
;
; LDA.b #$00 : STA FollowerIndicator
;
; STZ $5E
;
; JML $09A6B6 ; <- 4A6B6 tagalong.asm:1194 (SEP #$30 : RTS)
;}
;================================================================
Sprite_ShowSolicitedMessageIfPlayerFacing_Alt:
{
STA $1CF0
STY $1CF1
JSL Sprite_CheckDamageToPlayerSameLayerLong : BCC .alpha
JSL Sprite_CheckIfPlayerPreoccupied : BCS .alpha
LDA $F6 : BPL .alpha
LDA $0F10, X : BNE .alpha
LDA $4D : CMP.b #$02 : BEQ .alpha
JSL Sprite_DirectionToFacePlayerLong : PHX : TYX
; Make sure that the sprite is facing towards the player, otherwise
; talking can't happen. (What sprites actually use this???)
LDA $05E1A3, X : PLX : CMP $2F : BNE .not_facing_each_other
PHY
LDA $1CF0
LDY $1CF1
; Check what room we're in so we know which npc we're talking to
LDA.b $A0 : CMP #$05 : BEQ .SahasrahlaDialogs
CMP #$1C : BEQ .BombShopGuyDialog
BRA .SayNothing
.SahasrahlaDialogs
REP #$20 : LDA.l MapReveal_Sahasrahla : ORA MapOverlay : STA MapOverlay : SEP #$20
JSL DialogSahasrahla : BRA .SayNothing
.BombShopGuyDialog
REP #$20 : LDA.l MapReveal_BombShop : ORA MapOverlay : STA MapOverlay : SEP #$20
JSL DialogBombShopGuy
.SayNothing
LDA.b #$40 : STA $0F10, X
PLA : EOR.b #$03
SEC
RTL
.not_facing_each_other
.alpha
LDA $0DE0, X
CLC
RTL
}
;================================================================
Sprite_ShowSolicitedMessageIfPlayerFacing_PreserveMessage:
{
PHY
PHA
JSL Sprite_CheckDamageToPlayerSameLayerLong : BCC .alpha
JSL Sprite_CheckIfPlayerPreoccupied : BCS .alpha
LDA $F6 : BPL .alpha
LDA $0F10, X : BNE .alpha
LDA $4D : CMP.b #$02 : BEQ .alpha
JSL Sprite_DirectionToFacePlayerLong : PHX : TYX
; Make sure that the sprite is facing towards the player, otherwise
; talking can't happen. (What sprites actually use this???)
LDA $05E1A3, X : PLX : CMP $2F : BNE .not_facing_each_other
PLA : XBA : PLA
PHY
TAY : XBA
JSL Sprite_ShowMessageUnconditional
LDA.b #$40 : STA $0F10, X
PLA : EOR.b #$03
SEC
RTL
.not_facing_each_other
.alpha
PLY
PLA
LDA $0DE0, X
CLC
RTL
}
;================================================================
incsrc menu/hudalpha.asm
incsrc util/utils.asm

View File

@@ -4,81 +4,106 @@
;--------------------------------------------------------------------------------
; Filtered Joypad 1 Register: [AXLR | ????]
; Filtered Joypad 1 Register: [BYST | udlr] [AXLR | ????]
!INVERT_DPAD = "$7F50CB"
InvertDPad_DPadOnly:
LDA $4218 : STA $00
LDA $4219
BIT.b #$0C : BEQ + : EOR.b #$0C : + ; swap up/down
BIT.b #$03 : BEQ + : EOR.b #$03 : + ; swap left/right
STA $01
JML.l InvertDPadReturn
InvertDPad_ButtonsOnly:
REP #$20 ; set 16-bit accumulator
LDA $4218
BIT.w #$8040 : BEQ + : EOR.w #$8040 : + ; swap X/B
BIT.w #$4080 : BEQ + : EOR.w #$4080 : + ; swap Y/A
STA $00
SEP #$20 ; set 8-bit accumulator
JML.l InvertDPadReturn
InvertDPad_Both:
REP #$20 ; set 16-bit accumulator
LDA $4218
BIT.w #$8040 : BEQ + : EOR.w #$8040 : + ; swap X/B
BIT.w #$4080 : BEQ + : EOR.w #$4080 : + ; swap Y/A
BIT.w #$0C00 : BEQ + : EOR.w #$0C00 : + ; swap up/down
BIT.w #$0300 : BEQ + : EOR.w #$0300 : + ; swap left/right
STA $00
SEP #$20 ; set 8-bit accumulator
JML.l InvertDPadReturn
InvertDPad_SwapSides:
REP #$20 ; set 16-bit accumulator
LDA $4218
BIT.w #$0840 : BEQ + : EOR.w #$0840 : + ; swap X/up
BIT.w #$0180 : BEQ + : EOR.w #$0180 : + ; swap A/right
BIT.w #$4200 : BEQ + : EOR.w #$4200 : + ; swap Y/left
BIT.w #$8400 : BEQ + : EOR.w #$8400 : + ; swap B/down
STA $00
SEP #$20 ; set 8-bit accumulator
JML.l InvertDPadReturn
InvertDPad_DPadLROnly:
LDA $4218 : STA $00
LDA $4219
BIT.b #$03 : BEQ + : EOR.b #$03 : + ; swap left/right
STA $01
JML.l InvertDPadReturn
InvertDPad_DPadUDOnly:
LDA $4218 : STA $00
LDA $4219
BIT.b #$0C : BEQ + : EOR.b #$0C : + ; swap up/down
STA $01
JML.l InvertDPadReturn
InvertDPad:
LDA.l OneMindPlayerCount : BEQ .crowd_control
LDA.l OneMindId
LDA.l !ONEMIND_ID
AND.b #$03
TAX
LDA.l .onemind_controller_offset, X
TAX
LDA.w JOY1L,X : STA.w Scrap00
LDA.w JOY1H,X : STA.w Scrap01
LDA.w $4218,X : STA.w $00
LDA.w $4219,X : STA.w $01
LDA.b #$80 : STA.w WRIO ; reset this so latch can read it, otherwise RNG breaks
LDA #$80 : STA $4201 ; reset this so latch can read it, otherwise RNG breaks
JML.l InvertDPadReturn
.crowd_control
LDA.l ControllerInverter : BNE +
LDA.b RoomIndex : CMP.b #$DE : BNE .off
LDA.b #$01 : BRA +
LDA !INVERT_DPAD : BNE +
.off
LDA.w JOY1L : STA.b Scrap00
LDA.w JOY1H : STA.b Scrap01
LDA $4218 : STA $00
LDA $4219 : STA $01
JML.l InvertDPadReturn
+ DEC : BEQ .dpadOnly
DEC : BEQ .buttonsOnly
DEC : BEQ .invertBoth
.swapSides
REP #$20 ; set 16-bit accumulator
LDA.w JOY1L
BIT.w #$0840 : BEQ + : EOR.w #$0840 : + ; swap X/up
BIT.w #$0180 : BEQ + : EOR.w #$0180 : + ; swap A/right
BIT.w #$4200 : BEQ + : EOR.w #$4200 : + ; swap Y/left
BIT.w #$8400 : BEQ + : EOR.w #$8400 : + ; swap B/down
STA.b Scrap00
SEP #$20 ; set 8-bit accumulator
JML.l InvertDPadReturn
.invertBoth
REP #$20 ; set 16-bit accumulator
LDA.w JOY1L
BIT.w #$8040 : BEQ + : EOR.w #$8040 : + ; swap X/B
BIT.w #$4080 : BEQ + : EOR.w #$4080 : + ; swap Y/A
BIT.w #$0C00 : BEQ + : EOR.w #$0C00 : + ; swap up/down
BIT.w #$0300 : BEQ + : EOR.w #$0300 : + ; swap left/right
STA.b Scrap00
SEP #$20 ; set 8-bit accumulator
JML.l InvertDPadReturn
.buttonsOnly
REP #$20 ; set 16-bit accumulator
LDA.w JOY1L
BIT.w #$8040 : BEQ + : EOR.w #$8040 : + ; swap X/B
BIT.w #$4080 : BEQ + : EOR.w #$4080 : + ; swap Y/A
STA.b Scrap00
SEP #$20 ; set 8-bit accumulator
JML.l InvertDPadReturn
.dpadOnly
LDA.w JOY1L : STA.b Scrap00
LDA.w JOY1H
BIT.b #$0C : BEQ + : EOR.b #$0C : + ; swap up/down
BIT.b #$03 : BEQ + : EOR.b #$03 : + ; swap left/right
STA.b Scrap01
JML.l InvertDPadReturn
+ DEC : BNE +
JMP.w InvertDPad_DPadOnly
+ DEC : BNE +
JMP.w InvertDPad_ButtonsOnly
+ DEC : BNE +
JMP.w InvertDPad_Both
+ DEC : BNE +
JMP.w InvertDPad_SwapSides
+ DEC : BNE +
JMP.w InvertDPad_DPadLROnly
+ JMP.w InvertDPad_DPadUDOnly
.onemind_controller_offset
db 0 ; player 0 - JOY1L - joy1d1
db 0 ; player 1 - JOY1L - joy1d1
db 2 ; player 2 - JOY2L - joy2d1
db 6 ; player 3 - JOY4L - joy2d2
db 2 ; player 4 - JOY2L - joy2d1
db 6 ; player 5 - JOY4L - joy2d2
db 0 ; player 0 - $4218 - joy1d1
db 0 ; player 1 - $4218 - joy1d1
db 2 ; player 2 - $421A - joy2d1
db 6 ; player 3 - $421E - joy2d2
db 2 ; player 4 - $421A - joy2d1
db 6 ; player 5 - $421E - joy2d2
;--------------------------------------------------------------------------------
@@ -88,12 +113,12 @@ HandleOneMindController:
REP #$20
LDA.l OneMindTimerRAM
LDA.l !ONEMIND_TIMER
DEC
BPL .no_switch
SEP #$20
LDA.l OneMindId
LDA.l !ONEMIND_ID
INC
CMP.l OneMindPlayerCount
BCC .no_wrap
@@ -101,26 +126,29 @@ HandleOneMindController:
LDA.b #$01 ; reset to player 1
.no_wrap
STA.l OneMindId
STA.l !ONEMIND_ID
REP #$20
LDA.l OneMindTimerInit
LDA.l OneMindTimer
.no_switch
STA.l OneMindTimerRAM
STA.l !ONEMIND_TIMER
SEP #$20
LDA.l OneMindId
LDA.l !ONEMIND_ID
CMP.b #$04 ; is it player 4 or 5?
BCC .no_multitap_switch
STZ.w WRIO
STZ.w $4201
.no_multitap_switch
.no_onemind
STZ.b NMIDoneFlag
STZ.b $12
JML $008034 ; reset frame loop

View File

@@ -1,6 +1,21 @@
; Scrap04 used for n
; Scrap06 used for rounds
; Scrap08 use for dpScratch/MXResult (lower 32 of dpScratch)
; $7F50D0 - $7F50FF - Block Cypher Parameters
; $7F5100 - $7F51FF - Block Cypher Buffer
!v = "$7F5100"
!n = "$04"
!MXResult = "$08" ; an alternate name for the lower 32 bits of dpScratch
!dpScratch = "$08"
!keyBase = "$7F50D0"
!y = "$7F50E0"
!z = "$7F50E4"
!sum = "$7F50E8"
!p = "$7F50EC"
!rounds = "$06"
!e = "$7F50F0"
!upperScratch = "$7F50F2"
CryptoDelta:
dd #$9e3779b9
@@ -20,144 +35,164 @@ macro ASL32Single(value)
; ROL handles the carry from the lower byte for us
endmacro
;macro LSR32(value,k)
; LDX.b <k>
; ?loop:
; %LSR32Single(<value>,<k>)
; DEX : CPX.b #$00 : BNE ?loop
;endmacro
;macro ASL32(value,k)
; LDX.b <k>
; ?loop:
; %LSR32Single(<value>,<k>)
; DEX : CPX.b #$00 : BNE ?loop
;endmacro
CryptoMX:
PHX
; upperScratch = (z>>5 ^ y <<2)
LDA.w z : STA.b Scrap08
LDA.w z+2 : STA.b Scrap08+2
%LSR32Single(Scrap08)
%LSR32Single(Scrap08)
%LSR32Single(Scrap08)
%LSR32Single(Scrap08)
%LSR32Single(Scrap08)
;%LSR32(Scrap08,#$05)
LDA.w !z : STA.b !dpScratch
LDA.w !z+2 : STA.b !dpScratch+2
%LSR32Single(!dpScratch)
%LSR32Single(!dpScratch)
%LSR32Single(!dpScratch)
%LSR32Single(!dpScratch)
%LSR32Single(!dpScratch)
;%LSR32(!dpScratch,#$05)
LDA.w y : STA.b Scrap08+4
LDA.w y+2 : STA.b Scrap08+6
%ASL32Single(Scrap08+4)
%ASL32Single(Scrap08+4)
;%ASL32(Scrap08+4,#$02)
LDA.w !y : STA.b !dpScratch+4
LDA.w !y+2 : STA.b !dpScratch+6
%ASL32Single(!dpScratch+4)
%ASL32Single(!dpScratch+4)
;%ASL32(!dpScratch+4,#$02)
LDA.b Scrap08 : EOR.b Scrap08+4 : STA.w CryptoScratch
LDA.b Scrap08+2 : EOR.b Scrap08+6 : STA.w CryptoScratch+2
LDA.b !dpScratch : EOR.b !dpScratch+4 : STA.w !upperScratch
LDA.b !dpScratch+2 : EOR.b !dpScratch+6 : STA.w !upperScratch+2
;================================
; upperscratch2 = (y>>3^z<<4)
LDA.w z : STA.b Scrap08
LDA.w z+2 : STA.b Scrap08+2
%ASL32Single(Scrap08)
%ASL32Single(Scrap08)
%ASL32Single(Scrap08)
%ASL32Single(Scrap08)
;%ASL32(Scrap08,#$04)
LDA.w !z : STA.b !dpScratch
LDA.w !z+2 : STA.b !dpScratch+2
%ASL32Single(!dpScratch)
%ASL32Single(!dpScratch)
%ASL32Single(!dpScratch)
%ASL32Single(!dpScratch)
;%ASL32(!dpScratch,#$04)
LDA.w y : STA.b Scrap08+4
LDA.w y+2 : STA.b Scrap08+6
%LSR32Single(Scrap08+4)
%LSR32Single(Scrap08+4)
%LSR32Single(Scrap08+4)
;%LSR32(Scrap08+4,#$03)
LDA.w !y : STA.b !dpScratch+4
LDA.w !y+2 : STA.b !dpScratch+6
%LSR32Single(!dpScratch+4)
%LSR32Single(!dpScratch+4)
%LSR32Single(!dpScratch+4)
;%LSR32(!dpScratch+4,#$03)
LDA.b Scrap08 : EOR.b Scrap08+4 : STA.w CryptoScratch+4
LDA.b Scrap08+2 : EOR.b Scrap08+6 : STA.w CryptoScratch+6
LDA.b !dpScratch : EOR.b !dpScratch+4 : STA.w !upperScratch+4
LDA.b !dpScratch+2 : EOR.b !dpScratch+6 : STA.w !upperScratch+6
;================================
; upperscratch = upperscratch + upperscratch2 ( == (z>>5^y<<2) + (y>>3^z<<4) )
LDA.w CryptoScratch : !ADD.w CryptoScratch+4 : STA.w CryptoScratch
LDA.w CryptoScratch+2 : ADC.w CryptoScratch+6 : STA.w CryptoScratch+2
LDA.w !upperScratch : !ADD.w !upperScratch+4 : STA.w !upperScratch
LDA.w !upperScratch+2 : ADC.w !upperScratch+6 : STA.w !upperScratch+2
;================================
; dpscratch = sum^y
LDA.w Sum : EOR.w y : STA.b Scrap08
LDA.w Sum+2 : EOR.w y+2 : STA.b Scrap08+2
LDA.w !sum : EOR.w !y : STA.b !dpScratch
LDA.w !sum+2 : EOR.w !y+2 : STA.b !dpScratch+2
;================================
; dpscratch2 = (k[p&3^e]^z)
LDA.w p : AND.w #$0003 : EOR.w e : ASL #2 : TAX ; put (p&3)^e into X
LDA.w KeyBase, X : EOR.w z : STA.b Scrap08+4
LDA.w KeyBase+2, X : EOR.w z+2 : STA.b Scrap08+6
LDA.w !p : AND.w #$0003 : EOR.w !e : ASL #2 : TAX ; put (p&3)^e into X
LDA.w !keyBase, X : EOR.w !z : STA.b !dpScratch+4
LDA.w !keyBase+2, X : EOR.w !z+2 : STA.b !dpScratch+6
;================================
; upperscratch2 = dpscratch + dpscratch2 (== (sum^y) + (k[p&3^e]^z))
LDA.b Scrap08 : !ADD.b Scrap08+4 : STA.w CryptoScratch+4
LDA.b Scrap08+2 : ADC.b Scrap08+6 : STA.w CryptoScratch+6
LDA.b !dpScratch : !ADD.b !dpScratch+4 : STA.w !upperScratch+4
LDA.b !dpScratch+2 : ADC.b !dpScratch+6 : STA.w !upperScratch+6
;================================
; MXResult = uppserscratch ^ upperscratch2
LDA.w CryptoScratch : EOR.w CryptoScratch+4 : STA.b Scrap08
LDA.w CryptoScratch+2 : EOR.w CryptoScratch+6 : STA.b Scrap08+2
LDA.w !upperScratch : EOR.w !upperScratch+4 : STA.b !MXResult
LDA.w !upperScratch+2 : EOR.w !upperScratch+6 : STA.b !MXResult+2
PLX
RTS
;!DIVIDEND_LOW = $4204
;!DIVIDEND_HIGH = $4205
;!DIVISOR = $4206
;!QUOTIENT_LOW = $4214
;!QUOTIENT_HIGH = $4215
XXTEA_Decode:
PHP : PHB
SEP #$30 ; set 8-bit accumulator and index
LDA.b #$7F : PHA : PLB
STZ.b Scrap04+1 ; set upper byte of n to be zero, so it can safely be accessed in 16-bit mode
STZ.b !n+1 ; set upper byte of n to be zero, so it can safely be accessed in 16-bit mode
; search for lookup table index to avoid division and multiplication
LDX.b #0
-
LDA.l .n_lookup, X
CMP.b Scrap04 : !BLT +
CMP.b !n : !BLT +
INX
BRA -
+
; rounds = 6 + 52/n;
LDA.l .round_counts, X : STA.b Scrap06 : STZ.b Scrap06+1
LDA.l .round_counts, X : STA.b !rounds : STZ.b !rounds+1
REP #$20 ; set 16-bit accumulator
; sum = rounds*DELTA;
TXA : ASL #2 : TAX
LDA.l .initial_sums, X : STA.w Sum
LDA.l .initial_sums+2, X : STA.w Sum+2
LDA.l .initial_sums, X : STA.w !sum
LDA.l .initial_sums+2, X : STA.w !sum+2
; y = v[0];
LDA.w v : STA.w y
LDA.w v+2 : STA.w y+2
LDA.w !v : STA.w !y
LDA.w !v+2 : STA.w !y+2
---
LDA.w Sum : LSR #2 : AND.w #$0003 : STA.w e ; e = (sum >> 2) & 3;
LDA.w !sum : LSR #2 : AND.w #$0003 : STA.w !e ; e = (sum >> 2) & 3;
LDA.b Scrap04 : DEC : STA.w p
LDA.b !n : DEC : STA.w !p
-- BEQ + ; for (p=n-1; p>0; p--) {
; z = v[p-1];
ASL #2 : TAX
LDA.w v-4, X : STA.w z
LDA.w v-4+2, X : STA.w z+2
LDA.w !v-4, X : STA.w !z
LDA.w !v-4+2, X : STA.w !z+2
; y = v[p] -= MX;
JSR CryptoMX
LDA.w p : ASL #2 : TAX
LDA.w v, X : !SUB.b Scrap08 : STA.w v, X : STA.w y
LDA.w v+2, X : SBC.b Scrap08+2 : STA.w v+2, X : STA.w y+2
LDA.w !p : ASL #2 : TAX
LDA.w !v, X : !SUB.b !MXResult : STA.w !v, X : STA.w !y
LDA.w !v+2, X : SBC.b !MXResult+2 : STA.w !v+2, X : STA.w !y+2
LDA.w p : DEC : STA.w p : BRA -- ; }
LDA.w !p : DEC : STA.w !p : BRA -- ; }
+
; z = v[n-1];
LDA.b Scrap04 : DEC : ASL #2 : TAX
LDA.w v, X : STA.w z
LDA.w v+2, X : STA.w z+2
LDA.b !n : DEC : ASL #2 : TAX
LDA.w !v, X : STA.w !z
LDA.w !v+2, X : STA.w !z+2
; y = v[0] -= MX;
JSR CryptoMX
LDA.w v : !SUB.b Scrap08 : STA.w v : STA.w y
LDA.w v+2 : SBC.b Scrap08+2 : STA.w v+2 : STA.w y+2
LDA.w !v : !SUB.b !MXResult : STA.w !v : STA.w !y
LDA.w !v+2 : SBC.b !MXResult+2 : STA.w !v+2 : STA.w !y+2
; sum -= DELTA;
LDA.w Sum : !SUB.l CryptoDelta : STA.w Sum
LDA.w Sum+2 : SBC.l CryptoDelta+2 : STA.w Sum+2
LDA.w !sum : !SUB.l CryptoDelta : STA.w !sum
LDA.w !sum+2 : SBC.l CryptoDelta+2 : STA.w !sum+2
DEC.b Scrap06 : BEQ + : JMP --- : + ; } while (--rounds);
DEC !rounds : BEQ + : JMP --- : + ; } while (--rounds);
PLB : PLP
RTL
@@ -208,3 +243,69 @@ db 32 ; n is 2
;dd (23*$9e3779b9)&$ffffffff ; n is 3
dd (32*$9e3779b9)&$ffffffff ; n is 2
;void btea(uint32_t *v, int n, uint32_t const key[4]) {
; uint32_t y, z, sum;
; unsigned p, rounds, e;
; } else if (n < -1) { /* Decoding Part */
; n = -n;
; rounds = 6 + 52/n;
; sum = rounds*DELTA;
; y = v[0];
; do {
; e = (sum >> 2) & 3;
; for (p=n-1; p>0; p--) {
; z = v[p-1];
; y = v[p] -= MX;
; }
; z = v[n-1];
; y = v[0] -= MX;
; sum -= DELTA;
; } while (--rounds);
; }
;BTEA will encode or decode n words as a single block where n > 1
;
;v is the n word data vector
;k is the 4 word key
;n is negative for decoding
;if n is zero result is 1 and no coding or decoding takes place, otherwise the result is zero
;assumes 32 bit 'long' and same endian coding and decoding
;#include <stdint.h>
;#define DELTA 0x9e3779b9
;#define MX ((((z>>5)^(y<<2)) + ((y>>3)^(z<<4))) ^ ((sum^y) + (key[(p&3)^e] ^ z)))
;
;void btea(uint32_t *v, int n, uint32_t const key[4]) {
; uint32_t y, z, sum;
; unsigned p, rounds, e;
; if (n > 1) { /* Coding Part */
; rounds = 6 + 52/n;
; sum = 0;
; z = v[n-1];
; do {
; sum += DELTA;
; e = (sum >> 2) & 3;
; for (p=0; p<n-1; p++) {
; y = v[p+1];
; z = v[p] += MX;
; }
; y = v[0];
; z = v[n-1] += MX;
; } while (--rounds);
; } else if (n < -1) { /* Decoding Part */
; n = -n;
; rounds = 6 + 52/n;
; sum = rounds*DELTA;
; y = v[0];
; do {
; e = (sum >> 2) & 3;
; for (p=n-1; p>0; p--) {
; z = v[p-1];
; y = v[p] -= MX;
; }
; z = v[n-1];
; y = v[0] -= MX;
; sum -= DELTA;
; } while (--rounds);
; }
;}

View File

@@ -1,64 +1,78 @@
;================================================================================
!CUCCO = $0B
!INERT = $00
!INIT = $08
!ALIVE = $09
!CUCCO_ENRAGED = $23
!CUCCO_STORM = "$7F50C5"
!IS_INDOORS = "$7E001B"
!ENEMY_STATE_TABLE = "$7E0DD0"
!ENEMY_TYPE_TABLE = "$7E0E20"
!ENEMY_AUX1_TABLE = "$7E0DA0"
!ENEMY_AUX2_TABLE = "$7E0DB0"
!ENEMY_DIRECTION_TABLE = "$7E0EB0"
!CUCCO = "#$0B"
!INERT = "#$00"
!INIT = "#$08"
!ALIVE = "#$09"
!CUCCO_ENRAGED = "#$23"
!LINK_POS_Y_LOW = "$20"
!LINK_POS_Y_HIGH = "$21"
!LINK_POS_X_LOW = "$22"
!LINK_POS_X_HIGH = "$23"
!ENEMY_POS_Y_LOW = "$7E0D00"
!ENEMY_POS_X_LOW = "$7E0D10"
!ENEMY_POS_Y_HIGH = "$7E0D20"
!ENEMY_POS_X_HIGH = "$7E0D30"
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
LDA.l !CUCCO_STORM : BEQ + ; only if storm is on
LDA.b $10 : CMP.b #$09 : BEQ .check ; only if outdoors
.indoors
LDA.b #$00 : STA.l CuccoStormer ; turn off cucco storm if indoors
LDA.b #$00 : STA.l !CUCCO_STORM ; turn off cucco storm if indoors
BRA +
.check
LDA.l LoopFrames : AND.b #$7F : BNE + ; check every 128 frames
-
;==== Find a Cucco
LDY.b #$FF : PHY ; push "cucco not found"
LDX.b #$00 : -- : CPX.b #$10 : !BGE .ldone
LDA.w SpriteAITable, X : CMP.b #!ALIVE : BEQ +++
LDA.w !ENEMY_STATE_TABLE, X : CMP.b !ALIVE : BEQ +++
; enemy not found
CMP.b #!INERT : BNE ++
CMP.b !INERT : BNE ++
; log inert enemy slot
PLA : PHX
BRA ++
+++
; found an enemy
LDA.l SpriteTypeTable, X : CMP.b #!CUCCO : BNE ++
LDA.l !ENEMY_TYPE_TABLE, X : CMP.b !CUCCO : BNE ++
; it's a cucco
TXY ; record where we found the living cucco in case we don't find any angry ones
LDA.w SpriteAuxTable, X : CMP.b #!CUCCO_ENRAGED : !BLT ++
LDA.w !ENEMY_AUX1_TABLE, 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
CPY.b #$FF : BEQ + ; fail if no slots found
LDA.b #!CUCCO : STA.w SpriteTypeTable, Y
LDA.b #!INIT : STA.w SpriteAITable, Y
LDA.b LinkPosY : STA.w SpritePosYLow, Y
LDA.b LinkPosY+1 : STA.w SpritePosYHigh, Y
LDA.b LinkPosX : STA.w SpritePosXLow, Y
LDA.b LinkPosX+1 : STA.w SpritePosXHigh, Y
LDA.b !CUCCO : STA.w !ENEMY_TYPE_TABLE, Y
LDA.b !INIT : STA.w !ENEMY_STATE_TABLE, Y
LDA.b !LINK_POS_Y_LOW : STA.w !ENEMY_POS_Y_LOW, Y
LDA.b !LINK_POS_Y_HIGH : STA.w !ENEMY_POS_Y_HIGH, Y
LDA.b !LINK_POS_X_LOW : STA.w !ENEMY_POS_X_LOW, Y
LDA.b !LINK_POS_X_HIGH : STA.w !ENEMY_POS_X_HIGH, Y
BRA +++
++
PLA
+++
;==== Enrage a Cucco
LDA.b #!CUCCO_ENRAGED : STA.w SpriteAuxTable, Y ; enrage the cucco
LDA.b #$00 : STA.w SpriteAuxTable+$10, Y : STA.w SpriteDirectionTable, Y
LDA.b !CUCCO_ENRAGED : STA.w !ENEMY_AUX1_TABLE, Y ; enrage the cucco
LDA.b #$00 : STA.w !ENEMY_AUX2_TABLE, Y : STA.w !ENEMY_DIRECTION_TABLE, Y
;====
+
RTL

View File

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

View File

@@ -7,77 +7,89 @@ DarkWorldSaveFix:
JML.l StatSaveCounter
;--------------------------------------------------------------------------------
DoWorldFix:
LDA.l InvertedMode : BEQ +
LDA InvertedMode : BEQ +
JMP DoWorldFix_Inverted
+
LDA FollowerIndicator : CMP #$04 : BEQ .aga1Alive ; if old man following, skip mirror/aga check
LDA.l Bugfix_MirrorlessSQToLW : BEQ .skip_mirror_check
LDA.l FollowerIndicator : CMP.b #$04 : BEQ .setLightWorld ; check if old man is following
LDA.l MirrorEquipment : BEQ .noMirror ; check if we have the mirror
LDA MirrorEquipment : AND #$02 : BEQ .noMirror ; check if we have the mirror
.skip_mirror_check ; alt entrance point
LDA.l ProgressIndicator : CMP.b #$03 : BCS .done ; check if agahnim 1 is alive
.setLightWorld
LDA.b #$00
LDA ProgressIndicator : CMP.b #$03 : BCS .done ; check if agahnim 1 is alive
.aga1Alive
LDA #$00
.noMirror
STA.l CurrentWorld ; set flag to light world
LDA.l FollowerIndicator : CMP.b #$07 : BNE .done : INC : STA.l FollowerIndicator ; convert frog to dwarf
STA CurrentWorld ; set flag to light world
LDA.l SmithDeleteOnSave : BEQ .transform
LDA FollowerIndicator
CMP #$07 : BEQ .clear ; clear frog
CMP #$08 : BEQ .clear ; clear dwarf - consider flute implications
BRA .done
.clear
LDA.b #$00 : STA FollowerIndicator : BRA .done ; clear follower
.transform
LDA FollowerIndicator : CMP #$07 : BNE .done : INC : STA FollowerIndicator ; convert frog to dwarf
.done
RTL
;--------------------------------------------------------------------------------
SetDeathWorldChecked:
LDA.l InvertedMode : BEQ +
LDA InvertedMode : BEQ +
JMP SetDeathWorldChecked_Inverted
+
LDA.b IndoorsFlag : BEQ .outdoors
LDA.w DungeonID : CMP.b #$FF : BNE .dungeon
LDA.b RoomIndex : ORA.b RoomIndex+1 : BNE ++
LDA.l GanonPyramidRespawn : BNE .pyramid ; if flag is set, force respawn at pyramid on death to ganon
LDA $1B : BEQ .outdoors
LDA $040C : CMP #$FF : BNE .dungeon
LDA $A0 : ORA $A1 : BNE ++
LDA GanonPyramidRespawn : BNE .pyramid ; if flag is set, force respawn at pyramid on death to ganon
++
.outdoors
JMP DoWorldFix
.dungeon
LDA.l Bugfix_PreAgaDWDungeonDeathToFakeDW : BNE .done ; if the bugfix is enabled, we do nothing on death in dungeon
LDA Bugfix_PreAgaDWDungeonDeathToFakeDW : BNE .done ; if the bugfix is enabled, we do nothing on death in dungeon
JMP DoWorldFix_skip_mirror_check
.pyramid
LDA.b #$40 : STA.l CurrentWorld ; set flag to dark world
LDA.l FollowerIndicator : CMP.b #$08 : BNE .done : DEC : STA.l FollowerIndicator : + ; convert dwarf to frog
LDA #$40 : STA CurrentWorld ; set flag to dark world
LDA FollowerIndicator : CMP #$08 : BNE .done : DEC : STA FollowerIndicator : + ; convert dwarf to frog
.done
RTL
;================================================================================
DoWorldFix_Inverted:
LDA FollowerIndicator : CMP #$04 : BEQ .aga1Alive ; if old man following, skip mirror/aga check
LDA.l Bugfix_MirrorlessSQToLW : BEQ .skip_mirror_check
LDA.l FollowerIndicator : CMP.b #$04 : BEQ .setDarkWorld ; check if old man is following
LDA.l MirrorEquipment : BEQ .setDarkWorld ; check if we have the mirror
LDA.l MirrorEquipment : AND #$02 : BEQ .noMirror ; check if we have the mirror
.skip_mirror_check ; alt entrance point
LDA.l ProgressIndicator : CMP.b #$03 : BCS .done ; check if agahnim 1 is alive
.setDarkWorld
LDA.b #$40 : STA.l CurrentWorld ; set flag to dark world
LDA.l FollowerIndicator
CMP.b #$07 : BEQ .clear ; clear frog
CMP.b #$08 : BEQ .clear ; clear dwarf - consider flute implications
BRA .done
.clear
LDA.b #$00 : STA.l FollowerIndicator ; clear follower
LDA ProgressIndicator : CMP.b #$03 : BCS .done ; check if agahnim 1 is alive
.noMirror
.aga1Alive
LDA #$40 : STA CurrentWorld ; set flag to dark world
LDA.l SmithDeleteOnSave : BEQ .transform
LDA FollowerIndicator
CMP #$07 : BEQ .clear ; clear frog
CMP #$08 : BEQ .clear ; clear dwarf - consider flute implications
BRA .done
.clear
LDA.b #$00 : STA FollowerIndicator : BRA .done ; clear follower
.transform
LDA FollowerIndicator : CMP #$07 : BNE .done : INC : STA FollowerIndicator ; convert frog to dwarf
.done
RTL
;--------------------------------------------------------------------------------
SetDeathWorldChecked_Inverted:
LDA.b IndoorsFlag : BEQ .outdoors
LDA.w DungeonID : CMP.b #$FF : BNE .dungeon
LDA.b RoomIndex : ORA.b RoomIndex+1 : BNE ++
LDA.l GanonPyramidRespawn : BNE .castle ; if flag is set, force respawn at pyramid on death to ganon
LDA $1B : BEQ .outdoors
LDA $040C : CMP #$FF : BNE .dungeon
LDA $A0 : ORA $A1 : BNE ++
LDA GanonPyramidRespawn : BNE .castle ; if flag is set, force respawn at pyramid on death to ganon
++
.outdoors
JMP DoWorldFix
JMP DoWorldFix_Inverted
.dungeon
LDA.l Bugfix_PreAgaDWDungeonDeathToFakeDW : BNE .done ; if the bugfix is enabled, we do nothing on death in dungeon
LDA Bugfix_PreAgaDWDungeonDeathToFakeDW : BNE .done ; if the bugfix is enabled, we do nothing on death in dungeon
JMP DoWorldFix_Inverted_skip_mirror_check
.castle
LDA.b #$00 : STA.l CurrentWorld ; set flag to dark world
LDA.l FollowerIndicator : CMP.b #$07 : BNE + : LDA.b #$08 : STA.l FollowerIndicator : + ; convert frog to dwarf
LDA #$00 : STA CurrentWorld ; set flag to dark world
LDA FollowerIndicator : CMP #$07 : BNE + : LDA.b #$08 : STA FollowerIndicator : + ; convert frog to dwarf
.done
RTL
;================================================================================
@@ -85,20 +97,22 @@ RTL
;--------------------------------------------------------------------------------
FakeWorldFix:
LDA.l FixFakeWorld : BEQ +
LDA.b OverworldIndex : AND.b #$40 : STA.l CurrentWorld
LDA FixFakeWorld : BEQ +
PHX
LDX $8A : LDA.l OWTileWorldAssoc, X : STA CurrentWorld
PLX
+
RTL
;--------------------------------------------------------------------------------
MasterSwordFollowerClear:
LDA.l FollowerIndicator
CMP.b #$0E : BNE .exit ; clear master sword follower
LDA.b #$00 : STA.l FollowerIndicator ; clear follower
LDA FollowerIndicator
CMP #$0E : BNE .exit ; clear master sword follower
LDA.b #$00 : STA FollowerIndicator ; clear follower
.exit
RTL
;--------------------------------------------------------------------------------
FixAgahnimFollowers:
LDA.b #$00 : STA.l FollowerIndicator ; clear follower
LDA.b #$00 : STA FollowerIndicator ; clear follower
JML PrepDungeonExit ; thing we wrote over
;--------------------------------------------------------------------------------
@@ -108,10 +122,10 @@ macro SetMinimum(base,filler,compare)
?done:
endmacro
RefreshRainAmmo:
LDA.l ProgressIndicator : CMP.b #$01 : BEQ .rain ; check if we're in rain state
LDA ProgressIndicator : CMP.b #$01 : BEQ .rain ; check if we're in rain state
RTL
.rain
LDA.l StartingEntrance
LDA StartingEntrance
+ CMP.b #$03 : BNE + ; Uncle
%SetMinimum(CurrentMagic,MagicFiller,RainDeathRefillMagic_Uncle)
%SetMinimum(BombsEquipment,BombsFiller,RainDeathRefillBombs_Uncle)
@@ -131,29 +145,30 @@ RefreshRainAmmo:
RTL
;--------------------------------------------------------------------------------
SetEscapeAssist:
LDA.l ProgressIndicator : CMP.b #$01 : BNE .no_train ; check if we're in rain state
LDA ProgressIndicator : CMP.b #$01 : BNE .no_train ; check if we're in rain state
.rain
LDA.l EscapeAssist
BIT.b #$04 : BEQ + : STA.l InfiniteArrows : +
BIT.b #$02 : BEQ + : STA.l InfiniteBombs : +
BIT.b #$01 : BEQ + : STA.l InfiniteArrows : +
BIT.b #$04 : BEQ + : STA InfiniteMagicModifier : +
BIT.b #$02 : BEQ + : STA InfiniteBombsModifier : +
BIT.b #$01 : BEQ + : STA InfiniteArrowsModifier : +
BRA ++
.no_train ; choo choo
LDA.l EscapeAssist : BIT.b #$04 : BEQ + : LDA.b #$00 : STA.l InfiniteMagic : +
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 EscapeAssist
BIT.b #$40 : BEQ + : STA InfiniteMagicModifier : +
BIT.b #$20 : BEQ + : STA InfiniteBombsModifier : +
BIT.b #$10 : BEQ + : STA InfiniteArrowsModifier : +
++
LDA.l SpecialWeapons : CMP #$01 : BNE +
LDA.l SpecialWeaponLevel : BEQ +
LDA #$01 : STA InfiniteBombs
LDA #$01 : STA InfiniteBombsModifier
+
RTL
;--------------------------------------------------------------------------------
SetSilverBowMode:
LDA.l SilverArrowsUseRestriction : BEQ + ; fix bow type for restricted arrow mode
LDA.l BowEquipment : CMP.b #$3 : BCC +
SBC.b #$02 : STA.l BowEquipment
LDA SilverArrowsUseRestriction : BEQ + ; fix bow type for restricted arrow mode
LDA BowEquipment : CMP.b #$3 : BCC +
SBC.b #$02 : STA BowEquipment
+
RTL
;================================================================================

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

View File

@@ -1,10 +1,13 @@
!CryptoBuffer = "$7F5100"
;!keyBase = "$7F50D0"
;--------------------------------------------------------------------------------
LoadStaticDecryptionKey:
PHB : PHA : PHX : PHY : PHP
REP #$30 ; set 16-bit accumulator & index registers
LDX.w #StaticDecryptionKey ; Source
LDY.w #KeyBase ; Target
LDY.w #!keyBase ; Target
LDA.w #$000F ; Length
MVN $307F
@@ -20,63 +23,65 @@ RetrieveValueFromEncryptedTable:
;Returns result in A
PHX : PHY
PHA
LDY.b Scrap04 : PHY : LDY.b Scrap06 : PHY : LDY.b Scrap08 : PHY
LDY.b Scrap0A : PHY : LDY.b Scrap0C : PHY : LDY.b Scrap0E : PHY
LDY $04 : PHY : LDY $06 : PHY : LDY $08 : PHY
LDY $0A : PHY : LDY $0C : PHY : LDY $0E : PHY
AND.w #$FFF8 : TAY
LDA.b [$00], Y : STA.l CryptoBuffer : INY #2
LDA.b [$00], Y : STA.l CryptoBuffer+2 : INY #2
LDA.b [$00], Y : STA.l CryptoBuffer+4 : INY #2
LDA.b [$00], Y : STA.l CryptoBuffer+6
LDA [$00], Y : STA.l !CryptoBuffer : INY #2
LDA [$00], Y : STA.l !CryptoBuffer+2 : INY #2
LDA [$00], Y : STA.l !CryptoBuffer+4 : INY #2
LDA [$00], Y : STA.l !CryptoBuffer+6
LDA.w #$0002 : STA.b Scrap04 ;set block size
LDA.w #$0002 : STA $04 ;set block size
JSL.l XXTEA_Decode
PLA : STA.b Scrap0E : PLA : STA.b Scrap0C : PLA : STA.b Scrap0A
PLA : STA.b Scrap08 : PLA : STA.b Scrap06 : PLA : STA.b Scrap04
PLA : STA $0E : PLA : STA $0C : PLA : STA $0A
PLA : STA $08 : PLA : STA $06 : PLA : STA $04
PLA : AND.w #$0007 : TAX
LDA.l CryptoBuffer, X
LDA.l !CryptoBuffer, X
PHA
LDA.w #$0000
STA.l CryptoBuffer
STA.l CryptoBuffer+2
STA.l CryptoBuffer+4
STA.l CryptoBuffer+6
STA.l !CryptoBuffer
STA.l !CryptoBuffer+2
STA.l !CryptoBuffer+4
STA.l !CryptoBuffer+6
PLA
PLY : PLX
RTL
;--------------------------------------------------------------------------------
ChestData = $01E96C
ChestDataPayload = $01EABC ; ChestData+$0150
!ChestData = "$01E96C"
!ChestData_Payload = "$1EABC" ; !ChestData+$0150
;--------------------------------------------------------------------------------
GetChestData:
LDA.l IsEncrypted : BNE .encrypted
INC.b Scrap0E : LDX.w #$FFFD ; what we wrote over
INC $0E : LDX.w #$FFFD ; what we wrote over
JML.l Dungeon_OpenKeyedObject_nextChest
.encrypted
INC.b Scrap0E : LDX.w #$FFFE
INC $0E : LDX.w #$FFFE
.nextChest
INX #2 : CPX.w #$0150 : BEQ .couldntFindChest
LDA.l ChestData, X : AND.w #$7FFF : CMP.b RoomIndex : BNE .nextChest
LDA !ChestData, X : AND.w #$7FFF : CMP $A0 : BNE .nextChest
DEC.b Scrap0E : BNE .nextChest
DEC $0E : BNE .nextChest
LDA.b Scrap00 : PHA : LDA.b Scrap02 : PHA
LDA $00 : PHA : LDA $02 : PHA
LDA.w #ChestDataPayload : STA.b Scrap00
LDA.w #ChestDataPayload>>16 : STA.b Scrap02
LDA.w #!ChestData_Payload : STA $00
LDA.w #!ChestData_Payload>>16 : STA $02
TXA : LSR
JSL RetrieveValueFromEncryptedTable
STA.b Scrap0C
STA $0C
PLA : STA.b Scrap02 : PLA : STA.b Scrap00
PLA : STA $02 : PLA : STA $00
LDA.l ChestData, X : ASL A : BCC .smallChest
LDA !ChestData, X : ASL A : BCC .smallChest
JML.l Dungeon_OpenKeyedObject_bigChest ;(bank01.asm line #13783)

View File

@@ -2,138 +2,200 @@
; Dialog Pointer Override
;--------------------------------------------------------------------------------
DialogOverride:
LDA.l AltTextFlag : BEQ .skip
LDA.l DialogBuffer, X ; use alternate buffer
LDA $7F5035 : BEQ .skip
LDA $7F5700, X ; use alternate buffer
RTL
.skip
LDA.l DecompressionBuffer+$1200, X
LDA $7F1200, X
RTL
;--------------------------------------------------------------------------------
; $7F5035 - Alternate Text Pointer Flag ; 0=Disable
; $7F5036 - Padding Byte (Must be Zero)
; $7F5700 - $7F57FF - Dialog Buffer
;--------------------------------------------------------------------------------
ResetDialogPointer:
STZ.w TextID : STZ.w TextID+1 ; reset decompression buffer
LDA.b #$00 : STA.l AltTextFlag ; zero out the alternate flag
LDA.b #$1C : STA.w DelayTimer ; thing we wrote over
STZ $1CF0 : STZ $1CF1 ; reset decompression buffer
LDA.b #$00 : STA $7F5035 ; zero out the alternate flag
LDA.b #$1C : STA $1CE9 ; thing we wrote over
RTL
;--------------------------------------------------------------------------------
;macro LoadDialog(index,table)
; PHA : PHX : PHY
; PHB : PHK : PLB
; LDA $00 : PHA
; LDA $01 : PHA
; LDA $02 : PHA
; LDA.b #$01 : STA $7F5035 ; set flag
;
; LDA <index> : ASL : !ADD.l <index> : TAX ; get quote offset *3, move to X
; LDA <table>, X : STA $00 ; write pointer to direct page
; LDA <table>+1, X : STA $01
; LDA <table>+2, X : STA $02
;
; LDX.b #$00 : LDY.b #$00
; -
; LDA [$00], Y ; load the next character from the pointer
; STA $7F5700, X ; write to the buffer
; INX : INY
; CMP.b #$7F : BNE -
; PLA : STA $02
; PLA : STA $01
; PLA : STA $00
; PLB
; PLY : PLX : PLA
;endmacro
;--------------------------------------------------------------------------------
;macro LoadDialogAddress(address)
; PHA : PHX : PHY
; PHP
; PHB : PHK : PLB
; SEP #$30 ; set 8-bit accumulator and index registers
; LDA $00 : PHA
; LDA $01 : PHA
; LDA $02 : PHA
; LDA.b #$01 : STA $7F5035 ; set flag
;
; LDA.b #<address> : STA $00 ; write pointer to direct page
; LDA.b #<address>>>8 : STA $01
; LDA.b #<address>>>16 : STA $02
;
; LDX.b #$00 : LDY.b #$00
; -
; LDA [$00], Y ; load the next character from the pointer
; STA $7F5700, X ; write to the buffer
; INX : INY
; CMP.b #$7F : BNE -
; PLA : STA $02
; PLA : STA $01
; PLA : STA $00
; PLB
; PLP
; PLY : PLX : PLA
;endmacro
;--------------------------------------------------------------------------------
!OFFSET_POINTER = "$7F5094"
!OFFSET_RETURN = "$7F5096"
!DIALOG_BUFFER = "$7F5700"
macro LoadDialogAddress(address)
PHA : PHX : PHY
PHP
PHB : PHK : PLB
SEP #$20 ; set 8-bit accumulator
REP #$10 ; set 16-bit index registers
PEI.b ($00)
LDA.b Scrap02 : PHA
STZ.w TextID : STZ.w TextID+1 ; reset decompression buffer
LDA.b #$01 : STA.l AltTextFlag ; set flag
PEI ($00)
LDA $02 : PHA
STZ $1CF0 : STZ $1CF1 ; reset decompression buffer
LDA.b #$01 : STA $7F5035 ; set flag
%CopyDialog(<address>)
PLA : STA.b Scrap02
PLA : STA $02
REP #$20
PLA : STA.b Scrap00
PLA : STA $00
PLB
PLP
PLY : PLX : PLA
endmacro
;--------------------------------------------------------------------------------
macro CopyDialog(address)
LDA.b #<address> : STA.b Scrap00 ; write pointer to direct page
LDA.b #<address>>>8 : STA.b Scrap01
LDA.b #<address>>>16 : STA.b Scrap02
LDA.b #<address> : STA $00 ; write pointer to direct page
LDA.b #<address>>>8 : STA $01
LDA.b #<address>>>16 : STA $02
%CopyDialogIndirect()
endmacro
;--------------------------------------------------------------------------------
macro CopyDialogIndirect()
REP #$20 : LDA.l DialogOffsetPointer : TAX : LDY.w #$0000 : SEP #$20 ; copy 2-byte offset pointer to X and set Y to 0
REP #$20 : LDA !OFFSET_POINTER : TAX : LDY.w #$0000 : SEP #$20 ; copy 2-byte offset pointer to X and set Y to 0
?loop:
LDA.b [$00], Y ; load the next character from the pointer
STA.l DialogBuffer, X ; write to the buffer
LDA [$00], Y ; load the next character from the pointer
STA !DIALOG_BUFFER, X ; write to the buffer
INX : INY
CMP.b #$7F : BNE ?loop
REP #$20 ; set 16-bit accumulator
TXA : INC : STA.l DialogReturnPointer ; copy out X into
LDA.w #$0000 : STA.l DialogOffsetPointer
TXA : INC : STA !OFFSET_RETURN ; copy out X into
LDA.w #$0000 : STA !OFFSET_POINTER
SEP #$20 ; set 8-bit accumulator
endmacro
;--------------------------------------------------------------------------------
LoadDialogAddressIndirect:
STZ.w TextID : STZ.w TextID+1 ; reset decompression buffer
LDA.b #$01 : STA.l AltTextFlag ; set flag
STZ $1CF0 : STZ $1CF1 ; reset decompression buffer
LDA.b #$01 : STA $7F5035 ; set flag
%CopyDialogIndirect()
;%LoadDialogAddress(UncleText)
RTL
;--------------------------------------------------------------------------------
!ITEM_TEMPORARY = "$7F5040"
FreeDungeonItemNotice:
STA.w ScratchBufferV
STA !ITEM_TEMPORARY
PHA : PHX : PHY
PHP
PHB : PHK : PLB
SEP #$20 ; set 8-bit accumulator
REP #$10 ; set 16-bit index registers
PEI.b (Scrap00)
LDA.b Scrap02 : PHA
LDA.w ScratchBufferNV : PHA
LDA.w ScratchBufferNV+1 : PHA
PHA : PHX : PHY
PHP
PHB : PHK : PLB
SEP #$20 ; set 8-bit accumulator
REP #$10 ; set 16-bit index registers
PEI ($00)
LDA $02 : PHA
;--------------------------------
LDA.l FreeItemText : BNE + : JMP .skip : +
LDA.b #$00 : STA.w ScratchBufferNV ; initialize scratch
LDA #$00 : STA $7F5010 ; 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 !ITEM_TEMPORARY : CMP.b #$24 : BNE + ; general small key
%CopyDialog(Notice_SmallKeyOf)
LDA.l DialogReturnPointer : DEC #2 : STA.l DialogOffsetPointer
LDA !OFFSET_RETURN : DEC #2 : STA !OFFSET_POINTER
%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 !ITEM_TEMPORARY : CMP.b #$25 : BNE + ; general compass
%CopyDialog(Notice_CompassOf)
LDA.l DialogReturnPointer : DEC #2 : STA.l DialogOffsetPointer
LDA !OFFSET_RETURN : DEC #2 : STA !OFFSET_POINTER
%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 !ITEM_TEMPORARY : CMP.b #$33 : BNE + ; general map
%CopyDialog(Notice_MapOf)
LDA.l DialogReturnPointer : DEC #2 : STA.l DialogOffsetPointer
LDA !OFFSET_RETURN : DEC #2 : STA !OFFSET_POINTER
%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 !ITEM_TEMPORARY : CMP.b #$32 : BNE + ; general big key
%CopyDialog(Notice_BigKeyOf)
LDA.l DialogReturnPointer : DEC #2 : STA.l DialogOffsetPointer
LDA !OFFSET_RETURN : DEC #2 : STA !OFFSET_POINTER
%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 !ITEM_TEMPORARY : AND.b #$F0 ; looking at high bits only
CMP.b #$70 : BNE + ; map of...
%CopyDialog(Notice_MapOf)
JMP .dungeon
+ : LDA.l FreeItemText : AND.b #$02 : BEQ + ; show message for dungeon compass
LDA.w ScratchBufferV : AND.b #$F0 : CMP.b #$80 : BNE + ; compass of...
LDA !ITEM_TEMPORARY : 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 !ITEM_TEMPORARY : AND.b #$F0 : CMP.b #$90 : BNE + ; big key of...
%CopyDialog(Notice_BigKeyOf)
BRA .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 !ITEM_TEMPORARY : AND.b #$F0 : CMP.b #$A0 : BNE + ; small key of...
LDA !ITEM_TEMPORARY : CMP.b #$AF : BNE ++ : JMP .skip : ++
%CopyDialog(Notice_SmallKeyOf)
LDA.b #$01 : STA.w ScratchBufferNV ; set up a flip for small keys
PLA : AND.b #$0F : STA $7F5020 : LDA.b #$0F : !SUB $7F5020 : PHA
LDA #$01 : STA $7F5010 ; set up a flip for small keys
BRA .dungeon
+
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
LDA !OFFSET_RETURN : DEC #2 : STA !OFFSET_POINTER
LDA !ITEM_TEMPORARY
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
STA $7F5011
LDA $7F5010 : BEQ +
LDA $7F5010
LDA #$0F : !SUB $7F5011 : STA $7F5011 ; flip the values for small keys
+
LDA.w ScratchBufferNV+1
LDA $7F5011
CMP.b #$00 : BNE + ; ...light world
%CopyDialog(Notice_LightWorld) : JMP .done
+ : CMP.b #$01 : BNE + ; ...dark world
@@ -169,31 +231,30 @@ FreeDungeonItemNotice:
+
.done
STZ.w TextID : STZ.w TextID+1 ; reset decompression buffer
LDA.b #$01 : STA.l AltTextFlag ; set alternate dialog flag
STA.l TextBoxDefer
STZ $1CF0 : STZ $1CF1 ; reset decompression buffer
LDA.b #$01 : STA $7F5035 ; set alternate dialog flag
STA $7F509F
;--------------------------------
.skip
PLA : STA.w ScratchBufferNV+1
PLA : STA.w ScratchBufferNV
PLA : STA.b Scrap02
REP #$20
PLA : STA.b Scrap00
PLB
PLP
PLY : PLX : PLA
PLA : STA $02
REP #$20
PLA : STA $00
PLB
PLP
PLY : PLX : PLA
;JSL.l Main_ShowTextMessage_Alt ; .skip can be here so long as this line remains commented out
RTL
;--------------------------------------------------------------------------------
DialogResetSelectionIndex:
JSL.l Attract_DecompressStoryGfx ; what we wrote over
STZ.w MessageCursor
STZ $1CE8
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 #$98 : BCC ++ ;if the item is $4C or greater it must be a rando item
.nomessage
LDA.w #$FFFF
@@ -206,14 +267,10 @@ RTL
;--------------------------------------------------------------------------------
DialogFairyThrow:
LDA.l Restrict_Ponds : BEQ .normal
LDA.l BottleContentsOne
ORA.l BottleContentsTwo
ORA.l BottleContentsThree
ORA.l BottleContentsFour
BNE .normal
LDA BottleContentsOne
ORA BottleContentsTwo : ORA BottleContentsThree : ORA BottleContentsFour : BNE .normal
.noInventory
LDA.w SpriteActivity, X : !ADD #$08 : STA.w SpriteActivity, X
LDA $0D80, X : !ADD #$08 : STA $0D80, X
LDA.b #$51
LDY.b #$01
RTL
@@ -227,11 +284,8 @@ DialogGanon1:
REP #$20
LDA.w #$018C
BCC +
JSL CheckMushroom
LDA.w #$016D
BCC +
LDA.w #$0197
+ STA.w TextID
+ STA $1CF0
SEP #$20
JSL.l Sprite_ShowMessageMinimal_Alt
RTL
@@ -250,10 +304,6 @@ DialogGanon2:
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
@@ -286,7 +336,7 @@ DialogGanon2:
LDA.w #$0195 : BRA .done
.bombs
LDA.l BombsEquipment : AND #$00FF : BNE +
LDA.l InfiniteBombs : AND #$00FF : BNE + ; check for infinite bombs
LDA.l InfiniteBombsModifier : AND #$00FF : BNE + ; check for infinite bombs
LDA.w #$0192 : BRA .done
+
LDA.w #$0195 : BRA .done
@@ -304,18 +354,18 @@ DialogGanon2:
+
LDA.w #$0195 : BRA .done
.done
STA.w TextID
STA $1CF0
SEP #$20
JSL.l Sprite_ShowMessageMinimal_Alt
RTL
;--------------------------------------------------------------------------------
DialogEtherTablet:
PHA
LDA.w ItemCursor : CMP.b #$0F : BEQ + ; Show normal text if book is not equipped
LDA $0202 : CMP.b #$0F : BEQ + ; Show normal text if book is not equipped
-
PLA : JML Sprite_ShowMessageUnconditional ; Wacky Hylian Text
+
BIT.b Joy1A_New : BVC - ; Show normal text if Y is not pressed
BIT $F4 : BVC - ; Show normal text if Y is not pressed
JSL CheckTabletSword : BMI .yesText
CMP.b #$02 : !BGE .noText
.yesText
@@ -330,11 +380,11 @@ RTL
;--------------------------------------------------------------------------------
DialogBombosTablet:
PHA
LDA.w ItemCursor : CMP.b #$0F : BEQ + ; Show normal text if book is not equipped
LDA $0202 : CMP.b #$0F : BEQ + ; Show normal text if book is not equipped
-
PLA : JML Sprite_ShowMessageUnconditional ; Wacky Hylian Text
+
BIT.b Joy1A_New : BVC - ; Show normal text if Y is not pressed
BIT $F4 : BVC - ; Show normal text if Y is not pressed
JSL CheckTabletSword : BMI .yesText
CMP.b #$02 : !BGE .noText
.yesText
@@ -348,7 +398,7 @@ DialogBombosTablet:
RTL
;--------------------------------------------------------------------------------
DialogSahasrahla:
LDA.l PendantsField : AND.b #$04 : BEQ + ;Check if player has green pendant
LDA.l PendantsField : AND #$04 : BEQ + ;Check if player has green pendant
LDA.b #$2F
LDY.b #$00
JML Sprite_ShowMessageUnconditional
@@ -357,7 +407,7 @@ RTL
;--------------------------------------------------------------------------------
DialogBombShopGuy:
LDY.b #$15
LDA.l CrystalsField : AND.b #$05 : CMP.b #$05 : BNE + ;Check if player has crystals 5 & 6
LDA.l CrystalsField : AND #$05 : CMP #$05 : BNE + ;Check if player has crystals 5 & 6
INY ; from 15 to 16
+
TYA
@@ -375,54 +425,54 @@ AgahnimAsksAboutPed:
BNE .vanilla
LDA.b #$8C ; message 018C for no ped
STA.w TextID
STA.w $1CF0
.vanilla
JML $05FA8E ; Sprite_ShowMessageMinimal
;--------------------------------------------------------------------------------
Main_ShowTextMessage_Alt:
; Are we in text mode? If so then end the routine.
LDA.b GameMode : CMP.b #$0E : BEQ .already_in_text_mode
LDA $10 : CMP.b #$0E : BEQ .already_in_text_mode
Sprite_ShowMessageMinimal_Alt:
STZ.b GameSubMode
STZ $11
PHX : PHY
PEI.b (Scrap00)
LDA.b Scrap02 : PHA
PEI ($00)
LDA.b $02 : PHA
LDA.b #$1C : STA.b Scrap02
LDA.b #$1C : STA.b $02
REP #$30
LDA.w TextID : ASL : TAX
LDA.w $1CF0 : ASL : TAX
LDA.l $7F71C0, X
STA.b Scrap00
STA.b $00
SEP #$30
LDY.b #$00
LDA.b [Scrap00], Y : CMP.b #$FE : BNE +
INY : LDA.b [Scrap00], Y : CMP.b #$6E : BNE +
INY : LDA.b [Scrap00], Y : : BNE +
INY : LDA.b [Scrap00], Y : CMP.b #$FE : BNE +
INY : LDA.b [Scrap00], Y : CMP.b #$6B : BNE +
INY : LDA.b [Scrap00], Y : CMP.b #$04 : BNE +
STZ.w MessageCursor
LDA [$00], Y : CMP.b #$FE : BNE +
INY : LDA [$00], Y : CMP.b #$6E : BNE +
INY : LDA [$00], Y : : BNE +
INY : LDA [$00], Y : CMP.b #$FE : BNE +
INY : LDA [$00], Y : CMP.b #$6B : BNE +
INY : LDA [$00], Y : CMP.b #$04 : BNE +
STZ $1CE8
JMP .end
+
STZ.w MessageJunk ; Otherwise set it so we are in text mode.
STZ.w MessageSubModule
STZ $0223 ; Otherwise set it so we are in text mode.
STZ $1CD8 ; Initialize the step in the submodule
; Go to text display mode (as opposed to maps, etc)
LDA.b #$02 : STA.b GameSubMode
LDA.b #$02 : STA $11
; Store the current module in the temporary location.
LDA.b GameMode : STA.w GameModeCache
LDA $10 : STA $010C
; Switch the main module ($10) to text mode.
LDA.b #$0E : STA.b GameMode
LDA.b #$0E : STA $10
.end
PLA : STA.b Scrap02
PLA : STA.b Scrap01
PLA : STA.b Scrap00
PLA : STA.b $02
PLA : STA.b $01
PLA : STA.b $00
PLY : PLX
Main_ShowTextMessage_Alt_already_in_text_mode:
@@ -434,15 +484,15 @@ CalculateSignIndex:
; 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
LDA $8A : ASL A : TAY ;what we wrote over
LDA.w OWScreenSize : BEQ .done ; If a small map, we can skip these calculations.
LDA $0712 : BEQ .done ; If a small map, we can skip these calculations.
LDA.b LinkPosY+1 : AND.w #$0002 : ASL #2 : EOR.b OverworldIndex : AND.w #$0008 : BEQ +
LDA $21 : AND.w #$0002 : ASL #2 : EOR $8A : AND.w #$0008 : BEQ +
TYA : !ADD.w #$0010 : TAY ;add 16 if we are in lower half of big screen.
+
LDA.b LinkPosX+1 : AND.w #$0002 : LSR : EOR.b OverworldIndex : AND.w #$0001 : BEQ +
LDA $23 : AND.w #$0002 : LSR : EOR $8A : AND.w #$0001 : BEQ +
TYA : INC #2 : TAY ;add 16 if we are in lower half of big screen.
+
; ensure even if things go horribly wrong, we don't read the sign out of bounds and crash:
@@ -451,112 +501,6 @@ CalculateSignIndex:
.done
RTL
;================================================================
; Contributor: Myramong
;================================================================
Sprite_ShowSolicitedMessageIfPlayerFacing_Alt:
{
STA.w TextID
STY.w TextID+1
JSL Sprite_CheckDamageToPlayerSameLayerLong : BCC .alpha
JSL Sprite_CheckIfPlayerPreoccupied : BCS .alpha
LDA.b Joy1B_New : BPL .alpha
LDA.w SpriteTimerE, X : BNE .alpha
LDA.b LinkJumping : CMP.b #$02 : BEQ .alpha
JSL Sprite_DirectionToFacePlayerLong : PHX : TYX
; Make sure that the sprite is facing towards the player, otherwise
; talking can't happen. (What sprites actually use this???)
LDA.l $05E1A3, X : PLX : CMP.b LinkDirection : BNE .not_facing_each_other
PHY
LDA.w TextID
LDY.w TextID+1
; Check what room we're in so we know which npc we're talking to
LDA.b RoomIndex
CMP.b #$05 : BEQ .SahasrahlaDialogs
CMP.b #$1C : BEQ .BombShopGuyDialog
BRA .SayNothing
.SahasrahlaDialogs
REP #$20 : LDA.l MapReveal_Sahasrahla : ORA.l MapOverlay : STA.l MapOverlay : SEP #$20
JSL DialogSahasrahla : BRA .SayNothing
.BombShopGuyDialog
REP #$20 : LDA.l MapReveal_BombShop : ORA.l MapOverlay : STA.l MapOverlay : SEP #$20
JSL DialogBombShopGuy
.SayNothing
LDA.b #$40 : STA.w SpriteTimerE, X
PLA : EOR.b #$03
SEC
RTL
.not_facing_each_other
.alpha
LDA.w SpriteMoveDirection, X
CLC
RTL
}
;================================================================
Sprite_ShowSolicitedMessageIfPlayerFacing_PreserveMessage:
{
PHY
PHA
JSL Sprite_CheckDamageToPlayerSameLayerLong : BCC .alpha
JSL Sprite_CheckIfPlayerPreoccupied : BCS .alpha
LDA.b Joy1B_New : BPL .alpha
LDA.w SpriteTimerE, X : BNE .alpha
LDA.b LinkJumping : CMP.b #$02 : BEQ .alpha
JSL Sprite_DirectionToFacePlayerLong : PHX : TYX
; Make sure that the sprite is facing towards the player, otherwise
; talking can't happen. (What sprites actually use this???)
LDA.l $05E1A3, X : PLX : CMP.b LinkDirection : BNE .not_facing_each_other
PLA : XBA : PLA
PHY
TAY : XBA
JSL Sprite_ShowMessageUnconditional
LDA.b #$40 : STA.w SpriteTimerE, X
PLA : EOR.b #$03
SEC
RTL
.not_facing_each_other
.alpha
PLY
PLA
LDA.w SpriteMoveDirection, X
CLC
RTL
}
;--------------------------------------------------------------------------------
; A0 - A9 - 0 - 9
; AA - C3 - A - Z

View File

@@ -7,8 +7,8 @@
;--------------------------------------------------------------------------------
StoreLastOverworldDoorID:
TXA : INC
STA.l PreviousOverworldDoor
LDA.l $1BBB73, X : STA.w EntranceIndex
STA $7F5099
LDA $1BBB73, X : STA $010E
RTL
;--------------------------------------------------------------------------------
@@ -16,14 +16,14 @@ RTL
; CacheDoorFrameData
;--------------------------------------------------------------------------------
CacheDoorFrameData:
LDA.l PreviousOverworldDoor : BEQ .originalBehaviour
LDA $7F5099 : BEQ .originalBehaviour
DEC : ASL : TAX
LDA.l EntranceDoorFrameTable, X : STA.w TileMapEntranceDoors
LDA.l EntranceAltDoorFrameTable, X : STA.w TileMapTile32
LDA EntranceDoorFrameTable, X : STA $0696
LDA EntranceAltDoorFrameTable, X : STA $0698
BRA .done
.originalBehaviour
LDA.w $D724, X : STA.w TileMapEntranceDoors
STZ.w TileMapTile32
LDA $D724, X : STA $0696
STZ $0698
.done
RTL
;--------------------------------------------------------------------------------
@@ -32,8 +32,46 @@ RTL
; WalkDownIntoTavern
;--------------------------------------------------------------------------------
WalkDownIntoTavern:
LDA.l PreviousOverworldDoor
LDA $7F5099
; tavern door has index 0x42 (saved off value is incremented by one)
CMP.b #$43
CMP #$43
RTL
;--------------------------------------------------------------------------------
;--------------------------------------------------------------------------------
; TurnAroundOnUnderworld
;--------------------------------------------------------------------------------
TurnAroundOnUnderworld:
LDA $26 : BEQ .done
; turn around if ($010E == #$43) != ($7F5099 == #$43)
LDX #$00
LDA #$43 : CMP $010E : BEQ +
INX
+
CMP $7F5099 : BEQ +
DEX
+
CPX #$00 : BEQ .done
LDA $26 : EOR #$0C : STA $26
.done
JML $0FFD65 ; what we overwrote
;--------------------------------------------------------------------------------
; TurnUpOnOverworld
;--------------------------------------------------------------------------------
TurnUpOnOverworld:
LDA.l EntranceTavernBack : CMP #$43 : BEQ .done
LDA #$08 : STA $26 ; only fix this glitch if exit not vanilla
.done
JML $07E68F ; what we overwrote
;--------------------------------------------------------------------------------
; WalkUpOnOverworld
;--------------------------------------------------------------------------------
WalkUpOnOverworld:
LDA $20 : CMP #$091B : BNE .normal ; hardcoded Y coordinate
STZ $2F
RTL
.normal
LDA #$0002 : STA $2F ; what we overwrote
RTL

59
doorrando/doorrando.asm Normal file
View File

@@ -0,0 +1,59 @@
!add = "clc : adc"
!addl = "clc : adc.l"
!sub = "sec : sbc"
!bge = "bcs"
!blt = "bcc"
; Free RAM notes
; Normal doors use $AB-AC for scrolling indicator
; Normal doors use $FE to store the trap door indicator
; Normal doors use $045e to store Y coordinate when transitioning to in-room stairs
; Normal doors use $045f to determine the order in which supertile quadrants are drawn
; Straight stairs use $046d to store X coordinate on animation start
; Spiral doors use $045e to store stair type
; Gfx uses $b1 to for sub-sub-sub-module thing
; Hooks into various routines
incsrc drhooks.asm
;Main Code
org $A78000 ;138000
db $44, $52 ;DR
DRMode:
dw 0
; xxpg rmse
; xxxx xBDM
; x - unused
; p - use the original palette for the dungeon rooms instead of the DR table
; g - fix the EG glitch in more places (should be off for no logic)
; r - The collection rate flag
; m - Whether to display keys Map Info
; s - Start with Mirror Scroll
; e - GT minibosses marked as defeated instead of spawning heart container in all dungeons
; B - Big Key doors can displayed and be opened on the "south" side in addition
; D - Enabled spawning as a bunny in the Dark World underworld
; M - hides the total number in the collection rate
DRFlags:
dw 0
DRScroll:
db 0
OffsetTable:
dw -8, 8
incsrc normal.asm
incsrc scroll.asm
incsrc spiral.asm
incsrc gfx.asm
incsrc keydoors.asm
incsrc overrides.asm
incsrc edges.asm
incsrc math.asm
incsrc hudadditions.asm
incsrc dr_lobby.asm
incsrc entrance_fixes.asm
warnpc $A79C00
incsrc doortables.asm
warnpc $A88000

696
doorrando/doortables.asm Normal file
View File

@@ -0,0 +1,696 @@
org $A79C00
KeyDoorOffset:
; 0 1 2 3 4 5 6 7 8 9 a b c d e f --Offset Ruler
dw $0000,$0001,$0003,$0000,$0006,$0000,$000b,$0000,$0000,$0000,$000c,$000d,$0010,$0011,$0012,$0000
dw $0000,$0015,$0018,$001c,$001e,$0025,$0027,$0000,$0000,$002b,$002d,$0033,$0035,$0038,$0039,$003d
dw $003f,$0040,$0043,$0045,$0047,$0000,$004f,$0000,$0053,$0000,$0055,$005b,$0000,$0000,$005f,$0000
dw $0060,$0062,$0064,$0065,$0066,$0068,$006e,$0074,$007a,$007c,$007e,$0081,$0000,$0082,$0086,$0088
dw $0089,$008a,$0000,$008b,$008e,$0092,$0096,$0000,$0000,$0099,$009d,$00a2,$00a5,$00a6,$00a8,$00aa
dw $00ab,$00ad,$00af,$00b2,$0000,$0000,$00b5,$00b9,$00bf,$00c5,$00c9,$00ca,$00cc,$00ce,$00d1,$00d5
dw $00d6,$00dc,$00e3,$00e9,$00ec,$00ed,$00ee,$00f2,$00f5,$0000,$00f7,$00f8,$00fc,$00ff,$0102,$0000
dw $0000,$0103,$0106,$0107,$010a,$010c,$010e,$0112,$0000,$0000,$0000,$0114,$0117,$011b,$011e,$0121
dw $0000,$0123,$0000,$0124,$0127,$0128,$0000,$012c,$0000,$0000,$0000,$012e,$0133,$0139,$013e,$0000
dw $013f,$0140,$0141,$0146,$0000,$0149,$014b,$014d,$014f,$0150,$0000,$0153,$0156,$015a,$015d,$0161
dw $0163,$0164,$0166,$016a,$016c,$016d,$0000,$0000,$0170,$0176,$017c,$0182,$0184,$0000,$0185,$0186
dw $0188,$018b,$018f,$0197,$019c,$019d,$019e,$01a3,$01a4,$01a6,$01aa,$01ad,$01b3,$0000,$01bb,$01be
dw $01bf,$01c2,$01ca,$01d2,$01d9,$01da,$01dd,$01e3,$01e6,$01e7,$0000,$01ec,$01ed,$0000,$01f0,$0000
dw $01f1,$01f3,$01f7,$0000,$0000,$01f8,$01fa,$0000,$01fd,$0200,$0203,$0204,$0206,$0000,$0000,$0000
dw $0207
org $A79E00
SpiralOffset:
; 0 1 2 3 4 5 6 7 8 9 a b c d e f --Offset Ruler
db $00,$01,$02,$00,$03,$00,$00,$04,$00,$05,$07,$00,$08,$00,$0b,$00
db $00,$0c,$00,$00,$00,$0d,$0e,$0f,$00,$00,$11,$00,$13,$14,$15,$00
db $00,$00,$00,$00,$00,$00,$16,$19,$1b,$00,$00,$00,$00,$00,$00,$00
db $00,$1c,$00,$00,$1f,$00,$00,$00,$20,$00,$21,$00,$00,$00,$00,$22
db $23,$24,$25,$00,$00,$26,$00,$00,$00,$00,$27,$00,$29,$2a,$2b,$00
db $00,$00,$00,$2c,$2d,$00,$00,$00,$00,$00,$00,$00,$2e,$2f,$00,$30
db $00,$00,$00,$35,$36,$00,$37,$00,$00,$00,$38,$3a,$3b,$00,$3c,$00
db $3d,$40,$41,$00,$00,$00,$42,$45,$00,$00,$00,$00,$00,$00,$00,$49
db $4a,$00,$00,$00,$00,$00,$00,$4b,$00,$00,$00,$00,$4f,$00,$53,$00
db $00,$54,$00,$55,$00,$00,$00,$56,$57,$58,$00,$00,$00,$00,$59,$00
db $5a,$00,$5b,$00,$00,$5c,$5d,$00,$00,$00,$00,$5e,$00,$00,$5f,$00
db $60,$00,$00,$00,$00,$63,$64,$00,$00,$00,$00,$00,$65,$00,$66,$00
db $67,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
db $6a,$6d,$6e,$00,$00,$00,$00,$00,$00,$00,$6f,$00,$00,$00,$00,$00
db $70
org $A79F00
DoorOffset:
db $00,$01,$02,$00,$03,$00,$04,$00,$00,$00,$00,$00,$9A,$05,$99,$00
db $00,$06,$07,$08,$09,$0A,$0B,$00,$00,$0C,$0D,$0E,$00,$0F,$10,$11
db $12,$13,$14,$15,$16,$00,$17,$00,$98,$00,$18,$19,$00,$00,$1A,$00
db $1B,$00,$1C,$1D,$1E,$1F,$20,$21,$22,$23,$24,$25,$00,$26,$27,$00
db $96,$28,$97,$29,$2A,$2B,$2C,$00,$00,$2D,$2E,$2F,$30,$31,$32,$00
db $33,$34,$35,$36,$00,$00,$37,$38,$39,$3A,$3B,$3C,$3D,$3E,$3F,$40
db $41,$42,$43,$A0,$00,$00,$44,$45,$46,$00,$47,$48,$49,$4A,$4B,$00
; 0 1 2 3 4 5 6 7 8 9 a b c d e f --Offset Ruler
db $00,$4C,$00,$00,$00,$4D,$4E,$9E,$00,$00,$00,$4F,$50,$51,$52,$53
db $00,$54,$00,$9C,$9D,$55,$00,$00,$00,$00,$00,$56,$57,$58,$59,$00
db $5A,$5B,$5C,$5D,$00,$5E,$5F,$00,$9B,$60,$00,$61,$62,$63,$64,$65
db $66,$67,$68,$69,$6A,$6B,$00,$00,$6C,$6D,$6E,$6F,$70,$00,$71,$72
db $00,$73,$74,$75,$76,$77,$78,$79,$7A,$7B,$7C,$7D,$7E,$00,$7F,$80
db $00,$81,$82,$83,$84,$85,$86,$87,$88,$89,$00,$8A,$8B,$00,$8C,$00
db $00,$8D,$8E,$00,$00,$8F,$90,$00,$91,$92,$93,$94,$95,$00,$00,$00
db $9f
org $A7A000
DoorTable:
;; NW 00 N 01 NE 02 WN 00 W 01 WS 02 SW 00 S 01 SE 02 EN 00 E 01 ES 02 - Door ruler
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Default/Garbage row
dw $0003, $0003, $0003, $0450, $0003, $0003, $0003, $0003, $0003, $0452, $0003, $0003 ; HC Back Hall (x01)
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Sewer Switches (x02)
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Crystaroller
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Arghus
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Aga 2
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Sewer Secret Room
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Sanc
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; TR Pokey
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; TR Lava Pipe
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; TR Pipes n Ledge
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Swap Canal
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Pod dark Maze
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Pod Bridge
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Pod Eye Statue
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; GT Pre Aga
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Ice Cross
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Ice BK
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; x20 Aga1
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Sewer Key Rat
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Sewer Waters
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; TR Eye Entrance
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; TR Chest Entrance
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Swamp Statue
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; PoD Arena (x2a)
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; PoD Statue (x2b)
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Ice Compass
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; x30 Aga's Altar
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Dark Cross
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Lanmolas
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Swamp West Wing
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Flooded Key
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Swamp Main Hub (x36)
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Swamp Hammer Time
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Swamp First Basement
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Drop to the Moth
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Pod 3 Catwalks
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Pod Conveyor
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; GT Minihelma
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Ice Conveyor
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Sewers
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Desert Torches
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; TT Big Chest
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; TT Cellblock
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Swamp Compass Loop
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Skull3 Torches
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Pod Entrance
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Pod Mimics 1
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; GT Conveyor Ice
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; GT Moldorm
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; IPBJ
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0401, $0003, $0003 ; HC West Hall (x50)
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; HC Throne Room (x51)
dw $0003, $0003, $0003, $0401, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; HC East Hall (x52)
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Desert Tiles 1
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Skull 2 Left Entrance
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Skull 2 Right Entrance
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Skull 1 Entrance
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Skull 3 Entrance
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Helmasaur
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; GT Spike Switch
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; GT Cannonball
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Gauntlet 1
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Ice Choice Cross
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Iced U
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; HC West Lobby (x60)
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; HC Main Lobby (x61)
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; HC East Lobby (x62)
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; x66 Swamp Waterfall
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; x67 Skull 1 Left Drop
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; x68 Skull 1 Pinball
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; x6a Pod Rupees
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; x6b GT Mimics
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; x6c GT Lanmolas
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; x6d Gauntlet 2
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; x6e Ice Gators
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; HC Armory
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Desert BK Chest
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Swamp Flooded Chests
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; GT DM's Tile
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; GT Randoroom
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; GT Warp Maze
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Ice Freezors
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Ice Hookpit
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; HC Catawalk
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Desert Right Entrance
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; GT Left
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; GT Hopeful Torch
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; GT Right
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Ice Lonely Freezor
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Vitreous (x90)
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Mire Rain
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Mire Dark Crystals
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Mire Blockswitch
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; GT Fallbridge
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; GT Torch Cross
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Eastern Darkness
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; GT Warp Maze 2
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; GT Invis Bridge
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; GT Compass Room
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Ice Big Chests
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Icy Pots
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Mire Pre-Vitreous (xa0)
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Mire Fishbone
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Mire Bridges
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Mire Corner
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Trinexx (xa4)
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; GT Wizzrobes
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Eastern Compass (xa8)
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Eastern Courtyard (xa9)
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Eastern Map (xaa)
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; TT Switch
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Blind
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Iced T
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Ice Slipway
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Mire Warpzone
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Mire ????
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Mire Spikes
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; TR Refill
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; TR Dark Maze
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; TR Chainchomp
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; TR Rollers
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Eastern Big Key
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Easter Cannonball
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Eastern Dark Circle
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; TT Hellway
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; TT Bossway
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Ice Blockswitch
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Ice Backtracker
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Mire Tiles
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Mire Main Hub
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Mire Big Chest
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; TR Switch Maze
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; TR Narrow
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; TR Early Hub
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; TR Floating Torches
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Armos
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Eastern Entrance
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; TT NW Quad
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; TT NE Quad
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Ice Boss Drop
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Mire BK
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Mire 2
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; TR Laser Bridge
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; TR Main Entrance
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Eastern Eyegores
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Eastern Attic Switches
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Eastern Attic Start
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; TT Entrance Quad
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; TT SE Quad
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Aga 6F
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Sewers Rope
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Swamp Lobby
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Ice Lobby
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; GT Lobby
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Mire Lobby
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Desert West Lobby
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Desert Main Lobby
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Hera Lobby
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Tower Lobby
dw $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003, $0003 ; Desert Back Lobby
; this should end at 27AF18 about (160 * 24 bytes = 3840 or F18)
; some values you can hardcode for spirals
;dw $0070, $36a0 ; ->HC Stairwell
;dw $0072, $4ff8 ; ->HC Map Room
;dw $0080, $1f50 ; ->zelda's cellblock
org $A7B000
SpiralTable: ;113 4 byte entries - should end at 27B1C4
dw $0203, $8080 ;null row
dw $0203, $8080 ;HC Backhallway
dw $0203, $8080 ;Sewer Pull
dw $0203, $8080 ;Crystaroller
dw $0203, $8080 ;Moldorm
dw $0203, $8080, $0203, $8080 ;Pod Basement
dw $0203, $8080 ;Pod Stalfos
dw $0203, $8080, $0203, $8080, $0203, $8080 ;GT Entrance
dw $0203, $8080 ;Ice Entrance
dw $0203, $8080 ;Escape
dw $0203, $8080 ;TR Pipe Ledge
dw $0203, $8080 ;Swamp Way
dw $0203, $8080, $0203, $8080 ;Hera Fallplace
dw $0203, $8080, $0203, $8080 ;PoD Bridge
dw $0203, $8080 ;GT Ice
dw $0203, $8080 ;GT F8
dw $0203, $8080 ;Ice Cross
dw $0203, $8080, $0203, $8080, $0203, $8080 ;Swamp Statue
dw $0203, $8080, $0203, $8080 ;Hera Big
dw $0203, $8080 ;Swamp Ent
dw $0203, $8080, $0203, $8080, $0203, $8080 ;Hera Startiles (middle value unused)
dw $0203, $8080 ;West Swamp
dw $0203, $8080 ;Swamp Basement
dw $0203, $8080 ;Pod Drops
dw $0203, $8080 ;Ice Hammer
dw $0203, $8080 ;Aga Guards
dw $0203, $8080 ;Sewer Begin
dw $0203, $8080 ;Sewer Rope
dw $0203, $8080 ;TT Cellblock
dw $0203, $8080, $0203, $8080 ;Pod Entrance
dw $0203, $8080 ;GT Icespike
dw $0203, $8080 ;GT Moldorm
dw $0203, $8080 ;IPBJ
dw $0203, $8080 ;Desert Prep
dw $0203, $8080 ;Swamp Attic
dw $0203, $8080 ;GT Cannonball
dw $0203, $8080 ;GT Gauntlet1
dw $0203, $8080, $0203, $8080, $0203, $8080, $0203, $8080, $0203, $8080 ;Ice U (1st three values unused)
dw $0203, $8080 ;Desert Back
dw $0203, $8080 ;TT Attic L
dw $0203, $8080 ;Swamp Waterf
dw $0203, $8080 ;Pod Rupees
dw $0203, $8080 ;Pod Rupees
dw $0203, $8080 ;GT Mimics
dw $0203, $8080 ;GT Lanmo
dw $0203, $8080 ;Ice Gators
dw $0203, $8080, $0203, $8080, $0203, $8080 ;HC Tiny (first value placeholder)
dw $0203, $8080 ;HC Boomer
dw $0203, $8080 ;HC Pits1
dw $0203, $8080, $0203, $8080, $0203, $8080 ;Swamp Sunken
dw $0203, $8080, $0203, $8080, $0203, $8080, $0203, $8080 ;Hera Entrance (first value unused)
dw $0203, $8080 ;Ice Hookshot
dw $0203, $8080 ;HC Cellblock
dw $0203, $8080, $0203, $8080, $0203, $8080, $0203, $8080 ;Hera Basement (first and third values unused)
dw $0203, $8080, $0203, $8080, $0203, $8080, $0203, $8080 ;GT Circle (third value unused)
dw $0203, $8080 ;Ice Last Freeze
dw $0203, $8080 ;Mire Drops
dw $0203, $8080 ;Mire Block
dw $0203, $8080 ;Mire Attic
dw $0203, $8080 ;Mire Entrance
dw $0203, $8080 ;East Dark
dw $0203, $8080 ;Ice Big
dw $0203, $8080 ;Mire Previtreous
dw $0203, $8080 ;Mire Bridges
dw $0203, $8080 ;GT Wizzrobes
dw $0203, $8080 ;GT Spikepit
dw $0203, $8080 ;TT Switch
dw $0203, $8080 ;Ice T
dw $0203, $8080, $0203, $8080, $0203, $8080 ;Tower Usains (2nd value unused)
dw $0203, $8080 ;TR PlatMaze
dw $0203, $8080 ;TR Chainchomp
dw $0203, $8080 ;TT Bossway
dw $0203, $8080 ;Ice FallZone
dw $0203, $8080, $0203, $8080, $0203, $8080 ;Tower Dark2 (2nd value unused)
dw $0203, $8080, $0203, $8080, $0203, $8080 ;Tower Dark1 (2nd value unused)
dw $0203, $8080 ;Mire BK Thang
dw $0203, $8080 ;Mire2
dw $0203, $8080 ;East Attic Start
dw $0203, $8080 ;Tower Entrance
org $A7C000 ;ends around 27C418
PairedDoorTable:
dw $0000 ; the bad template
dw $0000,$0000
dw $0000,$0000,$0000
dw $0000,$0000,$0000,$0000,$0000
dw $0000
dw $0000
dw $0000,$0000,$0000
dw $0000
dw $0000
dw $0000,$0000,$0000
dw $0000,$0000,$8021
dw $0000,$0000,$0000,$0000
dw $4014,$0000
dw $8024,$8013,$0000,$0000,$0000,$0000,$0000
dw $0000,$0000
dw $0000,$0000,$0000,$0000
dw $201a,$401a
dw $0000,$4019,$8019,$402a,$0000,$0000
dw $0000,$0000
dw $0000,$0000,$0000
dw $0000
dw $0000,$0000,$0000,$0000
dw $0000,$0000
dw $0000
dw $2011,$0000,$0000
dw $8032,$0000
dw $0000,$0000
dw $8014,$0000,$0000,$0000,$0000,$0000,$0000,$0000
dw $4036,$0000,$0000,$0000
dw $0000,$0000
dw $0000,$101a,$402b,$0000,$0000,$0000
dw $0000,$202a,$0000,$0000
dw $0000
dw $0000,$0000
dw $0000,$0000
dw $8022
dw $0000
dw $0000,$0000
dw $2036,$0000,$0000,$0000,$0000,$0000
dw $8037,$8026,$8035,$0000,$0000,$0000
dw $8036,$8038,$0000,$4038,$0000,$0000
dw $4037,$1037
dw $0000,$0000
dw $204a,$0000,$0000
dw $0000
dw $0000,$0000,$804d,$0000
dw $0000,$404e
dw $0000
dw $0000
dw $0000
dw $0000,$0000,$2053
dw $0000,$0000,$0000,$0000
dw $0000,$0000,$0000,$0000
dw $0000,$0000,$0000
dw $0000,$0000,$8059,$0000
dw $0000,$0000,$803a,$0000,$0000
dw $0000,$0000,$0000
dw $0000
dw $203d,$0000
dw $0000,$403e
dw $0000 ; this is the odd extra room - shouldn't be used
dw $0000,$0000
dw $0000,$0000
dw $0000,$0000,$0000
dw $0000,$0000,$2043
dw $0000,$0000,$0000,$0000
dw $0000,$0000,$4058,$0000,$0000,$0000
dw $0000,$2057,$4068,$0000,$0000,$0000
dw $2049,$0000,$0000,$0000
dw $0000
dw $806b,$0000
dw $0000,$0000
dw $0000,$0000,$0000
dw $805f,$0000,$0000,$0000
dw $805e
dw $0000,$0000,$0000,$0000,$0000,$0000
dw $0000,$0000,$0000,$0000,$0000,$0000,$0000
dw $0000,$0000,$0000,$0000,$0000,$0000
dw $0000,$0000,$0000
dw $0000
dw $0000
dw $0000,$0000,$0000,$0000
dw $0000,$0000,$0000
dw $0000,$2058
dw $0000
dw $805b,$0000,$0000,$0000
dw $0000,$0000,$0000
dw $0000,$0000,$0000
dw $0000
dw $0000,$0000,$0000
dw $0000
dw $0000,$0000,$0000
dw $0000,$0000
dw $0000,$0000
dw $0000,$0000,$0000,$0000
dw $0000,$0000
dw $0000,$207c,$0000
dw $0000,$407d,$407b,$0000
dw $0000,$407c,$0000
dw $808e,$0000,$0000
dw $0000,$0000
dw $0000
dw $0000,$0000,$0000
dw $0000
dw $0000,$0000,$0000,$0000
dw $0000,$0000
dw $0000,$0000,$0000,$0000,$0000
dw $0000,$0000,$0000,$0000,$0000,$0000
dw $0000,$0000,$0000,$0000,$0000
dw $807e
dw $0000
dw $0000
dw $0000,$0000,$0000,$0000,$0000
dw $0000,$0000,$0000
dw $0000,$0000
dw $0000,$0000
dw $0000,$0000
dw $0000
dw $0000,$20a9,$0000
dw $0000,$0000,$0000
dw $0000,$0000,$0000,$0000
dw $0000,$0000,$0000
dw $0000,$0000,$0000,$0000
dw $0000,$0000
dw $0000
dw $40b1,$0000
dw $80b2,$0000,$0000,$0000
dw $0000,$0000
dw $0000
dw $0000,$0000,$0000
dw $0000,$0000,$80b8,$0000,$0000,$0000
dw $0000,$0000,$4099,$0000,$0000,$0000
dw $0000,$0000,$0000,$0000,$0000,$0000
dw $0000,$0000
dw $0000
dw $0000
dw $0000,$0000
dw $0000,$0000,$0000
dw $0000,$80a1,$0000,$0000
dw $80a2,$0000,$0000,$0000,$0000,$0000,$0000,$0000
dw $0000,$0000,$0000,$0000,$0000
dw $0000
dw $0000
dw $0000,$0000,$80c6,$0000,$0000
dw $0000
dw $20a8,$0000
dw $80ba,$0000,$0000,$0000
dw $80b9,$0000,$0000
dw $0000,$0000,$0000,$0000,$0000,$0000
dw $0000,$80cc,$0000,$40cc,$0000,$0000,$0000,$0000
dw $0000,$80bf,$0000
dw $40be
dw $0000,$0000,$0000
dw $0000,$40c2,$0000,$0000,$0000,$0000,$0000,$0000
dw $80c3,$40c1,$0000,$0000,$0000,$0000,$0000,$0000
dw $80c2,$0000,$0000,$0000,$0000,$0000,$0000
dw $80c5
dw $80c4,$0000,$0000
dw $20b6,$0000,$0000,$0000,$0000,$0000
dw $0000,$0000,$0000
dw $0000
dw $0000,$0000,$0000,$0000,$0000
dw $20cc
dw $40bc,$10bc,$80cb
dw $0000
dw $0000,$0000
dw $0000,$0000,$0000,$0000
dw $0000
dw $0000,$0000
dw $0000,$0000,$0000
dw $0000,$0000,$0000
dw $0000,$0000,$0000
dw $0000
dw $0000,$0000
dw $0000
dw $0000,$0000,$0000,$0000
dw $ffff ; indicates the end - we can drop this
; Edge Transition Table (Target Room, Flags, MultiDiv ratio for edges)
org $A7C500 ;ends around 27C5F(9) 4 bytes would be 27C649
;I kind of want to split the 3rd byte into two
NorthOpenEdge:
db $00,$80,$11, $00,$80,$11, $00,$80,$11, $00,$80,$11
db $00,$80,$11, $00,$80,$11, $00,$80,$11, $00,$80,$11
db $00,$80,$11, $00,$80,$11, $00,$80,$11
SouthOpenEdge:
db $00,$80,$11, $00,$80,$11, $00,$80,$11, $00,$80,$11
db $00,$80,$11, $00,$80,$11, $00,$80,$11, $00,$80,$11
db $00,$80,$11, $00,$80,$11, $00,$80,$11
WestOpenEdge:
db $00,$80,$11, $00,$80,$11, $00,$80,$11
db $00,$80,$11, $00,$80,$11, $00,$80,$11
db $00,$80,$11, $00,$80,$11, $00,$80,$11
EastOpenEdge:
db $00,$80,$11, $00,$80,$11, $00,$80,$11
db $00,$80,$11, $00,$80,$11, $00,$80,$11
db $00,$80,$11, $00,$80,$11, $00,$80,$11
; Edge Info Table (Midpoint, Width, Min Coord)
; I kind of want to add a fourth byte to help indicate quadrant info on min coord
NorthEdgeInfo:
db $a8,$10,$a0, $2c,$08,$28 ;HC
db $b8,$20,$a8 ; DP West Wing
db $38,$20,$28, $f8,$a0,$a8, $b8,$20,$a8 ; DP Main
db $78,$20,$68 ; DP East Wing
db $f8,$10,$f0, $7c,$18,$70 ; TT Lobby
db $74,$18,$68, $f8,$10,$f0 ; TT Compass
SouthEdgeInfo:
db $a8,$10,$a0, $2c,$08,$28 ; HC
db $b8,$20,$a8 ; DP Sandworm
db $38,$20,$28, $f8,$a0,$a8, $b8,$20,$a8 ; DP North Hall & Dead End
db $78,$20,$68 ; DP Arrow Pot
db $f8,$10,$f0, $7c,$18,$70 ; TT Ambush
db $74,$18,$68, $f8,$10,$f0 ; TT BK Corner
WestEdgeInfo:
db $78,$30,$60 ; TT Attic
db $40,$20,$30 ; DP North Hall
db $40,$20,$30 ; DP Arrow Pot
db $84,$18,$78, $68,$10,$60 ; HC South
db $a0,$a0,$50 ; DP East Wing
db $58,$50,$30, $98,$50,$70 ; TT BK Corner
db $58,$50,$30 ; TT Compass
EastEdgeInfo:
db $78,$30,$60 ; TT Attic
db $40,$20,$30 ; DP Sandworm
db $40,$20,$30 ; DP North Hall
db $68,$10,$60, $84,$18,$78 ; HC Guards
db $a0,$a0,$50 ; DP Main Lobby
db $58,$50,$30, $98,$50,$70 ; TT Ambush
db $58,$50,$30 ; TT Nook
MultDivInfo: ; (1, 2, 3, 4, 5, 6, 10, 20)
db $01, $02, $03, $04, $05, $06, $0a, $14
; indices: 0-7
; In-room stairs in North/South pairs. From left to right:
; PoD, IP right side, IP Freezor chest and GT
org $A7C700
InroomStairsTable:
dw $0003,$0003, $0003,$0003, $0003,$0003, $0003,$0003
org $A7C720
InroomStairsRoom:
db $0B,$1B, $3F,$1F, $7E,$5E, $96,$3D
InroomStairsX:
dw $0190, $0160, $0040, $0178
InroomStairsY:
dw $0058, $0148, $0198, $0190
org $A7E000
CutoffRooms:
; TT Alcove, Mire Bridge Left & Right, Mire Bent Bridge, Mire Hub
; Pod Falling & Harmless, SW Star Pits, TR Lava Escape & TR Dual Pipes, Bob's Room & GT Big Chest
dw $00bc, $00a2, $00a3, $00c2, $001a, $0049, $0014, $008c
; Ice Many Pots, Swamp Waterfall, GT Gauntlet 3, Eastern Push Block, Eastern Courtyard, Eastern Map Valley
; Eastern Cannonball, HC East Hall
dw $009f, $0066, $005d, $00a8, $00a9, $00aa, $00b9, $0052
; HC West Hall, TR Dash Bridge, TR Hub, Pod Arena, GT Petting Zoo, Ice Spike Cross
dw $0050, $00c5, $00c6, $0009, $0003, $002a, $007d, $005e
; Sewer Drop, Mire Cross, GT Crystal Circles
dw $0011, $00b2, $003d
dw $ffff
; dungeon tables
; HC HC EP DP AT SP PD MM SW IP TH TT TR GT
org $A7f000
CompassBossIndicator:
dw $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000
TotalKeys: ;27f020
db $04, $04, $02, $04, $04, $06, $06, $06, $05, $06, $01, $03, $06, $08, $00, $00
ChestKeys: ;27f030
db $01, $01, $00, $01, $02, $01, $06, $03, $03, $02, $01, $01, $04, $04, $00, $00
BigKeyStatus: ;27f040 (status 2 indicate BnC guard)
dw $0002, $0002, $0001, $0001, $0000, $0001, $0001, $0001, $0001, $0001, $0001, $0001, $0001, $0001, $0000, $0000
DungeonReminderTable: ;27f060
dw $2D50, $2D50, $2D51, $2D52, $2D54, $2D56, $2D55, $2D5A, $2D57, $2D59, $2D53, $2D58, $2D5B, $2D5C, $0000, $0000
TotalLocationsLow: ;27f080
db $08, $08, $06, $06, $02, $00, $04, $08, $08, $08, $06, $08, $02, $07, $00, $00
TotalLocationsHigh: ;27f090
db $00, $00, $00, $00, $00, $01, $01, $00, $00, $00, $00, $00, $01, $02, $00, $00
org $A7f0a0
TotalLocations:
db $08, $08, $06, $06, $02, $0a, $0e, $08, $08, $08, $06, $08, $0c, $1b, $00, $00
; no more room here
; Vert 0,6,0 Horz 2,0,8
org $A7f0b0
CoordIndex: ; Horizontal 1st
db 2, 0 ; Coordinate Index $20-$23
OppCoordIndex:
db 0, 2 ; Swapped coordinate Index $20-$23 (minor optimization)
CameraIndex: ; Horizontal 1st
db 0, 6 ; Camera Index $e2-$ea
CamQuadIndex: ; Horizontal 1st
db 8, 0 ; Camera quadrants $600-$60f
ShiftQuadIndex:
db 2, 1 ; see ShiftQuad func (relates to $a9,$aa)
CamBoundIndex: ; Horizontal 1st
db 0, 4 ; Camera Bounds $0618-$61f
OppCamBoundIndex: ; Horizontal 1st
db 4, 0 ; Camera Bounds $0618-$61f
CamBoundBaseLine: ; X camera stuff is 1st column todo Y camera needs more testing
dw $007f, $0077 ; Left/Top camera bounds when at edge or layout frozen
dw $0007, $000b ; Left/Top camera bounds when not frozen + appropriate low byte $22/$20 (preadj. by #$78/#$6c)
dw $00ff, $010b ; Right/Bot camera bounds when not frozen + appropriate low byte $20/$22
dw $017f, $0187 ; Right/Bot camera bound when at edge or layout frozen
;27f0ce next free byte
org $A7f0f0
RemoveRainDoorsRoom:
dw $0060, $0062, $ffff ; ffff indicates end of list
RainDoorMatch: ; org $A7f0f6 and f8 for now
dw $0081, $0061 ; not xba'd
BlockSanctuaryDoorInRain: ;27f0fa
dw $0000
org $A7f100
TilesetTable:
; 0 1 2 3 4 5 6 7 8 9 a b c d e f --Offset Ruler
db $13,$04,$04,$06,$0d,$ff,$08,$05,$06,$07,$07,$07,$0e,$0e,$0b,$ff
db $13,$04,$04,$0d,$0d,$0d,$08,$05,$06,$07,$07,$07,$0e,$0e,$0b,$0b
db $04,$04,$04,$0d,$0d,$ff,$08,$05,$08,$09,$07,$07,$06,$ff,$0b,$06
db $04,$05,$04,$12,$08,$08,$08,$08,$08,$09,$07,$07,$06,$0e,$0b,$0b
db $04,$04,$04,$12,$0a,$0a,$08,$ff,$ff,$09,$07,$07,$0e,$0e,$0b,$0b
db $04,$04,$04,$12,$08,$01,$09,$09,$09,$09,$07,$0e,$0e,$0e,$0b,$0b
db $04,$04,$04,$12,$0a,$0a,$08,$09,$09,$ff,$07,$0e,$0e,$0e,$0b,$ff
db $04,$04,$04,$12,$12,$12,$08,$05,$ff,$ff,$ff,$0e,$0e,$0e,$0b,$0b
db $04,$04,$04,$12,$12,$12,$ff,$05,$ff,$05,$ff,$0e,$0e,$0e,$0b,$ff
db $0c,$0c,$0c,$0c,$ff,$0e,$0e,$0c,$0c,$05,$ff,$0e,$0e,$0e,$0b,$0b
db $0c,$0c,$0c,$0c,$0d,$0e,$0e,$05,$05,$05,$05,$0a,$0a,$ff,$0b,$0b
db $04,$0c,$0c,$0c,$0d,$0d,$0d,$0d,$05,$05,$05,$0a,$0a,$ff,$0b,$0b
db $04,$0c,$0c,$0c,$0d,$0d,$0d,$0d,$05,$05,$ff,$0a,$0a,$ff,$0b,$ff
db $04,$0c,$0c,$ff,$ff,$0d,$0d,$ff,$05,$05,$05,$0a,$0a,$ff,$0b,$06
db $04,$06,$06,$06,$06,$06,$06,$06,$06,$ff,$06,$06,$ff,$06,$06,$06
db $06,$06,$03,$03,$03,$03,$ff,$ff,$06,$06,$06,$06,$ff,$06,$06,$06
;27f200
PaletteTable:
db $21,$00,$00,$07,$00,$08,$00,$00,$07,$00,$00,$00,$00,$00,$00,$21
db $21,$00,$00,$00,$00,$00,$00,$00,$07,$00,$00,$00,$00,$00,$00,$00
db $00,$00,$00,$00,$00,$00,$00,$00,$00,$0e,$00,$00,$07,$00,$00,$07
db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$07,$00,$00,$00
db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$13
db $00,$00,$00,$00,$00,$01,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
; 0 1 2 3 4 5 6 7 8 9 a b c d e f --Offset Ruler
db $00,$00,$00,$00,$00,$00,$00,$06,$00,$00,$00,$00,$00,$00,$00,$00
db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
db $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$14,$20
db $00,$07,$20,$20,$07,$07,$07,$07,$07,$20,$20,$07,$20,$20,$20,$20
db $07,$07,$02,$02,$02,$02,$07,$07,$07,$20,$20,$07,$20,$20,$20,$07
;A7f300
DungeonTilesets:
db $04,$04,$05,$12,$04,$08,$07,$0C,$09,$0B,$05,$0A,$0D,$0E,$06,$06
;
;org $A7ff00
org $A7fff0
LinksHouseDarkWorld:
dw $ffff
SanctuaryDarkWorld:
dw $ffff
OldManDarkWorld:
dw $ffff

19
doorrando/dr_lobby.asm Normal file
View File

@@ -0,0 +1,19 @@
CheckDarkWorldSpawn:
PHP
STA $A0 : STA $048E ; what we wrote over
JSL SetDefaultWorld
LDA.l LinksHouseDarkWorld : CMP.b $A0 : BEQ ++
LDA.l SanctuaryDarkWorld : CMP.b $A0 : BEQ ++
LDA.l OldManDarkWorld : CMP.b $A0 : BNE +
++ SEP #$20 : LDA CurrentWorld : EOR.b #$40 : STA CurrentWorld
LDA.l DRFlags+1 : AND #$02 : BEQ + ; skip if the flag isn't set
LDA.l MoonPearlEquipment : BNE + ; moon pearl?
LDA #$17 : STA $5D : INC $02E0
+ PLP : RTL
SetDefaultWorld:
PHP : SEP #$20
LDA.l InvertedMode : BEQ +
LDA.b #$40
+ STA CurrentWorld
PLP : RTL

220
doorrando/drhooks.asm Normal file
View File

@@ -0,0 +1,220 @@
org $82b5c4 ; -- moving right routine 135c4
jsl WarpRight
org $82b665 ; -- moving left routine
jsl WarpLeft
org $82b713 ; -- moving down routine
jsl WarpDown
org $82b7b4 ; -- moving up routine
jsl WarpUp
org $82bd80
jsl AdjustTransition
nop
;turn off linking doors -- see .notRoomLinkDoor label in Bank02.asm
org $82b5a8 ; <- 135a8 - Bank02.asm : 8368 (LDA $7EC004 : STA $A0)
jsl CheckLinkDoorR
bcc NotLinkDoor1
org $82b5b6
NotLinkDoor1:
org $82b649 ; <- 135a8 - Bank02.asm : 8482 (LDA $7EC004 : STA $A0)
jsl CheckLinkDoorL
bcc NotLinkDoor2
org $82b657
NotLinkDoor2:
; Staircase routine
org $81c3d4 ; <- c3d4 - Bank01.asm : 9762-4 (Dungeon_DetectStaircase-> STA $A0 : LDA $063D, X)
jsl RecordStairType : nop
org $82a1e7 ;(PC: 121e7)
jsl SpiralWarp
org $8291b3 ; <- Bank02.asm : 3303 (LDA $0462 : AND.b #$04)
jsl SpiralPriorityHack : nop
org $8290f9 ; <- Bank02.asm : 3188 (LDA $0462 : AND.b #$04)
jsl SpiralPriorityHack : nop
org $829369 ; <- 11369 - Bank02.asm : 3610 (STX $0464 : STY $012E)
jsl StraightStairsAdj : nop #2
org $829383 ; <- 11384 - Bank02.asm : 3629 (.walkingDownStaircase-> ADD $20 : STA $20)
jsl StraightStairsFix : nop
org $8293aa ; <- 113aa - Bank02.asm : 3653 (ADD $20 : STA $20)
jsl StraightStairsFix : nop
org $8293d1 ; <- 113d1 - Bank02.asm : 3683 (ADD $20 : STA $20 BRANCH_IOTA)
jsl StraightStairsFix : nop
org $829396 ; <- 11396 - Bank02.asm : 3641 (LDA $01C322, X)
jsl StraightStairLayerFix
org $82c092 ; STA $0020, Y : LDX #$00
jsl DoorToInroom : nop
org $82c0f8 ; CMP $02C034, X
jsl DoorToInroomEnd
org $82941a ; <- Bank02.asm : 3748 module 7.12.11 (LDA $0464 : BNE BRANCH_$11513 : INC $B0 : RTS)
jsl StraightStairsTrapDoor : rts
org $828b54 ; <- Bank02.asm : 2200 (JSL UseImplicitRegIndexedLocalJumpTable)
jsl InroomStairsTrapDoor
org $82c146
jsl HandleSpecialDoorLanding
org $8289a0 ; JSL $0091C4
jsl QuadrantLoadOrderBeforeScroll
org $82bd9c ; JSL $0091C4
jsl QuadrantLoadOrderAfterScroll
; Graphics fix
org $82895d ; Bank 02 line 1812 (JSL Dungeon_LoadRoom : JSL Dungeon_InitStarTileChr : JSL $00D6F9 : INC $B0)
Splicer:
jsl GfxFixer
lda $b1 : beq .done
rts
nop #5
.done
org $81b618 ; Bank01.asm : 7963 Dungeon_LoadHeader (REP #$20 : INY : LDA [$0D], Y)
nop : jsl OverridePaletteHeader
org $82817e ; Bank02.asm : 414 (LDA $02811E, X)
jsl FixAnimatedTiles
org $8aef43 ; UnderworldMap_RecoverGFX
jsl FixCloseDungeonMap
org $828a06 ; Bank02.asm : 1941 Dungeon_ResetTorchBackgroundAndPlayer
JSL FixWallmasterLamp
org $80d377 ;Bank 00 line 3185
DecompDungAnimatedTiles:
org $80fda4 ;Bank 00 line 8882
Dungeon_InitStarTileCh:
org $80d6ae ;(PC: 56ae)
LoadTransAuxGfx:
org $80d739 ;
LoadTransAuxGfx_Alt:
org $80df5a ;(PC: 5f5a)
PrepTransAuxGfx:
org $8ffd65 ;(PC: 07fd65)
Dungeon_LoadCustomTileAttr:
org $81feb0
Dungeon_ApproachFixedColor:
;org $01fec1
;Dungeon_ApproachFixedColor_variable:
;org $a0f972 ; Rando version
;LoadRoomHook:
org $9bee74 ;(PC: 0dee74)
Palette_DungBgMain:
org $9bec77
Palette_SpriteAux3:
org $9becc5
Palette_SpriteAux2:
org $9bece4
Palette_SpriteAux1:
org $828046 ; <- 10046 - Bank02.asm : 217 (JSL EnableForceBlank) (Start of Module_LoadFile)
jsl OnFileLoadOverride
org $87A93F ; < 3A93F - Bank07.asm 6548 (LDA $8A : AND.b #$40 - Mirror checks)
jsl MirrorCheckOverride
org $85ef47
Sprite_HeartContainer_Override: ;sprite_heart_upgrades.asm : 96-100 (LDA $040C : CMP.b #$1A : BNE .not_in_ganons_tower)
jsl GtBossHeartCheckOverride : bcs .not_in_ganons_tower
nop : stz $0dd0, X : rts
.not_in_ganons_tower
org $87a955 ; <- Bank07.asm : around 6564 (JP is a bit different) (STZ $05FC : STZ $05FD)
jsl BlockEraseFix
nop #2
org $82A0A8
Mirror_SaveRoomData:
org $87A95B ; < bank_07.asm ; #_07A95B: JSL Mirror_SaveRoomData
jsl EGFixOnMirror
org $82b82a
jsl FixShopCode
org $9ddeea ; <- Bank1D.asm : 286 (JSL Sprite_LoadProperties)
jsl VitreousKeyReset
org $9ed024 ; f5024 sprite_guruguru_bar.asm : 27 (LDA $040C : CMP.b #$12 : INY #2
jsl GuruguruFix : bra .next
nop #3
.next
org $828fc9
nop #2 : jsl BlindAtticFix
org $828409
jsl SuctionOverworldFix
org $8ded04 ; <- rando's hooks.asm line 2192 - 6ED04 - equipment.asm : 1963 (REP #$30)
jsl DrHudDungeonItemsAdditions
;org $098638 ; rando's hooks.asm line 2192
;jsl CountChestKeys
org $86D192 ; rando's hooks.asm line 457
jsl CountAbsorbedKeys
; rando's hooks.asm line 1020
;org $05FC7E ; <- 2FC7E - sprite_dash_item.asm : 118 (LDA $7EF36F : INC A : STA $7EF36F)
;jsl CountBonkItem
org $819dbd ; <- Bank01.asm : 4465 of Object_Draw8xN (LDA $9B52, Y : STA $7E2000, X)
jsl CutoffEntranceRug : bra .nextTile : nop
.nextTile
;maybe set 02e2 to 0
org $8799de ; <- Bank07.asm : 4088 (LDA.b #$15 : STA $5D)
JSL StoreTempBunnyState
;
org $88c450 ; <- ancilla_receive_item.asm : 146-148 (STY $5D : STZ $02D8)
JSL RetrieveBunnyState : NOP
org $82d9ce ; <- Bank02.asm : Dungeon_LoadEntrance 10829 (STA $A0 : STA $048E)
JSL CheckDarkWorldSpawn : NOP
org $9edabf ; <- sprite_energy_ball.asm : 86-7 Sprite_EnergyBall (LDA.b #$10 : LDX.b #$00)
JSL StandardAgaDmg
org $89F7B2 ; 09F7B2 Module17_01 S&Q
JSL StandardSaveAndQuit
org $89a681 ; < - similar to talalong.asm : 1157 (JSL Main_ShowTextMessage)
JSL BlindsAtticHint : NOP #2
org $9cfd69
Main_ShowTextMessage:
; Conditionally disable UW music changes in Door Rando
org $828ADB ; <- Bank02.asm:2088-2095 (LDX.b #$14 : LDA $A0 ...)
JSL.l Underworld_DoorDown_Entry : CPX #$FF
BEQ + : db $80, $1C ; BRA $028B04
NOP #6 : +
org $82C3F2 ; <- Bank02.asm:10521 Unused call
Underworld_DoorDown_Call:
org $82C3F3
dw $8AD9 ; address of Bank02.asm:2085
org $81AA90
JSL BigKeyDoorCheck : NOP
org $81AAA2
RoomDraw_OneSidedShutters_South_onesided_shutter_or_big_key_door:
;Enable south facing bk graphic
org $80CE24
dw $2ac8
org $81b714 ; PC: b714
OpenableDoors:
jsl CheckIfDoorsOpen
bcs .normal
rts
.normal
; fixes an issue with edges -> normal doors (bombable, dashable, keydoor)
org $82C06A
JSL TransitionCalculateLanding_Fix : NOP #2
org $82C157
JSL AlwaysPushThroughFDoors

325
doorrando/edges.asm Normal file
View File

@@ -0,0 +1,325 @@
; defines
; Ram usage
EdgeToNormalFlag = $7E1200
HorzEdge:
LDA.b #$00 : STA.l EdgeToNormalFlag
cpy #$ff : beq +
jsr DetectWestEdge : ldy #$02 : bra ++
+ jsr DetectEastEdge
++ cmp #$ff : beq +
sta $00 : asl : !add $00 : tax
cpy #$ff : beq ++
jsr LoadWestData : bra .main
++ jsr LoadEastData
.main
jsr LoadEdgeRoomHorz
sec : rts
+ clc : rts
VertEdge:
LDA.b #$00 : STA.l EdgeToNormalFlag
cpy #$ff : beq +
jsr DetectNorthEdge : bra ++
+ jsr DetectSouthEdge
++ cmp #$ff : beq +
sta $00 : asl : !add $00 : tax
cpy #$ff : beq ++
jsr LoadNorthData : bra .main
++ jsr LoadSouthData
.main
jsr LoadEdgeRoomVert
sec : rts
+ clc : rts
LoadEdgeRoomHorz:
lda $03 : sta $a0
sty $06
and.b #$0f : asl a : !sub $23 : !add $06 : sta $02
ldy #$00 : jsr ShiftVariablesMainDir
lda $04 : and #$80 : bne .edge
lda $04 : sta $01 ; load up flags in $01
jsr PrepScrollToNormal
bra .scroll
.edge
lda $04 : and #$10 : beq +
lda #$01
+ sta $ee ; layer stuff
jsr MathHorz
.scroll
jsr ScrollY
rts
LoadEdgeRoomVert:
lda $03 : sta $a0
sty $06
and.b #$f0 : lsr #3 : !sub $21 : !add $06 : sta $02
lda $04 : and #$80 : bne .edge
lda $04 : sta $01 ; load up flags in $01
and #$03 : cmp #$03 : beq .inroom
LDA.b #$01 : STA.l EdgeToNormalFlag
ldy #$01 : jsr ShiftVariablesMainDir
jsr PrepScrollToNormal
bra .scroll
.inroom
jsr ScrollToInroomStairs
rts
.edge
ldy #$01 : jsr ShiftVariablesMainDir
lda $04 : and #$10 : beq +
lda #$01
+ sta $ee ; layer stuff
jsr MathVert
lda $03
.scroll
jsr ScrollX
rts
MathHorz:
jsr MathStart : lda $20
jsr MathMid : and #$0040
jsr MathEnd
rts
MathVert:
jsr MathStart : lda $22
jsr MathMid : and #$0020
jsr MathEnd
rts
MathStart:
rep #$30
lda $08 : and #$00ff : sta $00
rts
MathMid:
and #$01ff : !sub $00 : and #$00ff : sta $00
; nothing should be bigger than $a0 at this point
lda $05 : and #$00f0 : lsr #4 : tax
lda MultDivInfo, x : and #$00ff : tay
lda $00 : jsr MultiplyByY : sta $02
lda $07 : and #$00ff : jsr MultiplyByY : tax
lda $05 : and #$000f : tay
lda MultDivInfo, y : and #$00ff : tay
lda $02 : jsr DivideByY : sta $00
lda $0c : and #$00ff : sta $02
lda $04
rts
MathEnd:
beq +
lda #$0100
+ !add $02 : !add $00
sta $04
sep #$30
rts
; don't need midpoint of edge Link is leaving (formerly in $06 - used by dir indicator)
; don't need width of edge Link is going to (currently in $0b)
LoadNorthData:
lda NorthOpenEdge, x : sta $03 : inx ; target room
lda NorthEdgeInfo, x : sta $07 ; needed for maths - (divide by 2 anyway)
lda NorthOpenEdge, x : sta $04 : inx ; bit field
lda NorthEdgeInfo, x : sta $08 ; needed for maths
lda NorthOpenEdge, x : sta $05 ; ratio
lda $04 : jsr LoadSouthMidpoint : inx ; needed now, and for nrml transition
lda SouthEdgeInfo, x : sta $0b : inx ; probably not needed todo: remove
lda SouthEdgeInfo, x : sta $0c ; needed for maths
rts
LoadSouthMidpoint:
and #$0f : sta $00 : asl : !add $00 : tax
lda SouthEdgeInfo, x : sta $0a ; needed now, and for nrml transition
rts
LoadSouthData:
lda SouthOpenEdge, x : sta $03 : inx
lda SouthEdgeInfo, x : sta $07
lda SouthOpenEdge, x : sta $04 : inx
lda SouthEdgeInfo, x : sta $08
lda SouthOpenEdge, x : sta $05
lda $04 : jsr LoadNorthMidpoint : inx
lda NorthEdgeInfo, x : sta $0b : inx
lda NorthEdgeInfo, x : sta $0c
rts
LoadNorthMidpoint:
and #$0f : sta $00 : asl : !add $00 : tax
lda NorthEdgeInfo, x : sta $0a ; needed now, and for nrml transition
rts
LoadWestData:
lda WestOpenEdge, x : sta $03 : inx
lda WestEdgeInfo, x : sta $07
lda WestOpenEdge, x : sta $04 : inx
lda WestEdgeInfo, x : sta $08
lda WestOpenEdge, x : sta $05
lda $04 : jsr LoadEastMidpoint : inx
lda EastEdgeInfo, x : sta $0b : inx
lda EastEdgeInfo, x : sta $0c
rts
LoadEastMidpoint:
and #$0f : sta $00 : asl : !add $00 : tax
lda EastEdgeInfo, x : sta $0a ; needed now, and for nrml transition
rts
LoadEastData:
lda EastOpenEdge, x : sta $03 : inx
lda EastEdgeInfo, x : sta $07
lda EastOpenEdge, x : sta $04 : inx
lda EastEdgeInfo, x : sta $08
lda EastOpenEdge, x : sta $05
lda $04 : jsr LoadWestMidpoint : inx
lda WestEdgeInfo, x : sta $0b : inx
lda WestEdgeInfo, x : sta $0c
LoadWestMidpoint:
and #$0f : sta $00 : asl : !add $00 : tax
lda WestEdgeInfo, x : sta $0a ; needed now, and for nrml transition
rts
DetectNorthEdge:
ldx #$ff
lda $a2
cmp #$82 : bne +
lda $22 : cmp #$50 : bcs ++
ldx #$01 : bra .end
++ ldx #$00 : bra .end
+ cmp #$83 : bne +
ldx #$02 : bra .end
+ cmp #$84 : bne +
lda $a9 : beq ++
lda $22 : cmp #$78 : bcs +++
ldx #$04 : bra .end
+++ ldx #$05 : bra .end
++ lda $22 : cmp #$78 : bcs ++
ldx #$03 : bra .end
++ ldx #$04 : bra .end
+ cmp #$85 : bne +
ldx #$06 : bra .end
+ cmp #$db : bne +
lda $a9 : beq ++
lda $22 : beq ++
ldx #$08 : bra .end
++ ldx #$07 : bra .end
+ cmp #$dc : bne .end
lda $a9 : bne ++
lda $22 : cmp #$b0 : bcs ++
ldx #$09 : bra .end
++ ldx #$0a
.end txa : rts
DetectSouthEdge:
ldx #$ff
lda $a2
cmp #$72 : bne +
lda $22 : cmp #$50 : bcs ++
ldx #$01 : bra .end
++ ldx #$00 : bra .end
+ cmp #$73 : bne +
ldx #$02 : bra .end
+ cmp #$74 : bne +
lda $a9 : beq ++
lda $22 : cmp #$78 : bcs +++
ldx #$04 : bra .end
+++ ldx #$05 : bra .end
++ lda $22 : cmp #$78 : bcs ++
ldx #$03 : bra .end
++ ldx #$04 : bra .end
+ cmp #$75 : bne +
ldx #$06 : bra .end
+ cmp #$cb : bne +
lda $a9 : beq ++
lda $22 : beq ++
ldx #$08 : bra .end
++ ldx #$07 : bra .end
+ cmp #$cc : bne .end
lda $a9 : bne ++
lda $22 : cmp #$b0 : bcs ++
ldx #$09 : bra .end
++ ldx #$0a
.end txa : rts
DetectWestEdge:
ldx #$ff
lda $a2
cmp #$65 : bne +
ldx #$00 : bra .end
+ cmp #$74 : bne +
ldx #$01 : bra .end
+ cmp #$75 : bne +
ldx #$02 : bra .end
+ cmp #$82 : bne +
lda $aa : beq ++
ldx #$03 : bra .end
++ ldx #$04 : bra .end
+ cmp #$85 : bne +
ldx #$05 : bra .end
+ cmp #$cc : bne +
lda $aa : beq ++
ldx #$06 : bra .end
++ ldx #$07 : bra .end
+ cmp #$dc : bne .end
ldx #$08
.end txa : rts
DetectEastEdge:
ldx #$ff
lda $a2
cmp #$64 : bne +
ldx #$00 : bra .end
+ cmp #$73 : bne +
ldx #$01 : bra .end
+ cmp #$74 : bne +
ldx #$02 : bra .end
+ cmp #$81 : bne +
lda $aa : beq ++
ldx #$04 : bra .end
++ ldx #$03 : bra .end
+ cmp #$84 : bne +
ldx #$05 : bra .end
+ cmp #$cb : bne +
lda $aa : beq ++
ldx #$06 : bra .end
++ ldx #$07 : bra .end
+ cmp #$db : bne .end
ldx #$08
.end txa : rts
TransitionCalculateLanding_Fix:
LDA.l EdgeToNormalFlag : BEQ +
LDX.w $0418 : CPX.b #$01 : BNE +
LDA.b $20 : SBC #$08 : STA.b $20
+ PHK : PEA.w .jslrtsreturn-1
PEA.w $02802C
JML CalculateTransitionLanding
.jslrtsreturn
LDX.w $0418 : CPX.b #$01 : BNE .zero ; the LDX is vanilla and needs to always run
LDA.l EdgeToNormalFlag : BEQ +
LDA.b $20 : ADC #$08 : STA.b $20
.zero LDA.b #$00 : STA.l EdgeToNormalFlag
+ JSL DoorToStraight
RTL
AlwaysPushThroughFDoors:
PHA : AND.b #$F0 : CMP.b #$F0 : BNE +
PLA : RTL
+ PLA : AND.b #$8E : CMP.b #$80
RTL

View File

@@ -0,0 +1,274 @@
;===================================================================================================
; The only specific concern to keep in mind with this code is that your databank will be $00
; Actually, it should be $80, if you're using my fastrom changes.
;
; Leave all your door data vanilla
; Do not try to adjust doors as I previously suggested (not worth the effort)
; We need a few hooks and some light hardcoding either way
; Might as well just do it in a brute, but reliable, way
;
; In brief, this is the hack we're making:
; 1) Let vanilla routines draw the door normally
; 2) Draw over what vanilla just drew
; 3) Hijack the door tile type routine
; and replace the vanilla value with that of solid collision
;===================================================================================================
pushpc
org $01892F
DoorDrawJankMove:
JML PrepDoorDraw
.return
JSL AdjustEscapeDoorGraphics
RTS
; we don't want to overwrite the JMP ($000E) that's already there
; Well, we could, but we don't need to
warnpc $018939
org $01BF43
JSL AdjustEscapeDoorCollision
pullpc
;===================================================================================================
PrepDoorDraw:
; first off, we need this routine to return to our jank hook
; otherwise, finding a reliable place to put the graphics change check will be a pin
; so push the address to return to the routine
; It's a lot to explain why this is necessary
; Much easier to just tell you to look at $01890D in the disassembly
; and you should understand the vanilla program flow we need to reject
PEA.w DoorDrawJankMove_return-1
; copy vanilla code (but fast rom)
LDA.l $8186F0,X
STA.b $0E
LDX.b $02
LDA.b $04
; and to execute the jump, we'll use the JMP ($000E) we carefully avoided overwriting
JML.l $818939
;===================================================================================================
; Adjustment stage 1: graphics
AdjustEscapeDoorGraphics:
JSR IdentifyBlockedEntrance
BCS .replace_graphics
JSR IdentifySancEntrance
BCS .fix_sanctuary_entrance
JSR IdentifySwampEntrance
BCS .fix_swamp_entrance
; Do nothing
RTL
;---------------------------------------------------------------------------------------------------
.replace_graphics ; for blocked doors
; using the value in $19A0 should be fine for finding the graphics
; the only caveat is that this appears to locate the tile just above the north-west corner
; so below, I've indicated that offset with a +$xxx after the base tilemap buffer
; The only odd thing I notice with this position is that some bad hardcoded adjust for
; exploding walls that shouldn't affect how we use this value at all!
LDY.w $0460 ; get door index
LDX.w $19A0-2,Y ; get tilemap index
; hardcoded shutter door graphics tile replacement
; the horizontal flips could easily be explicit LDAs
; but it's probably best the door is symmetrical
; using ORA makes your intent more clear
; and gives you fewer values to change if you experiment with other graphics
; row 1
LDA.w #$8838
STA.l $7E2000+$080,X
ORA.w #$4000 ; horizontally flip
STA.l $7E2000+$086,X
; row 2
LDA.w #$8828
STA.l $7E2000+$100,X
ORA.w #$4000 ; horizontally flip
STA.l $7E2000+$106,X
LDA.w #$8829
STA.l $7E2000+$102,X
ORA.w #$4000 ; horizontally flip
STA.l $7E2000+$104,X
; the state of the A, X, and Y registers is irrelevant when we exit
; they're all subsequently loaded with new values
RTL
.fix_sanctuary_entrance
LDY.w $0460 ; get door index
LDX.w $19A0-2,Y ; get tilemap index
; row 0
LDA.w #$14C4
STA.l $7E2000+$000,X ; sanity check = should calculate to 7e3bbc
ORA.w #$4000 ; horizontally flip
STA.l $7E2000+$006,X
LDA.w #$14C5
STA.l $7E2000+$002,X
ORA.w #$4000 ; horizontally flip
STA.l $7E2000+$004,X
; row 1
LDA.w #$14E8
STA.l $7E2000+$082,X
ORA.w #$4000 ; horizontally flip
STA.l $7E2000+$084,X
; row 2
LDA.w #$14F8
STA.l $7E2000+$102,X
ORA.w #$4000 ; horizontally flip
STA.l $7E2000+$104,X
.fix_swamp_entrance
LDY.w $0460 ; get door index
LDX.w $19A0-2,Y ; get tilemap index
; row 0
LDA.w #$9DfC
STA.l $7E2000+$000,X
STA.l $7E2000+$002,X
STA.l $7E2000+$004,X
STA.l $7E2000+$006,X
; row 1
LDA.w #$0908
STA.l $7E2000+$080,X
ORA.w #$4000 ; horizontally flip
STA.l $7E2000+$086,X
LDA.w #$14E8
STA.l $7E2000+$082,X
ORA.w #$4000 ; horizontally flip
STA.l $7E2000+$084,X
; row 2
LDA.w #$0918
STA.l $7E2000+$100,X
ORA.w #$4000 ; horizontally flip
STA.l $7E2000+$106,X
LDA.w #$14F8
STA.l $7E2000+$102,X
ORA.w #$4000 ; horizontally flip
STA.l $7E2000+$104,X
; row 3
LDA.w #$A82C
STA.l $7E2000+$180,X
ORA.w #$4000 ; horizontally flip
STA.l $7E2000+$186,X
LDA.w #$A82D
STA.l $7E2000+$182,X
ORA.w #$4000 ; horizontally flip
STA.l $7E2000+$184,X
RTL
IdentifySancEntrance:
LDA.b $A0 : CMP.w #$0012 : BNE +
LDA.b $0A : CMP.w #$0010 : BNE +
SEC : RTS
+ CLC : RTS
IdentifySwampEntrance:
LDA.b $A0 : CMP.w #$0036 : BNE +
LDA.b $0A : CMP.w #$0010 : BNE +
SEC : RTS
+ CLC : RTS
;===================================================================================================
; Leaving this here in case you desire a fully custom door later
; For now, we'll just hardcode the tiles, as I did above
; I put these in column order because that's how they're expected for the vanilla draw routines
; but I changed my mind on redefining things
; and am too lazy to change it to a row-wise listing
BlockedEntrance:
dw $8838, $8828, $A888 ; column 0
dw $14E8, $8829, $C888 ; column 1
dw $14E8, $8829, $A888 ; column 2
dw $C838, $C828, $C888 ; column 3
;===================================================================================================
; Adjustment stage 2: collision
AdjustEscapeDoorCollision:
LSR ; vanilla shift
; save our parameters
; but one or both of these may not be necessary depending on how you detect these doors
; all that matters is that after identifying blockage, we have:
; Y is the same as what we entered with
; X has A>>1, for whatever A entered with
PHA
LDA.w $1980, Y ; grab door info (type)
AND.w #$00FF
STA.b $0A ; store in temporary variable
JSR IdentifyBlockedEntrance
PLX ; this is a TAX in vanilla, just have X pull A instead
BCS .block_entrance
; vanilla value
LDA.b $00
RTL
.block_entrance
LDA.w #$0101 ; load tile type for solid collision
RTL
;===================================================================================================
; Enter with:
; $0A containing the door information: position and type bytes
; which should be from $1980, Y or [$B7], Y depending on where in the door process we are
; Exit with:
; carry clear - leave door alone
; carry set - block door
IdentifyBlockedEntrance:
LDA.l ProgressIndicator : AND.w #$00FF : CMP.w #$0002 : BCS .leave_alone ; only in rain states (0 or 1)
LDA.l ProgressFlags : AND.w #$0004 : BNE .leave_alone ; zelda's been rescued
LDA.l BlockSanctuaryDoorInRain : BEQ + ;flagged
LDA.b $A0 : CMP.w #$0012 : BNE +
; we're in the sanctuary
; this code could be removed because you can't reach sanc without zelda currently
; but that's enforced in the logic, so this is to catch that case in case some mode allows it
LDA.l FollowerIndicator : AND.w #$00FF : CMP.w #$0001 : BEQ .leave_alone ; zelda is following
LDA.b $0A
CMP.w #$000A : BCC .leave_alone
CMP.w #$0014 : BCS .leave_alone
.block_door
SEC : RTS
+ LDA.l BlockCastleDoorsInRain : AND.w #$00FF : BEQ .leave_alone
LDX #$FFFE
- INX #2
LDA.l RemoveRainDoorsRoom, X : CMP.w #$FFFF : BEQ .leave_alone
CMP $A0 : BNE -
LDA.b $0A
CMP.w #$000A : BCC .continue
CMP.w #$0014 : BCS .continue
BRA .block_door
.continue
BRA -
.leave_alone
CLC : RTS
;===================================================================================================

95
doorrando/gfx.asm Normal file
View File

@@ -0,0 +1,95 @@
GfxFixer:
{
lda.l DRMode : bne +
jsl LoadRoomHook ;this is the code we overwrote
jsl Dungeon_InitStarTileCh
jsl LoadTransAuxGfx_Alt
inc $b0
rtl
+ lda $b1 : bne .stage2
jsl LoadRoomHook ; this is the rando version - let's only call this guy once - may fix star tiles and slower loads
jsl Dungeon_InitStarTileCh
jsl LoadTransAuxGfx
jsl Dungeon_LoadCustomTileAttr
jsl PrepTransAuxGfx
lda.l DRMode : cmp #$02 : bne + ; only do this in crossed mode
ldx $a0 : lda.l TilesetTable, x
cmp $0aa1 : beq + ; already eq no need to decomp
sta $0aa1
tax : lda $02802e, x : tay
jsl DecompDungAnimatedTiles
+
lda #$09 : sta $17 : sta $0710
jsl Palette_SpriteAux3
jsl Palette_SpriteAux2
jsl Palette_SpriteAux1
jsl Palette_DungBgMain
jsr CgramAuxToMain
inc $b1
rtl
.stage2
lda #$0a : sta $17 : sta $0710
stz $b1 : inc $b0
rtl
}
FixAnimatedTiles:
LDA.L DRMode : CMP #$02 : BNE +
LDA $040C : CMP.b #$FF : BEQ +
PHX
LDX $A0 : LDA.l TilesetTable, x
CMP $0AA1 : beq ++
TAX : PLA : BRA +
++
PLX
+ LDA $02802E, X ; what we wrote over
RTL
FixCloseDungeonMap:
LDA.l DRMode : CMP #$02 : BNE .vanilla
LDA $040C : BMI .vanilla
LSR : TAX
LDA.l DungeonTilesets,x
RTL
.vanilla
LDA $7EC20E
RTL
FixWallmasterLamp:
ORA $0458
STY $1C : STA $1D : RTL ; what we wrote over
CgramAuxToMain: ; ripped this from bank02 because it ended with rts
{
rep #$20
ldx.b #$00
.loop
lda $7EC300, X : sta $7EC500, x
lda $7EC340, x : sta $7EC540, x
lda $7EC380, x : sta $7EC580, x
lda $7EC3C0, x : sta $7EC5C0, x
lda $7EC400, x : sta $7EC600, x
lda $7EC440, x : sta $7EC640, x
lda $7EC480, x : sta $7EC680, x
lda $7EC4C0, x : sta $7EC6C0, x
inx #2 : cpx.b #$40 : bne .loop
sep #$20
; tell NMI to upload new CGRAM data
inc $15
rts
}
OverridePaletteHeader:
lda.l DRMode : cmp #$02 : bne +
lda.l DRFlags : and #$20 : bne +
cpx #$01c2 : !bge +
rep #$20
txa : lsr : tax
lda.l PaletteTable, x
iny : rtl
+ rep #$20 : iny : lda [$0D], Y ; what we wrote over
rtl

299
doorrando/hudadditions.asm Normal file
View File

@@ -0,0 +1,299 @@
DrHudOverride:
{
jsl.l NewDrawHud
jsr HudAdditions
rtl
}
HudAdditions:
{
SEP #$10
LDA.l DRFlags : AND #$0008 : BNE + : JMP .end_item_count : +
LDA.l TotalItemCounter : PHA : CMP #1000 : !BLT +
JSL HexToDec4Digit_fast
LDX.b $04 : TXA : ORA.w #$2490 : STA !GOAL_DRAW_ADDRESS ; draw 1000's digit
BRA .skip
+ JSL HexToDec_fast
.skip
LDA #$207F : STA !GOAL_DRAW_ADDRESS+2 : STA !GOAL_DRAW_ADDRESS+4
PLA : PHA : CMP.w #100 : !BLT +
LDX.b $05 : TXA : ORA.w #$2490 : STA !GOAL_DRAW_ADDRESS+2 ; draw 100's digit
+ PLA : CMP.w #10 : !BLT +
LDX.b $06 : TXA : ORA.w #$2490 : STA !GOAL_DRAW_ADDRESS+4 ; draw 10's digit
+ LDX.b $07 : TXA : ORA.w #$2490 : STA !GOAL_DRAW_ADDRESS+6 ; draw 1's digit
LDA.w #$2830 : STA !GOAL_DRAW_ADDRESS+8 ; draw slash
LDA.l DRFlags : AND #$0100 : BNE +
LDA.l MultiClientFlagsWRAM+1 : CMP #1000 : !BLT .three_digit_goal
JSL HexToDec4Digit_fast
LDX.b $04 : TXA : ORA.w #$2490 : STA !GOAL_DRAW_ADDRESS+10 ; draw 1000's digit
LDX.b $05 : TXA : ORA.w #$2490 : STA !GOAL_DRAW_ADDRESS+12 ; draw 100's digit
LDX.b $06 : TXA : ORA.w #$2490 : STA !GOAL_DRAW_ADDRESS+14 ; draw 10's digit
LDX.b $07 : TXA : ORA.w #$2490 : STA !GOAL_DRAW_ADDRESS+16 ; draw 1's digit
BRA .end_item_count
.three_digit_goal
JSL HexToDec_fast
LDX.b $05 : TXA : ORA.w #$2490 : STA !GOAL_DRAW_ADDRESS+10 ; draw 100's digit
LDX.b $06 : TXA : ORA.w #$2490 : STA !GOAL_DRAW_ADDRESS+12 ; draw 10's digit
LDX.b $07 : TXA : ORA.w #$2490 : STA !GOAL_DRAW_ADDRESS+14 ; draw 1's digit
BRA .end_item_count
+ LDA.w #$2405 : STA !GOAL_DRAW_ADDRESS+10 : STA !GOAL_DRAW_ADDRESS+12
STA !GOAL_DRAW_ADDRESS+14 : STA !GOAL_DRAW_ADDRESS+16
.end_item_count
LDX $1B : BNE + ; if outdoors
lda.l OWMode : and.w #((!FLAG_OW_CROSSED+!FLAG_OW_MIXED)<<8)+$ff : bne ++ : rts ; Skip if vanilla ow rando
++ lda CurrentHealth : and #$00ff : beq ++
lda CurrentWorld : and #$00ff : beq +++
lda #$2d60 : bra .owdisplay
+++ lda #$2d68 : bra .owdisplay
++ lda #$207f
.owdisplay sta $7ec702 : rts
+ ldx $040c : cpx #$ff : bne + : rts : + ; Skip if not in dungeon
lda.l DRMode : bne + : rts : + ; Skip if not door rando
phb : phk : plb
lda CompassField : and.l $0098c0, x : beq +
lda.w CompassBossIndicator, x : and #$00ff : cmp $a0 : bne +
lda $1a : and #$0010 : beq +
lda #$345e : sta $7ec790 : bra .next
+ lda #$207f : sta $7ec790
.next lda.w DRMode : and #$0002 : bne + : plb : rts : +
lda CurrentHealth : and #$00ff : beq +
lda.w DungeonReminderTable, x : bra .reminder
+ lda #$207f
.reminder sta $7ec702
+ lda.w DRFlags : and #$0004 : beq .restore
; lda MapField : and.l $0098c0, x : beq .restore
txa : lsr : tax
lda.l GenericKeys : and #$00ff : bne +
lda DungeonCollectedKeys, x : jsr ConvertToDisplay : sta $7ec7a2
lda #$2830 : sta $7ec7a4
+
lda.w ChestKeys, x : jsr ConvertToDisplay : sta $7ec7a6
; todo 4b0 no longer in use
.restore
plb : rts
}
;column distance for BK/Smalls
HudOffsets:
; none hc east desert aga swamp pod mire skull ice hera tt tr gt
dw $fffe, $0000, $0006, $0008, $0002, $0010, $000e, $0018, $0012, $0016, $000a, $0014, $001a, $001e
; offset from 1644
RowOffsets:
dw $0000, $0000, $0040, $0080, $0000, $0080, $0040, $0080, $00c0, $0040, $00c0, $0000, $00c0, $0000
ColumnOffsets:
dw $0000, $0000, $0000, $0000, $000a, $000a, $000a, $0014, $000a, $0014, $0000, $0014, $0014, $001e
DrHudDungeonItemsAdditions:
{
jsl DrawHUDDungeonItems
lda.l HUDDungeonItems : and #$ff : bne + : rtl : +
lda.l DRMode : cmp #$02 : beq + : rtl : +
phx : phy : php
rep #$30
lda.w #$24f5 : sta $1606 : sta $1610 : sta $161a : sta $1624
sta $1644 : sta $164a : sta $1652 : sta $1662 : sta $1684 : sta $16c4
ldx #$0000
- sta $1704, x : sta $170e, x : sta $1718, x
inx #2 : cpx #$0008 : !blt -
lda HudFlag : and.w #$0020 : beq + : JMP ++ : +
lda HUDDungeonItems : and.w #$0007 : bne + : JMP ++ : +
; bk symbols
lda.w #$2811 : sta $1606 : sta $1610 : sta $161a : sta $1624
; sm symbols
lda.w #$2810 : sta $160a : sta $1614 : sta $161e : sta $16e4
; blank out stuff
lda.w #$24f5 : sta $1724
ldx #$0002
- lda #$0000 : !addl RowOffsets,x : !addl ColumnOffsets, x : tay
lda.l DungeonReminderTable, x : sta $1644, y : iny #2
lda.w #$24f5 : sta $1644, y
lda MapField : and.l $0098c0, x : beq + ; must have map
jsr BkStatus : sta $1644, y : bra .smallKey ; big key status
+ lda BigKeyField : and.l $0098c0, x : beq .smallKey
lda.w #$2826 : sta $1644, y
.smallKey
+ iny #2
cpx #$001a : bne +
tya : !add #$003c : tay
+ stx $00
txa : lsr : tax
lda.w #$24f5 : sta $1644, y
lda.l GenericKeys : and #$00FF : bne +
lda.l DungeonKeys, x : and #$00FF : beq +
jsr ConvertToDisplay2 : sta $1644, y
+ iny #2 : lda.w #$24f5 : sta $1644, y
phx : ldx $00
; lda MapField : and.l $0098c0, x : beq + ; must have map
plx : sep #$30 : lda.l ChestKeys, x : sta $02
lda.l GenericKeys : bne +++
lda $02 : !sub DungeonCollectedKeys, x : sta $02
+++ lda $02
rep #$30
jsr ConvertToDisplay2 : sta $1644, y ; small key totals
bra .skipStack
+ plx
.skipStack iny #2
cpx #$000d : beq +
lda.w #$24f5 : sta $1644, y
+
ldx $00
+ inx #2 : cpx #$001b : bcs ++ : JMP -
++
lda HudFlag : and.w #$0020 : bne + : JMP ++ : +
lda HUDDungeonItems : and.w #$000c : bne + : JMP ++ : +
; map symbols (do I want these) ; note compass symbol is 2c20
lda.w #$2821 : sta $1606 : sta $1610 : sta $161a : sta $1624
; blank out a couple thing from old hud
lda.w #$24f5 : sta $16e4 : sta $1724
sta $160a : sta $1614 : sta $161e ; blank out sm key indicators
ldx #$0002
- lda #$0000 ; start of hud area
!addl RowOffsets, x : !addl ColumnOffsets, x : tay
lda.l DungeonReminderTable, x : sta $1644, y
iny #2
lda.w #$24f5 : sta $1644, y ; blank out map spot
lda MapField : and.l $0098c0, x : beq + ; must have map
JSR MapIndicatorShort : STA $1644, Y
+ iny #2
cpx #$001a : bne +
tya : !add #$003c : tay
+ lda CompassField : and.l $0098c0, x : beq + ; must have compass
phx ; total chest counts
txa : lsr : tax
sep #$30
lda.l TotalLocations, x : !sub DungeonLocationsChecked, x : JSR HudHexToDec2DigitCopy
rep #$30
lda $06 : jsr ConvertToDisplay2 : sta $1644, y : iny #2
lda $07 : jsr ConvertToDisplay2 : sta $1644, y
plx
bra .skipBlanks
+ lda.w #$24f5 : sta $1644, y : iny #2 : sta $1644, y
.skipBlanks iny #2
cpx #$001a : beq +
lda.w #$24f5 : sta $1644, y ; blank out spot
+ inx #2 : cpx #$001b : !bge ++ : JMP -
++
plp : ply : plx : rtl
}
MapIndicatorLong:
PHX
LDA.l OldHudToNewHudTable, X : TAX
JSR MapIndicator
PLX
RTL
MapIndicatorShort:
PHX
TXA : LSR : TAX
JSR MapIndicator
PLX
RTS
OldHudToNewHudTable:
dw 1, 2, 3, 10, 4, 6, 5, 8, 11, 9, 7, 12, 13
IndicatorCharacters:
; check 1 2 3 4 5 6 7 G B R
dw $2426, $2817, $2818, $2819, $281A, $281B, $281C, $281D, $2590, $258B, $259B
MapIndicator:
LDA.l CrystalPendantFlags_3, X : AND #$00FF
PHX
ASL : TAX : LDA.l IndicatorCharacters, X
PLX
RTS
BkStatus:
lda BigKeyField : and.l $0098c0, x : bne +++ ; has the bk already
lda.l BigKeyStatus, x : bne ++
lda #$2827 : rts ; 0/O for no BK
++ cmp #$0002 : bne +
lda #$2420 : rts ; symbol for BnC
+ lda #$24f5 : rts ; black otherwise
+++ lda #$2826 : rts ; check mark
ConvertToDisplay:
and.w #$00ff : cmp #$000a : !blt +
!add #$2553 : rts
+ !add #$2490 : rts
ConvertToDisplay2:
and.w #$00ff : beq ++
cmp #$000a : !blt +
!add #$2553 : rts ; 2580 with 258A as "A" for non transparent digits
+ !add #$2816 : rts
++ lda #$2827 : rts ; 0/O for 0 or placeholder digit ;2483
CountAbsorbedKeys:
jsl IncrementSmallKeysNoPrimary : phx
lda $040c : cmp #$ff : beq +
lsr : tax
lda DungeonAbsorbedKeys, x : inc : sta DungeonAbsorbedKeys, x
+ plx : rtl
;================================================================================
; 16-bit A, 8-bit X
; in: A(b) - Byte to Convert
; out: $04 - $07 (high - low)
;================================================================================
HudHexToDec4DigitCopy:
LDY.b #$90
-
CMP.w #1000 : !BLT +
INY
SBC.w #1000 : BRA -
+
STY $04 : LDY #$90 ; Store 1000s digit & reset Y
-
CMP.w #100 : !BLT +
INY
SBC.w #100 : BRA -
+
STY $05 : LDY #$90 ; Store 100s digit & reset Y
-
CMP.w #10 : !BLT +
INY
SBC.w #10 : BRA -
+
STY $06 : LDY #$90 ; Store 10s digit & reset Y
CMP.w #1 : !BLT +
-
INY
DEC : BNE -
+
STY $07 ; Store 1s digit
RTS
;================================================================================
; 8-bit registers
; in: A(b) - Byte to Convert
; out: $06 - $07 (high - low)
;================================================================================
HudHexToDec2DigitCopy: ; modified
PHY
LDY.b #$00
-
CMP.b #10 : !BLT +
INY
SBC.b #10 : BRA -
+
STY $06 : LDY #$00 ; Store 10s digit and reset Y
CMP.b #1 : !BLT +
-
INY
DEC : BNE -
+
STY $07 ; Store 1s digit
PLY
RTS

42
doorrando/keydoors.asm Normal file
View File

@@ -0,0 +1,42 @@
; code to un-pair or re-pair doors
; doorlist is loaded into 19A0 but no terminator
; new room is in A0
; for "each" door do the following: (each could mean the first four doors?)
; in lookup table, grab room and corresponding position
; find the info at 7ef000, x where x is twice the paired room
; check the corresponding bit (there are only 4)
; set the bit in 068C
; Note the carry bit is used to indicate if we should aborted (set) or not
CheckIfDoorsOpen: {
jsr TrapDoorFixer ; see normal.asm
; note we are 16bit mode right now
lda.l DRMode : beq +
lda $040c : cmp #$00ff : bne .gtg
+ lda $a0 : dec : tax : and #$000f ; hijacked code
sec : rtl ; set carry to indicate normal behavior
.gtg
phb : phk : plb
stx $00 : ldy #$0000
.nextDoor
lda $a0 : asl : tax
lda.w KeyDoorOffset, x : beq .skipDoor
asl : sty $05 : !add $05 : tax
lda.w PairedDoorTable, x : beq .skipDoor
sta $02 : and #$00ff : asl a : tax
lda $02 : and #$ff00 : sta $03
lda RoomDataWRAM.l, X : and #$f000 : and $03 : beq .skipDoor
tyx : lda $068c : ora $0098c0,x : sta $068c
.skipDoor
iny #2 : cpy $00 : bne .nextDoor
plb : clc : rtl
}
; outstanding issues
; how to indicate opening for other (non-first four doors?)
; Bank01 Door Register stores the 4 bits in 068c to 400 (depending on type)
; Key collision and others depend on F0-F3 attribute not sure if extendable to other numbers
; Dungeon_ProcessTorchAndDoorInteractives.isOpenableDoor is the likely culprit for collision problems
; Saving open status to other unused rooms is tricky -- Bank 2 13947 (line 8888)

66
doorrando/math.asm Normal file
View File

@@ -0,0 +1,66 @@
;divide by 2 example
; 0 1 2 3 4 5 6 7 8 9 a b c d e f 10--Offset Ruler
;v 00 01 01 02 02 03 03 04 04 04 05 05 06 06 07 07 08
;divide by 3 example
; 0 1 2 3 4 5 6 7 8 9 a b c d e f 10 11 12 13 14 15 16 17 18
;00 00 01 01 01 02 02 02 03 03 03 04 04 04 05 05 05 06 06 06 07 07 07 08 08
MultiplyByY:
.loop cpy #$0001 : beq .done
cpy #$0003 : bne ++
jsr MultiBy3 : bra .done
++ cpy #$0005 : bne ++
jsr MultiBy5 : bra .done
++ asl : sta $00 : tya : lsr : tay : lda $00 : bra .loop
.done rts
;Divisor in Y. Width of division is in X for rounding toward middle
DivideByY:
.loop
cpy #$0000 : beq .done
cpy #$0001 : beq .done
cpy #$0003 : bne ++
jsr DivideBy3 : bra .done
++ cpy #$0005 : bne ++
jsr DivideBy5 : bra .done
++ jsr DivideBy2 : sta $00
tya : lsr : tay
txa : lsr : tax
lda $00 : bra .loop
.done rts
MultiBy3:
sta $00 : asl : !add $00
rts
MultiBy5:
sta $00 : asl #2 : !add $00
rts
;width of divison in x: rounds toward X/2
DivideBy2:
sta $00
lsr : bcc .done
sta $02 : txa : lsr : cmp $00 : !blt +
lda $02 : inc : bra .done
+ lda $02
.done rts
DivideBy3:
sta $00
ldx #$0000
lda #$0002
.loop cmp $00 : !bge .store
inx : !add #$0003 : bra .loop
.store txa
rts
DivideBy5:
sta $00
ldx #$0000
lda #$0003
.loop cmp $00 : !bge .store
inx : !add #$0005 : bra .loop
.store txa
rts

440
doorrando/normal.asm Normal file
View File

@@ -0,0 +1,440 @@
WarpLeft:
lda.l DRMode : beq .end
lda $040c : cmp.b #$ff : beq .end
lda $20 : ldx $aa
jsr CalcIndex
!add #$06 : ldy #$01 ; offsets in A, Y
jsr LoadRoomHorz
.end
jsr Cleanup
rtl
WarpRight:
lda.l DRMode : beq .end
lda $040c : cmp.b #$ff : beq .end
lda $20 : ldx $aa
jsr CalcIndex
!add #$12 : ldy #$ff ; offsets in A, Y
jsr LoadRoomHorz
.end
jsr Cleanup
rtl
WarpUp:
lda.l DRMode : beq .end
lda $040c : cmp.b #$ff : beq .end
lda $22 : ldx $a9
jsr CalcIndex
ldy #$02 ; offsets in A, Y
jsr LoadRoomVert
.end
jsr Cleanup
rtl
; Checks if $a0 is equal to <Room>. If it is, opens its stonewall if it's there
macro StonewallCheck(Room)
lda $a0 : cmp.b #<Room> : bne ?end
lda.l <Room>*2+$7ef000 : ora #$80 : sta.l <Room>*2+$7ef000
?end
endmacro
WarpDown:
lda.l DRMode : beq .end
lda $040c : cmp.b #$ff : beq .end
lda $22 : ldx $a9
jsr CalcIndex
!add #$0c : ldy #$ff ; offsets in A, Y
jsr LoadRoomVert
%StonewallCheck($43)
.end
jsr Cleanup
rtl
; carry set = use link door like normal
; carry clear = we are in dr mode, never use linking doors
CheckLinkDoorR:
lda.l DRMode : bne +
lda $7ec004 : sta $a0 ; what we wrote over
sec : rtl
+ clc : rtl
CheckLinkDoorL:
lda.l DRMode : bne +
lda $7ec003 : sta $a0 ; what we wrote over
sec : rtl
+ clc : rtl
TrapDoorFixer:
lda $fe : and #$0038 : beq .end
xba : asl #2 : sta $00
stz $0468 : lda $068c : ora $00 : sta $068c
.end
stz $fe ; clear our fe here because we don't need it anymore
rts
Cleanup:
lda.l DRFlags : and #$10 : beq +
stz $047a
+ inc $11
lda $ef
rts
;A needs be to the low coordinate, x needs to be either 0 for left,upper or non-zero for right,down
; This sets A (00,02,04) and stores half that at $04 for later use, (src door)
CalcIndex: ; A->low byte of Link's Coord, X-> Link's quadrant, DoorOffset x 2 -> A, DoorOffset -> $04 (vert/horz agnostic)
cpx.b #00 : bne .largeDoor
cmp.b #$d0 : bcc .smallDoor
lda #$01 : bra .done ; Middle Door
.smallDoor lda #$00 : bra .done
.largeDoor lda #$02
.done
sta $04
asl
rts
; Y is an adjustment for main direction of travel
; A is a door table row offset
LoadRoomHorz:
{
phb : phk : plb
sty $06 : sta $07 : lda $a0 : pha ; Store normal room on stack
lda $07 : jsr LookupNewRoom ; New room is in A, Room Data is in $00-$01
lda $00 : cmp #$03 : bne .gtg
jsr HorzEdge : pla : bcs .end
sta $a0 : bra .end ; Restore normal room, abort (straight staircases and open edges can get in this routine)
.gtg ;Good to Go!
pla ; Throw away normal room (don't fill up the stack)
lda $a0 : and.b #$0F : asl a : !sub $23 : !add $06 : sta $02
ldy #$00 : jsr ShiftVariablesMainDir
lda $01 : and #$80 : beq .normal
ldy $06 : cpy #$ff : beq +
lda $01 : jsr LoadEastMidpoint : bra ++
+ lda $01 : jsr LoadWestMidpoint
++ jsr PrepScrollToEdge : bra .scroll
.normal
jsr PrepScrollToNormal
.scroll
lda $01 : and #$40 : pha
jsr ScrollY
pla : beq .end
ldy #$06 : jsr ApplyScroll
.end
plb ; restore db register
rts
}
; Y is an adjustment for main direction of travel (stored at $06)
; A is a door table row offset (stored a $07)
LoadRoomVert:
{
phb : phk : plb
sty $06 : sta $07 : lda $a0 : pha ; Store normal room on stack
lda $07 : jsr LookupNewRoom ; New room is in A, Room Data is in $00-$01
lda $00 : cmp #$03 : bne .gtg
jsr VertEdge : pla : bcs .end
sta $a0 : bra .end ; Restore normal room, abort (straight staircases and open edges can get in this routine)
.gtg ;Good to Go!
pla ; Throw away normal room (don't fill up the stack)
lda $a0 : and.b #$F0 : lsr #3 : !sub $21 : !add $06 : sta $02
lda $01 : and #$80 : beq .notEdge
ldy #$01 : jsr ShiftVariablesMainDir
ldy $06 : cpy #$ff : beq +
lda $01 : jsr LoadSouthMidpoint : bra ++
+ lda $01 : jsr LoadNorthMidpoint
++ jsr PrepScrollToEdge : bra .scroll
.notEdge
lda $01 : and #$03 : cmp #$03 : bne .normal
jsr ScrollToInroomStairs
stz $046d
bra .end
.normal
ldy #$01 : jsr ShiftVariablesMainDir
jsr PrepScrollToNormal
.scroll
lda $01 : and #$40 : sta $046d
jsr ScrollX
.end
plb ; restore db register
rts
}
LookupNewRoom: ; expects data offset to be in A
{
rep #$30 : and #$00FF ;sanitize A reg (who knows what is in the high byte)
sta $00 ; offset in 00
lda $a2 : tax ; probably okay loading $a3 in the high byte
lda.w DoorOffset,x : and #$00FF ;we only want the low byte
asl #3 : sta $02 : !add $02 : !add $02 ;multiply by 24 (data size)
!add $00 ; should now have the offset of the address I want to load
tax : lda.w DoorTable,x : sta $00
and #$00FF : sta $a0 ; assign new room
sep #$30
rts
}
; INPUTS-- Y: Direction Index , $02: Shift Value
; Sets high bytes of various registers
ShiftVariablesMainDir:
{
lda.w CoordIndex,y : tax
lda $21,x : !add $02 : sta $21,x ; coordinate update
lda.w CameraIndex,y : tax
lda $e3,x : !add $02 : sta $e3,x ; scroll register high byte
lda.w CamQuadIndex,y : tax
lda $0605,x : !add $02 : sta $0605,x ; high bytes of these guys
lda $0607,x : !add $02 : sta $0607,x
lda $0601,x : !add $02 : sta $0601,x
lda $0603,x : !add $02 : sta $0603,x
rts
}
; Normal Flags should be in $01
ScrollToInroomStairs:
{
jsr PrepScrollToInroomStairs
ldy #$01 : jsr ShiftVariablesMainDir
jsr ScrollX
ldy #$00 : jsr ApplyScroll
lda $a0 : and #$0f : cmp #$0f : bne +
stz $e0 : stz $e2 ; special case camera fix
lda #$1f : sta $e1 : sta $e3
+
rts
}
; Direction should be in $06, Shift Value (see above) in $02 and other info in $01
; Sets $02, $04, $05, $ee, $045e, $045f and things related to Y coordinate
PrepScrollToInroomStairs:
{
lda $01 : and #$30 : lsr #3 : tay
lda.w InroomStairsX,y : sta $04
lda.w InroomStairsX+1,y : sta $05
lda $06 : cmp #$ff : beq .south
lda.w InroomStairsY+1,y : bne +
inc $045f ; flag indicating special screen transition
dec $02 ; shift variables further
stz $aa
lda $a8 : and #%11111101 : sta $a8
stz $0613 ; North scroll target
inc $0603 : inc $0607
dec $0619 : dec $061b
+
lda.w InroomStairsY,y : !add #$20 : sta $20
!sub #$38 : sta $045e
lda $01 : and #$40 : beq +
lda $20 : !add #$20 : sta $20
stz $045f
+
dec $21
%StonewallCheck($1b)
bra ++
.south
lda.w InroomStairsY+1,y : beq +
inc $045f ; flag indicating special screen transition
inc $02 ; shift variables further
lda #$02 : sta $aa
lda $a8 : ora #%00000010 : sta $a8
inc $0611 ; South scroll target
dec $0603 : dec $0607
inc $0619 : inc $061b
+
lda.w InroomStairsY,y : !sub #$20 : sta $20
!add #$38 : sta $045e
lda $01 : and #$40 : beq +
lda $20 : !sub #$20 : sta $20
stz $045f
+
inc $21
++
lda $01 : and #$04 : lsr #2 : sta $ee : bne +
stz $0476
+ rts
}
; Target pixel should be in A, other info in $01
; Sets $04 $05 and $ee
PrepScrollToEdge:
{
sta $04 : lda $01 : and #$20 : beq +
lda #01
+ sta $05
lda $01 : and #$10 : beq +
lda #01
+ sta $ee : bne +
stz $0476
+ rts
}
; Normal Flags should be in $01
; Sets $04 $05 and $ee, and $fe
PrepScrollToNormal:
{
lda $01 : sta $fe : and #$04 : lsr #2 : sta $ee ; trap door and layer
bne +
stz $0476
+ stz $05 : lda #$78 : sta $04
lda $01 : and #$03 : beq .end
cmp #$02 : !bge +
lda #$f8 : sta $04 : bra .end
+ inc $05
.end rts
}
StraightStairsAdj:
{
stx $0464 : sty $012e ; what we wrote over
lda.l DRMode : beq +
lda $045e : bne .toInroom
lda $046d : beq .noScroll
sta $22
ldy #$00 : jsr ApplyScroll
stz $046d
.noScroll
jsr GetTileAttribute : tax
lda $11 : cmp #$12 : beq .goingNorth
lda $a2 : cmp #$51 : bne ++
rep #$20 : lda #$0018 : !add $20 : sta $20 : sep #$20 ; special fix for throne room
jsr GetTileAttribute : tax
++ lda.l StepAdjustmentDown, X : bra .end
; lda $ee : beq .end
; rep #$20 : lda #$ffe0 : !add $20 : sta $20 : sep #$20
.goingNorth
cpx #$00 : bne ++
lda $a0 : cmp #$51 : bne ++
lda #$36 : bra .end ; special fix for throne room
++ ldy $ee : cpy #$00 : beq ++
inx
++ lda.l StepAdjustmentUp, X
.end
pha : lda $0462 : and #$04 : bne ++
pla : !add #$f6 : pha
++ pla : !add $0464 : sta $0464
+ rtl
.toInroom
lda #$32 : sta $0464 : stz $045e
rtl
}
GetTileAttribute:
{
phk : pea.w .jslrtsreturn-1
pea.w $02802c
jml CalculateTransitionLanding ; mucks with x/y sets a to Tile Attribute, I think
.jslrtsreturn
rts
}
; 0 open edge
; 1 nrm door high
; 2 straight str
; 3 nrm door low
; 4 trap door high
; 5 trap door low (none of these exist on North direction)
StepAdjustmentUp: ; really North Stairs
db $00, $f6, $1a, $18, $16, $38
StepAdjustmentDown: ; really South Stairs
db $d0, $f6, $10, $1a, $f0, $00
StraightStairsFix:
{
pha
lda.l DRMode : bne +
pla : !add $20 : sta $20 : rtl ;what we wrote over
+ pla : rtl
}
StraightStairLayerFix:
{
lda.l DRMode : beq +
lda $ee : rtl
+ lda $01c322, x : rtl ; what we wrote over
}
DoorToStraight:
{
pha
lda.l DRMode : beq .skip
pla : bne .end
pha
lda $a0 : cmp #$51 : bne .skip
lda #$04 : sta $4e
.skip pla
; the ldx $0418 is now taken care of by TransitionCalculateLanding_Fix
.end cmp #$02 ;what we wrote over
rtl
}
DoorToInroom:
{
ldx $045e : bne .end
sta $0020, y ; what we wrote over
.end
ldx #$00 ; what we wrote over
rtl
}
DoorToInroomEnd:
{
ldy $045e : beq .vanilla
cmp $045e : bne .return
stz $045e ; clear
.return
rtl
.vanilla
cmp $02c034, x ; what we wrote over
rtl
}
StraightStairsTrapDoor:
{
lda $0464 : bne +
; reset function
.reset phk : pea.w .jslrtsreturn-1
pea.w $02802c
jml $028c73 ; $10D71 .reset label of Bank02
.jslrtsreturn
lda $0468 : bne ++
lda $a0 : cmp.b #$ac : bne .animateTraps
lda $0403 : and.b #$20 : bne .animateTraps
lda $0403 : and.b #$10 : beq ++
.animateTraps
lda #$05 : sta $11
inc $0468 : stz $068e : stz $0690
++ JSL Underworld_DoorDown_Call : rtl
+ JML Dungeon_ApproachFixedColor ; what we wrote over
}
InroomStairsTrapDoor:
{
lda $0200 : cmp #$05 : beq .reset
lda $b0 : jml $008781 ; what we wrote over (essentially)
.reset
pla : pla : pla
jsl StraightStairsTrapDoor_reset
jml $028b15 ; just some RTS in bank 02
}
HandleSpecialDoorLanding: {
LDA.l $7F2000,X ; what we wrote over
SEP #$30
; A = tiletype
HandleIncomingDoorState:
PHA
LDA.l DRMode : BEQ .noDoor
PLA : PHA : AND.b #$FA : CMP.b #$80 : bne .noDoor
.setDoorState
LDA.w $0418 : AND.b #$02 : BNE + : INC
+ STA.b $6C
.noDoor
PLA
CMP #$34 : bne + ; inroom stairs
PHA : LDA #$26 : STA $045E : PLA
+ RTL
}

131
doorrando/overrides.asm Normal file
View File

@@ -0,0 +1,131 @@
GtBossHeartCheckOverride:
lda $a0 : cmp #$1c : beq ++
cmp #$6c : beq ++
cmp #$4d : bne +
++ lda.l DRFlags : and #$01 : bne ++ ;skip if flag on
lda $403 : ora #$80 : sta $403
++ clc
rtl
+ sec
rtl
OnFileLoadOverride:
jsl OnFileLoad ; what I wrote over
+ lda.l DRFlags : and #$02 : beq + ; Mirror Scroll
lda MirrorEquipment : bne +
lda #$01 : sta MirrorEquipment
+ rtl
MirrorCheckOverride:
lda.l DRFlags : and #$02 : beq ++
lda MirrorEquipment : cmp #$01 : beq +
;++ lda $8A : and #$40 ; what I wrote over
++ phx : ldx $8A : lda.l OWTileWorldAssoc,x : plx : and.b #$ff
rtl
+ lda.l DRScroll : rtl
EGFixOnMirror:
lda.l DRFlags : and #$10 : beq +
stz $047a
+ jsl Mirror_SaveRoomData
rtl
BlockEraseFix:
lda MirrorEquipment : and #$02 : beq +
stz $05fc : stz $05fd
+ rtl
FixShopCode:
cpx #$300 : !bge +
sta RoomDataWRAM[$00].l, x
+ rtl
VitreousKeyReset:
lda.l DRMode : beq +
stz $0cba, x
+ JML $0db818 ;restore old code
GuruguruFix:
lda $a0 : cmp #$df : !bge +
and #$0f : cmp #$0e : !blt +
iny #2
+ rtl
BlindAtticFix:
lda.l DRMode : beq +
lda #$01 : rtl
+ lda FollowerIndicator : cmp.b #$06
rtl
SuctionOverworldFix:
stz $50 : stz $5e
lda.l DRMode : beq +
stz $49
+ rtl
!CutoffTable = "$27E000"
CutoffEntranceRug:
PHA : PHX
LDA.l DRMode : BEQ .norm
LDA $04 : cmp #$000A : BEQ + ; only affect A & C objects
cmp #$000C : BNE .norm
+ LDX #$0000 : LDA !CutoffTable, x
- CMP.W $A0 : BEQ .check
INX #2 : LDA !CutoffTable, x : CMP.w #$FFFF : BNE -
.norm PLX : PLA : LDA $9B52, y : STA $7E2000, x ; what we wrote over
RTL
.check
LDA $0c : CMP #$0004 : !BGE .skip
LDA $0e : CMP #$0008 : !BGE .skip
CMP.l #$0004 : !BLT .skip
BRA .norm
.skip PLX : PLA : RTL
StoreTempBunnyState:
LDA $5D : CMP #$1C : BNE +
STA $5F
+ LDA #$15 : STA $5D ; what we wrote over
RTL
RetrieveBunnyState:
STY $5D : STZ $02D8 ; what we wrote over
LDA $5F : BEQ +
STA $5D
+ RTL
; A should be how much dmg to do to Aga when leaving this function
StandardAgaDmg:
LDX.b #$00 ; part of what we wrote over
LDA.l ProgressFlags : AND #$04 : BEQ + ; zelda's not been rescued
LDA.b #$10 ; hurt him!
+ RTL ; A is zero if the AND results in zero and then Agahnim's invincible!
StandardSaveAndQuit:
LDA.b #$0F : STA.b $95 ; what we wrote over
LDA.l ProgressFlags : AND #$04 : BNE +
LDA.l DRMode : BEQ +
LDA.l StartingEntrance : CMP.b #$02 : BCC +
LDA.b #$03 : STA.l StartingEntrance ; set spawn to uncle if >=
+ RTL
; note: this skips both maiden dialog triggers if the hole is open
BlindsAtticHint:
REP #$20
CMP.w #$0122 : BNE +
LDA RoomDataWRAM[$65].low : AND.w #$0100 : BEQ +
SEP #$20 : RTL ; skip the dialog box if the hole is already open
+ SEP #$20 : JML Main_ShowTextMessage
BlindZeldaDespawnFix:
CMP.b #06 : BEQ +
LDA.w $0D00,X : BEQ + ; don't despawn follower if maiden isn't "present"
PLA : PLA : PEA.w SpritePrep_BlindMaiden_despawn_follower-1 : RTL
+ PLA : PLA : PEA.w SpritePrep_BlindMaiden_kill_the_girl-1 : RTL
BigKeyDoorCheck:
CPY.w #$001E : BNE + ; skip if it isn't a BK door
LDA.l DRFlags : AND #$0400 : BNE + ; skip if the flag is set - bk doors can be double-sided
PLA : PEA.w RoomDraw_OneSidedShutters_South_onesided_shutter_or_big_key_door-1
+ LDA.w #$0000 : RTL

222
doorrando/scroll.asm Normal file
View File

@@ -0,0 +1,222 @@
AdjustTransition:
{
lda $ab : and #$01ff : beq .reset
phy : ldy #$06 ; operating on vertical registers during horizontal trans
cpx.b #$02 : bcs .horizontalScrolling
ldy #$00 ; operate on horizontal regs during vert trans
.horizontalScrolling
cmp #$0008 : bcs +
pha : lda $ab : and #$0200 : beq ++
pla : bra .add
++ pla : eor #$ffff : inc ; convert to negative
.add jsr AdjustCamAdd : ply : bra .reset
+ lda $ab : and #$0200 : xba : tax
lda.l OffsetTable,x : jsr AdjustCamAdd
lda $ab : !sub #$0008 : sta $ab
ply : bra .done
.reset ; clear the $ab variable so to not disturb intra-tile doors
stz $ab
.done
lda $00 : and #$01fc
rtl
}
AdjustCamAdd:
!add $00E2,y : pha
and #$01ff : cmp #$0111 : !blt +
cmp #$01f8 : !bge ++
pla : and #$ff10 : pha : bra +
++ pla : and #$ff00 : !add #$0100 : pha
+ pla : sta $00E2,y : sta $00E0,y : rts
; expects target quad in $05 (either 0 or 1) and target pixel in $04, target room should be in $a0
; $06 is either $ff or $01/02
; uses $00-$03 and $0e for calculation
; also set up $ac
ScrollY: ;change the Y offset variables
lda $a0 : and.b #$f0 : lsr #3 : sta $0603 : inc : sta $0607
lda $05 : bne +
lda $603 : sta $00 : stz $01 : bra ++
+ lda $607 : sta $00 : lda #$02 : sta $01
++ ; $01 now contains 0 or 2 and $00 contains the correct lat
stz $0e
rep #$30
lda $00 : pha
lda $e8 : and #$01ff : sta $02
lda $04 : jsr LimitYCamera : sta $00
jsr CheckRoomLayoutY : bcc +
lda $00 : cmp #$0080 : !bge ++
cmp #$0010 : !blt .cmpSrll
lda #$0010 : bra .cmpSrll
++ cmp #$0100 : !bge .cmpSrll
lda #$0100
.cmpSrll sta $00
; figures out scroll amt
+ lda $00 : cmp $02 : bne +
lda #$0000 : bra .next
+ !blt +
!sub $02 : inc $0e : bra .next
+ lda $02 : !sub $00
.next
sta $ab
jsr AdjustCameraBoundsY
pla : sta $00
sep #$30
lda $04 : sta $20
lda $00 : sta $21 : sta $0601 : sta $0605
lda $01 : sta $aa
lda $0e : asl : ora $ac : sta $ac
lda $e9 : and #$01 : asl #2 : tax : lda $0603, x : sta $e9
rts
LimitYCamera:
cmp #$006c : !bge +
lda #$0000 : bra .end
+ cmp #$017d : !blt +
lda #$0110 : bra .end
+ !sub #$006c
.end rts
CheckRoomLayoutY:
jsr LoadRoomLayout ;switches to 8-bit
cmp #$00 : beq .lock
cmp #$07 : beq .free
cmp #$01 : beq .free
cmp #$04 : !bge .lock
cmp #$02 : bne +
lda $06 : cmp #$ff : beq .lock
+ cmp #$03 : bne .free
lda $06 : cmp #$ff : bne .lock
.free rep #$30 : clc : rts
.lock rep #$30 : sec : rts
AdjustCameraBoundsY:
jsr CheckRoomLayoutY : bcc .free
; layouts that are camera locked (quads only)
lda $04 : and #$00ff : cmp #$007d : !blt +
lda #$0088 : bra ++
+ cmp #$006d : !bge +
lda #$0078 : bra ++
+ !add #$000b
; I think we no longer need the $02 variable
++ sta $02 : lda $04 : and #$0100 : !add $02 : bra .setBounds
; layouts where the camera is free
.free lda $04 : cmp #$006c : !bge +
lda #$0077 : bra .setBounds
+ cmp #$017c : !blt +
lda #$0187 : bra .setBounds
+ !add #$000b
.setBounds sta $0618 : inc #2 : sta $061a
rts
LoadRoomLayout:
lda $a0 : asl : !add $a0 : tax
lda $1f8001, x : sta $b8
lda $1f8000, x : sta $b7
sep #$30
ldy #$01 : lda [$b7], y : and #$1c : lsr #2
rts
; expects target quad in $05 (either 0 or 1) and target pixel in $04, target room should be in $a0
; uses $00-$03 and $0e for calculation
; also set up $ac
ScrollX: ;change the X offset variables
lda $a0 : and.b #$0f : asl : sta $060b : inc : sta $060f
lda $05 : bne +
lda $60b : sta $00 : stz $01 : bra ++
+ lda $60f : sta $00 : lda #$01 : sta $01
++ ; $01 now contains 0 or 1 and $00 contains the correct long
stz $0e ; pos/neg indicator
rep #$30
lda $00 : pha
lda $e2 : and #$01ff : sta $02
lda $04 : jsr LimitXCamera : sta $00
jsr CheckRoomLayoutX : bcc +
lda $00 : cmp #$0080 : !bge ++
lda #$0000 : bra .cmpSrll
++ lda #$0100
.cmpSrll sta $00
;figures out scroll amt
+ lda $00 : cmp $02 : bne +
lda #$0000 : bra .next
+ !blt +
!sub $02 : inc $0e : bra .next
+ lda $02 : !sub $00
.next
sta $ab : lda $04
cmp #$0078 : !bge +
lda #$007f : bra ++
+ cmp #$0178 : !blt +
lda #$017f : bra ++
+ !add #$0007
++ sta $061c : inc #2 : sta $061e
pla : sta $00
sep #$30
lda $04 : ldx $046d : bne .straight
sta $22 : bra +
.straight
sta $046d ; set X position later
+
lda $00 : sta $23 : sta $0609 : sta $060d
lda $01 : sta $a9
lda $0e : asl : ora $ac : sta $ac
lda $e3 : and #$01 : asl #2 : tax : lda $060b, x : sta $e3
rts
LimitXCamera:
cmp #$0079 : !bge +
lda #$0000 : bra .end
+ cmp #$0178 : !blt +
lda #$0178
+ !sub #$0078
.end rts
CheckRoomLayoutX:
jsr LoadRoomLayout ;switches to 8-bit
cmp #$04 : !blt .lock
cmp #$05 : bne +
lda $06 : cmp #$ff : beq .lock
+ cmp #$06 : bne .free
lda $06 : cmp #$ff : bne .lock
.free rep #$30 : clc : rts
.lock rep #$30 : sec : rts
ApplyScroll:
rep #$30
lda $ab : and #$01ff : sta $00
lda $ab : and #$0200 : beq +
lda $00e2, y : !add $00 : bra .end
+ lda $00e2, y : !sub $00
.end
sta $00e2, y
sta $00e0, y
stz $ab : sep #$30 : rts
QuadrantLoadOrderBeforeScroll:
lda $045f : beq .end
lda #$08 : sta $045c ; start with opposite quadrant row
.end
JML $0091c4 ; what we overwrote
QuadrantLoadOrderAfterScroll:
lda $045f : beq .end
stz $045c : stz $045f ; draw other row and clear flag
.end
JML $0091c4 ; what we overwrote

329
doorrando/spiral.asm Normal file
View File

@@ -0,0 +1,329 @@
RecordStairType: {
pha
lda.l DRMode : beq .norm
lda $040c : cmp #$ff : beq .norm
lda $0e
cmp #$25 : bcc ++ ; don't record straight staircases
sta $045e
++ pla : bra +
.norm pla : sta $a0
+ lda $063d, x
rtl
}
SpiralWarp: {
lda.l DRMode : beq .abort ; abort if not DR
lda $040c : cmp.b #$ff : beq .abort ; abort if not in dungeon
lda $045e : cmp #$5e : beq .gtg ; abort if not spiral - intended room is in A!
cmp #$5f : beq .gtg
cmp #$26 : beq .inroom
.abort
stz $045e : lda $a2 : and #$0f : rtl ; clear,run hijacked code and get out
.inroom
jsr InroomStairsWarp
lda $a2 : and #$0f ; this is the code we are hijacking
rtl
.gtg
phb : phk : plb : phx : phy ; push stuff
jsr LookupSpiralOffset
rep #$30 : and #$00FF : asl #2 : tax
lda.w SpiralTable, x : sta $00
lda.w SpiralTable+2, x : sta $02
sep #$30
lda $00 : sta $a0
; shift quadrant if necessary
stz $07 ; this is a x quad adjuster for those blasted staircase on the edges
lda $01 : and #$01 : !sub $a9
bne .xQuad
lda $0462 : and #$04 : bne .xqCont
inc $07
.xqCont lda $22 : bne .skipXQuad ; this is an edge case
dec $23 : bra .skipXQuad ; need to -1 if $22 is 0
.xQuad sta $06 : !add $a9 : sta $a9
lda $0462 : and #$04 : bne .xCont
inc $07 ; up stairs are going to -1 the quad anyway during transition, need to add this back
.xCont ldy #$00 : jsr ShiftQuadSimple
.skipXQuad
lda $aa : lsr : sta $06 : lda $01 : and #$02 : lsr : !sub $06
beq .skipYQuad
sta $06 : asl : !add $aa : sta $aa
ldy #$01 : jsr ShiftQuadSimple
.skipYQuad
lda $01 : and #$04 : lsr : sta $048a ;fix layer calc 0->0 2->1
lda $01 : and #$08 : lsr #2 : sta $0492 ;fix from layer calc 0->0 2->1
; shift lower coordinates
lda $02 : sta $22 : bne .adjY : lda $23 : !add $07 : sta $23
.adjY lda $03 : sta $20 : bne .upDownAdj : inc $21
.upDownAdj ldx #$08
lda $0462 : and #$04 : beq .upStairs
ldx #$fd
lda $01 : and #$80 : bne .set53
; if target is also down adjust by (6,-15)
lda #$06 : !add $20 : sta $20 : lda #$eb : !add $22 : sta $22 : bra .set53
.upStairs
lda $01 : and #$80 : beq .set53
; if target is also up adjust by (-6, 14)
lda #$fa : !add $20 : sta $20 : lda #$14 : !add $22 : sta $22
bne .set53 : inc $23
.set53
txa : !add $22 : sta $53
lda $01 : and #$10 : sta $07 ; zeroHzCam check
ldy #$00 : jsr SetCamera
lda $01 : and #$20 : sta $07 ; zeroVtCam check
ldy #$01 : jsr SetCamera
jsr StairCleanup
ply : plx : plb ; pull the stuff we pushed
lda $a2 : and #$0f ; this is the code we are hijacking
rtl
}
StairCleanup: {
stz $045e ; clear the staircase flag
; animated tiles fix
lda.l DRMode : cmp #$02 : bne + ; only do this in crossed mode
ldx $a0 : lda.l TilesetTable, x
cmp $0aa1 : beq + ; already eq no need to decomp
sta $0aa1
tax : lda $02802e, x : tay
jsl DecompDungAnimatedTiles
+
stz $047a
rts
}
;Sets the offset in A
LookupSpiralOffset: {
;where link currently is in $a2: quad in a8 & #$03
;count doors
stz $00 : ldx #$00 : stz $01
.loop
lda $047e, x : cmp $00 : bcc .continue
sta $00
.continue inx #2
cpx #$08 : bcc .loop
lda $00 : lsr
cmp #$01 : beq .done
; look up the quad
lda $a9 : ora $aa : and #$03 : beq .quad0
cmp #$01 : beq .quad1
cmp #$02 : beq .quad2
bra .quad3
.quad0
inc $01 : lda $a2
cmp #$0c : beq .q0diff ;gt ent
cmp #$70 : bne .done ;hc stairwell
.q0diff lda $22 : cmp #$00 : beq .secondDoor
cmp #$98 : bcc .done ;gt ent and hc stairwell
.secondDoor inc $01 : bra .done
.quad1
lda $a2
cmp #$1a : beq .q1diff ;pod compass
cmp #$26 : beq .q1diff ;swamp elbows
cmp #$6a : beq .q1diff ;pod dark basement
cmp #$76 : bne .done ;swamp drain
.q1diff lda $22 : cmp #$98 : bcc .done
inc $01 : bra .done
.quad2
lda #$03 : sta $01 : lda $a2
cmp #$5f : beq .iceu ;ice u room
cmp #$3f : bne .done ;hammer ice exception
stz $01 : bra .done
.iceu lda $22 : cmp #$78 : bcc .done
inc $01 : bra .done
.quad3
lda $a2 : cmp #$40 : beq .done ; top of aga exception
lda #$02 : sta $01 ; always 2
.done
lda $a2 : tax : lda.w SpiralOffset,x
!add $01 ;add a thing (0 in easy case)
rts
}
InroomStairsWarp: {
phb : phk : plb : phx : phy ; push stuff
; find stairs by room and store index in X
lda $a0 : ldx #$07
.loop
cmp.w InroomStairsRoom,x
beq .found
dex
bne .loop
.found
rep #$30
txa : and #$00ff : asl : tay
lda.w InroomStairsTable,y : sta $00
sep #$30
sta $a0
; set position and everything else based on target door type
txa : and #$01 : eor #$01 : sta $07
; should be the same as lda $0462 : and #$04 : lsr #2 : eor #$01 : sta $07
lda $01 : and #$80 : beq .notEdge
lda $07 : sta $03 : beq +
lda $01 : jsr LoadSouthMidpoint : sta $22 : lda #$f4
bra ++
+
lda $01 : jsr LoadNorthMidpoint : sta $22 : dec $21 : lda #$f7
++
sta $20
lda $01 : and #$20 : beq +
lda #$01
+
sta $02
stz $07
lda $01 : and #$10 : lsr #4
JMP .layer
.notEdge
lda $01 : and #$03 : cmp #$03 : bne .normal
txa : and #$06 : sta $07
lda $01 : and #$30 : lsr #3 : tay
lda.w InroomStairsX+1,y : sta $02
lda.w InroomStairsY+1,y : sta $03
cpy $07 : beq .vanillaTransition
lda.w InroomStairsX,y : sta $22
lda.w InroomStairsY,y
ldy $07 : beq +
!add #$07
+
sta $20
inc $07
bra ++
.vanillaTransition
lda #$c0 : sta $07 ; leave camera
++
%StonewallCheck($1b)
lda $01 : and #$04 : lsr #2
bra .layer
.normal
lda $01 : sta $fe ; trap door
lda $07 : sta $03 : beq +
lda $01 : and #$04 : bne .specialFix
lda #$e0 : bra ++
.specialFix
lda #$c8 : bra ++
+
%StonewallCheck($43)
lda $01 : and #$04 : bne +
lda #$1b : bra ++
+ lda #$33
++ sta $20
inc $07 : stz $02 : lda #$78 : sta $22
lda $01 : and #$03 : beq ++
cmp #$02 : !bge +
lda #$f8 : sta $22 : stz $07 : bra ++
+ inc $02
++
lda $01 : and #$04 : lsr #2
.layer
sta $ee
bne +
stz $0476
+
lda $02 : !sub $a9
beq .skipXQuad
sta $06 : !add $a9 : sta $a9
ldy #$00 : jsr ShiftQuadSimple
.skipXQuad
lda $aa : lsr : sta $06 : lda $03 : !sub $06
beq .skipYQuad
sta $06 : asl : !add $aa : sta $aa
ldy #$01 : jsr ShiftQuadSimple
.skipYQuad
lda $07 : bmi .skipCamera
ldy #$00 : jsr SetCamera ; horizontal camera
ldy #$01 : sty $07 : jsr SetCamera ; vertical camera
lda $20 : cmp #$e0 : bcc +
lda $e8 : bne +
lda #$10 : sta $e8 ; adjust vertical camera at bottom
+
.skipCamera
jsr StairCleanup
ply : plx : plb ; pull the stuff we pushed
rts
}
ShiftQuadSimple: {
lda.w CoordIndex,y : tax
lda $20,x : beq .skip
lda $21,x : !add $06 : sta $21,x ; coordinate update
.skip
lda.w CamQuadIndex,y : tax
lda $0601,x : !add $06 : sta $0601,x
lda $0605,x : !add $06 : sta $0605,x ; high bytes of these guys
rts
}
SetCamera: {
stz $04
tyx : lda $a9,x : bne .nonZeroHalf
lda.w CamQuadIndex,y : tax : lda $607,x : pha
lda.w CameraIndex,y : tax : pla : cmp $e3, x : bne .noQuadAdj
dec $e3,x
.noQuadAdj
lda $07 : bne .adj0
lda.w CoordIndex,y : tax
lda $20,x : beq .oddQuad
cmp #$79 : bcc .adj0
!sub #$78 : sta $04
tya : asl : !add #$04 : tax : jsr AdjCamBounds : bra .done
.oddQuad
lda #$80 : sta $04 : bra .adj1 ; this is such a weird case - quad cross boundary
.adj0
tya : asl : tax : jsr AdjCamBounds : bra .done
.nonZeroHalf ;meaning either right half or bottom half
lda $07 : bne .setQuad
lda.w CoordIndex,y : tax
lda $20,x : cmp #$78 : bcs .setQuad
!add #$78 : sta $04
lda.w CamQuadIndex,y : tax : lda $0603, x : pha
lda.w CameraIndex,y : tax : pla : sta $e3, x
.adj1
tya : asl : !add #$08 : tax : jsr AdjCamBounds : bra .done
.setQuad
lda.w CamQuadIndex,y : tax : lda $0607, x : pha
lda.w CameraIndex,y : tax : pla : sta $e3, x
tya : asl : !add #$0c : tax : jsr AdjCamBounds : bra .done
.done
lda.w CameraIndex,y : tax
lda $04 : sta $e2, x
rts
}
; input, expects X to be an appropriate offset into the CamBoundBaseLine table
; when $04 is 0 no coordinate are added
AdjCamBounds: {
rep #$20 : lda.w CamBoundBaseLine, x : sta $05
lda $04 : and #$00ff : beq .common
lda.w CoordIndex,y : tax
lda $20, x : and #$00ff : !add $05 : sta $05
.common
lda.w OppCamBoundIndex,y : tax
lda $05 : sta $0618, x
inc #2 : sta $061A, x : sep #$20
rts
}
SpiralPriorityHack: {
lda.l DRMode : beq +
lda #$01 : rtl ; always skip the priority code - until I figure out how to fix it
+ lda $0462 : and #$04 ; what we wrote over
rtl
}

View File

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

View File

@@ -1,19 +1,27 @@
DoDungeonMapBossIcon:
LDA.b NMISTRIPES
LDA.b $14
CMP.b #$09
BEQ .dungeonmap
.cave
CMP.b #$01
RTL
.dungeonmap
LDX.w DungeonID
LDX.w $040C
BMI .cave
; LDA.l DungeonMapIcons
; AND.b #$01
; BNE ++
;
; INC ; so it's not equal to $01
; BRA .cave
; get dungeon boss room
++ REP #$30
LDA.l $8AE817,X
LDA.l DungeonMapBossRooms, X
ASL
TAX
@@ -49,7 +57,7 @@ DoDungeonMapBossIcon:
.match
LDA.b #$80
STA.w CGADD
STA.w $2121
REP #$30
@@ -66,14 +74,14 @@ DoDungeonMapBossIcon:
ASL ; x128 for graphics
ASL
ADC.w #BossMapIconGFX
STA.w A1T1L
STA.w $4312
PHY
LDY.w #32
SEP #$20
-- LDA.l .boss_palettes,X
STA.w CGDATA
STA.w $2122
INX
DEY
BNE --
@@ -86,24 +94,24 @@ DoDungeonMapBossIcon:
SEP #$10
LDA.w #$1801
STA.w DMAP1
STA.w $4310
LDX.b #BossMapIconGFX>>16
STX.w A1B1
STX.w $4314
LDA.w #$A060>>1
STA.w VMADDL
STA.w $2116
LDA.w #$0040
STA.w DAS1L
STA.w $4315
LDX.b #$02
STX.w MDMAEN
STX.w $420B
STA.w DAS1L
STA.w $4315
LDA.w #$A260>>1
STA.w VMADDL
STA.w $2116
STX.w MDMAEN
STX.w $420B
; done
SEP #$30

View File

@@ -1,11 +1,11 @@
NewElderCode:
{
LDA.b OverworldIndex : CMP.b #$1B : BEQ .newCodeContinue
LDA $8A : CMP #$1B : BEQ .newCodeContinue
;Restore Jump we can keep the RTL so JML
JML $05F0CD
.newCodeContinue
PHB : PHK : PLB
LDA.b #$07 : STA.w SpriteOAMProp, X ; Palette
LDA.b #$07 : STA $0F50, X ;Palette
JSR Elder_Draw
JSL Sprite_PlayerCantPassThrough
JSR Elder_Code
@@ -17,12 +17,12 @@ RTL
Elder_Draw:
{
LDA.b #$02 : STA.b Scrap06 : STZ.b Scrap07 ;Number of Tiles
LDA.b #$02 : STA $06 : STZ $07 ;Number of Tiles
LDA.w SpriteGFXControl, X : ASL #04
LDA $0DC0, X : ASL #04
ADC.b #.animation_states : STA.b Scrap08
LDA.b #.animation_states>>8 : ADC.b #$00 : STA.b Scrap09
ADC.b #.animation_states : STA $08
LDA.b #.animation_states>>8 : ADC.b #$00 : STA $09
JSL Sprite_DrawMultiple_player_deferred
JSL Sprite_DrawShadowLong
@@ -46,11 +46,11 @@ RTL
LDA.l TurnInGoalItems : AND.w #$00FF : BNE +
.despawn
SEP #$20
STZ.w SpriteAITable, X ; despawn self
STZ $0DD0, X ; despawn self
RTS
+
SEP #$20
LDA.b GameSubMode
LDA.b $11
BNE .done
LDA.b #$96
LDY.b #$01
@@ -66,6 +66,6 @@ RTL
.done
SEP #$20
LDA.b FrameCounter : LSR #5 : AND.b #$01 : STA.w SpriteGFXControl, X
LDA.b $1A : LSR #5 : AND.b #$01 : STA.w $0DC0, X
RTS
}

View File

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

13
enemizer/blindboss.asm Normal file
View File

@@ -0,0 +1,13 @@
;================================================================================
; Blind Boss fight
;--------------------------------------------------------------------------------
print "Blind Spawn Code Check: ", pc
check_blind_boss_room:
LDA $A0 ; load room index (low byte)
CMP #172 : BNE + ; Is is Thieve Town Boss Room
LDA $09DE81 : BEQ + ; Blind maiden does not need rescuing
LDA FollowerIndicator : JML Check_for_Blind_Fight
+
JML Initialize_Blind_Fight

View File

@@ -0,0 +1,13 @@
;================================================================================
; Blind Boss fight
;--------------------------------------------------------------------------------
org $9DA081 ; Original Code
JML check_blind_boss_room
Check_for_Blind_Fight:
org $9DA090
Initialize_Blind_Fight:

1
enemizer/hooks.asm Normal file
View File

@@ -0,0 +1 @@
incsrc blindboss_hooks.asm

35
enemizer/main.asm Normal file
View File

@@ -0,0 +1,35 @@
; Intended to be a migration of code generated by enemizer
lorom
;================================================================================
!ADD = "CLC : ADC"
!SUB = "SEC : SBC"
!BLT = "BCC"
!BGE = "BCS"
;=Constants======================================================================
!BUSHES_FLAG = "$368100"
!BLIND_DOOR_FLAG = "$368101"
!MOLDORM_EYES_FLAG = "$368102"
!RANDOM_SPRITE_FLAG = "$368103"
!AGAHNIM_FUN_BALLS = "$368104"
!ENABLE_MIMIC_OVERRIDE = "$368105"
!ENABLE_TERRORPIN_AI_FIX = "$368106"
; Enemizer reserved memory
; $7F50B0 - $7F50BF - Downstream Reserved (Enemizer)
!SHELL_DMA_FLAG = "$7F50B0"
!SOUNDFX_LOADED = "$7F50B1"
;================================================================================
incsrc hooks.asm
org $B78000 ; the original org is 368000, but I'm putting this here for migration purposes, and I think B6 is the same bank but fastrom
EnemizerTablesStart:
;none migrated yet
EnemizerCodeStart:
incsrc blindboss.asm

View File

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

View File

@@ -8,7 +8,7 @@ LockAgahnimDoors:
;#$0 = Never Locked
LDA.w #$0000 : RTL
+ : CMP.w #$0001 : BNE +
LDA.l ProgressIndicator : AND.w #$000F : CMP.w #$0002 : !BGE .unlock ; if we rescued zelda, skip
LDA ProgressIndicator : AND.w #$000F : CMP.w #$0002 : !BGE .unlock ; if we rescued zelda, skip
JSR.w LockAgahnimDoorsCore : RTL
+ : CMP.w #$0002 : BNE +
JSR.w LockAgahnimDoorsCore : BEQ .unlock
@@ -18,20 +18,20 @@ LockAgahnimDoors:
REP #$30
PLY : PLX
!BGE .crystalOrUnlock
LDA.w #$0001 : RTL
LDA #$0001 : RTL
.crystalOrUnlock
LDA.l InvertedMode : AND.w #$00FF : BEQ .unlock
LDA SwapAgaGanonsTower : AND.w #$00FF : BEQ .unlock
LDA.l OverworldEventDataWRAM+$43 : AND.w #$0020 : BNE .unlock ; Check if GT overlay is already on or not
LDA.w AButtonAct : AND.w #$0080 : BEQ ++ ;If we are holding an item
LDA OverworldEventDataWRAM+$43 : AND.w #$0020 : BNE .unlock ; Check if GT overlay is already on or not
LDA $0308 : AND.w #$0080 : BEQ ++ ;If we are holding an item
.locked
LDA.w #$0001 : RTL ;Keep the door locked
LDA #$0001 : RTL ;Keep the door locked
++
SEP #$30
JSL $099B6F ;Add tower break seal
REP #$30
LDA.w #$0001 ;Prevent door from opening that frame otherwise it glitchy
LDA #$0001 ;Prevent door from opening that frame otherwise it glitchy
RTL
+
@@ -42,21 +42,21 @@ LockAgahnimDoors:
RTL
;---------------------------------------------------------------------------------
FlagAgahnimDoor:
LDA.l InvertedMode : BEQ .vanilla
LDA.l SwapAgaGanonsTower : BEQ .vanilla
LDA.l OverworldEventDataWRAM+$43 : ORA.b #$20 : STA.l OverworldEventDataWRAM+$43 ; activate GT overlay
LDA OverworldEventDataWRAM+$43 : ORA #$20 : STA OverworldEventDataWRAM+$43 ; activate GT overlay
.vanilla
LDA.b #$28 : STA.b ScrapBuffer72
LDA.b #$28 : STA.b $72
RTL
;--------------------------------------------------------------------------------
LockAgahnimDoorsCore:
LDA.b LinkPosX : CMP.w #1992 : !BLT + ; door too far left, 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 $22 : CMP.w #1992 : !BLT + ; door too far left, skip
CMP.w #2088 : !BGE + ; door too rat right, skip
LDA $20 : CMP.w #1720 : !BGE + ; door too low, skip
LDA.w #$0001
RTS
+
LDA.w #$0000
@@ -77,54 +77,55 @@ JML.l Overworld_Entrance_BRANCH_RHO
AllowStartFromSingleEntranceCave:
; 16 Bit A, 16 bit XY
; do not need to preserve A or X or Y
LDA.l StartingEntrance : AND.w #$00FF ; What we wrote over
LDA StartingEntrance : AND.w #$00FF ; What we wrote over
PHA
TAX
LDA.l StartingAreaExitOffset, X
AND.w #$00FF
LDA.l StartingAreaExitOffset, X : AND.w #$00FF
BNE +
JMP .done
+
DEC
STA.b Scrap00
ASL #2 : !ADD Scrap00 : ASL #2 ; mult by 20
STA $00
ASL #2 : !ADD $00 : ASL #2 ; mult by 20
TAX
LDA.w #$0016 : STA.l EN_MAINDESQ ; Cache the main screen designation
LDA.l StartingAreaExitTable+$05, X : STA.l EN_BG2VERT ; Cache BG1 V scroll
LDA.l StartingAreaExitTable+$07, X : STA.l EN_BG2HORZ ; Cache BG1 H scroll
LDA.l StartingAreaExitTable+$09, X : !ADD.w #$0010 : STA.l EN_POSY ; Cache Link's Y coordinate
LDA.l StartingAreaExitTable+$0B, X : STA.l EN_POSX ; Cache Link's X coordinate
LDA.l StartingAreaExitTable+$0D, X : STA.l EN_SCROLLATN ; Cache Camera Y coord lower bound.
LDA.l StartingAreaExitTable+$0F, X : STA.l EN_SCROLLATW ; Cache Camera X coord lower bound.
LDA.l StartingAreaExitTable+$03, X : STA.l EN_OWTMAPI ; Cache Link VRAM Location
LDA #$0016 : STA $7EC142 ; Cache the main screen designation
LDA.l StartingAreaExitTable+$05, X : STA $7EC144 ; Cache BG1 V scroll
LDA.l StartingAreaExitTable+$07, X : STA $7EC146 ; Cache BG1 H scroll
LDA.l StartingAreaExitTable+$09, X : !ADD.w #$0010 : STA $7EC148 ; Cache Link's Y coordinate
LDA.l StartingAreaExitTable+$0B, X : STA $7EC14A ; Cache Link's X coordinate
LDA.l StartingAreaExitTable+$0D, X : STA $7EC150 ; Cache Camera Y coord lower bound.
LDA.l StartingAreaExitTable+$0F, X : STA $7EC152 ; Cache Camera X coord lower bound.
LDA.l StartingAreaExitTable+$03, X : STA $7EC14E ; Cache Link VRAM Location
; Handle the 2 "unknown" bytes, which control what area of the backgound
; relative to the camera? gets loaded with new tile data as the player moves around
; (because some overworld areas like Kak are too big for a single VRAM tilemap)
LDA.l StartingAreaExitTable+$11, X : AND.w #$00FF
BIT.w #$0080 : BEQ + : ORA.w #$FF00 : + ; Sign extend
STA.l EN_SCRMODYA
BIT.w #$0080 : BEQ + : ORA #$FF00 : + ; Sign extend
STA.l $7EC16A
LDA.l StartingAreaExitTable+$12, X : AND.w #$00FF
BIT.w #$0080 : BEQ + : ORA.w #$FF00 : + ; Sign extend
STA.l EN_SCRMODXA
BIT.w #$0080 : BEQ + : ORA #$FF00 : + ; Sign extend
STA.l $7EC16E
LDA.w #$0000 : !SUB.l EN_SCRMODYA : STA.l EN_SCRMODYB
LDA.w #$0000 : !SUB.l EN_SCRMODXA : STA.l EN_SCRMODXB
LDA.w #$0000 : !SUB.l $7EC16A : STA $7EC16C
LDA.w #$0000 : !SUB.l $7EC16E : STA $7EC170
LDA.l StartingAreaExitTable+$02, X : AND.w #$00FF
STA.l EN_OWSCR ; Cache the overworld area number
STA.l EN_OWSCR2 ; Cache the aux overworld area number
STA $7EC14C ; Cache the overworld area number
STA $7EC140 ; Cache the aux overworld area number
STZ.w TileMapTile32 ;zero out door overlays in case starting overworld door is not set
STZ.w TileMapTile32+1 ;zero out door overlays in case starting overworld door is not set
STZ $0698 ;zero out door overlays in case starting overworld door is not set
STZ $0699 ;zero out door overlays in case starting overworld door is not set
SEP #$20 ; set 8-bit accumulator
LDA.l StartingEntrance : TAX
LDA.l StartingAreaOverworldDoor, X : STA.l PreviousOverworldDoor ;Load overworld door
LDA StartingEntrance : TAX
LDA.l StartingAreaOverworldDoor, X : STA.l $7F5099 ;Load overworld door
REP #$20 ; reset 16-bit accumulator
JSL.l CacheDoorFrameData
@@ -134,7 +135,7 @@ RTL
;--------------------------------------------------------------------------------
AllowStartFromExit:
LDX.w MessageCursor
LDX $1CE8
LDA.l ShouldStartatExit, X : BNE .doStart
LDA.l StartingEntrance ; what we wrote over
@@ -145,38 +146,39 @@ JML.l AllowStartFromExitReturn
LDA.l $028481, X ;Module_LocationMenu_starting_points
ASL : TAX
LDA.l $02D8D2, X : STA.b RoomIndex
LDA.l $02D8D3, X : STA.b RoomIndex+1
LDA.l $02D8D2, X : STA $A0
LDA.l $02D8D3, X : STA $A1
; Go to pre-overworld mode
LDA.b #$08 : STA.b GameMode
LDA.b #$08 : STA $10
STZ.b GameSubMode
STZ.b SubSubModule
STZ.w DeathReloadFlag
STZ.w RespawnFlag
STZ $11
STZ $B0
STZ $010A
STZ $04AA
JSL Equipment_SearchForEquippedItemLong
JSL HUD_RebuildLong2
JSL Equipment_UpdateEquippedItemLong
JSL $0DDD32 ; Equipment_UpdateEquippedItemLong
RTL
;--------------------------------------------------------------------------------
CheckHole:
LDX.w #$0024
.nextHoleClassic
LDA.b Scrap00 : CMP.l $1BB800, X
LDA.b $00 : CMP.l $1BB800, X
BNE .wrongMap16Classic
LDA.b OverworldIndex : CMP.l $1BB826, X
LDA.w $040A : CMP.l $1BB826, X
BEQ .matchedHoleClassic
.wrongMap16Classic
DEX #2 : BPL .nextHoleClassic
LDX.w #$001E
.nextHoleExtra
LDA.b Scrap00 : CMP.l ExtraHole_Map16, X
LDA.b $00 : CMP.l ExtraHole_Map16, X
BNE .wrongMap16Extra
LDA.b OverworldIndex : CMP.l ExtraHole_Area, X
LDA.w $040A : CMP.l ExtraHole_Area, X
BEQ .matchedHoleExtra
.wrongMap16Extra
DEX #2 : BPL .nextHoleExtra
@@ -187,14 +189,14 @@ CheckHole:
.matchedHoleExtra
SEP #$30
TXA : LSR A : TAX
LDA.l ExtraHole_Entrance, X : STA.w EntranceIndex : STZ.w EntranceIndex+1
LDA.l ExtraHole_Entrance, X : STA.w $010E : STZ.w $010F
JML Overworld_Hole_End
;--------------------------------------------------------------------------------
PreventEnterOnBonk:
STA.b Scrap00 ; part of what we wrote over
LDA.l InvertedMode : AND.w #$00FF : BEQ .done
LDA.b LinkState : AND.w #$00FF : CMP.w #$0014 : BNE .done ;in mirror mode?
LDA.b OverworldIndex : AND.w #$0040 : CMP.b WorldCache : BEQ .done ; Are we bonking, or doing the superbunny glitch?
STA $00 ; part of what we wrote over
LDA.b $8A : TAX : LDA.l OWTileMapAlt, X : AND.w #$0001 : BEQ .done
LDA.l $5D : AND.w #$00FF : CMP.w #$0014 : BNE .done ;in mirror mode?
LDA.b $8A : TAX : LDA.l OWTileWorldAssoc, X : AND.w #$00FF : CMP $7B : BEQ .done ; Are we bonking, or doing the superbunny glitch?
; If in inverted, are in mirror mode, and are bonking then do not enter
JML.l PreventEnterOnBonk_BRANCH_IX
@@ -204,24 +206,25 @@ PreventEnterOnBonk:
JML.l PreventEnterOnBonk_return
;--------------------------------------------------------------------------------
TurtleRockEntranceFix:
LDA.l TurtleRockAutoOpenFix : BEQ .done
LDA.b OverworldIndex : CMP.b #$47 : BNE .done
LDA TurtleRockAutoOpenFix : BEQ .done
LDA $8A : CMP.b #$47 : BNE .done
;If exiting to turtle rock ensure the entrance is open
LDA.l OverworldEventDataWRAM+$47 : ORA.b #$20 : STA.l OverworldEventDataWRAM+$47
.done
RTL
;--------------------------------------------------------------------------------
AnimatedEntranceFix: ;when an entrance animation tries to start
PHA
PHA : PHX
LDA.l InvertedMode : BEQ + ;If we are in inverted mode
LDA.b OverworldIndex : AND.b #$40 : BNE + ;and in the light world
PLA
STZ.w OWEntranceCutscene ; skip it.
LDA.b #$00
LDA.l OWMode+1 : AND.b #!FLAG_OW_MIXED : BNE + ;If we are in Mixed OW shuffle mode
LDA $8A : AND #$40 : BNE + ;and in the light world
PLX : PLA
STZ $04C6 ; skip it.
LDA #$00
RTL
+
PLA
STA.w CutsceneFlag ;what we wrote over
STA.w FreezeSprites ;what we wrote over
STA.w SkipOAM ;what we wrote over
PLX : PLA
STA $02E4 ;what we wrote over
STA $0FC1 ;what we wrote over
STA $0710 ;what we wrote over
RTL

View File

@@ -1,6 +1,13 @@
;--------------------------------------------------------------------------------
; OnLoadOW
;--------------------------------------------------------------------------------
;OnLoadMap:
; LDA OverworldEventDataWRAM+$5B ; thing we wrote over
;RTL
;--------------------------------------------------------------------------------
OnPrepFileSelect:
LDA.b GameSubMode : CMP.b #$03 : BNE +
LDA.b #$06 : STA.b NMISTRIPES ; thing we wrote over
LDA $11 : CMP.b #$03 : BNE +
LDA.b #$06 : STA $14 ; thing we wrote over
RTL
+
JSL.l LoadAlphabetTilemap
@@ -8,6 +15,7 @@ OnPrepFileSelect:
;--------------------------------------------------------------------------------
OnDrawHud:
JSL.l DrawChallengeTimer ; this has to come before NewDrawHud because the timer overwrites the compass counter
JSL.l DrHudOverride
JSL.l NewDrawHud
JSL.l SwapSpriteIfNecessary
JSL.l CuccoStorm
@@ -15,8 +23,8 @@ OnDrawHud:
JML.l ReturnFromOnDrawHud
;--------------------------------------------------------------------------------
OnDungeonEntrance:
STA.l PegColor ; thing we wrote over
JSL MaybeFlagDungeonTotalsEntrance
STA $7EC172 ; thing we wrote over
JSL MaybeFlagCompassTotalEntrance
RTL
;--------------------------------------------------------------------------------
OnPlayerDead:
@@ -33,7 +41,7 @@ OnDungeonExit:
JSL.l SQEGFix
PLP : PLA
STA.w DungeonID : STZ.w Map16ChangeIndex ; thing we wrote over
STA $040C : STZ $04AC ; thing we wrote over
PHA : PHP
JSL.l HUD_RebuildLong
@@ -44,31 +52,31 @@ RTL
;--------------------------------------------------------------------------------
OnQuit:
JSL.l SQEGFix
LDA.b #$00 : STA.l AltTextFlag ; bandaid patch bug with mirroring away from text
LDA.b #$10 : STA.b MAINDESQ ; thing we wrote over
LDA.b #$00 : STA $7F5035 ; bandaid patch bug with mirroring away from text
LDA.b #$10 : STA $1C ; thing we wrote over
RTL
;--------------------------------------------------------------------------------
OnUncleItemGet:
PHA
LDA.l EscapeAssist
BIT.b #$04 : BEQ + : STA InfiniteMagicModifier : +
BIT.b #$02 : BEQ + : STA InfiniteBombsModifier : +
BIT.b #$01 : BEQ + : STA InfiniteArrowsModifier : +
LDA.l EscapeAssist
BIT.b #$04 : BEQ + : STA.l InfiniteMagic : +
BIT.b #$02 : BEQ + : STA.l InfiniteBombs : +
BIT.b #$01 : BEQ + : STA.l InfiniteArrows : +
LDA UncleItem_Player : STA !MULTIWORLD_ITEM_PLAYER_ID
PLA
JSL.l Link_ReceiveItem
LDA.l UncleRefill : BIT.b #$04 : BEQ + : LDA.b #$80 : STA.l MagicFiller : + ; refill magic
LDA.l UncleRefill : BIT.b #$02 : BEQ + : LDA.b #50 : STA.l BombsFiller : + ; refill bombs
LDA.l UncleRefill : BIT.b #$01 : BEQ + ; refill arrows
LDA.b #70 : STA.l ArrowsFiller
LDA.b #70 : STA.l ArrowsFiller
LDA.l ArrowMode : BEQ +
LDA.l BowTracking : ORA.b #$80 : STA.l BowTracking ; enable bow toggle
REP #$20 ; set 16-bit accumulator
LDA.l CurrentRupees : !ADD.l FreeUncleItemAmount : STA.l CurrentRupees ; rupee arrows, so also give the player some money to start
SEP #$20 ; set 8-bit accumulator
LDA.l ArrowMode : BEQ +
LDA.l BowTracking : ORA #$80 : STA.l BowTracking ; enable bow toggle
REP #$20 ; set 16-bit accumulator
LDA.l CurrentRupees : !ADD.l FreeUncleItemAmount : STA.l CurrentRupees ; rupee arrows, so also give the player some money to start
SEP #$20 ; set 8-bit accumulator
+
LDA.l ProgressIndicator : BNE +
LDA.b #$01 : STA.l ProgressIndicator ; handle rain state
@@ -82,17 +90,16 @@ OnAga2Defeated:
;--------------------------------------------------------------------------------
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 ; /
LDA.w #$03D7 ; \
LDX.w #$B000 ; | Copies from beginning of inital sram table up to file name
LDY.w #$0000 ; | (exclusively)
MVN $70, $30 ; /
; Skip file name and validity value
LDA.w #$010C ; \
LDX.w #$B3E3 ; | Rando-Specific Assignments & Game Stats block
LDY.w #$03E3 ; |
MVN $70, $30 ; /
PLB
; resolve instant post-aga if standard
@@ -104,29 +111,35 @@ OnFileCreation:
REP #$20
; 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
LDA.w #$55AA : STA.l $7003E1
STZ $00
STZ $01
LDX.b $00
LDY.w #$0000
TYA
JML.l InitializeSaveFile_done
JML.l InitializeSaveFile_build_checksum
;--------------------------------------------------------------------------------
!RNG_ITEM_LOCK_IN = "$7F5090"
OnFileLoad:
REP #$10 ; set 16 bit index registers
JSL.l EnableForceBlank ; what we wrote over
REP #$20 : LDA.l $30F010 : STA.l MultiClientFlagsWRAM+1 : SEP #$20
LDA MultiClientFlagsROM : STA.l MultiClientFlagsWRAM
LDA.b #$07 : STA.w BG34NBA ; Restore screen 3 to normal tile area
LDA.b #$07 : STA $210C ; Restore screen 3 to normal tile area
LDA.l FileMarker : BNE +
JSL.l OnNewFile
LDA.b #$FF : STA.l FileMarker
+
LDA.w DeathReloadFlag : BNE + ; don't adjust the worlds for "continue" or "save-continue"
LDA.l MosaicLevel : BNE + ; don't adjust worlds if mosiac is enabled (Read: mirroring in dungeon)
LDA.w $010A : BNE + ; don't adjust the worlds for "continue" or "save-continue"
LDA.l $7EC011 : BNE + ; don't adjust worlds if mosiac is enabled (Read: mirroring in dungeon)
JSL.l DoWorldFix
+
JSL.l MasterSwordFollowerClear
LDA.b #$FF : STA.l RNGLockIn ; reset rng item lock-in
LDA.b #$FF : STA !RNG_ITEM_LOCK_IN ; reset rng item lock-in
LDA.b #$00 : STA $7F5001 ; mark fake flipper softlock as impossible
LDA.l GenericKeys : BEQ +
LDA.l CurrentGenericKeys : STA.l CurrentSmallKeys ; copy generic keys to key counter
+
@@ -141,78 +154,86 @@ OnFileLoad:
SEP #$10 ; restore 8 bit index registers
RTL
;--------------------------------------------------------------------------------
!RNG_ITEM_LOCK_IN = "$7F5090"
OnNewFile:
PHX : PHP
; reset some values on new file that are otherwise only reset on hard reset
SEP #$20 ; set 8-bit accumulator
STZ.w AncillaSearch
STZ.w LayerAdjustment ; EG
STZ.w ArcVariable : STZ.w ArcVariable+1
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
LDA.b #$00 : STA.l MosaicLevel
JSL InitRNGPointerTable
STZ $03C4 ; ancilla slot index
STZ $047A ; EG
STZ $0B08 : STZ $0B09 ; arc variable
STZ $0CFB ; enemies killed (pull trees)
STZ $0CFC ; times taken damage (pull trees)
STZ $0FC7 : STZ $0FC8 : STZ $0FC9 : STZ $0FCA : STZ $0FCB : STZ $0FCC : STZ $0FCD ; prize packs
LDA #$00 : STA $7EC011 ; mosaic
JSL InitRNGPointerTable ; boss RNG
PLP : PLX
RTL
;--------------------------------------------------------------------------------
OnInitFileSelect:
LDA.b #$51 : STA.w $0AA2 ;<-- Line missing from JP1.0, needed to ensure "extra" copy of naming screen graphics are loaded.
; LDA.b #$10 : STA $BC ; init sprite pointer - does nothing unless spriteswap.asm is included
; JSL.l SpriteSwap_SetSprite
LDA.b #$51 : STA $0AA2 ;<-- Line missing from JP1.0, needed to ensure "extra" copy of naming screen graphics are loaded.
JSL.l EnableForceBlank
RTL
;--------------------------------------------------------------------------------
OnLinkDamaged:
JSL.l IncrementDamageTakenCounter_Arb
;JSL.l FlipperKill
JML.l OHKOTimer
;--------------------------------------------------------------------------------
;OnEnterWater:
; JSL.l UnequipCapeQuiet ; what we wrote over
;RTL
OnEnterWater:
JSL.l RegisterWaterEntryScreen
JSL.l MysteryWaterFunction
LDX.b #$04
RTL
;--------------------------------------------------------------------------------
OnLinkDamagedFromPit:
JSL.l OHKOTimer
LDA.l AllowAccidentalMajorGlitch
BEQ ++
-- LDA.b #$14 : STA.b GameSubMode ; thing we wrote over
-- LDA.b #$14 : STA $11 ; thing we wrote over
RTL
++ LDA.b GameMode : CMP.b #$12 : BNE --
++ LDA.b $10 : CMP.b #$12 : BNE --
STZ.b GameSubMode
STZ.b $11
RTL
;--------------------------------------------------------------------------------
OnLinkDamagedFromPitOutdoors:
JML.l OHKOTimer ; make sure this is last
;--------------------------------------------------------------------------------
!RNG_ITEM_LOCK_IN = "$7F5090"
OnOWTransition:
JSL.l FloodGateReset
JSL.l FlipperFlag
JSL.l StatTransitionCounter
PHP
SEP #$20 ; set 8-bit accumulator
LDA.b #$FF : STA.l RNGLockIn ; clear lock-in
LDA.b #$FF : STA !RNG_ITEM_LOCK_IN ; clear lock-in
PLP
RTL
;--------------------------------------------------------------------------------
!DARK_DUCK_TEMP = "$7F509C"
OnLoadDuckMap:
LDA.l DuckMapFlag
LDA !DARK_DUCK_TEMP
BNE +
INC : STA.l DuckMapFlag
JSL OverworldMap_InitGfx : DEC.w SubModuleInterface
INC : STA !DARK_DUCK_TEMP
JSL OverworldMap_InitGfx : DEC $0200
RTL
+
LDA.b #$00 : STA.l DuckMapFlag
LDA.b #$00 : STA !DARK_DUCK_TEMP
JML OverworldMap_DarkWorldTilemap
;--------------------------------------------------------------------------------
PreItemGet:
LDA.b #$01 : STA.l BusyItem ; mark item as busy
LDA.b #$01 : STA !ITEM_BUSY ; mark item as busy
RTL
;--------------------------------------------------------------------------------
PostItemGet:
@@ -220,19 +241,30 @@ PostItemGet:
RTL
;--------------------------------------------------------------------------------
PostItemAnimation:
LDA.b #$00 : STA.l BusyItem ; mark item as finished
LDA.b #$00 : STA !ITEM_BUSY ; mark item as finished
LDA.l TextBoxDefer : BEQ +
STZ.w TextID : STZ.w TextID+1 ; reset decompression buffer
LDA $7F509F : BEQ +
STZ $1CF0 : STZ $1CF1 ; reset decompression buffer
JSL.l Main_ShowTextMessage_Alt
LDA.b #$00 : STA.l TextBoxDefer
LDA.b #$00 : STA $7F509F
+
LDA.w ItemReceiptMethod : CMP.b #$01 : BNE +
LDA.b LinkDirection : BEQ +
LDA $1B : BEQ +
REP #$20 : LDA $A0 : STA !MULTIWORLD_ROOMID : SEP #$20
LDA $0403 : STA !MULTIWORLD_ROOMDATA
+
LDA.w $02E9 : CMP.b #$01 : BNE +
LDA.b $2F : BEQ +
JSL.l IncrementChestTurnCounter
+
STZ.w ItemReceiptMethod : LDA.w AncillaGet, X ; thing we wrote over to get here
RTL
LDA !MULTIWORLD_ITEM_PLAYER_ID : BEQ +
STZ $02E9
LDA #$00 : STA !MULTIWORLD_ITEM_PLAYER_ID
JML.l Ancilla_ReceiveItem_objectFinished
+
STZ $02E9 : LDA $0C5E, X ; thing we wrote over to get here
JML.l Ancilla_ReceiveItem_optimus+6
;--------------------------------------------------------------------------------

View File

@@ -1,9 +1,9 @@
pushtable
table "data/bsodencode.txt"
table "bsodencode.txt"
; Uncomment this to force a crash to test message
; pushpc : org $008132 : db 0 : pullpc
;pushpc : org $008132 : db 0 : pullpc
;===================================================================================================
@@ -11,29 +11,29 @@ DontUseZSNES:
SEP #$35 ; sets carry and I flag too
LDA.b #$00
STA.l NMITIMEN ; disable NMI and IRQ
STA.l HDMAEN ; disable HDMA
STA.l $4200 ; disable NMI and IRQ
STA.l $420C ; disable HDMA
ROR ; A = 0x80 from carry
STA.l INIDISP
STA.l VMAIN
STA.l $2100
STA.l $2115
; Empty VRAM
LDA.b #AllZeros>>16 : STA.l A1B0
LDA.b #AllZeros>>16 : STA.l $4304
REP #$20
LDA.w #AllZeros
STA.l A1T0L
STA.l $4302
LDA.w #$1809
STA.l DMAP0
STA.l $4300
LDA.w #$0000
STA.l DAS0L
STA.l $4305
LDA.w #$0001
STA.l MDMAEN
STA.l $420B
JSR ConfigurePPUForFailureReport
JSR ConfigureBSODVWF
@@ -43,7 +43,7 @@ DontUseZSNES:
JSR DrawVWFMessage
LDA.w #$0F0F
STA.w INIDISP
STA.w $2100
-- BRA --
@@ -77,29 +77,29 @@ Crashed:
SEP #$35 ; sets carry and I flag too
LDA.b #$00
STA.l NMITIMEN ; disable NMI and IRQ
STA.l HDMAEN ; disable HDMA
STA.l $4200 ; disable NMI and IRQ
STA.l $420C ; disable HDMA
ROR ; A = 0x80 from carry
STA.l INIDISP
STA.l VMAIN
STA.l $2100
STA.l $2115
; Empty VRAM
LDA.b #AllZeros>>16 : STA.l A1B0
LDA.b #AllZeros>>16 : STA.l $4304
REP #$38
LDA.w #AllZeros
STA.l A1T0L
STA.l $4302
LDA.w #$1809
STA.l DMAP0
STA.l $4300
LDA.w #$0000
STA.l DAS0L
STA.l $4305
LDA.w #$0001
STA.l MDMAEN
STA.l $420B
;===================================================================================================
@@ -113,32 +113,32 @@ Crashed:
; stack pointer
LDA.w #$0C38>>1
STA.b VMADDL
STA.b $2116
TSC
XBA
AND.w #$00FF
ORA.w #$0100
STA.b VMDATAL
STA.b $2118
TSC
AND.w #$00FF
ORA.w #$0100
STA.l VMDATAL
STA.l $2118
; game module
LDA.w #$0C78>>1
STA.b VMADDL
STA.b $2116
LDA.l GameMode
LDA.l $10
AND.w #$00FF
ORA.w #$0100
STA.b VMDATAL
STA.b $2118
LDA.l GameSubMode
LDA.l $11
AND.w #$00FF
ORA.w #$0100
STA.b VMDATAL
STA.b $2118
;---------------------------------------------------------------------------------------------------
@@ -176,7 +176,7 @@ Crashed:
.next_row
STA.l $7F0004
STA.b VMADDL
STA.b $2116
LDY.w #20
@@ -194,7 +194,7 @@ Crashed:
AND.w #$01FF
.in_stack
STA.b VMDATAL
STA.b $2118
DEX
TXA
@@ -235,10 +235,16 @@ Crashed:
JSR DrawVWFMessage
LDA.w #$0F0F
STA.w INIDISP
STA.w $2100
-- BRA --
; LDA.w #$0000
; TCD
;
; TSC
BSODMessage:
db "A fatal error has occurred and resulted in an", $80
db "unrecoverable crash. ?", $80
@@ -254,11 +260,11 @@ BSODMessage:
;===================================================================================================
DrawVWFMessage:
STA.b Scrap06
STA.b $06
.next
LDA.b (Scrap06)
INC.b Scrap06
LDA.b ($06)
INC.b $06
AND.w #$00FF
CMP.w #$0080
BEQ .done_row
@@ -278,26 +284,26 @@ DrawVWFMessage:
ASL
TAX
LDA.w .row_offset,X
STA.w VMADDL
STA.w $2116
INC.b VWFR
LDA.w #$1800
STA.w DMAP0
STA.w $4300
LDA.w #20*16
STA.w DAS0L
STA.w $4305
LDA.w #$1000
STA.w A1T0L
STA.w $4302
SEP #$20
STZ.w VMAIN
STZ.w A1B0
STZ.w $2115
STZ.w $4304
LDA.b #$01
STA.w MDMAEN
STA.w $420B
REP #$20
@@ -341,7 +347,7 @@ DrawFailureVWFChar:
ASL
ASL
ADC.w #BSODFontGFX
STA.b Scrap08
STA.b $08
LDA.b VWFP
AND.w #$FFF8
@@ -396,23 +402,23 @@ LoadBSODHexFont:
REP #$20
LDA.w #BSODHex
STA.w A1T0L
STA.w $4302
LDA.w #$1801
STA.w DMAP0
STA.w $4300
LDA.w #$1000
STA.w DAS0L
STA.w $4305
LDA.w #$2800
STA.w VMADDL
STA.w $2116
SEP #$20
LDA.b #BSODHex>>16
STA.w A1B0
STA.w $4304
LDA.b #$01
STA.w MDMAEN
STA.w $420B
REP #$30
@@ -431,21 +437,21 @@ ConfigureBSODVWF:
LDX.b #$FF
LDY.b #$7F
STZ.b CGADD
STZ.b CGDATA : STZ.b CGDATA
STZ.b $2121
STZ.b $2122 : STZ.b $2122
STX.b CGDATA : STY.b CGDATA
STX.b $2122 : STY.b $2122
LDA.b #$05
STA.b CGADD
STA.b $2121
LDA.b #$11 : STA.b CGDATA : STY.b CGDATA
LDA.b #$11 : STA.b $2122 : STY.b $2122
LDA.b #$21 : STA.b CGADD
STX.b CGDATA : STY.b CGDATA
LDA.b #$21 : STA.b $2121
STX.b $2122 : STY.b $2122
LDA.b #$25 : STA.b CGADD
LDA.b #$11 : STA.b CGDATA : STY.b CGDATA
LDA.b #$25 : STA.b $2121
LDA.b #$11 : STA.b $2122 : STY.b $2122
REP #$30
@@ -467,14 +473,14 @@ ConfigureBSODVWF:
.start
STA.w $20
STA.b VMADDL
STA.b $2116
PLA
LDY.w #30
.next_char
STA.b VMDATAL
STA.b $2118
INC
DEY
BNE .next_char
@@ -510,39 +516,39 @@ ConfigurePPUForFailureReport:
PHK
PLB
STZ.w BGMODE ; BG mode 0
STZ.w MOSAIC ; no mosaic
STZ.w BG1SC ; BG1 tilemap to $0000
STZ.w TS
STZ.w $2105 ; BG mode 0
STZ.w $2106 ; no mosaic
STZ.w $2107 ; BG1 tilemap to $0000
STZ.w $212D
STZ.w BG1HOFS : STZ.w BG1HOFS
STZ.w BG1VOFS : STZ.w BG1VOFS
STZ.w BG2HOFS : STZ.w BG2HOFS
STZ.w BG2VOFS : STZ.w BG2VOFS
STZ.w $210D : STZ.w $210D
STZ.w $210E : STZ.w $210E
STZ.w $210F : STZ.w $210F
STZ.w $2110 : STZ.w $2110
STZ.w W12SEL
STZ.w CGADSUB
STZ.w SETINI
STZ.w $2123
STZ.w $2131
STZ.w $2133
LDA.b #$04
STA.w BG2SC ; BG1 tilemap to $0800
STA.w $2108 ; BG1 tilemap to $0800
LDA.b #$21
STA.w BG12NBA
STA.w $210B
LDA.b #$03
STA.w TM
STA.w $212C
RTS
;===================================================================================================
BSODHex:
incbin "data/bsodhex.2bpp"
incbin "bsodhex.2bpp"
BSODFontGFX:
incbin "data/bsodfont.1bpp"
incbin "bsodfont.1bpp"
BSODCharWidths:
; [space]

View File

@@ -2,20 +2,20 @@
; Fairy Changes & Fixes
;--------------------------------------------------------------------------------
RefillHealthPlusMagic:
LDA.l BigFairyHealth : STA.l HeartsFiller
LDA BigFairyHealth : STA HeartsFiller
RTL
;--------------------------------------------------------------------------------
RefillHealthPlusMagic8bit:
LDA.l BigFairyHealth : STA.l HeartsFiller
LDA.l BigFairyMagic : STA.l MagicFiller
LDA BigFairyHealth : STA HeartsFiller
LDA BigFairyMagic : STA MagicFiller
RTL
;--------------------------------------------------------------------------------
CheckFullHealth:
LDA.l BigFairyHealth : BEQ +
LDA.l CurrentHealth : CMP.l MaximumHealth : BNE .player_hp_not_full_yet
LDA BigFairyHealth : BEQ +
LDA CurrentHealth : CMP MaximumHealth : BNE .player_hp_not_full_yet
+
LDA.l BigFairyMagic : BEQ +
LDA.l CurrentMagic : CMP.b #$80 : BNE .player_mp_not_full_yet
LDA BigFairyMagic : BEQ +
LDA CurrentMagic : CMP.b #$80 : BNE .player_mp_not_full_yet
+
LDA.b #$00
RTL
@@ -30,56 +30,57 @@ FairyPond_Init:
JML.l Sprite_ShowMessageFromPlayerContact
+
PHY : JSL.l Sprite_CheckDamageToPlayerSameLayerLong : BCC +
LDA.l BottleContentsOne : CMP.b #$02 : BNE ++ : LDA.b #$1C : PHA : BRA .emptyBottle : ++
LDA.l BottleContentsTwo : CMP.b #$02 : BNE ++ : LDA.b #$1D : PHA : BRA .emptyBottle : ++
LDA.l BottleContentsThree : CMP.b #$02 : BNE ++ : LDA.b #$1E : PHA : BRA .emptyBottle : ++
LDA.l BottleContentsFour : CMP.b #$02 : BNE ++ : LDA.b #$1F : PHA : BRA .emptyBottle : ++
LDA BottleContentsOne : CMP.b #$02 : BNE ++ : LDA.b #$1C : PHA : BRA .emptyBottle : ++
LDA BottleContentsTwo : CMP.b #$02 : BNE ++ : LDA.b #$1D : PHA : BRA .emptyBottle : ++
LDA BottleContentsThree : CMP.b #$02 : BNE ++ : LDA.b #$1E : PHA : BRA .emptyBottle : ++
LDA BottleContentsFour : CMP.b #$02 : BNE ++ : LDA.b #$1F : PHA : BRA .emptyBottle : ++
.noInventory
LDA.b #$0A : STA.w SpriteActivity, X
LDA.b #$0A : STA $0D80, X
LDA.b #$51
LDY.b #$01
JSL.l Sprite_ShowMessageFromPlayerContact
JMP .cleanup
.emptyBottle
LDA.b #$02 : STA.w SpriteActivity, X
STZ.b LinkDirection
LDA.b #$01 : STA.w CutsceneFlag
PLA : STA.w MessageCursor
LDA.b #$02 : STA $0D80, X
;JSL Player_ResetState ; If we continue to have issues, add this in too. (After determining the address for it)
STZ $2F
LDA.b #$01 : STA $02E4
PLA : STA $1CE8
.cleanup
STZ.w SpriteDirectionTable, X ; Clear the sprite's item-given variable
STZ $0EB0, X ; Clear the sprite's item-given variable
CLC ; skip rest of original function
+ : PLY
RTL
;--------------------------------------------------------------------------------
HappinessPond_Check:
LDA.b RoomIndex : CMP.b #$15 ;what we wrote over
LDA $A0 : CMP.b #$15 ;what we wrote over
BNE .done
PHP
LDA.b #$72
JSL Sprite_SpawnDynamically
LDA.w SpriteCoordCacheX : STA.w SpritePosXLow, Y
LDA.w SpriteCoordCacheX+1 : STA.w SpritePosXHigh, Y
LDA $0FD8 : STA $0D10, Y
LDA $0FD9 : STA $0D30, Y
LDA.w SpriteCoordCacheY : !SUB.b #$40 : STA.w SpritePosYLow, Y
LDA.w SpriteCoordCacheY+1 : SBC.b #$00 : STA.w SpritePosYHigh, Y
LDA $0FDA : !SUB.b #$40 : STA $0D00, Y
LDA $0FDB : SBC.b #$00 : STA $0D20, Y
LDA.b #$01 : STA.w SpriteAuxTable, Y
LDA.b #$01 : STA $0DA0, Y
LDA.b #$BB
JSL Sprite_SpawnDynamically
LDA.b #$08 : STA.w SpriteAITable, Y ; ensure we run prep for the shopkeeper
LDA.b #$08 : STA $0DD0, Y ; ensure we run prep for the shopkeeper
LDA.w SpriteCoordCacheX : STA.w SpritePosXLow, Y
LDA.w SpriteCoordCacheX+1 : STA.w SpritePosXHigh, Y
LDA $0FD8 : STA $0D10, Y
LDA $0FD9 : STA $0D30, Y
LDA.w SpriteCoordCacheY : !SUB.b #$20 : STA.w SpritePosYLow, Y
LDA.w SpriteCoordCacheY+1 : SBC.b #$00 : STA.w SpritePosYHigh, Y
LDA $0FDA : !SUB.b #$20 : STA $0D00, Y
LDA $0FDB : SBC.b #$00 : STA $0D20, Y
STZ.w SpriteAITable, X ; self terminate
STZ $0DD0, X ; self terminate
PLP
.done

View File

@@ -1,21 +1,21 @@
;===================================================================================================
FastCreditsCutsceneTimer:
BIT.b Joy1B_All-1 : BVC .slow
BIT.b $F2-1 : BVC .slow
LDA.w #$0001 : STA.b $50
LDA.b ScrapBufferBD+$0B
LDA.b $C8
CLC
ADC.w #$0004
AND.w #$FFFE
STA.b ScrapBufferBD+$0B
STA.b $C8
SEP #$20
RTL
.slow
INC.b ScrapBufferBD+$0B
INC.b $C8
SEP #$20
RTL
@@ -51,16 +51,16 @@ FastCreditsCutsceneScroll:
LDA.w $00E2,Y
CMP.l $0EC308,X ; compare to target
ROL.b Scrap00 ; put carry in here
ROL.b $00 ; put carry in here
LDA.l $0EC348,X ; get movement
BPL ++ ; if positive, leave saved carry alone
INC.b Scrap00 ; otherwise, flip it
++ ROR.b Scrap00 ; recover carry
INC.b $00 ; otherwise, flip it
++ ROR.b $00 ; recover carry
BCC ++ ; scroll if carry not set
LDA.w #$0000
++ BIT.b Joy1B_All-1 : BVC .slow ; check for X held
++ BIT.b $F2-1 : BVC .slow ; check for X held
AND.w #$FFFF ; get sign of A
BPL .positive
@@ -90,8 +90,8 @@ FastCreditsCutsceneScroll:
FastCreditsCutsceneUnderworldX:
JSR FastCreditsCutsceneScrollX
CLC
ADC.b BG2H
STA.b BG2H
ADC.b $E2
STA.b $E2
RTL
@@ -99,15 +99,15 @@ FastCreditsCutsceneUnderworldX:
FastCreditsCutsceneUnderworldY:
JSR FastCreditsCutsceneScrollY
CLC
ADC.b BG2V
STA.b BG2V
ADC.b $E8
STA.b $E8
RTL
FastTextScroll:
LDA.b FrameCounter
BIT.b Joy1B_All-1 : BVC .slow
LDA.b $1A
BIT.b $F2-1 : BVC .slow
AND.w #$0000
RTL

View File

@@ -1,17 +1,18 @@
!ValidKeyLoaded = "$7F509E"
;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
!FS_COLOR_BLUE = $0C00
!FS_COLOR_GRAY = $1000 ;(Used to gray out items)
!FS_COLOR_BOOTS = $1400
!FS_COLOR_GREEN = $1800
!FS_COLOR_BW = $1C00
!FS_COLOR_BROWN = "$0000" ;(only used for: Shovel, hammer, powder)
!FS_COLOR_RED = "$0400"
!FS_COLOR_YELLOW = "$0800"
!FS_COLOR_BLUE = "$0C00"
!FS_COLOR_GRAY = "$1000" ;(Used to gray out items)
!FS_COLOR_BOOTS = "$1400"
!FS_COLOR_GREEN = "$1800"
!FS_COLOR_BW = "$1C00"
!FS_HFLIP = $4000
!FS_VFLIP = $8000
!FS_HFLIP = "$4000"
!FS_VFLIP = "$8000"
macro fs_draw8x8(screenrow,screencol)
;Note due to XKAS's screwy math this formula is misleading.
@@ -82,89 +83,45 @@ JMP DrawItemGray
DrawBottle:
AND.w #$00FF : BNE +
LDX.w #FileSelectItems_empty_bottle
LDX #FileSelectItems_empty_bottle
JMP DrawItemGray
+ : DEC #2 : BNE +
LDX.w #FileSelectItems_empty_bottle
LDX #FileSelectItems_empty_bottle
JMP DrawItem
+ : DEC : BNE +
LDX.w #FileSelectItems_red_potion
LDX #FileSelectItems_red_potion
JMP DrawItem
+ : DEC : BNE +
LDX.w #FileSelectItems_green_potion
LDX #FileSelectItems_green_potion
JMP DrawItem
+ : DEC : BNE +
LDX.w #FileSelectItems_blue_potion
LDX #FileSelectItems_blue_potion
JMP DrawItem
+ : DEC : BNE +
LDX.w #FileSelectItems_fairy_bottle
LDX #FileSelectItems_fairy_bottle
JMP DrawItem
+ : DEC : BNE +
LDX.w #FileSelectItems_bee_bottle
LDX #FileSelectItems_bee_bottle
JMP DrawItem
+
LDX.w #FileSelectItems_good_bee_bottle
LDX #FileSelectItems_good_bee_bottle
JMP DrawItem
DrawPlayerFile:
LDA.b FrameCounter : AND.w #$0001 : BNE .normal
LDA $1A : AND.w #$0001 : BNE .normal
JSR DrawPlayerFileShared
INC.w SkipOAM ; Suppress animated tile updates for this frame
INC $0710 ; Suppress animated tile updates for this frame
; re-enable Stripe Image format upload on this frame
; Value loaded must match what gets set by AltBufferTable
LDA.w #$0161 : STA.w GFXStripes+2
LDA.w #$C000>>1
XBA
STA.w GFXStripes+$0402
LDA.w #$C03E>>1
XBA
STA.w GFXStripes+$0408
LDA.w #$C000|57
XBA
STA.w GFXStripes+$0404
STA.w GFXStripes+$040A
LDA.w #$0188 ; change back to 12BF to restore the border
STA.w GFXStripes+$0406
ORA.w #$4000
STA.w GFXStripes+$040C
LDA.w #$C0C6>>1
XBA
STA.w GFXStripes+$040E
LDA.w #$4001
XBA
STA.w GFXStripes+$0410
LDA.l DisableFlashing
AND.w #$00FF
BEQ .flashing
LDA.w #$26BE
BRA .draw_access_icon
.flashing
LDA.w #$0188
NOP ; 2 cycles wasted to be equal
.draw_access_icon
STA.w GFXStripes+$0412
LDA.w #$FFFF
STA.w GFXStripes+$0414
LDA.w #$0161 : STA $1002
BRA .done
.normal
STZ.w SkipOAM ; ensure core animated tile updates are not suppressed
LDA.w #$FFFF : STA.w GFXStripes+2 ; Suppress Stripe Image format upload on this frame
STZ $0710 ; ensure core animated tile updates are not suppressed
LDA #$FFFF : STA.w $1002 ; Suppress Stripe Image format upload on this frame
.done
LDA.w #$0004 : STA.b Scrap02 ; thing we wrote over
LDA.w #$0004 : STA $02 ; thing we wrote over
RTL
@@ -175,29 +132,29 @@ DrawPlayerFileShared:
LDA.b #FileSelectItems>>16 : PHA : PLB
REP #$20 ; restore 16 bit accumulator
LDA.l ExtendedFileNameSRAM+$08 : ORA.w #!FS_COLOR_BW
LDA ExtendedFileNameSRAM+$08 : ORA.w #!FS_COLOR_BW
%fs_draw8x16(6,5)
LDA.l ExtendedFileNameSRAM+$0A : ORA.w #!FS_COLOR_BW
LDA ExtendedFileNameSRAM+$0A : ORA.w #!FS_COLOR_BW
%fs_draw8x16(6,6)
LDA.l ExtendedFileNameSRAM+$0C : ORA.w #!FS_COLOR_BW
LDA ExtendedFileNameSRAM+$0C : ORA.w #!FS_COLOR_BW
%fs_draw8x16(6,7)
LDA.l ExtendedFileNameSRAM+$0E : ORA.w #!FS_COLOR_BW
LDA ExtendedFileNameSRAM+$0E : ORA.w #!FS_COLOR_BW
%fs_draw8x16(6,8)
LDA.l ExtendedFileNameSRAM+$10 : ORA.w #!FS_COLOR_BW
LDA ExtendedFileNameSRAM+$10 : ORA.w #!FS_COLOR_BW
%fs_draw8x16(9,5)
LDA.l ExtendedFileNameSRAM+$12 : ORA.w #!FS_COLOR_BW
LDA ExtendedFileNameSRAM+$12 : ORA.w #!FS_COLOR_BW
%fs_draw8x16(9,6)
LDA.l ExtendedFileNameSRAM+$14 : ORA.w #!FS_COLOR_BW
LDA ExtendedFileNameSRAM+$14 : ORA.w #!FS_COLOR_BW
%fs_draw8x16(9,7)
LDA.l ExtendedFileNameSRAM+$16 : ORA.w #!FS_COLOR_BW
LDA ExtendedFileNameSRAM+$16 : ORA.w #!FS_COLOR_BW
%fs_draw8x16(9,8)
JSR FileSelectDrawHudBar
; Bow
LDA.l BowTrackingSRAM : AND.w #$0040 : BEQ +
LDA.l EquipmentSRAM+$00 : AND.w #$00FF : BEQ ++
LDA EquipmentSRAM+$00 : AND.w #$00FF : BEQ ++
%fs_drawItem(3,12,FileSelectItems_silver_bow)
BRA .bow_end
++
@@ -242,7 +199,7 @@ DrawPlayerFileShared:
++
; Mushroom
LDA.l InventoryTrackingSRAM : AND.w #$0028 : BEQ +
LDA.l InventoryTrackingSRAM : AND.w #$0008 : BEQ +
%fs_drawItem(3,18,FileSelectItems_mushroom)
BRA ++
+
@@ -394,10 +351,10 @@ DrawPlayerFileShared:
%fs_drawItem(9,26,FileSelectItems_heart_piece_3_of_4)
++
LDA.l EquipmentSRAM+$0108 : AND.w #$00FF
LDA EquipmentSRAM+$0108 : 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 $7F5006 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(11,26)
LDA $7F5007 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(11,27)
; Boots
%fs_drawItemBasic(EquipmentSRAM+$15,3,28,FileSelectItems_boots)
@@ -420,21 +377,21 @@ DrawPlayerFileShared:
%fs_drawItemBasic(EquipmentSRAM+$17,9,28,FileSelectItems_pearl)
; Pendants
LDA.l EquipmentSRAM+$34 : AND.w #$0004 : BEQ +
LDA EquipmentSRAM+$34 : AND.w #$0004 : BEQ +
%fs_drawItem(12,12,FileSelectItems_green_pendant)
BRA ++
+
%fs_drawItem(12,12,FileSelectItems_no_pendant)
++
LDA.l EquipmentSRAM+$34 : AND.w #$0002 : BEQ +
LDA EquipmentSRAM+$34 : AND.w #$0002 : BEQ +
%fs_drawItem(12,14,FileSelectItems_blue_pendant)
BRA ++
+
%fs_drawItem(12,14,FileSelectItems_no_pendant)
++
LDA.l EquipmentSRAM+$34 : AND.w #$0001 : BEQ +
LDA EquipmentSRAM+$34 : AND.w #$0001 : BEQ +
%fs_drawItem(12,16,FileSelectItems_red_pendant)
BRA ++
+
@@ -442,49 +399,49 @@ DrawPlayerFileShared:
++
; Crystals
LDA.l EquipmentSRAM+$3A : AND.w #$0002 : BEQ +
LDA EquipmentSRAM+$3A : AND.w #$0002 : BEQ +
LDA.w #$0297|!FS_COLOR_BLUE
BRA ++
+
LDA.w #$0287|!FS_COLOR_GRAY
++ : %fs_draw16x8(13,18)
LDA.l EquipmentSRAM+$3A : AND.w #$0010 : BEQ +
LDA EquipmentSRAM+$3A : AND.w #$0010 : BEQ +
LDA.w #$0297|!FS_COLOR_BLUE
BRA ++
+
LDA.w #$0287|!FS_COLOR_GRAY
++ : %fs_draw16x8(12,19)
LDA.l EquipmentSRAM+$3A : AND.w #$0040 : BEQ +
LDA EquipmentSRAM+$3A : AND.w #$0040 : BEQ +
LDA.w #$0297|!FS_COLOR_BLUE
BRA ++
+
LDA.w #$0287|!FS_COLOR_GRAY
++ : %fs_draw16x8(13,20)
LDA.l EquipmentSRAM+$3A : AND.w #$0020 : BEQ +
LDA EquipmentSRAM+$3A : AND.w #$0020 : BEQ +
LDA.w #$0297|!FS_COLOR_BLUE
BRA ++
+
LDA.w #$0287|!FS_COLOR_GRAY
++ : %fs_draw16x8(12,21)
LDA.l EquipmentSRAM+$3A : AND.w #$0004 : BEQ +
LDA EquipmentSRAM+$3A : AND.w #$0004 : BEQ +
LDA.w #$0297|!FS_COLOR_RED
BRA ++
+
LDA.w #$0287|!FS_COLOR_GRAY
++ : %fs_draw16x8(13,22)
LDA.l EquipmentSRAM+$3A : AND.w #$0001 : BEQ +
LDA EquipmentSRAM+$3A : AND.w #$0001 : BEQ +
LDA.w #$0297|!FS_COLOR_RED
BRA ++
+
LDA.w #$0287|!FS_COLOR_GRAY
++ : %fs_draw16x8(12,23)
LDA.l EquipmentSRAM+$3A : AND.w #$0008 : BEQ +
LDA EquipmentSRAM+$3A : AND.w #$0008 : BEQ +
LDA.w #$0297|!FS_COLOR_BLUE
BRA ++
+
@@ -637,121 +594,122 @@ FileSelectItems:
;--------------------------------------------------------------------------------
FileSelectDrawHudBar:
LDA.w #$029B|!FS_COLOR_GREEN : %fs_draw16x8(0,10)
LDA.l DisplayRupeesSRAM
LDA #$029B|!FS_COLOR_GREEN : %fs_draw16x8(0,10)
LDA EquipmentSRAM+$22
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 $7F5004 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(1,9)
LDA $7F5005 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(1,10)
LDA $7F5006 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(1,11)
LDA $7F5007 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(1,12)
LDA.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
LDA SpecialWeapons : AND.w #$00FF : CMP #$0001 : BEQ .colorBombs
LDA #$028B|!FS_COLOR_BLUE : %fs_draw16x8(0,14)
LDA EquipmentSRAM+$03 : 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)
LDA $7F5006 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(1,14)
LDA $7F5007 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(1,15)
BRA ++
.colorBombs
LDA.l $70038F : AND.w #$00FF : BNE +
LDA $70038F : AND.w #$00FF : BNE +
; no bombs, draw no icon
BRA ++
+ : DEC : BNE +
LDA.w #$028B|!FS_COLOR_GREEN : %fs_draw16x8(0,14)
LDA #$028B|!FS_COLOR_GREEN : %fs_draw16x8(0,14)
BRA ++
+ : DEC : BNE +
LDA.w #$028B|!FS_COLOR_BLUE : %fs_draw16x8(0,14)
LDA #$028B|!FS_COLOR_BLUE : %fs_draw16x8(0,14)
BRA ++
+ : DEC : BNE +
LDA.w #$028B|!FS_COLOR_RED : %fs_draw16x8(0,14)
LDA #$028B|!FS_COLOR_RED : %fs_draw16x8(0,14)
BRA ++
+
LDA.w #$028B|!FS_COLOR_YELLOW : %fs_draw16x8(0,14)
LDA #$028B|!FS_COLOR_YELLOW : %fs_draw16x8(0,14)
++
LDA.l BowTrackingSRAM : AND.w #$0040 : BEQ +
LDA.w #$0299|!FS_COLOR_RED : %fs_draw16x8(0,17)
LDA #$0299|!FS_COLOR_RED : %fs_draw16x8(0,17)
BRA ++
+
LDA.w #$0289|!FS_COLOR_BROWN : %fs_draw16x8(0,17)
LDA #$0289|!FS_COLOR_BROWN : %fs_draw16x8(0,17)
++
LDA.l CurrentArrowsSRAM : AND.w #$00FF
LDA EquipmentSRAM+$37 : 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 $7F5006 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(1,17)
LDA $7F5007 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(1,18)
RTS
;--------------------------------------------------------------------------------
AltBufferTable:
LDA.b #$02 : STA.w BG34NBA ; Have Screen 3 use same tile area as screens 1
LDA.b #$02 : STA $210c ; Have Screen 3 use same tile area as screens 1
.noScreen3Change
REP #$20
LDX.w #$0400 ; 14 rows with 64 bytes (30 tiles * 2 + 4 byte header)
;fill with the blank character
LDA.w #$0188
-
STA.w GFXStripes, X
STA $1000, X
DEX : DEX : BNE -
; set vram offsets
LDA.w #$0161 : STA.w GFXStripes+$02 ;file 1 top row
LDA.w #$2161 : STA.w GFXStripes+$42 ;file 1 bottom row
LDA.w #$0161 : STA $1002 ;file 1 top row
LDA.w #$2161 : STA $1042 ;file 1 bottom row
LDA.w #$4161 : STA.w GFXStripes+$82 ;gap row top
LDA.w #$6161 : STA.w GFXStripes+$C2 ;gap row bottom
LDA.w #$4161 : STA $1082 ;gap row top
LDA.w #$6161 : STA $10C2 ;gap row bottom
LDA.w #$8161 : STA.w GFXStripes+$0102 ;file 2 top row
LDA.w #$A161 : STA.w GFXStripes+$0142 ;file 2 bottom row
LDA.w #$8161 : STA $1102 ;file 2 top row
LDA.w #$A161 : STA $1142 ;file 2 bottom row
LDA.w #$C161 : STA.w GFXStripes+$0182 ;gap row top
LDA.w #$E161 : STA.w GFXStripes+$01C2 ;gap row bottom
LDA.w #$C161 : STA $1182 ;gap row top
LDA.w #$E161 : STA $11c2 ;gap row bottom
LDA.w #$0162 : STA.w GFXStripes+$0202 ;file 3 top row
LDA.w #$2162 : STA.w GFXStripes+$0242 ;file 3 bottom row
LDA.w #$0162 : STA $1202 ;file 3 top row
LDA.w #$2162 : STA $1242 ;file 3 bottom row
LDA.w #$4162 : STA.w GFXStripes+$0282 ;extra gap row top
LDA.w #$6162 : STA.w GFXStripes+$02C2 ;extra gap row bottom
LDA.w #$4162 : STA $1282 ;extra gap row top
LDA.w #$6162 : STA $12c2 ;extra gap row bottom
LDA.w #$8162 : STA.w GFXStripes+$0302 ;extra gap row top
LDA.w #$A162 : STA.w GFXStripes+$0342 ;extra gap row bottom
LDA.w #$8162 : STA $1302 ;extra gap row top
LDA.w #$A162 : STA $1342 ;extra gap row bottom
LDA.w #$C162 : STA.w GFXStripes+$0382 ;extra gap row top
LDA.w #$E162 : STA.w GFXStripes+$03C2 ;extra gap row bottom
LDA.w #$C162 : STA $1382 ;extra gap row top
LDA.w #$E162 : STA $13C2 ;extra gap row bottom
; set lengths
LDA.w #$3B00
STA.w GFXStripes+$04 ;file 1 top row
STA.w GFXStripes+$44 ;file 1 bottom row
STA.w GFXStripes+$84 ;gap row top
STA.w GFXStripes+$C4 ;gap row bottom
STA.w GFXStripes+$0104 ;file 2 top row
STA.w GFXStripes+$0144 ;file 2 bottom row
STA.w GFXStripes+$0184 ;gap row top
STA.w GFXStripes+$01C4 ;gap row bottom
STA.w GFXStripes+$0204 ;file 3 top row
STA.w GFXStripes+$0244 ;file 3 bottom row
STA.w GFXStripes+$0284 ;extra gap row top
STA.w GFXStripes+$02C4 ;extra gap row bottom
STA.w GFXStripes+$0304 ;extra gap row top
STA.w GFXStripes+$0344 ;extra gap row bottom
STA.w GFXStripes+$0384 ;extra gap row top
STA.w GFXStripes+$03C4 ;extra gap row bottom
STA $1004 ;file 1 top row
STA $1044 ;file 1 bottom row
STA $1084 ;gap row top
STA $10C4 ;gap row bottom
STA $1104 ;file 2 top row
STA $1144 ;file 2 bottom row
STA $1184 ;gap row top
STA $11C4 ;gap row bottom
STA $1204 ;file 3 top row
STA $1244 ;file 3 bottom row
STA $1284 ;extra gap row top
STA $12C4 ;extra gap row bottom
STA $1304 ;extra gap row top
STA $1344 ;extra gap row bottom
STA $1384 ;extra gap row top
STA $13C4 ;extra gap row bottom
; Set last packet marker
LDA.w #$00FF : STA.w GFXStripes+$0402
LDA.w #$00FF : STA $1402
; Draw Unlock option if applicable
LDA.b GameMode : AND.w #$00FF : CMP.w #$0001 : BNE +
LDA.l IsEncrypted : AND.w #$00FF : CMP.w #$0002 : BNE +
PHP : SEP #$30 : PHX : PHY : JSL ValidatePassword : PLY : PLX : PLP
AND.w #$00FF : BNE +
LDA.w #!FSTILE_U_TOP : %fs_draw8x16(14,5)
LDA.w #!FSTILE_N_TOP : %fs_draw8x16(14,6)
LDA.w #!FSTILE_L_TOP : %fs_draw8x16(14,7)
LDA.w #!FSTILE_O_TOP : %fs_draw8x16(14,8)
LDA.w #!FSTILE_C_TOP : %fs_draw8x16(14,9)
LDA.w #!FSTILE_K_TOP : %fs_draw8x16(14,10)
+
SEP #$20
LDA $10 : AND.w #$00FF : CMP.w #$0001 : BNE +
LDA.l IsEncrypted : AND.w #$00FF : CMP.w #$0002 : BNE +
PHP : SEP #$30 : PHX : PHY : JSL ValidatePassword : PLY : PLX : PLP
AND.w #$00FF : BNE +
LDA.w #!FSTILE_U_TOP : %fs_draw8x16(14,5)
LDA.w #!FSTILE_N_TOP : %fs_draw8x16(14,6)
LDA.w #!FSTILE_L_TOP : %fs_draw8x16(14,7)
LDA.w #!FSTILE_O_TOP : %fs_draw8x16(14,8)
LDA.w #!FSTILE_C_TOP : %fs_draw8x16(14,9)
LDA.w #!FSTILE_K_TOP : %fs_draw8x16(14,10)
+
SEP #$20
RTL
;--------------------------------------------------------------------------------
@@ -759,36 +717,36 @@ AltBufferTable_credits:
JSL AltBufferTable_noScreen3Change
REP #$20
LDA.w #$6168 : STA.w GFXStripes+$02 ;file 1 top row
LDA.w #$8168 : STA.w GFXStripes+$42 ;file 1 bottom row
LDA.w #$6168 : STA $1002 ;file 1 top row
LDA.w #$8168 : STA $1042 ;file 1 bottom row
LDA.w #$A168 : STA.w GFXStripes+$82 ;gap row top
LDA.w #$C168 : STA.w GFXStripes+$C2 ;gap row bottom
LDA.w #$A168 : STA $1082 ;gap row top
LDA.w #$C168 : STA $10C2 ;gap row bottom
LDA.w #$E168 : STA.w GFXStripes+$0102 ;file 2 top row
LDA.w #$0169 : STA.w GFXStripes+$0142 ;file 2 bottom row
LDA.w #$E168 : STA $1102 ;file 2 top row
LDA.w #$0169 : STA $1142 ;file 2 bottom row
LDA.w #$2169 : STA.w GFXStripes+$0182 ;gap row top
LDA.w #$4169 : STA.w GFXStripes+$01c2 ;gap row bottom
LDA.w #$2169 : STA $1182 ;gap row top
LDA.w #$4169 : STA $11c2 ;gap row bottom
LDA.w #$6169 : STA.w GFXStripes+$0202 ;file 3 top row
LDA.w #$8169 : STA.w GFXStripes+$0242 ;file 3 bottom row
LDA.w #$6169 : STA $1202 ;file 3 top row
LDA.w #$8169 : STA $1242 ;file 3 bottom row
LDA.w #$A169 : STA.w GFXStripes+$0282 ;extra gap row top
LDA.w #$C169 : STA.w GFXStripes+$02C2 ;extra gap row bottom
LDA.w #$A169 : STA $1282 ;extra gap row top
LDA.w #$C169 : STA $12c2 ;extra gap row bottom
LDA.w #$E169 : STA.w GFXStripes+$0302 ;extra gap row top
LDA.w #$016A : STA.w GFXStripes+$0342 ;extra gap row bottom
LDA.w #$E169 : STA $1302 ;extra gap row top
LDA.w #$016A : STA $1342 ;extra gap row bottom
LDA.w #$216A : STA.w GFXStripes+$0382 ;extra gap row top
LDA.w #$416A : STA.w GFXStripes+$03C2 ;extra gap row bottom
LDA.w #$216A : STA $1382 ;extra gap row top
LDA.w #$416A : STA $13C2 ;extra gap row bottom
SEP #$20
RTL
;--------------------------------------------------------------------------------
macro LayoutPriority(address)
LDX.w #$003C
- : LDA.w <address>, X : ORA.w #$2000 : STA.w <address>, X
- : LDA.w <address>, X : ORA #$2000 : STA.w <address>, X
DEX : DEX : BNE -
endmacro
@@ -814,47 +772,47 @@ 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 $4300 : PHA ; preserve DMA parameters
LDA $4301 : PHA ; preserve DMA parameters
LDA $4302 : PHA ; preserve DMA parameters
LDA $4303 : PHA ; preserve DMA parameters
LDA $4304 : PHA ; preserve DMA parameters
LDA $4305 : PHA ; preserve DMA parameters
LDA $4306 : PHA ; preserve DMA parameters
;--------------------------------------------------------------------------------
LDA.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 #$80 : STA $2115 ; write read increment on $2119
LDA.b #$01 : STA $4300 ; set DMA transfer direction A -> B, bus A auto increment, double-byte mode
LDA.b #$18 : STA $4301 ; 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 #$00 : STA $2116 ; write VRAM destination address
LDA.b #$30 : STA $2117 ; 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.b #$31 : STA $4304 ; set bus A source bank
LDA.b #FileSelectNewGraphics : STA $4302 ; set bus A source address to ROM
LDA.b #FileSelectNewGraphics>>8 : STA $4303 ; set bus A source address to ROM
LDA.w INIDISP : PHA : LDA.b #$80 : STA.w INIDISP ; save screen state & turn screen off
LDA $2100 : PHA : LDA.b #$80 : STA $2100 ; 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
STZ $4305 : LDA.b #$10 : STA $4306 ; set transfer size to 0x1000
LDA #$01 : STA $420B ; begin DMA transfer
PLA : STA.w INIDISP ; put screen back however it was before
PLA : STA $2100 ; 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
PLA : STA $4306 ; restore DMA parameters
PLA : STA $4305 ; restore DMA parameters
PLA : STA $4304 ; restore DMA parameters
PLA : STA $4303 ; restore DMA parameters
PLA : STA $4302 ; restore DMA parameters
PLA : STA $4301 ; restore DMA parameters
PLA : STA $4300 ; restore DMA parameters
PLX : PLA
RTL
;--------------------------------------------------------------------------------
SetFileSelectPalette:
LDA.b GameMode : CMP.b #$04 : BNE +
LDA $10 : CMP.b #$04 : BNE +
; load the vanilla file select screen BG3 palette for naming screen
LDA.b #$01 : STA.w $0AB2
LDA.b #$01 : STA $0AB2
JSL.l Palette_Hud
BRA .done
+
@@ -870,12 +828,12 @@ LoadCustomHudPalette:
LDX.b #$40
-
LDA.l GFX_HUD_Palette, X
STA.l PaletteBuffer, X
STA.l $7EC500, X
DEX : DEX
BPL -
SEP #$20
INC.b NMICGRAM ; ensure CGRAM gets updated
INC $15 ; ensure CGRAM gets updated
PLX : PLA
RTL
;--------------------------------------------------------------------------------
@@ -883,16 +841,16 @@ DrawPlayerFile_credits:
; see $6563C for drawing first file name and hearts
REP #$20 ; set 16 bit accumulator
LDA.l EquipmentSRAM+$99 : ORA.w #!FS_COLOR_BW
LDA EquipmentSRAM+$99 : ORA.w #!FS_COLOR_BW
%fs_draw8x16(3,5)
LDA.l EquipmentSRAM+$9B : ORA.w #!FS_COLOR_BW
LDA EquipmentSRAM+$9B : ORA.w #!FS_COLOR_BW
%fs_draw8x16(3,6)
LDA.l EquipmentSRAM+$9D : ORA.w #!FS_COLOR_BW
LDA EquipmentSRAM+$9D : ORA.w #!FS_COLOR_BW
%fs_draw8x16(3,7)
LDA.l EquipmentSRAM+$9F : ORA.w #!FS_COLOR_BW
LDA EquipmentSRAM+$9F : ORA.w #!FS_COLOR_BW
%fs_draw8x16(3,8)
LDA.l EquipmentSRAM+$2C : AND.w #$00FF : LSR #3 : STA.b Scrap02
LDA EquipmentSRAM+$2C : AND.w #$00FF : LSR #3 : STA $02
%fs_LDY_screenpos(0,20)
LDA.w #$028F|!FS_COLOR_RED
LDX.w #$000A
@@ -906,61 +864,60 @@ DrawPlayerFile_credits:
TYA : !ADD.w #$40-$14 : TAY
PLA
+
DEC.b Scrap02 : BNE .nextHeart
DEC $02 : BNE .nextHeart
JSR DrawPlayerFileShared
RTL
;--------------------------------------------------------------------------------
FSCursorUp:
LDA.b FileSelectPosition : BNE +
LDA.b #$04 ; up from file becomes delete
LDA $C8 : BNE +
LDA #$04 ; up from file becomes delete
BRA .done
+ : CMP.b #$03 : BNE +
LDA.b #$00 ; up from unlock is the file
+ : CMP #$03 : BNE +
LDA #$00 ; up from unlock is the file
BRA .done
+
LDA.l IsEncrypted : CMP.b #$02 : BNE +
LDA.l ValidKeyLoaded : BNE +
LDA.b #$03 ; up from delete is unlock for password protected seeds
LDA.l !ValidKeyLoaded : BNE +
LDA #$03 ; up from delete is unlock for password protected seeds
BRA .done
+
LDA.b #$00 ;otherwise up from delete is file
LDA #$00 ;otherwise up from delete is file
.done
STA.b FileSelectPosition
STA $C8
RTL
FSCursorDown:
LDA.b FileSelectPosition : BNE +
LDA $C8 : BNE +
LDA.l IsEncrypted : CMP.b #$02 : BNE ++
LDA.l ValidKeyLoaded : BNE ++
LDA.b #$03 ; down from file is unlock for password protected seeds
LDA.l !ValidKeyLoaded : BNE ++
LDA #$03 ; down from file is unlock for password protected seeds
BRA .done
++
LDA.b #$04 ;otherwise down from file is delete
LDA #$04 ;otherwise down from file is delete
BRA .done
+ : CMP.b #$03 : BNE +
LDA.b #$04 ; down from unlock is delete
+ : CMP #$03 : BNE +
LDA #$04 ; down from unlock is delete
BRA .done
+
LDA.b #$00 ; down from delete is file
LDA #$00 ; down from delete is file
.done
STA.b FileSelectPosition
STA $C8
RTL
;--------------------------------------------------------------------------------
FSSelectFile:
LDA.l IsEncrypted : CMP.b #$02 : BNE .normal
STZ.w SFX2 ; temporarily cancel file screen selection sound
STZ $012E ; temporarily cancel file screen selection sound
PHX : PHY
JSL ValidatePassword : BEQ .must_unlock
PLY : PLX
LDA.b #$2C : STA.w SFX2 ;file screen selection sound
LDA.b #$2C : STA $012E ;file screen selection sound
.normal
LDA.b #$F1 : STA.w MusicControlRequest
LDA.b #$F1 : STA $012C
JML FSSelectFile_continue
.must_unlock
PLY : PLX
LDA.b #$03 : STA.b FileSelectPosition ;set cursor to unlock
LDA.b #$3C : STA.w SFX2 ; play error sound
LDA #$03 : STA $C8 ;set cursor to unlock
LDA.b #$3C : STA $012E ; play error sound
JML FSSelectFile_return
;--------------------------------------------------------------------------------
MaybeForceFileName:
@@ -970,8 +927,8 @@ MaybeForceFileName:
-
INX : INX
LDA.l StaticFileName, X : STA.l ExtendedFileNameSRAM, X
CPX.b #$16 : BEQ .done
CPX.b #$08 : BCS -
CPX #$16 : BEQ .done
CPX #$08 : BCS -
STA.l FileNameVanillaSRAM, X
BRA -
.done

BIN
data/fileselectgfx.2bpp → fileselect.chr.gfx Normal file → Executable file

Binary file not shown.

8
firebarlayer.asm Normal file
View File

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

View File

@@ -1,14 +1,78 @@
;================================================================================
; Fake Flippers Softlock Fix
;--------------------------------------------------------------------------------
; Written over and used by OnEnterWater hook.
UnequipCapeQuiet:
LDA.b #$20 : STA.w PoofTimer
STZ.w NoDamage
STZ.b CapeOn
STZ.w LinkZap
FlipperKill:
PHP
LDA $5D : CMP #$04 : BNE .done ; skip if we're not swimming
LDA FlippersEquipment : BNE .done ; skip if we have the flippers
LDA $7F5001 : BEQ .done ; skip if we're not marked in danger for softlock
LDA $8A : CMP $7F5098 : BEQ .done ; skip if we're on the same screen we entered the water on
;JSL.l KillFairies ; take away fairies
LDA IgnoreFaeries : ORA.b #$04 : STA IgnoreFaeries
LDA.b #$00 : STA CurrentHealth ; kill link
LDA.b #$00 : STA $7F5001 ; mark fake flipper softlock as impossible
.done
PLP
LDA CurrentHealth ; thing we wrote over
RTL
;--------------------------------------------------------------------------------
IgnoreFairyCheck:
LDX.b #$00 ; thing we wrote over
LDA IgnoreFaeries : BIT.b #$04 : BEQ .normal
AND.b #$FB : STA IgnoreFaeries ; clear ignore fairy flag
LDA.b #$F0 ; set check to invalid entry
RTL
.normal
LDA.b #$06 ; set check to fairy
RTL
;--------------------------------------------------------------------------------
;KillFairies:
; LDA BottleContentsOne : CMP #$06 : BNE +
; LDA #$02 : STA BottleContentsOne
; + LDA BottleContentsTwo : CMP #$06 : BNE +
; LDA #$02 : STA BottleContentsTwo
; + LDA BottleContentsThree : CMP #$06 : BNE +
; LDA #$02 : STA BottleContentsThree
; + LDA BottleContentsFour : CMP #$06 : BNE +
; LDA #$02 : STA BottleContentsFour
; +
;RTL
;--------------------------------------------------------------------------------
FlipperReset:
JSL $0998E8 ; AddTransitionSplash
LDA #$00 : STA $7F5001 ; mark fake flipper softlock as impossible
.done
RTL
;--------------------------------------------------------------------------------
FlipperFlag:
LDA $5D : CMP #$04 : BNE .done ; skip if we're not swimming
LDA FlippersEquipment : BNE .safe ; skip if we have the flippers
LDA #$01 : STA $7F5001 ; mark fake flipper softlock as possible
BRA .done
.safe
LDA #$00 : STA $7F5001 ; mark fake flipper softlock as impossible
.done
RTL
;--------------------------------------------------------------------------------
RegisterWaterEntryScreen:
PHA
LDA $8A : STA $7F5098 ; store ow index
PLA
RTL
;--------------------------------------------------------------------------------
MysteryWaterFunction: ; *$3AE54 ALTERNATE ENTRY POINT
LDA.b #$20 : STA $02E2
STZ $037B
STZ $55
STZ $0360
RTL
;--------------------------------------------------------------------------------
;===================================================================================================
; More elegant solution
;===================================================================================================
protectff:
LDA.l AllowAccidentalMajorGlitch
@@ -19,16 +83,16 @@ protectff:
.yes_protect
REP #$30
LDA.b LinkPosY
LDA.b $20
AND.w #$1E00
ASL
ASL
ASL
STA.b Scrap06
STA.b $06
LDA.b LinkPosX
LDA.b $22
AND.w #$1E00
ORA.b Scrap06
ORA.b $06
XBA
LSR
@@ -39,7 +103,7 @@ protectff:
; Remove dark world bit
; in game table that converts coordinates to actual screen ID
; special case for other areas
LDA.b OverworldIndex
LDA.b $8A
BMI .special_overworld
AND.b #$3F
@@ -48,17 +112,17 @@ protectff:
.protect
LDA.b #$15
STA.b LinkState
STA.b $5D
STZ.b LinkAnimationStep
STZ.b LinkWalkDirection
STZ.b $2E
STZ.b $67
LDA.b #$02
STA.b LinkDirection
STA.b $2F
STZ.w MedallionFlag
STZ.w CutsceneFlag
STZ.w NoMenu
STZ.w $0112
STZ.w $02E4
STZ.w $0FFC
++ RTL
@@ -71,3 +135,20 @@ protectff:
.spow
db $80, $81, $81, $FF, $FF, $FF, $FF, $FF
db $FF, $81, $81, $FF, $FF, $FF, $FF, $FF
FlipperScrollWarp:
STZ $00 : STZ $02 ; what we wrote over
LDA $308358 : BEQ .checkX : RTL
.checkX
LDA $22 : CMP.w $0604 : BCC +
CMP.w $0616 : BCS +
BRA .checkY
+ LDA $7EC186
STA $22
.checkY
LDA $20 : CMP.w $0600 : BCC +
CMP.w $0612 : BCS +
RTL
+ LDA $7EC184
STA $20
RTL

View File

@@ -5,21 +5,25 @@ FloodGateAndMasterSwordFollowerReset:
JSL.l MasterSwordFollowerClear
FloodGateReset:
LDA.l PersistentFloodgate : BNE +
LDA.l OverworldEventDataWRAM+$3B : AND.b #$DF : STA.l OverworldEventDataWRAM+$3B ; reset water outside floodgate
LDA.l OverworldEventDataWRAM+$7B : AND.b #$DF : STA.l OverworldEventDataWRAM+$7B ; reset water outside swamp palace
LDA.l RoomDataWRAM[$010B].low : AND.b #$7F : STA.l RoomDataWRAM[$010B].low ; clear water inside floodgate
LDA.l RoomDataWRAM[$28].high : AND.b #$FE : STA.l RoomDataWRAM[$28].high ; clear water front room (room 40)
LDA OverworldEventDataWRAM+$3B : AND.b #$DF : STA OverworldEventDataWRAM+$3B ; reset water outside floodgate
LDA OverworldEventDataWRAM+$7B : AND.b #$DF : STA OverworldEventDataWRAM+$7B ; reset water outside swamp palace
LDA RoomDataWRAM[$010B].low : AND.b #$7F : STA RoomDataWRAM[$010B].low ; clear water inside floodgate
LDA RoomDataWRAM[$28].high : AND.b #$FE : STA RoomDataWRAM[$28].high ; clear water front room (room 40)
+
FloodGateResetInner:
LDA.l Bugfix_SwampWaterLevel : BEQ +++
LDA.l RoomDataWRAM[$37].low : AND.b #$04 : BEQ + ; Check if key in room 55 has been collected.
LDA.l FlippersEquipment : AND.b #$01 : BNE ++ ; Check for flippers. This can otherwise softlock doors if flooded without flippers and no way to reset.
+
LDA.l RoomDataWRAM[$37].low : AND.b #$7F : STA.l RoomDataWRAM[$37].low ; clear water room 55 - outer room you shouldn't be able to softlock except in major glitches
++
LDA.l RoomDataWRAM[$35].high : AND.b #$04 : BNE +++ ; Check if key in room 53 has been collected.
LDA.l Bugfix_SwampWaterLevel : BEQ .done
LDA DRMode : BEQ .check_room_35; Only do the check for room 37 if on door rando
LDA.l SwampDrain1HasItem : BEQ .flipper_check
LDA $7F666F : AND.b #$80 : BEQ .drain_room_37 ; Check if key in room 37 has been collected.
.flipper_check
LDA FlippersEquipment : AND.b #$01 : BNE .check_room_35 ; Check for flippers. This can otherwise softlock doors if flooded without flippers and no way to reset.
.drain_room_37
LDA RoomDataWRAM[$37].low : AND.b #$7F : STA RoomDataWRAM[$37].low ; clear water room 37 - outer room you shouldn't be able to softlock except in major glitches
.check_room_35
LDA.l SwampDrain2HasItem : BEQ .done
LDA $7F666B : AND.b #$80 : BNE .done ; Check if key in room 35 has been collected.
; no need to check for flippers on the inner room, as you can't get to the west door no matter what, without flippers.
LDA.l RoomDataWRAM[$35].low : AND.b #$7F : STA.l RoomDataWRAM[$35].low ; clear water room 53 - inner room with the easy key flood softlock
+++
LDA RoomDataWRAM[$35].low : AND.b #$7F : STA RoomDataWRAM[$35].low ; clear water room 35 - inner room with the easy key flood softlock
.done
RTL
;================================================================================

View File

@@ -2,38 +2,39 @@
; Randomize Flute Dig Item
;--------------------------------------------------------------------------------
SpawnHauntedGroveItem:
LDA.b OverworldIndex : CMP.b #$2A : BEQ + : RTL : + ; Skip if not the haunted grove
LDA.b IndoorsFlag : BEQ + : RTL : + ; Skip if indoors
LDA $8A : CMP.b #$2A : BEQ + : RTL : + ; Skip if not the haunted grove
LDA $1B : BEQ + : RTL : + ; Skip if indoors
LDA.l HauntedGroveItem_Player : STA !MULTIWORLD_SPRITEITEM_PLAYER_ID
%GetPossiblyEncryptedItem(HauntedGroveItem, HeartPieceOutdoorValues)
JSL.l PrepDynamicTile
LDA.b #$EB
STA.l MiniGameTime
STA $7FFE00
JSL Sprite_SpawnDynamically
LDX.b #$00
LDA.b LinkDirection : CMP.b #$04 : BEQ + : INX : +
LDA $2F : CMP.b #$04 : BEQ + : INX : +
LDA.l .x_speeds, X : STA.w SpriteVelocityX, Y
LDA.l .x_speeds, X : STA $0D50, Y
LDA.b #$00 : STA.w SpriteVelocityY, Y
LDA.b #$18 : STA.w SpriteVelocityZ, Y
LDA.b #$FF : STA.w EnemyStunTimer, Y
LDA.b #$30 : STA.w SpriteTimerE, Y
LDA.b #$00 : STA $0D40, Y
LDA.b #$18 : STA $0F80, Y
LDA.b #$FF : STA $0B58, Y
LDA.b #$30 : STA $0F10, Y
LDA.b LinkPosX : !ADD.l .x_offsets, X
AND.b #$F0 : STA.w SpritePosXLow, Y
LDA.b LinkPosX+1 : ADC.b #$00 : STA.w SpritePosXHigh, Y
LDA $22 : !ADD.l .x_offsets, X
AND.b #$F0 : STA $0D10, Y
LDA $23 : ADC.b #$00 : STA $0D30, Y
LDA.b LinkPosY : !ADD.b #$16 : AND.b #$F0 : STA.w SpritePosYLow, Y
LDA.b LinkPosY+1 : ADC.b #$00 : STA.w SpritePosYHigh, Y
LDA $20 : !ADD.b #$16 : AND.b #$F0 : STA $0D00, Y
LDA $21 : ADC.b #$00 : STA $0D20, Y
LDA.b #$00 : STA.w SpriteLayer, Y
LDA.b #$00 : STA $0F20, Y
TYX
LDX.b OverworldIndex ; haunted grove (208D0A)
LDA.l OverworldEventDataWRAM, X : AND.b #$40 : BNE +
LDX $8A ; haunted grove (208D0A)
LDA OverworldEventDataWRAM, X : AND.b #$40 : BNE +
LDA.b #$1B : JSL Sound_SetSfx3PanLong
+
RTL
@@ -52,30 +53,33 @@ RTL
}
;--------------------------------------------------------------------------------
FluteBoy:
LDA.b GameMode : CMP.b #$1A : BEQ +
LDA.b #$01 : STA.w $0FDD
LDA $10 : CMP.b #$1A : BEQ +
LDA.b #$01 : STA $0FDD
JML.l FluteBoy_Abort
+
LDA.w SpriteActivity, X : CMP.b #$03 ; thing we wrote over
LDA $0D80, X : CMP.b #$03 ; thing we wrote over
JML.l FluteBoy_Continue
;--------------------------------------------------------------------------------
FreeDuckCheck:
LDA.l InvertedMode : BEQ .done
LDA.l FluteEquipment : CMP.b #$03 : BEQ .done ; flute is already active
LDA.l OWMode+1 : AND.b #!FLAG_OW_MIXED : BNE .skipInvertedCheck
LDA.l InvertedMode : BEQ .done
.skipInvertedCheck
LDA FluteEquipment : CMP.b #$03 : BEQ .done ; flute is already active
; check the area, is it #$18 = 30?
LDA.b OverworldIndex : CMP.b #$18 : BNE .done
LDA $8A : CMP.b #$18 : BNE .done
REP #$20
; Y coordinate boundaries for setting it off.
LDA.b LinkPosY
LDA $20
CMP.w #$0760 : BCC .done
CMP.w #$07E0 : BCS .done
; do if( (Ycoord >= 0x0760) && (Ycoord < 0x07e0
LDA.b LinkPosX
LDA $22
CMP.w #$01CF : BCC .done
CMP.w #$0230 : BCS .done
@@ -84,7 +88,7 @@ FreeDuckCheck:
SEP #$20
; Apparently a special Overworld mode for doing this?
LDA.b #$2D : STA.b GameSubMode
LDA.b #$2D : STA $11
; Trigger the sequence to start the weathervane explosion.
LDY.b #$00
@@ -94,12 +98,12 @@ FreeDuckCheck:
BRA .skipSong
.done
SEP #$20
LDA.b #$80 : STA.w FluteTimer ; thing we wrote over
LDA.b #$80 : STA $03F0 ; thing we wrote over, load flute timer
LDA.b #$13
RTL
.skipSong
SEP #$20
LDA.b #$80 : STA.w FluteTimer ; thing we wrote over
LDA.b #$80 : STA $03F0 ; thing we wrote over, load flute timer
LDA.b #$00
RTL
;--------------------------------------------------------------------------------

View File

@@ -2,40 +2,74 @@
; Frame Hook
;--------------------------------------------------------------------------------
FrameHookAction:
JSL $0080B5 ; Module_MainRouting
JSL CheckMusicLoadRequest
PHP : REP #$30 : PHA
SEP #$20
LDA.l StatsLocked : BNE ++
REP #$20 ; set 16-bit accumulator
LDA.l LoopFrames : INC : STA.l LoopFrames : BNE +
LDA.l LoopFrames+2 : INC : STA.l LoopFrames+2
+
LDA.l GameMode : CMP.w #$010E : BNE ++ ; move this to nmi hook?
LDA.l MenuFrames : INC : STA.l MenuFrames : BNE ++
LDA.l MenuFrames+2 : INC : STA.l MenuFrames+2
++
REP #$30 : PLA : PLP
JSL $0080B5 ; Module_MainRouting
JSL CheckMusicLoadRequest
PHP : REP #$30 : PHA
SEP #$20
LDA StatsLocked : BNE ++
REP #$20 ; set 16-bit accumulator
LDA LoopFrames : INC : STA LoopFrames : BNE +
LDA LoopFrames+2 : INC : STA LoopFrames+2
+
LDA $10 : CMP.w #$010E : BNE + ; move this to nmi hook?
LDA MenuFrames : INC : STA MenuFrames : BNE +
LDA MenuFrames+2 : INC : STA MenuFrames+2
+
++
REP #$30 : PLA : PLP
RTL
!NMI_MW = "$7F5047"
;--------------------------------------------------------------------------------
NMIHookAction:
PHA : PHX : PHY : PHD ; thing we wrote over, push stuff
LDA.l StatsLocked : AND.w #$00FF : BNE +
LDA.l NMIFrames : INC : STA.l NMIFrames : BNE +
LDA.l NMIFrames+2 : INC : STA.l NMIFrames+2
+
PHA : PHX : PHY : PHD ; thing we wrote over, push stuff
LDA !NMI_MW : BEQ ++
PHP
SEP #$30
LDA #$00 : STA !NMI_MW
; Multiworld text
LDA !NMI_MW+1 : BEQ +
LDA #$00 : STA !NMI_MW+1
JSL.l WriteText
+
PLP
++
LDA StatsLocked : AND.w #$00FF : BNE ++
LDA NMIFrames : INC : STA NMIFrames : BNE +
LDA NMIFrames+2 : INC : STA NMIFrames+2
+
++
JML.l NMIHookReturn
;--------------------------------------------------------------------------------
PostNMIHookAction:
LDA.w NMIAux : BEQ +
PHK : PEA .return-1 ; push stack for RTL return
JMP.w [NMIAux]
.return
STZ.w NMIAux ; zero bank byte of NMI hook pointer
+
LDA.b INIDISPQ : STA.w INIDISP ; thing we wrote over, turn screen back on
!NMI_AUX = "$7F5044"
PostNMIHookAction:
LDA.l !NMI_AUX+2 : BEQ .return
PHK
PEA .return-1
PHA
LDA.b #$00 : STA.l !NMI_AUX+2
REP #$20
LDA.l !NMI_AUX+0 : DEC : PHA
SEP #$20
RTL
.return
LDA.b $13 : STA.w $2100
JML.l PostNMIHookReturn
JML.l PostNMIHookReturn
;--------------------------------------------------------------------------------

16
ganonfixes.asm Normal file
View File

@@ -0,0 +1,16 @@
;================================================================================
; Ganon Fixes
;================================================================================
;--------------------------------------------------------------------------------
; GanonWarpRNG
; out: Accumulator - #$00 or #01 randomly, with no repeated #$01s
;--------------------------------------------------------------------------------
;GanonWarpRNG:
; JSL GetRandomInt : AND.b #$01 : BEQ .zero
; LDA !GANON_WARP_CHAIN : EOR #$01 : STA !GANON_WARP_CHAIN
;RTL
; .zero
; STA !GANON_WARP_CHAIN
;RTL
;--------------------------------------------------------------------------------

View File

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

View File

@@ -1,17 +1,21 @@
;--------------------------------------------------------------------------------
; $7F5010 - Scratch Space (Callee Preserved)
;--------------------------------------------------------------------------------
!GOAL_DRAW_ADDRESS = "$7EC72A"
;--------------------------------------------------------------------------------
; DrawGoalIndicator moved to newhud.asm
;--------------------------------------------------------------------------------
GoalItemGanonCheck:
LDA.w SpriteTypeTable, X : CMP.b #$D6 : BNE .success ; skip if not ganon
LDA.w $0D80, X : CMP.b #$12 : BEQ .fail
LDA $0E20, X : CMP.b #$D6 : BNE .success ; skip if not ganon
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
LDA $0D80, X : CMP.b #17 : !BLT .success ; decmial 17 because Acmlm's chart is decimal
LDA.b #$00
RTL
.success
LDA.b OAMOffsetY : CMP.b #$80 ; thing we wrote over
LDA $44 : CMP.b #$80 ; thing we wrote over
RTL
;--------------------------------------------------------------------------------
;Carry clear = ganon invincible
@@ -42,6 +46,7 @@ CheckGanonVulnerability:
dw .crystals_and_bosses
dw .bosses_only
dw .all_dungeons_no_agahnim
dw .completionist
; 00 = always vulnerable
.vulnerable
@@ -63,12 +68,12 @@ CheckGanonVulnerability:
.all_dungeons_no_agahnim
LDA.l PendantsField : AND.b #$07 : CMP.b #$07 : BNE .fail ; require all pendants
LDA.l CrystalsField : AND.b #$7F : CMP.b #$7F : BNE .fail ; require all crystals
LDA.l OverworldEventDataWRAM+$5B : AND.b #$20 : BEQ .fail ; require aga2 defeated (pyramid hole open)
LDA RoomDataWRAM[$0D].high : AND.b #$08 : BEQ .fail ; require aga2 defeated (pyramid hole open)
BRA .success
; 03 = crystals and aga 2
.crystals_and_aga
LDA.l OverworldEventDataWRAM+$5B : AND.b #$20 : BEQ .fail ; check aga2 first then bleed in
LDA RoomDataWRAM[$0D].high : AND.b #$08 : BEQ .fail ; check aga2 first then bleed in
; 04 = crystals only
.crystals
@@ -95,6 +100,15 @@ CheckGanonVulnerability:
.bosses_only
JMP CheckForCrystalBossesDefeated
; 0a = Check Item counter
.completionist
REP #$20
LDA.l TotalItemCounter : CMP.l MaxItemCounter
SEP #$20
BCC .fail
BRA .all_dungeons
;--------------------------------------------------------------------------------
GetRequiredCrystalsForTower:
BEQ + : JSL.l BreakTowerSeal_ExecuteSparkles : + ; thing we wrote over
@@ -121,12 +135,12 @@ GetRequiredCrystalsInX:
RTL
;--------------------------------------------------------------------------------
CheckEnoughCrystalsForGanon:
LDA.l CrystalCounter
LDA CrystalCounter
CMP.l NumberOfCrystalsRequiredForGanon
RTL
;--------------------------------------------------------------------------------
CheckEnoughCrystalsForTower:
LDA.l CrystalCounter
LDA CrystalCounter
CMP.l NumberOfCrystalsRequiredForTower
RTL
@@ -141,13 +155,13 @@ CheckAgaForPed:
BEQ .force_blue_ball
.vanilla ; run vanilla check for phase
LDA.w SpriteAux, X
LDA.w $0E30, X
CMP.b #$02
RTL
.force_blue_ball
LDA.b #$01 : STA.w SpriteAuxTable, Y
LDA.b #$20 : STA.w SpriteTimer, Y
LDA.b #$01 : STA.w $0DA0, Y
LDA.b #$20 : STA.w $0DF0, Y
CLC ; skip the RNG check
RTL
@@ -178,7 +192,7 @@ CheckForCrystalBossesDefeated:
REP #$30
; count of number of bosses killed
STZ.b Scrap00
STZ.b $00
LDY.w #10
@@ -198,7 +212,7 @@ CheckForCrystalBossesDefeated:
AND.w #$0800
BEQ ++
INC.b Scrap00
INC.b $00
++ DEY
BPL .next_check
@@ -206,7 +220,7 @@ CheckForCrystalBossesDefeated:
SEP #$30
PLY : PLX : PLB
LDA.b Scrap00 : CMP.l NumberOfCrystalsRequiredForGanon
LDA.b $00 : CMP.l NumberOfCrystalsRequiredForGanon
RTS

View File

@@ -6,10 +6,11 @@ GetMagicBatItem:
%GetPossiblyEncryptedItem(MagicBatItem, SpriteItemValues)
CMP.b #$FF : BEQ .normalLogic
TAY
STZ.b ItemReceiptMethod ; 0 = Receiving item from an NPC or message
PHA : LDA MagicBatItem_Player : STA !MULTIWORLD_ITEM_PLAYER_ID : PLA
STZ $02E9 ; 0 = Receiving item from an NPC or message
JML.l Link_ReceiveItem
.normalLogic
LDA.l HalfMagic
STA.l MagicConsumption
LDA HalfMagic
STA MagicConsumption
RTL
;--------------------------------------------------------------------------------

View File

@@ -3,22 +3,22 @@
;================================================================================
CalculateSpikeFloorDamage:
REP #$20 ; set 16-bit accumulator
LDA.b RoomIndex ; these are all decimal because i got them that way
LDA $A0 ; these are all decimal because i got them that way
CMP.w #279
SEP #$20 ; set 8-bit accumulator
BNE +
LDA.l ByrnaCaveSpikeDamage
STA.w DamageReceived
STA $0373
RTL
+
LDA.w $D055, Y
STA.w DamageReceived
LDA $D055, Y
STA $0373
RTL
;--------------------------------------------------------------------------------
CalculateByrnaUsage:
LDA.b IndoorsFlag : BEQ ++
LDA $1B : BEQ ++
REP #$20 ; set 16-bit accumulator
LDA.b RoomIndex ; these are all decimal because i got them that way
LDA $A0 ; these are all decimal because i got them that way
CMP.w #95 : BEQ + ; Ice Palace Spike Room
CMP.w #172 : BEQ + ; Blind Boss Room
CMP.w #179 : BEQ + ; Room in Misery Mire
@@ -29,16 +29,16 @@ CalculateByrnaUsage:
+
SEP #$20 ; set 8-bit accumulator
PHX : TYX
LDA.l HardModeExclusionCaneOfByrnaUsage, X : STA.b Scrap00
LDA.l HardModeExclusionCaneOfByrnaUsage, X : STA $00
PLX
++
LDA.l CurrentMagic ; thing we wrote over
LDA CurrentMagic ; thing we wrote over
JML IncrementMagicUseCounterByrna
;--------------------------------------------------------------------------------
CalculateCapeUsage:
LDA.b IndoorsFlag : BEQ ++
LDA $1B : BEQ ++
REP #$20 ; set 16-bit accumulator
LDA.b RoomIndex ; these are all decimal because i got them that way
LDA $A0 ; these are all decimal because i got them that way
CMP.w #95 : BEQ + ; Ice Palace Spike Room
CMP.w #179 : BEQ + ; Room in Misery Mire
CMP.w #213 : BEQ + ; Laser Bridge
@@ -48,15 +48,15 @@ CalculateCapeUsage:
+
SEP #$20 ; set 8-bit accumulator
PHX : TYX
LDA.l HardModeExclusionCapeUsage, X : STA.b CapeTimer ; set cape decrement timer
LDA.l HardModeExclusionCapeUsage, X : STA $4C ; set cape decrement timer
PLX
++
JML IncrementMagicUseCounterOne
;--------------------------------------------------------------------------------
ActivateInvulnerabilityOrDont:
LDA.b IndoorsFlag : BEQ .nowhere_special
LDA $1B : BEQ .nowhere_special
REP #$20 ; set 16-bit accumulator
LDA.b RoomIndex ; these are all decimal because i got them that way
LDA $A0 ; these are all decimal because i got them that way
CMP.w #95 : BEQ .somewhere_cool ; Ice Palace Spike Room
CMP.w #179 : BEQ .somewhere_cool ; Room in Misery Mire
CMP.w #213 : BEQ .somewhere_cool ; Laser Bridge
@@ -66,9 +66,9 @@ ActivateInvulnerabilityOrDont:
BRA .nowhere_special
.somewhere_cool
SEP #$20 ; set 8-bit accumulator
LDA.b #$01 : STA.w NoDamage : RTL
LDA.b #$01 : STA $037B : RTL
.nowhere_special
LDA.l ByrnaInvulnerability : STA.w NoDamage
LDA.l ByrnaInvulnerability : STA $037B
RTL
;--------------------------------------------------------------------------------
GetItemDamageValue:
@@ -87,13 +87,13 @@ GetItemDamageValue:
RTL
.normal
LDA.l $0DB8F1, X ; what we wrote over
LDA $0DB8F1, X ; what we wrote over
RTL
.boomerang
LDA.l StunItemAction : AND.b #$01 : BNE .normal
LDA.l StunItemAction : AND #$01 : BNE .normal
BRA .noDamage
.hookshot
LDA.l StunItemAction : AND.b #$02 : BNE .normal
LDA.l StunItemAction : AND #$02 : BNE .normal
.noDamage
LDA.b #$00
RTL
@@ -101,17 +101,17 @@ RTL
;Argument : A = id we want to find return 00 if none found, 01 if found
SearchAncilla:
{
STA.b Scrap05
STA $05
PHX
LDX.b #$00
LDX #$00
.loop
LDA.w AncillaID, X
LDA $0C4A, X
INX : CPX #$0A : BEQ .notFound
CMP.b Scrap05 : BNE .loop
LDA.b #$01
CMP $05 : BNE .loop
LDA #$01
BRA .return
.notFound
LDA.b #$00
LDA #$00
.return
PLX
RTS

View File

@@ -1,39 +1,41 @@
;--------------------------------------------------------------------------------
; Hash Alphabet
; ALPHA_BOW = $0000
; ALPHA_BOOM = $0001
; ALPHA_HOOK = $0002
; ALPHA_BOMB = $0003
; ALPHA_SHROOM = $0004
; ALPHA_POWDER = $0005
; ALPHA_ROD = $0006
; ALPHA_PENDANT = $0007
; ALPHA_BOMBOS = $0008
; ALPHA_ETHER = $0009
; ALPHA_QUAKE = $000A
; ALPHA_LAMP = $000B
; ALPHA_HAMMER = $000C
; ALPHA_SHOVEL = $000D
; ALPHA_FLUTE = $000E
; ALPHA_NET = $000F
; ALPHA_BOOK = $0010
; ALPHA_BOTTLE = $0011
; ALPHA_POTION = $0012
; ALPHA_CANE = $0013
; ALPHA_CAPE = $0014
; ALPHA_MIRROR = $0015
; ALPHA_BOOTS = $0016
; ALPHA_GLOVES = $0017
; ALPHA_FLIPPERS = $0018
; ALPHA_PEARL = $0019
; ALPHA_SHIELD = $001A
; ALPHA_TUNIC = $001B
; ALPHA_HEART = $001C
; ALPHA_MAP = $001D
; ALPHA_COMPASS = $001E
; ALPHA_KEY = $001F
;Hash Alphabet
!ALPHA_BOW = "#$0000"
!ALPHA_BOOM = "#$0001"
!ALPHA_HOOK = "#$0002"
!ALPHA_BOMB = "#$0003"
!ALPHA_SHROOM = "#$0004"
!ALPHA_POWDER = "#$0005"
!ALPHA_ROD = "#$0006"
!ALPHA_PENDANT = "#$0007"
!ALPHA_BOMBOS = "#$0008"
!ALPHA_ETHER = "#$0009"
!ALPHA_QUAKE = "#$000A"
!ALPHA_LAMP = "#$000B"
!ALPHA_HAMMER = "#$000C"
!ALPHA_SHOVEL = "#$000D"
!ALPHA_FLUTE = "#$000E"
!ALPHA_NET = "#$000F"
!ALPHA_BOOK = "#$0010"
!ALPHA_BOTTLE = "#$0011"
!ALPHA_POTION = "#$0012"
!ALPHA_CANE = "#$0013"
!ALPHA_CAPE = "#$0014"
!ALPHA_MIRROR = "#$0015"
!ALPHA_BOOTS = "#$0016"
!ALPHA_GLOVES = "#$0017"
!ALPHA_FLIPPERS = "#$0018"
!ALPHA_PEARL = "#$0019"
!ALPHA_SHIELD = "#$001A"
!ALPHA_TUNIC = "#$001B"
!ALPHA_HEART = "#$001C"
!ALPHA_MAP = "#$001D"
!ALPHA_COMPASS = "#$001E"
!ALPHA_KEY = "#$001F"
;--------------------------------------------------------------------------------
;--------------------------------------------------------------------------------
!BIGRAM = "$7EC900";
;--------------------------------------------------------------------------------
LoadAlphabetTilemap:
PHB : PHA : PHX : PHY : PHP
@@ -43,9 +45,9 @@ LoadAlphabetTilemap:
LDX.b #$00 : -
LDA.w FileSelect_PlayerSelectText_Top, X
STA.l BigRAM, X
STA !BIGRAM, X
INX #2
CPX.b #128 : !BLT -
CPX #128 : !BLT -
LDY.b #00
LDX.b #$00 : -
@@ -53,12 +55,12 @@ LoadAlphabetTilemap:
AND.w #$001F ; mask to alphabet of 32
ASL #3 : PHY : TAY
LDA.w HashAlphabetTiles,Y : STA.l BigRAM+24, X
LDA.w HashAlphabetTiles+2,Y : STA.l BigRAM+24+2, X
LDA.w HashAlphabetTiles+4,Y : STA.l BigRAM+24+64, X
LDA.w HashAlphabetTiles+6,Y : STA.l BigRAM+24+64+2, X
LDA.w HashAlphabetTiles,Y : STA !BIGRAM+24, X
LDA.w HashAlphabetTiles+2,Y : STA !BIGRAM+24+2, X
LDA.w HashAlphabetTiles+4,Y : STA !BIGRAM+24+64, X
LDA.w HashAlphabetTiles+6,Y : STA !BIGRAM+24+64+2, X
PLY : INX #6 : INY
CPX.b #25 : !BLT -
CPX #25 : !BLT -
SEP #$20 ; 8-bit accumulator
@@ -70,38 +72,38 @@ RTL
;--------------------------------------------------------------------------------
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 $4300 : PHA ; preserve DMA parameters
LDA $4301 : PHA ; preserve DMA parameters
LDA $4302 : PHA ; preserve DMA parameters
LDA $4303 : PHA ; preserve DMA parameters
LDA $4304 : PHA ; preserve DMA parameters
LDA $4305 : PHA ; preserve DMA parameters
LDA $4306 : PHA ; preserve DMA parameters
;--------------------------------------------------------------------------------
LDA.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 #$01 : STA $4300 ; set DMA transfer direction A -> B, bus A auto increment, double-byte mode
LDA.b #$80 : STA $2115 ; write read increment on $2119
LDA.b #$18 : STA $4301 ; 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 #$60 : STA $2116 ; write VRAM destination address
STA $2117 ; 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 #!BIGRAM : STA $4302 ; set bus A source address to WRAM
LDA.b #!BIGRAM>>8 : STA $4303 ; set bus A source address to WRAM
LDA.b #!BIGRAM>>16 : STA $4304 ; set bus A source bank
LDA.b #$80 : STA.w DAS0L : STZ.w DAS0H ; set transfer size to 0x40
LDA.b #$80 : STA $4305 : STZ $4306 ; 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
LDA $2100 : PHA : LDA.b #$80 : STA $2100 ; save screen state & turn screen off
LDA #$01 : STA $420B ; begin DMA transfer
PLA : STA $2100 ; 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
PLA : STA $4306 ; restore DMA parameters
PLA : STA $4305 ; restore DMA parameters
PLA : STA $4304 ; restore DMA parameters
PLA : STA $4303 ; restore DMA parameters
PLA : STA $4302 ; restore DMA parameters
PLA : STA $4301 ; restore DMA parameters
PLA : STA $4300 ; restore DMA parameters
PLX : PLA
RTS
;--------------------------------------------------------------------------------

View File

@@ -1,80 +1,106 @@
;--------------------------------------------------------------------------------
!FSTILE_SPACE = $0188
!FSTILE_SPACE = "$0188"
!FSTILE_BRACKET_OPEN_TOP = $1D8A
!FSTILE_BRACKET_OPEN_BOTTOM = $1D9A
!FSTILE_BRACKET_OPEN_TOP = "$1D8A"
!FSTILE_BRACKET_OPEN_BOTTOM = "$1D9A"
!FSTILE_BRACKET_CLOSE_TOP = $1D8B
!FSTILE_BRACKET_CLOSE_BOTTOM = $1D9B
!FSTILE_BRACKET_CLOSE_TOP = "$1D8B"
!FSTILE_BRACKET_CLOSE_BOTTOM = "$1D9B"
!FSTILE_A_TOP = $1D4A
!FSTILE_A_BOTTOM = $1D5A
!FSTILE_A_TOP = "$1D4A"
!FSTILE_A_BOTTOM = "$1D5A"
!FSTILE_C_TOP = $1D4C
!FSTILE_C_BOTTOM = $1D5C
!FSTILE_C_TOP = "$1D4C"
!FSTILE_C_BOTTOM = "$1D5C"
!FSTILE_D_TOP = $1D4D
!FSTILE_D_BOTTOM = $1D5D
!FSTILE_D_TOP = "$1D4D"
!FSTILE_D_BOTTOM = "$1D5D"
!FSTILE_E_TOP = $1D4E
!FSTILE_E_BOTTOM = $1D5E
!FSTILE_E_TOP = "$1D4E"
!FSTILE_E_BOTTOM = "$1D5E"
!FSTILE_F_TOP = $1D4F
!FSTILE_F_BOTTOM = $1D5F
!FSTILE_F_TOP = "$1D4F"
!FSTILE_F_BOTTOM = "$1D5F"
!FSTILE_H_TOP = $1D61
!FSTILE_H_BOTTOM = $1D71
!FSTILE_H_TOP = "$1D61"
!FSTILE_H_BOTTOM = "$1D71"
!FSTILE_I_TOP = $1D62
!FSTILE_I_BOTTOM = $1D72
!FSTILE_I_TOP = "$1D62"
!FSTILE_I_BOTTOM = "$1D72"
!FSTILE_K_TOP = $1D64
!FSTILE_K_BOTTOM = $1D74
!FSTILE_K_TOP = "$1D64"
!FSTILE_K_BOTTOM = "$1D74"
!FSTILE_L_TOP = $1D65
!FSTILE_L_BOTTOM = $1D75
!FSTILE_L_TOP = "$1D65"
!FSTILE_L_BOTTOM = "$1D75"
!FSTILE_N_TOP = $1D67
!FSTILE_N_BOTTOM = $1D77
!FSTILE_N_TOP = "$1D67"
!FSTILE_N_BOTTOM = "$1D77"
!FSTILE_O_TOP = $1D68
!FSTILE_O_BOTTOM = $1D78
!FSTILE_O_TOP = "$1D68"
!FSTILE_O_BOTTOM = "$1D78"
!FSTILE_P_TOP = $1D69
!FSTILE_P_BOTTOM = $1D79
!FSTILE_P_TOP = "$1D69"
!FSTILE_P_BOTTOM = "$1D79"
!FSTILE_S_TOP = $1D6C
!FSTILE_S_BOTTOM = $1D7C
!FSTILE_S_TOP = "$1D6C"
!FSTILE_S_BOTTOM = "$1D7C"
!FSTILE_T_TOP = $1D6D
!FSTILE_T_BOTTOM = $1D7D
!FSTILE_T_TOP = "$1D6D"
!FSTILE_T_BOTTOM = "$1D7D"
!FSTILE_U_TOP = $1D6E
!FSTILE_U_BOTTOM = $1D7E
!FSTILE_U_TOP = "$1D6E"
!FSTILE_U_BOTTOM = "$1D7E"
!FSTILE_Y_TOP = $1D82
!FSTILE_Y_BOTTOM = $1D92
!FSTILE_Y_TOP = "$1D82"
!FSTILE_Y_BOTTOM = "$1D92"
;--------------------------------------------------------------------------------
org $0CDE60 ; <- 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
;dw !FSTILE_C_TOP, !FSTILE_SPACE, !FSTILE_O_TOP, !FSTILE_SPACE, !FSTILE_P_TOP, !FSTILE_SPACE, !FSTILE_Y_TOP, !FSTILE_SPACE, !FSTILE_SPACE, !FSTILE_SPACE, !FSTILE_SPACE
;dw $1CAC, !FSTILE_SPACE, $1D23, !FSTILE_SPACE, $1D89, !FSTILE_SPACE, $1D04, !FSTILE_SPACE, $1D89, !FSTILE_SPACE, $1D07
;--------------------------------------------------------------------------------
org $0CDE7A ; <- 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
;dw !FSTILE_C_BOTTOM, !FSTILE_SPACE, !FSTILE_O_BOTTOM, !FSTILE_SPACE, !FSTILE_P_BOTTOM, !FSTILE_SPACE, !FSTILE_Y_BOTTOM, !FSTILE_SPACE, !FSTILE_SPACE, !FSTILE_SPACE, !FSTILE_SPACE
;dw $1CBC, !FSTILE_SPACE, $1D33, !FSTILE_SPACE, $1D99, !FSTILE_SPACE, $1D14, !FSTILE_SPACE, $1D99, !FSTILE_SPACE, $1D17
;--------------------------------------------------------------------------------
org $0CDE94 ; <- 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
;dw !FSTILE_D_TOP, !FSTILE_SPACE, !FSTILE_E_TOP, !FSTILE_SPACE, !FSTILE_L_TOP, !FSTILE_SPACE, !FSTILE_E_TOP, !FSTILE_SPACE, !FSTILE_T_TOP, !FSTILE_SPACE, !FSTILE_E_TOP, !FSTILE_SPACE, !FSTILE_SPACE
;dw !FSTILE_K_TOP, !FSTILE_SPACE, !FSTILE_I_TOP, !FSTILE_SPACE, !FSTILE_L_TOP, !FSTILE_SPACE, !FSTILE_L_TOP, !FSTILE_SPACE, !FSTILE_SPACE, !FSTILE_SPACE, !FSTILE_SPACE, !FSTILE_SPACE, !FSTILE_SPACE
;dw !FSTILE_K_TOP, !FSTILE_SPACE, !FSTILE_I_TOP, !FSTILE_SPACE, !FSTILE_L_TOP, !FSTILE_SPACE, !FSTILE_L_TOP, !FSTILE_SPACE, $1D04, !FSTILE_SPACE, $1D89, !FSTILE_SPACE, $1D07
;--------------------------------------------------------------------------------
org $0CDEB2 ; <- 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
;dw !FSTILE_D_BOTTOM, !FSTILE_SPACE, !FSTILE_E_BOTTOM, !FSTILE_SPACE, !FSTILE_L_BOTTOM, !FSTILE_SPACE, !FSTILE_E_BOTTOM, !FSTILE_SPACE, !FSTILE_T_BOTTOM, !FSTILE_SPACE, !FSTILE_E_BOTTOM, !FSTILE_SPACE, !FSTILE_SPACE
;dw !FSTILE_K_BOTTOM, !FSTILE_SPACE, !FSTILE_I_BOTTOM, !FSTILE_SPACE, !FSTILE_L_BOTTOM, !FSTILE_SPACE, !FSTILE_L_BOTTOM, !FSTILE_SPACE, !FSTILE_SPACE, !FSTILE_SPACE, !FSTILE_SPACE, !FSTILE_SPACE, !FSTILE_SPACE
;dw !FSTILE_K_BOTTOM, !FSTILE_SPACE, !FSTILE_I_BOTTOM, !FSTILE_SPACE, !FSTILE_L_BOTTOM, !FSTILE_SPACE, !FSTILE_L_BOTTOM, !FSTILE_SPACE, $1D14, !FSTILE_SPACE, $1D99, !FSTILE_SPACE, $1D17
;--------------------------------------------------------------------------------
;org $0CDDE8 ; <- 65DE8
;FileSelect_PlayerSelectText_Top:
;db $60, $62, $00, $37
;db $8A, $1D, $88, $01, $69, $1D, $88, $01, $65, $1D, $88, $01, $4A, $1D, $88, $01
;db $82, $1D, $88, $01, $4E, $1D, $88, $01, $6B, $1D, $88, $01, $88, $01, $6C, $1D
;db $88, $01, $4E, $1D, $88, $01, $65, $1D, $88, $01, $4E, $1D, $88, $01, $4C, $1D
;db $88, $01, $6D, $1D, $88, $01, $8B, $1D
;--------------------------------------------------------------------------------
;org $0CDE24 ; <- 65E24
;FileSelect_PlayerSelectText_Bottom:
;db $60, $82, $00, $37
;db $9A, $1D, $88, $01, $79, $1D, $88, $01, $75, $1D, $88, $01, $5A, $1D, $88, $01
;db $92, $1D, $88, $01, $5E, $1D, $88, $01, $7B, $1D, $88, $01, $88, $01, $7C, $1D
;db $88, $01, $5E, $1D, $88, $01, $75, $1D, $88, $01, $5E, $1D, $88, $01, $5C, $1D
;db $88, $01, $7D, $1D, $88, $01, $9B, $1D
;--------------------------------------------------------------------------------
;CopyFile_Header:
org $0CE228 ; <- 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
@@ -114,8 +140,10 @@ dw !FSTILE_BRACKET_OPEN_BOTTOM, !FSTILE_SPACE, !FSTILE_D_BOTTOM, !FSTILE_E_BOTTO
;KillFile_Which:
org $0CE04E ; <- 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
;dw $0D4D, $0D4E, $0D65, $0D4E, $0D6D, $0D4E, !FSTILE_SPACE, $0D80, $0D61, $0D62, $0D4C, $0D61, !FSTILE_SPACE, $0D4F, $0D62, $0D65, $0D4E, $0D86, !FSTILE_SPACE, !FSTILE_SPACE, !FSTILE_SPACE, !FSTILE_SPACE, !FSTILE_SPACE, !FSTILE_SPACE, !FSTILE_SPACE
org $0CE084 ; <- 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
;dw $0D5D, $0D5E, $0D75, $0D5E, $0D7D, $0D5E, !FSTILE_SPACE, $0D90, $0D71, $0D72, $0D5C, $0D71, !FSTILE_SPACE, $0D5F, $0D72, $0D75, $0D5E, $0D96, !FSTILE_SPACE, !FSTILE_SPACE, !FSTILE_SPACE, !FSTILE_SPACE, !FSTILE_SPACE, !FSTILE_SPACE, !FSTILE_SPACE
;KillFile_Execute:
org $0CD328 ; <- 65328

View File

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

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