85 Commits

Author SHA1 Message Date
e5420fc651 Sidnexx damage modify? 2023-03-17 11:36:24 -05:00
9f441108e0 Moldorm stunnable with hookshot/boomerang; only damagable when stunned 2023-03-17 11:16:29 -05:00
e3afa34088 Sword swing slight delay as sword is upgraded 2023-03-16 23:15:55 -05:00
5139f6d857 Fix bunny pot-throwing 2023-03-16 19:10:46 -05:00
e55af7e610 Using shovel indoors bunnies link 2023-03-15 23:13:58 -05:00
e11ac2c130 Initial trolls:
- random dash timer
- random bomb timer
- flute sometimes summons chickens
- ice physics while carrying things
- lowered i-frames with increased hearts/armor
- Blind impervious (TODO: allow hitting with bunny pots)
2023-03-15 22:06:02 -05:00
015f769521 Move kara-branch code to bank A2 so there's space 2023-02-26 14:31:51 -06:00
bfbc180ff3 Merge branch 'OWMain' into overworld_kara 2023-02-26 14:30:05 -06:00
ec6231955d Merge remote-tracking branch 'codemann/OWMain' into overworld_kara 2023-01-30 19:47:34 -06:00
9699c4d731 Fix swordless boss counter 2022-11-19 21:09:34 -08:00
846ad798cf Fix conflict between hammer-on-B code with bunny-pressing-A code 2022-11-19 10:06:37 -08:00
44e2ccf7f7 Fix bomb on file select screen in swordless 2022-11-16 14:39:47 -08:00
5d4e7fa62d Add Hammer-On-B mode 2022-11-16 14:39:05 -08:00
be81787446 Bee Mode 2022-11-16 14:37:42 -08:00
682583c215 Merge branch 'OWMain' into overworld_kara 2022-11-16 14:24:25 -08:00
3cec56c5d8 Revert "Fix mixing progressive/non-progressive swords and shields"
This reverts commit d05169d5e2.
2022-10-12 15:55:48 -07:00
d05169d5e2 Fix mixing progressive/non-progressive swords and shields 2022-10-08 15:43:28 -07:00
f93a817ed3 Show chest keys count always 2022-09-18 23:21:55 -07:00
d6f3aee02b Remove non-progressive bomb/cane upgrades 2022-09-18 18:18:12 -07:00
4817fa2013 Fix up labels
still WIP

still do not use
2022-09-18 18:11:21 -07:00
6f138825d9 Merge remote-tracking branch 'codemann/OWMain' into overworld_kara
WIP, Broken, Do Not Use
2022-09-18 17:36:49 -07:00
6400a563ea unscramble lowercase letters for new font 2022-04-02 10:07:39 -07:00
9c30e3cdf9 Merge commit '697a742e0937780d3e6d1193876c8096ef1e2200' into HEAD 2022-04-01 18:28:29 -07:00
7da5e6257a Merge branch 'OWMain' of github.com:codemann8/z3randomizer into overworld_kara 2022-02-11 13:36:00 -08:00
8dfdd3ee87 Merge branch 'main' into overworld_kara 2022-01-24 14:07:50 -08:00
ede8760b5c Make non-seeded rng a rom flag instead of compile flag 2022-01-24 13:55:29 -08:00
2a15f39e65 Fix boomerang instakilling Armos Knights 2022-01-24 13:55:19 -08:00
Thomas Prescott
c416bfa917 update credits 2022-01-03 12:29:04 -08:00
b2043ef15e Adjust credits to match layout of base randomizer fork 2022-01-03 12:26:15 -08:00
74c55cf048 Merge remote-tracking branch 'codemann/OWMain' into overworld_kara 2022-01-01 15:30:19 -08:00
spannerisms
e78c41ef38 match expected usage 2021-12-29 18:58:15 -08:00
6db6733d80 Add permanent ice physics bit 2021-12-29 18:51:42 -08:00
8ffef89fb8 Fix bee damage 2021-12-27 14:04:20 -08:00
8c6d2ac26d Fix moldorm/somaria issue and add both-canes mode 2021-12-23 22:13:30 -08:00
0f26e5aaa5 Fix width of special cane freestanding sprites 2021-12-23 22:13:30 -08:00
8a25dc9d52 Prevent hitting stunned ganon in cane-mode with default vulnerability 2021-12-23 22:13:30 -08:00
d2ad452170 Fix mothula/ganon breaking things (hopefully) 2021-12-23 22:13:30 -08:00
b1e3a7999c Remove bomb damage in cane modes 2021-12-23 22:13:30 -08:00
53792aea25 Add cane-only modes 2021-12-23 22:13:26 -08:00
0ab9095222 Merge branch 'OWMain' into overworld_kara 2021-11-29 00:04:13 -08:00
e96d802ed1 Shorten duration of boomerang stun 2021-11-10 00:08:35 -08:00
b515b59a38 Make boomerang in bomb-only mode stun enemies it would normally damage 2021-11-08 16:38:03 -08:00
69a669e16e Merge branch 'OWMain' into overworld_kara 2021-11-08 00:09:02 -08:00
4896985493 Fix bomb icons on file select/endgame screens 2021-11-07 23:58:40 -08:00
2fd459d8ca Show bomb level on file select screen in bomb-only mode 2021-11-07 19:32:27 -08:00
918eefc3bd Minor fixes 2021-11-07 19:31:53 -08:00
2b241b2340 Unify handling of bomb colors in bomb-only mode 2021-11-07 12:47:13 -08:00
0c6ba20470 Merge branch 'main' into overworld_kara 2021-10-30 16:38:09 -07:00
82c5190f63 Merge branch 'OWMain' into overworld_kara 2021-10-30 11:55:08 -07:00
aeec3fe6c6 Allow early detonation of bombs and add build flag to remove static RNG 2021-10-30 09:11:36 -07:00
825d4a1ead Merge branch 'overworld_kara' of github.com:ardnaxelarak/z3randomizer into overworld_kara 2021-10-02 21:19:06 -07:00
6d9cbc85b7 Merge branch 'OWMain' of github.com:codemann8/z3randomizer into overworld_kara 2021-10-02 20:46:14 -07:00
f6f6383913 Merge remote-tracking branch 'codemann/OWMain' into overworld_kara 2021-09-21 14:10:23 -07:00
fb4068a3e1 Merge branch 'main' into overworld_kara 2021-09-21 11:55:33 -07:00
42002ae839 Merge branch 'main' into overworld_kara 2021-08-26 08:44:15 -07:00
0816bb7cab Merge branch 'fix_ohko' into overworld_kara 2021-08-09 15:33:03 -07:00
a12b5a9188 Merge branch 'OWMain' into overworld_kara 2021-08-02 19:00:33 -07:00
f14fea3699 Merge branch 'main' into overworld_kara 2021-08-02 19:00:13 -07:00
07f0ee9962 Merge branch 'OWMain' into overworld_kara 2021-07-28 12:54:14 -07:00
7aac3970d1 Add pseudo-sword mode 2021-07-25 01:42:21 -07:00
b663bb982f Merge branch 'OWMain' into overworld_kara 2021-07-23 15:42:41 -07:00
73ac8d8c25 Merge branch 'main' into overworld_kara 2021-07-23 15:28:30 -07:00
6df8dca127 Fix Stalfos Knights in bomb-mode to have bombs instakill while collapsed 2021-07-20 20:34:08 -07:00
faf05fb9a9 Merge branch 'OWMain' into overworld_kara 2021-07-17 12:19:56 -07:00
6da1227578 Color bombs in the HUD according to bomb level in bomb-only mode 2021-07-17 12:11:25 -07:00
59affe8b93 Adjust things for replacing sword stats with bomb stats 2021-07-17 12:11:25 -07:00
bdd665db24 move storage of BOMB_LEVEL to make it play nicely with starting equipment 2021-07-13 11:28:04 -07:00
e81905a517 Fix bomb downgrades and track bomb stats in bomb-mode 2021-07-12 02:35:24 -07:00
da14e440c7 Add L-1 bombs as separate from no bombs in bomb-only mode 2021-07-12 02:34:57 -07:00
8d92e39451 Fix extra space in credits 2021-07-12 02:13:08 -07:00
2c221dfa37 Allow bombing barrier and getting tablet checks with L2+ bombs 2021-07-10 23:47:27 -07:00
a6a8cda041 Fix junk graphics appearing during GAME OVER screen 2021-07-10 11:32:48 -07:00
2c931527e9 Merge branch 'DRMain' into overworld_kara 2021-07-08 19:39:10 -07:00
8b173ac27b Fix printing damage and magic to stat counters in credits 2021-07-08 01:57:12 -07:00
d960103e86 Merge branch 'main' into overworld_kara 2021-07-07 09:15:29 -07:00
7022b8768a Merge branch 'OWMain' of github.com:codemann8/z3randomizer into overworld_kara 2021-07-06 19:00:52 -07:00
d4e1337471 Add bombs-placed counter to stat screen 2021-07-05 17:56:56 -07:00
b8545ca055 Fix quake not blobbifying certain enemies 2021-07-05 16:15:26 -07:00
f4e7d412ed Fix hookshot and armos knights:
- hookshot now stuns enemies it would normally damage
- armos knights now take same damage from L-2 bombs as L-1/L-3
2021-07-04 18:34:10 -07:00
28b84484e0 NO BOMBOS DAMAGE 2021-07-04 15:40:57 -07:00
2fec3f7484 Merge commit 'f403ca10da9e009599a531be8cdcd20a61b4801c' of github.com:spannerisms/z3randomizer into overworld_kara 2021-07-01 23:05:48 -07:00
01abf889d7 Merge branch 'main' into overworld_kara 2021-07-01 23:02:23 -07:00
b8dc86d7c5 Allow Ganon to be vulnerable to arbitrary item 2021-06-29 16:43:01 -07:00
8b0f0464f8 Implement always-allowed medallions 2021-06-29 16:43:01 -07:00
b3d649a0fb Add bomb-only mode 2021-06-29 16:43:01 -07:00
271 changed files with 21192 additions and 36907 deletions

1
.gitignore vendored
View File

@@ -3,4 +3,3 @@ tournament.asm
/.idea
/__pycache__
/.vscode
build.sh

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

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

View File

@@ -3,54 +3,78 @@
;================================================================================
lorom
;===================================================================================================
; THIS NEEDS TO BE THE FIRST INCLUDE BECAUSE IT CHANGES THINGS EVERYWHERE
; If this were to be included later, it would almost certainly overwrite other changes
incsrc "fastrom.asm"
;================================================================================
;org $80FFC0 ; <- 7FC0 - Bank00.asm : 9173 (db "THE LEGEND OF ZELDA " ; 21 bytes)
;db $23, $4E
;org $00FFC0 ; <- 7FC0 - Bank00.asm : 9173 (db "THE LEGEND OF ZELDA " ; 21 bytes)
;db #$23, $4E
org $80FFD5 ; <- 7FD5 - Bank00.asm : 9175 (db $20 ; rom layout)
db $30 ; set fast lorom
org $00FFD5 ; <- 7FD5 - Bank00.asm : 9175 (db $20 ; rom layout)
db #$30 ; set fast lorom
;org $80FFD6 ; <- 7FD6 - Bank00.asm : 9176 (db $02 ; cartridge type)
;db $55 ; enable S-RTC
;org $00FFD6 ; <- 7FD6 - Bank00.asm : 9176 (db $02 ; cartridge type)
;db #$55 ; enable S-RTC
org $80FFD7 ; <- 7FD7 - Bank00.asm : 9177 (db $0A ; rom size)
db $0B ; mark rom as 16mbit
org $00FFD7 ; <- 7FD7 - Bank00.asm : 9177 (db $0A ; rom size)
db #$0B ; mark rom as 16mbit
org $80FFD8 ; <- 7FD8 - Bank00.asm : 9178 (db $03 ; ram size (sram size))
db $05 ; mark sram as 32k
org $00FFD8 ; <- 7FD8 - Bank00.asm : 9178 (db $03 ; ram size (sram size))
db #$05 ; mark sram as 32k
org $BFFFFF ; <- 1FFFFF
db $00 ; expand file to 2mb
org $3FFFFF ; <- 1FFFFF
db #$00 ; expand file to 2mb
org $9FFFF8 ; <- FFFF8 timestamp rom
db $20, $19, $08, $31 ; year/month/day
org $1FFFF8 ; <- FFFF8 timestamp rom
db #$20, #$19, #$08, #$31 ; year/month/day
;================================================================================
!ROM_VERSION_LOW ?= 1 ; ROM version (two 16-bit integers)
!ROM_VERSION_HIGH ?= 5 ;
!ROM_VERSION_HIGH ?= 2 ;
org $80FFE0 ; Unused hardware vector
org $00FFE0 ; Unused hardware vector
RomVersion:
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
!FEATURE_FIX_BASEROM ?= 0
!FEATURE_NEW_TEXT ?= 0
;================================================================================
@@ -73,18 +97,18 @@ function hexto555(h) = ((((h&$FF)/8)<<10)|(((h>>8&$FF)/8)<<5)|(((h>>16&$FF)/8)<<
!FLAG_OW_MIXED = $04
!FLAG_OW_CROSSED = $02
!FLAG_OW_BONKDROP = $02
incsrc hooks.asm
incsrc treekid.asm
incsrc spriteswap.asm
incsrc hashalphabethooks.asm
incsrc sharedplayerpalettefix.asm
incsrc ram.asm
incsrc sram.asm
incsrc registers.asm
incsrc vanillalabels.asm
org $A08000 ; bank $20
;org $208000 ; bank #$20
org $A08000 ; bank #$A0
incsrc newitems.asm ; LEAVE THIS AS FIRST
incsrc itemdowngrade.asm
incsrc bugfixes.asm
incsrc darkworldspawn.asm
@@ -92,6 +116,7 @@ incsrc lampmantlecone.asm
incsrc floodgatesoftlock.asm
incsrc heartpieces.asm
incsrc npcitems.asm
incsrc utilities.asm
incsrc flipperkill.asm
incsrc pendantcrystalhud.asm
incsrc potions.asm
@@ -102,29 +127,30 @@ incsrc tablets.asm
incsrc fairyfixes.asm
incsrc rngfixes.asm
incsrc medallions.asm
incsrc inventory.asm
incsrc ganonfixes.asm
incsrc zelda.asm
incsrc maidencrystals.asm
incsrc zoraking.asm
incsrc catfish.asm
incsrc flute.asm
incsrc dungeondrops.asm
incsrc halfmagicbat.asm
incsrc mantle.asm
incsrc swordswap.asm
incsrc stats.asm
incsrc scratchpad.asm
incsrc map.asm
incsrc dialog.asm
incsrc entrances.asm
incsrc clock.asm
incsrc accessibility.asm
incsrc heartbeep.asm
incsrc capacityupgrades.asm
incsrc timer.asm
incsrc doorframefixes.asm
incsrc music.asm
incsrc roomloading.asm
incsrc icepalacegraphics.asm
incsrc follower.asm
warnpc $A18000
org $9C8000 ; text tables for translation
incbin "data/i18n_en.bin"
warnpc $9CF356
org $1C8000 ; text tables for translation
incbin i18n_en.bin
warnpc $1CF356
org $A18000 ; static mapping area
incsrc framehook.asm
@@ -135,7 +161,7 @@ incsrc hud.asm
warnpc $A18800
org $A18800 ; static mapping area
incsrc zsnes.asm
warnpc $A19000
org $A1A000 ; static mapping area. Referenced by front end. Do not move.
@@ -151,11 +177,19 @@ org $A1FF00 ; static mapping area
incsrc init.asm
org $A48000 ; code bank - PUT NEW CODE HERE
incsrc timer.asm
incsrc doorframefixes.asm
incsrc music.asm
incsrc roomloading.asm
incsrc icepalacegraphics.asm
incsrc firebarlayer.asm
incsrc glitched.asm
incsrc hardmode.asm
incsrc goalitem.asm
incsrc quickswap.asm
incsrc endingsequence.asm
incsrc cuccostorm.asm
incsrc compression.asm
incsrc retro.asm
incsrc controllerjank.asm
incsrc boots.asm
@@ -166,172 +200,166 @@ incsrc decryption.asm
incsrc hashalphabet.asm
incsrc inverted.asm
incsrc invertedmaps.asm
incsrc invertedmaps2.asm
incsrc bonktreemaps.asm
incsrc newhud.asm
incsrc compasses.asm
incsrc save.asm
incsrc password.asm
incsrc enemy_adjustments.asm
incsrc stats.asm
;incsrc hudtext.asm
incsrc servicerequest.asm
incsrc elder.asm
incsrc toast.asm
incsrc darkroomitems.asm
incsrc fastcredits.asm
incsrc msu.asm
incsrc menu/overworldmap.asm ; Overwrites some code in bank $8A
incsrc dungeonmap.asm
incsrc hextodec.asm
incsrc multiworld.asm
incsrc textrenderer.asm
incsrc terrorpin.asm
if !FEATURE_NEW_TEXT
incsrc textrenderer.asm
endif
warnpc $A58000
org $A28000
ItemReceiptGraphicsROM:
; we need some empty space here so that 0000 can mean nothing
fillbyte $00 : fill 32
incbin "data/customitems.4bpp"
PreloadedGraphicsROM:
incbin "data/preloadedgfx.4bpp"
warnpc $A2B000
org $A2B000
incsrc itemdatatables.asm ; Statically mapped
incsrc decompresseditemgraphics.asm
incsrc newitems.asm
incsrc utilities.asm
incsrc inventory.asm
incsrc menu/hudalpha.asm
warnpc $A38000
org $B98000
incsrc crystalswitchbook.asm
incsrc mimicdash.asm
incsrc gloom.asm
;org $228000 ; contrib area
org $A28000 ; contrib area
incsrc contrib.asm
incsrc special_weapons.asm
incsrc variable_ganon_vulnerability.asm
incsrc pseudoflute.asm
warnpc $BA8000
incsrc trolls.asm
warnpc $A38000
org $A38000
incsrc stats/credits.asm ; Statically mapped
incsrc stats/main.asm
incsrc stats/statConfig.asm
FontTable:
incsrc stats/fonttable.asm
incsrc doorrando/doorrando.asm ; bank 27/A7
incsrc menu/overworldmap.asm ; overwrites some code in bank 0A
incsrc doorrando/doorrando.asm ; bank 27 likely A7 in the future
;bank 28/A8 for keydropshuffle / standing items
incsrc keydrop/standing_items.asm ; bank 28/A8
incsrc owrando.asm ; bank 2A/AA
incsrc enemizer/main.asm ; bank 36/B6
incsrc keydrop/standing_items.asm
incsrc owrando.asm ; bank AA
incsrc enemizer/main.asm ; this is originally in bank 36, but is currently in migratory status in bank 37
org $B08000 ; bank #$30
org $308000 ; bank #$30
incsrc tables.asm
warnpc $B18000
warnpc $318000
org $B48000
org $348000
incsrc spc.asm
org $B18000 ; bank $31
; uncomment for inverted adjustments
;incsrc sandbox.asm
org $318000 ; bank #$31
GFX_Mire_Bombos:
incbin "data/99ff1_bombos.gfx"
warnpc $B18800
incbin 99ff1_bombos.gfx
warnpc $318800
org $B18800
org $318800
GFX_Mire_Quake:
incbin "data/99ff1_quake.gfx"
warnpc $B19000
incbin 99ff1_quake.gfx
warnpc $319000
org $B19000
org $319000
GFX_TRock_Bombos:
incbin "data/a6fc4_bombos.gfx"
warnpc $B19800
incbin a6fc4_bombos.gfx
warnpc $319800
org $B19800
org $319800
GFX_TRock_Ether:
incbin "data/a6fc4_ether.gfx"
warnpc $B1A000
incbin a6fc4_ether.gfx
warnpc $31A000
org $B1A000
org $31A000
GFX_HUD_Items:
incbin "menu/drsheetdc.2bppc"
warnpc $B1A800
incbin c2807_v4.gfx
warnpc $31A800
org $B1A800
org $31A800
GFX_New_Items:
incbin newitems.gfx
;incbin eventitems.gfx ; *EVENT*
warnpc $31B000
warnpc $B1B000
org $B1B000
org $31B000
GFX_HUD_Main:
incbin "data/c2e3e.gfx"
warnpc $B1B800
incbin c2e3e.gfx
warnpc $31B800
org $B1C000
org $31C000
IcePalaceFloorGfx:
incbin "data/ice_palace_floor.bin"
warnpc $B1C801
incbin ice_palace_floor.bin
warnpc $31C801
org $B1C800
org $31C800
Damage_Table:
incbin "data/damage_table.bin"
warnpc $B1D001
incbin damage_table.bin
warnpc $31D001
org $B1D000
org $31D000
FileSelectNewGraphics:
incbin "data/fileselectgfx.2bpp"
warnpc $B1E001
incbin fileselect.chr.gfx
warnpc $31E001
org $B1E000
org $31E000
InvertedCastleHole: ;address used by front end. DO NOT MOVE!
incbin "data/sheet73.gfx"
warnpc $B1E501
incbin sheet73.gfx
warnpc $31E501
org $B38000
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 "data/hudpalette.pal"
warnpc $B38041
incbin hudpalette.pal
warnpc $338041
org $B39000
ExpandedTrinexx:
incbin "data/sheet178.gfx"
warnpc $B39600
org $339000
incbin sheet178.gfx
warnpc $339600
org $B39600
org $339600
BossMapIconGFX:
incbin "data/bossicons.4bpp"
incbin bossicons.4bpp
org $B39C00
NewFont:
incbin "data/newfont.bin"
NewFontInverted:
incbin "data/newfont_inverted.bin"
SmallCharacters:
incbin "data/smallchars.2bpp"
org $8CD7DF
incsrc data/playernamecharmap.asm
org $8CE73D
incbin data/playernamestripes_1.bin
org $8CE911
incbin data/playernamestripes_2.bin
incsrc data/kanjireplacements.asm ; Overwrites text gfx data and masks in bank $8E
if !FEATURE_NEW_TEXT
org $339C00
NewFont:
incbin newfont.bin
NewFontInverted:
incbin newfont_inverted.bin
org $B28000
org $0CD7DF
incbin text_unscramble1.bin
org $0CE4D5
incbin text_unscramble2.bin
endif
org $328000
Extra_Text_Table:
incsrc itemtext.asm
warnpc $B2E000
if !FEATURE_NEW_TEXT
incsrc itemtext_lower.asm
else
incsrc itemtext.asm
endif
warnpc $32E000
org $B2DFD0 ; PC 0x195FD0
org $32DFD0 ; PC 0x195FD0
incsrc multiworldplayernames.asm
warnpc $B30000
warnpc $330000
incsrc externalhooks.asm
;================================================================================
org $919100 ; PC 0x89100
incbin "data/map_icons.gfx"
warnpc $919401
;================================================================================
org $9BB1E0
incsrc custompalettes.asm
warnpc $9BB880
org $119100 ; PC 0x89100
incbin map_icons.gfx
warnpc $119401
;================================================================================
org $AF8000 ; PC 0x178000
Static_RNG: ; each line below is 512 bytes of rng
@@ -346,15 +374,14 @@ warnpc $B08000
;Bank Map
;$20 Code Bank
;$21 Reserved (Frame Hook & Init)
;$22 Unused
;$22 Contrib Code
;$23 Stats & Credits
;$24 Code Bank
;$26 Multiworld data
;$27 DR Code Bank
;$28 Keydrop / Standing Items Code bank
;$29 External hooks (rest of bank not used)
;$2A Reserved for OWR
;$2B Reserved for "outlet data" ~5.8k
;$2B Room Data migration
;$2E Reserved for Tournament Use
;$2F Static RNG (rest is reserved for tournament use)
;$30 Main Configuration Table
@@ -362,25 +389,23 @@ warnpc $B08000
;$32 Text Bank
;$33 Graphics Bank
;$36 reserved for Enemizer
;$37 Room data if needed for DR/Pottery/Enemizer
;$39 GwaaKiwi Code Bank
;$3A reserved for downstream use
;$3B reserved for downstream use
;$3F reserved for internal debugging
;================================================================================
;RAM
;See ram.asm for label assignments
;$7EC900[0x1F00]: BigRAM buffer
;$7E021B[0x1]: Used by race game instead of $0ABF to avoid witch item conflict
;$7EC900[0x1F00]: BIGRAM buffer
;$7EF000[0x500]: SRAM mirror First 0x500 bytes of SRAM
; See sram.asm for labels and assignments
;$7F5000[0x800]: Rando's main free ram region
; See ram.asm for specific assignments
; See tables.asm for specific assignments
;$7F6000[0x1000]: SRAM buffer mapped to vanilla save slots 1 and 2
; See sram.asm for labels and assignments
;$7F7667[0x6719] - free ram
;================================================================================
;SRAM Map
;See sram.asm for label assignments and documentation
;See sram.asm for rando-specific assignments
;$70:0000 (5K) Game state
; 0000-04FF Vanilla Slot 1 (mirrored at $7EF000)
; 0500-14FF Ext Slot 1 (mirrored at $7F6000)
@@ -388,19 +413,423 @@ 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 $80D09C ; 0x509C - HUD Items H
;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
org $80D17B ; 0x517B - HUD Items M
org $00D17B ; 0x517B - HUD Items M
db GFX_HUD_Items>>8
org $80D25A ; 0x525A - HUD Items L
org $00D25A ; 0x525A - HUD Items L
db GFX_HUD_Items
org $80D09D ; 0x509D - HUD Main H
db GFX_HUD_Main>>16
org $80D17C ; 0x517C - HUD Main M
db GFX_HUD_Main>>8
org $80D25B ; 0x525B - HUD Main L
db GFX_HUD_Main
; this used to be a pointer to a dummy file
org $00D065 ; 005065 - New Items H
db GFX_New_Items>>16
org $00D144 ; 005114 - New Items M
db GFX_New_Items>>8
org $00D223 ; 005223 - New Items L
db GFX_New_Items
org $00D09D ; 0x509D - HUD Main H
db GFX_HUD_Main>>16
org $00D17C ; 0x517C - HUD Main M
db GFX_HUD_Main>>8
org $00D25B ; 0x525B - HUD Main L
db GFX_HUD_Main
;================================================================================
org $008781
UseImplicitRegIndexedLocalJumpTable:
org $00879c
UseImplicitRegIndexedLongJumpTable:
org $008333
Vram_EraseTilemaps_triforce:
org $008913
Sound_LoadLightWorldSongBank:
org $00891D
.do_load
org $00893D
EnableForceBlank:
DungeonMask = $0098C0
org $00D308
DecompSwordGfx:
org $00D348
DecompShieldGfx:
org $00D463
Tagalong_LoadGfx:
org $00D51B
GetAnimatedSpriteTile:
org $00D52D
GetAnimatedSpriteTile_variable:
org $00D84E
Attract_DecompressStoryGfx:
org $00E529
LoadSelectScreenGfx:
org $00F945
PrepDungeonExit:
org $00FDEE
Mirror_InitHdmaSettings:
org $01873A
Dungeon_LoadRoom:
org $02821E
Module_PreDungeon:
org $028296
.setAmbientSfx
org $02A0A8
Dungeon_SaveRoomData:
org $02A0BE
Dungeon_SaveRoomData_justKeys:
org $02A4E3
Overworld_ActualScreenID:
org $02B861
Dungeon_SaveRoomQuadrantData:
org $02C11D
CalculateTransitionLanding:
org $02C176
Overworld_FinalizeEntryOntoScreen_Data:
org $02D9B9
Underworld_LoadSpawnEntrance:
org $02E99D
FluteMenu_LoadTransport:
org $02FD8A ; 17D8A - Bank0E.asm: 3732 Note: Different bank
LoadGearPalettes_bunny:
org $02FD95 ; 17D95 - Bank0E.asm: 3742 Note: Different bank
LoadGearPalettes_variable:
org $02FEAB
Filter_Majorly_Whiten_Color:
org $04E780
Overworld_MemorizeMap16Change:
org $04E879
Overworld_CheckForSpecialOverworldTrigger_Direction:
org $05A51D
Sprite_SpawnFallingItem:
org $05AFF1
Sprite_6C_MirrorPortal_dont_do_warp:
org $05DF6C ; 02DF6C - Bank05.asm : 2445
Sprite_DrawMultiple:
org $05DF70 ; 02DF70 - Bank05.asm : 2454
Sprite_DrawMultiple_quantity_preset:
org $05DF75 ; 02DF75 - Bank05.asm : 2461
Sprite_DrawMultiple_player_deferred:
org $05E1A7 ; 02E1A7 - Bank05.asm : 2592
Sprite_ShowSolicitedMessageIfPlayerFacing:
org $05E1F0
Sprite_ShowMessageFromPlayerContact:
org $05E219
Sprite_ShowMessageUnconditional:
org $05EC96
Sprite_ZeldaLong:
org $0680FA
Player_ApplyRumbleToSprites:
org $0683E6
Utility_CheckIfHitBoxesOverlapLong:
org $06A7DB
Chicken_SpawnAvengerChicken: ; returns short
org $06AD58
Sprite_TransmuteToBomb:
org $06DC5C
Sprite_DrawShadowLong:
org $06DD40
DashKey_Draw:
org $06DBF8
Sprite_PrepAndDrawSingleLargeLong:
org $06DC00
Sprite_PrepAndDrawSingleSmallLong:
org $06EA18
Sprite_ApplySpeedTowardsPlayerLong:
org $06EAA6
Sprite_DirectionToFacePlayerLong:
org $06F12F
Sprite_CheckDamageToPlayerSameLayerLong:
org $06F86A
OAM_AllocateDeferToPlayerLong:
org $0791B3
Player_HaltDashAttackLong:
org $07999D
Link_ReceiveItem:
org $079F82
Link_UseHammer:
org $07A985
SetGameModeLikeMirror:
org $07E68F
Unknown_Method_0: ; In US version disassembly simply called "$3E6A6 IN ROM"
org $07F413
Link_CheckForEdgeScreenTransition:
org $07F4AA
Sprite_CheckIfPlayerPreoccupied:
org $08C3AE
Ancilla_ReceiveItem:
org $08C505
Ancilla_ReceiveItem_objectFinished:
org $08CE93
Ancilla_BreakTowerSeal_draw_single_crystal:
org $08CEC3
Ancilla_BreakTowerSeal_stop_spawning_sparkles:
org $08CF59
BreakTowerSeal_ExecuteSparkles:
org $08F710
Ancilla_SetOam_XY_Long:
org $0985E2 ; (break on $0985E4)
AddReceivedItem:
org $098605
AddReceivedItem_notCrystal:
org $098766
AddReceivedItem_gfxHandling:
org $098BAD
AddPendantOrCrystal:
org $098CFD
AddWeathervaneExplosion:
org $0993DF
AddDashTremor:
org $099D04
AddAncillaLong:
org $099D1A
Ancilla_CheckIfAlreadyExistsLong:
org $09AC57
Ancilla_TerminateSelectInteractives:
org $09AE64
Sprite_SetSpawnedCoords:
org $09AD58
GiveRupeeGift:
org $0AB7BD
FluteMenu_HandleSelection_NoSelection:
org $0ABA4F
OverworldMap_InitGfx:
org $0ABA99
OverworldMap_DarkWorldTilemap:
org $0ABAB9
OverworldMap_LoadSprGfx:
org $8AE817
DungeonMapBossRooms:
org $0CD7D1
NameFile_MakeScreenVisible:
org $0CDB3E
InitializeSaveFile:
org $0CDBC0
InitializeSaveFile_build_checksum:
org $0DBA71
GetRandomInt:
org $0DBA80
OAM_AllocateFromRegionA:
org $0DBA84
OAM_AllocateFromRegionB:
org $0DBA88
OAM_AllocateFromRegionC:
org $0DBA8C
OAM_AllocateFromRegionD:
org $0DBA90
OAM_AllocateFromRegionE:
org $0DBA94
OAM_AllocateFromRegionF:
org $0DBB67
Sound_SetSfxPanWithPlayerCoords:
org $0DBB6E
Sound_SetSfx1PanLong:
org $0DBB7C
Sound_SetSfx2PanLong:
org $0DBB8A
Sound_SetSfx3PanLong:
org $0DDB7F
HUD_RefreshIconLong:
org $0DDD32
Equipment_UpdateEquippedItemLong:
org $0DE01E ; 6E10E - equipment.asm : 787
BottleMenu_movingOn:
org $0DE346
RestoreNormalMenu:
org $0DE395
Equipment_SearchForEquippedItemLong:
org $0DE9C8
DrawProgressIcons: ; this returns short
org $0DED29
DrawEquipment: ; this returns short
org $0DFA78
HUD_RebuildLong:
org $0DFA88
HUD_RebuildIndoor_Palace:
org $0DFA88
HUD_RebuildLong2:
org $0EEE10
Messaging_Text:
org $0FFD94
Overworld_TileAttr:
org $1BC97C
Overworld_DrawPersistentMap16:
org $1BED03
Palette_Sword:
org $1BED29
Palette_Shield:
org $1BEDF9
Palette_ArmorAndGloves:
org $1BEE52
Palette_Hud:
org $1BEF96
Palette_SelectScreen:
org $1CFAAA
ShopKeeper_RapidTerminateReceiveItem:
org $1CF500
Sprite_NullifyHookshotDrag:
org $1CF537
Ancilla_CheckForAvailableSlot:
org $1DE9B6
Filter_MajorWhitenMain:
org $1DF65D
Sprite_SpawnDynamically:
org $1DF65F
Sprite_SpawnDynamically_arbitrary:
org $1DFD4B
DiggingGameGuy_AttemptPrizeSpawn:
org $1EDE28
Sprite_GetEmptyBottleIndex: ; this is totally in sprite_bees.asm
org $1EF4E7
Sprite_PlayerCantPassThrough:
;================================================================================

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

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

View File

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

BIN
asar Executable file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -1,249 +0,0 @@
#include <stdio.h>
#include <stddef.h>
#include <stdlib.h>
#include <sys/stat.h>
const int MAXLENGTH = 0x300;
struct section {
int mode;
int length;
unsigned char data[2];
int datalength;
};
int find_duplicate(off_t loc, off_t size, unsigned char buf[], struct section *out) {
int i, j;
struct section result;
result.mode = 4;
result.length = 0;
for (i = 0; i < loc && i < 0x10000; i++) {
if (buf[i] != buf[loc]) {
continue;
}
for (j = 0; j < MAXLENGTH; j++) {
if (buf[i + j] != buf[loc + j]) {
break;
}
}
if (j > result.length) {
result.length = j;
result.data[0] = i & 0xFF;
result.data[1] = (i >> 8) & 0xFF;
result.datalength = 2;
}
}
if (result.length < 4) {
return -1;
}
*out = result;
return 0;
}
int find_repeat_byte(off_t loc, off_t size, unsigned char buf[], struct section *out) {
int i;
for (i = 0; i < MAXLENGTH && loc + i < size; i++) {
if (buf[loc + i] != buf[loc]) {
break;
}
}
if (i > 2) {
struct section result;
result.mode = 1;
result.length = i;
result.data[0] = buf[loc];
result.datalength = 1;
*out = result;
return 0;
}
return -1;
}
int find_repeat_word(off_t loc, off_t size, unsigned char buf[], struct section *out) {
int i;
for (i = 0; i < MAXLENGTH && loc + i + 1 < size; i += 1) {
if (buf[loc + i] != buf[loc + (i & 1)]) {
break;
}
}
if (i > 3) {
struct section result;
result.mode = 2;
result.length = i;
result.data[0] = buf[loc];
result.data[1] = buf[loc + 1];
result.datalength = 2;
*out = result;
return 0;
}
return -1;
}
int find_incrementing_byte(off_t loc, off_t size, unsigned char buf[], struct section *out) {
int i;
for (i = 0; i < MAXLENGTH && loc + i < size; i++) {
if (buf[loc] + i < i) {
break;
}
if (buf[loc + i] != buf[loc] + i) {
break;
}
}
if (i > 2) {
struct section result;
result.mode = 3;
result.length = i;
result.data[0] = buf[loc];
result.datalength = 1;
*out = result;
return 0;
}
return -1;
}
int get_section(off_t loc, off_t size, unsigned char buf[], struct section *out) {
struct section best, current;
best.length = 0;
if (!find_repeat_byte(loc, size, buf, &current)) {
if (current.length > best.length) {
best = current;
}
}
if (!find_repeat_word(loc, size, buf, &current)) {
if (current.length > best.length) {
best = current;
}
}
if (!find_incrementing_byte(loc, size, buf, &current)) {
if (current.length > best.length) {
best = current;
}
}
if (!find_duplicate(loc, size, buf, &current)) {
if (current.length > best.length) {
best = current;
}
}
if (best.length > 0) {
// printf("byte %06X: mode %d length %02X\n", loc, best.mode, best.length);
*out = best;
return 0;
} else {
return -1;
}
}
int write_section(struct section section, unsigned char data[], unsigned char buf[], int loc) {
int nloc = loc;
int len = section.length - 1;
if (len > 0x1F) {
buf[nloc++] = 0xE0 | (section.mode << 2) | (len >> 8);
buf[nloc++] = len & 0xFF;
} else {
buf[nloc++] = (section.mode << 5) | len;
}
for (int i = 0; i < section.datalength; i++) {
buf[nloc++] = data[i];
}
return nloc;
}
int main(int argc, char *argv[]) {
if (argc < 3) {
printf("Usage: %s infile outfile [start [length]]\n", argv[0]);
return 1;
}
off_t seek = 0;
if (argc > 3) {
seek = strtol(argv[3], NULL, 0);
}
FILE *inptr;
if ((inptr = fopen(argv[1], "rb")) == NULL) {
printf("%s does not exist.\n", argv[1]);
return 1;
}
int fd = fileno(inptr);
if (fd < 0) {
printf("Error stating file: %s\n", argv[1]);
return 1;
}
struct stat buf;
if (fstat(fd, &buf) != 0) {
printf("Error stating file: %s\n", argv[1]);
return 1;
}
off_t size = buf.st_size - seek;
if (argc > 4) {
size = strtol(argv[4], NULL, 0);
}
unsigned char inbuf[size];
fseek(inptr, seek, SEEK_SET);
if (fread(inbuf, 1, size, inptr) < size) {
printf("Error reading file: %s\n", argv[1]);
return 1;
}
fclose(inptr);
unsigned char outbuf[size * 2];
unsigned char m0data[MAXLENGTH];
int oloc = 0;
struct section m0;
m0.mode = 0;
m0.length = 0;
int i;
off_t loc = 0;
while (loc < size) {
struct section section;
if (!get_section(loc, size, inbuf, &section)) {
if (m0.length > 0) {
m0.datalength = m0.length;
oloc = write_section(m0, m0data, outbuf, oloc);
m0.length = 0;
}
oloc = write_section(section, section.data, outbuf, oloc);
loc += section.length;
} else {
if (m0.length == MAXLENGTH) {
m0.datalength = m0.length;
oloc = write_section(m0, m0data, outbuf, oloc);
m0.length = 0;
}
m0data[m0.length++] = inbuf[loc];
loc += 1;
}
}
if (m0.length > 0) {
m0.datalength = m0.length;
oloc = write_section(m0, m0data, outbuf, oloc);
m0.length = 0;
}
outbuf[oloc++] = 0xFF;
FILE *outptr;
if ((outptr = fopen(argv[2], "wb")) == NULL) {
printf("Error opening file: %s\n", argv[2]);
return 1;
}
if (fwrite(outbuf, 1, oloc, outptr) < oloc) {
printf("Error writing to file: %s\n", argv[2]);
return 1;
}
fclose(outptr);
printf("Input file: %lX bytes. Compressed: %X bytes.\n", size, oloc);
return 0;
}

View File

@@ -1,155 +0,0 @@
#include <stdio.h>
#include <stddef.h>
#include <stdlib.h>
#include <sys/stat.h>
struct section {
int mode;
int length;
unsigned char data[2];
int datalength;
};
int read_section(unsigned char buf[], int loc, struct section *out) {
int nloc = loc;
unsigned char header = buf[nloc++];
if (header == 0xFF) {
return -1;
}
struct section result;
result.data[0] = buf[loc];
result.datalength = 1;
if ((header & 0xE0) == 0xE0) {
result.mode = (header & 0x1C) >> 2;
result.length = (((header & 0x03) << 8) | buf[nloc++]) + 1;
} else {
result.mode = (header & 0xE0) >> 5;
result.length = (header & 0x1F) + 1;
}
switch (result.mode) {
case 0:
result.datalength = 0;
break;
case 1:
result.datalength = 1;
break;
case 2:
result.datalength = 2;
break;
case 3:
result.datalength = 1;
break;
case 4:
result.datalength = 2;
break;
}
for (int i = 0; i < result.datalength; i++) {
result.data[i] = buf[nloc++];
}
*out = result;
return nloc;
}
int main(int argc, char *argv[]) {
if (argc < 3) {
printf("Usage: %s infile outfile [start [length]]\n", argv[0]);
return 1;
}
off_t seek = 0;
if (argc > 3) {
seek = strtol(argv[3], NULL, 0);
}
FILE *inptr;
if ((inptr = fopen(argv[1], "rb")) == NULL) {
printf("%s does not exist.\n", argv[1]);
return 1;
}
int fd = fileno(inptr);
if (fd < 0) {
printf("Error stating file: %s\n", argv[1]);
return 1;
}
struct stat buf;
if (fstat(fd, &buf) != 0) {
printf("Error stating file: %s\n", argv[1]);
return 1;
}
off_t size = buf.st_size - seek;
if (argc > 4) {
size = strtol(argv[4], NULL, 0);
}
fseek(inptr, seek, SEEK_SET);
unsigned char inbuf[size];
if (fread(inbuf, 1, size, inptr) < size) {
printf("Error reading file: %s\n", argv[1]);
return 1;
}
fclose(inptr);
unsigned char outbuf[size * 256];
int oloc = 0;
struct section section;
int i;
off_t loc = 0;
while ((loc = read_section(inbuf, loc, &section)) >= 0) {
if (section.mode == 0) {
for (i = 0; i < section.length; i++) {
outbuf[oloc++] = inbuf[loc++];
}
} else if (section.mode == 1) {
for (i = 0; i < section.length; i++) {
outbuf[oloc++] = section.data[0];
}
} else if (section.mode == 2) {
for (i = 0; i < section.length; i++) {
outbuf[oloc++] = section.data[0];
if (++i < section.length) {
outbuf[oloc++] = section.data[1];
}
}
} else if (section.mode == 3) {
for (i = 0; i < section.length; i++) {
outbuf[oloc++] = (section.data[0] + i) & 0xff;
}
} else if (section.mode == 4) {
int offset = section.data[0] | (section.data[1] << 8);
for (i = 0; i < section.length; i++) {
outbuf[oloc++] = outbuf[offset + i];
}
}
}
FILE *outptr;
if ((outptr = fopen(argv[2], "wb")) == NULL) {
printf("Error opening file: %s\n", argv[2]);
return 1;
}
if (fwrite(outbuf, 1, oloc, outptr) < oloc) {
printf("Error writing to file: %s\n", argv[2]);
return 1;
}
fclose(outptr);
printf("Input file: %lX bytes. Decompressed: %X bytes.\n", size, oloc);
return 0;
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@@ -2,22 +2,22 @@
; Randomize Book of Mudora
;--------------------------------------------------------------------------------
LoadLibraryItemGFX:
INC.w SkipBeeTrapDisguise
LDA.l LibraryItem_Player : STA.w SprItemMWPlayer, X : STA.l !MULTIWORLD_SPRITEITEM_PLAYER_ID
%GetPossiblyEncryptedItem(LibraryItem, SpriteItemValues)
STA.w SprSourceItemId, X
JML RequestStandingItemVRAMSlot
LDA.l LibraryItem_Player : STA !MULTIWORLD_SPRITEITEM_PLAYER_ID
%GetPossiblyEncryptedItem(LibraryItem, SpriteItemValues)
STA $0E80, X ; Store item type
JSL.l PrepDynamicTile
RTL
;--------------------------------------------------------------------------------
DrawLibraryItemGFX:
PHA
LDA.w SprItemReceipt, X
JSL DrawPotItem
PLA
PHA
LDA $0E80, X ; Retrieve stored item type
JSL.l DrawDynamicTile
PLA
RTL
;--------------------------------------------------------------------------------
SetLibraryItem:
LDY.w SprSourceItemId, X
JSL ItemSet_Library ; contains thing we wrote over
LDY $0E80, X ; Retrieve stored item type
JSL.l ItemSet_Library ; contains thing we wrote over
RTL
;--------------------------------------------------------------------------------
@@ -25,82 +25,69 @@ RTL
;================================================================================
; Randomize Bonk Keys
;--------------------------------------------------------------------------------
!REDRAW = "$7F5000"
;--------------------------------------------------------------------------------
LoadBonkItemGFX:
LDA.b #$08 : STA.w SpriteOAMProp, X ; thing we wrote over
LDA.b #$08 : STA $0F50, X ; thing we wrote over
LoadBonkItemGFX_inner:
INC.w SkipBeeTrapDisguise
JSR LoadBonkItem_Player : STA.w SprItemMWPlayer, X : STA.l !MULTIWORLD_SPRITEITEM_PLAYER_ID
JSR LoadBonkItem
STA.w SprSourceItemId, X
JSL RequestStandingItemVRAMSlot
LDA.b #$00 : STA !REDRAW
JSR LoadBonkItem_Player : STA !MULTIWORLD_SPRITEITEM_PLAYER_ID
JSR LoadBonkItem
JSL.l PrepDynamicTile
RTL
;--------------------------------------------------------------------------------
DrawBonkItemGFX:
PHA
LDA.w SprRedrawFlag, X : BEQ .skipInit
JSL LoadBonkItemGFX_inner
LDA.w SprRedrawFlag, X : CMP.b #$02 : BEQ .skipInit
BRA .done ; don't draw on the init frame
.skipInit
LDA.w SprItemReceipt,X
JSL DrawPotItem
.done
PLA
PHA
LDA !REDRAW : BEQ .skipInit ; skip init if already ready
JSL.l LoadBonkItemGFX_inner
BRA .done ; don't draw on the init frame
.skipInit
JSR LoadBonkItem
JSL.l DrawDynamicTileNoShadow
.done
PLA
RTL
;--------------------------------------------------------------------------------
GiveBonkItem:
LDA.w SprItemMWPlayer, X : STA.l !MULTIWORLD_ITEM_PLAYER_ID
LDA.w SprSourceItemId, X
JSR AbsorbKeyCheck : BCC .notKey
PHY : LDY.b #$24 : JSL AddInventory : PLY ; do inventory processing for a small key
LDA.l CurrentSmallKeys : INC A : STA.l CurrentSmallKeys
LDA.b #$2F : JSL Sound_SetSfx3PanLong
LDA.b #$01 : STA.l UpdateHUDFlag
RTL
JSR LoadBonkItem_Player : STA !MULTIWORLD_ITEM_PLAYER_ID
JSR LoadBonkItem
CMP #$24 : BNE .notKey
.key
PHY : LDY.b #$24 : JSL.l AddInventory : PLY ; do inventory processing for a small key
LDA CurrentSmallKeys : INC A : STA CurrentSmallKeys
LDA.b #$2F : JSL.l Sound_SetSfx3PanLong
JSL CountBonkItem
RTL
.notKey
PHY : TAY : JSL Link_ReceiveItem : PLY
PHY : TAY : JSL.l Link_ReceiveItem : PLY
JSL CountBonkItem
RTL
;--------------------------------------------------------------------------------
LoadBonkItem:
LDA.b RoomIndex ; check room ID - only bonk keys in 2 rooms so we're just checking the lower byte
CMP.b #$73 : BNE + ; Desert Bonk Key
LDA.l BonkKey_Desert
BRA ++
+ : CMP.b #$8C : BNE + ; GTower Bonk Key
LDA.l BonkKey_GTower
BRA ++
+
LDA.b #$24 ; default to small key
++
LDA $A0 ; check room ID - only bonk keys in 2 rooms so we're just checking the lower byte
CMP #115 : BNE + ; Desert Bonk Key
LDA.l BonkKey_Desert
BRA ++
+ : CMP #140 : BNE + ; GTower Bonk Key
LDA.l BonkKey_GTower
BRA ++
+
LDA.b #$24 ; default to small key
++
RTS
;--------------------------------------------------------------------------------
LoadBonkItem_Player:
LDA.b RoomIndex ; check room ID - only bonk keys in 2 rooms so we're just checking the lower byte
CMP.b #$73 : BNE + ; Desert Bonk Key
LDA.l BonkKey_Desert_Player
BRA ++
+ : CMP.b #$8C : BNE + ; GTower Bonk Key
LDA.l BonkKey_GTower_Player
BRA ++
+
LDA.b #$00
++
RTS
;--------------------------------------------------------------------------------
AbsorbKeyCheck:
PHA
CMP.b #$24 : BEQ .key
CMP.b #$A0 : BCC .not_key
CMP.b #$B0 : BCS .not_key
AND.b #$0F : ASL
CMP.w DungeonID : BNE .not_key
.key
PLA
SEC
RTS
.not_key
PLA
CLC
LDA $A0 ; check room ID - only bonk keys in 2 rooms so we're just checking the lower byte
CMP #115 : BNE + ; Desert Bonk Key
LDA.l BonkKey_Desert_Player
BRA ++
+ : CMP #140 : BNE + ; GTower Bonk Key
LDA.l BonkKey_GTower_Player
BRA ++
+
LDA.b #$00
++
RTS

View File

@@ -1,95 +1,77 @@
;================================================================================
; Boots State Modifier
;--------------------------------------------------------------------------------
!BOOTS_MODIFIER = "$7F50CE"
ModifyBoots:
PHA
LDA.l BootsModifier : CMP.b #$01 : BNE +
PLA : AND.l AbilityFlags : ORA.b #$04 : RTL ; yes boots
LDA !BOOTS_MODIFIER : CMP.b #$01 : BNE +
PLA : AND AbilityFlags : ORA.b #$04 : RTL ; yes boots
+ : CMP.b #$02 : BNE +
PLA : AND.l AbilityFlags : AND.b #$FB : RTL ; no boots
+ : LDA.l FakeBoots : CMP.b #$01 : BNE +
LDA.b LinkSlipping : BEQ ++ : LDA.b PitTileActField : BNE + ; hover check
++ : PLA : AND.l AbilityFlags : ORA.b #$04 : RTL ; yes boots, not hovering
PLA : AND AbilityFlags : AND.b #$FB : RTL ; no boots
+ : LDA FakeBoots : CMP.b #$01 : BNE +
LDA $5B : BEQ ++ : LDA $59 : BNE + ; hover check
++ : PLA : AND AbilityFlags : ORA.b #$04 : RTL ; yes boots, not hovering
+
PLA
AND.l AbilityFlags ; regular boots
AND AbilityFlags ; regular boots
RTL
;--------------------------------------------------------------------------------
AddBonkTremors:
PHA
LDA.b LinkIncapacitatedTimer : BNE + ; Check for incapacitated Link
JSL IncrementBonkCounter
LDA $46 : BNE + ; Check for incapacitated Link
JSL.l IncrementBonkCounter
+
LDA.l BootsModifier : CMP.b #$01 : BEQ +
LDA.l BootsEquipment : BNE + ; Check for Boots
LDA !BOOTS_MODIFIER : CMP.b #$01 : BEQ +
LDA BootsEquipment : BNE + ; Check for Boots
PLA : RTL
+
PLA
JSL AddDashTremor : JSL Player_ApplyRumbleToSprites ; things we wrote over
JSL.l AddDashTremor : JSL.l Player_ApplyRumbleToSprites ; things we wrote over
RTL
;--------------------------------------------------------------------------------
BonkBreakableWall:
PHX : PHP
SEP #$30 ; set 8-bit accumulator and index registers
LDA.l BootsModifier : CMP.b #$01 : BEQ +
LDA.l BootsEquipment : BNE + ; Check for Boots
LDA !BOOTS_MODIFIER : CMP.b #$01 : BEQ +
LDA BootsEquipment : BNE + ; Check for Boots
PLP : PLX : LDA.w #$0000 : RTL
+
PLP : PLX
LDA.w LinkDashing : AND.w #$00FF ; things we wrote over
LDA $0372 : AND.w #$00FF ; things we wrote over
RTL
;--------------------------------------------------------------------------------
BonkRockPile:
LDA.l BootsModifier : CMP.b #$01 : BEQ +
LDA.l BootsEquipment : BNE + ; Check for Boots
LDA !BOOTS_MODIFIER : CMP.b #$01 : BEQ +
LDA BootsEquipment : BNE + ; Check for Boots
LDA.b #$00 : RTL
+
LDA.w TileActBE : AND.b #$70 ; things we wrote over
LDA $02EF : AND.b #$70 ; things we wrote over
RTL
;--------------------------------------------------------------------------------
GravestoneHook:
LDA.l BootsModifier : CMP.b #$01 : BEQ +
LDA.l BootsEquipment : BEQ .done ; Check for Boots
LDA !BOOTS_MODIFIER : CMP.b #$01 : BEQ +
LDA BootsEquipment : BEQ .done ; Check for Boots
+
LDA.w LinkDashing : BEQ .done ; things we wrote over
JML moveGravestone
LDA $0372 : BEQ .done ; things we wrote over
JML.l moveGravestone
.done
JML GravestoneHook_continue
JML.l GravestoneHook_continue
;--------------------------------------------------------------------------------
JumpDownLedge:
LDA.l BootsModifier : CMP.b #$01 : BEQ +
LDA.l BootsEquipment : BNE + ; Check for Boots
LDA !BOOTS_MODIFIER : CMP.b #$01 : BEQ +
LDA BootsEquipment : BNE + ; Check for Boots
; Disarm Waterwalk
LDA.b LinkSlipping : CMP.b #$01 : BNE +
STZ.b LinkSlipping
LDA $5B : CMP.b #$01 : BNE +
STZ $5B
+
LDA.b IndoorsFlag : BNE .done : LDA.b #$02 : STA.b LinkLayer ; things we wrote over
LDA $1B : BNE .done : LDA.b #$02 : STA $EE ; things we wrote over
.done
RTL
;--------------------------------------------------------------------------------
BonkRecoil:
LDA.l BootsModifier : CMP.b #$01 : BEQ +
LDA.l BootsEquipment : BNE + ; Check for Boots
LDA.b #$16 : STA.b LinkRecoilZ : RTL
LDA !BOOTS_MODIFIER : CMP.b #$01 : BEQ +
LDA BootsEquipment : BNE + ; Check for Boots
LDA.b #$16 : STA $29 : RTL
+
LDA.b #$24 : STA.b LinkRecoilZ ; things we wrote over
LDA.b #$24 : STA $29 ; things we wrote over
RTL
;--------------------------------------------------------------------------------
BonkRecoilStop:
LDA.l BootsModifier : CMP.b #$01 : BEQ .return
LDA.l BootsEquipment : BNE .return
LDA.b LinkState : CMP.b #$02 : BNE .return
LDA.b LinkPosZ : BMI .return : CMP.b #$09 : BCC .return
LDA.b FrameCounter : AND.b #$01 : BNE .return
REP #$20
LDA.w $0114 : CMP.w #$0020 : SEP #$20 : BNE .return
LDA.b LinkRecoilY : BEQ ++ : BMI +
DEC : BRA ++
+ INC
++ STA.b LinkRecoilY
LDA.b LinkRecoilX : BEQ ++ : BMI +
DEC : BRA ++
+ INC
++ STA.b LinkRecoilX
.return
JML LinkHop_FindArbitraryLandingSpot

View File

@@ -1,12 +1,20 @@
;================================================================================
;--------------------------------------------------------------------------------
AssignKiki:
LDA.b #$00 : STA FollowerDropped ; defuse bomb
LDA.b #$0A : STA FollowerIndicator ; assign kiki as follower
RTL
;--------------------------------------------------------------------------------
;--------------------------------------------------------------------------------
; Name: AllowSQ
; Returns: Accumulator = 0 if S&Q is disallowed, 1 if allowed
;--------------------------------------------------------------------------------
!ITEM_BUSY = "$7F5091"
AllowSQ:
LDA.l ProgressIndicator : BEQ .done ; thing we overwrote - check if link is in his bed
LDA.l BusyItem : EOR.b #$01
LDA ProgressIndicator : BEQ .done ; thing we overwrote - check if link is in his bed
LDA !ITEM_BUSY : EOR #$01
.done
RTL
;--------------------------------------------------------------------------------
@@ -15,8 +23,8 @@ RTL
;0 = Reset Music
;1 = Don't Reset Music
MSMusicReset:
LDA.b OverworldIndex : CMP.b #$80 : BNE +
LDA.b LinkPosX+1
LDA $8A : CMP.b #$80 : BNE +
LDA $23
+
RTL
;--------------------------------------------------------------------------------
@@ -24,11 +32,11 @@ RTL
;--------------------------------------------------------------------------------
;0 = Become (Perma)bunny
DecideIfBunny:
LDA.l MoonPearlEquipment : BNE .done
LDA.l CurrentWorld : AND.b #$40
LDA MoonPearlEquipment : BNE .done
LDA CurrentWorld : AND.b #$40
PHA : LDA.l InvertedMode : BNE .inverted
.normal
PLA : EOR.b #$40
PLA : EOR #$40
BRA .done
.inverted
PLA
@@ -39,25 +47,34 @@ RTL
DecideIfBunnyByScreenIndex:
; If indoors we don't have a screen index. Return non-bunny to make mirror-based
; superbunny work
LDA.b IndoorsFlag : BNE .done
LDA.l MoonPearlEquipment : BNE .done
PHX : LDX.b OverworldIndex : LDA.l OWTileWorldAssoc, X : PLX : PHA
LDA $1B : BNE .done
LDA MoonPearlEquipment : BNE .done
PHX : LDX $8A : LDA.l OWTileWorldAssoc, X : PLX : PHA
LDA.l InvertedMode : BNE .inverted
.normal
PLA : EOR.b #$40
PLA : EOR #$40
BRA .done
.inverted
PLA
.done
RTL
;--------------------------------------------------------------------------------
;--------------------------------------------------------------------------------
;ReadInventoryPond:
; CPX.b #$1B : BNE + : LDA.b #$01 : RTL : +
; LDA EquipmentWRAM, X
;RTL
;--------------------------------------------------------------------------------
;--------------------------------------------------------------------------------
FixBunnyOnExitToLightWorld:
LDA.w BunnyFlag : BEQ +
JSL DecideIfBunny : BEQ +
STZ.b LinkState ; set player mode to Normal
STZ.w BunnyFlag : STZ.b BunnyFlagDP ; return player graphics to normal
LDA.w $02E0 : BEQ +
JSL.l DecideIfBunny : BEQ +
STZ $5D ; set player mode to Normal
STZ $02E0 : STZ $56 ; return player graphics to normal
+
RTL
RTS
;--------------------------------------------------------------------------------
;--------------------------------------------------------------------------------
@@ -66,23 +83,26 @@ RTL
FixAga2Bunny:
LDA.l FixFakeWorld : BEQ + ; Only use this fix is fakeworld fix is in use
LDA.l InvertedMode : BEQ +++
LDA.b #$00 : STA.l CurrentWorld ; Switch to light world
LDA.b #$00 : STA CurrentWorld ; Switch to light world
BRA ++
+++
LDA.b #$40 : STA.l CurrentWorld ; Switch to dark world
LDA.b #$40 : STA CurrentWorld ; Switch to dark world
++
JSL DecideIfBunny : BNE +
JSR MakeBunny
LDA.b #$04 : STA.w $012C ; play bunny music
BRA .done
+
.done
JML Overworld_DetermineAndSetMusic
LDA.b #$09 : STA.w $012C ; what we wrote over
.done
RTL
;--------------------------------------------------------------------------------
;--------------------------------------------------------------------------------
MakeBunny:
PHX : PHY
LDA.b #$17 : STA.b LinkState ; set player mode to permabunny
LDA.b #$01 : STA.w BunnyFlag : STA.b BunnyFlagDP ; make player look like bunny
LDA.b #$17 : STA $5D ; set player mode to permabunny
LDA.b #$01 : STA $02E0 : STA $56 ; make player look like bunny
JSL LoadGearPalettes_bunny
PLY : PLX
RTS
@@ -110,27 +130,27 @@ RTL
; Fix for SQ jumping causing accidental Exploration Glitch
SQEGFix:
LDA.l Bugfix_PodEG : BEQ ++
STZ.w LayerAdjustment ; disarm exploration glitch
STZ.w $047A ; disarm exploration glitch
++ RTL
;--------------------------------------------------------------------------------
; Fix crystal not spawning when using somaria vs boss
TryToSpawnCrystalUntilSuccess:
STX.w ItemReceiptID ; what we overwrote
STX $02D8 ; what we overwrote
JSL AddAncillaLong : BCS .failed ; a clear carry flag indicates success
.spawned
STZ.b RoomTag ; the "trying to spawn crystal" flag
STZ.b RoomTag+1 ; the "trying to spawn pendant" flag
STZ $AE ; the "trying to spawn crystal" flag
STZ $AF ; the "trying to spawn pendant" flag
.failed
RTL
;--------------------------------------------------------------------------------
; Fix crystal not spawning when using somaria vs boss
WallmasterCameraFix:
STZ.b CameraBoundV ; disable vertical camera scrolling for current room
STZ $A7 ; disable vertical camera scrolling for current room
REP #$20
STZ.w CameraScrollN ; something about scrolling, setting these to 0 tricks the game
STZ.w CameraScrollS ; into thinking we're at the edge of the room so it doesn't scroll.
STZ $0618 ; something about scrolling, setting these to 0 tricks the game
STZ $061A ; into thinking we're at the edge of the room so it doesn't scroll.
SEP #$20
JML Sound_SetSfx3PanLong ; what we wrote over, also this will RTL
@@ -138,8 +158,8 @@ WallmasterCameraFix:
; Fix losing glove colors
LoadActualGearPalettesWithGloves:
REP #$20
LDA.l SwordEquipment : STA.b Scrap0C
LDA.l ArmorEquipment : AND.w #$00FF
LDA SwordEquipment : STA $0C
LDA ArmorEquipment : AND.w #$00FF
JSL LoadGearPalettes_variable
JSL SpriteSwap_Palette_ArmorAndGloves_part_two
RTL
@@ -147,24 +167,24 @@ RTL
;--------------------------------------------------------------------------------
; Fix Bunny Palette Map Bug
LoadGearPalette_safe_for_bunny:
LDA.b GameMode
LDA $10
CMP.w #$030E : BEQ .new ; opening dungeon map
CMP.w #$070E : BEQ .new ; opening overworld map
.original
-
LDA.b [Scrap00]
STA.l PaletteBufferAux, X
STA.l PaletteBuffer, X
INC.b Scrap00 : INC.b Scrap00
LDA [$00]
STA $7EC300, X
STA $7EC500, X
INC $00 : INC $00
INX #2
DEY
BPL -
RTL
.new
-
LDA.b [Scrap00]
STA.l PaletteBuffer, X
INC.b Scrap00 : INC.b Scrap00
LDA [$00]
STA $7EC500, X
INC $00 : INC $00
INX #2
DEY
BPL -
@@ -173,59 +193,16 @@ RTL
;--------------------------------------------------------------------------------
; Fix pedestal pull overlay
PedestalPullOverlayFix:
LDA.b #$09 : STA.w AncillaGeneralF, X ; the thing we wrote over
LDA.b IndoorsFlag : BNE +
LDA.b OverworldIndex : CMP.b #$80 : BNE +
LDA.b OverlayID : CMP.b #$97
LDA.b #$09 : STA $039F, X ; the thing we wrote over
LDA $1B : BNE +
LDA $8A : CMP.b #$80 : BNE +
LDA $8C : CMP.b #$97
+
RTL
PostFixMirrorGfxPrep:
LDA.b #$01 : STA.w OWTransitionFlag
JML HandleFollowersAfterMirroring ; what we wrote over
; warning, this is called on frames after PostFixMirrorGfxPrep but for
; several frames after, so we use OWTransitionFlag to run something once
PostFixMirrorGfx:
STA.w SubModuleInterface ; what we wrote over
LDA.w OWTransitionFlag : CMP.b #$01 : BNE .done
LDA.b #$08 : STA.w OWTransitionFlag
JML FollowerGfxRedraw
.done
RTL
PostFixOAMGfx:
JSL FollowerGfxRedraw
REP #$30 : LDA.w #$2000 ; what we wrote over
RTL
;--------------------------------------------------------------------------------
; Fix losing VRAM gfx when using quake
PostNMIUpdateBGCharHalf:
STA.w DMAENABLE : SEP #$10 ; what we wrote over
LDA.w VRAMTileMapIndex : CMP.b #$46 : BNE .return ; checks to see if this is the last VRAM write
LDA.b LinkState : CMP.b #$08 : BCC + : CMP.b #$0A+1 : BCS + ; skip if we're mid-medallion
RTL
+ JSL DynamicDropGFXClear
JSL HeartPieceSetRedraw ; set redraw flag for items
.return
RTL
; Force redraws of items following map checks
PostOverworldGfxLoad:
INC.b GameSubMode : STZ.b INIDISPQ ; what we wrote over
JSL DynamicDropGFXClear
JSL HeartPieceSetRedraw
RTL
PostUnderworldMap:
JSL DynamicDropGFXClear
JSL HeartPieceSetRedraw
LDA.l $7EC229 ; what we wrote over
RTL
;--------------------------------------------------------------------------------
FixJingleGlitch:
LDA.b GameSubMode
LDA.b $11
BEQ .set_doors
LDA.l AllowAccidentalMajorGlitch
@@ -233,7 +210,7 @@ FixJingleGlitch:
.set_doors
LDA.b #$05
STA.b GameSubMode
STA.b $11
.exit
RTL
@@ -245,109 +222,7 @@ pushpc
pullpc
;--------------------------------------------------------------------------------
SetOverworldTransitionFlags:
LDA.b #$01
STA.w OWTransitionFlag
STA.w RaceGameFlag
LDA #$01
STA $0ABF ; used by witch
STA $021B ; used by race game
RTL
;--------------------------------------------------------------------------------
ParadoxCaveGfxFix:
; Always upload line unless you're moving into paradox cave (0x0FF) from above (0x0EF)
LDA.b IndoorsFlag : BEQ .uploadLine
LDX.b RoomIndex : CPX.w #$00FF : BNE .uploadLine
LDX.b PreviousRoom : CPX.w #$00EF : BNE .uploadLine
;Ignore uploading four specific lines of tiles to VRAM
LDX.w VRAMUploadAddress
; Line 1
CPX.w #$1800 : BEQ .skipMostOfLine
; Line 2
CPX.w #$1A00 : BEQ .skipMostOfLine
; Line 3
CPX.w #$1C00 : BEQ .uploadLine
; Line 4
CPX.w #$1E00 : BEQ .uploadLine
.uploadLine
LDA.b #$01 : STA.w DMAENABLE
.skipLine
JML FollowerGfxRedraw
.skipMostOfLine
; Set line length to 192 bytes (the first 6 8x8 tiles in the line)
LDX.w #$00C0 : STX.w DAS0L
BRA .uploadLine
;--------------------------------------------------------------------------------
SetItemRiseTimer:
LDA.w ItemReceiptMethod : CMP.b #$01 : BNE .not_from_chest
LDA.b #$38 : STA.w AncillaTimer, X
RTL
.not_from_chest
JSL.l ItemIsJunk
BEQ .default
.junk
LDA.l JunkItemTimer : AND.b #$3F : STA.w AncillaTimer, X
RTL
.default
TYA : STA.w AncillaTimer, X ; What we wrote over
RTL
;--------------------------------------------------------------------------------
ItemIsJunk:
PHX
LDA.l JunkItemTimer : BIT.b #$3F : BEQ .not_junk
BIT.b #$80 : BNE .check
LDA.l !MULTIWORLD_ITEM_PLAYER_ID : BNE .check
LDA.l !MULTIWORLD_RECEIVING_ITEM : BNE .check
BRA .not_junk
.check
LDA.l JunkItemTimer : AND.b #$40
BEQ +
LDA.b #JunkItems_triforce_end-JunkItems_end
+
CLC : ADC.b #JunkItems_end-JunkItems-1
LDA.w AncillaGet, X
TAX
-
CMP.l JunkItems, X : BEQ .junk
DEX : BPL -
.not_junk
PLX
LDA.b #$00
RTL
.junk
PLX
LDA.b #$01
RTL
RTL
JunkItems:
db $27 ; Bomb
db $28 ; 3 bombs
db $31 ; 10 bombs
db $34 ; 1 rupee
db $35 ; 5 rupees
db $36 ; 20 rupees
db $40 ; 100 rupees
db $41 ; 50 rupees
db $42 ; Heart
db $43 ; Arrow
db $44 ; 10 arrows
db $45 ; Small magic
db $46 ; 300 rupees
db $47 ; 20 rupees green
db $59 ; Rupoor
db $D1 ; Apples
db $D2 ; Fairy
db $D3 ; Chicken
db $D4 ; Big Magic
db $D5 ; 5 Arrows
db $D6 ; Good Bee
.end
db $6B ; Power Star
db $6C ; Triforce Piece
.triforce_end
;--------------------------------------------------------------------------------

View File

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

View File

@@ -1,8 +1,5 @@
#!/bin/bash
rm ../alttp.sfc
cp ~/dev/kwyn/orig/z3.sfc ../alttp.sfc
asar --symbols=wla LTTP_RND_GeneralBugfixes.asm ../alttp.sfc
flips ~/dev/kwyn/orig/z3.sfc ../alttp.sfc ../base2current.bps
md5sum ../alttp.sfc | tee /dev/tty | cut -d ' ' -f 1 | xargs -I '{}' sed -i "s/RANDOMIZERBASEHASH = '.\+'/RANDOMIZERBASEHASH = '{}'/g" ~/dev/kwyn/doors/Rom.py
cp ../base2current.bps ~/dev/kwyn/doors/data
rm ../working.sfc
cp ../alttp.sfc ../working.sfc
./asar LTTP_RND_GeneralBugfixes.asm ../working.sfc

View File

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

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

Binary file not shown.

BIN
c2e3e.gfx Normal file

Binary file not shown.

View File

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

42
catfish.asm Normal file
View File

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

248
clock.asm Normal file
View File

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

72
compasses.asm Normal file
View File

@@ -0,0 +1,72 @@
;--------------------------------------------------------------------------------
; $7F5010 - Scratch Space
;--------------------------------------------------------------------------------
DrawDungeonCompassCounts:
SEP #$10
LDX $1B : BNE + : RTL : + ; Skip if outdoors
; extra hard safeties for getting dungeon ID to prevent crashes
PHA
LDA.w $040C : AND.w #$00FE : TAX ; force dungeon ID to be multiple of 2
PLA
CPX.b #$1B : BCC + ; Skip if not in a valid dungeon ID
JMP .done
+
BIT.w #$0002 : BNE ++ ; if CompassMode==2, we don't check for the compass
TXY : TXA : LSR : TAX : LDA.l ExistsTransfer, X : TAX : LDA CompassExists, X : BEQ ++
TYX : LDA CompassField : AND.l DungeonItemMasks, X ; Load compass values to A, mask with dungeon item masks
BNE ++
JMP .done ; skip if we don't have compass
++
LDA $040C : LSR
BNE +
INC
+ TAX : LDA.l CompassTotalsWRAM, X : AND #$00FF
PHX
PHA
JSL HexToDec_fast
PLA : CMP.w #100 : !BLT .two_digit
LDX.b $05 : TXA : ORA #$2490 : STA $7EC79A
LDX.b $06 : TXA : ORA #$2490 : STA $7EC79C
LDX.b $07 : TXA : ORA #$2490 : STA $7EC79E
BRA .end_total
.two_digit
LDX.b $06 : TXA : ORA #$2490 : STA $7EC79A
LDX.b $07 : TXA : ORA #$2490 : STA $7EC79C
.end_total
PLX
LDA DungeonLocationsChecked, X : AND #$00FF
PHA
JSL HexToDec_fast
PLA : CMP.w #100 : !BLT +
LDX.b $05 : TXA : ORA #$2490 : STA $7EC792 ; Draw the 100's digit
+
LDX.b $06 : TXA : ORA #$2490 : STA $7EC794 ; Draw the item count
LDX.b $07 : TXA : ORA #$2490 : STA $7EC796
LDA.w #$2830 : STA $7EC798 ; draw the slash
.done
RTL
DungeonItemMasks: ; these are dungeon correlations to $7EF364 - $7EF369 so it knows where to store compasses, etc
dw $8000, $4000, $2000, $1000, $0800, $0400, $0200, $0100
dw $0080, $0040, $0020, $0010, $0008, $0004
; maps from $040C to the odd order used in overworld map
ExistsTransfer:
db $0C, $0C, $00, $02, $0B, $09, $03, $07, $04, $08, $01, $06, $05, $0A
;--------------------------------------------------------------------------------
; $7EF4C0-7EF4CF - item locations checked indexed by $040C >> 1
;--------------------------------------------------------------------------------
InitCompassTotalsRAM:
LDX #$00
-
LDA CompassTotalsROM, X : STA CompassTotalsWRAM, X
INX
CPX #$0F : !BLT -
RTL

29
compression.asm Normal file
View File

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

185
contrib.asm Normal file
View File

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

View File

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

42
creditscharmapbighi.txt Normal file
View File

@@ -0,0 +1,42 @@
=9F
0=53
1=54
2=55
3=56
4=57
5=58
6=59
7=5A
8=5B
9=5C
A=5D
B=5E
C=5F
D=60
E=61
F=62
G=63
H=64
I=65
J=66
K=67
L=68
M=69
N=6A
O=6B
P=6C
Q=6D
R=6E
S=6F
T=70
U=71
V=72
W=73
X=74
Y=75
Z=76
'=77
.=A0
/=A2
:=A3
_=A6

42
creditscharmapbiglo.txt Normal file
View File

@@ -0,0 +1,42 @@
=9F
0=79
1=7A
2=7B
3=7C
4=7D
5=7E
6=7F
7=80
8=81
9=82
A=83
B=84
C=85
D=86
E=87
F=88
G=89
H=8A
I=8B
J=8C
K=8D
L=8E
M=8F
N=90
O=91
P=92
Q=93
R=94
S=95
T=96
U=97
V=98
W=99
X=9A
Y=9B
Z=9C
'=9d
.=C0
/=C2
:=C3
_=C6

View File

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

View File

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

View File

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

View File

@@ -1,52 +0,0 @@
pushpc
org $87A46E
JSL CheckBookTriggerSwitch
BCS +
skip 15
+
org $8296A8
JSL FinishPegChange
pullpc
FinishPegChange:
LDA.b #$20
TRB.w $037A
STZ.b $B0
STZ.b $11
RTL
CheckBookTriggerSwitch:
LDA.l CrystalSwitchBook
BEQ +
LDA.b $10
CMP.b #$07
BNE +
LDA.l $7EC172
EOR.b #$01
STA.l $7EC172
LDA.b #$16
STA.b $11
LDA.b #$20
TSB.w $037A
LDA.b #$25
JSL $8DBB8A
SEC
BRA .done
+ CLC
.done
; what we wrote over
LDA.b $3A
AND.b #$BF
STA.b $3A
RTL

View File

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

View File

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

Binary file not shown.

Binary file not shown.

27
darkroomitems.asm Normal file
View File

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

View File

@@ -2,105 +2,94 @@
; Dark World Spawn Location Fix & Master Sword Grove Fix
;--------------------------------------------------------------------------------
DarkWorldSaveFix:
JSL MasterSwordFollowerClear
JML StatSaveCounter
LDA.b #$70 : PHA : PLB ; thing we wrote over - data bank change
JSL.l MasterSwordFollowerClear
JML.l StatSaveCounter
;--------------------------------------------------------------------------------
DoWorldFix:
LDA.l InvertedMode : BEQ +
LDA InvertedMode : BEQ +
JMP DoWorldFix_Inverted
+
LDA FollowerIndicator : CMP #$04 : BEQ .aga1Alive ; if old man following, skip mirror/aga check
LDA.l Bugfix_MirrorlessSQToLW : BEQ .skip_mirror_check
LDA.l FollowerIndicator : CMP.b #$04 : BNE + ; if old man following, skip mirror/aga check
LDA.l FollowerTravelAllowed : CMP.b #$02 : BEQ +
LDA.l OldManRetrievalWorld
BRA .noMirror
+ LDA.l MirrorEquipment : AND.b #$02 : BEQ .noMirror ; check if we have the mirror
LDA MirrorEquipment : AND #$02 : BEQ .noMirror ; check if we have the mirror
.skip_mirror_check ; alt entrance point
LDA.l ProgressIndicator : CMP.b #$03 : BCS .done ; check if agahnim 1 is alive
.setLightWorld
LDA.b #$00
LDA ProgressIndicator : CMP.b #$03 : BCS .done ; check if agahnim 1 is alive
.aga1Alive
LDA #$00
.noMirror
STA.l CurrentWorld ; set flag to light world
STA CurrentWorld ; set flag to light world
LDA.l SmithDeleteOnSave : BEQ .transform
LDA.l FollowerIndicator
CMP.b #$07 : BEQ .clear ; clear frog
CMP.b #$08 : BEQ .clear ; clear dwarf - consider flute implications
LDA FollowerIndicator
CMP #$07 : BEQ .clear ; clear frog
CMP #$08 : BEQ .clear ; clear dwarf - consider flute implications
BRA .done
.clear
LDA.b #$00 : STA.l FollowerIndicator : BRA .done ; clear follower
LDA.b #$00 : STA FollowerIndicator : BRA .done ; clear follower
.transform
LDA.l FollowerIndicator : CMP.b #$07 : BNE .done : INC : STA.l FollowerIndicator ; convert frog to dwarf
LDA FollowerIndicator : CMP #$07 : BNE .done : INC : STA FollowerIndicator ; convert frog to dwarf
.done
RTL
;--------------------------------------------------------------------------------
SetDeathWorldChecked:
LDA.l InvertedMode : BEQ +
LDA InvertedMode : BEQ +
JMP SetDeathWorldChecked_Inverted
+
LDA.b IndoorsFlag : BEQ .outdoors
LDA.w DungeonID : CMP.b #$FF : BNE .dungeon
LDA.b RoomIndex : ORA.b RoomIndex+1 : BNE ++
LDA.l GanonPyramidRespawn : BNE .pyramid ; if flag is set, force respawn at pyramid on death to ganon
++
LDA $1B : BEQ .outdoors
LDA $040C : CMP #$FF : BNE .dungeon
LDA $A0 : ORA $A1 : BNE ++
LDA GanonPyramidRespawn : BNE .pyramid ; if flag is set, force respawn at pyramid on death to ganon
++
.outdoors
JMP DoWorldFix
.dungeon
LDA.l MosaicLevel : BNE .dontfix ; this is a sanc & quit
LDA.l Bugfix_PreAgaDWDungeonDeathToFakeDW : BNE .done ; if the bugfix is enabled, we do nothing on death in dungeon
.dontfix
JMP DoWorldFix_skip_mirror_check
LDA Bugfix_PreAgaDWDungeonDeathToFakeDW : BNE .done ; if the bugfix is enabled, we do nothing on death in dungeon
JMP DoWorldFix_skip_mirror_check
.pyramid
LDA.b #$40 : STA.l CurrentWorld ; set flag to dark world
LDA.l FollowerIndicator : CMP.b #$08 : BNE .done : DEC : STA.l FollowerIndicator : + ; convert dwarf to frog
LDA #$40 : STA CurrentWorld ; set flag to dark world
LDA FollowerIndicator : CMP #$08 : BNE .done : DEC : STA FollowerIndicator : + ; convert dwarf to frog
.done
RTL
;================================================================================
DoWorldFix_Inverted:
LDA FollowerIndicator : CMP #$04 : BEQ .aga1Alive ; if old man following, skip mirror/aga check
LDA.l Bugfix_MirrorlessSQToLW : BEQ .skip_mirror_check
LDA.l FollowerIndicator : CMP.b #$04 : BNE + ; if old man following, skip mirror/aga check
LDA.l FollowerTravelAllowed : CMP.b #$02 : BEQ +
LDA.l OldManRetrievalWorld
BRA .setWorld
+ LDA.l MirrorEquipment : AND.b #$02 : BEQ .noMirror ; check if we have the mirror
LDA.l MirrorEquipment : AND #$02 : BEQ .noMirror ; check if we have the mirror
.skip_mirror_check ; alt entrance point
LDA.l ProgressIndicator : CMP.b #$03 : BCS .done ; check if agahnim 1 is alive
LDA ProgressIndicator : CMP.b #$03 : BCS .done ; check if agahnim 1 is alive
.noMirror
.setDarkWorld
LDA.b #$40
.setWorld
STA.l CurrentWorld ; set flag to dark world
.aga1Alive
LDA #$40 : STA CurrentWorld ; set flag to dark world
LDA.l SmithDeleteOnSave : BEQ .transform
LDA.l FollowerIndicator
CMP.b #$07 : BEQ .clear ; clear frog
CMP.b #$08 : BEQ .clear ; clear dwarf - consider flute implications
LDA FollowerIndicator
CMP #$07 : BEQ .clear ; clear frog
CMP #$08 : BEQ .clear ; clear dwarf - consider flute implications
BRA .done
.clear
LDA.b #$00 : STA.l FollowerIndicator : BRA .done ; clear follower
LDA.b #$00 : STA FollowerIndicator : BRA .done ; clear follower
.transform
LDA.l FollowerIndicator : CMP.b #$07 : BNE .done : INC : STA.l FollowerIndicator ; convert frog to dwarf
LDA FollowerIndicator : CMP #$07 : BNE .done : INC : STA FollowerIndicator ; convert frog to dwarf
.done
RTL
;--------------------------------------------------------------------------------
SetDeathWorldChecked_Inverted:
LDA.b IndoorsFlag : BEQ .outdoors
LDA.w DungeonID : CMP.b #$FF : BNE .dungeon
LDA.b RoomIndex : ORA.b RoomIndex+1 : BNE ++
LDA.l GanonPyramidRespawn : BNE .castle ; if flag is set, force respawn at pyramid on death to ganon
LDA $1B : BEQ .outdoors
LDA $040C : CMP #$FF : BNE .dungeon
LDA $A0 : ORA $A1 : BNE ++
LDA GanonPyramidRespawn : BNE .castle ; if flag is set, force respawn at pyramid on death to ganon
++
.outdoors
JMP DoWorldFix_Inverted
.dungeon
LDA.l MosaicLevel : BNE .dontfix ; this is a sanc & quit
LDA.l Bugfix_PreAgaDWDungeonDeathToFakeDW : BNE .done ; if the bugfix is enabled, we do nothing on death in dungeon
.dontfix
JMP DoWorldFix_Inverted_skip_mirror_check
LDA Bugfix_PreAgaDWDungeonDeathToFakeDW : BNE .done ; if the bugfix is enabled, we do nothing on death in dungeon
JMP DoWorldFix_Inverted_skip_mirror_check
.castle
LDA.b #$00 : STA.l CurrentWorld ; set flag to dark world
LDA.l FollowerIndicator : CMP.b #$07 : BNE + : LDA.b #$08 : STA.l FollowerIndicator : + ; convert frog to dwarf
LDA #$00 : STA CurrentWorld ; set flag to dark world
LDA FollowerIndicator : CMP #$07 : BNE + : LDA.b #$08 : STA FollowerIndicator : + ; convert frog to dwarf
.done
RTL
;================================================================================
@@ -108,34 +97,22 @@ RTL
;--------------------------------------------------------------------------------
FakeWorldFix:
LDA.l FixFakeWorld : BEQ +
LDA FixFakeWorld : BEQ +
PHX
LDX.b OverworldIndex : LDA.l OWTileWorldAssoc, X : STA.l CurrentWorld
LDX $8A : LDA.l OWTileWorldAssoc, X : STA CurrentWorld
PLX
+
RTL
;--------------------------------------------------------------------------------
GetCurrentWorldForLoad:
LDA.l FollowerTravelAllowed : CMP.b #$02 : BEQ .default
LDA.l FollowerIndicator : CMP.b #$04 : BNE .default
LDA.l InvertedMode : BEQ +
LDA.b #$40
+ RTL
.default
LDA.l CurrentWorld
RTL
;--------------------------------------------------------------------------------
MasterSwordFollowerClear:
LDA.l FollowerIndicator
CMP.b #$0E : BNE .exit ; clear master sword follower
LDA.b #$00 : STA.l FollowerIndicator ; clear follower
LDA FollowerIndicator
CMP #$0E : BNE .exit ; clear master sword follower
LDA.b #$00 : STA FollowerIndicator ; clear follower
.exit
RTL
;--------------------------------------------------------------------------------
FixAgahnimFollowers:
LDA.l FollowerTravelAllowed : CMP.b #$02 : BEQ +
LDA.b #$00 : STA.l FollowerIndicator ; clear follower
+
LDA.b #$00 : STA FollowerIndicator ; clear follower
JML PrepDungeonExit ; thing we wrote over
;--------------------------------------------------------------------------------
@@ -145,53 +122,53 @@ macro SetMinimum(base,filler,compare)
?done:
endmacro
RefreshRainAmmo:
LDA.l ProgressIndicator : CMP.b #$01 : BEQ .rain ; check if we're in rain state
LDA ProgressIndicator : CMP.b #$01 : BEQ .rain ; check if we're in rain state
RTL
.rain
LDA.l StartingEntrance
LDA StartingEntrance
+ CMP.b #$03 : BNE + ; Uncle
%SetMinimum(CurrentMagic,MagicFiller,RainDeathRefillMagic_Uncle)
%SetMinimum(BombsEquipment,BombsFiller,RainDeathRefillBombs_Uncle)
LDA.l ArrowMode : BEQ ++
LDA.l BowEquipment : BEQ +++
++ %SetMinimum(CurrentArrows,ArrowsFiller,RainDeathRefillArrows_Uncle)
+++ BRA .done
%SetMinimum(CurrentArrows,ArrowsFiller,RainDeathRefillArrows_Uncle)
BRA .done
+ CMP.b #$02 : BNE + ; Cell
%SetMinimum(CurrentMagic,MagicFiller,RainDeathRefillMagic_Cell)
%SetMinimum(BombsEquipment,BombsFiller,RainDeathRefillBombs_Cell)
LDA.l ArrowMode : BEQ ++
LDA.l BowEquipment : BEQ .done
++ %SetMinimum(CurrentArrows,ArrowsFiller,RainDeathRefillArrows_Cell)
%SetMinimum(CurrentArrows,ArrowsFiller,RainDeathRefillArrows_Cell)
BRA .done
+ CMP.b #$04 : BNE + ; Mantle
%SetMinimum(CurrentMagic,MagicFiller,RainDeathRefillMagic_Mantle)
%SetMinimum(BombsEquipment,BombsFiller,RainDeathRefillBombs_Mantle)
LDA.l ArrowMode : BEQ ++
LDA.l BowEquipment : BEQ .done
++ %SetMinimum(CurrentArrows,ArrowsFiller,RainDeathRefillArrows_Mantle)
%SetMinimum(CurrentArrows,ArrowsFiller,RainDeathRefillArrows_Mantle)
+
.done
RTL
;--------------------------------------------------------------------------------
SetEscapeAssist:
LDA.l ProgressIndicator : CMP.b #$01 : BNE .no_train ; check if we're in rain state
LDA ProgressIndicator : CMP.b #$01 : BNE .no_train ; check if we're in rain state
.rain
LDA.l EscapeAssist
BIT.b #$04 : BEQ + : STA.l InfiniteArrows : +
BIT.b #$02 : BEQ + : STA.l InfiniteBombs : +
BIT.b #$01 : BEQ + : STA.l InfiniteArrows : +
BIT.b #$04 : BEQ + : STA InfiniteMagicModifier : +
BIT.b #$02 : BEQ + : STA InfiniteBombsModifier : +
BIT.b #$01 : BEQ + : STA InfiniteArrowsModifier : +
BRA ++
.no_train ; choo choo
LDA.l EscapeAssist : BIT.b #$04 : BEQ + : LDA.b #$00 : STA.l InfiniteMagic : +
LDA.l EscapeAssist : BIT.b #$02 : BEQ + : LDA.b #$00 : STA.l InfiniteBombs : +
LDA.l EscapeAssist : BIT.b #$01 : BEQ + : LDA.b #$00 : STA.l InfiniteArrows : +
LDA.l EscapeAssist
BIT.b #$40 : BEQ + : STA InfiniteMagicModifier : +
BIT.b #$20 : BEQ + : STA InfiniteBombsModifier : +
BIT.b #$10 : BEQ + : STA InfiniteArrowsModifier : +
++
LDA.l SpecialWeapons : CMP #$01 : BNE +
LDA.l SpecialWeaponLevel : BEQ +
LDA #$01 : STA InfiniteBombsModifier
+
RTL
;--------------------------------------------------------------------------------
SetSilverBowMode:
LDA.l SilverArrowsUseRestriction : BEQ + ; fix bow type for restricted arrow mode
LDA.l BowEquipment : CMP.b #$3 : BCC +
SBC.b #$02 : STA.l BowEquipment
LDA SilverArrowsUseRestriction : BEQ + ; fix bow type for restricted arrow mode
LDA BowEquipment : CMP.b #$3 : BCC +
SBC.b #$02 : STA BowEquipment
+
RTL
;================================================================================

Binary file not shown.

View File

@@ -1,79 +0,0 @@
=9F
0=53
1=54
2=55
3=56
4=57
5=58
6=59
7=5A
8=5B
9=5C
A=5D
B=5E
C=5F
D=60
E=61
F=62
G=63
H=64
I=65
J=66
K=67
L=68
M=69
N=6A
O=6B
P=6C
Q=6D
R=6E
S=6F
T=70
U=71
V=72
W=73
X=74
Y=75
Z=76
a=A0
b=A1
c=A2
d=A3
e=A4
f=A5
g=A6
h=A7
i=A8
j=A9
k=AA
l=AB
m=AC
n=AD
o=AE
p=AF
q=B0
r=B1
s=B2
t=B3
u=B4
v=B5
w=B6
x=B7
y=B8
z=B9
'=D9
"=DA
/=DB
.=DC
:=DD
_=DE
^=DF
&=E0
#=E1
@=E2
>=E3
?=E4
!=E5
~=E6
,=E7
-=E8

View File

@@ -1,79 +0,0 @@
=9F
0=79
1=7A
2=7B
3=7C
4=7D
5=7E
6=7F
7=80
8=81
9=82
A=83
B=84
C=85
D=86
E=87
F=88
G=89
H=8A
I=8B
J=8C
K=8D
L=8E
M=8F
N=90
O=91
P=92
Q=93
R=94
S=95
T=96
U=97
V=98
W=99
X=9A
Y=9B
Z=9C
a=BB
b=BC
c=BD
d=BE
e=BF
f=C0
g=C1
h=C2
i=C3
j=C4
k=C5
l=C6
m=C7
n=C8
o=C9
p=CA
q=CB
r=CC
s=CD
t=CE
u=CF
v=D0
w=D1
x=D2
y=D3
z=D4
'=EC
"=ED
/=EE
.=EF
:=F0
_=F1
^=F2
&=F3
#=F4
@=F5
>=F6
?=F7
!=F8
~=F9
,=FA
-=FB

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

View File

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

View File

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

Binary file not shown.

Binary file not shown.

View File

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

Binary file not shown.

View File

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

View File

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Binary file not shown.

View File

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

View File

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

View File

@@ -1,679 +0,0 @@
;===================================================================================================
; Get the item's graphic from WRAM/ROM
; Bit 7 set indicates an explicit WRAM address
; Bit 7 reset indicates an offset into the ROM buffer
;===================================================================================================
;---------------------------------------------------------------------------------------------------
; Enters with A for parameter
;---------------------------------------------------------------------------------------------------
TransferItemReceiptToBuffer_using_GraphicsID:
PHP
PHB
REP #$30
PHX
PHY
SEP #$30
LDX.b #$00
.find_reverse
CMP.l ItemReceipts_graphics,X
BEQ .found
INX
BNE .find_reverse
.found
TXA
REP #$30
BRA ++
;===================================================================================================
TransferRupeesProperly:
PHP
PHB
REP #$31
PHX
PHY
AND.w #$00FF
SBC.w #$0023
XBA
LSR
LSR
LSR
ADC.w #BigDecompressionBuffer+$800
BRA TransferItemReceiptToBuffer_using_ExplicitBufferAddress
;===================================================================================================
TransferItemReceiptToBuffer_using_ReceiptID:
PHP : PHB
REP #$30
PHX : PHY
++ AND.w #$00FF
ASL : TAX
LDA.l BusyItem : BNE +
LDA.l StandingItemGraphicsOffsets,X
BRA .have_address
+
LDA.l ItemReceiptGraphicsOffsets,X
.have_address
BMI TransferItemReceiptToBuffer_using_ExplicitBufferAddress
.rom_address
ADC.w #ItemReceiptGraphicsROM
PHK
BRA .continue
#TransferItemReceiptToBuffer_using_ExplicitBufferAddress:
PEA.w $7F7F
PLB
.continue
PLB
TAY
LDX.w #62
.next_write
LDA.w $003E,Y
STA.l ItemGetGFX+$00,X
LDA.w $023E,Y
STA.l ItemGetGFX+$40,X
DEY
DEY
DEX
DEX
BPL .next_write
REP #$30
PLY
PLX
PLB
PLP
RTL
;===================================================================================================
TransferItemToVRAM:
REP #$21
SEP #$10
LDA.w ItemGFXPtr
BEQ .exit
BMI .wram_address
.rom_address
ADC.w #ItemReceiptGraphicsROM
LDX.b #ItemReceiptGraphicsROM>>16
.set_address
STA.w $4302
ADC.w #$0200
STA.w $4312
STX.w $4304
STX.w $4314
LDX.b #$80
STX.w $2115
LDA.w #$1801
STA.w $4300
STA.w $4310
LDA.w #$0040
STA.w $4305
STA.w $4315
LDA.w ItemGFXTarget
STA.w $2116
LDX.b #$01
STX.w DMAENABLE
ADC.w #$0100
STA.w $2116
INX
STX.w DMAENABLE
STZ.w ItemGFXPtr
STZ.w ItemGFXTarget
.exit
RTL
.wram_address
LDX.b #$7F
BRA .set_address
;===================================================================================================
; Decompress everything at the start of the game
;===================================================================================================
DecompBufferOffset = $18
DecompTestByte = $04
DecompCommand = $02
DecompSize = $00
DecompTileCount = $1A
DecompSaveY = $1A
Decomp3BPPScratch = $20
;===================================================================================================
DecompressAllItemGraphics:
PHP
PHB
PHD
REP #$38
; Stack change for safety
TSX
LDA.w #$1400
TCS
PHX
; direct page change for speed
LDA.w #$1200
TCD
STZ.b DecompBufferOffset
SEP #$34
STA.l $4200 ; already 0 from the LDA above
LDX.b #$5D+$73 : JSR AddGfxSheetToBigBuffer
LDX.b #$5C+$73 : JSR AddGfxSheetToBigBuffer
LDX.b #$5B+$73 : JSR AddGfxSheetToBigBuffer
LDX.b #$5A+$73 : JSR AddGfxSheetToBigBuffer
JSR AddCherryPickGfxToBigBuffer
LDX.b #$01 : STX.w $06FA
LDX.b #$06+$73 : JSR AddGfxSheetToBigBuffer
LDX.b #$07+$73 : JSR AddGfxSheetToBigBuffer
REP #$30
PLX
TXS
SEP #$20
LDA.b #$81
STA.l $4200
PLD
PLB
PLP
RTL
;===================================================================================================
AddGfxSheetToBigBuffer:
SEP #$30
LDA.l GFXSheetPointers_background_bank,X : PHA : PLB
LDA.l GFXSheetPointers_background_high,X : XBA
LDA.l GFXSheetPointers_background_low,X
CPX.b #$73 : !BLT FastSpriteDecomp
CPX.b #$73+$0C : !BGE FastSpriteDecomp
.uncompressed
JMP Direct3BPPConvert
;===================================================================================================
; I normally hate macros like this... but I don't feel like constantly rewriting this
;===================================================================================================
macro GetNextByte()
LDA.w $0000,Y
INY
BNE ?++
; Y pulls more than it needs, but that's fine
; the high byte should only be affected if we somehow have FF as our bank
; and if that happens, we have other problems
PHB
PLY
INY
PHY
PLB
LDY.w #$8000
?++
endmacro
;===================================================================================================
; There's no long vanilla routine, and we're going to make heavy use of this
; so might as well rewrite it to be fast
;===================================================================================================
FastSpriteDecomp:
REP #$10
TAY
LDX.w #$0000
.next_command
%GetNextByte()
CMP.b #$FF
BNE .continue
;---------------------------------------------------------------------------------------------------
JMP Unrolled3BPPConvert
;---------------------------------------------------------------------------------------------------
.continue
CMP.b #$E0
BCS .expanded
STA.b DecompTestByte
REP #$20
AND.w #$001F
BRA .normal
;---------------------------------------------------------------------------------------------------
; Putting some commands up here for branch distance
;---------------------------------------------------------------------------------------------------
.nonrepeating
REP #$21
TYA
ADC.b DecompSize
ORA.w #$8000
STA.b DecompSize
SEP #$20
.next_nonrepeating
%GetNextByte()
STA.l DecompBuffer2,X
INX
CPY.b DecompSize
BNE .next_nonrepeating
BRA .next_command
;---------------------------------------------------------------------------------------------------
.repeating
%GetNextByte()
STY.b DecompSaveY
LDY.b DecompSize
.next_repeating
STA.l DecompBuffer2,X
INX
DEY
BNE .next_repeating
LDY.b DecompSaveY
BRA .next_command
;---------------------------------------------------------------------------------------------------
; Rest of command handling
;---------------------------------------------------------------------------------------------------
.expanded
STA.b DecompCommand
ASL
ASL
ASL
STA.b DecompTestByte
LDA.b DecompCommand
AND.b #$03
XBA
%GetNextByte()
REP #$20
;---------------------------------------------------------------------------------------------------
.normal
INC
STA.b DecompSize
SEP #$20
LDA.b DecompTestByte
AND.b #$E0
BEQ .nonrepeating
BMI .copy
ASL
BPL .repeating
ASL
BPL .repeating_word
;---------------------------------------------------------------------------------------------------
.incremental
%GetNextByte()
STY.b DecompSaveY
LDY.b DecompSize
.next_incremental
STA.l DecompBuffer2,X
INC
INX
DEY
BNE .next_incremental
LDY.b DecompSaveY
JMP .next_command
;---------------------------------------------------------------------------------------------------
.repeating_word
JSR .get_next_word
REP #$20
STY.b DecompSaveY
LDY.b DecompSize
DEY
.next_word
STA.l DecompBuffer2,X
INX
INX
DEY
DEY
BPL .next_word
INY
BEQ .not_too_far
DEX
.not_too_far
SEP #$20
LDY.b DecompSaveY
JMP .next_command
;---------------------------------------------------------------------------------------------------
.copy
JSR .get_next_word
STY.b DecompSaveY
TAY
LDA.b DecompSize
BNE ++
DEC.b DecompSize+1
++ PHB
LDA.b #$7F
PHA
PLB
.next_copy
LDA.w DecompBuffer2,Y
STA.w DecompBuffer2,X
INX
INY
DEC.b DecompSize+0
BNE .next_copy
DEC.b DecompSize+1
BPL .next_copy
PLB
LDY.b DecompSaveY
JMP .next_command
;---------------------------------------------------------------------------------------------------
; These are only used once per command, so I'm fine with letting them be a JSR I guess
;---------------------------------------------------------------------------------------------------
.get_next_word
%GetNextByte()
XBA
%GetNextByte()
XBA
RTS
;===================================================================================================
; More macros, because lazy
;===================================================================================================
macro DoPlanesA(offset)
LDA.w DecompBuffer2+<offset>+<offset>,Y
STA.w BigDecompressionBuffer+<offset>+<offset>,X
ORA.w DecompBuffer2+<offset>+<offset>-1,Y
AND.w #$FF00
STA.b Decomp3BPPScratch
LDA.w DecompBuffer2+$10+<offset>,Y
AND.w #$00FF
TSB.b Decomp3BPPScratch
XBA
ORA.b Decomp3BPPScratch
PHY
LDY.w $06FA : BEQ +
AND.w #$00FF ; idk why this line works but some sheets we pull in aren't correct without it
+
PLY
STA.w BigDecompressionBuffer+$10+<offset>+<offset>,X
endmacro
;===================================================================================================
macro DoIndirectPlanesA(offset)
LDA.b Scrap00 : ADC.w #<offset>+<offset> : STA.b Scrap02
LDA.b (Scrap02),Y
STA.l BigDecompressionBuffer+<offset>+<offset>,X
DEC.b Scrap02
ORA.b (Scrap02),Y
AND.w #$FF00
STA.b Decomp3BPPScratch
LDA.b Scrap00 : ADC.w #$10+<offset> : STA.b Scrap02
LDA.b (Scrap02),Y
AND.w #$00FF
TSB.b Decomp3BPPScratch
XBA
ORA.b Decomp3BPPScratch
PHY
LDY.w $06FA : BEQ +
AND.w #$00FF ; idk why this line works but some sheets we pull in aren't correct without it
+
PLY
STA.l BigDecompressionBuffer+$10+<offset>+<offset>,X
endmacro
;===================================================================================================
Direct3BPPConvert:
REP #$31
STA.b Scrap00
LDY.w #$0000
LDX.b DecompBufferOffset
.next_3bpp_tile
%DoIndirectPlanesA(0) ; 8 times
%DoIndirectPlanesA(1)
%DoIndirectPlanesA(2)
%DoIndirectPlanesA(3)
%DoIndirectPlanesA(4)
%DoIndirectPlanesA(5)
%DoIndirectPlanesA(6)
%DoIndirectPlanesA(7)
; carry will always be clear
; don't worry
TXA
ADC.w #32
TAX
; just trust me
TYA
ADC.w #24
TAY
CMP.w #24*64
BCS .done
JMP .next_3bpp_tile
.done
STX.b DecompBufferOffset
SEP #$30
RTS
;===================================================================================================
Unrolled3BPPConvert:
LDA.b #$7F
PHA
PLB
REP #$21
LDY.w #$0000
LDX.b DecompBufferOffset
.next_3bpp_tile
%DoPlanesA(0) ; 8 times
%DoPlanesA(1)
%DoPlanesA(2)
%DoPlanesA(3)
%DoPlanesA(4)
%DoPlanesA(5)
%DoPlanesA(6)
%DoPlanesA(7)
; carry will always be clear
; don't worry
TXA
ADC.w #32
TAX
; just trust me
TYA
ADC.w #24
TAY
CMP.w #24*64
BCS .done
JMP .next_3bpp_tile
.done
STX.b DecompBufferOffset
SEP #$30
RTS
;===================================================================================================
macro CherryPickGfx(source,dest,length)
LDX.w #BigDecompressionBuffer+<source>
LDY.w #BigDecompressionBuffer+<dest>
LDA.w #<length>-1
MVN BigDecompressionBuffer>>16,BigDecompressionBuffer>>16
LDX.w #BigDecompressionBuffer+<source>+$200
LDY.w #BigDecompressionBuffer+<dest>+$200
LDA.w #<length>-1
MVN BigDecompressionBuffer>>16,BigDecompressionBuffer>>16
endmacro
;===================================================================================================
AddCherryPickGfxToBigBuffer:
; this is mostly to load and rearrange follower gfx to save on space
; assumes DecompBufferOffset left off at $A000 (#BigDecompressionBuffer+$2000)
; adjustments will be needed if anything prior to this changes
LDX.b #$01 : STX.w $06FA
LDX.b #$35+$73 : JSR AddGfxSheetToBigBuffer
LDX.b #$55+$73 : JSR AddGfxSheetToBigBuffer
REP #$30
%CherryPickGfx($2400,$2140,$40) ; move old man head
%CherryPickGfx($2D40,$20C0,$40) ; move zelda body
LDA.b DecompBufferOffset : SEC : SBC.w #$0C00 : STA.b DecompBufferOffset
SEP #$30
LDX.b #$11+$73 : JSR AddGfxSheetToBigBuffer
LDX.b #$15+$73 : JSR AddGfxSheetToBigBuffer
REP #$30
%CherryPickGfx($2940,$2180,$80) ; move locksmith head/body
%CherryPickGfx($2D00,$0440,$40) ; move frog
%CherryPickGfx($31C0,$0500,$40) ; move purple chest
LDA.b DecompBufferOffset : SEC : SBC.w #$1000 : STA.b DecompBufferOffset
SEP #$30
LDX.b #$59+$73 : JSR AddGfxSheetToBigBuffer
LDX.b #$58+$73 : JSR AddGfxSheetToBigBuffer
REP #$30
%CherryPickGfx($2880,$0480,$40) ; move kiki head
%CherryPickGfx($2900,$04C0,$40) ; move kiki body
%CherryPickGfx($30C0,$0540,$40) ; move big bomb
%CherryPickGfx($2C40,$0180,$40) ; move duck
LDA.b DecompBufferOffset : SEC : SBC.w #$1000 : STA.b DecompBufferOffset
SEP #$30
LDX.b #$4D+$73 : JSR AddGfxSheetToBigBuffer
LDX.b #$50+$73 : JSR AddGfxSheetToBigBuffer
REP #$30
%CherryPickGfx($2880,$0580,$40) ; move smith
%CherryPickGfx($3140,$0140,$40) ; move chicken
LDA.b DecompBufferOffset : SEC : SBC.w #$1000 : STA.b DecompBufferOffset
SEP #$30
STZ.w $06FA
RTS

View File

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

View File

@@ -2,161 +2,200 @@
; Dialog Pointer Override
;--------------------------------------------------------------------------------
DialogOverride:
LDA.l AltTextFlag : BEQ .skip
LDA.l DialogBuffer, X ; use alternate buffer
LDA $7F5035 : BEQ .skip
LDA $7F5700, X ; use alternate buffer
RTL
.skip
LDA.l DecompressionBuffer+$1200, X
LDA $7F1200, X
RTL
;--------------------------------------------------------------------------------
; $7F5035 - Alternate Text Pointer Flag ; 0=Disable
; $7F5036 - Padding Byte (Must be Zero)
; $7F5700 - $7F57FF - Dialog Buffer
;--------------------------------------------------------------------------------
ResetDialogPointer:
STZ.w TextID : STZ.w TextID+1 ; reset decompression buffer
LDA.b #$00 : STA.l AltTextFlag ; zero out the alternate flag
LDA.b #$1C : STA.w DelayTimer ; thing we wrote over
STZ $1CF0 : STZ $1CF1 ; reset decompression buffer
LDA.b #$00 : STA $7F5035 ; zero out the alternate flag
LDA.b #$1C : STA $1CE9 ; thing we wrote over
RTL
;--------------------------------------------------------------------------------
;macro LoadDialog(index,table)
; PHA : PHX : PHY
; PHB : PHK : PLB
; LDA $00 : PHA
; LDA $01 : PHA
; LDA $02 : PHA
; LDA.b #$01 : STA $7F5035 ; set flag
;
; LDA <index> : ASL : !ADD.l <index> : TAX ; get quote offset *3, move to X
; LDA <table>, X : STA $00 ; write pointer to direct page
; LDA <table>+1, X : STA $01
; LDA <table>+2, X : STA $02
;
; LDX.b #$00 : LDY.b #$00
; -
; LDA [$00], Y ; load the next character from the pointer
; STA $7F5700, X ; write to the buffer
; INX : INY
; CMP.b #$7F : BNE -
; PLA : STA $02
; PLA : STA $01
; PLA : STA $00
; PLB
; PLY : PLX : PLA
;endmacro
;--------------------------------------------------------------------------------
;macro LoadDialogAddress(address)
; PHA : PHX : PHY
; PHP
; PHB : PHK : PLB
; SEP #$30 ; set 8-bit accumulator and index registers
; LDA $00 : PHA
; LDA $01 : PHA
; LDA $02 : PHA
; LDA.b #$01 : STA $7F5035 ; set flag
;
; LDA.b #<address> : STA $00 ; write pointer to direct page
; LDA.b #<address>>>8 : STA $01
; LDA.b #<address>>>16 : STA $02
;
; LDX.b #$00 : LDY.b #$00
; -
; LDA [$00], Y ; load the next character from the pointer
; STA $7F5700, X ; write to the buffer
; INX : INY
; CMP.b #$7F : BNE -
; PLA : STA $02
; PLA : STA $01
; PLA : STA $00
; PLB
; PLP
; PLY : PLX : PLA
;endmacro
;--------------------------------------------------------------------------------
!OFFSET_POINTER = "$7F5094"
!OFFSET_RETURN = "$7F5096"
!DIALOG_BUFFER = "$7F5700"
macro LoadDialogAddress(address)
PHA : PHX : PHY
PHP
PHB : PHK : PLB
SEP #$20 ; set 8-bit accumulator
REP #$10 ; set 16-bit index registers
PEI.b (Scrap00)
LDA.b Scrap02 : PHA
STZ.w TextID : STZ.w TextID+1 ; reset decompression buffer
LDA.b #$01 : STA.l AltTextFlag ; set flag
PEI ($00)
LDA $02 : PHA
STZ $1CF0 : STZ $1CF1 ; reset decompression buffer
LDA.b #$01 : STA $7F5035 ; set flag
%CopyDialog(<address>)
PLA : STA.b Scrap02
PLA : STA $02
REP #$20
PLA : STA.b Scrap00
PLA : STA $00
PLB
PLP
PLY : PLX : PLA
endmacro
;--------------------------------------------------------------------------------
macro CopyDialog(address)
LDA.b #<address> : STA.b Scrap00 ; write pointer to direct page
LDA.b #<address>>>8 : STA.b Scrap01
LDA.b #<address>>>16 : STA.b Scrap02
LDA.b #<address> : STA $00 ; write pointer to direct page
LDA.b #<address>>>8 : STA $01
LDA.b #<address>>>16 : STA $02
%CopyDialogIndirect()
endmacro
;--------------------------------------------------------------------------------
macro CopyDialogIndirect()
REP #$20 : LDA.l DialogOffsetPointer : TAX : LDY.w #$0000 : SEP #$20 ; copy 2-byte offset pointer to X and set Y to 0
REP #$20 : LDA !OFFSET_POINTER : TAX : LDY.w #$0000 : SEP #$20 ; copy 2-byte offset pointer to X and set Y to 0
?loop:
LDA.b [Scrap00], Y ; load the next character from the pointer
STA.l DialogBuffer, X ; write to the buffer
LDA [$00], Y ; load the next character from the pointer
STA !DIALOG_BUFFER, X ; write to the buffer
INX : INY
CMP.b #$7F : BNE ?loop
REP #$20 ; set 16-bit accumulator
TXA : INC : STA.l DialogReturnPointer ; copy out X into
LDA.w #$0000 : STA.l DialogOffsetPointer
TXA : INC : STA !OFFSET_RETURN ; copy out X into
LDA.w #$0000 : STA !OFFSET_POINTER
SEP #$20 ; set 8-bit accumulator
endmacro
;--------------------------------------------------------------------------------
LoadDialogAddressIndirect:
STZ.w TextID : STZ.w TextID+1 ; reset decompression buffer
LDA.b #$01 : STA.l AltTextFlag ; set flag
STZ $1CF0 : STZ $1CF1 ; reset decompression buffer
LDA.b #$01 : STA $7F5035 ; set flag
%CopyDialogIndirect()
;%LoadDialogAddress(UncleText)
RTL
;--------------------------------------------------------------------------------
!ITEM_TEMPORARY = "$7F5040"
FreeDungeonItemNotice:
STA.l ScratchBufferV
STA !ITEM_TEMPORARY
PHA : PHX : PHY
PHP
PHB : PHK : PLB
SEP #$20 ; set 8-bit accumulator
REP #$10 ; set 16-bit index registers
PEI.b (Scrap00)
LDA.b Scrap02 : PHA
LDA.l ScratchBufferNV : PHA
LDA.l ScratchBufferNV+1 : PHA
PHA : PHX : PHY
PHP
PHB : PHK : PLB
SEP #$20 ; set 8-bit accumulator
REP #$10 ; set 16-bit index registers
PEI ($00)
LDA $02 : PHA
;--------------------------------
LDA.l FreeItemText : BNE + : JMP .skip : +
LDA.b #$00 : STA.l ScratchBufferNV ; initialize scratch
LDA #$00 : STA $7F5010 ; initialize scratch
LDA.l FreeItemText : AND.b #$01 : BEQ + ; show message for general small key
LDA.l ScratchBufferV : CMP.b #$24 : BNE + ; general small key
LDA !ITEM_TEMPORARY : CMP.b #$24 : BNE + ; general small key
%CopyDialog(Notice_SmallKeyOf)
LDA.l DialogReturnPointer : DEC #2 : STA.l DialogOffsetPointer
LDA !OFFSET_RETURN : DEC #2 : STA !OFFSET_POINTER
%CopyDialog(Notice_Self)
JMP .done
+ : LDA.l FreeItemText : AND.b #$02 : BEQ + ; show message for general compass
LDA.l ScratchBufferV : CMP.b #$25 : BNE + ; general compass
LDA !ITEM_TEMPORARY : CMP.b #$25 : BNE + ; general compass
%CopyDialog(Notice_CompassOf)
LDA.l DialogReturnPointer : DEC #2 : STA.l DialogOffsetPointer
LDA !OFFSET_RETURN : DEC #2 : STA !OFFSET_POINTER
%CopyDialog(Notice_Self)
JMP .done
+ : LDA.l FreeItemText : AND.b #$04 : BEQ + ; show message for general map
LDA.l ScratchBufferV : CMP.b #$33 : BNE + ; general map
LDA !ITEM_TEMPORARY : CMP.b #$33 : BNE + ; general map
%CopyDialog(Notice_MapOf)
LDA.l DialogReturnPointer : DEC #2 : STA.l DialogOffsetPointer
LDA !OFFSET_RETURN : DEC #2 : STA !OFFSET_POINTER
%CopyDialog(Notice_Self)
JMP .done
+ : LDA.l FreeItemText : AND.b #$08 : BEQ + ; show message for general big key
LDA.l ScratchBufferV : CMP.b #$32 : BNE + ; general big key
LDA !ITEM_TEMPORARY : CMP.b #$32 : BNE + ; general big key
%CopyDialog(Notice_BigKeyOf)
LDA.l DialogReturnPointer : DEC #2 : STA.l DialogOffsetPointer
LDA !OFFSET_RETURN : DEC #2 : STA !OFFSET_POINTER
%CopyDialog(Notice_Self)
JMP .done
+
LDA.l FreeItemText : AND.b #$04 : BEQ + ; show message for dungeon map
LDA.l ScratchBufferV : AND.b #$F0 ; looking at high bits only
LDA !ITEM_TEMPORARY : AND.b #$F0 ; looking at high bits only
CMP.b #$70 : BNE + ; map of...
%CopyDialog(Notice_MapOf)
JMP .dungeon
+ : LDA.l FreeItemText : AND.b #$02 : BEQ + ; show message for dungeon compass
LDA.l ScratchBufferV : AND.b #$F0 : CMP.b #$80 : BNE + ; compass of...
LDA !ITEM_TEMPORARY : AND.b #$F0 : CMP.b #$80 : BNE + ; compass of...
%CopyDialog(Notice_CompassOf)
JMP .dungeon
+ : LDA.l FreeItemText : AND.b #$08 : BEQ + ; show message for dungeon big key
LDA.l ScratchBufferV : AND.b #$F0 : CMP.b #$90 : BNE + ; big key of...
LDA !ITEM_TEMPORARY : AND.b #$F0 : CMP.b #$90 : BNE + ; big key of...
%CopyDialog(Notice_BigKeyOf)
JMP .dungeon
+ : LDA.l FreeItemText : AND.b #$01 : BEQ + ; show message for dungeon small key
LDA.l ScratchBufferV : AND.b #$F0 : CMP.b #$A0 : BNE + ; small key of...
LDA.l ScratchBufferV : CMP.b #$AF : BNE ++ : JMP .skip : ++
%CopyDialog(Notice_SmallKeyOf)
LDA.b #$01 : STA.l ScratchBufferNV ; set up a flip for small keys
BRA .dungeon
+ : LDA.l FreeItemText : AND.b #$20 : BEQ + ; show message for crystal
LDA.l ScratchBufferV : CMP.b #$B0 : !BLT + ; crystal #
CMP.b #$B7 : !BGE +
%CopyDialog(Notice_Crystal)
JMP .crystal
+
+ : 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 : ++
%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
BRA .dungeon
+
JMP .skip ; it's not something we are going to give a notice for
.dungeon
LDA.l DialogReturnPointer : DEC #2 : STA.l DialogOffsetPointer
LDA.l ScratchBufferV
AND.b #$0F
STA.l ScratchBufferNV+1
LDA.l ScratchBufferNV : BEQ +
LDA.l ScratchBufferNV
LDA.b #$0F : !SUB.l ScratchBufferNV+1 : STA.l ScratchBufferNV+1 ; flip the values for small keys
LDA !OFFSET_RETURN : DEC #2 : STA !OFFSET_POINTER
LDA !ITEM_TEMPORARY
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
+
LDA.l ScratchBufferNV+1
ASL : TAX
REP #$20
LDA.l DungeonItemIDMap,X : CMP.w #$0003 : BCC .hc_sewers
CMP.w DungeonID : BNE +
BRA .self_notice
.hc_sewers
LDA.w DungeonID : CMP.w #$0003 : BCS +
.self_notice
SEP #$20
LDA.l FreeItemText : AND.b #$40 : BEQ ++
LDA.b #$00 : STA.l DialogOffsetPointer : STA.l DialogOffsetPointer+1
JMP .skip
++
%CopyDialog(Notice_Self)
JMP .done
+
SEP #$20
LDA.l ScratchBufferNV+1
LDA $7F5011
CMP.b #$00 : BNE + ; ...light world
%CopyDialog(Notice_LightWorld) : JMP .done
+ : CMP.b #$01 : BNE + ; ...dark world
@@ -184,61 +223,38 @@ FreeDungeonItemNotice:
+ : CMP.b #$0C : BNE + ; ...desert palace
%CopyDialog(Notice_Desert) : JMP .done
+ : CMP.b #$0D : BNE + ; ...eastern palace
%CopyDialog(Notice_Eastern) : JMP .done
%CopyDialog(Notice_Eastern) : BRA .done
+ : CMP.b #$0E : BNE + ; ...hyrule castle
%CopyDialog(Notice_Castle) : JMP .done
%CopyDialog(Notice_Castle) : BRA .done
+ : CMP.b #$0F : BNE + ; ...sewers
%CopyDialog(Notice_Sewers)
+
JMP .done
.crystal
LDA.l DialogReturnPointer : DEC #2 : STA.l DialogOffsetPointer
LDA.l ScratchBufferV
AND.b #$0F ; looking at low bits only
CMP.b #$00 : BNE +
%CopyDialog(Notice_Six) : JMP .done
+ : CMP.b #$01 : BNE +
%CopyDialog(Notice_One) : JMP .done
+ : CMP.b #$02 : BNE +
%CopyDialog(Notice_Five) : JMP .done
+ : CMP.b #$03 : BNE +
%CopyDialog(Notice_Seven) : JMP .done
+ : CMP.b #$04 : BNE +
%CopyDialog(Notice_Two) : JMP .done
+ : CMP.b #$05 : BNE +
%CopyDialog(Notice_Four) : JMP .done
+ : CMP.b #$06 : BNE +
%CopyDialog(Notice_Three) : JMP .done
+
.done
STZ.w TextID : STZ.w TextID+1 ; reset decompression buffer
LDA.b #$01 : STA.l AltTextFlag ; set alternate dialog flag
STA.l TextBoxDefer
STZ $1CF0 : STZ $1CF1 ; reset decompression buffer
LDA.b #$01 : STA $7F5035 ; set alternate dialog flag
STA $7F509F
;--------------------------------
.skip
PLA : STA.l ScratchBufferNV+1
PLA : STA.l ScratchBufferNV
PLA : STA.b Scrap02
REP #$20
PLA : STA.b Scrap00
PLB
PLP
PLY : PLX : PLA
PLA : STA $02
REP #$20
PLA : STA $00
PLB
PLP
PLY : PLX : PLA
;JSL.l Main_ShowTextMessage_Alt ; .skip can be here so long as this line remains commented out
RTL
;--------------------------------------------------------------------------------
DialogResetSelectionIndex:
JSL Attract_DecompressStoryGfx ; what we wrote over
STZ.w MessageCursor
JSL.l Attract_DecompressStoryGfx ; what we wrote over
STZ $1CE8
RTL
;--------------------------------------------------------------------------------
DialogItemReceive:
BCS .nomessage ; if doubling the item value overflowed it must be a rando item
CPY.b #$98 : BCC ++ ;if the item is $4C or greater it must be a rando item
CPY #$98 : BCC ++ ;if the item is $4C or greater it must be a rando item
.nomessage
LDA.w #$FFFF
@@ -251,11 +267,10 @@ RTL
;--------------------------------------------------------------------------------
DialogFairyThrow:
LDA.l Restrict_Ponds : BEQ .normal
LDA.l BottleContentsOne
ORA.l BottleContentsTwo : ORA.l BottleContentsThree : ORA.l BottleContentsFour : BNE .normal
LDA BottleContentsOne
ORA BottleContentsTwo : ORA BottleContentsThree : ORA BottleContentsFour : BNE .normal
.noInventory
LDA.w SpriteActivity, X : !ADD.b #$08 : STA.w SpriteActivity, X
LDA $0D80, X : !ADD #$08 : STA $0D80, X
LDA.b #$51
LDY.b #$01
RTL
@@ -265,14 +280,14 @@ RTL
RTL
;--------------------------------------------------------------------------------
DialogGanon1:
LDA.b #$01 : JSL CheckConditionPass
JSL.l CheckGanonVulnerability
REP #$20
LDA.w #$018C
BCC +
LDA.w #$016D
+ STA.w TextID
+ STA $1CF0
SEP #$20
JSL Sprite_ShowMessageMinimal_Alt
JSL.l Sprite_ShowMessageMinimal_Alt
RTL
;--------------------------------------------------------------------------------
; #$0192 - no bow
@@ -284,82 +299,75 @@ RTL
; s = silver arrow bow
; p = 2nd progressive bow
DialogGanon2:
LDA.b #$01 : JSL CheckConditionPass
JSL.l CheckGanonVulnerability
REP #$20
BCS +
LDA.w #$018D : JMP .done
+
LDA.l GanonVulnerabilityItem : AND.w #$00FF
BEQ .silver_arrows
CMP.w #$0001 : BEQ .silver_arrows
CMP.w #$0004 : BEQ .bombs
CMP.w #$0005 : BEQ .powder
CMP.w #$0010 : BEQ .bee
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
PHX : TAX
LDA.l EquipmentWRAM-1, X
PLX
AND.w #$00FF : BNE .have
BRA .dont_have
.silver_arrows
LDA.l BowTracking
BIT.w #$0080 : BEQ .dont_have ; no bow
BIT.w #$0040 : BNE .have ; have silvers
BIT.w #$0020 : BNE +
LDA.w #$0194 : BRA .done ; have p bow
+ LDA.w #$0193 : BRA .done ; don't have p bow
.dont_have
LDA.w #$0192 : BRA .done
.have
LDA.w #$0195 : BRA .done
.bombs
LDA.l BombsEquipment : AND.w #$00FF : BNE .have
LDA.l InfiniteBombs : AND.w #$00FF : BNE .have
BRA .dont_have
.powder
LDA.l InventoryTracking : BIT.w #$0010 : BNE .have
BRA .dont_have
.bee
LDA.l BottleContentsOne : AND.w #$00FF
CMP.w #$0007 : BEQ .have
CMP.w #$0008 : BEQ .have
LDA.l BottleContentsTwo : AND.w #$00FF
CMP.w #$0007 : BEQ .have
CMP.w #$0008 : BEQ .have
LDA.l BottleContentsThree : AND.w #$00FF
CMP.w #$0007 : BEQ .have
CMP.w #$0008 : BEQ .have
LDA.l BottleContentsFour : AND.w #$00FF
CMP.w #$0007 : BEQ .have
CMP.w #$0008 : BEQ .have
BRA .dont_have
.done
STA.w TextID
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 InfiniteBombsModifier : 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 $1CF0
SEP #$20
JSL Sprite_ShowMessageMinimal_Alt
JSL.l Sprite_ShowMessageMinimal_Alt
RTL
;--------------------------------------------------------------------------------
DialogEtherTablet:
PHA
LDA.w ItemCursor : CMP.b #$0F : BEQ + ; Show normal text if book is not equipped
LDA $0202 : CMP.b #$0F : BEQ + ; Show normal text if book is not equipped
-
PLA : JML Sprite_ShowMessageUnconditional ; Wacky Hylian Text
+
BIT.b Joy1A_New : BVC - ; Show normal text if Y is not pressed
LDA.l AllowHammerTablets : BEQ ++
LDA.l HammerEquipment : BEQ .yesText : BRA .noText
++
LDA.l SwordEquipment : CMP.b #$FF : BEQ .yesText : CMP.b #$02 : BCS .noText
;++
BIT $F4 : BVC - ; Show normal text if Y is not pressed
JSL CheckTabletSword : BMI .yesText
CMP.b #$02 : !BGE .noText
.yesText
PLA
LDA.b #$0C
@@ -372,18 +380,15 @@ RTL
;--------------------------------------------------------------------------------
DialogBombosTablet:
PHA
LDA.w ItemCursor : CMP.b #$0F : BEQ + ; Show normal text if book is not equipped
LDA $0202 : CMP.b #$0F : BEQ + ; Show normal text if book is not equipped
-
PLA : JML Sprite_ShowMessageUnconditional ; Wacky Hylian Text
+
BIT.b Joy1A_New : BVC - ; Show normal text if Y is not pressed
LDA.l AllowHammerTablets : BEQ ++
LDA.l HammerEquipment : BEQ .yesText : BRA .noText
++
LDA.l SwordEquipment : CMP.b #$FF : BEQ .yesText : CMP.b #$02 : !BGE .noText
;++
BIT $F4 : BVC - ; Show normal text if Y is not pressed
JSL CheckTabletSword : BMI .yesText
CMP.b #$02 : !BGE .noText
.yesText
PLA
PLA
LDA.b #$0D
LDY.b #$01
JML Sprite_ShowMessageUnconditional ; Text From MSPedestalText (tables.asm)
@@ -393,81 +398,81 @@ DialogBombosTablet:
RTL
;--------------------------------------------------------------------------------
DialogSahasrahla:
LDA.l PendantsField : AND.b #$04 : BEQ + ;Check if player has green pendant
LDA.l PendantsField : AND #$04 : BEQ + ;Check if player has green pendant
LDA.b #$2F
LDY.b #$00
LDY.b #$00
JML Sprite_ShowMessageUnconditional
+
RTL
;--------------------------------------------------------------------------------
DialogBombShopGuy:
LDY.b #$15
LDA.l CrystalsField : AND.b #$05 : CMP.b #$05 : BNE + ;Check if player has crystals 5 & 6
LDA.l CrystalsField : AND #$05 : CMP #$05 : BNE + ;Check if player has crystals 5 & 6
INY ; from 15 to 16
+
TYA
LDY.b #$01
JSL Sprite_ShowMessageUnconditional
JSL.l Sprite_ShowMessageUnconditional
RTL
;---------------------------------------------------------------------------------------------------
AgahnimAsksAboutPed:
; seems light_speed option to change some aga text is unused for now
BRA .vanilla
LDA.l InvincibleGanon
CMP.b #$06 : BNE .vanilla
LDA.l OverworldEventDataWRAM+$80 ; check ped flag
AND.b #$40
BNE .vanilla
LDA.b #$8C ; message 018C for no ped
STA.w TextID
STA.w $1CF0
.vanilla
JML Sprite_ShowMessageMinimal
JML $05FA8E ; Sprite_ShowMessageMinimal
;--------------------------------------------------------------------------------
Main_ShowTextMessage_Alt:
; Are we in text mode? If so then end the routine.
LDA.b GameMode : CMP.b #$0E : BEQ .already_in_text_mode
LDA $10 : CMP.b #$0E : BEQ .already_in_text_mode
Sprite_ShowMessageMinimal_Alt:
STZ.b GameSubMode
STZ $11
PHX : PHY
PEI.b (Scrap00)
LDA.b Scrap02 : PHA
PEI ($00)
LDA.b $02 : PHA
LDA.b #$1C : STA.b Scrap02
LDA.b #$1C : STA.b $02
REP #$30
LDA.w TextID : ASL : TAX
LDA.w $1CF0 : ASL : TAX
LDA.l $7F71C0, X
STA.b Scrap00
STA.b $00
SEP #$30
LDY.b #$00
LDA.b [Scrap00], Y : CMP.b #$FE : BNE +
INY : LDA.b [Scrap00], Y : CMP.b #$6E : BNE +
INY : LDA.b [Scrap00], Y : : BNE +
INY : LDA.b [Scrap00], Y : CMP.b #$FE : BNE +
INY : LDA.b [Scrap00], Y : CMP.b #$6B : BNE +
INY : LDA.b [Scrap00], Y : CMP.b #$04 : BNE +
STZ.w MessageCursor
LDA [$00], Y : CMP.b #$FE : BNE +
INY : LDA [$00], Y : CMP.b #$6E : BNE +
INY : LDA [$00], Y : : BNE +
INY : LDA [$00], Y : CMP.b #$FE : BNE +
INY : LDA [$00], Y : CMP.b #$6B : BNE +
INY : LDA [$00], Y : CMP.b #$04 : BNE +
STZ $1CE8
JMP .end
+
STZ.w MessageJunk ; Otherwise set it so we are in text mode.
STZ.w MessageSubModule
STZ $0223 ; Otherwise set it so we are in text mode.
STZ $1CD8 ; Initialize the step in the submodule
; Go to text display mode (as opposed to maps, etc)
LDA.b #$02 : STA.b GameSubMode
LDA.b #$02 : STA $11
; Store the current module in the temporary location.
LDA.b GameMode : STA.w GameModeCache
LDA $10 : STA $010C
; Switch the main module ($10) to text mode.
LDA.b #$0E : STA.b GameMode
LDA.b #$0E : STA $10
.end
PLA : STA.b Scrap02
PLA : STA.b Scrap01
PLA : STA.b Scrap00
PLA : STA.b $02
PLA : STA.b $01
PLA : STA.b $00
PLY : PLX
Main_ShowTextMessage_Alt_already_in_text_mode:
@@ -476,132 +481,26 @@ RTL
CalculateSignIndex:
; for the big 1024x1024 screens we are calculating link's effective
; screen area, as though the screen was 4 different 512x512 screens.
; And we do this in a way that will likely give the right value even
; And we do this in a way that will likely give the right value even
; with major glitches.
LDA.b OverworldIndex : ASL A : TAY ;what we wrote over
LDA $8A : ASL A : TAY ;what we wrote over
LDA.w OWScreenSize : BEQ .done ; If a small map, we can skip these calculations.
LDA $0712 : BEQ .done ; If a small map, we can skip these calculations.
LDA.b LinkPosY+1 : AND.w #$0002 : ASL #2 : EOR.b OverworldIndex : AND.w #$0008 : BEQ +
LDA $21 : AND.w #$0002 : ASL #2 : EOR $8A : AND.w #$0008 : BEQ +
TYA : !ADD.w #$0010 : TAY ;add 16 if we are in lower half of big screen.
+
+
LDA.b LinkPosX+1 : AND.w #$0002 : LSR : EOR.b OverworldIndex : AND.w #$0001 : BEQ +
LDA $23 : AND.w #$0002 : LSR : EOR $8A : AND.w #$0001 : BEQ +
TYA : INC #2 : TAY ;add 16 if we are in lower half of big screen.
+
; ensure even if things go horribly wrong, we don't read the sign out of bounds and crash:
TYA : AND.w #$00FF : TAY
TYA : AND.w #$00FF : TAY
.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 Sprite_ShowSolicitedMessage_Direction, 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 Sprite_ShowSolicitedMessage_Direction, X : PLX : CMP.b LinkDirection : BNE .not_facing_each_other
PLA : XBA : PLA
PHY
TAY : XBA
JSL Sprite_ShowMessageUnconditional
LDA.b #$40 : STA.w SpriteTimerE, X
PLA : EOR.b #$03
SEC
RTL
.not_facing_each_other
.alpha
PLY
PLA
LDA.w SpriteMoveDirection, X
CLC
RTL
}
;--------------------------------------------------------------------------------
; A0 - A9 - 0 - 9
; AA - C3 - A - Z

View File

@@ -7,8 +7,8 @@
;--------------------------------------------------------------------------------
StoreLastOverworldDoorID:
TXA : INC
STA.l PreviousOverworldDoor
LDA.l Overworld_Entrance_ID, X : STA.w EntranceIndex
STA $7F5099
LDA $1BBB73, X : STA $010E
RTL
;--------------------------------------------------------------------------------
@@ -16,14 +16,14 @@ RTL
; CacheDoorFrameData
;--------------------------------------------------------------------------------
CacheDoorFrameData:
LDA.l PreviousOverworldDoor : BEQ .originalBehaviour
LDA $7F5099 : BEQ .originalBehaviour
DEC : ASL : TAX
LDA.l EntranceDoorFrameTable, X : STA.w TileMapEntranceDoors
LDA.l EntranceAltDoorFrameTable, X : STA.w TileMapTile32
LDA EntranceDoorFrameTable, X : STA $0696
LDA EntranceAltDoorFrameTable, X : STA $0698
BRA .done
.originalBehaviour
LDA.w $D724, X : STA.w TileMapEntranceDoors
STZ.w TileMapTile32
LDA $D724, X : STA $0696
STZ $0698
.done
RTL
;--------------------------------------------------------------------------------
@@ -32,9 +32,9 @@ RTL
; WalkDownIntoTavern
;--------------------------------------------------------------------------------
WalkDownIntoTavern:
LDA.l PreviousOverworldDoor
LDA $7F5099
; tavern door has index 0x42 (saved off value is incremented by one)
CMP.b #$43
CMP #$43
RTL
;--------------------------------------------------------------------------------
@@ -42,49 +42,36 @@ RTL
; TurnAroundOnUnderworld
;--------------------------------------------------------------------------------
TurnAroundOnUnderworld:
LDA.b LinkPushDirection : BEQ .done
LDA $26 : BEQ .done
; turn around if ($010E == #$43) != ($7F5099 == #$43)
LDX.b #$00
LDA.b #$43 : CMP.w EntranceIndex : BEQ +
LDX #$00
LDA #$43 : CMP $010E : BEQ +
INX
+
CMP.l PreviousOverworldDoor : BEQ +
CMP $7F5099 : BEQ +
DEX
+
CPX.b #$00 : BEQ .done
LDA.b LinkPushDirection : EOR.b #$0C : STA.b LinkPushDirection
CPX #$00 : BEQ .done
LDA $26 : EOR #$0C : STA $26
.done
JML Underworld_LoadCustomTileAttributes ; what we overwrote
JML $0FFD65 ; what we overwrote
;--------------------------------------------------------------------------------
; TurnUpOnOverworld
;--------------------------------------------------------------------------------
TurnUpOnOverworld:
LDA.l EntranceTavernBack : CMP.b #$43 : BEQ .done
LDA.b #$08 : STA.b LinkPushDirection ; only fix this glitch if exit not vanilla
LDA.l EntranceTavernBack : CMP #$43 : BEQ .done
LDA #$08 : STA $26 ; only fix this glitch if exit not vanilla
.done
JML Link_HandleMovingAnimation_FullLongEntry ; what we overwrote
JML $07E68F ; what we overwrote
;--------------------------------------------------------------------------------
; WalkUpOnOverworld
;--------------------------------------------------------------------------------
WalkUpOnOverworld:
LDA.b LinkPosY : CMP.w #$091B : BNE .normal ; hardcoded Y coordinate
STZ.b LinkDirection
LDA $20 : CMP #$091B : BNE .normal ; hardcoded Y coordinate
STZ $2F
RTL
.normal
LDA.w #$0002 : STA.b LinkDirection ; what we overwrote
RTL
;--------------------------------------------------------------------------------
; CheckStairsAdjustment
;--------------------------------------------------------------------------------
CheckStairsAdjustment:
LDA.b RoomIndex
CMP.w #$0124 ; vanilla check, rooms $0124 to $0127 have a lower exit position (currently ER ignores the entrance location)
BCC .done
LDA.w #$FFFF-1
CMP.w TileMapEntranceDoors ; tavern back ($0696 == #$FFFF) should always have carry cleared
.done
RTL
; if carry cleared, shift position up
LDA #$0002 : STA $2F ; what we overwrote
RTL

View File

@@ -1,51 +0,0 @@
pushpc
org $9E9463
JSL CheckKholdShellCoordinates
BCC Sprite_A3_KholdstareShell_link_not_close
BRA Sprite_A3_KholdstareShell_link_close
NOP #13
Sprite_A3_KholdstareShell_link_close = $9E9478
Sprite_A3_KholdstareShell_link_not_close = $9E9480
pullpc
CheckKholdShellCoordinates:
LDA.w SpritePosXHigh, X
XBA
LDA.w SpritePosXLow, X ; full 16 bit X coordinate of sprite
REP #$21 ; carry is guaranteed clear
SBC.w #$0020
CMP.b LinkPosX
BCS .not_colliding
ADC.w #$0040 ; carry is guaranteed clear
CMP.b LinkPosX
BCC .not_colliding
SEP #$20
LDA.w SpritePosYHigh, X
XBA
LDA.w SpritePosYLow, X ; full 16 bit Y coordinate of sprite
REP #$21 ; carry is guaranteed clear
SBC.w #$001F ; could go to 27 and still let link squeeze in
CMP.b LinkPosY
BCS .not_colliding
ADC.w #$0037 ; carry is guaranteed clear
CMP.b LinkPosY
BCC .not_colliding
SEP #$20 ; collision detected
SEC
RTL
.not_colliding
SEP #$30
CLC
RTL

View File

@@ -1,3 +1,9 @@
!add = "clc : adc"
!addl = "clc : adc.l"
!sub = "sec : sbc"
!bge = "bcs"
!blt = "bcc"
; Free RAM notes
; Normal doors use $AB-AC for scrolling indicator
; Normal doors use $FE to store the trap door indicator
@@ -35,11 +41,6 @@ DRScroll:
db 0
OffsetTable:
dw -8, 8
org $A78010
DRVersionInfo:
dw $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000
org $A78020
incsrc normal.asm
incsrc scroll.asm
@@ -52,7 +53,6 @@ incsrc math.asm
incsrc hudadditions.asm
incsrc dr_lobby.asm
incsrc entrance_fixes.asm
incsrc bugfix/kholdstare_shell_collision.asm
warnpc $A79C00
incsrc doortables.asm

View File

@@ -593,9 +593,8 @@ CompassBossIndicator:
dw $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000
TotalKeys: ;27f020
db $04, $04, $02, $04, $04, $06, $06, $06, $05, $06, $01, $03, $06, $08, $00, $00
skip $10
;ChestKeys: ;27f030 - moved to B0F010
;db $01, $01, $00, $01, $02, $01, $06, $03, $03, $02, $01, $01, $04, $04, $00, $00
ChestKeys: ;27f030
db $01, $01, $00, $01, $02, $01, $06, $03, $03, $02, $01, $01, $04, $04, $00, $00
BigKeyStatus: ;27f040 (status 2 indicate BnC guard)
dw $0002, $0002, $0001, $0001, $0000, $0001, $0001, $0001, $0001, $0001, $0001, $0001, $0001, $0001, $0000, $0000
DungeonReminderTable: ;27f060
@@ -694,6 +693,4 @@ dw $ffff
SanctuaryDarkWorld:
dw $ffff
OldManDarkWorld:
dw $ffff
OldManRetrievalWorld:
dw $0000
dw $ffff

View File

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

View File

@@ -44,8 +44,6 @@ org $8293d1 ; <- 113d1 - Bank02.asm : 3683 (ADD $20 : STA $20 BRANCH_IOTA)
jsl StraightStairsFix : nop
org $829396 ; <- 11396 - Bank02.asm : 3641 (LDA $01C322, X)
jsl StraightStairLayerFix
org $82c06d ; <- Bank02.asm : 9874 (LDX $0418, CMP.b #$02)
jsl DoorToStraight : nop
org $82c092 ; STA $0020, Y : LDX #$00
jsl DoorToInroom : nop
org $82c0f8 ; CMP $02C034, X
@@ -67,7 +65,7 @@ jsl QuadrantLoadOrderAfterScroll
org $82895d ; Bank 02 line 1812 (JSL Dungeon_LoadRoom : JSL Dungeon_InitStarTileChr : JSL $00D6F9 : INC $B0)
Splicer:
jsl GfxFixer
lda.b $b1 : beq .done
lda $b1 : beq .done
rts
nop #5
.done
@@ -98,7 +96,7 @@ org $8ffd65 ;(PC: 07fd65)
Dungeon_LoadCustomTileAttr:
org $81feb0
Dungeon_ApproachFixedColor:
;org $81fec1
;org $01fec1
;Dungeon_ApproachFixedColor_variable:
;org $a0f972 ; Rando version
;LoadRoomHook:
@@ -120,7 +118,7 @@ jsl MirrorCheckOverride
org $85ef47
Sprite_HeartContainer_Override: ;sprite_heart_upgrades.asm : 96-100 (LDA $040C : CMP.b #$1A : BNE .not_in_ganons_tower)
jsl GtBossHeartCheckOverride : bcs .not_in_ganons_tower
nop : stz.w SpriteAITable, X : rts
nop : stz $0dd0, X : rts
.not_in_ganons_tower
@@ -136,7 +134,7 @@ jsl EGFixOnMirror
org $82b82a
jsl FixShopCode
org $9ddeea ; <- Bank1D.asm : 286 (JSL SpritePrep_LoadProperties)
org $9ddeea ; <- Bank1D.asm : 286 (JSL Sprite_LoadProperties)
jsl VitreousKeyReset
org $9ed024 ; f5024 sprite_guruguru_bar.asm : 27 (LDA $040C : CMP.b #$12 : INY #2
@@ -169,8 +167,8 @@ jsl CutoffEntranceRug : bra .nextTile : nop
org $8799de ; <- Bank07.asm : 4088 (LDA.b #$15 : STA $5D)
JSL StoreTempBunnyState
;
org $88C450 ; <- ancilla_receive_item.asm : 146-148 (STY $5D : STZ $02D8)
JSL RetrieveBunnyState : JMP.w + : NOP : +
org $88c450 ; <- ancilla_receive_item.asm : 146-148 (STY $5D : STZ $02D8)
JSL RetrieveBunnyState : NOP
org $82d9ce ; <- Bank02.asm : Dungeon_LoadEntrance 10829 (STA $A0 : STA $048E)
JSL CheckDarkWorldSpawn : NOP
@@ -188,13 +186,14 @@ Main_ShowTextMessage:
; Conditionally disable UW music changes in Door Rando
org $828ADB ; <- Bank02.asm:2088-2095 (LDX.b #$14 : LDA $A0 ...)
JSL Underworld_DoorDown_Entry : CPX.b #$FF
JSL.l Underworld_DoorDown_Entry : CPX #$FF
BEQ + : db $80, $1C ; BRA $028B04
NOP #6 : +
org $82FD00 ; unreachable code
Underworld_SetBossOrSancMusicUponEntry_long:
JSR Underworld_SetBossOrSancMusicUponEntry : RTL
org $82C3F2 ; <- Bank02.asm:10521 Unused call
Underworld_DoorDown_Call:
org $82C3F3
dw $8AD9 ; address of Bank02.asm:2085
org $81AA90
JSL BigKeyDoorCheck : NOP
@@ -213,9 +212,9 @@ bcs .normal
rts
.normal
; fixes an issue with edges -> normal doors (bombable, dashable, keydoor)
org $82C06A
JSL TransitionCalculateLanding_Fix : NOP #2
org $82C157
JSL AlwaysPushThroughFDoors
org $80E766
JML ConditionalLoadCommonSprites_Do3To4Low : NOP #2
LoadCommonSprites_Prep3To4Low:

View File

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

View File

@@ -12,18 +12,10 @@
; 2) Draw over what vanilla just drew
; 3) Hijack the door tile type routine
; and replace the vanilla value with that of solid collision
; For door dection free RAM at $19EE-$19FF has been co-opted to door each drawn doors position and type bytes
; 19EE is for the "current" door for the IdentifyBlockedEntrance routine
; The array at 19F0 is for the collision routine to retrieve that information as it is no longer
; available by that point
;===================================================================================================
pushpc
org $81B0E6
JSL StoreDoorInfo
org $81892F
org $01892F
DoorDrawJankMove:
JML PrepDoorDraw
@@ -33,22 +25,14 @@ DoorDrawJankMove:
; we don't want to overwrite the JMP ($000E) that's already there
; Well, we could, but we don't need to
warnpc $818939
warnpc $018939
org $81BF43
org $01BF43
JSL AdjustEscapeDoorCollision
org $81C132 ; ADC.w #$0040 : TAX : LDA.b $00
JSL AdjustEscapeDoorCollision_LowEntrance : NOP #2
pullpc
;===================================================================================================
StoreDoorInfo:
STA.w $1980,X
LDA.b Scrap00 : STA.w $19F0,X
TXA
RTL
PrepDoorDraw:
; first off, we need this routine to return to our jank hook
@@ -59,18 +43,16 @@ PrepDoorDraw:
; Much easier to just tell you to look at $01890D in the disassembly
; and you should understand the vanilla program flow we need to reject
PEA.w DoorDrawJankMove_return-1
LDA.b Scrap00
STA.w $19EE ; for current routine
; copy vanilla code (but fast rom)
LDA.l $8186F0,X
STA.b Scrap0E
STA.b $0E
LDX.b Scrap02
LDA.b Scrap04
LDX.b $02
LDA.b $04
; and to execute the jump, we'll use the JMP ($000E) we carefully avoided overwriting
JML $818939
JML.l $818939
;===================================================================================================
@@ -106,23 +88,20 @@ AdjustEscapeDoorGraphics:
; row 1
LDA.w #$8838
STA.l TileMapA+$080,X
STA.l $7E2000+$080,X
ORA.w #$4000 ; horizontally flip
STA.l TileMapA+$086,X
STA.l $7E2000+$086,X
; row 2
LDA.w #$8828
STA.l TileMapA+$100,X
STA.l $7E2000+$100,X
ORA.w #$4000 ; horizontally flip
STA.l TileMapA+$106,X
STA.l $7E2000+$106,X
LDA.w #$8829
STA.l TileMapA+$102,X
STA.l $7E2000+$102,X
ORA.w #$4000 ; horizontally flip
STA.l TileMapA+$104,X
JSR IdentifySwampEntrance
BCS .fix_swamp_entrance_alternate
STA.l $7E2000+$104,X
; the state of the A, X, and Y registers is irrelevant when we exit
; they're all subsequently loaded with new values
@@ -134,84 +113,81 @@ AdjustEscapeDoorGraphics:
; row 0
LDA.w #$14C4
STA.l TileMapA+$000,X ; sanity check = should calculate to 7e3bbc
STA.l $7E2000+$000,X ; sanity check = should calculate to 7e3bbc
ORA.w #$4000 ; horizontally flip
STA.l TileMapA+$006,X
STA.l $7E2000+$006,X
LDA.w #$14C5
STA.l TileMapA+$002,X
STA.l $7E2000+$002,X
ORA.w #$4000 ; horizontally flip
STA.l TileMapA+$004,X
STA.l $7E2000+$004,X
; row 1
LDA.w #$14E8
STA.l TileMapA+$082,X
STA.l $7E2000+$082,X
ORA.w #$4000 ; horizontally flip
STA.l TileMapA+$084,X
STA.l $7E2000+$084,X
; row 2
LDA.w #$14F8
STA.l TileMapA+$102,X
STA.l $7E2000+$102,X
ORA.w #$4000 ; horizontally flip
STA.l TileMapA+$104,X
RTL
STA.l $7E2000+$104,X
.fix_swamp_entrance
LDY.w $0460 ; get door index
LDX.w $19A0-2,Y ; get tilemap index
; row 1 - outer section
; row 0
LDA.w #$9DfC
STA.l $7E2000+$000,X
STA.l $7E2000+$002,X
STA.l $7E2000+$004,X
STA.l $7E2000+$006,X
; row 1
LDA.w #$0908
STA.l TileMapA+$080,X
STA.l $7E2000+$080,X
ORA.w #$4000 ; horizontally flip
STA.l TileMapA+$086,X
STA.l $7E2000+$086,X
LDA.w #$14E8
STA.l $7E2000+$082,X
ORA.w #$4000 ; horizontally flip
STA.l $7E2000+$084,X
; row 2
LDA.w #$0918
STA.l TileMapA+$100,X
STA.l $7E2000+$100,X
ORA.w #$4000 ; horizontally flip
STA.l TileMapA+$106,X
STA.l $7E2000+$106,X
LDA.w #$14F8
STA.l TileMapA+$102,X
STA.l $7E2000+$102,X
ORA.w #$4000 ; horizontally flip
STA.l TileMapA+$104,X
.fix_swamp_entrance_alternate
; row 0
LDA.w #$9DFC
STA.l TileMapA+$000,X
STA.l TileMapA+$002,X
STA.l TileMapA+$004,X
STA.l TileMapA+$006,X
; row 1 - mid section
LDA.w #$14E8
STA.l TileMapA+$082,X
ORA.w #$4000 ; horizontally flip
STA.l TileMapA+$084,X
STA.l $7E2000+$104,X
; row 3
LDA.w #$A82C
STA.l TileMapA+$180,X
STA.l $7E2000+$180,X
ORA.w #$4000 ; horizontally flip
STA.l TileMapA+$186,X
STA.l $7E2000+$186,X
LDA.w #$A82D
STA.l TileMapA+$182,X
STA.l $7E2000+$182,X
ORA.w #$4000 ; horizontally flip
STA.l TileMapA+$184,X
STA.l $7E2000+$184,X
RTL
IdentifySancEntrance:
LDA.b RoomIndex : CMP.w #$0012 : BNE +
LDA.b Scrap0A : CMP.w #$0010 : BNE +
LDA.b $A0 : CMP.w #$0012 : BNE +
LDA.b $0A : CMP.w #$0010 : BNE +
SEC : RTS
+ CLC : RTS
IdentifySwampEntrance:
LDA.b RoomIndex : CMP.w #$0036 : BNE +
LDA.b Scrap0A : CMP.w #$0010 : BNE +
LDA.b $A0 : CMP.w #$0036 : BNE +
LDA.b $0A : CMP.w #$0010 : BNE +
SEC : RTS
+ CLC : RTS
@@ -234,15 +210,15 @@ BlockedEntrance:
AdjustEscapeDoorCollision:
LSR ; vanilla shift
AdjustEscapeDoorCollisionShared:
; save our parameters
; but one or both of these may not be necessary depending on how you detect these doors
; all that matters is that after identifying blockage, we have:
; Y is the same as what we entered with
; X has A>>1, for whatever A entered with
PHA
LDA.w $19F0, Y ; grab door info (type, position)
STA.w $19EE ; store in temporary variable
LDA.w $1980, Y ; grab door info (type)
AND.w #$00FF
STA.b $0A ; store in temporary variable
JSR IdentifyBlockedEntrance
PLX ; this is a TAX in vanilla, just have X pull A instead
@@ -250,7 +226,7 @@ AdjustEscapeDoorCollisionShared:
BCS .block_entrance
; vanilla value
LDA.b Scrap00
LDA.b $00
RTL
@@ -259,14 +235,11 @@ AdjustEscapeDoorCollisionShared:
RTL
AdjustEscapeDoorCollision_LowEntrance:
ADC.w #$0040 ; vanilla add
JMP AdjustEscapeDoorCollisionShared
;===================================================================================================
; Enter with:
; $19EE containing the door information: position and type bytes
; $0A containing the door information: position and type bytes
; which should be from $1980, Y or [$B7], Y depending on where in the door process we are
; Exit with:
; carry clear - leave door alone
; carry set - block door
@@ -274,23 +247,24 @@ IdentifyBlockedEntrance:
LDA.l ProgressIndicator : AND.w #$00FF : CMP.w #$0002 : BCS .leave_alone ; only in rain states (0 or 1)
LDA.l ProgressFlags : AND.w #$0004 : BNE .leave_alone ; zelda's been rescued
LDA.l BlockSanctuaryDoorInRain : BEQ + ;flagged
LDA.b RoomIndex : CMP.w #$0012 : BNE +
LDA.b $A0 : CMP.w #$0012 : BNE +
; we're in the sanctuary
; this code could be removed because you can't reach sanc without zelda currently
; but that's enforced in the logic, so this is to catch that case in case some mode allows it
LDA.l FollowerIndicator : AND.w #$00FF : CMP.w #$0001 : BEQ .leave_alone ; zelda is following
LDA.b Scrap0A
LDA.b $0A
CMP.w #$000A : BCC .leave_alone
CMP.w #$0014 : BCS .leave_alone
.block_door
SEC : RTS
+ LDA.l BlockCastleDoorsInRain : AND.w #$00FF : BEQ .leave_alone
LDX.w #$FFFE
LDX #$FFFE
- INX #2
LDA.l RemoveRainDoorsRoom, X : CMP.w #$FFFF : BEQ .leave_alone
CMP.b RoomIndex : BNE -
LDA.l RainDoorMatch, X
CMP.w $19EE : BNE .leave_alone
CMP $A0 : BNE -
LDA.b $0A
CMP.w #$000A : BCC .continue
CMP.w #$0014 : BCS .continue
BRA .block_door
.continue
BRA -

View File

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

View File

@@ -1,106 +1,80 @@
!BlankTile = $207F
!SlashTile = $2830
!HyphenTile = $2405
!LTile = $2D68
!DTile = $2D60
!RedSquare = $345E
!BlueSquare = $2C5E
DrHudOverride:
PHB
SEP #$30
LDA.b #$7E
PHA
PLB
{
jsl.l NewDrawHud
jsr HudAdditions
rtl
}
DRHUD_DrawItemCounter:
; hides total for mystery seeds
LDA.l ItemCounterHUD : BEQ DRHUD_DrawIndicators
LDA.l DRFlags+1 : LSR : BCC DRHUD_DrawIndicators
REP #$30
LDY.w #!HyphenTile : STY.w HUDGoalIndicator+$0A : STY.w HUDGoalIndicator+$0C
STY.w HUDGoalIndicator+$0E : STY.w HUDGoalIndicator+$10
SEP #$30
HudAdditions:
{
SEP #$10
LDA.l DRFlags : AND #$0008 : BNE + : JMP .end_item_count : +
LDA.l TotalItemCounter : PHA : CMP #1000 : !BLT +
JSL HexToDec4Digit_fast
LDX.b $04 : TXA : ORA.w #$2490 : STA !GOAL_DRAW_ADDRESS ; draw 1000's digit
BRA .skip
+ JSL HexToDec_fast
.skip
LDA #$207F : STA !GOAL_DRAW_ADDRESS+2 : STA !GOAL_DRAW_ADDRESS+4
PLA : PHA : CMP.w #100 : !BLT +
LDX.b $05 : TXA : ORA.w #$2490 : STA !GOAL_DRAW_ADDRESS+2 ; draw 100's digit
+ PLA : CMP.w #10 : !BLT +
LDX.b $06 : TXA : ORA.w #$2490 : STA !GOAL_DRAW_ADDRESS+4 ; draw 10's digit
+ LDX.b $07 : TXA : ORA.w #$2490 : STA !GOAL_DRAW_ADDRESS+6 ; draw 1's digit
LDA.w #$2830 : STA !GOAL_DRAW_ADDRESS+8 ; draw slash
LDA.l DRFlags : AND #$0100 : BNE +
LDA.l MultiClientFlagsWRAM+1 : CMP #1000 : !BLT .three_digit_goal
JSL HexToDec4Digit_fast
LDX.b $04 : TXA : ORA.w #$2490 : STA !GOAL_DRAW_ADDRESS+10 ; draw 1000's digit
LDX.b $05 : TXA : ORA.w #$2490 : STA !GOAL_DRAW_ADDRESS+12 ; draw 100's digit
LDX.b $06 : TXA : ORA.w #$2490 : STA !GOAL_DRAW_ADDRESS+14 ; draw 10's digit
LDX.b $07 : TXA : ORA.w #$2490 : STA !GOAL_DRAW_ADDRESS+16 ; draw 1's digit
BRA .end_item_count
.three_digit_goal
JSL HexToDec_fast
LDX.b $05 : TXA : ORA.w #$2490 : STA !GOAL_DRAW_ADDRESS+10 ; draw 100's digit
LDX.b $06 : TXA : ORA.w #$2490 : STA !GOAL_DRAW_ADDRESS+12 ; draw 10's digit
LDX.b $07 : TXA : ORA.w #$2490 : STA !GOAL_DRAW_ADDRESS+14 ; draw 1's digit
BRA .end_item_count
+ LDA.w #$2405 : STA !GOAL_DRAW_ADDRESS+10 : STA !GOAL_DRAW_ADDRESS+12
STA !GOAL_DRAW_ADDRESS+14 : STA !GOAL_DRAW_ADDRESS+16
.end_item_count
DRHUD_DrawIndicators:
LDA.b IndoorsFlag : BNE .continue
JMP OWRHUD_DrawWorldIndicator
.continue
LDA.b FrameCounter : AND.b #$10 : BEQ DRHUD_EnemyDropIndicator
LDX $1B : BNE + ; if outdoors
lda.l OWMode : and.w #((!FLAG_OW_CROSSED+!FLAG_OW_MIXED)<<8)+$ff : bne ++ : rts ; Skip if vanilla ow rando
++ lda CurrentHealth : and #$00ff : beq ++
lda CurrentWorld : and #$00ff : beq +++
lda #$2d60 : bra .owdisplay
+++ lda #$2d68 : bra .owdisplay
++ lda #$207f
.owdisplay sta $7ec702 : rts
+ ldx $040c : cpx #$ff : bne + : rts : + ; Skip if not in dungeon
lda.l DRMode : bne + : rts : + ; Skip if not door rando
phb : phk : plb
lda CompassField : and.l $0098c0, x : beq +
lda.w CompassBossIndicator, x : and #$00ff : cmp $a0 : bne +
lda $1a : and #$0010 : beq +
lda #$345e : sta $7ec790 : bra .next
+ lda #$207f : sta $7ec790
.next lda.w DRMode : and #$0002 : bne + : plb : rts : +
lda CurrentHealth : and #$00ff : beq +
lda.w DungeonReminderTable, x : bra .reminder
+ lda #$207f
.reminder sta $7ec702
+ lda.w DRFlags : and #$0004 : beq .restore
; lda MapField : and.l $0098c0, x : beq .restore
txa : lsr : tax
DRHUD_BossIndicator:
LDA.l DRMode : BNE .continue
.early_exit
REP #$10
LDY.w #!BlankTile : STY.w HUDMultiIndicator
JMP DRHUD_Finished
.continue
LDA.w DungeonID : CMP.b #$1B : BCS .early_exit
lda.l GenericKeys : and #$00ff : bne +
lda DungeonCollectedKeys, x : jsr ConvertToDisplay : sta $7ec7a2
lda #$2830 : sta $7ec7a4
+
lda.w ChestKeys, x : jsr ConvertToDisplay : sta $7ec7a6
; todo 4b0 no longer in use
SEP #$10 ; clears the high byte of X and prevents it from getting B register
TAX
REP #$30
LDY.w #!BlankTile
LDA.w CompassField : AND.l DungeonMask, x
SEP #$20
BEQ .draw_indicator
LDA.l CompassBossIndicator, x : CMP.b RoomIndex : BNE .draw_indicator
LDY.w #!RedSquare
.draw_indicator
STY.w HUDMultiIndicator
BRA DRHUD_DrawCurrentDungeonIndicator
DRHUD_EnemyDropIndicator:
REP #$30
LDA.w EnemyDropIndicator : STA.w HUDMultiIndicator
SEP #$20
LDA.w DungeonID : CMP.b #$1B : BCC + : JMP DRHUD_Finished : +
SEP #$10 : TAX : REP #$10
DRHUD_DrawCurrentDungeonIndicator: ; mX
LDA.l DRMode : BIT.b #$02 : BEQ DRHUD_Finished
LDY.w #!BlankTile
LDA.w CurrentHealth : BEQ .draw_indicator
REP #$20 : LDA.l DungeonReminderTable,X : TAY
SEP #$20
.draw_indicator
STY.w HUDCurrentDungeonWorld
DRHUD_DrawKeyCounter:
LDA.l DRFlags : AND.b #$04 : BEQ DRHUD_Finished
LDA.l CompassMode : BIT.b #$03 : BEQ DRHUD_Finished
REP #$20
BIT.w #$0002 : BNE .skip_map_check
LDA.w MapField : AND.l DungeonMask, X : BEQ DRHUD_Finished
.skip_map_check
TXA : LSR : BNE .dungeon_id
INC
.dungeon_id
TAX
LDA.l GenericKeys : LSR : BCS .total_only
LDA.w DungeonCollectedKeys, X : JSR ConvertToDisplay : STA.w HUDKeysObtained
LDA.w #!SlashTile : STA.w HUDKeysSlash
.total_only
LDA.l ChestKeys, x : JSR ConvertToDisplay : STA.w HUDKeysTotal
JMP DRHUD_Finished
OWRHUD_DrawWorldIndicator:
LDA.l OWMode+1 : AND.b #(!FLAG_OW_CROSSED+!FLAG_OW_MIXED) : BEQ DRHUD_Finished
REP #$10
LDY.w #!BlankTile
LDA.w CurrentHealth : BEQ .draw_indicator
LDA.w CurrentWorld : BEQ +
LDY.w #!DTile : BRA .draw_indicator
+ LDY.w #!LTile
.draw_indicator
STY.w HUDCurrentDungeonWorld ; uses same slot as DR Dungeon Indicator
DRHUD_Finished:
PLB : RTL
;===================================================================================================
.restore
plb : rts
}
;column distance for BK/Smalls
HudOffsets:
@@ -118,98 +92,96 @@ dw $0000, $0000, $0000, $0000, $000a, $000a, $000a, $0014, $000a, $0014, $0000,
DrHudDungeonItemsAdditions:
{
jsl DrawHUDDungeonItems
lda.l DRMode : cmp.b #$02 : beq + : rtl : +
lda.l HUDDungeonItems : and #$ff : bne + : rtl : +
lda.l DRMode : cmp #$02 : beq + : rtl : +
phx : phy : php
rep #$30
lda.w #$24f5 : sta.w $1606 : sta.w $1610 : sta.w $161a : sta.w $1624
sta.w $1644 : sta.w $164a : sta.w $1652 : sta.w $1662 : sta.w $1684 : sta.w $16c4
ldx.w #$0000
- sta.w $1704, x : sta.w $170e, x : sta.w $1718, x
inx #2 : cpx.w #$0008 : !BLT -
lda.w #$24f5 : sta $1606 : sta $1610 : sta $161a : sta $1624
sta $1644 : sta $164a : sta $1652 : sta $1662 : sta $1684 : sta $16c4
ldx #$0000
- sta $1704, x : sta $170e, x : sta $1718, x
inx #2 : cpx #$0008 : !blt -
lda.l HudFlag : and.w #$0020 : beq + : JMP ++ : +
lda.l HUDDungeonItems : and.w #$0007 : bne + : JMP ++ : +
lda HudFlag : and.w #$0020 : beq + : JMP ++ : +
lda HUDDungeonItems : and.w #$0007 : bne + : JMP ++ : +
; bk symbols
lda.w #$2811 : sta.w $1606 : sta.w $1610 : sta.w $161a : sta.w $1624
lda.w #$2811 : sta $1606 : sta $1610 : sta $161a : sta $1624
; sm symbols
lda.w #$2810 : sta.w $160a : sta.w $1614 : sta.w $161e : sta.w $16e4
lda.w #$2810 : sta $160a : sta $1614 : sta $161e : sta $16e4
; blank out stuff
lda.w #$24f5 : sta.w $1724
lda.w #$24f5 : sta $1724
ldx.w #$0002
- lda.w #$0000 : !ADD.l RowOffsets,x : !ADD.l ColumnOffsets, x : tay
lda.l DungeonReminderTable, x : sta.w $1644, y : iny #2
lda.w #$24f5 : sta.w $1644, y
lda.l MapField : and.l DungeonMask, x : beq + ; must have map
jsr BkStatus : sta.w $1644, y : bra .smallKey ; big key status
+ lda.l BigKeyField : and.l DungeonMask, x : beq .smallKey
lda.w #$2826 : sta.w $1644, y
ldx #$0002
- lda #$0000 : !addl RowOffsets,x : !addl ColumnOffsets, x : tay
lda.l DungeonReminderTable, x : sta $1644, y : iny #2
lda.w #$24f5 : sta $1644, y
lda MapField : and.l $0098c0, x : beq + ; must have map
jsr BkStatus : sta $1644, y : bra .smallKey ; big key status
+ lda BigKeyField : and.l $0098c0, x : beq .smallKey
lda.w #$2826 : sta $1644, y
.smallKey
+ iny #2
cpx.w #$001a : bne +
tya : !ADD.w #$003c : tay
+ stx.b Scrap00
cpx #$001a : bne +
tya : !add #$003c : tay
+ stx $00
txa : lsr : tax
lda.w #$24f5 : sta.w $1644, y
lda.l GenericKeys : and.w #$00FF : bne +
lda.l DungeonKeys, x : and.w #$00FF : beq +
jsr ConvertToDisplay2 : sta.w $1644, y
+ iny #2 : lda.w #$24f5 : sta.w $1644, y
phx : ldx.b Scrap00
LDA.l CompassMode : BIT.w #$0002 : BNE .skip_map_check
LDA.l MapField : AND.l DungeonMask, x : BEQ .key_info_done ; must have map
.skip_map_check
plx : sep #$30 : lda.l ChestKeys, x : sta.b Scrap02
lda.l GenericKeys : bne +++
lda.b Scrap02 : !SUB.l DungeonCollectedKeys, x : sta.b Scrap02
+++ lda.b Scrap02
rep #$30
jsr ConvertToDisplay2 : sta.w $1644, y ; small key totals
bra .skipStack
.key_info_done
plx
.skipStack iny #2
cpx.w #$000d : beq +
lda.w #$24f5 : sta.w $1644, y
lda.w #$24f5 : sta $1644, y
lda.l GenericKeys : and #$00FF : bne +
lda.l DungeonKeys, x : and #$00FF : beq +
jsr ConvertToDisplay2 : sta $1644, y
+ iny #2 : lda.w #$24f5 : sta $1644, y
phx : ldx $00
; lda MapField : and.l $0098c0, x : beq + ; must have map
plx : sep #$30 : lda.l ChestKeys, x : sta $02
lda.l GenericKeys : bne +++
lda $02 : !sub DungeonCollectedKeys, x : sta $02
+++ lda $02
rep #$30
jsr ConvertToDisplay2 : sta $1644, y ; small key totals
bra .skipStack
+ plx
.skipStack iny #2
cpx #$000d : beq +
lda.w #$24f5 : sta $1644, y
+
ldx.b Scrap00
+ inx #2 : cpx.w #$001b : bcs ++ : JMP -
ldx $00
+ inx #2 : cpx #$001b : bcs ++ : JMP -
++
lda.l HudFlag : and.w #$0020 : bne + : JMP ++ : +
; map symbols
lda.w #$2821 : sta.w $1606 : sta.w $1610 : sta.w $161a
; compass symbols
lda.w #$2c20 : sta.w $160a : sta.w $1614 : sta.w $161e : sta.w $16e4
lda HudFlag : and.w #$0020 : bne + : JMP ++ : +
lda HUDDungeonItems : and.w #$000c : bne + : JMP ++ : +
; map symbols (do I want these) ; note compass symbol is 2c20
lda.w #$2821 : sta $1606 : sta $1610 : sta $161a : sta $1624
; blank out a couple thing from old hud
lda.w #$24f5 : sta.w $1624 : sta.w $1724
ldx.w #$0002
- lda.w #$0000 ; start of hud area
!ADD.l RowOffsets, x : !ADD.l ColumnOffsets, x : tay
lda.l DungeonReminderTable, x : sta.w $1644, y
lda.w #$24f5 : sta $16e4 : sta $1724
sta $160a : sta $1614 : sta $161e ; blank out sm key indicators
ldx #$0002
- lda #$0000 ; start of hud area
!addl RowOffsets, x : !addl ColumnOffsets, x : tay
lda.l DungeonReminderTable, x : sta $1644, y
iny #2
lda.w #$24f5 : sta.w $1644, y ; blank out map spot
lda.l MapField : ora.l MapCountDisplay : ora.l MapOverlay
and.l DungeonMask, x : beq + ; must have map
JSR MapIndicatorShort : STA.w $1644, Y
lda.w #$24f5 : sta $1644, y ; blank out map spot
lda MapField : and.l $0098c0, x : beq + ; must have map
JSR MapIndicatorShort : STA $1644, Y
+ iny #2
cpx.w #$001a : bne +
tya : !ADD.w #$003c : tay
+ lda.l CompassField : ora.l CompassCountDisplay
and.l DungeonMask, x : beq + ; must have compass
cpx #$001a : bne +
tya : !add #$003c : tay
+ lda CompassField : and.l $0098c0, x : beq + ; must have compass
phx ; total chest counts
LDA.l CompassTotalsWRAM, x : !SUB.l DungeonLocationsChecked, x
SEP #$30 : JSR HudHexToDec2DigitCopy : REP #$30
lda.b Scrap06 : jsr ConvertToDisplay2 : sta.w $1644, y : iny #2
lda.b Scrap07 : jsr ConvertToDisplay2 : sta.w $1644, y
txa : lsr : tax
sep #$30
lda.l TotalLocations, x : !sub DungeonLocationsChecked, x : JSR HudHexToDec2DigitCopy
rep #$30
lda $06 : jsr ConvertToDisplay2 : sta $1644, y : iny #2
lda $07 : jsr ConvertToDisplay2 : sta $1644, y
plx
bra .skipBlanks
+ lda.w #$24f5 : sta.w $1644, y : iny #2 : sta.w $1644, y
+ lda.w #$24f5 : sta $1644, y : iny #2 : sta $1644, y
.skipBlanks iny #2
cpx.w #$001a : beq +
lda.w #$24f5 : sta.w $1644, y ; blank out spot
+ inx #2 : cpx.w #$001b : !BGE ++ : JMP -
cpx #$001a : beq +
lda.w #$24f5 : sta $1644, y ; blank out spot
+ inx #2 : cpx #$001b : !bge ++ : JMP -
++
plp : ply : plx : rtl
}
@@ -236,53 +208,72 @@ IndicatorCharacters:
dw $2426, $2817, $2818, $2819, $281A, $281B, $281C, $281D, $2590, $258B, $259B
MapIndicator:
LDA.l CrystalPendantFlags_3, X : AND.w #$00FF
LDA.l CrystalPendantFlags_3, X : AND #$00FF
PHX
ASL : TAX : LDA.l IndicatorCharacters, X
PLX
RTS
BkStatus:
lda.l BigKeyField : and.l DungeonMask, x : bne +++ ; has the bk already
lda BigKeyField : and.l $0098c0, x : bne +++ ; has the bk already
lda.l BigKeyStatus, x : bne ++
lda.w #$2827 : rts ; 0/O for no BK
++ cmp.w #$0002 : bne +
lda.w #$2420 : rts ; symbol for BnC
+ lda.w #$24f5 : rts ; black otherwise
+++ lda.w #$2826 : rts ; check mark
lda #$2827 : rts ; 0/O for no BK
++ cmp #$0002 : bne +
lda #$2420 : rts ; symbol for BnC
+ lda #$24f5 : rts ; black otherwise
+++ lda #$2826 : rts ; check mark
ConvertToDisplay:
and.w #$00ff : cmp.w #$000a : !BLT +
!ADD.w #$2519 : rts
+ !ADD.w #$2490 : rts
and.w #$00ff : cmp #$000a : !blt +
!add #$2553 : rts
+ !add #$2490 : rts
ConvertToDisplay2:
and.w #$00ff : beq ++
cmp.w #$000a : !BLT +
!ADD.w #$2517 : rts ; 2580 with 258A as "A" for non transparent digits
+ !ADD.w #$2816 : rts
++ lda.w #$2827 : rts ; 0/O for 0 or placeholder digit ;2483
cmp #$000a : !blt +
!add #$2553 : rts ; 2580 with 258A as "A" for non transparent digits
+ !add #$2816 : rts
++ lda #$2827 : rts ; 0/O for 0 or placeholder digit ;2483
CountAbsorbedKeys:
JML IncrementSmallKeysNoPrimary
jsl IncrementSmallKeysNoPrimary : phx
lda $040c : cmp #$ff : beq +
lsr : tax
lda DungeonAbsorbedKeys, x : inc : sta DungeonAbsorbedKeys, x
+ plx : rtl
; This function apporach doesn't currently work
CountAbsorbedKeysViaCountAllKey:
PHA : PHX
LDA.l StandingItemsOn : BEQ .count_it
; LDA.w SpawnedItemKeyCounted : BNE .done ; this was added because pot keys were being double counted when they weren't shuffled
CPY.b #$24 : BEQ .count_it ; small key for this dungeon
LDA.w DungeonID : LSR : TAX
TYA : CMP.l KeyTable, X : BNE .done
.count_it
STY.b Scrap02 : LDY.b #$24 ; for non-24 items (w/o standing_items a small key is just $C), fake it
LDX.b #$84 ; pretend this isn't a smallkey, but an absorbed object (small heart)
REP #$10 : JSL CountAllKey : SEP #$10
LDY.b Scrap02
.done
; STZ.w SpawnedItemKeyCounted ; reset to zero for next time
PLX : PLA
JML IncrementSmallKeysNoPrimary
;================================================================================
; 16-bit A, 8-bit X
; in: A(b) - Byte to Convert
; out: $04 - $07 (high - low)
;================================================================================
HudHexToDec4DigitCopy:
LDY.b #$90
-
CMP.w #1000 : !BLT +
INY
SBC.w #1000 : BRA -
+
STY $04 : LDY #$90 ; Store 1000s digit & reset Y
-
CMP.w #100 : !BLT +
INY
SBC.w #100 : BRA -
+
STY $05 : LDY #$90 ; Store 100s digit & reset Y
-
CMP.w #10 : !BLT +
INY
SBC.w #10 : BRA -
+
STY $06 : LDY #$90 ; Store 10s digit & reset Y
CMP.w #1 : !BLT +
-
INY
DEC : BNE -
+
STY $07 ; Store 1s digit
RTS
;================================================================================
; 8-bit registers
@@ -297,12 +288,12 @@ HudHexToDec2DigitCopy: ; modified
INY
SBC.b #10 : BRA -
+
STY.b Scrap06 : LDY.b #$00 ; Store 10s digit and reset Y
STY $06 : LDY #$00 ; Store 10s digit and reset Y
CMP.b #1 : !BLT +
-
INY
DEC : BNE -
+
STY.b Scrap07 ; Store 1s digit
STY $07 ; Store 1s digit
PLY
RTS

View File

@@ -13,24 +13,24 @@ CheckIfDoorsOpen: {
jsr TrapDoorFixer ; see normal.asm
; note we are 16bit mode right now
lda.l DRMode : beq +
lda.w DungeonID : cmp.w #$00ff : bne .gtg
+ lda.b RoomIndex : dec : tax : and.w #$000f ; hijacked code
lda $040c : cmp #$00ff : bne .gtg
+ lda $a0 : dec : tax : and #$000f ; hijacked code
sec : rtl ; set carry to indicate normal behavior
.gtg
phb : phk : plb
stx.b Scrap00 : ldy.w #$0000
stx $00 : ldy #$0000
.nextDoor
lda.b RoomIndex : asl : tax
lda $a0 : asl : tax
lda.w KeyDoorOffset, x : beq .skipDoor
asl : sty.b Scrap05 : !ADD.b Scrap05 : tax
asl : sty $05 : !add $05 : tax
lda.w PairedDoorTable, x : beq .skipDoor
sta.b Scrap02 : and.w #$00ff : asl a : tax
lda.b Scrap02 : and.w #$ff00 : sta.b Scrap03
lda.l RoomDataWRAM.l, X : and.w #$f000 : and.b Scrap03 : beq .skipDoor
tyx : lda.w $068c : ora.l DungeonMask,x : sta.w $068c
sta $02 : and #$00ff : asl a : tax
lda $02 : and #$ff00 : sta $03
lda RoomDataWRAM.l, X : and #$f000 : and $03 : beq .skipDoor
tyx : lda $068c : ora $0098c0,x : sta $068c
.skipDoor
iny #2 : cpy.b Scrap00 : bne .nextDoor
iny #2 : cpy $00 : bne .nextDoor
plb : clc : rtl
}

View File

@@ -7,60 +7,60 @@
;00 00 01 01 01 02 02 02 03 03 03 04 04 04 05 05 05 06 06 06 07 07 07 08 08
MultiplyByY:
.loop cpy.w #$0001 : beq .done
cpy.w #$0003 : bne ++
.loop cpy #$0001 : beq .done
cpy #$0003 : bne ++
jsr MultiBy3 : bra .done
++ cpy.w #$0005 : bne ++
++ cpy #$0005 : bne ++
jsr MultiBy5 : bra .done
++ asl : sta.b Scrap00 : tya : lsr : tay : lda.b Scrap00 : bra .loop
++ asl : sta $00 : tya : lsr : tay : lda $00 : bra .loop
.done rts
;Divisor in Y. Width of division is in X for rounding toward middle
DivideByY:
.loop
cpy.w #$0000 : beq .done
cpy.w #$0001 : beq .done
cpy.w #$0003 : bne ++
cpy #$0000 : beq .done
cpy #$0001 : beq .done
cpy #$0003 : bne ++
jsr DivideBy3 : bra .done
++ cpy.w #$0005 : bne ++
++ cpy #$0005 : bne ++
jsr DivideBy5 : bra .done
++ jsr DivideBy2 : sta.b Scrap00
++ jsr DivideBy2 : sta $00
tya : lsr : tay
txa : lsr : tax
lda.b Scrap00 : bra .loop
lda $00 : bra .loop
.done rts
MultiBy3:
sta.b Scrap00 : asl : !ADD.b Scrap00
sta $00 : asl : !add $00
rts
MultiBy5:
sta.b Scrap00 : asl #2 : !ADD.b Scrap00
sta $00 : asl #2 : !add $00
rts
;width of divison in x: rounds toward X/2
DivideBy2:
sta.b Scrap00
sta $00
lsr : bcc .done
sta.b Scrap02 : txa : lsr : cmp.b Scrap00 : !BLT +
lda.b Scrap02 : inc : bra .done
+ lda.b Scrap02
sta $02 : txa : lsr : cmp $00 : !blt +
lda $02 : inc : bra .done
+ lda $02
.done rts
DivideBy3:
sta.b Scrap00
ldx.w #$0000
lda.w #$0002
.loop cmp.b Scrap00 : !BGE .store
inx : !ADD.w #$0003 : bra .loop
sta $00
ldx #$0000
lda #$0002
.loop cmp $00 : !bge .store
inx : !add #$0003 : bra .loop
.store txa
rts
DivideBy5:
sta.b Scrap00
ldx.w #$0000
lda.w #$0003
.loop cmp.b Scrap00 : !BGE .store
inx : !ADD.w #$0005 : bra .loop
sta $00
ldx #$0000
lda #$0003
.loop cmp $00 : !bge .store
inx : !add #$0005 : bra .loop
.store txa
rts

View File

@@ -1,9 +1,9 @@
WarpLeft:
lda.l DRMode : beq .end
JSR CheckIfCave : BCS .end
lda.b LinkPosY : ldx.b LinkQuadrantV
lda $040c : cmp.b #$ff : beq .end
lda $20 : ldx $aa
jsr CalcIndex
!ADD.b #$06 : ldy.b #$01 ; offsets in A, Y
!add #$06 : ldy #$01 ; offsets in A, Y
jsr LoadRoomHorz
.end
jsr Cleanup
@@ -11,10 +11,10 @@ WarpLeft:
WarpRight:
lda.l DRMode : beq .end
JSR CheckIfCave : BCS .end
lda.b LinkPosY : ldx.b LinkQuadrantV
lda $040c : cmp.b #$ff : beq .end
lda $20 : ldx $aa
jsr CalcIndex
!ADD.b #$12 : ldy.b #$ff ; offsets in A, Y
!add #$12 : ldy #$ff ; offsets in A, Y
jsr LoadRoomHorz
.end
jsr Cleanup
@@ -22,10 +22,10 @@ WarpRight:
WarpUp:
lda.l DRMode : beq .end
JSR CheckIfCave : BCS .end
lda.b LinkPosX : ldx.b LinkQuadrantH
lda $040c : cmp.b #$ff : beq .end
lda $22 : ldx $a9
jsr CalcIndex
ldy.b #$02 ; offsets in A, Y
ldy #$02 ; offsets in A, Y
jsr LoadRoomVert
.end
jsr Cleanup
@@ -33,17 +33,17 @@ WarpUp:
; Checks if $a0 is equal to <Room>. If it is, opens its stonewall if it's there
macro StonewallCheck(Room)
lda.b RoomIndex : cmp.b #<Room> : bne ?end
lda.l <Room>*2+$7ef000 : ora.b #$80 : sta.l <Room>*2+$7ef000
lda $a0 : cmp.b #<Room> : bne ?end
lda.l <Room>*2+$7ef000 : ora #$80 : sta.l <Room>*2+$7ef000
?end
endmacro
WarpDown:
lda.l DRMode : beq .end
JSR CheckIfCave : BCS .end
lda.b LinkPosX : ldx.b LinkQuadrantH
lda $040c : cmp.b #$ff : beq .end
lda $22 : ldx $a9
jsr CalcIndex
!ADD.b #$0c : ldy.b #$ff ; offsets in A, Y
!add #$0c : ldy #$ff ; offsets in A, Y
jsr LoadRoomVert
%StonewallCheck($43)
.end
@@ -54,49 +54,41 @@ WarpDown:
; carry clear = we are in dr mode, never use linking doors
CheckLinkDoorR:
lda.l DRMode : bne +
lda.l $7ec004 : sta.b RoomIndex ; what we wrote over
lda $7ec004 : sta $a0 ; what we wrote over
sec : rtl
+ clc : rtl
CheckLinkDoorL:
lda.l DRMode : bne +
lda.l $7ec003 : sta.b RoomIndex ; what we wrote over
lda $7ec003 : sta $a0 ; what we wrote over
sec : rtl
+ clc : rtl
TrapDoorFixer:
lda.b $fe : and.w #$0038 : beq .end
xba : asl #2 : sta.b Scrap00
stz.w TrapDoorFlag : lda.w $068c : ora.b Scrap00 : sta.w $068c
lda $fe : and #$0038 : beq .end
xba : asl #2 : sta $00
stz $0468 : lda $068c : ora $00 : sta $068c
.end
stz.b $fe ; clear our fe here because we don't need it anymore
stz $fe ; clear our fe here because we don't need it anymore
rts
Cleanup:
lda.l DRFlags : and.b #$10 : beq +
stz.w LayerAdjustment
+ inc.b GameSubMode
lda.b $ef
lda.l DRFlags : and #$10 : beq +
stz $047a
+ inc $11
lda $ef
rts
; carry set if cave, clear otherwise
CheckIfCave:
REP #$30
LDA.b PreviousRoom : CMP.w #$00E1 : BCS .invalid
SEP #$30 : CLC : RTS
.invalid
SEP #$30 : SEC : RTS
;A needs be to the low coordinate, x needs to be either 0 for left,upper or non-zero for right,down
; This sets A (00,02,04) and stores half that at $04 for later use, (src door)
CalcIndex: ; A->low byte of Link's Coord, X-> Link's quadrant, DoorOffset x 2 -> A, DoorOffset -> $04 (vert/horz agnostic)
cpx.b #00 : bne .largeDoor
cmp.b #$d0 : bcc .smallDoor
lda.b #$01 : bra .done ; Middle Door
.smallDoor lda.b #$00 : bra .done
.largeDoor lda.b #$02
lda #$01 : bra .done ; Middle Door
.smallDoor lda #$00 : bra .done
.largeDoor lda #$02
.done
sta.b Scrap04
sta $04
asl
rts
@@ -105,30 +97,30 @@ CalcIndex: ; A->low byte of Link's Coord, X-> Link's quadrant, DoorOffset x 2 ->
LoadRoomHorz:
{
phb : phk : plb
sty.b Scrap06 : sta.b Scrap07 : lda.b RoomIndex : pha ; Store normal room on stack
lda.b Scrap07 : jsr LookupNewRoom ; New room is in A, Room Data is in $00-$01
lda.b Scrap00 : cmp.b #$03 : bne .gtg
sty $06 : sta $07 : lda $a0 : pha ; Store normal room on stack
lda $07 : jsr LookupNewRoom ; New room is in A, Room Data is in $00-$01
lda $00 : cmp #$03 : bne .gtg
jsr HorzEdge : pla : bcs .end
sta.b RoomIndex : bra .end ; Restore normal room, abort (straight staircases and open edges can get in this routine)
sta $a0 : bra .end ; Restore normal room, abort (straight staircases and open edges can get in this routine)
.gtg ;Good to Go!
pla ; Throw away normal room (don't fill up the stack)
lda.b RoomIndex : and.b #$0F : asl a : !SUB.b LinkPosX+1 : !ADD.b Scrap06 : sta.b Scrap02
ldy.b #$00 : jsr ShiftVariablesMainDir
lda $a0 : and.b #$0F : asl a : !sub $23 : !add $06 : sta $02
ldy #$00 : jsr ShiftVariablesMainDir
lda.b Scrap01 : and.b #$80 : beq .normal
ldy.b Scrap06 : cpy.b #$ff : beq +
lda.b Scrap01 : jsr LoadEastMidpoint : bra ++
+ lda.b Scrap01 : jsr LoadWestMidpoint
lda $01 : and #$80 : beq .normal
ldy $06 : cpy #$ff : beq +
lda $01 : jsr LoadEastMidpoint : bra ++
+ lda $01 : jsr LoadWestMidpoint
++ jsr PrepScrollToEdge : bra .scroll
.normal
jsr PrepScrollToNormal
.scroll
lda.b Scrap01 : and.b #$40 : pha
lda $01 : and #$40 : pha
jsr ScrollY
pla : beq .end
ldy.b #$06 : jsr ApplyScroll
ldy #$06 : jsr ApplyScroll
.end
plb ; restore db register
rts
@@ -139,32 +131,32 @@ LoadRoomHorz:
LoadRoomVert:
{
phb : phk : plb
sty.b Scrap06 : sta.b Scrap07 : lda.b RoomIndex : pha ; Store normal room on stack
lda.b Scrap07 : jsr LookupNewRoom ; New room is in A, Room Data is in $00-$01
lda.b Scrap00 : cmp.b #$03 : bne .gtg
sty $06 : sta $07 : lda $a0 : pha ; Store normal room on stack
lda $07 : jsr LookupNewRoom ; New room is in A, Room Data is in $00-$01
lda $00 : cmp #$03 : bne .gtg
jsr VertEdge : pla : bcs .end
sta.b RoomIndex : bra .end ; Restore normal room, abort (straight staircases and open edges can get in this routine)
sta $a0 : bra .end ; Restore normal room, abort (straight staircases and open edges can get in this routine)
.gtg ;Good to Go!
pla ; Throw away normal room (don't fill up the stack)
lda.b RoomIndex : and.b #$F0 : lsr #3 : !SUB.b LinkPosY+1 : !ADD.b Scrap06 : sta.b Scrap02
lda $a0 : and.b #$F0 : lsr #3 : !sub $21 : !add $06 : sta $02
lda.b Scrap01 : and.b #$80 : beq .notEdge
ldy.b #$01 : jsr ShiftVariablesMainDir
ldy.b Scrap06 : cpy.b #$ff : beq +
lda.b Scrap01 : jsr LoadSouthMidpoint : bra ++
+ lda.b Scrap01 : jsr LoadNorthMidpoint
lda $01 : and #$80 : beq .notEdge
ldy #$01 : jsr ShiftVariablesMainDir
ldy $06 : cpy #$ff : beq +
lda $01 : jsr LoadSouthMidpoint : bra ++
+ lda $01 : jsr LoadNorthMidpoint
++ jsr PrepScrollToEdge : bra .scroll
.notEdge
lda.b Scrap01 : and.b #$03 : cmp.b #$03 : bne .normal
lda $01 : and #$03 : cmp #$03 : bne .normal
jsr ScrollToInroomStairs
stz.w $046d
stz $046d
bra .end
.normal
ldy.b #$01 : jsr ShiftVariablesMainDir
ldy #$01 : jsr ShiftVariablesMainDir
jsr PrepScrollToNormal
.scroll
lda.b Scrap01 : and.b #$40 : sta.w $046d
lda $01 : and #$40 : sta $046d
jsr ScrollX
.end
plb ; restore db register
@@ -173,14 +165,14 @@ LoadRoomVert:
LookupNewRoom: ; expects data offset to be in A
{
rep #$30 : and.w #$00FF ;sanitize A reg (who knows what is in the high byte)
sta.b Scrap00 ; offset in 00
lda.b PreviousRoom : tax ; probably okay loading $a3 in the high byte
lda.w DoorOffset,x : and.w #$00FF ;we only want the low byte
asl #3 : sta.b Scrap02 : !ADD.b Scrap02 : !ADD.b Scrap02 ;multiply by 24 (data size)
!ADD.b Scrap00 ; should now have the offset of the address I want to load
tax : lda.w DoorTable,x : sta.b Scrap00
and.w #$00FF : sta.b RoomIndex ; assign new room
rep #$30 : and #$00FF ;sanitize A reg (who knows what is in the high byte)
sta $00 ; offset in 00
lda $a2 : tax ; probably okay loading $a3 in the high byte
lda.w DoorOffset,x : and #$00FF ;we only want the low byte
asl #3 : sta $02 : !add $02 : !add $02 ;multiply by 24 (data size)
!add $00 ; should now have the offset of the address I want to load
tax : lda.w DoorTable,x : sta $00
and #$00FF : sta $a0 ; assign new room
sep #$30
rts
}
@@ -190,14 +182,14 @@ LookupNewRoom: ; expects data offset to be in A
ShiftVariablesMainDir:
{
lda.w CoordIndex,y : tax
lda.b LinkPosY+1,x : !ADD.b Scrap02 : sta.b LinkPosY+1,x ; coordinate update
lda $21,x : !add $02 : sta $21,x ; coordinate update
lda.w CameraIndex,y : tax
lda.b $e3,x : !ADD.b Scrap02 : sta.b $e3,x ; scroll register high byte
lda $e3,x : !add $02 : sta $e3,x ; scroll register high byte
lda.w CamQuadIndex,y : tax
lda.w $0605,x : !ADD.b Scrap02 : sta.w $0605,x ; high bytes of these guys
lda.w $0607,x : !ADD.b Scrap02 : sta.w $0607,x
lda.w $0601,x : !ADD.b Scrap02 : sta.w $0601,x
lda.w $0603,x : !ADD.b Scrap02 : sta.w $0603,x
lda $0605,x : !add $02 : sta $0605,x ; high bytes of these guys
lda $0607,x : !add $02 : sta $0607,x
lda $0601,x : !add $02 : sta $0601,x
lda $0603,x : !add $02 : sta $0603,x
rts
}
@@ -205,12 +197,12 @@ ShiftVariablesMainDir:
ScrollToInroomStairs:
{
jsr PrepScrollToInroomStairs
ldy.b #$01 : jsr ShiftVariablesMainDir
ldy #$01 : jsr ShiftVariablesMainDir
jsr ScrollX
ldy.b #$00 : jsr ApplyScroll
lda.b RoomIndex : and.b #$0f : cmp.b #$0f : bne +
stz.b BG1H : stz.b BG2H ; special case camera fix
lda.b #$1f : sta.b BG1H+1 : sta.b BG2H+1
ldy #$00 : jsr ApplyScroll
lda $a0 : and #$0f : cmp #$0f : bne +
stz $e0 : stz $e2 ; special case camera fix
lda #$1f : sta $e1 : sta $e3
+
rts
}
@@ -219,48 +211,48 @@ ScrollToInroomStairs:
; Sets $02, $04, $05, $ee, $045e, $045f and things related to Y coordinate
PrepScrollToInroomStairs:
{
lda.b Scrap01 : and.b #$30 : lsr #3 : tay
lda.w InroomStairsX,y : sta.b Scrap04
lda.w InroomStairsX+1,y : sta.b Scrap05
lda.b Scrap06 : cmp.b #$ff : beq .south
lda $01 : and #$30 : lsr #3 : tay
lda.w InroomStairsX,y : sta $04
lda.w InroomStairsX+1,y : sta $05
lda $06 : cmp #$ff : beq .south
lda.w InroomStairsY+1,y : bne +
inc.w $045f ; flag indicating special screen transition
dec.b Scrap02 ; shift variables further
stz.b LinkQuadrantV
lda.b $a8 : and.b #%11111101 : sta.b $a8
stz.w CameraTargetS+1 ; North scroll target
inc.w $0603 : inc.w $0607
dec.w CameraScrollN+1 : dec.w CameraScrollS+1
inc $045f ; flag indicating special screen transition
dec $02 ; shift variables further
stz $aa
lda $a8 : and #%11111101 : sta $a8
stz $0613 ; North scroll target
inc $0603 : inc $0607
dec $0619 : dec $061b
+
lda.w InroomStairsY,y : !ADD.b #$20 : sta.b LinkPosY
!SUB.b #$38 : sta.w $045e
lda.b Scrap01 : and.b #$40 : beq +
lda.b LinkPosY : !ADD.b #$20 : sta.b LinkPosY
stz.w $045f
lda.w InroomStairsY,y : !add #$20 : sta $20
!sub #$38 : sta $045e
lda $01 : and #$40 : beq +
lda $20 : !add #$20 : sta $20
stz $045f
+
dec.b LinkPosY+1
dec $21
%StonewallCheck($1b)
bra ++
.south
lda.w InroomStairsY+1,y : beq +
inc.w $045f ; flag indicating special screen transition
inc.b Scrap02 ; shift variables further
lda.b #$02 : sta.b LinkQuadrantV
lda.b $a8 : ora.b #%00000010 : sta.b $a8
inc.w CameraTargetN+1 ; South scroll target
dec.w $0603 : dec.w $0607
inc.w CameraScrollN+1 : inc.w CameraScrollS+1
inc $045f ; flag indicating special screen transition
inc $02 ; shift variables further
lda #$02 : sta $aa
lda $a8 : ora #%00000010 : sta $a8
inc $0611 ; South scroll target
dec $0603 : dec $0607
inc $0619 : inc $061b
+
lda.w InroomStairsY,y : !SUB.b #$20 : sta.b LinkPosY
!ADD.b #$38 : sta.w $045e
lda.b Scrap01 : and.b #$40 : beq +
lda.b LinkPosY : !SUB.b #$20 : sta.b LinkPosY
stz.w $045f
lda.w InroomStairsY,y : !sub #$20 : sta $20
!add #$38 : sta $045e
lda $01 : and #$40 : beq +
lda $20 : !sub #$20 : sta $20
stz $045f
+
inc.b LinkPosY+1
inc $21
++
lda.b Scrap01 : and.b #$04 : lsr #2 : sta.b LinkLayer : bne +
stz.w $0476
lda $01 : and #$04 : lsr #2 : sta $ee : bne +
stz $0476
+ rts
}
@@ -268,13 +260,13 @@ PrepScrollToInroomStairs:
; Sets $04 $05 and $ee
PrepScrollToEdge:
{
sta.b Scrap04 : lda.b Scrap01 : and.b #$20 : beq +
lda.b #01
+ sta.b Scrap05
lda.b Scrap01 : and.b #$10 : beq +
lda.b #01
+ sta.b LinkLayer : bne +
stz.w $0476
sta $04 : lda $01 : and #$20 : beq +
lda #01
+ sta $05
lda $01 : and #$10 : beq +
lda #01
+ sta $ee : bne +
stz $0476
+ rts
}
@@ -282,56 +274,56 @@ PrepScrollToEdge:
; Sets $04 $05 and $ee, and $fe
PrepScrollToNormal:
{
lda.b Scrap01 : sta.b $fe : and.b #$04 : lsr #2 : sta.b LinkLayer ; trap door and layer
lda $01 : sta $fe : and #$04 : lsr #2 : sta $ee ; trap door and layer
bne +
stz.w $0476
+ stz.b Scrap05 : lda.b #$78 : sta.b Scrap04
lda.b Scrap01 : and.b #$03 : beq .end
cmp.b #$02 : !BGE +
lda.b #$f8 : sta.b Scrap04 : bra .end
+ inc.b Scrap05
stz $0476
+ stz $05 : lda #$78 : sta $04
lda $01 : and #$03 : beq .end
cmp #$02 : !bge +
lda #$f8 : sta $04 : bra .end
+ inc $05
.end rts
}
StraightStairsAdj:
{
stx.w $0464 : sty.w SFX2 ; what we wrote over
stx $0464 : sty $012e ; what we wrote over
lda.l DRMode : beq +
lda.w $045e : bne .toInroom
lda.w $046d : beq .noScroll
sta.b LinkPosX
ldy.b #$00 : jsr ApplyScroll
stz.w $046d
lda $045e : bne .toInroom
lda $046d : beq .noScroll
sta $22
ldy #$00 : jsr ApplyScroll
stz $046d
.noScroll
jsr GetTileAttribute : tax
lda.b GameSubMode : cmp.b #$12 : beq .goingNorth
lda.b PreviousRoom : cmp.b #$51 : bne ++
rep #$20 : lda.w #$0018 : !ADD.b LinkPosY : sta.b LinkPosY : sep #$20 ; special fix for throne room
lda $11 : cmp #$12 : beq .goingNorth
lda $a2 : cmp #$51 : bne ++
rep #$20 : lda #$0018 : !add $20 : sta $20 : sep #$20 ; special fix for throne room
jsr GetTileAttribute : tax
++ lda.l StepAdjustmentDown, X : bra .end
; lda.b LinkLayer : beq .end
; rep #$20 : lda.w #$ffe0 : !ADD.b LinkPosY : sta.b LinkPosY : sep #$20
; lda $ee : beq .end
; rep #$20 : lda #$ffe0 : !add $20 : sta $20 : sep #$20
.goingNorth
cpx.b #$00 : bne ++
lda.b RoomIndex : cmp.b #$51 : bne ++
lda.b #$36 : bra .end ; special fix for throne room
++ ldy.b LinkLayer : cpy.b #$00 : beq ++
cpx #$00 : bne ++
lda $a0 : cmp #$51 : bne ++
lda #$36 : bra .end ; special fix for throne room
++ ldy $ee : cpy #$00 : beq ++
inx
++ lda.l StepAdjustmentUp, X
.end
pha : lda.w $0462 : and.b #$04 : bne ++
pla : !ADD.b #$f6 : pha
++ pla : !ADD.w $0464 : sta.w $0464
pha : lda $0462 : and #$04 : bne ++
pla : !add #$f6 : pha
++ pla : !add $0464 : sta $0464
+ rtl
.toInroom
lda.b #$32 : sta.w $0464 : stz.w $045e
lda #$32 : sta $0464 : stz $045e
rtl
}
GetTileAttribute:
{
phk : pea.w .jslrtsreturn-1
pea.w $82802c
pea.w $02802c
jml CalculateTransitionLanding ; mucks with x/y sets a to Tile Attribute, I think
.jslrtsreturn
rts
@@ -352,15 +344,15 @@ StraightStairsFix:
{
pha
lda.l DRMode : bne +
pla : !ADD.b LinkPosY : sta.b LinkPosY : rtl ;what we wrote over
pla : !add $20 : sta $20 : rtl ;what we wrote over
+ pla : rtl
}
StraightStairLayerFix:
{
lda.l DRMode : beq +
lda.b LinkLayer : rtl
+ lda.l LayerOfDestination+3, x : rtl ; what we wrote over
lda $ee : rtl
+ lda $01c322, x : rtl ; what we wrote over
}
DoorToStraight:
@@ -369,61 +361,62 @@ DoorToStraight:
lda.l DRMode : beq .skip
pla : bne .end
pha
lda.b RoomIndex : cmp.b #$51 : bne .skip
lda.b #$04 : sta.b $4e
lda $a0 : cmp #$51 : bne .skip
lda #$04 : sta $4e
.skip pla
.end LDX.w TransitionDirection : CMP.b #$02 ; what we wrote over
; the ldx $0418 is now taken care of by TransitionCalculateLanding_Fix
.end cmp #$02 ;what we wrote over
rtl
}
DoorToInroom:
{
ldx.w $045e : bne .end
sta.w $0020, y ; what we wrote over
ldx $045e : bne .end
sta $0020, y ; what we wrote over
.end
ldx.b #$00 ; what we wrote over
ldx #$00 ; what we wrote over
rtl
}
DoorToInroomEnd:
{
ldy.w $045e : beq .vanilla
cmp.w $045e : bne .return
stz.w $045e ; clear
ldy $045e : beq .vanilla
cmp $045e : bne .return
stz $045e ; clear
.return
rtl
.vanilla
cmp.l UnderworldTransitionLandingCoordinate, x ; what we wrote over
cmp $02c034, x ; what we wrote over
rtl
}
StraightStairsTrapDoor:
{
lda.w $0464 : bne +
lda $0464 : bne +
; reset function
.reset phk : pea.w .jslrtsreturn-1
pea.w $82802c
jml ResetThenCacheRoomEntryProperties ; $10D71 .reset label of Bank02
pea.w $02802c
jml $028c73 ; $10D71 .reset label of Bank02
.jslrtsreturn
lda.w TrapDoorFlag : bne ++
lda.b RoomIndex : cmp.b #$ac : bne .animateTraps
lda.w $0403 : and.b #$20 : bne .animateTraps
lda.w $0403 : and.b #$10 : beq ++
lda $0468 : bne ++
lda $a0 : cmp.b #$ac : bne .animateTraps
lda $0403 : and.b #$20 : bne .animateTraps
lda $0403 : and.b #$10 : beq ++
.animateTraps
lda.b #$05 : sta.b GameSubMode
inc.w TrapDoorFlag : stz.w TileMapDoorPos : stz.w DoorTimer
++ JML Underworld_SetBossOrSancMusicUponEntry_long
lda #$05 : sta $11
inc $0468 : stz $068e : stz $0690
++ JSL Underworld_DoorDown_Call : rtl
+ JML Dungeon_ApproachFixedColor ; what we wrote over
}
InroomStairsTrapDoor:
{
lda.w SubModuleInterface : cmp.b #$05 : beq .reset
lda.b SubSubModule : jml JumpTableLocal ; what we wrote over (essentially)
lda $0200 : cmp #$05 : beq .reset
lda $b0 : jml $008781 ; what we wrote over (essentially)
.reset
pla : pla : pla
jsl StraightStairsTrapDoor_reset
jml $828b15 ; just some RTS in bank 02
jml $028b15 ; just some RTS in bank 02
}
HandleSpecialDoorLanding: {
@@ -433,16 +426,15 @@ HandleSpecialDoorLanding: {
HandleIncomingDoorState:
PHA
LDA.l DRMode : BEQ .noDoor
LDA.b 1,S : AND.b #$FA : CMP.b #$80 : bne .noDoor
PLA : PHA : AND.b #$FA : CMP.b #$80 : bne .noDoor
.setDoorState
LDA.w TransitionDirection : AND.b #$02 : BNE + : INC
LDA.w $0418 : AND.b #$02 : BNE + : INC
+ STA.b $6C
.noDoor
PLA
CMP.b #$34 : BNE + ; inroom stairs
PHA : LDA.b #$26 : STA.w $045E : PLA
+
RTL
CMP #$34 : bne + ; inroom stairs
PHA : LDA #$26 : STA $045E : PLA
+ RTL
}

View File

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

View File

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

View File

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

View File

@@ -1,479 +1,9 @@
;================================================================================
; Dungeon & Boss Drop Fixes
;--------------------------------------------------------------------------------
SpawnDungeonPrize:
PHX : PHB
PHA
; Don't spawn prize in Cave state, Hyrule Castle, Escape, Castle Tower, or Ganon's Tower
LDA.w DungeonID : BMI .skip_prize_drop ; Cave state
CMP.b #$00 : BEQ .skip_prize_drop ; Escape
CMP.b #$02 : BEQ .skip_prize_drop ; Hyrule Castle
CMP.b #$1A : BEQ .skip_prize_drop ; Ganon's Tower
CMP.b #$08 : BEQ .skip_prize_drop ; Agahnim's Tower (Castle Tower)
PLA
STA.w ItemReceiptID
TAX
LDA.b $06,S : STA.b ScrapBuffer72 ; Store current RoomTag index
LDA.b #$29 : LDY.b #$06
JSL AddAncillaLong
BCS .failed_spawn
LDA.w ItemReceiptID
STA.w AncillaGet,X
JSR AddDungeonPrizeAncilla
LDX.b ScrapBuffer72 : STZ.b RoomTag,X
.failed_spawn
PLB : PLX
RTL
.skip_prize_drop:
PLA : PLB : PLX
RTL
AddDungeonPrizeAncilla:
LDY.w ItemReceiptID
STZ.w AncillaVelocityY,X
STZ.w AncillaVelocityX,X
STZ.w AncillaGeneralF,X
STZ.w AncillaGeneralA,X
STZ.w AncillaGeneralN,X
LDA.b #$D0 : STA.w AncillaVelocityZ,X
LDA.b #$80 : STA.w AncillaZCoord,X
LDA.b #$09 : STA.w AncillaTimer,X
LDA.b #$00 : STA.w AncillaGeneralD,X
LDA.w AncillaGet,X : STA.w ItemReceiptID
LDA.w DungeonID : CMP.b #$14 : BNE .not_hera
LDA.b LinkPosY+1 : AND.b #$FE
INC A
STA.b Scrap01
STZ.b Scrap00
LDA.b LinkPosX+1 : AND.b #$FE
INC A
STA.b Scrap03
STZ.b Scrap02
BRA .set_coords_exit
.not_hera
TYA : ASL : TAY
REP #$20
LDA.w #$0078
CLC : ADC.b BG2V
STA.b Scrap00
LDA.w #$0078
CLC : ADC.b BG2H
STA.b Scrap02
SEP #$20
.set_coords_exit
LDA.b Scrap00 : STA.w AncillaCoordYLow,X
LDA.b Scrap01 : STA.w AncillaCoordYHigh,X
LDA.b Scrap02 : STA.w AncillaCoordXLow,X
LDA.b Scrap03 : STA.w AncillaCoordXHigh,X
RTS
PrepPrizeTile:
PHA : PHX : PHY
JSL BossPrizeGetPlayer : STA.l !MULTIWORLD_SPRITEITEM_PLAYER_ID
LDA.b #$01 : STA.l SpriteSkipEOR
LDA.w AncillaGet, X
JSL AttemptItemSubstitution
JSL ResolveLootIDLong
STA.w AncillaGet, X
JSL RequestStandingItemVRAMSlot
LDA.b #$00 : STA.l SpriteSkipEOR
PLY : PLX : PLA
RTL
PrizeReceiveItem:
PHA
JSL BossPrizeGetPlayer : STA.l !MULTIWORLD_ITEM_PLAYER_ID
PLA
CMP.b #$6A : BNE +
; TODO : This doesn't increment any item counts/stats
JML ActivateTriforceCutscene
+
JSL Link_ReceiveItem
LDA.l TextBoxDefer : BEQ +
STZ.w TextID : STZ.w TextID+1 ; reset decompression buffer
JSL Main_ShowTextMessage_Alt
LDA.b #$00 : STA.l TextBoxDefer
+
RTL
SetItemPose:
PHA
LDA.w DungeonID : BMI .one_handed
LDA.w RoomItemsTaken : BIT.b #$80 : BNE +
.one_handed
PLA
JML Link_ReceiveItem_not_cool_pose
+
JSR CrystalOrPendantBehavior : BCC .one_handed
.two_handed
PLA
JML Link_ReceiveItem_cool_pose
SetPrizeCoords:
PHX : PHY
STZ.b Scrap03
LDA.w ItemReceiptMethod : CMP.b #$03 : BEQ +
.regular_coords
PLY : PLX
LDY.w AncillaGet,X
RTL
+
JSR CrystalOrPendantBehavior : BCC .regular_coords
PLY : PLX
LDY.b #$20 ; Treat as crystal
RTL
SetCutsceneFlag:
; Out: c - Cutscene flag $02 if set, $01 if unset.
PHX
LDY.b #$01 ; wrote over
LDA.w DungeonID : BMI .no_cutscene
LDA.w RoomItemsTaken : BIT.b #$80 : BNE .dungeon_prize
.no_cutscene
SEP #$30
PLX
CLC
RTL
.dungeon_prize
LDA.w ItemReceiptMethod : CMP.b #$03 : BCC .no_cutscene
JSR SetDungeonCompleted
LDA.w ItemReceiptID
REP #$30
AND.w #$00FF : ASL : TAX
LDA.l InventoryTable_properties,X : BIT.w #$0080 : BEQ .no_cutscene
SEP #$31
PLX
RTL
AnimatePrizeCutscene:
LDA.w ItemReceiptMethod : CMP.b #$03 : BNE +
JSR CrystalOrPendantBehavior : BCC +
LDA.w DungeonID : BMI +
LDA.w RoomItemsTaken : BIT.b #$80 : BEQ +
SEC
RTL
+
CLC
RTL
PrizeDropSparkle:
LDA.w AncillaID,X : CMP.b #$29 : BNE .no_sparkle
JSR CrystalOrPendantBehavior : BCC .no_sparkle
SEC
RTL
.no_sparkle
CLC
RTL
HandleDropSFX:
LDA.w RoomItemsTaken : BIT.b #$80 : BEQ .no_sound
JSR CrystalOrPendantBehavior : BCC .no_sound
SEC
RTL
.no_sound
CLC
RTL
HandleCrystalsField:
TAX
LDA.w ItemReceiptID : CMP.b #$20 : BNE .not_crystal
TXA
STA.l CrystalsField
RTL
.not_crystal
RTL
MaybeKeepLootID:
PHA
LDA.w DungeonID : BMI .no_prize
LDA.w RoomItemsTaken : BIT.b #$80 : BNE .prize
.no_prize
STZ.w ItemReceiptID
STZ.w ItemReceiptPose
PLA
RTL
.prize
STZ.w ItemReceiptPose
PLA
RTL
CheckSpawnPrize:
; In: A - DungeonID
; Out: c - Spawn prize if set
REP #$20
LDX.w DungeonID
LDA.l DungeonItemMasks,X : AND.l DungeonsCompleted : BEQ .spawn
SEP #$20
CLC
RTL
.spawn
SEP #$21
RTL
CheckDungeonCompletion:
LDX.w DungeonID
REP #$20
LDA.l DungeonItemMasks,X : AND.l DungeonsCompleted
SEP #$20
RTL
PendantMusicCheck:
; In: A - Item receipt ID
PHX
TAY
LDA.w ItemReceiptMethod : CMP.b #$03 : BNE .dont_wait
TYA
REP #$30
AND.w #$00FF : ASL : TAX
LDA.l InventoryTable_properties,X : BIT.w #$0080 : BNE .dont_wait
SEP #$31
PLX
RTL
.dont_wait
SEP #$30
PLX
CLC
RTL
PrepPrizeOAMCoordinates:
PHX : PHY
LDY.w AncillaLayer,X
LDA.w $F67F,Y : STA.b $65
STZ.b $64
LDA.w AncillaCoordYLow,X : STA.b Scrap00
LDA.w AncillaCoordYHigh,X : STA.b Scrap01
LDA.w AncillaCoordXLow,X : STA.b Scrap02
LDA.w AncillaCoordXHigh,X : STA.b Scrap03
REP #$20
LDA.b Scrap00
SEC : SBC.w $0122
STA.b Scrap00
LDA.b Scrap02
SEC : SBC.w $011E
STA.b Scrap02
STA.b Scrap04
LDA.w AncillaZCoord,X
AND.w #$00FF
STA.b ScrapBuffer72
LDA.b Scrap00
STA.b Scrap06
SEC
SBC.b ScrapBuffer72
STA.b Scrap00
JSL PrepAncillaAnimation
TXY
LDA.w AncillaGet,Y : AND.w #$00FF : PHA
REP #$10
ASL : TAX
LDA.l VRAMAddressOffset,X : STA.b Scrap0C
CLC : ADC.w #$0010 : STA.b Scrap0D
PLX
SEP #$10
PHX
; special animation handling
CPX.b #$D2 : BNE + ; fairy
LDX.w AncillaDirection,Y : BEQ ++ : CPX.b #$03 : BEQ ++ ; use other fairy GFX
LDA.b Scrap0C : CLC : ADC.w #$0002 : STA.b Scrap0C
CLC : ADC.w #$0010 : STA.b Scrap0D
++ CPX.b #$02 : BCC .check_width ; move fairy up 2 pixels
LDA.b Scrap00 : SEC : SBC.w #$0002 : STA.b Scrap00
BRA .check_width
+ CPX.b #$D6 : BNE + ; good bee
LDA.b Scrap0C : AND.w #$FF00 : ORA.w #$007C : STA.b Scrap0C ; use blank GFX for high VRAM
LDX.w AncillaDirection,Y : BEQ ++ : CPX.b #$03 : BEQ ++ ; use other bee GFX
LDA.b Scrap0D : SEC : SBC.w #$0010 : STA.b Scrap0D
++ CPX.b #$02 : BCC + ; move bee up 2 pixels
LDA.b Scrap00 : SEC : SBC.w #$0002 : STA.b Scrap00
+
.check_width
PLX
SEP #$20
LDA.l SpriteProperties_chest_width,X : BNE .wide
TYX
LDA.w AncillaID,X : CMP.b #$3E : BEQ .rising_crystal
REP #$20
LDA.b Scrap00
CLC : ADC.w #$0008
STA.b Scrap08
LDA.b Scrap02
CLC : ADC.w #$0004
STA.b Scrap02 : STA.b Scrap0A
BRA .wide
.rising_crystal
REP #$20
LDA.b Scrap00
CLC : ADC.w #$0008 : STA.b Scrap08
LDA.b Scrap02 : STA.b Scrap0A
.wide
SEP #$20
PLY : PLX
RTL
PrepPrizeVRAMHigh:
PHX
LDX.b #$00
JSL PrepPrizeVRAM : BCS .store
LDA.b #$24
.store
STA.b ($90),Y
PLX
RTL
PrepPrizeVRAMLow:
PHX
LDX.b #$01
JSL PrepPrizeVRAM : BCS .store
LDA.b #$34
.store
STA.b ($90),Y
PLX
RTL
PrepPrizeVRAM:
PHY
LDA.b 9,S : TAY
LDA.w AncillaID,Y : CMP.b #$29 : BEQ +
PLY : CLC : RTL ; not a prize drop ancilla
+ LDA.b Scrap0C,X : CMP.b #$24 : BEQ + : CMP.b #$34 : BEQ +
PLY : SEC : RTL ; in vanilla VRAM
+
; use dynamic VRAM slot
PHX
LDA.w SprItemGFXSlot,Y : ASL : TAX
REP #$20
LDA.l FreeUWGraphics,X : LSR #4
PLX
CPX.b #$01 : BNE +
CLC : ADC.w #$0010
+
SEP #$20
PLY : SEC
RTL
PrepPrizeShadow:
PHX
LDA.b 5,S : TAX : LDA.w AncillaGet,X : TAX
LDA.l SpriteProperties_standing_width,X : BNE .wide
LDA.b Scrap02
SEC : SBC.b #$04
STA.b Scrap02
PLX : LDX.b #$02
BRA .wide+1
.wide
PLX
LDA.b #$20 : STA.b Scrap04 ; What we wrote over
RTL
CheckPoseItemCoordinates:
PHX
LDA.w SprRedrawFlag,X : BEQ +
JSL BossPrizeGetPlayer : STA.l !MULTIWORLD_SPRITEITEM_PLAYER_ID
LDA.b #$01 : STA.l SpriteSkipEOR
LDA.w AncillaGet,X
JSL RequestStandingItemVRAMSlot
LDA.b #$00 : STA.l SpriteSkipEOR
+
LDA.w ItemReceiptPose : BEQ .done
BIT.b #$02 : BEQ .done
LDA.w AncillaGet,X : TAX
LDA.l SpriteProperties_chest_width,X : BNE .done
LDA.b Scrap02
CLC : ADC.b #$04
STA.b Scrap02
.done
PLX
LDA.w AncillaGet,X
TAX
RTL
CrystalOrPendantBehavior:
; Out: c - Crystal Behavior if set, pendant if unset
PHA : PHX
LDA.w AncillaGet,X
REP #$31
AND.w #$00FF : ASL : TAX
LDA.l InventoryTable_properties,X : BIT.w #$0080 : BNE .crystal_behavior
SEP #$30
LDA.w ItemReceiptPose : BEQ +
LDA.b #$02 : STA.b LinkDirection
+
PLX : PLA
RTS
.crystal_behavior
SEP #$31
PLX : PLA
RTS
CheckDungeonWorld:
; Maintain vanilla door opening behavior with dungeon prizes
TXA : CMP.b #$05 : BCS .dark_world
REP #$02
RTL
.dark_world
SEP #$02
RTL
SetDungeonCompleted:
LDX.w DungeonID : BMI +
REP #$20
LDA.l DungeonItemMasks, X : ORA.l DungeonsCompleted : STA.l DungeonsCompleted
SEP #$20
+
RTS
MaybeSkipHeartRefill:
LDA.w CurrentControlRequest : CMP.b #$13 : BNE .vanilla
LDA.l HeartPieceQuarter : BNE +
; increase health
LDA.l MaximumHealth : CMP.b #$A0 : BEQ .reset_skip
CLC : ADC.b #$08 : STA.l MaximumHealth
+
.reset_skip
LDA.b #$00 ; just to ensure the MaximumHealth doesn't flow outside
BRA .skip
.vanilla
LDA.l HeartPieceQuarter : BEQ .do ; what we wrote over
.skip
CLC
RTL
.do
SEC
RTL
ClearMultiworldText:
PHP : PHX
SEP #$30
LDA.l !MULTIWORLD_HUD_TIMER : BEQ +
LDA.b #$01 : STA.l !MULTIWORLD_HUD_TIMER
JSL GetMultiworldItem
+
PLX : PLP
RTL
MaybeSkipCrystalCutsceneFollowerReset:
PHA
LDA.l FollowerTravelAllowed : CMP.b #$02 : BEQ .skip
; skip if prizes are shuffled outside of normal boss drops
LDA.l InventoryTable_properties+($37*2) : AND.b #$01 : BEQ .continue
.skip
PLA : PLA : PLA : PLA
JML CrystalCutscene_SpawnMaiden_PostFollowerGfx
.continue
PLA
STA.l FollowerIndicator ; what we wrote over
DropSafeDungeon:
LDA $040C : CMP #$08 : BEQ +
LDA $01C6FC, X : JML Sprite_SpawnFallingItem
+
RTL
;--------------------------------------------------------------------------------

View File

@@ -1,16 +1,24 @@
DoDungeonMapBossIcon:
LDA.b NMISTRIPES
LDA.b $14
CMP.b #$09
BEQ .dungeonmap
.cave
CMP.b #$01
RTL
.dungeonmap
LDX.w DungeonID
LDX.w $040C
BMI .cave
; LDA.l DungeonMapIcons
; AND.b #$01
; BNE ++
;
; INC ; so it's not equal to $01
; BRA .cave
; get dungeon boss room
++ REP #$30
LDA.l DungeonMapBossRooms, X
@@ -18,19 +26,13 @@ DoDungeonMapBossIcon:
TAX
; get sprite pointer for room
LDA.l UWSpritesPointers,X
STA.b Scrap00 ; pointer in $00
if !FEATURE_FIX_BASEROM
LDA.w #$0089
else
LDA.w #$0028 ; set the bank to 28 for now
endif
STA.b Scrap02
LDY.w #$0001 ; to skip the "sort"
LDA.l $89D62E,X
INC ; to skip the "sort"
TAX
; get first byte to make sure it isn't an empty room
SEP #$20
LDA.b [Scrap00], Y
LDA.l $890000,X
CMP.b #$FF
BNE ++
@@ -38,8 +40,7 @@ DoDungeonMapBossIcon:
BRA .cave
; check first sprite
++ INY #2
LDA.b [Scrap00], Y
++ LDA.l $890002,X
SEP #$10
; match boss id
@@ -56,7 +57,7 @@ DoDungeonMapBossIcon:
.match
LDA.b #$80
STA.w CGADD
STA.w $2121
REP #$30
@@ -73,14 +74,14 @@ DoDungeonMapBossIcon:
ASL ; x128 for graphics
ASL
ADC.w #BossMapIconGFX
STA.w A1T1L
STA.w $4312
PHY
LDY.w #32
SEP #$20
-- LDA.l .boss_palettes,X
STA.w CGDATA
STA.w $2122
INX
DEY
BNE --
@@ -93,24 +94,24 @@ DoDungeonMapBossIcon:
SEP #$10
LDA.w #$1801
STA.w DMAP1
STA.w $4310
LDX.b #BossMapIconGFX>>16
STX.w A1B1
STX.w $4314
LDA.w #$A060>>1
STA.w VMADDL
STA.w $2116
LDA.w #$0040
STA.w DAS1L
STA.w $4315
LDX.b #$02
STX.w DMAENABLE
STX.w $420B
STA.w DAS1L
STA.w $4315
LDA.w #$A260>>1
STA.w VMADDL
STA.w $2116
STX.w DMAENABLE
STX.w $420B
; done
SEP #$30

234
elder.asm
View File

@@ -1,27 +1,28 @@
NewElderCode:
{
LDA.b OverworldIndex : AND.b #$3F : CMP.b #$1B : BEQ .newCodeContinue
LDA $8A : CMP #$1B : BEQ .newCodeContinue
;Restore Jump we can keep the RTL so JML
JML Sprite_16_Elder
JML $05F0CD
.newCodeContinue
PHB : PHK : PLB
LDA.b #$07 : STA.w SpriteOAMProp, X ; Palette
LDA.b #$07 : STA $0F50, X ;Palette
JSR Elder_Draw
JSL Sprite_PlayerCantPassThrough
JSR Elder_Code
PLB
RTL
}
Elder_Draw:
{
LDA.b #$02 : STA.b Scrap06 : STZ.b Scrap07 ;Number of Tiles
LDA.b #$02 : STA $06 : STZ $07 ;Number of Tiles
LDA.w SpriteGFXControl, X : ASL #04
LDA $0DC0, X : ASL #04
ADC.b #.animation_states : STA.b Scrap08
LDA.b #.animation_states>>8 : ADC.b #$00 : STA.b Scrap09
ADC.b #.animation_states : STA $08
LDA.b #.animation_states>>8 : ADC.b #$00 : STA $09
JSL Sprite_DrawMultiple_player_deferred
JSL Sprite_DrawShadowLong
@@ -39,219 +40,32 @@ RTL
Elder_Code:
{
TXY : LDX.b #$06
REP #$30
LDA.l GoalConditionTable, X
TAX : LDA.l $B00000, X
SEP #$30
TYX
CMP.b #$00 : BEQ .despawn ; no goal, despawn
LDA.l TurnInGoalItems : BNE +
REP #$20
LDA.l GoalItemRequirement : BEQ .despawn
LDA.l InvincibleGanon : AND.w #$00FF : CMP.w #$0005 : BEQ .despawn
LDA.l TurnInGoalItems : AND.w #$00FF : BNE +
.despawn
STZ.w SpriteAITable, X ; despawn self
SEP #$20
STZ $0DD0, X ; despawn self
RTS
+
LDA.b GameSubMode
SEP #$20
LDA.b $11
BNE .done
LDA.b #$96
LDY.b #$01
JSL Sprite_ShowSolicitedMessageIfPlayerFacing_PreserveMessage : BCC .dont_show
LDA.b #$03 : JSL CheckConditionPass : BCC +
JSL ActivateTriforceCutscene
REP #$20
LDA.l GoalCounter
CMP.l GoalItemRequirement : !BLT +
SEP #$20
JSL.l ActivateGoal
+
.dont_show
.done
LDA.b FrameCounter : LSR #5 : AND.b #$01 : STA.w SpriteGFXControl, X
SEP #$20
LDA.b $1A : LSR #5 : AND.b #$01 : STA.w $0DC0, X
RTS
}
;--------------------------------------------------------------------------------
; Triforce (Pedestal) Cutscene
;--------------------------------------------------------------------------------
ActivateTriforceCutscene:
; despawn other sprites
LDY.b #$0F
- LDA.w SpriteTypeTable,Y : CMP.b #$16 : BNE +
CPY.b #$00 : BEQ .next
; move Murahdahla to slot 0 for draw priority reasons
LDA.w SpriteTypeTable,Y : STA.w SpriteTypeTable
LDA.w SpritePosYLow,Y : STA.w SpritePosYLow
LDA.w SpritePosXLow,Y : STA.w SpritePosXLow
LDA.w SpritePosYHigh,Y : STA.w SpritePosYHigh
LDA.w SpritePosXHigh,Y : STA.w SpritePosXHigh
LDA.w SpriteVelocityY,Y : STA.w SpriteVelocityY
LDA.w SpriteOAMProp,Y : STA.w SpriteOAMProp
LDA.w SpriteOAMProperties,Y : STA.w SpriteOAMProperties
LDA.w SpriteControl,Y : STA.w SpriteControl
LDA.w SpriteAITable,Y : STA.w SpriteAITable
LDA.b #$02 : STA.w SpriteLayer
+ LDA.b #$00 : STA.w SpriteAITable,Y
.next
DEY : BPL -
LDA.b #$62 ; MasterSword Sprite
JSL Sprite_SpawnDynamically
; set up coords
LDA.b LinkPosX : STA.w SpritePosXLow,Y
LDA.b LinkPosX+1 : STA.w SpritePosXHigh,Y
LDA.b LinkPosY : CLC : ADC.b #$08 : STA.w SpritePosYLow,Y
LDA.b LinkPosY+1 : ADC.b #$00 : STA.w SpritePosYHigh,Y
LDA.b #$01 : STA.w SpriteMovement,Y ; our indicator this is a special cutscene sprite
INC : STA.b LinkDirection ; makes Link face downward
; reset modules
LDA.b IndoorsFlag : BEQ +
LDA.b #$07
BRA ++
+ LDA.b #$09
++ STA.b GameMode
STZ.b GameSubMode : STZ.b SubSubModule
RTL
pushpc
org $858928
MasterSword_InPedestal_DoCutscene:
org $8589B1
MasterSword_ConditionalHandleReceipt_DoReceipt:
org $8588DF
JSL MasterSword_CheckIfPulled : PLX : NOP #2
db $90 ; BCC instead of BEQ
org $85890E
JSL MasterSword_ConditionalActivateCutscene
org $85895F
JSL MasterSword_ConditionalGrabPose : NOP
org $858994
JSL MasterSword_ConditionalGrabPose : NOP
org $858D1C
JML MasterSword_SpawnPendantProp_ChangePalette
MasterSword_SpawnPendantProp_ChangePalette_return:
org $8589A3
JSL MasterSword_ConditionalHandleReceipt : NOP #2
pullpc
MasterSword_CheckIfPulled:
CPX.b #$80 : BEQ +
- CLC : RTL ; not on pedestal screen, continue with cutscene
+ LDA.l OverworldEventDataWRAM,X : AND.b #$40 ; what we wrote over
BEQ - : SEC : RTL
MasterSword_ConditionalActivateCutscene:
LDA.w SpriteMovement,X : BNE .specialCutscene
PHX
REP #$30
LDA.w SprRedrawFlag, X : BNE .doNormalPed
INC.w SprRedrawFlag, X
LDA.l PedPullGfx : BEQ .doNormalPed
LDX.w ItemStackPtr : STA.l ItemGFXStack,X
LDA.w #$BCE0>>1 : STA.l ItemTargetStack,X
TXA : INC #2 : STA.w ItemStackPtr
.doNormalPed
SEP #$30
PLX
JML Sprite_CheckDamageToPlayerSameLayerLong ; what we wrote over
.specialCutscene
LDA.b #$02 : STA.w ItemReceiptPose ; Link's 2-hands-up pose
STA.b LinkLayer ; draw Link on top
; draw Triforce piece in VRAM
LDA.w SprRedrawFlag, X : BNE .skipTransfer
INC.w SprRedrawFlag, X
PHX
REP #$30
LDA.l MurahdahlaGfx : BNE .submitRequest
LDX.w #$006A<<1 : LDA.l StandingItemGraphicsOffsets,X
.submitRequest
LDX.w ItemStackPtr : STA.l ItemGFXStack,X
LDA.w #$9CE0>>1 : STA.l ItemTargetStack,X
TXA : INC #2 : STA.w ItemStackPtr
SEP #$30
PLX
.skipTransfer
PLA : PLA : PLA : JML MasterSword_InPedestal_DoCutscene ; do cutscene
MasterSword_ConditionalGrabPose:
PHA
LDA.w SpriteMovement,X : BNE .specialCutscene
PLA
STA.w $0377 : LDA.b #$01 ; what we wrote over
RTL
.specialCutscene
PLA
LDA.b #$01
RTL
MasterSword_SpawnPendantProp_ChangePalette:
STA.w SpriteVelocityY,Y : PLX ; what we wrote over
LDA.w SpriteMovement,X : BNE .specialCutscene
LDA.l PedPullGfx : BNE .customPedGfx
LDA.l PedPullGfx+1 : BNE .customPedGfx
BRA .done
.customPedGfx
LDA.l PedPullPalette : ASL : INC : BRA .setPalette
.specialCutscene
LDA.b #$02 : STA.w SpriteLayer,Y ; change layer
LDA.l MurahdahlaGfx : BNE .customGfx
LDA.l MurahdahlaGfx+1 : BNE .customGfx
LDA.b #$08 : BRA .setPalette
.customGfx
LDA.l MurahdahlaPalette : ASL
.setPalette
STA.w SpriteOAMProp,Y ; change palette
.done
JML MasterSword_SpawnPendantProp_ChangePalette_return
MasterSword_ConditionalHandleReceipt:
LDA.w SpriteMovement,X : BNE .specialCutscene
LDX.b OverworldIndex : LDA.l OverworldEventDataWRAM,X ; what we wrote over
RTL
.specialCutscene
PLA : PLA : PEA.w MasterSword_ConditionalHandleReceipt_DoReceipt-1
LDA.b 4,S : TAX
LDY.b #$6A
RTL
pushpc
org $858AB6
MasterSword_SpawnLightWell:
org $858AD0
MasterSword_SpawnLightFountain:
org $858B62
MasterSword_SpawnLightBeam:
org $858941
JSL MasterSword_ConditionalSpawnLightWell : NOP #2
MasterSword_SpawnLightWell_return:
org $858952
JSL MasterSword_ConditionalSpawnLightFountain : NOP #2
MasterSword_SpawnLightFountain_return:
org $858B64
JSL MasterSword_ConditionalSpawnLightBeam : NOP #2
pullpc
MasterSword_ConditionalSpawnLightWell:
INC.w SpriteActivity,X ; part of what we wrote over
LDA.w SpriteMovement,X : BNE .specialCutscene
PLA : PLA : PLA : PEA.w MasterSword_SpawnLightWell_return-1
JML MasterSword_SpawnLightWell ; part of what we wrote over
.specialCutscene
RTL
MasterSword_ConditionalSpawnLightFountain:
INC.w SpriteActivity,X ; part of what we wrote over
LDA.w SpriteMovement,X : BNE .specialCutscene
PLA : PLA : PLA : PEA.w MasterSword_SpawnLightFountain_return-1
JML MasterSword_SpawnLightFountain ; part of what we wrote over
.specialCutscene
RTL
MasterSword_ConditionalSpawnLightBeam:
LDA.w SpriteMovement,X : BNE .specialCutscene
LDA.b #$62 : JSL Sprite_SpawnDynamically ; what we wrote over
RTL
.specialCutscene
LDY.b #$FF
RTL

22
endingsequence.asm Normal file
View File

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

View File

@@ -1,70 +0,0 @@
!DISP_REG = $2100 ; Screen Display Register
!VMAIN_REG = $2115 ; Video Port Control Register
!VRAM_LOW_REG = $2116 ; VRAM Address Registers (Low)
!VRAM_HIGH_REG = $2117 ; VRAM Address Registers (High)
!VRAM_WRITE_REG = #$18 ; VRAM Data Write Registers (Low) (you always store it to the dest register so no need for the actual address)
!DMA0_REG = $4300 ; DMA Control Register - channel 0
!DMA0_DEST_REG = $4301 ; DMA Destination Register
!DMA0_SRC_LOW_REG = $4302 ; DMA Source Address Register (Low)
!DMA0_SRC_HIGH_REG = $4303 ; DMA Source Address Register (High)
!DMA0_SRC_BANK_REG = $4304 ; DMA Source Address Register (Bank)
!DMA0_SIZE_LOW_REG = $4305 ; DMA Size Registers (Low)
!DMA0_SIZE_HIGH_REG = $4306 ; DMA Size Registers (Low)
macro DMA_VRAM(VRAM_HIGH,VRAM_LOW,SRC_BANK,SRC_HIGH,SRC_LOW,LENGTH_HIGH,LENGTH_LOW)
PHA
; --- preserve DMA registers ----------------------------------------------------
LDA.w !DMA0_REG : PHA
LDA.w !DMA0_DEST_REG : PHA
LDA.w !DMA0_SRC_LOW_REG : PHA
LDA.w !DMA0_SRC_HIGH_REG : PHA
LDA.w !DMA0_SRC_BANK_REG : PHA
LDA.w !DMA0_SIZE_LOW_REG : PHA
LDA.w !DMA0_SIZE_HIGH_REG : PHA
; -------------------------------------------------------------------------------
;LDA.b #$80 : STA.w !DISP_REG ; force vblank
LDA.b #$80 : STA.w !VMAIN_REG
; write to vram at $<VRAM_HIGH><VRAM_LOW>
LDA.b <VRAM_LOW> : STA.w !VRAM_LOW_REG ; Set VRAM destination address low byte
LDA.b <VRAM_HIGH> : STA.w !VRAM_HIGH_REG ; Set VRAM destination address high byte
; Set DMA0 to write a word at a time.
LDA.b #$01
STA.w !DMA0_REG
; Write to $2118 & $2119 - VRAM Data Write Registers (Low) & VRAM Data Write Registers (High)
; setting word write mode on DMA0_REG causes a write to $2118 and then $2119
; $21xx is assumed
LDA.b !VRAM_WRITE_REG
STA.w !DMA0_DEST_REG
; Read from $<SRC_BANK>:<SRC_HIGH><SRC_LOW>.
LDA.b <SRC_LOW>
STA.w !DMA0_SRC_LOW_REG ; set src address low byte
LDA.b <SRC_HIGH>
STA.w !DMA0_SRC_HIGH_REG ; set src address high byte
LDA.b <SRC_BANK>
STA.w !DMA0_SRC_BANK_REG ; set src address bank byte
; total bytes to copy: #$1000 bytes.
LDA.b <LENGTH_LOW> : STA.w !DMA0_SIZE_LOW_REG ; length low byte
LDA.b <LENGTH_HIGH> : STA.w !DMA0_SIZE_HIGH_REG ; length high byte
; start DMA on channel 0
LDA.b #$01 ; channel select bitmask
STA.w DMAENABLE
; --- restore DMA registers -----------------------------------------------------
PLA : STA.w !DMA0_SIZE_HIGH_REG
PLA : STA.w !DMA0_SIZE_LOW_REG
PLA : STA.w !DMA0_SRC_BANK_REG
PLA : STA.w !DMA0_SRC_HIGH_REG
PLA : STA.w !DMA0_SRC_LOW_REG
PLA : STA.w !DMA0_DEST_REG
PLA : STA.w !DMA0_REG
; -------------------------------------------------------------------------------
PLA
endmacro

View File

@@ -1,53 +0,0 @@
;-------------
NMIHookActionEnemizer:
{
;-----------------------------------------
; do our shell stuff
PHA
PHP
SEP #$20 ; get into 8-bit mode
LDA.l !SHELL_DMA_FLAG : BEQ .return ; check our draw flag
AND.b #$01 : BNE .loadKholdstare
LDA.l !SHELL_DMA_FLAG : AND.b #$02 : BNE .loadTrinexx
BRA .return ; just in case
;BIT.b #$01 : BEQ .loadKholdstare
;BIT.b #$02 : BEQ .loadTrinexx
.loadKholdstare
JSL DMAKholdstare
LDA.b #$00 : STA.l !SHELL_DMA_FLAG ; clear our draw flag
BRA .return
.loadTrinexx
JSL DMATrinexx
LDA.b #$00 : STA.l !SHELL_DMA_FLAG ; clear our draw flag
.return
PLP
PLA
;-----------------------------------------
; restore code Bank00.asm (164-167)
PHB
; Sets DP to $0000
LDA.w #$0000 : TCD
JML NMIHookReturnEnemizer
}
DMAKholdstare:
{
;#GFX_Kholdstare_Shell>>16
%DMA_VRAM(#$34,#$00,#GFX_Kholdstare_Shell>>16&$FF,#GFX_Kholdstare_Shell>>8&$FF,#GFX_Kholdstare_Shell&$FF,#$10,#$00)
RTL
}
DMATrinexx:
{
; TODO: change this to trinexx gfx
%DMA_VRAM(#$34,#$00,#GFX_Trinexx_Shell>>16,#GFX_Trinexx_Shell>>8&$FF,#GFX_Trinexx_Shell&$FF,#$08,#$00)
%DMA_VRAM(#$3A,#$A0,#GFX_Trinexx_Shell2>>16,#GFX_Trinexx_Shell2>>8&$FF,#GFX_Trinexx_Shell2&$FF,#$00,#$C0)
RTL
}

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