164 Commits

Author SHA1 Message Date
0867a32ad4 Prevent bunny-throwing pots in Aga2's room 2023-04-02 20:46:14 -05:00
2bb66b0cb8 Speed up tile rooms 2023-03-20 18:32:26 -05:00
b86fdcfb32 Fix credits stats 2023-03-20 17:41:43 -05:00
702958f00f Fix no-dashing coming from brewery 2023-03-19 15:52:18 -05:00
28de11a4aa Merge branch 'main' into kara_troll 2023-03-19 15:37:39 -05:00
0e3e3bddbe Kholdstare used confusion! 2023-03-19 12:34:42 -05:00
256bb5ba19 Vitreous - bomb the small eyes 2023-03-19 12:25:06 -05:00
795ce782a9 Poor helmie, his mask is brittle 2023-03-19 11:50:55 -05:00
9d72aee7aa Make aga a lil less friendly 2023-03-19 11:32:16 -05:00
0e710a1b54 Ganon not vulnerable to "silverless" frame 2023-03-19 03:44:29 -05:00
1b36e7672e Randomize Ganon items 2023-03-19 03:07:47 -05:00
8b1f6b9074 Ganon invulverable with a mushroom in the room 2023-03-19 00:43:52 -05:00
1efd8f0f3d No dash Arrgus 2023-03-18 23:19:18 -05:00
136854436d Icy mothfloor 2023-03-18 23:10:23 -05:00
c30113df54 Faster (but still random) dash charge 2023-03-18 23:04:50 -05:00
9f6bd61bdf Faster lanmolas 2023-03-18 23:02:50 -05:00
083a93766c OHKO in Armos Knights room 2023-03-18 22:50:04 -05:00
0d58bb2568 Fix cucco stormer 2023-03-17 15:20:13 -05:00
e7818c8515 Speed up mini-moldorms 2023-03-17 14:18:01 -05:00
2f7a0f2c72 Sidnexx damaged by bombos/ether 2023-03-17 14:17:49 -05:00
0aafee3eae Moldorm stunnable with hookshot/boomerang; only damagable when stunned 2023-03-17 11:41:35 -05:00
e2cc059401 Sword swing slight delay as sword is upgraded 2023-03-17 11:41:29 -05:00
cf278af936 Fix bunny pot-throwing 2023-03-17 11:41:22 -05:00
fd9229ed6b Using shovel indoors bunnies link 2023-03-17 11:40:42 -05:00
d20c8d5d31 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-17 11:40:23 -05:00
Lexi Rose
23ecf41b33 Merge pull request #191 from cassidoxa/keys_hud
Properly mask HUD item flags
2023-03-15 11:50:57 -05:00
cassidoxa
0505cc28e1 Properly mask HUD item flags 2023-03-15 12:42:45 -04:00
2a9b098dac Merge branch 'main' into kara 2023-03-13 21:33:27 -05:00
Lexi Rose
c7c5ac23a8 Merge pull request #190 from cassidoxa/keys_hud
Fix file select HUD I broke
2023-03-13 20:49:11 -05:00
cassidoxa
5ef08d934c Fix file select HUD I broke 2023-03-13 17:49:00 -04:00
Lexi Rose
5a0990638c Merge pull request #189 from cassidoxa/keys_hud
Fix small key stats tracker
2023-03-13 12:28:15 -05:00
cassidoxa
1f8389c446 Fix small key stats tracker 2023-03-13 13:15:30 -04:00
Lexi Rose
95f0e9eed2 Merge pull request #188 from cassidoxa/keys_hud
Compass and map HUD display modes properly skip or draw
2023-03-12 20:42:04 -05:00
cassidoxa
efa5d288a8 Fix typo 2023-03-12 19:14:14 -04:00
cassidoxa
df60b3641b Draw flute, shovel, powder, mushroom correctly on file select 2023-03-12 18:30:02 -04:00
cassidoxa
7968ddf020 Compass and map HUD display modes properly skip or draw
Minor key count refactor, count HC and Sewers as both in all cases
2023-03-12 17:20:54 -04:00
Thomas Prescott
c0986d6bbc Remove file select screen border 2023-03-08 08:20:07 -06:00
Lexi Rose
d0f9bf6b32 Merge pull request #186 from cassidoxa/init_save
Delete save backup when header name doesn't match SRAM
2023-03-07 02:11:58 -06:00
cassidoxa
af1df7cc6c Delete save backup when header name doesn't match SRAM
Ram init refactor
2023-02-28 11:19:20 -05:00
Lexi Rose
5e3fce17be Merge pull request #185 from cassidoxa/map_counts
Fix dungeon indexing for compass/map hud coutns
2023-02-24 16:56:53 -06:00
cassidoxa
af05d2df44 Merge branch 'master' into map_counts 2023-02-24 17:48:08 -05:00
cassidoxa
5546827c48 Fix dungeon indexing for compass/map hud 2023-02-24 17:47:28 -05:00
Lexi Rose
23427497b4 Merge pull request #184 from cassidoxa/map_counts
Add HUD map mode flag, "chest key" totals table, and seen-counter flags for tracking
2023-02-24 16:08:37 -06:00
cassidoxa
d76d4b4254 Skip HUD count drawing routine if nothing enabled 2023-02-24 16:09:07 -05:00
cassidoxa
068d4c2449 Port map key counter on HUD from DR 2023-02-23 21:46:27 -05:00
cassidoxa
a2020c9c76 Add HUD map mode flag, "chest key" totals table, and seen-counter flags
for tracking
2023-02-23 20:46:40 -05:00
Lexi Rose
66fd23fc61 Merge pull request #183 from cassidoxa/sram_checksum
Compute and write save checksum on new file creation
2023-02-21 15:13:49 -06:00
cassidoxa
af59265712 Don't lock inventory stats; temp fix for post-game progressive items 2023-02-21 15:39:55 -05:00
cassidoxa
02786974ad Compute and write save checksum on new file creation 2023-02-21 14:58:24 -05:00
Lexi Rose
aed9166f48 Merge pull request #182 from cassidoxa/fontstuff
Lower case stuff
2023-02-20 18:31:14 -06:00
cassidoxa
d5c8de0436 Fix inverted castle hole typo 2023-02-20 17:25:59 -05:00
cassidoxa
3b848f0586 Lower case stuff 2023-02-20 13:41:24 -05:00
Thomas Prescott
d7887b2305 Merge pull request #181 from spannerisms/v31.1
file select
2023-02-13 17:17:42 -06:00
spannerisms
663ba966a1 file select 2023-02-13 13:14:35 -05:00
Lexi Rose
c2ea144bfb Merge pull request #180 from cassidoxa/filename_numbers
Add numbers to file name screen
2023-01-25 09:21:53 -06:00
cassidoxa
7151093664 Add numbers to file name screen 2023-01-17 17:01:21 -05:00
Lexi Rose
35e1b3a659 updated name for contributor MATRETHEWEY 2023-01-09 01:15:27 -06:00
Lexi Rose
85b433fcd4 delete garbage empty file 2023-01-09 00:36:50 -06:00
Thomas Prescott
05fdeaccb0 Pyramid sign fix from Zarby 2022-12-29 11:57:12 -06:00
Lexi Rose
c23facd617 Merge pull request #179 from cassidoxa/tablets
Fix tablet flags
2022-12-29 11:29:59 -06:00
cassidoxa
5ab91e7137 Fix tablet check 2022-12-19 12:37:51 -05:00
Lexi Rose
186cbba855 Merge pull request #177 from cassidoxa/newfont
New font changes
2022-12-09 10:09:22 -06:00
Lexi Rose
1d64ee7926 Merge pull request #176 from cassidoxa/menu_dungeonhud
Allow menu free dungeon item toggle with no menu items
2022-12-09 10:07:46 -06:00
cassidoxa
6797e84696 Linux asar link against older glibc 2022-12-08 23:33:06 -05:00
cassidoxa
6e876b2d1f Update build scripts 2022-12-08 23:16:20 -05:00
cassidoxa
4437982063 Merge branch 'binaries' into newfont 2022-12-08 23:08:18 -05:00
cassidoxa
3c7399eb12 Add bin/ directory with asar executables
Removed execute permissions on a bunch of text and gfx files
2022-12-08 22:49:59 -05:00
cassidoxa
dac500627c Update build scripts for new font 2022-12-01 18:48:53 -05:00
cassidoxa
d7431b6550 Allow menu free dungeon item toggle with no menu items 2022-11-27 23:35:59 -05:00
cassidoxa
aa65adbec5 New font changes
Added lower case text for free dungeon items (via Aerinon)
Changed credits gfx to properly include symbols on player name screen
2022-11-26 22:13:12 -05:00
Lexi Rose
b2fdeb6b84 Merge pull request #175 from cassidoxa/quickswap
RAM labels, Length Annotations, and Quickswap Fix
2022-11-25 18:58:17 -06:00
cassidoxa
69fd6015e6 Some more annotations 2022-11-25 01:08:07 -05:00
cassidoxa
8d0315e4c1 Reserve private, 3rd party WRAM block
Reserve large decompression buffer
2022-11-24 23:07:16 -05:00
cassidoxa
823166c4cd Re-organize vanillalabels.asm 2022-11-24 22:24:38 -05:00
cassidoxa
9425b1c3b1 Move zoraking.asm and catfish.asm into npcitems.asm 2022-11-24 22:02:55 -05:00
cassidoxa
d3cd3a86ca Move tree kid stuff into hooks.asm 2022-11-24 21:53:18 -05:00
cassidoxa
524a27d680 Merge branch 'master' into quickswap 2022-11-24 19:05:24 -05:00
cassidoxa
7426ce5945 More RAM labels
Fixed tablets checking for item collected, uses NpcFlags+1
Deleted mantle.asm, moved to lampmantlecone.asm
2022-11-24 18:34:35 -05:00
cassidoxa
da8576546d Move binary data to new data directory 2022-11-22 01:02:16 -05:00
cassidoxa
09d15f3294 Another WRAM label pass
Deleted compression.asm
2022-11-22 00:36:39 -05:00
ad44b610fb Fix conflict between hammer-on-B code with bunny-pressing-A code 2022-11-19 10:11:10 -08:00
cassidoxa
788cceaab9 Continue labeling and documentation in ram.asm, main rando block
Deleted several unused modules and some commented code
Reorganized some routines to clean up modules
Moved some memory into mirrored WRAM
Refactored NMI hook aux routine
Removed old fake flipper fix
2022-11-16 21:38:28 -05:00
98b13507f1 Merge branch 'main' into kara 2022-11-16 14:52:02 -08:00
7d0ce859a3 Fix bomb on file select screen in swordless 2022-11-12 08:29:39 -08:00
a4962b3b8b Add Hammer-On-B mode 2022-11-11 13:30:51 -08:00
cassidoxa
43f753b517 ram.asm initial commit. Replaced all address defines with labels
Value defines styled without quotes, # moved to load/store/cmp site
Added registers.asm (copied from spannerisms JP disassembly)
Added a bunch of length annotations
Deleted old or trivial commented out code
Deleted: ganonfixes.asm, map.asm, seedtag.asm
Replaced obsolete credits.asm with creditsnew.asm
Moved scratch space at $7F5020-3F to mirrored WRAM (7E1E70-8F)
Moved clock RAM to mirrored WRAM (7E1E90-9F)
dialog.asm: FreeDungeonItemNotice preserves callee-preserved scratch RAM
Toast buffer moved to mirrored WRAM (7E1E0E-0F)
servicerequest.asm: long store to $012E converted to word length store
2022-11-05 00:50:25 -04:00
Lexi Rose
9cf3cb0601 Merge pull request #174 from cassidoxa/hera_music
Fix check for Tower of Hera boss defeated
2022-10-25 21:47:11 -05:00
cassidoxa
6b2e7a5c34 Fix check for Tower of Hera boss defeated
Improve room data documentation
2022-10-25 22:38:19 -04:00
cassidoxa
cafb0908a0 Introduce bound to QS loop to prevent infinite loop on last bomb loss
Move !INFINITE_BOMB define to ram.asm, replace with labels
2022-10-23 22:02:36 -04:00
Lexi Rose
0e87fb3bc4 Merge pull request #172 from cassidoxa/shields
newitems: Progressive shields, swords, and mail use highest item level to determine upgrade
2022-10-22 16:32:16 -05:00
Lexi Rose
177452c853 Merge pull request #173 from cassidoxa/oldman_entrance
darkworldspawn: Add check for old man to fix post-aga spawn bug
2022-10-22 16:32:03 -05:00
cassidoxa
dbf674c9fd darkworldspawn: Add check for old man to fix post-aga spawn bug 2022-10-20 14:47:04 -04:00
9d079dbd0f Revert "Fix mixing progressive/non-progressive swords and shields"
This reverts commit 9bcb72f7bc.
2022-10-12 15:55:18 -07:00
cassidoxa
651d00d320 Progressive shields, swords, and mail use highest item level to
determine upgrade
2022-10-09 17:09:43 -04:00
9bcb72f7bc Fix mixing progressive/non-progressive swords and shields 2022-10-08 15:38:20 -07:00
Lexi Rose
48ccf03ac8 Merge pull request #170 from cassidoxa/ammo_capacity
Combine starting max ammo and capacity upgrade in SRAM into single, flat ammo capacity values
2022-10-01 08:08:26 -05:00
bfc361ad3e Remove non-progressive bomb/cane upgrades 2022-09-18 15:02:37 -07:00
cassidoxa
f8d9be201a tables.asm: Add GFX pointer to table in utilities.asm 2022-09-09 19:30:16 -04:00
cassidoxa
031e3965b2 Requires frontend changes
Change SRAM ammo capacity upgrades to flatly represent max capacity
2022-08-08 13:42:19 -04:00
Lexi Rose
aba3ec930d Merge pull request #169 from cassidoxa/validate_sram
Compute checksum for extended SRAM
2022-08-01 08:40:19 -05:00
cassidoxa
95ee31f7c9 Remove some hard coded addresses for MVN instructions 2022-07-29 22:04:13 -04:00
cassidoxa
d8846a4ba9 Add backup save that gets checked and loaded if main save is corrupt
Add suffixes to instructions in save.asm
Disable HDMA, NMI, and joypad during extended save DMA
2022-07-29 20:57:54 -04:00
cassidoxa
10079a539b Compute checksum for extended SRAM
Validate SRAM on file screen load and delete if checksum incorrect
2022-07-25 22:19:06 -04:00
f7070dd30f Merge branch 'main' into kara 2022-07-23 17:33:34 -07:00
9d485e86cd Merge branch 'main' into kara 2022-07-23 16:47:01 -07:00
Lexi Rose
0e6e5d5b45 Merge pull request #167 from cassidoxa/elder_submodule
Check submodule during goal NPC interaction to prevent it from firing when menu is open
2022-07-14 22:40:37 -05:00
cassidoxa
9e5e9a17ed Check submodule during goal NPC interaction to prevent it from firing
when menu is open (via kan)
2022-07-05 12:49:00 -04:00
ba660409bf Bees in beemode only target enemies they can actually affect 2022-05-21 17:50:20 -07:00
3d93b0160f Golden Bee fix 2022-05-21 15:34:44 -07:00
bb35409bc8 Fix checking tablets in bee mode 2022-05-14 11:45:38 -07:00
ffdb5e837a Fix Trinexx 2022-05-12 12:53:29 -07:00
4d4ae6b894 Fix Arrghus 2022-04-30 21:21:21 -07:00
4f4f46352d More improvement to bee mode? 2022-04-30 14:04:22 -07:00
103c41ae94 Bee Mode WIP 2022-04-29 15:23:47 -07:00
90a4c50a01 unscramble lowercase letters for new font 2022-04-02 10:07:03 -07:00
3acc2a3f45 Merge branch 'main' into kara 2022-01-24 13:58:12 -08:00
5fd285c767 Make non-seeded rng a rom flag instead of compile flag 2022-01-24 13:53:03 -08:00
7f551ad1a4 Fix boomerang instakilling Armos Knights 2022-01-24 13:50:44 -08:00
Thomas Prescott
96e3427868 update credits 2022-01-03 12:27:15 -08:00
f629bcb15a Merge branch 'main' into kara 2021-12-29 18:56:36 -08:00
02ea894a40 Add permanent ice physics bit 2021-12-29 18:52:38 -08:00
ac81fcbf0f Fix bee damage 2021-12-27 14:05:28 -08:00
265089cedb Fix moldorm/somaria issue and add both-canes mode 2021-12-22 00:29:56 -08:00
6279f32fe3 Fix width of special cane freestanding sprites 2021-12-21 02:10:16 -08:00
843f1cad6f Prevent hitting stunned ganon in cane-mode with default vulnerability 2021-12-21 01:40:23 -08:00
c23b4ad5b2 Fix mothula/ganon breaking things (hopefully) 2021-12-20 19:02:02 -08:00
22b9c17f09 Remove bomb damage in cane modes 2021-12-20 17:37:49 -08:00
e210c85710 Add cane-only modes 2021-12-20 16:10:11 -08:00
e50641db11 Merge branch 'main' into kara 2021-12-20 01:35:56 -08:00
1ec9f22cea Shorten duration of boomerang stun 2021-11-10 00:08:57 -08:00
18a2214b23 Make boomerang in bomb-only mode stun enemies it would normally damage 2021-11-08 16:37:22 -08:00
f2a0cfc098 Fix bomb icons on file select/endgame screens 2021-11-07 23:58:06 -08:00
6565fbfd65 Show bomb level on file select screen in bomb-only mode 2021-11-07 19:32:57 -08:00
ae0a5c685a Unify handling of bomb colors in bomb-only mode 2021-11-07 00:28:28 -07:00
c323a71340 Merge branch 'main' into kara 2021-10-30 16:37:59 -07:00
f3e0def5a2 Allow early detonation of bombs and add build flag to remove static RNG 2021-10-30 09:02:57 -07:00
1fcde00d09 Merge remote-tracking branch 'kara/pseudoswords' into kara 2021-10-12 13:31:37 -07:00
123dcddc94 Merge branch 'main' into kara 2021-09-21 11:50:40 -07:00
7c8ef3afce Merge branch 'main' into kara 2021-08-26 08:39:23 -07:00
74e2f96e0a Merge branch 'fix_ohko' into kara 2021-08-09 15:32:51 -07:00
dafef001be Merge branch 'main' into kara 2021-08-02 18:59:58 -07:00
3f4db583f5 Add pseudo-sword mode 2021-07-24 16:06:01 -07:00
44f3f10bc1 Merge branch 'main' into kara 2021-07-22 12:05:40 -07:00
2bb5ec87b0 Fix Stalfos Knights in bomb-mode to have bombs instakill while collapsed 2021-07-20 20:33:28 -07:00
86a1f82d23 Color bombs in the HUD according to bomb level in bomb-only mode 2021-07-16 03:48:23 -07:00
1071b834cd Adjust things for replacing sword stats with bomb stats 2021-07-15 13:14:49 -07:00
2693e73a21 move storage of BOMB_LEVEL to make it play nicely with starting equipment 2021-07-13 11:15:07 -07:00
6d52427696 Fix bomb downgrades and track bomb stats in bomb-mode 2021-07-11 13:58:04 -07:00
374abe7e88 Merge branch 'kara' of github.com:ardnaxelarak/z3randomizer into kara 2021-07-11 13:56:01 -07:00
1b698808c3 Add L-1 bombs as separate from no bombs in bomb-only mode 2021-07-11 12:52:20 -07:00
62c81f2cf3 Fix extra space in credits 2021-07-11 02:14:01 -07:00
08166fe669 Allow bombing barrier and getting tablet checks with L2+ bombs 2021-07-10 17:40:08 -07:00
70ec318204 Fix junk graphics appearing during GAME OVER screen 2021-07-10 11:32:33 -07:00
081411a448 Merge branch 'main' into kara 2021-07-08 19:26:55 -07:00
55fd818f55 Merge branch 'main' into kara 2021-07-07 10:27:58 -07:00
37b90894e3 Show bombs placed in credits 2021-07-05 17:57:12 -07:00
f6983cee35 Fix quake not blobbing some enemies in bomb-only mode 2021-07-05 15:40:25 -07:00
642205bc68 Fix hookshot and armos knights
- hookshot now stuns enemies it would normally damage
- armos knights with L-2 bombs now take same damage as L-1 or L-3
2021-07-04 18:28:46 -07:00
a8bc95bd1f NO BOMBOS DAMAGE 2021-07-04 15:43:02 -07:00
0dcef701df Merge commit 'f403ca10da9e009599a531be8cdcd20a61b4801c' of github.com:spannerisms/z3randomizer into kara 2021-07-03 18:25:27 -07:00
1dafb620b0 Merge branch 'main' into kara 2021-07-03 18:23:05 -07:00
828a9df7d9 Allow Ganon to be vulnerable to arbitrary item 2021-06-29 16:28:19 -07:00
ea72d70b1b Implement always-allowed medallions 2021-06-29 16:24:21 -07:00
bf953e7953 Add bomb-only mode 2021-06-29 16:23:15 -07:00
166 changed files with 11744 additions and 10060 deletions

View File

@@ -36,41 +36,11 @@ 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
@@ -79,12 +49,13 @@ function hexto555(h) = ((((h&$FF)/8)<<10)|(((h>>8&$FF)/8)<<5)|(((h>>16&$FF)/8)<<
;================================================================================
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
@@ -108,22 +79,15 @@ 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
@@ -132,11 +96,10 @@ incsrc doorframefixes.asm
incsrc music.asm
incsrc roomloading.asm
incsrc icepalacegraphics.asm
incsrc firebarlayer.asm
warnpc $A18000
org $1C8000 ; text tables for translation
incbin i18n_en.bin
incbin "data/i18n_en.bin"
warnpc $1CF356
org $A18000 ; static mapping area
@@ -170,7 +133,6 @@ incsrc goalitem.asm
incsrc quickswap.asm
incsrc endingsequence.asm
incsrc cuccostorm.asm
incsrc compression.asm
incsrc retro.asm
incsrc controllerjank.asm
incsrc boots.asm
@@ -194,14 +156,15 @@ incsrc darkroomitems.asm
incsrc fastcredits.asm
incsrc msu.asm
incsrc dungeonmap.asm
incsrc special_weapons.asm
incsrc variable_ganon_vulnerability.asm
incsrc trolls.asm
if !FEATURE_NEW_TEXT
incsrc textrenderer.asm
endif
warnpc $A58000
;org $228000 ; contrib area
org $A28000 ; contrib area
incsrc contrib.asm
org $A28000
org $A38000
incsrc stats/main.asm
@@ -212,99 +175,110 @@ incsrc tables.asm
org $348000
incsrc spc.asm
; uncomment for inverted adjustments
;incsrc sandbox.asm
org $318000 ; bank #$31
GFX_Mire_Bombos:
incbin 99ff1_bombos.gfx
incbin "data/99ff1_bombos.gfx"
warnpc $318800
org $318800
GFX_Mire_Quake:
incbin 99ff1_quake.gfx
incbin "data/99ff1_quake.gfx"
warnpc $319000
org $319000
GFX_TRock_Bombos:
incbin a6fc4_bombos.gfx
incbin "data/a6fc4_bombos.gfx"
warnpc $319800
org $319800
GFX_TRock_Ether:
incbin a6fc4_ether.gfx
incbin "data/a6fc4_ether.gfx"
warnpc $31A000
org $31A000
GFX_HUD_Items:
incbin c2807_v4.gfx
incbin "data/c2807_v4.gfx"
warnpc $31A800
org $31A800
GFX_New_Items:
incbin newitems.gfx
incbin "data/newitems.gfx"
;incbin eventitems.gfx ; *EVENT*
warnpc $31B000
org $31B000
GFX_HUD_Main:
incbin c2e3e.gfx
incbin "data/c2e3e.gfx"
warnpc $31B800
org $31C000
IcePalaceFloorGfx:
incbin ice_palace_floor.bin
incbin "data/ice_palace_floor.bin"
warnpc $31C801
org $31C800
Damage_Table:
incbin damage_table.bin
incbin "data/damage_table.bin"
warnpc $31D001
org $31D000
FileSelectNewGraphics:
incbin fileselect.chr.gfx
incbin "data/fileselectgfx.2bpp"
warnpc $31E001
org $31E000
InvertedCastleHole: ;address used by front end. DO NOT MOVE!
incbin sheet73.gfx
incbin "data/sheet73.gfx"
warnpc $31E501
org $31E800
Damage_Table_Bombs:
incbin damage_table_sword_bombs.bin
warnpc $31F000
org $31F000
Damage_Table_Pseudo:
incbin damage_table_pseudo_sword.bin
warnpc $31F800
org $338000
GFX_HUD_Palette:
incbin hudpalette.pal
incbin "data/hudpalette.pal"
warnpc $338041
org $339000
incbin sheet178.gfx
incbin "data/sheet178.gfx"
warnpc $339600
org $339600
BossMapIconGFX:
incbin bossicons.4bpp
incbin "data/bossicons.4bpp"
if !FEATURE_NEW_TEXT
org $339C00
NewFont:
incbin newfont.bin
incbin "data/newfont.bin"
NewFontInverted:
incbin newfont_inverted.bin
incbin "data/newfont_inverted.bin"
org $0CD7DF
incbin text_unscramble1.bin
incbin "data/text_unscramble1.bin"
org $0CE4D5
incbin text_unscramble2.bin
incbin "data/text_unscramble2.bin"
endif
org $328000
Extra_Text_Table:
incsrc itemtext.asm
if !FEATURE_NEW_TEXT
incsrc itemtext_lower.asm
else
incsrc itemtext.asm
endif
incsrc externalhooks.asm
;================================================================================
org $119100 ; PC 0x89100
incbin map_icons.gfx
incbin "data/map_icons.gfx"
warnpc $119401
;================================================================================
org $AF8000 ; PC 0x178000
@@ -320,7 +294,7 @@ warnpc $B08000
;Bank Map
;$20 Code Bank
;$21 Reserved (Frame Hook & Init)
;$22 Contrib Code
;$22 Unused
;$23 Stats & Credits
;$24 Code Bank
;$29 External hooks (rest of bank not used)
@@ -336,18 +310,18 @@ warnpc $B08000
;$3F reserved for internal debugging
;================================================================================
;RAM
;$7E021B[0x1]: Used by race game instead of $0ABF to avoid witch item conflict
;$7EC900[0x1F00]: BIGRAM buffer
;See ram.asm for label assignments
;$7EC900[0x1F00]: BigRAM buffer
;$7EF000[0x500]: SRAM mirror First 0x500 bytes of SRAM
; See sram.asm for labels and assignments
;$7F5000[0x800]: Rando's main free ram region
; See tables.asm for specific assignments
; See ram.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 rando-specific assignments
;See sram.asm for label assignments and documentation
;$70:0000 (5K) Game state
; 0000-04FF Vanilla Slot 1 (mirrored at $7EF000)
; 0500-14FF Ext Slot 1 (mirrored at $7F6000)
@@ -355,44 +329,6 @@ 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
@@ -416,308 +352,3 @@ 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 $02B861
Dungeon_SaveRoomQuadrantData:
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 $05A51D
Sprite_SpawnFallingItem:
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 $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 $07E68F
Unknown_Method_0: ; In US version disassembly simply called "$3E6A6 IN ROM"
org $07F4AA
Sprite_CheckIfPlayerPreoccupied:
org $08C3AE
Ancilla_ReceiveItem:
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 $098BAD
AddPendantOrCrystal:
org $098CFD
AddWeathervaneExplosion:
org $0993DF
AddDashTremor:
org $099D04
AddAncillaLong:
org $099D1A
Ancilla_CheckIfAlreadyExistsLong:
org $09AE64
Sprite_SetSpawnedCoords:
org $09AD58
GiveRupeeGift:
org $0ABA4F
OverworldMap_InitGfx:
org $0ABA99
OverworldMap_DarkWorldTilemap:
org $0ABAB9
OverworldMap_LoadSprGfx:
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:
;================================================================================

View File

@@ -1,127 +1,118 @@
;================================================================================
; 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 $9A
LDA.b #$32 : STA.w CGADSUBQ
RTL
++
LDA.b #$72
STA $9A
STA.b CGADSUBQ
RTL
;================================================================================
ConditionalWhitenBg:
LDX.b #$00
LDA.l DisableFlashing : REP #$20 : BNE +
LDA $00,X
LDA.b Scrap00,X
JSR WhitenLoopReal
RTL
+
LDA $00
LDA.b Scrap00
JSR WhitenLoopDummy
RTL
;================================================================================
WhitenLoopReal:
-
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
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
INX #2 : CPX.b #$10 : BEQ +
JMP -
+
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+$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 $7EC3F6 : JSL Filter_Majorly_Whiten_Color : STA $7EC5F6
LDA $7EC3F8 : JSL Filter_Majorly_Whiten_Color : STA $7EC5F8
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
BRA +++
++
LDA $7EC3F6 : JSL Filter_Majorly_Whiten_Color : STA $7EC5F6
LDA $7EC3F8 : JSL Filter_Majorly_Whiten_Color : STA $7EC5F8
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
BRA +++
+++
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
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
REP #$10
LDA $7EC540 : TAY
LDA $7EC300 : BNE +
LDA.l PaletteBuffer+$40 : TAY
LDA.l PaletteBufferAux : BNE +
TAY
+
TYA : STA $7EC500
TYA : STA.l PaletteBuffer
SEP #$30
RTS
;================================================================================
WhitenLoopDummy:
-
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
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
INX #2 : CPX.b #$10 : BEQ +
JMP -
+
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+$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 $7EC3F6 : JSL Filter_Majorly_Whiten_Color : LDA $7EC5F6
LDA $7EC3F8 : JSL Filter_Majorly_Whiten_Color : LDA $7EC5F8
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
BRA +++
++
LDA $7EC3F6 : JSL Filter_Majorly_Whiten_Color : STA $7EC5F6
LDA $7EC3F8 : JSL Filter_Majorly_Whiten_Color : STA $7EC5F8
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
BRA +++
+++
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
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
REP #$10
LDA $7EC540 : TAY
LDA $7EC300 : BNE +
LDA.l PaletteBuffer+$40 : TAY
LDA.l PaletteBufferAux : BNE +
TAY
+
TYA : STA $7EC500
TYA : STA.l PaletteBuffer
SEP #$30
RTS
;================================================================================
@@ -129,36 +120,36 @@ RestoreBgEther:
LDX.b #$00
LDA.l DisableFlashing : REP #$20 : BNE +
-
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
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
INX #2 : CPX.b #$10 : BNE -
BRA ++
+
-
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
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
INX #2 : CPX.b #$10 : BNE -
BRA ++
++
@@ -168,105 +159,105 @@ DDMConditionalLightning:
LDA.l DisableFlashing
REP #$20
BNE +
LDA.w $0000
LDA.w Scrap
LDX.b #$02
JML $07FA7F ; Bank0E.asm : 4738 vanilla loop equivalent to below beginning at LDY #$00
+
LDA.b $00 : LDX.b #$02 : LDY #$00
LDA.b Scrap00 : LDX.b #$02 : LDY.b #$00
-
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
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
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 $0000
LDA.w Scrap
-
LDA $F9C1, Y : STA $7EC5D0, X
LDA.w $F9C1, Y : STA.l PaletteBuffer+$D0, X
INY #2
INX #2 : CPX.b #$10 : BNE -
RTL
+
LDA $00
LDA.b Scrap00
-
LDA $F9C1, Y : LDA $7EC5D0, X
LDA.w $F9C1, Y : LDA.l PaletteBuffer+$D0, X
INY #2
INX #2 : CPX.b #$10 : BNE -
RTL
;================================================================================
ConditionalRedFlash:
LDA.l DisableFlashing : REP #$20 : BNE +
LDA $00,X
LDA.w #$1D59 : STA $7EC5DA
LDA.w #$25FF : STA $7EC5DC
LDA.b Scrap,X
LDA.w #$1D59 : STA.l PaletteBuffer+$DA
LDA.w #$25FF : STA.l PaletteBuffer+$DC
LDA.w #$001A
RTL
+
LDA $00
LDA.w #$1D59 : LDA $7EC5DA
LDA.w #$25FF : LDA $7EC5DC
LDA.b Scrap00
LDA.w #$1D59 : LDA.l PaletteBuffer+$DA
LDA.w #$25FF : LDA.l PaletteBuffer+$DC
LDA.w #$0000
RTL
;================================================================================
ConditionalPedAncilla:
LDA.l DisableFlashing : REP #$20 : BNE +
LDA $00,X
LDA $00 : STA $04
LDA $02 : STA $06
LDA.b Scrap,X
LDA.b Scrap00 : STA.b Scrap04
LDA.b Scrap02 : STA.b Scrap06
RTL
+
LDA $00
LDA $00 : LDA $04
LDA $02 : LDA $06
LDA.b Scrap
LDA.b Scrap00 : LDA.b Scrap04
LDA.b Scrap02 : LDA.b Scrap06
RTL
;================================================================================
LoadElectroPalette:
REP #$20
LDA.w #$0202 : STA $0C
LDA.w #$0404 : STA $0E
LDA.w #$001B : STA $02
LDA.w #$0202 : STA.b Scrap0C
LDA.w #$0404 : STA.b Scrap0E
LDA.w #$001B : STA.b Scrap02
SEP #$10
LDX $0C : LDA $1BEBB4, X : AND.w #$00FF : ADC #$D630
LDX.b Scrap0C : LDA.l $1BEBB4, X : AND.w #$00FF : ADC.w #$D630
REP #$10 : LDX.w #$01B2 : LDY.w #$0002
JSR ConditionalLoadGearPalette
SEP #$10
LDX $0D
LDA $1BEBC1, X : AND.w #$00FF : ADC #$D648
LDX.b Scrap0D
LDA.l $1BEBC1, X : AND.w #$00FF : ADC.w #$D648
REP #$10 : LDX.w #$01B8 : LDY.w #$0003
JSR ConditionalLoadGearPalette
SEP #$10
LDX $0E
LDA $1BEC06, X : AND.w #$00FF : ASL A : ADC #$D308
LDX.b Scrap0E
LDA.l $1BEC06, X : AND.w #$00FF : ASL A : ADC.w #$D308
REP #$10 : LDX.w #$01E2 : LDY.w #$000E
JSR ConditionalLoadGearPalette
SEP #$30
INC $15
INC.b NMICGRAM
RTL
;================================================================================
ConditionalLoadGearPalette:
STA $00
STA.b Scrap00
SEP #$20
LDA.l DisableFlashing : REP #$20 : BNE +
LDA $00,X
LDA.b Scrap,X
-
LDA [$00]
STA $7EC500, X
INC $00 : INC $00
LDA.b [Scrap00]
STA.l PaletteBuffer, X
INC.b Scrap00 : INC.b Scrap00
INX #2
DEY
BPL -
RTS
+
LDA $00
LDA.b Scrap
-
LDA [$00]
LDA $7EC500, X
INC $00 : INC $00
LDA.b [Scrap00]
LDA.l PaletteBuffer, X
INC.b Scrap00 : INC.b Scrap00
INX #2
DEY
BPL -
@@ -281,13 +272,13 @@ RestoreElectroPalette:
LDX.w #$01E2 : LDY.w #$000E
JSR FillPaletteBufferFromAux
SEP #$30
INC $15
INC.b NMICGRAM
RTL
;================================================================================
FillPaletteBufferFromAux:
-
LDA $7EC300, X
STA $7EC500, X
LDA.l PaletteBufferAux, X
STA.l PaletteBuffer, X
INX #2
DEY
BPL -

BIN
asar

Binary file not shown.

BIN
bin/linux/asar Executable file

Binary file not shown.

BIN
bin/macos/asar Executable file

Binary file not shown.

BIN
bin/windows/asar.exe Normal file

Binary file not shown.

View File

@@ -2,21 +2,21 @@
; Randomize Book of Mudora
;--------------------------------------------------------------------------------
LoadLibraryItemGFX:
%GetPossiblyEncryptedItem(LibraryItem, SpriteItemValues)
STA $0E80, X ; Store item type
JSL.l PrepDynamicTile
%GetPossiblyEncryptedItem(LibraryItem, SpriteItemValues)
STA.w SpriteItemType, X ; Store item type
JSL.l PrepDynamicTile
RTL
;--------------------------------------------------------------------------------
DrawLibraryItemGFX:
PHA
LDA $0E80, X ; Retrieve stored item type
JSL.l DrawDynamicTile
PLA
PHA
LDA.w SpriteItemType, X ; Retrieve stored item type
JSL.l DrawDynamicTile
PLA
RTL
;--------------------------------------------------------------------------------
SetLibraryItem:
LDY $0E80, X ; Retrieve stored item type
JSL.l ItemSet_Library ; contains thing we wrote over
LDY.w SpriteItemType, X ; Retrieve stored item type
JSL.l ItemSet_Library ; contains thing we wrote over
RTL
;--------------------------------------------------------------------------------
@@ -24,37 +24,34 @@ RTL
;================================================================================
; Randomize Bonk Keys
;--------------------------------------------------------------------------------
!REDRAW = "$7F5000"
;--------------------------------------------------------------------------------
LoadBonkItemGFX:
LDA.b #$08 : STA $0F50, X ; thing we wrote over
LDA.b #$08 : STA.w SpriteOAMProp, X ; thing we wrote over
LoadBonkItemGFX_inner:
LDA.b #$00 : STA !REDRAW
LDA.b #$00 : STA.l RedrawFlag
JSR LoadBonkItem
JSL.l PrepDynamicTile
RTL
;--------------------------------------------------------------------------------
DrawBonkItemGFX:
PHA
LDA !REDRAW : BEQ .skipInit ; skip init if already ready
JSL.l LoadBonkItemGFX_inner
BRA .done ; don't draw on the init frame
PHA
LDA.l RedrawFlag : 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
JSR LoadBonkItem
JSL.l DrawDynamicTileNoShadow
.done
PLA
.done
PLA
RTL
;--------------------------------------------------------------------------------
GiveBonkItem:
JSR LoadBonkItem
CMP #$24 : BNE .notKey
CMP.b #$24 : BNE .notKey
.key
PHY : LDY.b #$24 : JSL.l AddInventory : PLY ; do inventory processing for a small key
LDA CurrentSmallKeys : INC A : STA CurrentSmallKeys
LDA.l CurrentSmallKeys : INC A : STA.l CurrentSmallKeys
LDA.b #$2F : JSL.l Sound_SetSfx3PanLong
JSL CountBonkItem
RTL
@@ -64,11 +61,11 @@ RTL
RTL
;--------------------------------------------------------------------------------
LoadBonkItem:
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.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.l BonkKey_Desert
BRA ++
+ : CMP #140 : BNE + ; GTower Bonk Key
+ : CMP.b #140 : BNE + ; GTower Bonk Key
LDA.l BonkKey_GTower
BRA ++
+

View File

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

View File

@@ -2,8 +2,8 @@
;--------------------------------------------------------------------------------
AssignKiki:
LDA.b #$00 : STA FollowerDropped ; defuse bomb
LDA.b #$0A : STA FollowerIndicator ; assign kiki as follower
LDA.b #$00 : STA.l FollowerDropped ; defuse bomb
LDA.b #$0A : STA.l FollowerIndicator ; assign kiki as follower
RTL
;--------------------------------------------------------------------------------
@@ -11,10 +11,9 @@ RTL
; Name: AllowSQ
; Returns: Accumulator = 0 if S&Q is disallowed, 1 if allowed
;--------------------------------------------------------------------------------
!ITEM_BUSY = "$7F5091"
AllowSQ:
LDA ProgressIndicator : BEQ .done ; thing we overwrote - check if link is in his bed
LDA !ITEM_BUSY : EOR #$01
LDA.l ProgressIndicator : BEQ .done ; thing we overwrote - check if link is in his bed
LDA.l BusyItem : EOR.b #$01
.done
RTL
;--------------------------------------------------------------------------------
@@ -23,8 +22,8 @@ RTL
;0 = Reset Music
;1 = Don't Reset Music
MSMusicReset:
LDA $8A : CMP.b #$80 : BNE +
LDA $23
LDA.b OverworldIndex : CMP.b #$80 : BNE +
LDA.b LinkPosX+1
+
RTL
;--------------------------------------------------------------------------------
@@ -32,11 +31,11 @@ RTL
;--------------------------------------------------------------------------------
;0 = Become (Perma)bunny
DecideIfBunny:
LDA MoonPearlEquipment : BNE .done
LDA CurrentWorld : AND.b #$40
LDA.l MoonPearlEquipment : BNE .done
LDA.l CurrentWorld : AND.b #$40
PHA : LDA.l InvertedMode : BNE .inverted
.normal
PLA : EOR #$40
PLA : EOR.b #$40
BRA .done
.inverted
PLA
@@ -47,9 +46,9 @@ RTL
DecideIfBunnyByScreenIndex:
; If indoors we don't have a screen index. Return non-bunny to make mirror-based
; superbunny work
LDA $1B : BNE .done
LDA MoonPearlEquipment : BNE .done
LDA $8A : AND.b #$40 : PHA
LDA.b IndoorsFlag : BNE .done
LDA.l MoonPearlEquipment : BNE .done
LDA.b OverworldIndex : AND.b #$40 : PHA
LDA.l InvertedMode : BNE .inverted
.normal
PLA : EOR #$40
@@ -58,21 +57,12 @@ DecideIfBunnyByScreenIndex:
PLA
.done
RTL
;--------------------------------------------------------------------------------
;--------------------------------------------------------------------------------
;ReadInventoryPond:
; CPX.b #$1B : BNE + : LDA.b #$01 : RTL : +
; LDA EquipmentWRAM, X
;RTL
;--------------------------------------------------------------------------------
;--------------------------------------------------------------------------------
FixBunnyOnExitToLightWorld:
LDA.w $02E0 : BEQ +
LDA.w BunnyFlag : BEQ +
JSL.l DecideIfBunny : BEQ +
STZ $5D ; set player mode to Normal
STZ $02E0 : STZ $56 ; return player graphics to normal
STZ.b LinkState ; set player mode to Normal
STZ.w BunnyFlag : STZ.b BunnyFlagDP ; return player graphics to normal
+
RTS
;--------------------------------------------------------------------------------
@@ -83,17 +73,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 CurrentWorld ; Switch to light world
LDA.b #$00 : STA.l CurrentWorld ; Switch to light world
BRA ++
+++
LDA.b #$40 : STA CurrentWorld ; Switch to dark world
LDA.b #$40 : STA.l CurrentWorld ; Switch to dark world
++
JSL DecideIfBunny : BNE +
JSR MakeBunny
LDA.b #$04 : STA.w $012C ; play bunny music
LDA.b #$04 : STA.w MusicControlRequest ; play bunny music
BRA .done
+
LDA.b #$09 : STA.w $012C ; what we wrote over
LDA.b #$09 : STA.w MusicControlRequest ; what we wrote over
.done
RTL
;--------------------------------------------------------------------------------
@@ -101,8 +91,8 @@ RTL
;--------------------------------------------------------------------------------
MakeBunny:
PHX : PHY
LDA.b #$17 : STA $5D ; set player mode to permabunny
LDA.b #$01 : STA $02E0 : STA $56 ; make player look like bunny
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
JSL LoadGearPalettes_bunny
PLY : PLX
RTS
@@ -130,27 +120,27 @@ RTS
; Fix for SQ jumping causing accidental Exploration Glitch
SQEGFix:
LDA.l Bugfix_PodEG : BEQ ++
STZ.w $047A ; disarm exploration glitch
STZ.w LayerAdjustment ; disarm exploration glitch
++ RTL
;--------------------------------------------------------------------------------
; Fix crystal not spawning when using somaria vs boss
TryToSpawnCrystalUntilSuccess:
STX $02D8 ; what we overwrote
STX.w ItemReceiptID ; what we overwrote
JSL AddAncillaLong : BCS .failed ; a clear carry flag indicates success
.spawned
STZ $AE ; the "trying to spawn crystal" flag
STZ $AF ; the "trying to spawn pendant" flag
STZ.b RoomTag ; the "trying to spawn crystal" flag
STZ.b RoomTag+1 ; the "trying to spawn pendant" flag
.failed
RTL
;--------------------------------------------------------------------------------
; Fix crystal not spawning when using somaria vs boss
WallmasterCameraFix:
STZ $A7 ; disable vertical camera scrolling for current room
STZ.b CameraBoundV ; disable vertical camera scrolling for current room
REP #$20
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.
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.
SEP #$20
JML Sound_SetSfx3PanLong ; what we wrote over, also this will RTL
@@ -158,8 +148,8 @@ WallmasterCameraFix:
; Fix losing glove colors
LoadActualGearPalettesWithGloves:
REP #$20
LDA SwordEquipment : STA $0C
LDA ArmorEquipment : AND.w #$00FF
LDA.l SwordEquipment : STA.b Scrap0C
LDA.l ArmorEquipment : AND.w #$00FF
JSL LoadGearPalettes_variable
JSL SpriteSwap_Palette_ArmorAndGloves_part_two
RTL
@@ -167,24 +157,24 @@ RTL
;--------------------------------------------------------------------------------
; Fix Bunny Palette Map Bug
LoadGearPalette_safe_for_bunny:
LDA $10
LDA.b GameMode
CMP.w #$030E : BEQ .new ; opening dungeon map
CMP.w #$070E : BEQ .new ; opening overworld map
.original
-
LDA [$00]
STA $7EC300, X
STA $7EC500, X
INC $00 : INC $00
LDA.b [Scrap00]
STA.l PaletteBufferAux, X
STA.l PaletteBuffer, X
INC.b Scrap00 : INC.b Scrap00
INX #2
DEY
BPL -
RTL
.new
-
LDA [$00]
STA $7EC500, X
INC $00 : INC $00
LDA.b [Scrap00]
STA.l PaletteBuffer, X
INC.b Scrap00 : INC.b Scrap00
INX #2
DEY
BPL -
@@ -193,16 +183,16 @@ RTL
;--------------------------------------------------------------------------------
; Fix pedestal pull overlay
PedestalPullOverlayFix:
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
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
+
RTL
;--------------------------------------------------------------------------------
FixJingleGlitch:
LDA.b $11
LDA.b GameSubMode
BEQ .set_doors
LDA.l AllowAccidentalMajorGlitch
@@ -210,7 +200,7 @@ FixJingleGlitch:
.set_doors
LDA.b #$05
STA.b $11
STA.b GameSubMode
.exit
RTL
@@ -222,7 +212,36 @@ pushpc
pullpc
;--------------------------------------------------------------------------------
SetOverworldTransitionFlags:
LDA #$01
STA $0ABF ; used by witch
STA $021B ; used by race game
LDA.b #$01
STA.w OWTransitionFlag
STA.w RaceGameFlag
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,4 @@
del ..\working.sfc
copy ..\alttp.sfc ..\working.sfc
xkas.exe LTTP_RND_GeneralBugfixes.asm ..\working.sfc
%~dp0bin\windows\asar.exe LTTP_RND_GeneralBugfixes.asm ..\working.sfc
cmd /k

View File

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

View File

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

View File

@@ -2,36 +2,26 @@
; Capacity Logic
;================================================================================
IncrementBombs:
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
+
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
+
RTL
;--------------------------------------------------------------------------------
IncrementArrows:
LDA ArrowCapacityUpgrades ; get arrow upgrades
!ADD.l StartingMaxArrows : DEC
CMP CurrentArrows
!BLT +
LDA CurrentArrows
CMP.b #99 : !BGE +
INC : STA CurrentArrows
+
LDA.l ArrowCapacity : DEC
CMP.l CurrentArrows : !BLT +
LDA.l CurrentArrows
CMP.b #99 : !BGE +
INC : STA.l CurrentArrows
+
RTL
;--------------------------------------------------------------------------------
CompareBombsToMax:
LDA BombCapacityUpgrades ; get bomb upgrades
!ADD.l StartingMaxBombs
CMP BombsEquipment
LDA.l BombCapacity
CMP.l BombsEquipment
RTL
;--------------------------------------------------------------------------------

View File

@@ -1,34 +0,0 @@
;================================================================================
; Randomize Catfish
;--------------------------------------------------------------------------------
!HEART_REDRAW = "$7F5000"
LoadCatfishItemGFX:
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:
JSL Link_ReceiveItem ; thing we wrote over
LDA $8A : CMP.b #$81 : BNE .catfish
.zora
JML ItemSet_ZoraKing
.catfish
JML ItemSet_Catfish
;--------------------------------------------------------------------------------

248
clock.asm
View File

@@ -1,248 +0,0 @@
;--------------------------------------------------------------------------------
; http://problemkaputt.de/fullsnes.htm
; 2800h-2801h S-RTC Real Time Clock I/O Ports
; cartridge type change from #$02 to #$55 to enable S-RTC
; SNES Cart S-RTC (Realtime Clock) (1 game)
;
; PCB "SHVC-LJ3R-01" with 24pin "Sharp S-RTC" chip. Used only by one japanese game:
; Dai Kaiju Monogatari 2 (1996) Birthday/Hudson Soft (JP)
;
; S-RTC I/O Ports
; 002800h S-RTC Read (R)
; 002801h S-RTC Write (W)
; Both registers are 4bits wide. When writing: Upper 4bit should be zero. When reading: Upper 4bit should be masked-off (they do possibly contain garbage, eg. open-bus).
;
; S-RTC Communication
; The sequence for setting, and then reading the time is:
; Send <0Eh,04h,0Dh,0Eh,00h,Timestamp(12 digits),0Dh> to [002801h]
; If ([002800h] AND 0F)=0Fh then read <Timestamp(13 digits)>
; If ([002800h] AND 0F)=0Fh then read <Timestamp(13 digits)>
; If ([002800h] AND 0F)=0Fh then read <Timestamp(13 digits)>
; If ([002800h] AND 0F)=0Fh then read <Timestamp(13 digits)>
; etc.
; The exact meaning of the bytes is unknown. 0Eh/0Dh seems to invoke/terminate commands, 04h might be some configuration stuff (like setting 24-hour mode). 00h is apparently the set-time command. There might be further commands (such like setting interrupts, alarm, 12-hour mode, reading battery low & error flags, etc.). When reading, 0Fh seems to indicate sth like "time available".
; The 12/13-digit "SSMMHHDDMYYY(D)" Timestamps are having the following format:
; Seconds.lo (BCD, 0..9)
; Seconds.hi (BCD, 0..5)
; Minutes.lo (BCD, 0..9)
; Minutes.hi (BCD, 0..5)
; Hours.lo (BCD, 0..9)
; Hours.hi (BCD, 0..2)
; Day.lo (BCD, 0..9)
; Day.hi (BCD, 0..3)
; Month (HEX, 01h..0Ch)
; Year.lo (BCD, 0..9)
; Year.hi (BCD, 0..9)
; Century (HEX, 09h..0Ah for 19xx..20xx)
; When READING the time, there is one final extra digit (the existing software doesn't transmit that extra digit on WRITING, though maybe it's possible to do writing, too):
; Day of Week? (0..6) (unknown if RTC assigns sth like 0=Sunday or 0=Monday)
;--------------------------------------------------------------------------------
;--------------------------------------------------------------------------------
macro A_x10()
ASL #1 : PHA
ASL #2 : !ADD 1,s
STA 1,s : PLA
endmacro
;--------------------------------------------------------------------------------
macro A_x24()
ASL #3 : PHA
ASL #1 : !ADD 1,s
STA 1,s : PLA
endmacro
;--------------------------------------------------------------------------------
macro A_x60()
ASL #2 : PHA
ASL #4 : !SUB 1,s
STA 1,s : PLA
endmacro
;--------------------------------------------------------------------------------
macro Clock_ReadBCD()
LDA $002800 : PHA
LDA $002800 : %A_x10() : !ADD 1,s
STA 1,s : PLA
endmacro
;--------------------------------------------------------------------------------
Clock_Test:
JSL.l Clock_Init
JML.l Clock_IsSupported
;--------------------------------------------------------------------------------
; Clock_Init
;--------------------------------------------------------------------------------
Clock_Init:
LDA.b #$0E : STA $002801
LDA.b #$04 : STA $002801
LDA.b #$0D : STA $002801
LDA.b #$0E : STA $002801
LDA.b #$00 : STA $002801
LDA.b #$00 : STA $002801
LDA.b #$00 : STA $002801
LDA.b #$00 : STA $002801
LDA.b #$00 : STA $002801
LDA.b #$00 : STA $002801
LDA.b #$00 : STA $002801
LDA.b #$01 : STA $002801
LDA.b #$00 : STA $002801
LDA.b #$01 : STA $002801
LDA.b #$00 : STA $002801
LDA.b #$00 : STA $002801
LDA.b #$0A : STA $002801
LDA.b #$0D : STA $002801
RTL
;--------------------------------------------------------------------------------
;--------------------------------------------------------------------------------
; Clock_IsSupported
;--------------------------------------------------------------------------------
; Input: None (8-bit accumulator)
;--------------------------------------------------------------------------------
; Output:
; Carry - unset if unsupported, set if supported
; Zero - Undefined
;--------------------------------------------------------------------------------
; Side Effects:
; S-RTC is ready for reading upon exit if supported
;--------------------------------------------------------------------------------
Clock_IsSupported:
PHA : PHX
LDX #$00;
-
LDA $002800 : AND.b #$0F : CMP #$0F : BEQ .done ; check for clock chip ready signal
CPX.b #$0E : BCC ++ : CLC : BRA .done ; if we've read 14 bytes with no success, unset carry and exit
++ INX
BRA -
.done
PLX : PLA
RTL
;--------------------------------------------------------------------------------
;--------------------------------------------------------------------------------
; Clock_QuickStamp
;--------------------------------------------------------------------------------
; Input: None
;--------------------------------------------------------------------------------
; Output:
; $00.b - 24-bit timestamp (low)
; $01.b - 24-bit timestamp (mid)
; $02.b - 24-bit timestamp (high)
; $03.b - zero
; Carry - Unset if error, Set if success
; Zero - Undefined
;--------------------------------------------------------------------------------
; Side Effects:
; Requires Mode-7 Matrix Registers
;--------------------------------------------------------------------------------
Clock_QuickStamp:
PHA : PHX : PHP
SEP #$30 ; set 8-bit accumulator and index registers
LDX #$00;
-
LDA $002800 : AND.b #$0F : CMP #$0F : BEQ .ready ; check for clock chip ready signal
CPX.b #$0E : !BLT ++ : CLC : JMP .done : ++ ; if we've read 14 bytes with no success, unset carry and exit
INX
BRA -
SEC ; indicate success
.ready
%Clock_ReadBCD() : STA $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,56 +1,82 @@
;--------------------------------------------------------------------------------
; $7F5010 - Scratch Space
;--------------------------------------------------------------------------------
DrawDungeonCompassCounts:
LDX $1B : BNE + : RTL : + ; Skip if outdoors
DrawDungeonItemCounts:
LDX.b IndoorsFlag : BNE + : RTL : + ; Skip if outdoors
; extra hard safeties for getting dungeon ID to prevent crashes
PHA
LDA.w $040C : AND.w #$00FE : TAX ; force dungeon ID to be multiple of 2
LDA.w DungeonID : AND.w #$00FE : TAX ; force dungeon ID to be multiple of 2
PLA
CPX.b #$1B : BCS .done ; Skip if not in a valid dungeon ID
BIT.w #$0002 : BNE ++ ; if CompassMode==2, we don't check for the compass
LDA CompassField : AND.l DungeonItemMasks, X ; Load compass values to A, mask with dungeon item masks
BEQ .done ; skip if we don't have compass
++
JSR.w DrawCompassCounts
JSR.w DrawMapCounts
.done
RTL
DrawCompassCounts:
PHX
LDA.l CompassMode : AND.w #$00FF : BEQ .done
BIT.w #$0002 : BNE + ; if CompassMode==2, we don't check for the compass
LDA.l CompassField : AND.l DungeonItemMasks, X ; Load compass values to A, mask with dungeon item masks
BEQ .done ; skip if we don't have compass
+
TXA : LSR : TAX
BNE +
INC
+
LDA.l CompassTotalsWRAM, X : AND #$00FF
LDA.l CompassTotalsWRAM, X : AND.w #$00FF
SEP #$20
JSR HudHexToDec2Digit
REP #$20
PHX
LDX.b $06 : TXA : ORA #$2400 : STA $7EC79A
LDX.b $07 : TXA : ORA #$2400 : STA $7EC79C
LDX.b Scrap06 : TXA : ORA.w #$2400 : STA.l HUDTileMapBuffer+$9A
LDX.b Scrap07 : TXA : ORA.w #$2400 : STA.l HUDTileMapBuffer+$9C
PLX
LDA DungeonLocationsChecked, X : AND #$00FF
LDA.l DungeonLocationsChecked, X : AND.w #$00FF
SEP #$20
JSR HudHexToDec2Digit
REP #$20
LDX.b $06 : TXA : ORA #$2400 : STA $7EC794 ; Draw the item count
LDX.b $07 : TXA : ORA #$2400 : STA $7EC796
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
LDA.w #$2830 : STA $7EC798 ; draw the slash
.done
RTL
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 $8000, $4000, $2000, $1000, $0800, $0400, $0200, $0100
dw $C000, $C000, $2000, $1000, $0800, $0400, $0200, $0100
dw $0080, $0040, $0020, $0010, $0008, $0004
;--------------------------------------------------------------------------------
InitCompassTotalsRAM:
LDX #$00
InitDungeonCounts:
LDX.b #$0F
-
LDA CompassTotalsROM, X : STA CompassTotalsWRAM, X
INX
CPX #$0F : !BLT -
LDA.l CompassTotalsROM, X : STA.l CompassTotalsWRAM, X
DEX
BPL -
LDX.b #$0F
-
LDA.l ChestKeys, X : STA.l MapTotalsWRAM, X
DEX
BPL -
RTL

View File

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

View File

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

View File

@@ -4,29 +4,31 @@
;--------------------------------------------------------------------------------
; Filtered Joypad 1 Register: [AXLR | ????]
; Filtered Joypad 1 Register: [BYST | udlr] [AXLR | ????]
!INVERT_DPAD = "$7F50CB"
InvertDPad:
LDA.l OneMindPlayerCount : BEQ .crowd_control
LDA.l !ONEMIND_ID
LDA.l OneMindId
AND.b #$03
TAX
LDA.l .onemind_controller_offset, X
TAX
LDA.w $4218,X : STA.w $00
LDA.w $4219,X : STA.w $01
LDA.w JOY1L,X : STA.w Scrap00
LDA.w JOY1H,X : STA.w Scrap01
LDA #$80 : STA $4201 ; reset this so latch can read it, otherwise RNG breaks
LDA.b #$80 : STA.w WRIO ; reset this so latch can read it, otherwise RNG breaks
JML.l InvertDPadReturn
.crowd_control
LDA !INVERT_DPAD : BNE +
LDA.l ControllerInverter : BNE +
LDA.b RoomIndex : CMP.b #$DE : BNE .off
LDA.b #$01 : BRA +
LDA $4218 : STA $00
LDA $4219 : STA $01
.off
LDA.w JOY1L : STA.b Scrap00
LDA.w JOY1H : STA.b Scrap01
JML.l InvertDPadReturn
+ DEC : BEQ .dpadOnly
@@ -34,47 +36,47 @@ InvertDPad:
DEC : BEQ .invertBoth
.swapSides
REP #$20 ; set 16-bit accumulator
LDA $4218
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 $00
STA.b Scrap00
SEP #$20 ; set 8-bit accumulator
JML.l InvertDPadReturn
.invertBoth
REP #$20 ; set 16-bit accumulator
LDA $4218
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 $00
STA.b Scrap00
SEP #$20 ; set 8-bit accumulator
JML.l InvertDPadReturn
.buttonsOnly
REP #$20 ; set 16-bit accumulator
LDA $4218
LDA.w JOY1L
BIT.w #$8040 : BEQ + : EOR.w #$8040 : + ; swap X/B
BIT.w #$4080 : BEQ + : EOR.w #$4080 : + ; swap Y/A
STA $00
STA.b Scrap00
SEP #$20 ; set 8-bit accumulator
JML.l InvertDPadReturn
.dpadOnly
LDA $4218 : STA $00
LDA $4219
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 $01
STA.b Scrap01
JML.l InvertDPadReturn
.onemind_controller_offset
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
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
@@ -86,12 +88,12 @@ HandleOneMindController:
REP #$20
LDA.l !ONEMIND_TIMER
LDA.l OneMindTimerRAM
DEC
BPL .no_switch
SEP #$20
LDA.l !ONEMIND_ID
LDA.l OneMindId
INC
CMP.l OneMindPlayerCount
BCC .no_wrap
@@ -99,29 +101,26 @@ HandleOneMindController:
LDA.b #$01 ; reset to player 1
.no_wrap
STA.l !ONEMIND_ID
STA.l OneMindId
REP #$20
LDA.l OneMindTimer
LDA.l OneMindTimerInit
.no_switch
STA.l !ONEMIND_TIMER
STA.l OneMindTimerRAM
SEP #$20
LDA.l !ONEMIND_ID
LDA.l OneMindId
CMP.b #$04 ; is it player 4 or 5?
BCC .no_multitap_switch
STZ.w $4201
STZ.w WRIO
.no_multitap_switch
.no_onemind
STZ.b $12
STZ.b NMIDoneFlag
JML $008034 ; reset frame loop

View File

@@ -1,21 +1,6 @@
; $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"
; Scrap04 used for n
; Scrap06 used for rounds
; Scrap08 use for dpScratch/MXResult (lower 32 of dpScratch)
CryptoDelta:
dd #$9e3779b9
@@ -35,164 +20,144 @@ 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 !dpScratch
LDA.w !z+2 : STA.b !dpScratch+2
%LSR32Single(!dpScratch)
%LSR32Single(!dpScratch)
%LSR32Single(!dpScratch)
%LSR32Single(!dpScratch)
%LSR32Single(!dpScratch)
;%LSR32(!dpScratch,#$05)
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 !y : STA.b !dpScratch+4
LDA.w !y+2 : STA.b !dpScratch+6
%ASL32Single(!dpScratch+4)
%ASL32Single(!dpScratch+4)
;%ASL32(!dpScratch+4,#$02)
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.b !dpScratch : EOR.b !dpScratch+4 : STA.w !upperScratch
LDA.b !dpScratch+2 : EOR.b !dpScratch+6 : STA.w !upperScratch+2
LDA.b Scrap08 : EOR.b Scrap08+4 : STA.w CryptoScratch
LDA.b Scrap08+2 : EOR.b Scrap08+6 : STA.w CryptoScratch+2
;================================
; upperscratch2 = (y>>3^z<<4)
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 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 !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.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.b !dpScratch : EOR.b !dpScratch+4 : STA.w !upperScratch+4
LDA.b !dpScratch+2 : EOR.b !dpScratch+6 : STA.w !upperScratch+6
LDA.b Scrap08 : EOR.b Scrap08+4 : STA.w CryptoScratch+4
LDA.b Scrap08+2 : EOR.b Scrap08+6 : STA.w CryptoScratch+6
;================================
; upperscratch = upperscratch + upperscratch2 ( == (z>>5^y<<2) + (y>>3^z<<4) )
LDA.w !upperScratch : !ADD.w !upperScratch+4 : STA.w !upperScratch
LDA.w !upperScratch+2 : ADC.w !upperScratch+6 : STA.w !upperScratch+2
LDA.w CryptoScratch : !ADD.w CryptoScratch+4 : STA.w CryptoScratch
LDA.w CryptoScratch+2 : ADC.w CryptoScratch+6 : STA.w CryptoScratch+2
;================================
; dpscratch = sum^y
LDA.w !sum : EOR.w !y : STA.b !dpScratch
LDA.w !sum+2 : EOR.w !y+2 : STA.b !dpScratch+2
LDA.w Sum : EOR.w y : STA.b Scrap08
LDA.w Sum+2 : EOR.w y+2 : STA.b Scrap08+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 !dpScratch+4
LDA.w !keyBase+2, X : EOR.w !z+2 : STA.b !dpScratch+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 Scrap08+4
LDA.w KeyBase+2, X : EOR.w z+2 : STA.b Scrap08+6
;================================
; upperscratch2 = dpscratch + dpscratch2 (== (sum^y) + (k[p&3^e]^z))
LDA.b !dpScratch : !ADD.b !dpScratch+4 : STA.w !upperScratch+4
LDA.b !dpScratch+2 : ADC.b !dpScratch+6 : STA.w !upperScratch+6
LDA.b Scrap08 : !ADD.b Scrap08+4 : STA.w CryptoScratch+4
LDA.b Scrap08+2 : ADC.b Scrap08+6 : STA.w CryptoScratch+6
;================================
; MXResult = uppserscratch ^ upperscratch2
LDA.w !upperScratch : EOR.w !upperScratch+4 : STA.b !MXResult
LDA.w !upperScratch+2 : EOR.w !upperScratch+6 : STA.b !MXResult+2
LDA.w CryptoScratch : EOR.w CryptoScratch+4 : STA.b Scrap08
LDA.w CryptoScratch+2 : EOR.w CryptoScratch+6 : STA.b Scrap08+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 !n+1 ; set upper byte of n to be zero, so it can safely be accessed in 16-bit mode
STZ.b Scrap04+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 !n : !BLT +
CMP.b Scrap04 : !BLT +
INX
BRA -
+
; rounds = 6 + 52/n;
LDA.l .round_counts, X : STA.b !rounds : STZ.b !rounds+1
LDA.l .round_counts, X : STA.b Scrap06 : STZ.b Scrap06+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 !n : DEC : STA.w !p
LDA.b Scrap04 : 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 !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 : 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 : DEC : STA.w !p : BRA -- ; }
LDA.w p : DEC : STA.w p : BRA -- ; }
+
; z = v[n-1];
LDA.b !n : DEC : ASL #2 : TAX
LDA.w !v, X : STA.w !z
LDA.w !v+2, X : STA.w !z+2
LDA.b Scrap04 : 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 !MXResult : STA.w !v : STA.w !y
LDA.w !v+2 : SBC.b !MXResult+2 : STA.w !v+2 : STA.w !y+2
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
; 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 !rounds : BEQ + : JMP --- : + ; } while (--rounds);
DEC.b Scrap06 : BEQ + : JMP --- : + ; } while (--rounds);
PLB : PLP
RTL
@@ -243,69 +208,3 @@ 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,29 +1,19 @@
;================================================================================
!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"
!CUCCO = $0B
!INERT = $00
!INIT = $08
!ALIVE = $09
!CUCCO_ENRAGED = $23
CuccoStorm:
SEP #$30 ; set 8-bit accumulator index registers
LDA.l !CUCCO_STORM : BEQ + ; only if storm is on
LDA.b $10 : CMP.b #$09 : BNE + ; only if outdoors
LDA.l CuccoStormer : BEQ + ; only if storm is on
LDA.b GameMode : CMP.b #$09 : BEQ .check ; only if outdoors
.indoors
LDA.b #$00 : STA.l CuccoStormer ; turn off cucco storm if indoors
BRA +
.check
LDA.l LoopFrames : AND.b #$7F : BNE + ; check every 128 frames
-
@@ -32,18 +22,18 @@ CuccoStorm:
LDY.b #$FF : PHY ; push "cucco not found"
LDX.b #$00 : -- : CPX.b #$10 : !BGE .ldone
LDA.w !ENEMY_STATE_TABLE, X : CMP.b !ALIVE : BEQ +++
LDA.w SpriteAITable, 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 !ENEMY_TYPE_TABLE, X : CMP.b !CUCCO : BNE ++
LDA.l SpriteTypeTable, 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 !ENEMY_AUX1_TABLE, X : CMP.b !CUCCO_ENRAGED : !BLT ++
LDA.w SpriteAuxTable, X : CMP.b #!CUCCO_ENRAGED : !BLT ++
PLA : BRA + ; we found an angry cucco, done
++ : INX : BRA -- : .ldone
@@ -53,12 +43,12 @@ CuccoStorm:
; 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 !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
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
BRA +++
++
PLA
@@ -66,8 +56,8 @@ CuccoStorm:
;==== Enrage a Cucco
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
LDA.b #!CUCCO_ENRAGED : STA.w SpriteAuxTable, Y ; enrage the cucco
LDA.b #$00 : STA.w SpriteAuxTable+$10, Y : STA.w SpriteDirectionTable, Y
;====
+

Binary file not shown.

Binary file not shown.

View File

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

View File

@@ -7,76 +7,77 @@ DarkWorldSaveFix:
JML.l StatSaveCounter
;--------------------------------------------------------------------------------
DoWorldFix:
LDA InvertedMode : BEQ +
LDA.l InvertedMode : BEQ +
JMP DoWorldFix_Inverted
+
LDA.l Bugfix_MirrorlessSQToLW : BEQ .skip_mirror_check
LDA MirrorEquipment : BEQ .noMirror ; check if we have the mirror
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
.skip_mirror_check ; alt entrance point
LDA ProgressIndicator : CMP.b #$03 : BCS .done ; check if agahnim 1 is alive
.aga1Alive
LDA #$00
LDA.l ProgressIndicator : CMP.b #$03 : BCS .done ; check if agahnim 1 is alive
.setLightWorld
LDA.b #$00
.noMirror
STA CurrentWorld ; set flag to light world
LDA FollowerIndicator : CMP #$07 : BNE .done : INC : STA FollowerIndicator ; convert frog to dwarf
STA.l CurrentWorld ; set flag to light world
LDA.l FollowerIndicator : CMP.b #$07 : BNE .done : INC : STA.l FollowerIndicator ; convert frog to dwarf
.done
RTL
;--------------------------------------------------------------------------------
SetDeathWorldChecked:
LDA InvertedMode : BEQ +
LDA.l InvertedMode : BEQ +
JMP SetDeathWorldChecked_Inverted
+
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
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
++
.outdoors
JMP DoWorldFix
.dungeon
LDA Bugfix_PreAgaDWDungeonDeathToFakeDW : BNE .done ; if the bugfix is enabled, we do nothing on death in dungeon
LDA.l Bugfix_PreAgaDWDungeonDeathToFakeDW : BNE .done ; if the bugfix is enabled, we do nothing on death in dungeon
JMP DoWorldFix_skip_mirror_check
.pyramid
LDA #$40 : STA CurrentWorld ; set flag to dark world
LDA FollowerIndicator : CMP #$08 : BNE .done : DEC : STA FollowerIndicator : + ; convert dwarf to frog
LDA.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
.done
RTL
;================================================================================
DoWorldFix_Inverted:
LDA.l Bugfix_MirrorlessSQToLW : BEQ .skip_mirror_check
LDA MirrorEquipment : BEQ .noMirror ; check if we have the mirror
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
.skip_mirror_check ; alt entrance point
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 FollowerIndicator
CMP #$07 : BEQ .clear ; clear frog
CMP #$08 : BEQ .clear ; clear dwarf - consider flute implications
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 FollowerIndicator ; clear follower
LDA.b #$00 : STA.l FollowerIndicator ; clear follower
.done
RTL
;--------------------------------------------------------------------------------
SetDeathWorldChecked_Inverted:
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
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
++
.outdoors
JMP DoWorldFix
.dungeon
LDA Bugfix_PreAgaDWDungeonDeathToFakeDW : BNE .done ; if the bugfix is enabled, we do nothing on death in dungeon
LDA.l Bugfix_PreAgaDWDungeonDeathToFakeDW : BNE .done ; if the bugfix is enabled, we do nothing on death in dungeon
JMP DoWorldFix_Inverted_skip_mirror_check
.castle
LDA #$00 : STA CurrentWorld ; set flag to dark world
LDA FollowerIndicator : CMP #$07 : BNE + : LDA.b #$08 : STA FollowerIndicator : + ; convert frog to dwarf
LDA.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
.done
RTL
;================================================================================
@@ -84,20 +85,20 @@ RTL
;--------------------------------------------------------------------------------
FakeWorldFix:
LDA FixFakeWorld : BEQ +
LDA $8A : AND.b #$40 : STA CurrentWorld
LDA.l FixFakeWorld : BEQ +
LDA.b OverworldIndex : AND.b #$40 : STA.l CurrentWorld
+
RTL
;--------------------------------------------------------------------------------
MasterSwordFollowerClear:
LDA FollowerIndicator
CMP #$0E : BNE .exit ; clear master sword follower
LDA.b #$00 : STA FollowerIndicator ; clear follower
LDA.l FollowerIndicator
CMP.b #$0E : BNE .exit ; clear master sword follower
LDA.b #$00 : STA.l FollowerIndicator ; clear follower
.exit
RTL
;--------------------------------------------------------------------------------
FixAgahnimFollowers:
LDA.b #$00 : STA FollowerIndicator ; clear follower
LDA.b #$00 : STA.l FollowerIndicator ; clear follower
JML PrepDungeonExit ; thing we wrote over
;--------------------------------------------------------------------------------
@@ -107,10 +108,10 @@ macro SetMinimum(base,filler,compare)
?done:
endmacro
RefreshRainAmmo:
LDA ProgressIndicator : CMP.b #$01 : BEQ .rain ; check if we're in rain state
LDA.l ProgressIndicator : CMP.b #$01 : BEQ .rain ; check if we're in rain state
RTL
.rain
LDA StartingEntrance
LDA.l StartingEntrance
+ CMP.b #$03 : BNE + ; Uncle
%SetMinimum(CurrentMagic,MagicFiller,RainDeathRefillMagic_Uncle)
%SetMinimum(BombsEquipment,BombsFiller,RainDeathRefillBombs_Uncle)
@@ -129,28 +130,30 @@ RefreshRainAmmo:
.done
RTL
;--------------------------------------------------------------------------------
!INFINITE_ARROWS = "$7F50C8"
!INFINITE_BOMBS = "$7F50C9"
!INFINITE_MAGIC = "$7F50CA"
SetEscapeAssist:
LDA ProgressIndicator : CMP.b #$01 : BNE .no_train ; check if we're in rain state
LDA.l ProgressIndicator : CMP.b #$01 : BNE .no_train ; check if we're in rain state
.rain
LDA.l EscapeAssist
BIT.b #$04 : BEQ + : STA !INFINITE_MAGIC : +
BIT.b #$02 : BEQ + : STA !INFINITE_BOMBS : +
BIT.b #$01 : BEQ + : STA !INFINITE_ARROWS : +
BIT.b #$04 : BEQ + : STA.l InfiniteArrows : +
BIT.b #$02 : BEQ + : STA.l InfiniteBombs : +
BIT.b #$01 : BEQ + : STA.l InfiniteArrows : +
BRA ++
.no_train ; choo choo
LDA.l EscapeAssist : BIT.b #$04 : BEQ + : LDA.b #$00 : STA !INFINITE_MAGIC : +
LDA.l EscapeAssist : BIT.b #$02 : BEQ + : LDA.b #$00 : STA !INFINITE_BOMBS : +
LDA.l EscapeAssist : BIT.b #$01 : BEQ + : LDA.b #$00 : STA !INFINITE_ARROWS : +
LDA.l EscapeAssist : BIT.b #$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 SpecialWeapons : CMP #$01 : BNE +
LDA.l SpecialWeaponLevel : BEQ +
LDA #$01 : STA InfiniteBombs
+
RTL
;--------------------------------------------------------------------------------
SetSilverBowMode:
LDA SilverArrowsUseRestriction : BEQ + ; fix bow type for restricted arrow mode
LDA BowEquipment : CMP.b #$3 : BCC +
SBC.b #$02 : STA BowEquipment
LDA.l SilverArrowsUseRestriction : BEQ + ; fix bow type for restricted arrow mode
LDA.l BowEquipment : CMP.b #$3 : BCC +
SBC.b #$02 : STA.l BowEquipment
+
RTL
;================================================================================

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

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

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

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

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

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

Binary file not shown.

BIN
data/fileselectgfx.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

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

View File

@@ -1,13 +1,10 @@
!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
@@ -23,65 +20,63 @@ RetrieveValueFromEncryptedTable:
;Returns result in A
PHX : PHY
PHA
LDY $04 : PHY : LDY $06 : PHY : LDY $08 : PHY
LDY $0A : PHY : LDY $0C : PHY : LDY $0E : PHY
LDY.b Scrap04 : PHY : LDY.b Scrap06 : PHY : LDY.b Scrap08 : PHY
LDY.b Scrap0A : PHY : LDY.b Scrap0C : PHY : LDY.b Scrap0E : PHY
AND.w #$FFF8 : TAY
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.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.w #$0002 : STA $04 ;set block size
LDA.w #$0002 : STA.b Scrap04 ;set block size
JSL.l XXTEA_Decode
PLA : STA $0E : PLA : STA $0C : PLA : STA $0A
PLA : STA $08 : PLA : STA $06 : PLA : STA $04
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 : 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"
!ChestData_Payload = "$1EABC" ; !ChestData+$0150
ChestData = $01E96C
ChestDataPayload = $01EABC ; ChestData+$0150
;--------------------------------------------------------------------------------
GetChestData:
LDA.l IsEncrypted : BNE .encrypted
INC $0E : LDX.w #$FFFD ; what we wrote over
INC.b Scrap0E : LDX.w #$FFFD ; what we wrote over
JML.l Dungeon_OpenKeyedObject_nextChest
.encrypted
INC $0E : LDX.w #$FFFE
INC.b Scrap0E : LDX.w #$FFFE
.nextChest
INX #2 : CPX.w #$0150 : BEQ .couldntFindChest
LDA !ChestData, X : AND.w #$7FFF : CMP $A0 : BNE .nextChest
LDA.l ChestData, X : AND.w #$7FFF : CMP.b RoomIndex : BNE .nextChest
DEC $0E : BNE .nextChest
DEC.b Scrap0E : BNE .nextChest
LDA $00 : PHA : LDA $02 : PHA
LDA.b Scrap00 : PHA : LDA.b Scrap02 : PHA
LDA.w #!ChestData_Payload : STA $00
LDA.w #!ChestData_Payload>>16 : STA $02
LDA.w #ChestDataPayload : STA.b Scrap00
LDA.w #ChestDataPayload>>16 : STA.b Scrap02
TXA : LSR
JSL RetrieveValueFromEncryptedTable
STA $0C
STA.b Scrap0C
PLA : STA $02 : PLA : STA $00
PLA : STA.b Scrap02 : PLA : STA.b Scrap00
LDA !ChestData, X : ASL A : BCC .smallChest
LDA.l ChestData, X : ASL A : BCC .smallChest
JML.l Dungeon_OpenKeyedObject_bigChest ;(bank01.asm line #13783)

View File

@@ -2,200 +2,138 @@
; Dialog Pointer Override
;--------------------------------------------------------------------------------
DialogOverride:
LDA $7F5035 : BEQ .skip
LDA $7F5700, X ; use alternate buffer
LDA.l AltTextFlag : BEQ .skip
LDA.l DialogBuffer, X ; use alternate buffer
RTL
.skip
LDA $7F1200, X
LDA.l DecompressionBuffer+$1200, X
RTL
;--------------------------------------------------------------------------------
; $7F5035 - Alternate Text Pointer Flag ; 0=Disable
; $7F5036 - Padding Byte (Must be Zero)
; $7F5700 - $7F57FF - Dialog Buffer
;--------------------------------------------------------------------------------
ResetDialogPointer:
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
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
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 ($00)
LDA $02 : PHA
STZ $1CF0 : STZ $1CF1 ; reset decompression buffer
LDA.b #$01 : STA $7F5035 ; set flag
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
%CopyDialog(<address>)
PLA : STA $02
PLA : STA.b Scrap02
REP #$20
PLA : STA $00
PLA : STA.b Scrap00
PLB
PLP
PLY : PLX : PLA
endmacro
;--------------------------------------------------------------------------------
macro CopyDialog(address)
LDA.b #<address> : STA $00 ; write pointer to direct page
LDA.b #<address>>>8 : STA $01
LDA.b #<address>>>16 : STA $02
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
%CopyDialogIndirect()
endmacro
;--------------------------------------------------------------------------------
macro CopyDialogIndirect()
REP #$20 : LDA !OFFSET_POINTER : TAX : LDY.w #$0000 : SEP #$20 ; copy 2-byte offset pointer to X and set Y to 0
REP #$20 : LDA.l DialogOffsetPointer : TAX : LDY.w #$0000 : SEP #$20 ; copy 2-byte offset pointer to X and set Y to 0
?loop:
LDA [$00], Y ; load the next character from the pointer
STA !DIALOG_BUFFER, X ; write to the buffer
LDA.b [$00], Y ; load the next character from the pointer
STA.l DialogBuffer, X ; write to the buffer
INX : INY
CMP.b #$7F : BNE ?loop
REP #$20 ; set 16-bit accumulator
TXA : INC : STA !OFFSET_RETURN ; copy out X into
LDA.w #$0000 : STA !OFFSET_POINTER
TXA : INC : STA.l DialogReturnPointer ; copy out X into
LDA.w #$0000 : STA.l DialogOffsetPointer
SEP #$20 ; set 8-bit accumulator
endmacro
;--------------------------------------------------------------------------------
LoadDialogAddressIndirect:
STZ $1CF0 : STZ $1CF1 ; reset decompression buffer
LDA.b #$01 : STA $7F5035 ; set flag
STZ.w TextID : STZ.w TextID+1 ; reset decompression buffer
LDA.b #$01 : STA.l AltTextFlag ; set flag
%CopyDialogIndirect()
;%LoadDialogAddress(UncleText)
RTL
;--------------------------------------------------------------------------------
!ITEM_TEMPORARY = "$7F5040"
FreeDungeonItemNotice:
STA !ITEM_TEMPORARY
STA.w ScratchBufferV
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
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
;--------------------------------
LDA.l FreeItemText : BNE + : JMP .skip : +
LDA #$00 : STA $7F5010 ; initialize scratch
LDA.b #$00 : STA.w ScratchBufferNV ; initialize scratch
LDA.l FreeItemText : AND.b #$01 : BEQ + ; show message for general small key
LDA !ITEM_TEMPORARY : CMP.b #$24 : BNE + ; general small key
LDA.w ScratchBufferV : CMP.b #$24 : BNE + ; general small key
%CopyDialog(Notice_SmallKeyOf)
LDA !OFFSET_RETURN : DEC #2 : STA !OFFSET_POINTER
LDA.l DialogReturnPointer : DEC #2 : STA.l DialogOffsetPointer
%CopyDialog(Notice_Self)
JMP .done
+ : LDA.l FreeItemText : AND.b #$02 : BEQ + ; show message for general compass
LDA !ITEM_TEMPORARY : CMP.b #$25 : BNE + ; general compass
LDA.w ScratchBufferV : CMP.b #$25 : BNE + ; general compass
%CopyDialog(Notice_CompassOf)
LDA !OFFSET_RETURN : DEC #2 : STA !OFFSET_POINTER
LDA.l DialogReturnPointer : DEC #2 : STA.l DialogOffsetPointer
%CopyDialog(Notice_Self)
JMP .done
+ : LDA.l FreeItemText : AND.b #$04 : BEQ + ; show message for general map
LDA !ITEM_TEMPORARY : CMP.b #$33 : BNE + ; general map
LDA.w ScratchBufferV : CMP.b #$33 : BNE + ; general map
%CopyDialog(Notice_MapOf)
LDA !OFFSET_RETURN : DEC #2 : STA !OFFSET_POINTER
LDA.l DialogReturnPointer : DEC #2 : STA.l DialogOffsetPointer
%CopyDialog(Notice_Self)
JMP .done
+ : LDA.l FreeItemText : AND.b #$08 : BEQ + ; show message for general big key
LDA !ITEM_TEMPORARY : CMP.b #$32 : BNE + ; general big key
LDA.w ScratchBufferV : CMP.b #$32 : BNE + ; general big key
%CopyDialog(Notice_BigKeyOf)
LDA !OFFSET_RETURN : DEC #2 : STA !OFFSET_POINTER
LDA.l DialogReturnPointer : DEC #2 : STA.l DialogOffsetPointer
%CopyDialog(Notice_Self)
JMP .done
+
LDA.l FreeItemText : AND.b #$04 : BEQ + ; show message for dungeon map
LDA !ITEM_TEMPORARY : AND.b #$F0 ; looking at high bits only
LDA.w ScratchBufferV : AND.b #$F0 ; looking at high bits only
CMP.b #$70 : BNE + ; map of...
%CopyDialog(Notice_MapOf)
JMP .dungeon
+ : LDA.l FreeItemText : AND.b #$02 : BEQ + ; show message for dungeon compass
LDA !ITEM_TEMPORARY : AND.b #$F0 : CMP.b #$80 : BNE + ; compass of...
LDA.w ScratchBufferV : AND.b #$F0 : CMP.b #$80 : BNE + ; compass of...
%CopyDialog(Notice_CompassOf)
JMP .dungeon
+ : LDA.l FreeItemText : AND.b #$08 : BEQ + ; show message for dungeon big key
LDA !ITEM_TEMPORARY : AND.b #$F0 : CMP.b #$90 : BNE + ; big key of...
LDA.w ScratchBufferV : 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 !ITEM_TEMPORARY : AND.b #$F0 : CMP.b #$A0 : BNE + ; small key of...
LDA !ITEM_TEMPORARY : CMP.b #$AF : BNE ++ : JMP .skip : ++
LDA.w ScratchBufferV : AND.b #$F0 : CMP.b #$A0 : BNE + ; small key of...
LDA.w ScratchBufferV : CMP.b #$AF : BNE ++ : JMP .skip : ++
%CopyDialog(Notice_SmallKeyOf)
PLA : AND.b #$0F : STA $7F5020 : LDA.b #$0F : !SUB $7F5020 : PHA
LDA #$01 : STA $7F5010 ; set up a flip for small keys
LDA.b #$01 : STA.w ScratchBufferNV ; 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 !OFFSET_RETURN : DEC #2 : STA !OFFSET_POINTER
LDA !ITEM_TEMPORARY
LDA.l DialogReturnPointer : DEC #2 : STA.l DialogOffsetPointer
LDA.w ScratchBufferV
AND.b #$0F ; looking at low bits only
STA $7F5011
LDA $7F5010 : BEQ +
LDA $7F5010
LDA #$0F : !SUB $7F5011 : STA $7F5011 ; flip the values for small keys
STA.w ScratchBufferNV+1
LDA.w ScratchBufferNV : BEQ +
LDA.w ScratchBufferNV
LDA.b #$0F : !SUB.w ScratchBufferNV+1 : STA.w ScratchBufferNV+1 ; flip the values for small keys
+
LDA $7F5011
LDA.w ScratchBufferNV+1
CMP.b #$00 : BNE + ; ...light world
%CopyDialog(Notice_LightWorld) : JMP .done
+ : CMP.b #$01 : BNE + ; ...dark world
@@ -231,30 +169,31 @@ FreeDungeonItemNotice:
+
.done
STZ $1CF0 : STZ $1CF1 ; reset decompression buffer
LDA.b #$01 : STA $7F5035 ; set alternate dialog flag
STA $7F509F
STZ.w TextID : STZ.w TextID+1 ; reset decompression buffer
LDA.b #$01 : STA.l AltTextFlag ; set alternate dialog flag
STA.l TextBoxDefer
;--------------------------------
.skip
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
PLA : STA.w ScratchBufferNV+1
PLA : STA.w ScratchBufferNV
PLA : STA.b Scrap02
REP #$20
PLA : STA.b Scrap00
PLB
PLP
PLY : PLX : PLA
RTL
;--------------------------------------------------------------------------------
DialogResetSelectionIndex:
JSL.l Attract_DecompressStoryGfx ; what we wrote over
STZ $1CE8
STZ.w MessageCursor
RTL
;--------------------------------------------------------------------------------
DialogItemReceive:
BCS .nomessage ; if doubling the item value overflowed it must be a rando item
CPY #$98 : BCC ++ ;if the item is $4C or greater it must be a rando item
CPY.b #$98 : BCC ++ ;if the item is $4C or greater it must be a rando item
.nomessage
LDA.w #$FFFF
@@ -267,11 +206,14 @@ RTL
;--------------------------------------------------------------------------------
DialogFairyThrow:
LDA.l Restrict_Ponds : BEQ .normal
LDA BottleContentsOne
ORA BottleContentsTwo : ORA BottleContentsThree : ORA BottleContentsFour : BNE .normal
LDA.l BottleContentsOne
ORA.l BottleContentsTwo
ORA.l BottleContentsThree
ORA.l BottleContentsFour
BNE .normal
.noInventory
LDA $0D80, X : !ADD #$08 : STA $0D80, X
LDA.w SpriteActivity, X : !ADD #$08 : STA.w SpriteActivity, X
LDA.b #$51
LDY.b #$01
RTL
@@ -285,8 +227,11 @@ DialogGanon1:
REP #$20
LDA.w #$018C
BCC +
JSL CheckMushroom
LDA.w #$016D
+ STA $1CF0
BCC +
LDA.w #$0197
+ STA.w TextID
SEP #$20
JSL.l Sprite_ShowMessageMinimal_Alt
RTL
@@ -300,45 +245,79 @@ RTL
; s = silver arrow bow
; p = 2nd progressive bow
DialogGanon2:
JSL.l CheckGanonVulnerability
JSL.l CheckGanonVulnerability
REP #$20
BCS +
LDA.w #$018D : BRA ++
+
LDA.w #$018D : JMP .done
+
JSL CheckMushroom
BCC +
LDA.w #$0198 : JMP .done
+
LDA.l GanonVulnerabilityItem : AND #$00FF : BNE .special_item
LDA.l SpecialWeapons : AND.w #$00FF
CMP.w #$0001 : BEQ .bombs ; bombs if special bomb mode
.silver_arrows
LDA.l BowTracking
BIT.w #$0080 : BNE + ; branch if bow
LDA.w #$0192 : BRA ++
+
BIT.w #$0040 : BEQ + ; branch if no silvers
LDA.w #$0195 : BRA ++
+
BIT.w #$0020 : BNE + ; branch if p bow
LDA.w #$0194 : BRA ++
+
BIT.w #$0080 : BEQ + ; branch if no bow
LDA.w #$0193 : BRA ++
+
LDA.w #$016E
++
STA $1CF0
BIT.w #$0080 : BNE + ; branch if bow
LDA.w #$0192 : JMP .done
+
BIT.w #$0040 : BEQ + ; branch if no silvers
LDA.w #$0195 : JMP .done
+
BIT.w #$0020 : BNE + ; branch if p bow
LDA.w #$0194 : JMP .done
+
BIT.w #$0080 : BEQ + ; branch if no bow
LDA.w #$0193 : JMP .done
+
LDA.w #$016E : JMP .done
.special_item
CMP.w #$0001 : BEQ .silver_arrows
CMP.w #$0004 : BEQ .bombs
CMP.w #$0005 : BEQ .powder
CMP.w #$0010 : BEQ .bee
PHX : TAX
LDA.l EquipmentWRAM-1, X : PLX : AND #$00FF : BNE +
LDA.w #$0192 : JMP .done
+
LDA.w #$0195 : BRA .done
.bombs
LDA.l BombsEquipment : AND #$00FF : BNE +
LDA.l InfiniteBombs : AND #$00FF : BNE + ; check for infinite bombs
LDA.w #$0192 : BRA .done
+
LDA.w #$0195 : BRA .done
.powder
LDA.l InventoryTracking : AND #$0010 : BNE + ; check for powder
LDA.w #$0192 : BRA .done
+
LDA.w #$0195 : BRA .done
.bee
LDA.l BottleContentsOne : AND #$00FF : CMP.w #$0007 : BEQ + : CMP.w #$0008 : BEQ +
LDA.l BottleContentsTwo : AND #$00FF : CMP.w #$0007 : BEQ + : CMP.w #$0008 : BEQ +
LDA.l BottleContentsThree : AND #$00FF : CMP.w #$0007 : BEQ + : CMP.w #$0008 : BEQ +
LDA.l BottleContentsFour : AND #$00FF : CMP.w #$0007 : BEQ + : CMP.w #$0008 : BEQ +
LDA.w #$0192 : BRA .done
+
LDA.w #$0195 : BRA .done
.done
STA.w TextID
SEP #$20
JSL.l Sprite_ShowMessageMinimal_Alt
JSL.l Sprite_ShowMessageMinimal_Alt
RTL
;--------------------------------------------------------------------------------
DialogEtherTablet:
PHA
LDA $0202 : CMP.b #$0F : BEQ + ; Show normal text if book is not equipped
LDA.w ItemCursor : CMP.b #$0F : BEQ + ; Show normal text if book is not equipped
-
PLA : JML Sprite_ShowMessageUnconditional ; Wacky Hylian Text
+
BIT $F4 : BVC - ; Show normal text if Y is not pressed
LDA.l AllowHammerTablets : BEQ ++
LDA HammerEquipment : BEQ .yesText : BRA .noText
++
LDA SwordEquipment : CMP.b #$FF : BEQ .yesText : CMP.b #$02 : BCS .noText
;++
BIT.b Joy1A_New : BVC - ; Show normal text if Y is not pressed
JSL CheckTabletSword : BMI .yesText
CMP.b #$02 : !BGE .noText
.yesText
PLA
LDA.b #$0C
@@ -351,16 +330,13 @@ RTL
;--------------------------------------------------------------------------------
DialogBombosTablet:
PHA
LDA $0202 : CMP.b #$0F : BEQ + ; Show normal text if book is not equipped
LDA.w ItemCursor : CMP.b #$0F : BEQ + ; Show normal text if book is not equipped
-
PLA : JML Sprite_ShowMessageUnconditional ; Wacky Hylian Text
+
BIT $F4 : BVC - ; Show normal text if Y is not pressed
LDA.l AllowHammerTablets : BEQ ++
LDA HammerEquipment : BEQ .yesText : BRA .noText
++
LDA SwordEquipment : CMP.b #$FF : BEQ .yesText : CMP.b #$02 : !BGE .noText
;++
BIT.b Joy1A_New : BVC - ; Show normal text if Y is not pressed
JSL CheckTabletSword : BMI .yesText
CMP.b #$02 : !BGE .noText
.yesText
PLA
LDA.b #$0D
@@ -372,16 +348,16 @@ DialogBombosTablet:
RTL
;--------------------------------------------------------------------------------
DialogSahasrahla:
LDA.l PendantsField : AND #$04 : BEQ + ;Check if player has green pendant
LDA.l PendantsField : AND.b #$04 : BEQ + ;Check if player has green pendant
LDA.b #$2F
LDY.b #$00
LDY.b #$00
JML Sprite_ShowMessageUnconditional
+
RTL
;--------------------------------------------------------------------------------
DialogBombShopGuy:
LDY.b #$15
LDA.l CrystalsField : AND #$05 : CMP #$05 : BNE + ;Check if player has crystals 5 & 6
LDA.l CrystalsField : AND.b #$05 : CMP.b #$05 : BNE + ;Check if player has crystals 5 & 6
INY ; from 15 to 16
+
TYA
@@ -399,54 +375,54 @@ AgahnimAsksAboutPed:
BNE .vanilla
LDA.b #$8C ; message 018C for no ped
STA.w $1CF0
STA.w TextID
.vanilla
JML $05FA8E ; Sprite_ShowMessageMinimal
;--------------------------------------------------------------------------------
Main_ShowTextMessage_Alt:
; Are we in text mode? If so then end the routine.
LDA $10 : CMP.b #$0E : BEQ .already_in_text_mode
LDA.b GameMode : CMP.b #$0E : BEQ .already_in_text_mode
Sprite_ShowMessageMinimal_Alt:
STZ $11
STZ.b GameSubMode
PHX : PHY
PEI ($00)
LDA.b $02 : PHA
PEI.b (Scrap00)
LDA.b Scrap02 : PHA
LDA.b #$1C : STA.b $02
LDA.b #$1C : STA.b Scrap02
REP #$30
LDA.w $1CF0 : ASL : TAX
LDA.w TextID : ASL : TAX
LDA.l $7F71C0, X
STA.b $00
STA.b Scrap00
SEP #$30
LDY.b #$00
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
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
JMP .end
+
STZ $0223 ; Otherwise set it so we are in text mode.
STZ $1CD8 ; Initialize the step in the submodule
STZ.w MessageJunk ; Otherwise set it so we are in text mode.
STZ.w MessageSubModule
; Go to text display mode (as opposed to maps, etc)
LDA.b #$02 : STA $11
LDA.b #$02 : STA.b GameSubMode
; Store the current module in the temporary location.
LDA $10 : STA $010C
LDA.b GameMode : STA.w GameModeCache
; Switch the main module ($10) to text mode.
LDA.b #$0E : STA $10
LDA.b #$0E : STA.b GameMode
.end
PLA : STA.b $02
PLA : STA.b $01
PLA : STA.b $00
PLA : STA.b Scrap02
PLA : STA.b Scrap01
PLA : STA.b Scrap00
PLY : PLX
Main_ShowTextMessage_Alt_already_in_text_mode:
@@ -458,15 +434,15 @@ CalculateSignIndex:
; And we do this in a way that will likely give the right value even
; with major glitches.
LDA $8A : ASL A : TAY ;what we wrote over
LDA.b OverworldIndex : ASL A : TAY ;what we wrote over
LDA $0712 : BEQ .done ; If a small map, we can skip these calculations.
LDA.w OWScreenSize : BEQ .done ; If a small map, we can skip these calculations.
LDA $21 : AND.w #$0002 : ASL #2 : EOR $8A : AND.w #$0008 : BEQ +
LDA.b LinkPosY+1 : AND.w #$0002 : ASL #2 : EOR.b OverworldIndex : AND.w #$0008 : BEQ +
TYA : !ADD.w #$0010 : TAY ;add 16 if we are in lower half of big screen.
+
LDA $23 : AND.w #$0002 : LSR : EOR $8A : AND.w #$0001 : BEQ +
LDA.b LinkPosX+1 : AND.w #$0002 : LSR : EOR.b OverworldIndex : AND.w #$0001 : BEQ +
TYA : INC #2 : TAY ;add 16 if we are in lower half of big screen.
+
; ensure even if things go horribly wrong, we don't read the sign out of bounds and crash:
@@ -475,6 +451,112 @@ 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 $7F5099
LDA $1BBB73, X : STA $010E
STA.l PreviousOverworldDoor
LDA.l $1BBB73, X : STA.w EntranceIndex
RTL
;--------------------------------------------------------------------------------
@@ -16,14 +16,14 @@ RTL
; CacheDoorFrameData
;--------------------------------------------------------------------------------
CacheDoorFrameData:
LDA $7F5099 : BEQ .originalBehaviour
LDA.l PreviousOverworldDoor : BEQ .originalBehaviour
DEC : ASL : TAX
LDA EntranceDoorFrameTable, X : STA $0696
LDA EntranceAltDoorFrameTable, X : STA $0698
LDA.l EntranceDoorFrameTable, X : STA.w TileMapEntranceDoors
LDA.l EntranceAltDoorFrameTable, X : STA.w TileMapTile32
BRA .done
.originalBehaviour
LDA $D724, X : STA $0696
STZ $0698
LDA.w $D724, X : STA.w TileMapEntranceDoors
STZ.w TileMapTile32
.done
RTL
;--------------------------------------------------------------------------------
@@ -32,8 +32,8 @@ RTL
; WalkDownIntoTavern
;--------------------------------------------------------------------------------
WalkDownIntoTavern:
LDA $7F5099
LDA.l PreviousOverworldDoor
; tavern door has index 0x42 (saved off value is incremented by one)
CMP #$43
CMP.b #$43
RTL
;--------------------------------------------------------------------------------

View File

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

View File

@@ -1,24 +1,16 @@
DoDungeonMapBossIcon:
LDA.b $14
LDA.b NMISTRIPES
CMP.b #$09
BEQ .dungeonmap
.cave
CMP.b #$01
RTL
.dungeonmap
LDX.w $040C
LDX.w DungeonID
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
@@ -57,7 +49,7 @@ DoDungeonMapBossIcon:
.match
LDA.b #$80
STA.w $2121
STA.w CGADD
REP #$30
@@ -74,14 +66,14 @@ DoDungeonMapBossIcon:
ASL ; x128 for graphics
ASL
ADC.w #BossMapIconGFX
STA.w $4312
STA.w A1T1L
PHY
LDY.w #32
SEP #$20
-- LDA.l .boss_palettes,X
STA.w $2122
STA.w CGDATA
INX
DEY
BNE --
@@ -94,24 +86,24 @@ DoDungeonMapBossIcon:
SEP #$10
LDA.w #$1801
STA.w $4310
STA.w DMAP1
LDX.b #BossMapIconGFX>>16
STX.w $4314
STX.w A1B1
LDA.w #$A060>>1
STA.w $2116
STA.w VMADDL
LDA.w #$0040
STA.w $4315
STA.w DAS1L
LDX.b #$02
STX.w $420B
STX.w MDMAEN
STA.w $4315
STA.w DAS1L
LDA.w #$A260>>1
STA.w $2116
STA.w VMADDL
STX.w $420B
STX.w MDMAEN
; done
SEP #$30

View File

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

View File

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

View File

@@ -3,21 +3,25 @@
; make sure bats always load LW stats
;--------------------------------------------------------------------------------
NewBatInit:
CPY #$00 : BEQ .light_world
CPY.b #$00 : BEQ .light_world
;check if map id == 240 or 241
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 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.b #$85 : STA $0CD2, X
LDA.b #$04 : STA $0E50, X
LDA.b #$85 : STA.w SpriteBump, X
LDA.b #$04 : STA.w SpriteHitPoints, X
RTL
.light_world
LDA.b #$80 : STA $0CD2, X
LDA.b #$01 : STA $0E50, X
LDA.b #$80 : STA.w SpriteBump, X
LDA.b #$01 : STA.w SpriteHitPoints, 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 ProgressIndicator : AND.w #$000F : CMP.w #$0002 : !BGE .unlock ; if we rescued zelda, skip
LDA.l ProgressIndicator : AND.w #$000F : CMP.w #$0002 : !BGE .unlock ; if we rescued zelda, skip
JSR.w LockAgahnimDoorsCore : RTL
+ : CMP.w #$0002 : BNE +
JSR.w LockAgahnimDoorsCore : BEQ .unlock
@@ -18,20 +18,20 @@ LockAgahnimDoors:
REP #$30
PLY : PLX
!BGE .crystalOrUnlock
LDA #$0001 : RTL
LDA.w #$0001 : RTL
.crystalOrUnlock
LDA InvertedMode : AND.w #$00FF : BEQ .unlock
LDA.l InvertedMode : AND.w #$00FF : BEQ .unlock
LDA OverworldEventDataWRAM+$43 : AND.w #$0020 : BNE .unlock ; Check if GT overlay is already on or not
LDA $0308 : AND.w #$0080 : BEQ ++ ;If we are holding an item
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
.locked
LDA #$0001 : RTL ;Keep the door locked
LDA.w #$0001 : RTL ;Keep the door locked
++
SEP #$30
JSL $099B6F ;Add tower break seal
REP #$30
LDA #$0001 ;Prevent door from opening that frame otherwise it glitchy
LDA.w #$0001 ;Prevent door from opening that frame otherwise it glitchy
RTL
+
@@ -44,19 +44,19 @@ RTL
FlagAgahnimDoor:
LDA.l InvertedMode : BEQ .vanilla
LDA OverworldEventDataWRAM+$43 : ORA #$20 : STA OverworldEventDataWRAM+$43 ; activate GT overlay
LDA.l OverworldEventDataWRAM+$43 : ORA.b #$20 : STA.l OverworldEventDataWRAM+$43 ; activate GT overlay
.vanilla
LDA.b #$28 : STA.b $72
LDA.b #$28 : STA.b ScrapBuffer72
RTL
;--------------------------------------------------------------------------------
LockAgahnimDoorsCore:
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
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
RTS
+
LDA.w #$0000
@@ -77,57 +77,56 @@ JML.l Overworld_Entrance_BRANCH_RHO
AllowStartFromSingleEntranceCave:
; 16 Bit A, 16 bit XY
; do not need to preserve A or X or Y
LDA StartingEntrance : AND.w #$00FF ; What we wrote over
LDA.l StartingEntrance : AND.w #$00FF ; What we wrote over
PHA
TAX
LDA.l StartingAreaExitOffset, X
AND.w #$00FF
AND.w #$00FF
BNE +
JMP .done
+
DEC
STA $00
ASL #2 : !ADD $00 : ASL #2 ; mult by 20
STA.b Scrap00
ASL #2 : !ADD Scrap00 : ASL #2 ; mult by 20
TAX
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
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
; 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 #$FF00 : + ; Sign extend
STA.l $7EC16A
BIT.w #$0080 : BEQ + : ORA.w #$FF00 : + ; Sign extend
STA.l EN_SCRMODYA
LDA.l StartingAreaExitTable+$12, X : AND.w #$00FF
BIT.w #$0080 : BEQ + : ORA #$FF00 : + ; Sign extend
STA.l $7EC16E
BIT.w #$0080 : BEQ + : ORA.w #$FF00 : + ; Sign extend
STA.l EN_SCRMODXA
LDA.w #$0000 : !SUB.l $7EC16A : STA $7EC16C
LDA.w #$0000 : !SUB.l $7EC16E : STA $7EC170
LDA.w #$0000 : !SUB.l EN_SCRMODYA : STA.l EN_SCRMODYB
LDA.w #$0000 : !SUB.l EN_SCRMODXA : STA.l EN_SCRMODXB
LDA.l StartingAreaExitTable+$02, X : AND.w #$00FF
STA $7EC14C ; Cache the overworld area number
STA $7EC140 ; Cache the aux overworld area number
STA.l EN_OWSCR ; Cache the overworld area number
STA.l EN_OWSCR2 ; Cache the aux overworld area number
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
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
SEP #$20 ; set 8-bit accumulator
LDA $7EF3C8 : TAX
LDA.l StartingAreaOverworldDoor, X : STA.l $7F5099 ;Load overworld door
LDA.l StartingEntrance : TAX
LDA.l StartingAreaOverworldDoor, X : STA.l PreviousOverworldDoor ;Load overworld door
REP #$20 ; reset 16-bit accumulator
JSL.l CacheDoorFrameData
JSL.l CacheDoorFrameData
.done
PLA
@@ -135,7 +134,7 @@ RTL
;--------------------------------------------------------------------------------
AllowStartFromExit:
LDX $1CE8
LDX.w MessageCursor
LDA.l ShouldStartatExit, X : BNE .doStart
LDA.l StartingEntrance ; what we wrote over
@@ -146,39 +145,38 @@ JML.l AllowStartFromExitReturn
LDA.l $028481, X ;Module_LocationMenu_starting_points
ASL : TAX
LDA.l $02D8D2, X : STA $A0
LDA.l $02D8D3, X : STA $A1
LDA.l $02D8D2, X : STA.b RoomIndex
LDA.l $02D8D3, X : STA.b RoomIndex+1
; Go to pre-overworld mode
LDA.b #$08 : STA $10
LDA.b #$08 : STA.b GameMode
STZ $11
STZ $B0
STZ.b GameSubMode
STZ.b SubSubModule
STZ.w DeathReloadFlag
STZ.w RespawnFlag
STZ $010A
STZ $04AA
JSL Equipment_SearchForEquippedItemLong
JSL HUD_RebuildLong2
JSL $0DDD32 ; Equipment_UpdateEquippedItemLong
JSL Equipment_UpdateEquippedItemLong
RTL
;--------------------------------------------------------------------------------
CheckHole:
LDX.w #$0024
.nextHoleClassic
LDA.b $00 : CMP.l $1BB800, X
LDA.b Scrap00 : CMP.l $1BB800, X
BNE .wrongMap16Classic
LDA.w $040A : CMP.l $1BB826, X
LDA.b OverworldIndex : CMP.l $1BB826, X
BEQ .matchedHoleClassic
.wrongMap16Classic
DEX #2 : BPL .nextHoleClassic
LDX.w #$001E
.nextHoleExtra
LDA.b $00 : CMP.l ExtraHole_Map16, X
LDA.b Scrap00 : CMP.l ExtraHole_Map16, X
BNE .wrongMap16Extra
LDA.w $040A : CMP.l ExtraHole_Area, X
LDA.b OverworldIndex : CMP.l ExtraHole_Area, X
BEQ .matchedHoleExtra
.wrongMap16Extra
DEX #2 : BPL .nextHoleExtra
@@ -189,14 +187,14 @@ CheckHole:
.matchedHoleExtra
SEP #$30
TXA : LSR A : TAX
LDA.l ExtraHole_Entrance, X : STA.w $010E : STZ.w $010F
LDA.l ExtraHole_Entrance, X : STA.w EntranceIndex : STZ.w EntranceIndex+1
JML Overworld_Hole_End
;--------------------------------------------------------------------------------
PreventEnterOnBonk:
STA $00 ; part of what we wrote over
STA.b Scrap00 ; part of what we wrote over
LDA.l InvertedMode : AND.w #$00FF : BEQ .done
LDA.l $5D : AND.w #$00FF : CMP.w #$0014 : BNE .done ;in mirror mode?
LDA.b $8A : AND.w #$0040 : CMP $7B : BEQ .done ; Are we bonking, or doing the superbunny glitch?
LDA.b 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?
; If in inverted, are in mirror mode, and are bonking then do not enter
JML.l PreventEnterOnBonk_BRANCH_IX
@@ -206,8 +204,8 @@ PreventEnterOnBonk:
JML.l PreventEnterOnBonk_return
;--------------------------------------------------------------------------------
TurtleRockEntranceFix:
LDA TurtleRockAutoOpenFix : BEQ .done
LDA $8A : CMP.b #$47 : BNE .done
LDA.l TurtleRockAutoOpenFix : BEQ .done
LDA.b OverworldIndex : 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
@@ -216,14 +214,14 @@ RTL
AnimatedEntranceFix: ;when an entrance animation tries to start
PHA
LDA.l InvertedMode : BEQ + ;If we are in inverted mode
LDA $8A : AND.b #$40 : BNE + ;and in the light world
LDA.b OverworldIndex : AND.b #$40 : BNE + ;and in the light world
PLA
STZ $04C6 ; skip it.
LDA #$00
STZ.w OWEntranceCutscene ; skip it.
LDA.b #$00
RTL
+
PLA
STA $02E4 ;what we wrote over
STA $0FC1 ;what we wrote over
STA $0710 ;what we wrote over
STA.w CutsceneFlag ;what we wrote over
STA.w FreezeSprites ;what we wrote over
STA.w SkipOAM ;what we wrote over
RTL

View File

@@ -1,13 +1,6 @@
;--------------------------------------------------------------------------------
; OnLoadOW
;--------------------------------------------------------------------------------
;OnLoadMap:
; LDA OverworldEventDataWRAM+$5B ; thing we wrote over
;RTL
;--------------------------------------------------------------------------------
OnPrepFileSelect:
LDA $11 : CMP.b #$03 : BNE +
LDA.b #$06 : STA $14 ; thing we wrote over
LDA.b GameSubMode : CMP.b #$03 : BNE +
LDA.b #$06 : STA.b NMISTRIPES ; thing we wrote over
RTL
+
JSL.l LoadAlphabetTilemap
@@ -22,8 +15,8 @@ OnDrawHud:
JML.l ReturnFromOnDrawHud
;--------------------------------------------------------------------------------
OnDungeonEntrance:
STA $7EC172 ; thing we wrote over
JSL MaybeFlagCompassTotalEntrance
STA.l PegColor ; thing we wrote over
JSL MaybeFlagDungeonTotalsEntrance
RTL
;--------------------------------------------------------------------------------
OnPlayerDead:
@@ -40,7 +33,7 @@ OnDungeonExit:
JSL.l SQEGFix
PLP : PLA
STA $040C : STZ $04AC ; thing we wrote over
STA.w DungeonID : STZ.w Map16ChangeIndex ; thing we wrote over
PHA : PHP
JSL.l HUD_RebuildLong
@@ -51,17 +44,17 @@ RTL
;--------------------------------------------------------------------------------
OnQuit:
JSL.l SQEGFix
LDA.b #$00 : STA $7F5035 ; bandaid patch bug with mirroring away from text
LDA.b #$10 : STA $1C ; thing we wrote over
LDA.b #$00 : STA.l AltTextFlag ; bandaid patch bug with mirroring away from text
LDA.b #$10 : STA.b MAINDESQ ; thing we wrote over
RTL
;--------------------------------------------------------------------------------
OnUncleItemGet:
PHA
LDA.l EscapeAssist
BIT.b #$04 : BEQ + : STA !INFINITE_MAGIC : +
BIT.b #$02 : BEQ + : STA !INFINITE_BOMBS : +
BIT.b #$01 : BEQ + : STA !INFINITE_ARROWS : +
BIT.b #$04 : BEQ + : STA.l InfiniteMagic : +
BIT.b #$02 : BEQ + : STA.l InfiniteBombs : +
BIT.b #$01 : BEQ + : STA.l InfiniteArrows : +
PLA
JSL.l Link_ReceiveItem
@@ -77,66 +70,63 @@ OnUncleItemGet:
LDA.l CurrentRupees : !ADD.l FreeUncleItemAmount : STA.l CurrentRupees ; rupee arrows, so also give the player some money to start
SEP #$20 ; set 8-bit accumulator
+
LDA.l ProgressIndicator : BNE +
LDA.b #$01 : STA.l ProgressIndicator ; handle rain state
+
LDA.l ProgressIndicator : BNE +
LDA.b #$01 : STA.l ProgressIndicator ; handle rain state
+
RTL
;--------------------------------------------------------------------------------
OnAga2Defeated:
JSL.l Dungeon_SaveRoomData_justKeys ; thing we wrote over, make sure this is first
LDA.b #$01 : STA.l Aga2Duck
JML.l IncrementAgahnim2Sword
JSL.l Dungeon_SaveRoomData_justKeys ; thing we wrote over, make sure this is first
LDA.b #$01 : STA.l Aga2Duck
JML.l IncrementAgahnim2Sword
;--------------------------------------------------------------------------------
OnFileCreation:
; Copy initial SRAM state from ROM to cart SRAM
PHB
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
; Copy initial SRAM state from ROM to cart SRAM
; If the inital SRAM table is move these addresses must be changed
PHB
LDA.w #$03D7 ; \
LDX.w #$B000 ; | Copies from beginning of inital sram table up to file name
LDY.w #$0000 ; | (exclusively)
MVN !SRAMBank, !SRAMTableBank ; /
; Skip file name and validity value
LDA.w #$010C ; \
LDX.w #$B3E3 ; | Rando-Specific Assignments & Game Stats block
LDY.w #$03E3 ; |
MVN !SRAMBank, !SRAMTableBank ; /
PLB
; resolve instant post-aga if standard
SEP #$20
LDA.l InitProgressIndicator : BIT #$80 : BEQ +
LDA.b #$00 : STA.l ProgressIndicatorSRAM ; set post-aga after zelda rescue
LDA.b #$00 : STA.l OverworldEventDataSRAM+$02 ; keep rain state vanilla
+
REP #$20
; resolve instant post-aga if standard
SEP #$20
LDA.l InitProgressIndicator : BIT #$80 : BEQ +
LDA.b #$00 : STA.l ProgressIndicatorSRAM ; set post-aga after zelda rescue
LDA.b #$00 : STA.l OverworldEventDataSRAM+$02 ; keep rain state vanilla
+
REP #$20
; Set validity value and do some cleanup. Jump to checksum.
LDA.w #$55AA : STA.l $7003E1
STZ $00
STZ $01
LDX.b $00
LDY.w #$0000
TYA
; 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
JML.l InitializeSaveFile_build_checksum
JML.l InitializeSaveFile_done
;--------------------------------------------------------------------------------
!RNG_ITEM_LOCK_IN = "$7F5090"
OnFileLoad:
REP #$10 ; set 16 bit index registers
JSL.l EnableForceBlank ; what we wrote over
LDA.b #$07 : STA $210C ; Restore screen 3 to normal tile area
LDA.b #$07 : STA.w BG34NBA ; Restore screen 3 to normal tile area
LDA.l FileMarker : BNE +
JSL.l OnNewFile
LDA.b #$FF : STA.l FileMarker
+
LDA.w $010A : BNE + ; don't adjust the worlds for "continue" or "save-continue"
LDA.l $7EC011 : BNE + ; don't adjust worlds if mosiac is enabled (Read: mirroring in dungeon)
LDA.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)
JSL.l DoWorldFix
+
JSL.l MasterSwordFollowerClear
LDA.b #$FF : STA !RNG_ITEM_LOCK_IN ; reset rng item lock-in
LDA.b #$00 : STA $7F5001 ; mark fake flipper softlock as impossible
LDA.b #$FF : STA.l RNGLockIn ; reset rng item lock-in
LDA.l GenericKeys : BEQ +
LDA.l CurrentGenericKeys : STA.l CurrentSmallKeys ; copy generic keys to key counter
+
@@ -151,86 +141,78 @@ 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 $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
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
PLP : PLX
RTL
;--------------------------------------------------------------------------------
OnInitFileSelect:
; 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.
LDA.b #$51 : STA.w $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 RegisterWaterEntryScreen
JSL.l MysteryWaterFunction
LDX.b #$04
RTL
;OnEnterWater:
; JSL.l UnequipCapeQuiet ; what we wrote over
;RTL
;--------------------------------------------------------------------------------
OnLinkDamagedFromPit:
JSL.l OHKOTimer
LDA.l AllowAccidentalMajorGlitch
BEQ ++
-- LDA.b #$14 : STA $11 ; thing we wrote over
-- LDA.b #$14 : STA.b GameSubMode ; thing we wrote over
RTL
++ LDA.b $10 : CMP.b #$12 : BNE --
++ LDA.b GameMode : CMP.b #$12 : BNE --
STZ.b $11
STZ.b GameSubMode
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 !RNG_ITEM_LOCK_IN ; clear lock-in
LDA.b #$FF : STA.l RNGLockIn ; clear lock-in
PLP
RTL
;--------------------------------------------------------------------------------
!DARK_DUCK_TEMP = "$7F509C"
OnLoadDuckMap:
LDA !DARK_DUCK_TEMP
LDA.l DuckMapFlag
BNE +
INC : STA !DARK_DUCK_TEMP
JSL OverworldMap_InitGfx : DEC $0200
INC : STA.l DuckMapFlag
JSL OverworldMap_InitGfx : DEC.w SubModuleInterface
RTL
+
LDA.b #$00 : STA !DARK_DUCK_TEMP
LDA.b #$00 : STA.l DuckMapFlag
JML OverworldMap_DarkWorldTilemap
;--------------------------------------------------------------------------------
PreItemGet:
LDA.b #$01 : STA !ITEM_BUSY ; mark item as busy
LDA.b #$01 : STA.l BusyItem ; mark item as busy
RTL
;--------------------------------------------------------------------------------
PostItemGet:
@@ -238,19 +220,19 @@ PostItemGet:
RTL
;--------------------------------------------------------------------------------
PostItemAnimation:
LDA.b #$00 : STA !ITEM_BUSY ; mark item as finished
LDA.b #$00 : STA.l BusyItem ; mark item as finished
LDA $7F509F : BEQ +
STZ $1CF0 : STZ $1CF1 ; reset decompression buffer
LDA.l TextBoxDefer : BEQ +
STZ.w TextID : STZ.w TextID+1 ; reset decompression buffer
JSL.l Main_ShowTextMessage_Alt
LDA.b #$00 : STA $7F509F
LDA.b #$00 : STA.l TextBoxDefer
+
LDA.w $02E9 : CMP.b #$01 : BNE +
LDA.b $2F : BEQ +
LDA.w ItemReceiptMethod : CMP.b #$01 : BNE +
LDA.b LinkDirection : BEQ +
JSL.l IncrementChestTurnCounter
+
STZ $02E9 : LDA $0C5E, X ; thing we wrote over to get here
STZ.w ItemReceiptMethod : LDA.w AncillaGet, X ; thing we wrote over to get here
RTL
;--------------------------------------------------------------------------------

View File

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

View File

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

View File

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

View File

@@ -1,18 +1,17 @@
!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.
@@ -83,45 +82,89 @@ JMP DrawItemGray
DrawBottle:
AND.w #$00FF : BNE +
LDX #FileSelectItems_empty_bottle
LDX.w #FileSelectItems_empty_bottle
JMP DrawItemGray
+ : DEC #2 : BNE +
LDX #FileSelectItems_empty_bottle
LDX.w #FileSelectItems_empty_bottle
JMP DrawItem
+ : DEC : BNE +
LDX #FileSelectItems_red_potion
LDX.w #FileSelectItems_red_potion
JMP DrawItem
+ : DEC : BNE +
LDX #FileSelectItems_green_potion
LDX.w #FileSelectItems_green_potion
JMP DrawItem
+ : DEC : BNE +
LDX #FileSelectItems_blue_potion
LDX.w #FileSelectItems_blue_potion
JMP DrawItem
+ : DEC : BNE +
LDX #FileSelectItems_fairy_bottle
LDX.w #FileSelectItems_fairy_bottle
JMP DrawItem
+ : DEC : BNE +
LDX #FileSelectItems_bee_bottle
LDX.w #FileSelectItems_bee_bottle
JMP DrawItem
+
LDX #FileSelectItems_good_bee_bottle
LDX.w #FileSelectItems_good_bee_bottle
JMP DrawItem
DrawPlayerFile:
LDA $1A : AND.w #$0001 : BNE .normal
LDA.b FrameCounter : AND.w #$0001 : BNE .normal
JSR DrawPlayerFileShared
INC $0710 ; Suppress animated tile updates for this frame
INC.w SkipOAM ; 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 $1002
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
BRA .done
.normal
STZ $0710 ; ensure core animated tile updates are not suppressed
LDA #$FFFF : STA.w $1002 ; Suppress Stripe Image format upload on this frame
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
.done
LDA.w #$0004 : STA $02 ; thing we wrote over
LDA.w #$0004 : STA.b Scrap02 ; thing we wrote over
RTL
@@ -132,29 +175,29 @@ DrawPlayerFileShared:
LDA.b #FileSelectItems>>16 : PHA : PLB
REP #$20 ; restore 16 bit accumulator
LDA ExtendedFileNameSRAM+$08 : ORA.w #!FS_COLOR_BW
LDA.l ExtendedFileNameSRAM+$08 : ORA.w #!FS_COLOR_BW
%fs_draw8x16(6,5)
LDA ExtendedFileNameSRAM+$0A : ORA.w #!FS_COLOR_BW
LDA.l ExtendedFileNameSRAM+$0A : ORA.w #!FS_COLOR_BW
%fs_draw8x16(6,6)
LDA ExtendedFileNameSRAM+$0C : ORA.w #!FS_COLOR_BW
LDA.l ExtendedFileNameSRAM+$0C : ORA.w #!FS_COLOR_BW
%fs_draw8x16(6,7)
LDA ExtendedFileNameSRAM+$0E : ORA.w #!FS_COLOR_BW
LDA.l ExtendedFileNameSRAM+$0E : ORA.w #!FS_COLOR_BW
%fs_draw8x16(6,8)
LDA ExtendedFileNameSRAM+$10 : ORA.w #!FS_COLOR_BW
LDA.l ExtendedFileNameSRAM+$10 : ORA.w #!FS_COLOR_BW
%fs_draw8x16(9,5)
LDA ExtendedFileNameSRAM+$12 : ORA.w #!FS_COLOR_BW
LDA.l ExtendedFileNameSRAM+$12 : ORA.w #!FS_COLOR_BW
%fs_draw8x16(9,6)
LDA ExtendedFileNameSRAM+$14 : ORA.w #!FS_COLOR_BW
LDA.l ExtendedFileNameSRAM+$14 : ORA.w #!FS_COLOR_BW
%fs_draw8x16(9,7)
LDA ExtendedFileNameSRAM+$16 : ORA.w #!FS_COLOR_BW
LDA.l ExtendedFileNameSRAM+$16 : ORA.w #!FS_COLOR_BW
%fs_draw8x16(9,8)
JSR FileSelectDrawHudBar
; Bow
LDA.l BowTrackingSRAM : AND.w #$0040 : BEQ +
LDA EquipmentSRAM+$00 : AND.w #$00FF : BEQ ++
LDA.l EquipmentSRAM+$00 : AND.w #$00FF : BEQ ++
%fs_drawItem(3,12,FileSelectItems_silver_bow)
BRA .bow_end
++
@@ -199,7 +242,7 @@ DrawPlayerFileShared:
++
; Mushroom
LDA.l InventoryTrackingSRAM : AND.w #$0008 : BEQ +
LDA.l InventoryTrackingSRAM : AND.w #$0028 : BEQ +
%fs_drawItem(3,18,FileSelectItems_mushroom)
BRA ++
+
@@ -268,15 +311,16 @@ DrawPlayerFileShared:
%fs_drawBottle(EquipmentSRAM+$1F,9,23)
; Sword
LDA.l SpecialWeapons : AND.w #$00FF : CMP #$0001 : BEQ .bombSword
LDA.l EquipmentSRAM+$19 : AND.w #$00FF : BNE +
%fs_drawItemGray(3,26,FileSelectItems_fighters_sword)
BRA ++
JMP ++
+ : DEC : BNE +
%fs_drawItem(3,26,FileSelectItems_fighters_sword)
BRA ++
JMP ++
+ : DEC : BNE +
%fs_drawItem(3,26,FileSelectItems_master_sword)
BRA ++
JMP ++
+ : DEC : BNE +
%fs_drawItem(3,26,FileSelectItems_tempered_sword)
BRA ++
@@ -286,6 +330,29 @@ DrawPlayerFileShared:
+
; a sword value above 4 is either corrupted or 0xFF (a.k.a. swordless)
%fs_drawItemGray(3,26,FileSelectItems_fighters_sword)
BRA ++
.bombSword
LDA.l $70038F : AND.w #$00FF : BNE +
%fs_drawItemGray(3,26,FileSelectItems_fighters_bombs)
BRA ++
+ : DEC : BNE +
%fs_drawItem(3,26,FileSelectItems_fighters_bombs)
BRA ++
+ : DEC : BNE +
%fs_drawItem(3,26,FileSelectItems_master_bombs)
BRA ++
+ : DEC : BNE +
%fs_drawItem(3,26,FileSelectItems_tempered_bombs)
BRA ++
+ : DEC : BNE +
%fs_drawItem(3,26,FileSelectItems_gold_bombs)
BRA ++
+ : DEC : BNE +
%fs_drawItem(3,26,FileSelectItems_extra_gold_bombs)
BRA ++
+
; a bomb value above 5 is... who knows, let's just pretend it's 5
%fs_drawItem(3,26,FileSelectItems_extra_gold_bombs)
++
; Shield
@@ -327,10 +394,10 @@ DrawPlayerFileShared:
%fs_drawItem(9,26,FileSelectItems_heart_piece_3_of_4)
++
LDA EquipmentSRAM+$0108 : AND.w #$00FF
LDA.l EquipmentSRAM+$0108 : AND.w #$00FF
JSL.l HexToDec
LDA $7F5006 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(11,26)
LDA $7F5007 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(11,27)
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)
; Boots
%fs_drawItemBasic(EquipmentSRAM+$15,3,28,FileSelectItems_boots)
@@ -353,21 +420,21 @@ DrawPlayerFileShared:
%fs_drawItemBasic(EquipmentSRAM+$17,9,28,FileSelectItems_pearl)
; Pendants
LDA EquipmentSRAM+$34 : AND.w #$0004 : BEQ +
LDA.l EquipmentSRAM+$34 : AND.w #$0004 : BEQ +
%fs_drawItem(12,12,FileSelectItems_green_pendant)
BRA ++
+
%fs_drawItem(12,12,FileSelectItems_no_pendant)
++
LDA EquipmentSRAM+$34 : AND.w #$0002 : BEQ +
LDA.l EquipmentSRAM+$34 : AND.w #$0002 : BEQ +
%fs_drawItem(12,14,FileSelectItems_blue_pendant)
BRA ++
+
%fs_drawItem(12,14,FileSelectItems_no_pendant)
++
LDA EquipmentSRAM+$34 : AND.w #$0001 : BEQ +
LDA.l EquipmentSRAM+$34 : AND.w #$0001 : BEQ +
%fs_drawItem(12,16,FileSelectItems_red_pendant)
BRA ++
+
@@ -375,49 +442,49 @@ DrawPlayerFileShared:
++
; Crystals
LDA EquipmentSRAM+$3A : AND.w #$0002 : BEQ +
LDA.l EquipmentSRAM+$3A : AND.w #$0002 : BEQ +
LDA.w #$0297|!FS_COLOR_BLUE
BRA ++
+
LDA.w #$0287|!FS_COLOR_GRAY
++ : %fs_draw16x8(13,18)
LDA EquipmentSRAM+$3A : AND.w #$0010 : BEQ +
LDA.l EquipmentSRAM+$3A : AND.w #$0010 : BEQ +
LDA.w #$0297|!FS_COLOR_BLUE
BRA ++
+
LDA.w #$0287|!FS_COLOR_GRAY
++ : %fs_draw16x8(12,19)
LDA EquipmentSRAM+$3A : AND.w #$0040 : BEQ +
LDA.l EquipmentSRAM+$3A : AND.w #$0040 : BEQ +
LDA.w #$0297|!FS_COLOR_BLUE
BRA ++
+
LDA.w #$0287|!FS_COLOR_GRAY
++ : %fs_draw16x8(13,20)
LDA EquipmentSRAM+$3A : AND.w #$0020 : BEQ +
LDA.l EquipmentSRAM+$3A : AND.w #$0020 : BEQ +
LDA.w #$0297|!FS_COLOR_BLUE
BRA ++
+
LDA.w #$0287|!FS_COLOR_GRAY
++ : %fs_draw16x8(12,21)
LDA EquipmentSRAM+$3A : AND.w #$0004 : BEQ +
LDA.l EquipmentSRAM+$3A : AND.w #$0004 : BEQ +
LDA.w #$0297|!FS_COLOR_RED
BRA ++
+
LDA.w #$0287|!FS_COLOR_GRAY
++ : %fs_draw16x8(13,22)
LDA EquipmentSRAM+$3A : AND.w #$0001 : BEQ +
LDA.l EquipmentSRAM+$3A : AND.w #$0001 : BEQ +
LDA.w #$0297|!FS_COLOR_RED
BRA ++
+
LDA.w #$0287|!FS_COLOR_GRAY
++ : %fs_draw16x8(12,23)
LDA EquipmentSRAM+$3A : AND.w #$0008 : BEQ +
LDA.l EquipmentSRAM+$3A : AND.w #$0008 : BEQ +
LDA.w #$0297|!FS_COLOR_BLUE
BRA ++
+
@@ -556,106 +623,135 @@ FileSelectItems:
.good_bee_bottle
dw #$0240|!FS_COLOR_BW, #$0241|!FS_COLOR_BW, #$0254|!FS_COLOR_YELLOW, #$0246|!FS_COLOR_YELLOW
.fighters_bombs
dw #$020C|!FS_COLOR_GREEN, #$020D|!FS_COLOR_GREEN, #$021C|!FS_COLOR_GREEN, #$02A1|!FS_COLOR_GREEN
.master_bombs
dw #$020C|!FS_COLOR_BLUE, #$020D|!FS_COLOR_BLUE, #$021C|!FS_COLOR_BLUE, #$02A2|!FS_COLOR_BLUE
.tempered_bombs
dw #$020C|!FS_COLOR_RED, #$020D|!FS_COLOR_RED, #$021C|!FS_COLOR_RED, #$02A3|!FS_COLOR_RED
.gold_bombs
dw #$020C|!FS_COLOR_YELLOW, #$020D|!FS_COLOR_YELLOW, #$021C|!FS_COLOR_YELLOW, #$02A4|!FS_COLOR_YELLOW
.extra_gold_bombs
dw #$020C|!FS_COLOR_YELLOW, #$020D|!FS_COLOR_YELLOW, #$021C|!FS_COLOR_YELLOW, #$02A5|!FS_COLOR_YELLOW
;--------------------------------------------------------------------------------
FileSelectDrawHudBar:
LDA #$029B|!FS_COLOR_GREEN : %fs_draw16x8(0,10)
LDA EquipmentSRAM+$22
LDA.w #$029B|!FS_COLOR_GREEN : %fs_draw16x8(0,10)
LDA.l DisplayRupeesSRAM
JSL.l HexToDec
LDA $7F5004 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(1,9)
LDA $7F5005 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(1,10)
LDA $7F5006 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(1,11)
LDA $7F5007 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(1,12)
LDA.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 #$028B|!FS_COLOR_BLUE : %fs_draw16x8(0,14)
LDA EquipmentSRAM+$03 : AND.w #$00FF
LDA.l SpecialWeapons : AND.w #$00FF : CMP #$0001 : BEQ .colorBombs
LDA.w #$028B|!FS_COLOR_BLUE : %fs_draw16x8(0,14)
LDA.l BombsEquipmentSRAM : AND.w #$00FF
JSL.l HexToDec
LDA $7F5006 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(1,14)
LDA $7F5007 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(1,15)
LDA.l HexToDecDigit4 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(1,14)
LDA.l HexToDecDigit5 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(1,15)
BRA ++
.colorBombs
LDA.l $70038F : AND.w #$00FF : BNE +
; no bombs, draw no icon
BRA ++
+ : DEC : BNE +
LDA.w #$028B|!FS_COLOR_GREEN : %fs_draw16x8(0,14)
BRA ++
+ : DEC : BNE +
LDA.w #$028B|!FS_COLOR_BLUE : %fs_draw16x8(0,14)
BRA ++
+ : DEC : BNE +
LDA.w #$028B|!FS_COLOR_RED : %fs_draw16x8(0,14)
BRA ++
+
LDA.w #$028B|!FS_COLOR_YELLOW : %fs_draw16x8(0,14)
++
LDA.l BowTrackingSRAM : AND.w #$0040 : BEQ +
LDA #$0299|!FS_COLOR_RED : %fs_draw16x8(0,17)
LDA.w #$0299|!FS_COLOR_RED : %fs_draw16x8(0,17)
BRA ++
+
LDA #$0289|!FS_COLOR_BROWN : %fs_draw16x8(0,17)
LDA.w #$0289|!FS_COLOR_BROWN : %fs_draw16x8(0,17)
++
LDA EquipmentSRAM+$37 : AND.w #$00FF
LDA.l CurrentArrowsSRAM : AND.w #$00FF
JSL.l HexToDec
LDA $7F5006 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(1,17)
LDA $7F5007 : AND.w #$00FF : !ADD.w #$210+!FS_COLOR_BW : %fs_draw8x8(1,18)
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)
RTS
;--------------------------------------------------------------------------------
AltBufferTable:
LDA.b #$02 : STA $210c ; Have Screen 3 use same tile area as screens 1
LDA.b #$02 : STA.w BG34NBA ; 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 $1000, X
STA.w GFXStripes, X
DEX : DEX : BNE -
; set vram offsets
LDA.w #$0161 : STA $1002 ;file 1 top row
LDA.w #$2161 : STA $1042 ;file 1 bottom row
LDA.w #$0161 : STA.w GFXStripes+$02 ;file 1 top row
LDA.w #$2161 : STA.w GFXStripes+$42 ;file 1 bottom row
LDA.w #$4161 : STA $1082 ;gap row top
LDA.w #$6161 : STA $10C2 ;gap row bottom
LDA.w #$4161 : STA.w GFXStripes+$82 ;gap row top
LDA.w #$6161 : STA.w GFXStripes+$C2 ;gap row bottom
LDA.w #$8161 : STA $1102 ;file 2 top row
LDA.w #$A161 : STA $1142 ;file 2 bottom row
LDA.w #$8161 : STA.w GFXStripes+$0102 ;file 2 top row
LDA.w #$A161 : STA.w GFXStripes+$0142 ;file 2 bottom row
LDA.w #$C161 : STA $1182 ;gap row top
LDA.w #$E161 : STA $11c2 ;gap row bottom
LDA.w #$C161 : STA.w GFXStripes+$0182 ;gap row top
LDA.w #$E161 : STA.w GFXStripes+$01C2 ;gap row bottom
LDA.w #$0162 : STA $1202 ;file 3 top row
LDA.w #$2162 : STA $1242 ;file 3 bottom row
LDA.w #$0162 : STA.w GFXStripes+$0202 ;file 3 top row
LDA.w #$2162 : STA.w GFXStripes+$0242 ;file 3 bottom row
LDA.w #$4162 : STA $1282 ;extra gap row top
LDA.w #$6162 : STA $12c2 ;extra gap row bottom
LDA.w #$4162 : STA.w GFXStripes+$0282 ;extra gap row top
LDA.w #$6162 : STA.w GFXStripes+$02C2 ;extra gap row bottom
LDA.w #$8162 : STA $1302 ;extra gap row top
LDA.w #$A162 : STA $1342 ;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 #$C162 : STA $1382 ;extra gap row top
LDA.w #$E162 : STA $13C2 ;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
; set lengths
LDA.w #$3B00
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
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
; Set last packet marker
LDA.w #$00FF : STA $1402
LDA.w #$00FF : STA.w GFXStripes+$0402
; Draw Unlock option if applicable
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
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
RTL
;--------------------------------------------------------------------------------
@@ -663,36 +759,36 @@ AltBufferTable_credits:
JSL AltBufferTable_noScreen3Change
REP #$20
LDA.w #$6168 : STA $1002 ;file 1 top row
LDA.w #$8168 : STA $1042 ;file 1 bottom row
LDA.w #$6168 : STA.w GFXStripes+$02 ;file 1 top row
LDA.w #$8168 : STA.w GFXStripes+$42 ;file 1 bottom row
LDA.w #$A168 : STA $1082 ;gap row top
LDA.w #$C168 : STA $10C2 ;gap row bottom
LDA.w #$A168 : STA.w GFXStripes+$82 ;gap row top
LDA.w #$C168 : STA.w GFXStripes+$C2 ;gap row bottom
LDA.w #$E168 : STA $1102 ;file 2 top row
LDA.w #$0169 : STA $1142 ;file 2 bottom row
LDA.w #$E168 : STA.w GFXStripes+$0102 ;file 2 top row
LDA.w #$0169 : STA.w GFXStripes+$0142 ;file 2 bottom row
LDA.w #$2169 : STA $1182 ;gap row top
LDA.w #$4169 : STA $11c2 ;gap row bottom
LDA.w #$2169 : STA.w GFXStripes+$0182 ;gap row top
LDA.w #$4169 : STA.w GFXStripes+$01c2 ;gap row bottom
LDA.w #$6169 : STA $1202 ;file 3 top row
LDA.w #$8169 : STA $1242 ;file 3 bottom row
LDA.w #$6169 : STA.w GFXStripes+$0202 ;file 3 top row
LDA.w #$8169 : STA.w GFXStripes+$0242 ;file 3 bottom row
LDA.w #$A169 : STA $1282 ;extra gap row top
LDA.w #$C169 : STA $12c2 ;extra gap row bottom
LDA.w #$A169 : STA.w GFXStripes+$0282 ;extra gap row top
LDA.w #$C169 : STA.w GFXStripes+$02C2 ;extra gap row bottom
LDA.w #$E169 : STA $1302 ;extra gap row top
LDA.w #$016A : STA $1342 ;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 #$216A : STA $1382 ;extra gap row top
LDA.w #$416A : STA $13C2 ;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
SEP #$20
RTL
;--------------------------------------------------------------------------------
macro LayoutPriority(address)
LDX.w #$003C
- : LDA.w <address>, X : ORA #$2000 : STA.w <address>, X
- : LDA.w <address>, X : ORA.w #$2000 : STA.w <address>, X
DEX : DEX : BNE -
endmacro
@@ -718,47 +814,47 @@ RTL
;--------------------------------------------------------------------------------
LoadFullItemTiles:
PHA : PHX
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.w DMAP0 : PHA ; preserve DMA parameters
LDA.w BBAD0 : PHA ; preserve DMA parameters
LDA.w A1T0L : PHA ; preserve DMA parameters
LDA.w A1T0H : PHA ; preserve DMA parameters
LDA.w A1B0 : PHA ; preserve DMA parameters
LDA.w DAS0L : PHA ; preserve DMA parameters
LDA.w DAS0H : PHA ; preserve DMA parameters
;--------------------------------------------------------------------------------
LDA.b #$80 : STA $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 #$80 : STA.w VMAIN ; write read increment on $2119
LDA.b #$01 : STA.w DMAP0 ; set DMA transfer direction A -> B, bus A auto increment, double-byte mode
LDA.b #$18 : STA.w BBAD0 ; set bus B destination to VRAM register
LDA.b #$00 : STA $2116 ; write VRAM destination address
LDA.b #$30 : STA $2117 ; write VRAM destination address
LDA.b #$00 : STA.w VMADDL ; write VRAM destination address
LDA.b #$30 : STA.w VMADDH ; write VRAM destination address
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.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 $2100 : PHA : LDA.b #$80 : STA $2100 ; save screen state & turn screen off
LDA.w INIDISP : PHA : LDA.b #$80 : STA.w INIDISP ; save screen state & turn screen off
STZ $4305 : LDA.b #$10 : STA $4306 ; set transfer size to 0x1000
LDA #$01 : STA $420B ; begin DMA transfer
STZ.w DAS0L : LDA.b #$10 : STA.w DAS0H ; set transfer size to 0x1000
LDA.b #$01 : STA.w MDMAEN ; begin DMA transfer
PLA : STA $2100 ; put screen back however it was before
PLA : STA.w INIDISP ; put screen back however it was before
;--------------------------------------------------------------------------------
PLA : STA $4306 ; restore DMA parameters
PLA : STA $4305 ; restore DMA parameters
PLA : STA $4304 ; restore DMA parameters
PLA : STA $4303 ; restore DMA parameters
PLA : STA $4302 ; restore DMA parameters
PLA : STA $4301 ; restore DMA parameters
PLA : STA $4300 ; restore DMA parameters
PLA : STA.w DAS0H ; restore DMA parameters
PLA : STA.w DAS0L ; restore DMA parameters
PLA : STA.w A1B0 ; restore DMA parameters
PLA : STA.w A1T0H ; restore DMA parameters
PLA : STA.w A1T0L ; restore DMA parameters
PLA : STA.w BBAD0 ; restore DMA parameters
PLA : STA.w DMAP0 ; restore DMA parameters
PLX : PLA
RTL
;--------------------------------------------------------------------------------
SetFileSelectPalette:
LDA $10 : CMP.b #$04 : BNE +
LDA.b GameMode : CMP.b #$04 : BNE +
; load the vanilla file select screen BG3 palette for naming screen
LDA.b #$01 : STA $0AB2
LDA.b #$01 : STA.w $0AB2
JSL.l Palette_Hud
BRA .done
+
@@ -774,12 +870,12 @@ LoadCustomHudPalette:
LDX.b #$40
-
LDA.l GFX_HUD_Palette, X
STA.l $7EC500, X
STA.l PaletteBuffer, X
DEX : DEX
BPL -
SEP #$20
INC $15 ; ensure CGRAM gets updated
INC.b NMICGRAM ; ensure CGRAM gets updated
PLX : PLA
RTL
;--------------------------------------------------------------------------------
@@ -787,16 +883,16 @@ DrawPlayerFile_credits:
; see $6563C for drawing first file name and hearts
REP #$20 ; set 16 bit accumulator
LDA EquipmentSRAM+$99 : ORA.w #!FS_COLOR_BW
LDA.l EquipmentSRAM+$99 : ORA.w #!FS_COLOR_BW
%fs_draw8x16(3,5)
LDA EquipmentSRAM+$9B : ORA.w #!FS_COLOR_BW
LDA.l EquipmentSRAM+$9B : ORA.w #!FS_COLOR_BW
%fs_draw8x16(3,6)
LDA EquipmentSRAM+$9D : ORA.w #!FS_COLOR_BW
LDA.l EquipmentSRAM+$9D : ORA.w #!FS_COLOR_BW
%fs_draw8x16(3,7)
LDA EquipmentSRAM+$9F : ORA.w #!FS_COLOR_BW
LDA.l EquipmentSRAM+$9F : ORA.w #!FS_COLOR_BW
%fs_draw8x16(3,8)
LDA EquipmentSRAM+$2C : AND.w #$00FF : LSR #3 : STA $02
LDA.l EquipmentSRAM+$2C : AND.w #$00FF : LSR #3 : STA.b Scrap02
%fs_LDY_screenpos(0,20)
LDA.w #$028F|!FS_COLOR_RED
LDX.w #$000A
@@ -810,60 +906,61 @@ DrawPlayerFile_credits:
TYA : !ADD.w #$40-$14 : TAY
PLA
+
DEC $02 : BNE .nextHeart
DEC.b Scrap02 : BNE .nextHeart
JSR DrawPlayerFileShared
RTL
;--------------------------------------------------------------------------------
FSCursorUp:
LDA $C8 : BNE +
LDA #$04 ; up from file becomes delete
LDA.b FileSelectPosition : BNE +
LDA.b #$04 ; up from file becomes delete
BRA .done
+ : CMP #$03 : BNE +
LDA #$00 ; up from unlock is the file
+ : CMP.b #$03 : BNE +
LDA.b #$00 ; up from unlock is the file
BRA .done
+
LDA.l IsEncrypted : CMP.b #$02 : BNE +
LDA.l !ValidKeyLoaded : BNE +
LDA #$03 ; up from delete is unlock for password protected seeds
LDA.l ValidKeyLoaded : BNE +
LDA.b #$03 ; up from delete is unlock for password protected seeds
BRA .done
+
LDA #$00 ;otherwise up from delete is file
LDA.b #$00 ;otherwise up from delete is file
.done
STA $C8
STA.b FileSelectPosition
RTL
FSCursorDown:
LDA $C8 : BNE +
LDA.b FileSelectPosition : BNE +
LDA.l IsEncrypted : CMP.b #$02 : BNE ++
LDA.l !ValidKeyLoaded : BNE ++
LDA #$03 ; down from file is unlock for password protected seeds
LDA.l ValidKeyLoaded : BNE ++
LDA.b #$03 ; down from file is unlock for password protected seeds
BRA .done
++
LDA #$04 ;otherwise down from file is delete
LDA.b #$04 ;otherwise down from file is delete
BRA .done
+ : CMP #$03 : BNE +
LDA #$04 ; down from unlock is delete
+ : CMP.b #$03 : BNE +
LDA.b #$04 ; down from unlock is delete
BRA .done
+
LDA #$00 ; down from delete is file
LDA.b #$00 ; down from delete is file
.done
STA $C8
STA.b FileSelectPosition
RTL
;--------------------------------------------------------------------------------
FSSelectFile:
LDA.l IsEncrypted : CMP.b #$02 : BNE .normal
STZ $012E ; temporarily cancel file screen selection sound
STZ.w SFX2 ; temporarily cancel file screen selection sound
PHX : PHY
JSL ValidatePassword : BEQ .must_unlock
PLY : PLX
LDA.b #$2C : STA $012E ;file screen selection sound
LDA.b #$2C : STA.w SFX2 ;file screen selection sound
.normal
LDA.b #$F1 : STA $012C
LDA.b #$F1 : STA.w MusicControlRequest
JML FSSelectFile_continue
.must_unlock
PLY : PLX
LDA #$03 : STA $C8 ;set cursor to unlock
LDA.b #$3C : STA $012E ; play error sound
LDA.b #$03 : STA.b FileSelectPosition ;set cursor to unlock
LDA.b #$3C : STA.w SFX2 ; play error sound
JML FSSelectFile_return
;--------------------------------------------------------------------------------
MaybeForceFileName:
@@ -873,8 +970,8 @@ MaybeForceFileName:
-
INX : INX
LDA.l StaticFileName, X : STA.l ExtendedFileNameSRAM, X
CPX #$16 : BEQ .done
CPX #$08 : BCS -
CPX.b #$16 : BEQ .done
CPX.b #$08 : BCS -
STA.l FileNameVanillaSRAM, X
BRA -
.done

View File

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

View File

@@ -1,78 +1,14 @@
;================================================================================
; Fake Flippers Softlock Fix
;--------------------------------------------------------------------------------
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
; Written over and used by OnEnterWater hook.
UnequipCapeQuiet:
LDA.b #$20 : STA.w PoofTimer
STZ.w NoDamage
STZ.b CapeOn
STZ.w LinkZap
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
@@ -83,16 +19,16 @@ protectff:
.yes_protect
REP #$30
LDA.b $20
LDA.b LinkPosY
AND.w #$1E00
ASL
ASL
ASL
STA.b $06
STA.b Scrap06
LDA.b $22
LDA.b LinkPosX
AND.w #$1E00
ORA.b $06
ORA.b Scrap06
XBA
LSR
@@ -103,7 +39,7 @@ protectff:
; Remove dark world bit
; in game table that converts coordinates to actual screen ID
; special case for other areas
LDA.b $8A
LDA.b OverworldIndex
BMI .special_overworld
AND.b #$3F
@@ -112,17 +48,17 @@ protectff:
.protect
LDA.b #$15
STA.b $5D
STA.b LinkState
STZ.b $2E
STZ.b $67
STZ.b LinkAnimationStep
STZ.b LinkWalkDirection
LDA.b #$02
STA.b $2F
STA.b LinkDirection
STZ.w $0112
STZ.w $02E4
STZ.w $0FFC
STZ.w MedallionFlag
STZ.w CutsceneFlag
STZ.w NoMenu
++ RTL

View File

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

View File

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

View File

@@ -2,58 +2,40 @@
; Frame Hook
;--------------------------------------------------------------------------------
FrameHookAction:
JSL $0080B5 ; Module_MainRouting
JSL CheckMusicLoadRequest
PHP : REP #$30 : PHA
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
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
;--------------------------------------------------------------------------------
NMIHookAction:
PHA : PHX : PHY : PHD ; thing we wrote over, push stuff
LDA StatsLocked : AND.w #$00FF : BNE ++
LDA NMIFrames : INC : STA NMIFrames : BNE +
LDA NMIFrames+2 : INC : STA NMIFrames+2
+
++
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
+
JML.l NMIHookReturn
;--------------------------------------------------------------------------------
!NMI_AUX = "$7F5044"
PostNMIHookAction:
LDA !NMI_AUX : BEQ +
LDA $00 : PHA ; preserve DP ram
LDA $01 : PHA
LDA $02 : PHA
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
LDA !NMI_AUX+2 : STA $02 ; set up jump pointer
LDA !NMI_AUX+1 : STA $01
LDA !NMI_AUX+0 : STA $00
PHK : PER .return-1 ; push stack for RTL return
JMP [$0000]
.return
LDA.b #$00 : STA !NMI_AUX ; zero bank byte of NMI hook pointer
PLA : STA $02
PLA : STA $01
PLA : STA $00
+
LDA $13 : STA $2100 ; thing we wrote over, turn screen back on
JML.l PostNMIHookReturn
;--------------------------------------------------------------------------------

View File

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

74
generate_bomb_table.rb Normal file
View File

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

View File

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

View File

@@ -2,7 +2,7 @@
; Glitched Mode Fixes
;================================================================================
GetAgahnimPalette:
LDA $A0 ; get room id
LDA.b RoomIndex ; 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 $0BA0, X ; thing we wrote over
LDA $A0 ; get room id
STA.w $0BA0, X ; thing we wrote over
LDA.b RoomIndex ; get room id
CMP.b #13 : BNE + ; Agahnim 2 room
LDA.l Bugfix_SetWorldOnAgahnimDeath : BEQ ++
LDA.l InvertedMode : BEQ +++
LDA.b #$00 : STA CurrentWorld ; Switch to light world
LDA.b #$00 : STA.l CurrentWorld ; Switch to light world
BRA ++
+++
LDA.b #$40 : STA CurrentWorld ; Switch to dark world
LDA.b #$40 : STA.l CurrentWorld ; Switch to dark world
++
LDA.b #$01 ; Use Agahnim 2
RTL
+ ; Elsewhere
LDA.l Bugfix_SetWorldOnAgahnimDeath : BEQ ++
LDA.l InvertedMode : BEQ +++
LDA.b #$40 : STA CurrentWorld ; Switch to dark world
LDA.b #$40 : STA.l CurrentWorld ; Switch to dark world
BRA ++
+++
LDA.b #$00 : STA CurrentWorld ; Switch to light world
LDA.b #$00 : STA.l CurrentWorld ; Switch to light world
; (This will later get flipped to DW when Agahnim 1
; warps us to the pyramid)
++
@@ -37,7 +37,7 @@ GetAgahnimDeath:
RTL
;--------------------------------------------------------------------------------
GetAgahnimType:
LDA $A0 ; get room id
LDA.b RoomIndex ; 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 $A0 ; get room id
LDA.b RoomIndex ; 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 $0E30, X ; thing we wrote over
LDA $A0 ; get room id
INC.w SpriteAux, X ; thing we wrote over
LDA.b RoomIndex ; 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 PermitSQFromBosses : BEQ .fullCheck
LDA $0403 : AND.b #$80 : BEQ .fullCheck
LDA $0112 : ORA $02E4 ; we have heart container, do short check
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
RTL
.fullCheck
LDA $0112 : ORA $02E4 : ORA $0FFC
LDA.w MedallionFlag : ORA.w CutsceneFlag : ORA.w NoMenu
RTL
;--------------------------------------------------------------------------------

View File

@@ -1,21 +1,17 @@
;--------------------------------------------------------------------------------
; $7F5010 - Scratch Space (Callee Preserved)
;--------------------------------------------------------------------------------
!GOAL_DRAW_ADDRESS = "$7EC72A"
;--------------------------------------------------------------------------------
; DrawGoalIndicator moved to newhud.asm
;--------------------------------------------------------------------------------
GoalItemGanonCheck:
LDA $0E20, X : CMP.b #$D6 : BNE .success ; skip if not ganon
LDA.w SpriteTypeTable, X : CMP.b #$D6 : BNE .success ; skip if not ganon
LDA.w $0D80, X : CMP.b #$12 : BEQ .fail
JSL.l CheckGanonVulnerability
BCS .success
BCC .fail
JSL.l CheckMushroom
BCC .success
.fail
LDA $0D80, X : CMP.b #17 : !BLT .success ; decmial 17 because Acmlm's chart is decimal
LDA.w SpriteActivity, X : CMP.b #17 : !BLT .success ; decmial 17 because Acmlm's chart is decimal
LDA.b #$00
RTL
.success
LDA $44 : CMP.b #$80 ; thing we wrote over
LDA.b OAMOffsetY : CMP.b #$80 ; thing we wrote over
RTL
;--------------------------------------------------------------------------------
;Carry clear = ganon invincible
@@ -125,12 +121,12 @@ GetRequiredCrystalsInX:
RTL
;--------------------------------------------------------------------------------
CheckEnoughCrystalsForGanon:
LDA CrystalCounter
LDA.l CrystalCounter
CMP.l NumberOfCrystalsRequiredForGanon
RTL
;--------------------------------------------------------------------------------
CheckEnoughCrystalsForTower:
LDA CrystalCounter
LDA.l CrystalCounter
CMP.l NumberOfCrystalsRequiredForTower
RTL
@@ -145,13 +141,13 @@ CheckAgaForPed:
BEQ .force_blue_ball
.vanilla ; run vanilla check for phase
LDA.w $0E30, X
LDA.w SpriteAux, X
CMP.b #$02
RTL
.force_blue_ball
LDA.b #$01 : STA.w $0DA0, Y
LDA.b #$20 : STA.w $0DF0, Y
LDA.b #$01 : STA.w SpriteAuxTable, Y
LDA.b #$20 : STA.w SpriteTimer, Y
CLC ; skip the RNG check
RTL
@@ -182,7 +178,7 @@ CheckForCrystalBossesDefeated:
REP #$30
; count of number of bosses killed
STZ.b $00
STZ.b Scrap00
LDY.w #10
@@ -202,7 +198,7 @@ CheckForCrystalBossesDefeated:
AND.w #$0800
BEQ ++
INC.b $00
INC.b Scrap00
++ DEY
BPL .next_check
@@ -210,7 +206,7 @@ CheckForCrystalBossesDefeated:
SEP #$30
PLY : PLX : PLB
LDA.b $00 : CMP.l NumberOfCrystalsRequiredForGanon
LDA.b Scrap00 : CMP.l NumberOfCrystalsRequiredForGanon
RTS

View File

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

View File

@@ -3,22 +3,22 @@
;================================================================================
CalculateSpikeFloorDamage:
REP #$20 ; set 16-bit accumulator
LDA $A0 ; these are all decimal because i got them that way
LDA.b RoomIndex ; these are all decimal because i got them that way
CMP.w #279
SEP #$20 ; set 8-bit accumulator
BNE +
LDA.l ByrnaCaveSpikeDamage
STA $0373
STA.w DamageReceived
RTL
+
LDA $D055, Y
STA $0373
LDA.w $D055, Y
STA.w DamageReceived
RTL
;--------------------------------------------------------------------------------
CalculateByrnaUsage:
LDA $1B : BEQ ++
LDA.b IndoorsFlag : BEQ ++
REP #$20 ; set 16-bit accumulator
LDA $A0 ; these are all decimal because i got them that way
LDA.b RoomIndex ; these are all decimal because i got them that way
CMP.w #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 $00
LDA.l HardModeExclusionCaneOfByrnaUsage, X : STA.b Scrap00
PLX
++
LDA CurrentMagic ; thing we wrote over
LDA.l CurrentMagic ; thing we wrote over
JML IncrementMagicUseCounterByrna
;--------------------------------------------------------------------------------
CalculateCapeUsage:
LDA $1B : BEQ ++
LDA.b IndoorsFlag : BEQ ++
REP #$20 ; set 16-bit accumulator
LDA $A0 ; these are all decimal because i got them that way
LDA.b RoomIndex ; these are all decimal because i got them that way
CMP.w #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 $4C ; set cape decrement timer
LDA.l HardModeExclusionCapeUsage, X : STA.b CapeTimer ; set cape decrement timer
PLX
++
JML IncrementMagicUseCounterOne
;--------------------------------------------------------------------------------
ActivateInvulnerabilityOrDont:
LDA $1B : BEQ .nowhere_special
LDA.b IndoorsFlag : BEQ .nowhere_special
REP #$20 ; set 16-bit accumulator
LDA $A0 ; these are all decimal because i got them that way
LDA.b RoomIndex ; these are all decimal because i got them that way
CMP.w #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 $037B : RTL
LDA.b #$01 : STA.w NoDamage : RTL
.nowhere_special
LDA.l ByrnaInvulnerability : STA $037B
LDA.l ByrnaInvulnerability : STA.w NoDamage
RTL
;--------------------------------------------------------------------------------
GetItemDamageValue:
@@ -76,18 +76,24 @@ GetItemDamageValue:
CPX.b #$04 : BEQ .boomerang
CPX.b #$05 : BEQ .boomerang
CPX.b #$39 : BEQ .hookshot
CPX.b #$3b : BEQ .hookshot
CPX.b #$3c : BEQ .hookshot
CPX.b #$3d : BEQ .hookshot
CPX.b #$3B : BEQ .hookshot
CPX.b #$3C : BEQ .hookshot
CPX.b #$3D : BEQ .hookshot
LDA.l SpecialWeapons : CMP #$02 : BNE .normal
TXA : AND #$78 : CMP #$28 : BNE .normal
LDA $0DB8F1, X : BEQ .noDamage
LDA #$01
RTL
.normal
lda $0db8f1,x ;what we wrote over
LDA.l $0DB8F1, X ; what we wrote over
RTL
.boomerang
LDA.l StunItemAction : AND #$01 : BNE .normal
LDA.l StunItemAction : AND.b #$01 : BNE .normal
BRA .noDamage
.hookshot
LDA.l StunItemAction : AND #$02 : BNE .normal
LDA.l StunItemAction : AND.b #$02 : BNE .normal
.noDamage
LDA.b #$00
RTL
@@ -95,17 +101,17 @@ RTL
;Argument : A = id we want to find return 00 if none found, 01 if found
SearchAncilla:
{
STA $05
STA.b Scrap05
PHX
LDX #$00
LDX.b #$00
.loop
LDA $0C4A, X
LDA.w AncillaID, X
INX : CPX #$0A : BEQ .notFound
CMP $05 : BNE .loop
LDA #$01
CMP.b Scrap05 : BNE .loop
LDA.b #$01
BRA .return
.notFound
LDA #$00
LDA.b #$00
.return
PLX
RTS

View File

@@ -1,41 +1,39 @@
;--------------------------------------------------------------------------------
;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
@@ -45,9 +43,9 @@ LoadAlphabetTilemap:
LDX.b #$00 : -
LDA.w FileSelect_PlayerSelectText_Top, X
STA !BIGRAM, X
STA.l BigRAM, X
INX #2
CPX #128 : !BLT -
CPX.b #128 : !BLT -
LDY.b #00
LDX.b #$00 : -
@@ -55,12 +53,12 @@ LoadAlphabetTilemap:
AND.w #$001F ; mask to alphabet of 32
ASL #3 : PHY : TAY
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
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
PLY : INX #6 : INY
CPX #25 : !BLT -
CPX.b #25 : !BLT -
SEP #$20 ; 8-bit accumulator
@@ -72,38 +70,38 @@ RTL
;--------------------------------------------------------------------------------
DMAAlphabetTilemap:
PHA : PHX
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.w DMAP0 : PHA ; preserve DMA parameters
LDA.w BBAD0 : PHA ; preserve DMA parameters
LDA.w A1T0L : PHA ; preserve DMA parameters
LDA.w A1T0H : PHA ; preserve DMA parameters
LDA.w A1B0 : PHA ; preserve DMA parameters
LDA.w DAS0L : PHA ; preserve DMA parameters
LDA.w DAS0H : PHA ; preserve DMA parameters
;--------------------------------------------------------------------------------
LDA.b #$01 : STA $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 #$01 : STA.w DMAP0 ; set DMA transfer direction A -> B, bus A auto increment, double-byte mode
LDA.b #$80 : STA.w VMAIN ; write read increment on $2119
LDA.b #$18 : STA.w BBAD0 ; set bus B destination to VRAM register
LDA.b #$60 : STA $2116 ; write VRAM destination address
STA $2117 ; write VRAM destination address
LDA.b #$60 : STA.w VMADDL ; write VRAM destination address
STA.w VMADDH ; write VRAM destination address
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 #BigRAM : STA.w A1T0L ; set bus A source address to WRAM
LDA.b #BigRAM>>8 : STA.w A1T0H ; set bus A source address to WRAM
LDA.b #BigRAM>>16 : STA.w A1B0 ; set bus A source bank
LDA.b #$80 : STA $4305 : STZ $4306 ; set transfer size to 0x40
LDA.b #$80 : STA.w DAS0L : STZ.w DAS0H ; set transfer size to 0x40
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
LDA.w INIDISP : PHA : LDA.b #$80 : STA.w INIDISP ; save screen state & turn screen off
LDA.b #$01 : STA.w MDMAEN ; begin DMA transfer
PLA : STA.w INIDISP ; put screen back however it was before
;--------------------------------------------------------------------------------
PLA : STA $4306 ; restore DMA parameters
PLA : STA $4305 ; restore DMA parameters
PLA : STA $4304 ; restore DMA parameters
PLA : STA $4303 ; restore DMA parameters
PLA : STA $4302 ; restore DMA parameters
PLA : STA $4301 ; restore DMA parameters
PLA : STA $4300 ; restore DMA parameters
PLA : STA.w DAS0H ; restore DMA parameters
PLA : STA.w DAS0L ; restore DMA parameters
PLA : STA.w A1B0 ; restore DMA parameters
PLA : STA.w A1T0H ; restore DMA parameters
PLA : STA.w A1T0L ; restore DMA parameters
PLA : STA.w BBAD0 ; restore DMA parameters
PLA : STA.w DMAP0 ; restore DMA parameters
PLX : PLA
RTS
;--------------------------------------------------------------------------------

View File

@@ -1,106 +1,80 @@
;--------------------------------------------------------------------------------
!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
@@ -140,10 +114,8 @@ 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 $04CA
LDA.b #$2B : STA $012E
STA.w HeartBeepTimer
LDA.b #$2B : STA.w SFX2
RTL
+
LDA.b #$FF : STA $04CA
LDA.b #$FF : STA.w HeartBeepTimer
RTL
;================================================================================

View File

@@ -2,43 +2,41 @@
; Randomize Heart Pieces
;--------------------------------------------------------------------------------
HeartPieceGet:
PHX : PHY
LDY $0E80, X ; load item value into Y register
BNE +
; if for any reason the item value is 0 reload it, just in case
JSL.l LoadHeartPieceRoomValue : TAY
+
JSL.l MaybeMarkDigSpotCollected
PHX : PHY
LDY.w SpriteItemType, X ; load item value into Y register
BNE +
; if for any reason the item value is 0 reload it, just in case
JSL.l LoadHeartPieceRoomValue : TAY
+
JSL.l MaybeMarkDigSpotCollected
.skipLoad
.skipLoad
STZ $02E9 ; 0 = Receiving item from an NPC or message
STZ.w ItemReceiptMethod ; 0 = Receiving item from an NPC or message
CPY.b #$26 : BNE .notHeart ; don't add a 1/4 heart if it's not a heart piece
LDA HeartPieceQuarter : INC A : AND.b #$03 : STA HeartPieceQuarter : BNE .unfinished_heart ; add up heart quarters
BRA .giveItem
CPY.b #$26 : BNE .notHeart ; don't add a 1/4 heart if it's not a heart piece
LDA.l HeartPieceQuarter : INC A : AND.b #$03 : STA.l HeartPieceQuarter : BNE .unfinished_heart ; add up heart quarters
BRA .giveItem
.notHeart
.notHeart
.giveItem
JSL.l $0791B3 ; Player_HaltDashAttackLong
JSL.l Link_ReceiveItem
CLC ; return false
JMP .done ; finished
.giveItem
JSL.l $0791B3 ; Player_HaltDashAttackLong
JSL.l Link_ReceiveItem
CLC ; return false
JMP .done ; finished
.unfinished_heart
SEC ; return true
.done
JSL MaybeUnlockTabletAnimation
.unfinished_heart
SEC ; return true
.done
JSL MaybeUnlockTabletAnimation
PLY : PLX
PLY : PLX
RTL
;--------------------------------------------------------------------------------
HeartContainerGet:
PHX : PHY
JSL.l AddInventory_incrementBossSwordLong
LDY $0E80, X ; load item value into Y register
LDY.w SpriteItemType, X ; load item value into Y register
BNE +
; if for any reason the item value is 0 reload it, just in case
JSL.l LoadHeartContainerRoomValue : TAY
@@ -46,27 +44,24 @@ HeartContainerGet:
BRA HeartPieceGet_skipLoad
;--------------------------------------------------------------------------------
!REDRAW = "$7F5000"
DrawHeartPieceGFX:
PHP
JSL.l Sprite_IsOnscreen : BCC .offscreen
PHA : PHY
LDA !REDRAW : BEQ .skipInit ; skip init if already ready
LDA.l RedrawFlag : BEQ .skipInit ; skip init if already ready
JSL.l HeartPieceSpritePrep
JMP .done ; don't draw on the init frame
.skipInit
LDA $0E80, X ; Retrieve stored item type
LDA.w SpriteItemType, X ; Retrieve stored item type
.skipLoad
PHA
JSL.l IsNarrowSprite : BCC +
LDA $0E60, X : ORA.b #$20 : STA $0E60, X
LDA.w SpriteControl, X : ORA.b #$20 : STA.w SpriteControl, X
+
;LDA $0E60, X : ORA.b #$10 : STA $0E60, X
PLA
JSL.l DrawDynamicTile
@@ -78,18 +73,17 @@ DrawHeartPieceGFX:
PLP
RTL
;--------------------------------------------------------------------------------
!REDRAW = "$7F5000"
DrawHeartContainerGFX:
PHP
JSL.l Sprite_IsOnscreen : BCC DrawHeartPieceGFX_offscreen
PHA : PHY
LDA !REDRAW : BEQ .skipInit ; skip init if already ready
LDA.l RedrawFlag : BEQ .skipInit ; skip init if already ready
JSL.l HeartContainerSpritePrep
BRA DrawHeartPieceGFX_done ; don't draw on the init frame
.skipInit
LDA $0E80, X ; Retrieve stored item type
LDA.w SpriteItemType, X ; Retrieve stored item type
BRA DrawHeartPieceGFX_skipLoad
;--------------------------------------------------------------------------------
@@ -107,7 +101,7 @@ HeartContainerSound:
RTL
;--------------------------------------------------------------------------------
NormalItemSkipSound:
LDA $0C5E, X ; thing we wrote over
LDA.w AncillaGet, X ; thing we wrote over
CPY.b #$20 : BEQ + ; Skip for Crystal
CPY.b #$37 : BEQ + ; Skip for Pendants
@@ -115,66 +109,43 @@ NormalItemSkipSound:
CPY.b #$39 : BEQ +
PHA
JSL.l CheckIfBossRoom
JSL.l CheckIfBossRoom
PLA
RTL
+
CLC
RTL
;--------------------------------------------------------------------------------
HeartUpgradeSpawnDecision: ; this should return #$00 to make the hp spawn
LDA !FORCE_HEART_SPAWN : BEQ .normal_behavior
DEC : STA !FORCE_HEART_SPAWN
LDA #$00
RTL
.normal_behavior
LDA OverworldEventDataWRAM, X
RTL
;--------------------------------------------------------------------------------
SaveHeartCollectedStatus:
LDA !SKIP_HEART_SAVE : BEQ .normal_behavior
DEC : STA !SKIP_HEART_SAVE
RTL
.normal_behavior
LDA OverworldEventDataWRAM, X : ORA.b #$40 : STA OverworldEventDataWRAM, X
RTL
;--------------------------------------------------------------------------------
!REDRAW = "$7F5000"
HeartPieceSpritePrep:
PHA
LDA ServerRequestMode : BEQ + : : +
LDA.l ServerRequestMode : BEQ + : : +
LDA #$01 : STA !REDRAW
LDA $5D : CMP #$14 : BEQ .skip ; skip if we're mid-mirror
LDA.b #$01 : STA.l RedrawFlag
LDA.b LinkState : CMP.b #$14 : BEQ .skip ; skip if we're mid-mirror
LDA #$00 : STA !REDRAW
LDA.b #$00 : STA.l RedrawFlag
JSL.l LoadHeartPieceRoomValue ; load item type
STA $0E80, X ; Store item type
STA.w SpriteItemType, X ; Store item type
JSL.l PrepDynamicTile
.skip
PLA
RTL
;--------------------------------------------------------------------------------
!REDRAW = "$7F5000"
HeartContainerSpritePrep:
PHA
LDA #$00 : STA !REDRAW
LDA.b #$00 : STA.l RedrawFlag
JSL.l LoadHeartContainerRoomValue ; load item type
STA $0E80, X ; Store item type
STA.w SpriteItemType, X ; Store item type
JSL.l PrepDynamicTile
PLA
RTL
;--------------------------------------------------------------------------------
LoadHeartPieceRoomValue:
LDA $1B : BEQ .outdoors ; check if we're indoors or outdoors
LDA.b IndoorsFlag : BEQ .outdoors ; check if we're indoors or outdoors
.indoors
JSL.l LoadIndoorValue
JMP .done
@@ -183,38 +154,37 @@ LoadHeartPieceRoomValue:
.done
RTL
;--------------------------------------------------------------------------------
!REDRAW = "$7F5000"
HPItemReset:
JSL $09AD58 ; GiveRupeeGift - thing we wrote over
PHA : LDA #$01 : STA !REDRAW : PLA
PHA : LDA.b #$01 : STA.l RedrawFlag : PLA
RTL
;--------------------------------------------------------------------------------
MaybeMarkDigSpotCollected:
PHA : PHP
LDA $1B : BNE +
LDA.b IndoorsFlag : BNE +
REP #$20 ; set 16-bit accumulator
LDA $8A
LDA.b OverworldIndex
CMP.w #$2A : BNE +
LDA HasGroveItem : ORA.w #$0001 : STA HasGroveItem
LDA.l HasGroveItem : ORA.w #$0001 : STA.l HasGroveItem
+
PLP : PLA
RTL
;--------------------------------------------------------------------------------
macro GetPossiblyEncryptedItem(ItemLabel,TableLabel)
LDA IsEncrypted : BNE ?encrypted
LDA.l IsEncrypted : BNE ?encrypted
LDA.l <ItemLabel>
BRA ?done
?encrypted:
PHX : PHP
REP #$30 ; set 16-bit accumulator & index registers
LDA $00 : PHA : LDA $02 : PHA
LDA.b Scrap00 : PHA : LDA.b Scrap02 : PHA
LDA.w #<TableLabel> : STA $00
LDA.w #<TableLabel>>>16 : STA $02
LDA.w #<TableLabel> : STA.b Scrap00
LDA.w #<TableLabel>>>16 : STA.b Scrap02
LDA.w #<ItemLabel>-<TableLabel>
JSL RetrieveValueFromEncryptedTable
PLX : STX $02 : PLX : STX $01
PLX : STX.b Scrap02 : PLX : STX.b Scrap01
PLP : PLX
?done:
endmacro
@@ -222,7 +192,7 @@ endmacro
LoadIndoorValue:
PHP
REP #$20 ; set 16-bit accumulator
LDA $A0 ; these are all decimal because i got them that way
LDA.b RoomIndex ; these are all decimal because i got them that way
CMP.w #225 : BNE +
%GetPossiblyEncryptedItem(HeartPiece_Forest_Thieves, HeartPieceIndoorValues)
JMP .done
@@ -233,7 +203,7 @@ LoadIndoorValue:
%GetPossiblyEncryptedItem(HeartPiece_Spectacle_Cave, HeartPieceIndoorValues)
JMP .done
+ CMP.w #283 : BNE +
LDA $22 : XBA : AND.w #$0001 ; figure out where link is
LDA.b LinkPosX : XBA : AND.w #$0001 ; figure out where link is
BNE ++
%GetPossiblyEncryptedItem(HeartPiece_Circle_Bushes, HeartPieceIndoorValues)
JMP .done
@@ -247,7 +217,7 @@ LoadIndoorValue:
%GetPossiblyEncryptedItem(HeartPiece_Smith_Pegs, HeartPieceIndoorValues)
JMP .done
+ CMP.w #135 : BNE +
LDA StandingKey_Hera
LDA.l StandingKey_Hera
JMP .done
+
LDA.w #$0017 ; default to a normal hp
@@ -267,9 +237,9 @@ RTL
LoadOutdoorValue:
PHP
REP #$20 ; set 16-bit accumulator
LDA $8A
LDA.b OverworldIndex
CMP.w #$03 : BNE +
LDA $22 : CMP.w #1890 : !BLT ++
LDA.b LinkPosX : CMP.w #1890 : !BLT ++
%GetPossiblyEncryptedItem(HeartPiece_Spectacle, HeartPieceOutdoorValues)
JMP .done
++
@@ -285,7 +255,7 @@ LoadOutdoorValue:
%GetPossiblyEncryptedItem(HauntedGroveItem, HeartPieceOutdoorValues)
JMP .done
+ CMP.w #$30 : BNE +
LDA $22 : CMP.w #512 : !BGE ++
LDA.b LinkPosX : CMP.w #512 : !BGE ++
%GetPossiblyEncryptedItem(HeartPiece_Desert, HeartPieceOutdoorValues)
JMP .done
++
@@ -335,7 +305,7 @@ LoadHeartContainerRoomValue:
LoadBossValue:
PHP
REP #$20 ; set 16-bit accumulator
LDA $A0 ; these are all decimal because i got them that way
LDA.b RoomIndex ; these are all decimal because i got them that way
CMP.w #200 : BNE +
%GetPossiblyEncryptedItem(HeartContainer_ArmosKnights, HeartContainerBossValues)
JMP .done
@@ -378,7 +348,7 @@ CheckIfBossRoom:
; Carry set if we're in a boss room, unset otherwise.
;--------------------------------------------------------------------------------
REP #$20 ; set 16-bit accumulator
LDA $A0 ; these are all decimal because i got them that way
LDA.b RoomIndex ; these are all decimal because i got them that way
CMP.w #200 : BEQ .done
CMP.w #51 : BEQ .done
CMP.w #7 : BEQ .done

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