Merged in DR v1.4.1.6

This commit is contained in:
codemann8
2024-02-23 10:57:24 -06:00
235 changed files with 30100 additions and 17937 deletions

3
.gitignore vendored
View File

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

View File

@@ -3,81 +3,53 @@
;================================================================================ ;================================================================================
lorom lorom
;===================================================================================================
; THIS NEEDS TO BE THE FIRST INCLUDE BECAUSE IT CHANGES THINGS EVERYWHERE
; If this were to be included later, it would almost certainly overwrite other changes
incsrc "fastrom.asm"
;================================================================================ ;================================================================================
;org $00FFC0 ; <- 7FC0 - Bank00.asm : 9173 (db "THE LEGEND OF ZELDA " ; 21 bytes) ;org $80FFC0 ; <- 7FC0 - Bank00.asm : 9173 (db "THE LEGEND OF ZELDA " ; 21 bytes)
;db #$23, $4E ;db $23, $4E
org $00FFD5 ; <- 7FD5 - Bank00.asm : 9175 (db $20 ; rom layout) org $80FFD5 ; <- 7FD5 - Bank00.asm : 9175 (db $20 ; rom layout)
db #$30 ; set fast lorom db $30 ; set fast lorom
;org $00FFD6 ; <- 7FD6 - Bank00.asm : 9176 (db $02 ; cartridge type) ;org $80FFD6 ; <- 7FD6 - Bank00.asm : 9176 (db $02 ; cartridge type)
;db #$55 ; enable S-RTC ;db $55 ; enable S-RTC
org $00FFD7 ; <- 7FD7 - Bank00.asm : 9177 (db $0A ; rom size) org $80FFD7 ; <- 7FD7 - Bank00.asm : 9177 (db $0A ; rom size)
db #$0B ; mark rom as 16mbit db $0B ; mark rom as 16mbit
org $00FFD8 ; <- 7FD8 - Bank00.asm : 9178 (db $03 ; ram size (sram size)) org $80FFD8 ; <- 7FD8 - Bank00.asm : 9178 (db $03 ; ram size (sram size))
db #$05 ; mark sram as 32k db $05 ; mark sram as 32k
org $3FFFFF ; <- 1FFFFF org $BFFFFF ; <- 1FFFFF
db #$00 ; expand file to 2mb db $00 ; expand file to 2mb
org $1FFFF8 ; <- FFFF8 timestamp rom org $9FFFF8 ; <- FFFF8 timestamp rom
db #$20, #$19, #$08, #$31 ; year/month/day db $20, $19, $08, $31 ; year/month/day
;================================================================================ ;================================================================================
!ROM_VERSION_LOW ?= 1 ; ROM version (two 16-bit integers) !ROM_VERSION_LOW ?= 1 ; ROM version (two 16-bit integers)
!ROM_VERSION_HIGH ?= 2 ; !ROM_VERSION_HIGH ?= 5 ;
org $00FFE0 ; Unused hardware vector org $80FFE0 ; Unused hardware vector
RomVersion: RomVersion:
dw !ROM_VERSION_LOW dw !ROM_VERSION_LOW
dw !ROM_VERSION_HIGH dw !ROM_VERSION_HIGH
;================================================================================ ;================================================================================
!ADD = "CLC : ADC" !ADD = "CLC : ADC"
!SUB = "SEC : SBC" !SUB = "SEC : SBC"
!BLT = "BCC" !BLT = "BCC"
!BGE = "BCS" !BGE = "BCS"
!MS_GOT = "$7F5031"
;!REDRAW = "$7F5000"
!SPRITE_REDRAW = "$7E0790" ; 16 bytes
!SPRITE_OAM = "$7EC025" ; 16 bytes
!SPRITE_DYNAMIC_OAM = "$7EC035" ; 16 bytes
!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)) 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 flags, run asar with -DFEATURE_X=1 to enable
!FEATURE_NEW_TEXT ?= 0
;================================================================================ ;================================================================================
@@ -103,16 +75,16 @@ function hexto555(h) = ((((h&$FF)/8)<<10)|(((h>>8&$FF)/8)<<5)|(((h>>16&$FF)/8)<<
!FLAG_OW_BONKDROP = $02 !FLAG_OW_BONKDROP = $02
incsrc hooks.asm incsrc hooks.asm
incsrc treekid.asm
incsrc spriteswap.asm incsrc spriteswap.asm
incsrc hashalphabethooks.asm incsrc hashalphabethooks.asm
incsrc sharedplayerpalettefix.asm incsrc sharedplayerpalettefix.asm
incsrc ram.asm incsrc ram.asm
incsrc sram.asm incsrc sram.asm
incsrc registers.asm
incsrc vanillalabels.asm
incsrc menu/overworldmap.asm ; Overwrites some code in bank $8A
;org $208000 ; bank #$20 org $A08000 ; bank $20
org $A08000 ; bank #$A0
incsrc newitems.asm ; LEAVE THIS AS FIRST
incsrc itemdowngrade.asm incsrc itemdowngrade.asm
incsrc bugfixes.asm incsrc bugfixes.asm
incsrc darkworldspawn.asm incsrc darkworldspawn.asm
@@ -120,7 +92,6 @@ incsrc lampmantlecone.asm
incsrc floodgatesoftlock.asm incsrc floodgatesoftlock.asm
incsrc heartpieces.asm incsrc heartpieces.asm
incsrc npcitems.asm incsrc npcitems.asm
incsrc utilities.asm
incsrc flipperkill.asm incsrc flipperkill.asm
incsrc pendantcrystalhud.asm incsrc pendantcrystalhud.asm
incsrc potions.asm incsrc potions.asm
@@ -131,30 +102,28 @@ incsrc tablets.asm
incsrc fairyfixes.asm incsrc fairyfixes.asm
incsrc rngfixes.asm incsrc rngfixes.asm
incsrc medallions.asm incsrc medallions.asm
incsrc inventory.asm
incsrc ganonfixes.asm
incsrc zelda.asm incsrc zelda.asm
incsrc maidencrystals.asm incsrc maidencrystals.asm
incsrc zoraking.asm
incsrc catfish.asm
incsrc flute.asm incsrc flute.asm
incsrc dungeondrops.asm incsrc dungeondrops.asm
incsrc halfmagicbat.asm incsrc halfmagicbat.asm
incsrc mantle.asm
incsrc swordswap.asm incsrc swordswap.asm
incsrc scratchpad.asm incsrc stats.asm
incsrc map.asm
incsrc dialog.asm incsrc dialog.asm
incsrc entrances.asm incsrc entrances.asm
incsrc clock.asm
incsrc accessibility.asm incsrc accessibility.asm
incsrc heartbeep.asm incsrc heartbeep.asm
incsrc capacityupgrades.asm incsrc capacityupgrades.asm
incsrc timer.asm
incsrc doorframefixes.asm
incsrc music.asm
incsrc roomloading.asm
incsrc icepalacegraphics.asm
warnpc $A18000 warnpc $A18000
org $1C8000 ; text tables for translation org $9C8000 ; text tables for translation
incbin i18n_en.bin incbin "data/i18n_en.bin"
warnpc $1CF356 warnpc $9CF356
org $A18000 ; static mapping area org $A18000 ; static mapping area
incsrc framehook.asm incsrc framehook.asm
@@ -165,7 +134,7 @@ incsrc hud.asm
warnpc $A18800 warnpc $A18800
org $A18800 ; static mapping area org $A18800 ; static mapping area
incsrc zsnes.asm
warnpc $A19000 warnpc $A19000
org $A1A000 ; static mapping area. Referenced by front end. Do not move. org $A1A000 ; static mapping area. Referenced by front end. Do not move.
@@ -181,19 +150,11 @@ org $A1FF00 ; static mapping area
incsrc init.asm incsrc init.asm
org $A48000 ; code bank - PUT NEW CODE HERE 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 glitched.asm
incsrc hardmode.asm incsrc hardmode.asm
incsrc goalitem.asm incsrc goalitem.asm
incsrc quickswap.asm incsrc quickswap.asm
incsrc endingsequence.asm
incsrc cuccostorm.asm incsrc cuccostorm.asm
incsrc compression.asm
incsrc retro.asm incsrc retro.asm
incsrc controllerjank.asm incsrc controllerjank.asm
incsrc boots.asm incsrc boots.asm
@@ -204,152 +165,160 @@ incsrc decryption.asm
incsrc hashalphabet.asm incsrc hashalphabet.asm
incsrc inverted.asm incsrc inverted.asm
incsrc invertedmaps.asm incsrc invertedmaps.asm
incsrc invertedmaps2.asm
incsrc bonktreemaps.asm incsrc bonktreemaps.asm
incsrc newhud.asm incsrc newhud.asm
incsrc compasses.asm
incsrc save.asm incsrc save.asm
incsrc password.asm incsrc password.asm
incsrc enemy_adjustments.asm incsrc enemy_adjustments.asm
incsrc stats.asm
;incsrc hudtext.asm ;incsrc hudtext.asm
incsrc servicerequest.asm incsrc servicerequest.asm
incsrc elder.asm incsrc elder.asm
incsrc toast.asm incsrc toast.asm
incsrc darkroomitems.asm
incsrc fastcredits.asm incsrc fastcredits.asm
incsrc msu.asm incsrc msu.asm
incsrc dungeonmap.asm incsrc dungeonmap.asm
incsrc hextodec.asm
incsrc multiworld.asm incsrc multiworld.asm
incsrc terrorpin.asm incsrc textrenderer.asm
if !FEATURE_NEW_TEXT
incsrc textrenderer.asm
endif
warnpc $A58000 warnpc $A58000
;org $228000 ; contrib area org $A28000
org $A28000 ; contrib area ItemReceiptGraphicsROM:
incsrc contrib.asm ; we need some empty space here so that 0000 can mean nothing
fillbyte $00 : fill 32
incbin "data/customitems.4bpp"
warnpc $A2B000
org $A2B000
incsrc itemdatatables.asm ; Statically mapped
incsrc decompresseditemgraphics.asm
incsrc newitems.asm
incsrc utilities.asm
incsrc inventory.asm
incsrc menu/hudalpha.asm
warnpc $A38000 warnpc $A38000
org $A38000 org $A38000
incsrc stats/credits.asm ; Statically mapped
incsrc stats/main.asm incsrc stats/main.asm
incsrc stats/statConfig.asm
FontTable:
incsrc stats/fonttable.asm
incsrc menu/overworldmap.asm ; overwrites some code in bank 0A incsrc doorrando/doorrando.asm ; bank 27/A7
incsrc doorrando/doorrando.asm ; bank 27 likely A7 in the future
;bank 28/A8 for keydropshuffle / standing items ;bank 28/A8 for keydropshuffle / standing items
incsrc keydrop/standing_items.asm incsrc keydrop/standing_items.asm ; bank 28/A8
incsrc owrando.asm ; bank AA incsrc owrando.asm ; bank 2A/AA
incsrc enemizer/main.asm ; this is originally in bank 36, but is currently in migratory status in bank 37 incsrc enemizer/main.asm ; bank 36/B6
org $308000 ; bank #$30 org $B08000 ; bank #$30
incsrc tables.asm incsrc tables.asm
warnpc $318000 warnpc $B18000
org $348000 org $B48000
incsrc spc.asm incsrc spc.asm
; uncomment for inverted adjustments org $B18000 ; bank $31
;incsrc sandbox.asm
org $318000 ; bank #$31
GFX_Mire_Bombos: GFX_Mire_Bombos:
incbin 99ff1_bombos.gfx incbin "data/99ff1_bombos.gfx"
warnpc $318800 warnpc $B18800
org $318800 org $B18800
GFX_Mire_Quake: GFX_Mire_Quake:
incbin 99ff1_quake.gfx incbin "data/99ff1_quake.gfx"
warnpc $319000 warnpc $B19000
org $319000 org $B19000
GFX_TRock_Bombos: GFX_TRock_Bombos:
incbin a6fc4_bombos.gfx incbin "data/a6fc4_bombos.gfx"
warnpc $319800 warnpc $B19800
org $319800 org $B19800
GFX_TRock_Ether: GFX_TRock_Ether:
incbin a6fc4_ether.gfx incbin "data/a6fc4_ether.gfx"
warnpc $31A000 warnpc $B1A000
org $31A000 org $B1A000
GFX_HUD_Items: GFX_HUD_Items:
incbin c2807_v4.gfx incbin "data/c2807_v4.gfx"
warnpc $31A800 warnpc $B1A800
org $31A800 org $B1A800
GFX_New_Items:
incbin newitems.gfx
;incbin eventitems.gfx ; *EVENT*
warnpc $31B000
org $31B000 warnpc $B1B000
org $B1B000
GFX_HUD_Main: GFX_HUD_Main:
incbin c2e3e.gfx incbin "data/c2e3e.gfx"
warnpc $31B800 warnpc $B1B800
org $31C000 org $B1C000
IcePalaceFloorGfx: IcePalaceFloorGfx:
incbin ice_palace_floor.bin incbin "data/ice_palace_floor.bin"
warnpc $31C801 warnpc $B1C801
org $31C800 org $B1C800
Damage_Table: Damage_Table:
incbin damage_table.bin incbin "data/damage_table.bin"
warnpc $31D001 warnpc $B1D001
org $31D000 org $B1D000
FileSelectNewGraphics: FileSelectNewGraphics:
incbin fileselect.chr.gfx incbin "data/fileselectgfx.2bpp"
warnpc $31E001 warnpc $B1E001
org $31E000 org $B1E000
InvertedCastleHole: ;address used by front end. DO NOT MOVE! InvertedCastleHole: ;address used by front end. DO NOT MOVE!
incbin sheet73.gfx incbin "data/sheet73.gfx"
warnpc $31E501 warnpc $B1E501
org $338000 org $B38000
GFX_HUD_Palette: GFX_HUD_Palette:
incbin hudpalette.pal incbin "data/hudpalette.pal"
warnpc $338041 warnpc $B38041
org $339000 org $B39000
incbin sheet178.gfx ExpandedTrinexx:
warnpc $339600 incbin "data/sheet178.gfx"
warnpc $B39600
org $339600 org $B39600
BossMapIconGFX: BossMapIconGFX:
incbin bossicons.4bpp incbin "data/bossicons.4bpp"
if !FEATURE_NEW_TEXT org $B39C00
org $339C00 NewFont:
NewFont: incbin "data/newfont.bin"
incbin newfont.bin NewFontInverted:
NewFontInverted: incbin "data/newfont_inverted.bin"
incbin newfont_inverted.bin SmallCharacters:
org $0CD7DF incbin "data/smallchars.2bpp"
incbin text_unscramble1.bin org $8CD7DF
org $0CE4D5 incsrc data/playernamecharmap.asm
incbin text_unscramble2.bin org $8CE73D
endif incbin data/playernamestripes_1.bin
org $8CE911
incbin data/playernamestripes_2.bin
incsrc data/kanjireplacements.asm ; Overwrites text gfx data and masks in bank $8E
org $328000 org $B28000
Extra_Text_Table: Extra_Text_Table:
if !FEATURE_NEW_TEXT incsrc itemtext.asm
incsrc itemtext_lower.asm warnpc $B2E000
else
incsrc itemtext.asm
endif
warnpc $32E000
org $32DFD0 ; PC 0x195FD0 org $B2DFD0 ; PC 0x195FD0
incsrc multiworldplayernames.asm incsrc multiworldplayernames.asm
warnpc $330000 warnpc $B30000
incsrc externalhooks.asm incsrc externalhooks.asm
;================================================================================ ;================================================================================
org $119100 ; PC 0x89100 org $919100 ; PC 0x89100
incbin map_icons.gfx incbin "data/map_icons.gfx"
warnpc $119401 warnpc $919401
;================================================================================
org $9BB1E0
incsrc custompalettes.asm
warnpc $9BB880
;================================================================================ ;================================================================================
org $AF8000 ; PC 0x178000 org $AF8000 ; PC 0x178000
Static_RNG: ; each line below is 512 bytes of rng Static_RNG: ; each line below is 512 bytes of rng
@@ -364,14 +333,15 @@ warnpc $B08000
;Bank Map ;Bank Map
;$20 Code Bank ;$20 Code Bank
;$21 Reserved (Frame Hook & Init) ;$21 Reserved (Frame Hook & Init)
;$22 Contrib Code ;$22 Unused
;$23 Stats & Credits ;$23 Stats & Credits
;$24 Code Bank ;$24 Code Bank
;$26 Multiworld data
;$27 DR Code Bank ;$27 DR Code Bank
;$28 Keydrop / Standing Items Code bank ;$28 Keydrop / Standing Items Code bank
;$29 External hooks (rest of bank not used) ;$29 External hooks (rest of bank not used)
;$2A Reserved for OWR ;$2A Reserved for OWR
;$2B Room Data migration ;$2B Reserved for "outlet data" ~5.8k
;$2E Reserved for Tournament Use ;$2E Reserved for Tournament Use
;$2F Static RNG (rest is reserved for tournament use) ;$2F Static RNG (rest is reserved for tournament use)
;$30 Main Configuration Table ;$30 Main Configuration Table
@@ -379,23 +349,24 @@ warnpc $B08000
;$32 Text Bank ;$32 Text Bank
;$33 Graphics Bank ;$33 Graphics Bank
;$36 reserved for Enemizer ;$36 reserved for Enemizer
;$37 Room data if needed for DR/Pottery/Enemizer
;$3A reserved for downstream use ;$3A reserved for downstream use
;$3B reserved for downstream use ;$3B reserved for downstream use
;$3F reserved for internal debugging ;$3F reserved for internal debugging
;================================================================================ ;================================================================================
;RAM ;RAM
;$7E021B[0x1]: Used by race game instead of $0ABF to avoid witch item conflict ;See ram.asm for label assignments
;$7EC900[0x1F00]: BIGRAM buffer ;$7EC900[0x1F00]: BigRAM buffer
;$7EF000[0x500]: SRAM mirror First 0x500 bytes of SRAM ;$7EF000[0x500]: SRAM mirror First 0x500 bytes of SRAM
; See sram.asm for labels and assignments ; See sram.asm for labels and assignments
;$7F5000[0x800]: Rando's main free ram region ;$7F5000[0x800]: Rando's main free ram region
; See tables.asm for specific assignments ; See ram.asm for specific assignments
;$7F6000[0x1000]: SRAM buffer mapped to vanilla save slots 1 and 2 ;$7F6000[0x1000]: SRAM buffer mapped to vanilla save slots 1 and 2
; See sram.asm for labels and assignments ; See sram.asm for labels and assignments
;$7F7667[0x6719] - free ram ;$7F7667[0x6719] - free ram
;================================================================================ ;================================================================================
;SRAM Map ;SRAM Map
;See sram.asm for rando-specific assignments ;See sram.asm for label assignments and documentation
;$70:0000 (5K) Game state ;$70:0000 (5K) Game state
; 0000-04FF Vanilla Slot 1 (mirrored at $7EF000) ; 0000-04FF Vanilla Slot 1 (mirrored at $7EF000)
; 0500-14FF Ext Slot 1 (mirrored at $7F6000) ; 0500-14FF Ext Slot 1 (mirrored at $7F6000)
@@ -403,447 +374,19 @@ warnpc $B08000
;$70:3000 (0x16) Password ;$70:3000 (0x16) Password
;$70:6000 (8K) Scratch buffers ;$70:6000 (8K) Scratch buffers
;================================================================================ ;================================================================================
;org $0080DC ; <- 0xDC - Bank00.asm:179 - Kill Music
;db #$A9, #$00, #$EA
;LDA.b #$00 : NOP
;================================================================================
;org $0AC53E ; <- 5453E - Bank0A.asm:1103 - (LDA $0AC51F, X) - i have no idea what this is for anymore
;LDA.b #$7F
;NOP #2
;================================================================================
;org $05DF8B ; <- 2DF8B - Bank05.asm : 2483
;AND.w #$0100 ; allow Sprite_DrawMultiple to access lower half of sprite tiles
;================================================================================
;org $0DF8F1 ; this is required for the X-indicator in the HUD except not anymore obviously
;
;;red pendant
;db $2B, $31, $2C, $31, $3D, $31, $2E, $31
;db $2B, $25, $2C, $25, $2D, $25, $2E, $25
;
;;blue pendant
;db $2B, $31, $2C, $31, $3D, $31, $2E, $31
;db $2B, $2D, $2C, $2D, $2D, $2D, $2E, $2D
;
;;green pendant
;db $2B, $31, $2C, $31, $3D, $31, $2E, $31
;db $2B, $3D, $2C, $3D, $2D, $3D, $2E, $3D
;================================================================================
;org $00CFF2 ; 0x4FF2 - Mire H
;db GFX_Mire_Bombos>>16
;org $00D0D1 ; 0x50D1 - Mire M
;db GFX_Mire_Bombos>>8
;org $00D1B0 ; 0x51B0 - Mire L
;db GFX_Mire_Bombos
;org $00D020 ; 0x5020 - Trock H org $80D09C ; 0x509C - HUD Items 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 db GFX_HUD_Items>>16
org $00D17B ; 0x517B - HUD Items M org $80D17B ; 0x517B - HUD Items M
db GFX_HUD_Items>>8 db GFX_HUD_Items>>8
org $00D25A ; 0x525A - HUD Items L org $80D25A ; 0x525A - HUD Items L
db GFX_HUD_Items db GFX_HUD_Items
; this used to be a pointer to a dummy file org $80D09D ; 0x509D - HUD Main H
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 db GFX_HUD_Main>>16
org $00D17C ; 0x517C - HUD Main M org $80D17C ; 0x517C - HUD Main M
db GFX_HUD_Main>>8 db GFX_HUD_Main>>8
org $00D25B ; 0x525B - HUD Main L org $80D25B ; 0x525B - HUD Main L
db GFX_HUD_Main 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 $00E784
LoadCommonSprites_in_file_select:
org $00F945
PrepDungeonExit:
org $00FDEE
Mirror_InitHdmaSettings:
org $01873A
Dungeon_LoadRoom:
org $02821E
Module_PreDungeon:
org $028296
.setAmbientSfx
org $828AD9
Underworld_SetBossOrSancMusicUponEntry:
org $02A0A8
Dungeon_SaveRoomData:
org $02A0BE
Dungeon_SaveRoomData_justKeys:
org $02A4E3
Overworld_ActualScreenID:
org $02A9F3
OverworldHandleTransitions_change_palettes:
org $02B861
Dungeon_SaveRoomQuadrantData:
org $02C11D
CalculateTransitionLanding:
org $02C176
Overworld_FinalizeEntryOntoScreen_Data:
org $82C3F2
OverworldLoadScreensPaletteSet_long:
org $02D9B9
Underworld_LoadSpawnEntrance:
org $02E99D
FluteMenu_LoadTransport:
org $02FD6D
LoadGearPalettes_link:
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 $058008
Sprite_SpawnSparkleGarnish:
org $05A51D
Sprite_SpawnFallingItem:
org $05DF6C ; 02DF6C - Bank05.asm : 2445
Sprite_DrawMultiple:
org $05DF70 ; 02DF70 - Bank05.asm : 2454
Sprite_DrawMultiple_quantity_preset:
org $05DF75 ; 02DF75 - Bank05.asm : 2461
Sprite_DrawMultiple_player_deferred:
org $05E1A7 ; 02E1A7 - Bank05.asm : 2592
Sprite_ShowSolicitedMessageIfPlayerFacing:
org $05E1F0
Sprite_ShowMessageFromPlayerContact:
org $05E219
Sprite_ShowMessageUnconditional:
org $05EC96
Sprite_ZeldaLong:
org $0680FA
Player_ApplyRumbleToSprites:
org $0683E6
Utility_CheckIfHitBoxesOverlapLong:
org $06A7DB
Chicken_SpawnAvengerChicken: ; returns short
org $06AD58
Sprite_TransmuteToBomb:
org $06DC5C
Sprite_DrawShadowLong:
org $06DD40
DashKey_Draw:
org $06DBF8
Sprite_PrepAndDrawSingleLargeLong:
org $06DC00
Sprite_PrepAndDrawSingleSmallLong:
org $06E41C
Sprite_PrepOAMCoordLong:
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 $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 $08CE2E
GTCutscene_AnimateCrystals_NoRotate:
org $08CEB6
GTCutscene_DrawSingleCrystal_SkipCrystal:
org $08CEC3
GTCutscene_DrawSingleCrystal_SkipSparkle:
org $08CF59
GTCutscene_SparkleALot:
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 $1EDE89
GoldBee_Dormant_exit:
org $1EDE8A
GoldBee_SpawnSelf:
org $1EF4E7
Sprite_PlayerCantPassThrough:
;================================================================================ ;================================================================================

View File

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

BIN
asar

Binary file not shown.

BIN
bin/linux/asar Normal file

Binary file not shown.

BIN
bin/macos/asar Normal file

Binary file not shown.

BIN
bin/windows/asar.exe Normal file

Binary file not shown.

View File

@@ -8,7 +8,7 @@ Overworld_LoadBonkTiles:
LDA.b #$7E : PHA : PLB LDA.b #$7E : PHA : PLB
REP #$30 REP #$30
; Use it as an index into a jump table. ; Use it as an index into a jump table.
LDA.b $8A : CMP #$0080 : !BGE .noData LDA.b OverworldIndex : CMP.w #$0080 : !BGE .noData
ASL A : TAX : JSR (Overworld_BonkTilesTable, X) ASL A : TAX : JSR (Overworld_BonkTilesTable, X)
.noData .noData
@@ -56,7 +56,10 @@ dw return, return, return, return, return, return, map6e, return
dw return, return, return, return, return, return, return, return dw return, return, return, return, return, return, return, return
;120 121 122 123 124 125 126 127 ;120 121 122 123 124 125 126 127
dw return, return, return, return, return, return, return, return dw return, return, return, return, return, return, return, return
}
return:
RTS
map00: ; Map00/Map01/Map08/Map09 map00: ; Map00/Map01/Map08/Map09
{ {

View File

@@ -2,21 +2,23 @@
; Randomize Book of Mudora ; Randomize Book of Mudora
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
LoadLibraryItemGFX: LoadLibraryItemGFX:
LDA.l LibraryItem_Player : STA !MULTIWORLD_SPRITEITEM_PLAYER_ID LDA.l LibraryItem_Player : STA.l !MULTIWORLD_SPRITEITEM_PLAYER_ID
%GetPossiblyEncryptedItem(LibraryItem, SpriteItemValues) %GetPossiblyEncryptedItem(LibraryItem, SpriteItemValues)
STA $0E80, X ; Store item type JSL AttemptItemSubstitution
JML RequestSlottedTile JSL ResolveLootIDLong
STA.w SpriteID, X
JML RequestStandingItemVRAMSlot
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
DrawLibraryItemGFX: DrawLibraryItemGFX:
PHA PHA
LDA $0E80, X ; Retrieve stored item type LDA.w SpriteID, X
JSL.l DrawSlottedTile JSL DrawPotItem
PLA PLA
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
SetLibraryItem: SetLibraryItem:
LDY $0E80, X ; Retrieve stored item type LDY.w SpriteID, X
JSL.l ItemSet_Library ; contains thing we wrote over JSL ItemSet_Library ; contains thing we wrote over
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
@@ -25,49 +27,59 @@ RTL
; Randomize Bonk Keys ; Randomize Bonk Keys
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
LoadBonkItemGFX: LoadBonkItemGFX:
LDA.b #$08 : STA $0F50, X ; thing we wrote over LDA.b #$08 : STA.w SpriteOAMProp, X ; thing we wrote over
LoadBonkItemGFX_inner: LoadBonkItemGFX_inner:
JSR LoadBonkItem_Player : STA !MULTIWORLD_SPRITEITEM_PLAYER_ID JSR LoadBonkItem_Player : STA !MULTIWORLD_SPRITEITEM_PLAYER_ID
JSR LoadBonkItem JSR LoadBonkItem
JML RequestSlottedTile JSL AttemptItemSubstitution
JSL ResolveLootIDLong
STA.w SpriteItemType, X
STA.w SpriteID, X
JSL RequestStandingItemVRAMSlot
PHA : PHX
LDA.w SpriteID,X : TAX
LDA.l SpriteProperties_standing_width,X : BNE +
LDA.b #$00 : STA.l SpriteOAM : STA.l SpriteOAM+8
+
PLX : PLA
RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
DrawBonkItemGFX: DrawBonkItemGFX:
PHA PHA
LDA.w !SPRITE_REDRAW, X : BEQ .skipInit ; skip init if already ready LDA.w SprRedrawFlag, X : BEQ .skipInit
JSL.l LoadBonkItemGFX_inner JSL LoadBonkItemGFX_inner
LDA.w !SPRITE_REDRAW, X : CMP.b #$02 : BEQ .skipInit LDA.w SprRedrawFlag, X : CMP.b #$02 : BEQ .skipInit
BRA .done ; don't draw on the init frame BRA .done ; don't draw on the init frame
.skipInit .skipInit
JSR LoadBonkItem LDA.w SpriteID,X
JSL DrawSlottedTile JSL DrawPotItem
.done .done
PLA PLA
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
GiveBonkItem: GiveBonkItem:
JSR LoadBonkItem_Player : STA !MULTIWORLD_ITEM_PLAYER_ID JSR LoadBonkItem_Player : STA !MULTIWORLD_ITEM_PLAYER_ID
JSR LoadBonkItem JSR LoadBonkItem
CMP #$24 : BNE .notKey JSR AbsorbKeyCheck : BCC .notKey
.key .key
PHY : LDY.b #$24 : JSL.l AddInventory : PLY ; do inventory processing for a small key PHY : LDY.b #$24 : JSL AddInventory : PLY ; do inventory processing for a small key
LDA CurrentSmallKeys : INC A : STA CurrentSmallKeys LDA.l CurrentSmallKeys : INC A : STA.l CurrentSmallKeys
LDA.b #$2F : JSL.l Sound_SetSfx3PanLong LDA.b #$2F : JSL Sound_SetSfx3PanLong
JSL CountBonkItem INC.w UpdateHUDFlag
RTL RTL
.notKey .notKey
PHY : TAY : JSL.l Link_ReceiveItem : PLY PHY : TAY : JSL Link_ReceiveItem : PLY
JSL CountBonkItem
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
LoadBonkItem: LoadBonkItem:
LDA $A0 ; check room ID - only bonk keys in 2 rooms so we're just checking the lower byte LDA.b RoomIndex ; check room ID - only bonk keys in 2 rooms so we're just checking the lower byte
CMP #115 : BNE + ; Desert Bonk Key CMP.b #$73 : BNE + ; Desert Bonk Key
LDA.l BonkKey_Desert LDA.l BonkKey_Desert
BRA ++ BRA ++
+ : CMP #140 : BNE + ; GTower Bonk Key + : CMP.b #$8C : BNE + ; GTower Bonk Key
LDA.l BonkKey_GTower LDA.l BonkKey_GTower
BRA ++ BRA ++
+ +
LDA.b #$24 ; default to small key LDA.b #$24 ; default to small key
@@ -75,14 +87,30 @@ LoadBonkItem:
RTS RTS
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
LoadBonkItem_Player: LoadBonkItem_Player:
LDA $A0 ; check room ID - only bonk keys in 2 rooms so we're just checking the lower byte LDA.b RoomIndex ; check room ID - only bonk keys in 2 rooms so we're just checking the lower byte
CMP #115 : BNE + ; Desert Bonk Key CMP.b #$73 : BNE + ; Desert Bonk Key
LDA.l BonkKey_Desert_Player LDA.l BonkKey_Desert_Player
BRA ++ BRA ++
+ : CMP #140 : BNE + ; GTower Bonk Key + : CMP.b #$8C : BNE + ; GTower Bonk Key
LDA.l BonkKey_GTower_Player LDA.l BonkKey_GTower_Player
BRA ++ BRA ++
+ +
LDA.b #$00 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
RTS RTS

View File

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

View File

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

View File

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

View File

@@ -1,5 +1,8 @@
#!/bin/bash #!/bin/bash
rm ../working.sfc rm ../alttp.sfc
cp ../alttp.sfc ../working.sfc cp ~/dev/kwyn/orig/z3.sfc ../alttp.sfc
./asar LTTP_RND_GeneralBugfixes.asm ../working.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

View File

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

View File

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

View File

@@ -1,40 +0,0 @@
;================================================================================
; Randomize Catfish
;--------------------------------------------------------------------------------
LoadCatfishItemGFX:
LDA.l CatfishItem_Player : STA !MULTIWORLD_SPRITEITEM_PLAYER_ID
LDA.l $1DE185 ; location randomizer writes catfish item to
JML RequestSlottedTile
;--------------------------------------------------------------------------------
DrawThrownItem:
LDA $8A : CMP.b #$81 : BNE .catfish
.zora
LDA.l $1DE1C3 ; location randomizer writes zora item to
BRA .draw
.catfish
LDA.l $1DE185 ; location randomizer writes catfish item to
.draw
JML DrawSlottedTile
;--------------------------------------------------------------------------------
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
View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,21 +1,6 @@
; $7F50D0 - $7F50FF - Block Cypher Parameters ; Scrap04 used for n
; $7F5100 - $7F51FF - Block Cypher Buffer ; Scrap06 used for rounds
!v = "$7F5100" ; Scrap08 use for dpScratch/MXResult (lower 32 of dpScratch)
!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: CryptoDelta:
dd #$9e3779b9 dd #$9e3779b9
@@ -35,164 +20,144 @@ macro ASL32Single(value)
; ROL handles the carry from the lower byte for us ; ROL handles the carry from the lower byte for us
endmacro 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: CryptoMX:
PHX PHX
; upperScratch = (z>>5 ^ y <<2) ; upperScratch = (z>>5 ^ y <<2)
LDA.w !z : STA.b !dpScratch LDA.w z : STA.b Scrap08
LDA.w !z+2 : STA.b !dpScratch+2 LDA.w z+2 : STA.b Scrap08+2
%LSR32Single(!dpScratch) %LSR32Single(Scrap08)
%LSR32Single(!dpScratch) %LSR32Single(Scrap08)
%LSR32Single(!dpScratch) %LSR32Single(Scrap08)
%LSR32Single(!dpScratch) %LSR32Single(Scrap08)
%LSR32Single(!dpScratch) %LSR32Single(Scrap08)
;%LSR32(!dpScratch,#$05) ;%LSR32(Scrap08,#$05)
LDA.w !y : STA.b !dpScratch+4 LDA.w y : STA.b Scrap08+4
LDA.w !y+2 : STA.b !dpScratch+6 LDA.w y+2 : STA.b Scrap08+6
%ASL32Single(!dpScratch+4) %ASL32Single(Scrap08+4)
%ASL32Single(!dpScratch+4) %ASL32Single(Scrap08+4)
;%ASL32(!dpScratch+4,#$02) ;%ASL32(Scrap08+4,#$02)
LDA.b !dpScratch : EOR.b !dpScratch+4 : STA.w !upperScratch LDA.b Scrap08 : EOR.b Scrap08+4 : STA.w CryptoScratch
LDA.b !dpScratch+2 : EOR.b !dpScratch+6 : STA.w !upperScratch+2 LDA.b Scrap08+2 : EOR.b Scrap08+6 : STA.w CryptoScratch+2
;================================ ;================================
; upperscratch2 = (y>>3^z<<4) ; upperscratch2 = (y>>3^z<<4)
LDA.w !z : STA.b !dpScratch LDA.w z : STA.b Scrap08
LDA.w !z+2 : STA.b !dpScratch+2 LDA.w z+2 : STA.b Scrap08+2
%ASL32Single(!dpScratch) %ASL32Single(Scrap08)
%ASL32Single(!dpScratch) %ASL32Single(Scrap08)
%ASL32Single(!dpScratch) %ASL32Single(Scrap08)
%ASL32Single(!dpScratch) %ASL32Single(Scrap08)
;%ASL32(!dpScratch,#$04) ;%ASL32(Scrap08,#$04)
LDA.w !y : STA.b !dpScratch+4 LDA.w y : STA.b Scrap08+4
LDA.w !y+2 : STA.b !dpScratch+6 LDA.w y+2 : STA.b Scrap08+6
%LSR32Single(!dpScratch+4) %LSR32Single(Scrap08+4)
%LSR32Single(!dpScratch+4) %LSR32Single(Scrap08+4)
%LSR32Single(!dpScratch+4) %LSR32Single(Scrap08+4)
;%LSR32(!dpScratch+4,#$03) ;%LSR32(Scrap08+4,#$03)
LDA.b !dpScratch : EOR.b !dpScratch+4 : STA.w !upperScratch+4 LDA.b Scrap08 : EOR.b Scrap08+4 : STA.w CryptoScratch+4
LDA.b !dpScratch+2 : EOR.b !dpScratch+6 : STA.w !upperScratch+6 LDA.b Scrap08+2 : EOR.b Scrap08+6 : STA.w CryptoScratch+6
;================================ ;================================
; upperscratch = upperscratch + upperscratch2 ( == (z>>5^y<<2) + (y>>3^z<<4) ) ; upperscratch = upperscratch + upperscratch2 ( == (z>>5^y<<2) + (y>>3^z<<4) )
LDA.w !upperScratch : !ADD.w !upperScratch+4 : STA.w !upperScratch LDA.w CryptoScratch : !ADD.w CryptoScratch+4 : STA.w CryptoScratch
LDA.w !upperScratch+2 : ADC.w !upperScratch+6 : STA.w !upperScratch+2 LDA.w CryptoScratch+2 : ADC.w CryptoScratch+6 : STA.w CryptoScratch+2
;================================ ;================================
; dpscratch = sum^y ; dpscratch = sum^y
LDA.w !sum : EOR.w !y : STA.b !dpScratch LDA.w Sum : EOR.w y : STA.b Scrap08
LDA.w !sum+2 : EOR.w !y+2 : STA.b !dpScratch+2 LDA.w Sum+2 : EOR.w y+2 : STA.b Scrap08+2
;================================ ;================================
; dpscratch2 = (k[p&3^e]^z) ; 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 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, X : EOR.w z : STA.b Scrap08+4
LDA.w !keyBase+2, X : EOR.w !z+2 : STA.b !dpScratch+6 LDA.w KeyBase+2, X : EOR.w z+2 : STA.b Scrap08+6
;================================ ;================================
; upperscratch2 = dpscratch + dpscratch2 (== (sum^y) + (k[p&3^e]^z)) ; upperscratch2 = dpscratch + dpscratch2 (== (sum^y) + (k[p&3^e]^z))
LDA.b !dpScratch : !ADD.b !dpScratch+4 : STA.w !upperScratch+4 LDA.b Scrap08 : !ADD.b Scrap08+4 : STA.w CryptoScratch+4
LDA.b !dpScratch+2 : ADC.b !dpScratch+6 : STA.w !upperScratch+6 LDA.b Scrap08+2 : ADC.b Scrap08+6 : STA.w CryptoScratch+6
;================================ ;================================
; MXResult = uppserscratch ^ upperscratch2 ; MXResult = uppserscratch ^ upperscratch2
LDA.w !upperScratch : EOR.w !upperScratch+4 : STA.b !MXResult LDA.w CryptoScratch : EOR.w CryptoScratch+4 : STA.b Scrap08
LDA.w !upperScratch+2 : EOR.w !upperScratch+6 : STA.b !MXResult+2 LDA.w CryptoScratch+2 : EOR.w CryptoScratch+6 : STA.b Scrap08+2
PLX PLX
RTS RTS
;!DIVIDEND_LOW = $4204
;!DIVIDEND_HIGH = $4205
;!DIVISOR = $4206
;!QUOTIENT_LOW = $4214
;!QUOTIENT_HIGH = $4215
XXTEA_Decode: XXTEA_Decode:
PHP : PHB PHP : PHB
SEP #$30 ; set 8-bit accumulator and index SEP #$30 ; set 8-bit accumulator and index
LDA.b #$7F : PHA : PLB LDA.b #$7F : PHA : PLB
STZ.b !n+1 ; set upper byte of n to be zero, so it can safely be accessed in 16-bit mode STZ.b Scrap04+1 ; set upper byte of n to be zero, so it can safely be accessed in 16-bit mode
; search for lookup table index to avoid division and multiplication ; search for lookup table index to avoid division and multiplication
LDX.b #0 LDX.b #0
- -
LDA.l .n_lookup, X LDA.l .n_lookup, X
CMP.b !n : !BLT + CMP.b Scrap04 : !BLT +
INX INX
BRA - BRA -
+ +
; rounds = 6 + 52/n; ; rounds = 6 + 52/n;
LDA.l .round_counts, X : STA.b !rounds : STZ.b !rounds+1 LDA.l .round_counts, X : STA.b Scrap06 : STZ.b Scrap06+1
REP #$20 ; set 16-bit accumulator REP #$20 ; set 16-bit accumulator
; sum = rounds*DELTA; ; sum = rounds*DELTA;
TXA : ASL #2 : TAX TXA : ASL #2 : TAX
LDA.l .initial_sums, X : STA.w !sum LDA.l .initial_sums, X : STA.w Sum
LDA.l .initial_sums+2, X : STA.w !sum+2 LDA.l .initial_sums+2, X : STA.w Sum+2
; y = v[0]; ; y = v[0];
LDA.w !v : STA.w !y LDA.w v : STA.w y
LDA.w !v+2 : STA.w !y+2 LDA.w v+2 : STA.w y+2
--- ---
LDA.w !sum : LSR #2 : AND.w #$0003 : STA.w !e ; e = (sum >> 2) & 3; LDA.w Sum : LSR #2 : AND.w #$0003 : STA.w e ; e = (sum >> 2) & 3;
LDA.b !n : DEC : STA.w !p LDA.b Scrap04 : DEC : STA.w p
-- BEQ + ; for (p=n-1; p>0; p--) { -- BEQ + ; for (p=n-1; p>0; p--) {
; z = v[p-1]; ; z = v[p-1];
ASL #2 : TAX ASL #2 : TAX
LDA.w !v-4, X : STA.w !z LDA.w v-4, X : STA.w z
LDA.w !v-4+2, X : STA.w !z+2 LDA.w v-4+2, X : STA.w z+2
; y = v[p] -= MX; ; y = v[p] -= MX;
JSR CryptoMX JSR CryptoMX
LDA.w !p : ASL #2 : TAX LDA.w p : ASL #2 : TAX
LDA.w !v, X : !SUB.b !MXResult : STA.w !v, X : STA.w !y LDA.w v, X : !SUB.b Scrap08 : 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 v+2, X : SBC.b Scrap08+2 : STA.w v+2, X : STA.w y+2
LDA.w !p : DEC : STA.w !p : BRA -- ; } LDA.w p : DEC : STA.w p : BRA -- ; }
+ +
; z = v[n-1]; ; z = v[n-1];
LDA.b !n : DEC : ASL #2 : TAX LDA.b Scrap04 : DEC : ASL #2 : TAX
LDA.w !v, X : STA.w !z LDA.w v, X : STA.w z
LDA.w !v+2, X : STA.w !z+2 LDA.w v+2, X : STA.w z+2
; y = v[0] -= MX; ; y = v[0] -= MX;
JSR CryptoMX JSR CryptoMX
LDA.w !v : !SUB.b !MXResult : STA.w !v : STA.w !y LDA.w v : !SUB.b Scrap08 : STA.w v : STA.w y
LDA.w !v+2 : SBC.b !MXResult+2 : STA.w !v+2 : STA.w !y+2 LDA.w v+2 : SBC.b Scrap08+2 : STA.w v+2 : STA.w y+2
; sum -= DELTA; ; sum -= DELTA;
LDA.w !sum : !SUB.l CryptoDelta : STA.w !sum LDA.w Sum : !SUB.l CryptoDelta : STA.w Sum
LDA.w !sum+2 : SBC.l CryptoDelta+2 : STA.w !sum+2 LDA.w Sum+2 : SBC.l CryptoDelta+2 : STA.w Sum+2
DEC !rounds : BEQ + : JMP --- : + ; } while (--rounds); DEC.b Scrap06 : BEQ + : JMP --- : + ; } while (--rounds);
PLB : PLP PLB : PLP
RTL RTL
@@ -243,69 +208,3 @@ db 32 ; n is 2
;dd (23*$9e3779b9)&$ffffffff ; n is 3 ;dd (23*$9e3779b9)&$ffffffff ; n is 3
dd (32*$9e3779b9)&$ffffffff ; n is 2 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,49 +1,35 @@
;================================================================================ ;================================================================================
!CUCCO_STORM = "$7F50C5" !CUCCO = $0B
!IS_INDOORS = "$7E001B" !INERT = $00
!ENEMY_STATE_TABLE = "$7E0DD0" !INIT = $08
!ENEMY_TYPE_TABLE = "$7E0E20" !ALIVE = $09
!ENEMY_AUX1_TABLE = "$7E0DA0" !CUCCO_ENRAGED = $23
!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: CuccoStorm:
SEP #$30 ; set 8-bit accumulator index registers SEP #$30 ; set 8-bit accumulator index registers
LDA.l !CUCCO_STORM : BEQ + ; only if storm is on LDA.l CuccoStormer : BEQ + ; only if storm is on
LDA.b $10 : CMP.b #$09 : BNE + ; only if outdoors LDA.b GameMode : CMP.b #$09 : BNE + ; only if outdoors
LDA.l LoopFrames : AND.b #$7F : BNE + ; check every 128 frames LDA.l LoopFrames : AND.b #$7F : BNE + ; check every 128 frames
- -
;==== Find a Cucco ;==== Find a Cucco
LDY.b #$FF : PHY ; push "cucco not found" LDY.b #$FF : PHY ; push "cucco not found"
LDX.b #$00 : -- : CPX.b #$10 : !BGE .ldone LDX.b #$00 : -- : CPX.b #$10 : !BGE .ldone
LDA.w !ENEMY_STATE_TABLE, X : CMP.b !ALIVE : BEQ +++ LDA.w SpriteAITable, X : CMP.b #!ALIVE : BEQ +++
; enemy not found ; enemy not found
CMP.b !INERT : BNE ++ CMP.b #!INERT : BNE ++
; log inert enemy slot ; log inert enemy slot
PLA : PHX PLA : PHX
BRA ++ BRA ++
+++ +++
; found an enemy ; found an enemy
LDA.l !ENEMY_TYPE_TABLE, X : CMP.b !CUCCO : BNE ++ LDA.l SpriteTypeTable, X : CMP.b #!CUCCO : BNE ++
; it's a cucco ; it's a cucco
TXY ; record where we found the living cucco in case we don't find any angry ones TXY ; record where we found the living cucco in case we don't find any angry ones
LDA.w !ENEMY_AUX1_TABLE, X : CMP.b !CUCCO_ENRAGED : !BLT ++ LDA.w SpriteAuxTable, X : CMP.b #!CUCCO_ENRAGED : !BLT ++
PLA : BRA + ; we found an angry cucco, done PLA : BRA + ; we found an angry cucco, done
++ : INX : BRA -- : .ldone ++ : INX : BRA -- : .ldone
@@ -53,22 +39,22 @@ CuccoStorm:
; we didn't find a cucco, so try to create one ; we didn't find a cucco, so try to create one
PLY PLY
CPY.b #$FF : BEQ + ; fail if no slots found CPY.b #$FF : BEQ + ; fail if no slots found
LDA.b !CUCCO : STA.w !ENEMY_TYPE_TABLE, Y LDA.b #!CUCCO : STA.w SpriteTypeTable, Y
LDA.b !INIT : STA.w !ENEMY_STATE_TABLE, Y LDA.b #!INIT : STA.w SpriteAITable, Y
LDA.b !LINK_POS_Y_LOW : STA.w !ENEMY_POS_Y_LOW, Y LDA.b LinkPosY : STA.w SpritePosYLow, Y
LDA.b !LINK_POS_Y_HIGH : STA.w !ENEMY_POS_Y_HIGH, Y LDA.b LinkPosY+1 : STA.w SpritePosYHigh, Y
LDA.b !LINK_POS_X_LOW : STA.w !ENEMY_POS_X_LOW, Y LDA.b LinkPosX : STA.w SpritePosXLow, Y
LDA.b !LINK_POS_X_HIGH : STA.w !ENEMY_POS_X_HIGH, Y LDA.b LinkPosX+1 : STA.w SpritePosXHigh, Y
BRA +++ BRA +++
++ ++
PLA PLA
+++ +++
;==== Enrage a Cucco ;==== Enrage a Cucco
LDA.b !CUCCO_ENRAGED : STA.w !ENEMY_AUX1_TABLE, Y ; enrage the cucco LDA.b #!CUCCO_ENRAGED : STA.w SpriteAuxTable, Y ; enrage the cucco
LDA.b #$00 : STA.w !ENEMY_AUX2_TABLE, Y : STA.w !ENEMY_DIRECTION_TABLE, Y LDA.b #$00 : STA.w SpriteAuxTable+$10, Y : STA.w SpriteDirectionTable, Y
;==== ;====
+ +
RTL RTL

17
custompalettes.asm Normal file
View File

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

View File

@@ -1,27 +0,0 @@
CheckReceivedItemPropertiesBeforeLoad:
LDA $A0 : BEQ .normalCode
LDA $7EC005 : BNE .lightOff
.normalCode
LDA.l AddReceivedItemExpanded_properties, X ;Restore Rando Code
RTL
.lightOff
PHX : PHY : PHB
LDA.l AddReceivedItemExpanded_properties, X ; 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

@@ -3,99 +3,99 @@
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
DarkWorldSaveFix: DarkWorldSaveFix:
LDA.b #$70 : PHA : PLB ; thing we wrote over - data bank change LDA.b #$70 : PHA : PLB ; thing we wrote over - data bank change
JSL.l MasterSwordFollowerClear JSL MasterSwordFollowerClear
JML.l StatSaveCounter JML StatSaveCounter
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
DoWorldFix: DoWorldFix:
LDA InvertedMode : BEQ + LDA.l InvertedMode : BEQ +
JMP DoWorldFix_Inverted JMP DoWorldFix_Inverted
+ +
LDA.l Bugfix_MirrorlessSQToLW : BEQ .skip_mirror_check LDA.l Bugfix_MirrorlessSQToLW : BEQ .skip_mirror_check
LDA FollowerIndicator : CMP #$04 : BNE + ; if old man following, skip mirror/aga check LDA.l FollowerIndicator : CMP.b #$04 : BNE + ; if old man following, skip mirror/aga check
LDA.l OldManRetrievalWorld LDA.l OldManRetrievalWorld
BRA .noMirror BRA .noMirror
+ LDA MirrorEquipment : AND #$02 : BEQ .noMirror ; check if we have the mirror + LDA.l MirrorEquipment : AND.b #$02 : BEQ .noMirror ; check if we have the mirror
.skip_mirror_check ; alt entrance point .skip_mirror_check ; alt entrance point
LDA ProgressIndicator : CMP.b #$03 : BCS .done ; check if agahnim 1 is alive LDA.l ProgressIndicator : CMP.b #$03 : BCS .done ; check if agahnim 1 is alive
.setLightWorld .setLightWorld
LDA #$00 LDA.b #$00
.noMirror .noMirror
STA CurrentWorld ; set flag to light world STA.l CurrentWorld ; set flag to light world
LDA.l SmithDeleteOnSave : BEQ .transform LDA.l SmithDeleteOnSave : BEQ .transform
LDA FollowerIndicator LDA.l FollowerIndicator
CMP #$07 : BEQ .clear ; clear frog CMP.b #$07 : BEQ .clear ; clear frog
CMP #$08 : BEQ .clear ; clear dwarf - consider flute implications CMP.b #$08 : BEQ .clear ; clear dwarf - consider flute implications
BRA .done BRA .done
.clear .clear
LDA.b #$00 : STA FollowerIndicator : BRA .done ; clear follower LDA.b #$00 : STA.l FollowerIndicator : BRA .done ; clear follower
.transform .transform
LDA FollowerIndicator : CMP #$07 : BNE .done : INC : STA FollowerIndicator ; convert frog to dwarf LDA.l FollowerIndicator : CMP.b #$07 : BNE .done : INC : STA.l FollowerIndicator ; convert frog to dwarf
.done .done
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
SetDeathWorldChecked: SetDeathWorldChecked:
LDA InvertedMode : BEQ + LDA.l InvertedMode : BEQ +
JMP SetDeathWorldChecked_Inverted JMP SetDeathWorldChecked_Inverted
+ +
LDA $1B : BEQ .outdoors LDA.b IndoorsFlag : BEQ .outdoors
LDA $040C : CMP #$FF : BNE .dungeon LDA.w DungeonID : CMP.b #$FF : BNE .dungeon
LDA $A0 : ORA $A1 : BNE ++ LDA.b RoomIndex : ORA.b RoomIndex+1 : BNE ++
LDA GanonPyramidRespawn : BNE .pyramid ; if flag is set, force respawn at pyramid on death to ganon LDA.l GanonPyramidRespawn : BNE .pyramid ; if flag is set, force respawn at pyramid on death to ganon
++ ++
.outdoors .outdoors
JMP DoWorldFix JMP DoWorldFix
.dungeon .dungeon
LDA Bugfix_PreAgaDWDungeonDeathToFakeDW : BNE .done ; if the bugfix is enabled, we do nothing on death in dungeon LDA.l Bugfix_PreAgaDWDungeonDeathToFakeDW : BNE .done ; if the bugfix is enabled, we do nothing on death in dungeon
JMP DoWorldFix_skip_mirror_check JMP DoWorldFix_skip_mirror_check
.pyramid .pyramid
LDA #$40 : STA CurrentWorld ; set flag to dark world LDA.b #$40 : STA.l CurrentWorld ; set flag to dark world
LDA FollowerIndicator : CMP #$08 : BNE .done : DEC : STA FollowerIndicator : + ; convert dwarf to frog LDA.l FollowerIndicator : CMP.b #$08 : BNE .done : DEC : STA.l FollowerIndicator : + ; convert dwarf to frog
.done .done
RTL RTL
;================================================================================ ;================================================================================
DoWorldFix_Inverted: DoWorldFix_Inverted:
LDA.l Bugfix_MirrorlessSQToLW : BEQ .skip_mirror_check LDA.l Bugfix_MirrorlessSQToLW : BEQ .skip_mirror_check
LDA FollowerIndicator : CMP #$04 : BNE + ; if old man following, skip mirror/aga check LDA.l FollowerIndicator : CMP.b #$04 : BNE + ; if old man following, skip mirror/aga check
LDA.l OldManRetrievalWorld LDA.l OldManRetrievalWorld
BRA .setWorld BRA .setWorld
+ LDA.l MirrorEquipment : AND #$02 : BEQ .noMirror ; check if we have the mirror + LDA.l MirrorEquipment : AND.b #$02 : BEQ .noMirror ; check if we have the mirror
.skip_mirror_check ; alt entrance point .skip_mirror_check ; alt entrance point
LDA ProgressIndicator : CMP.b #$03 : BCS .done ; check if agahnim 1 is alive LDA.l ProgressIndicator : CMP.b #$03 : BCS .done ; check if agahnim 1 is alive
.noMirror .noMirror
.setDarkWorld .setDarkWorld
LDA #$40 LDA.b #$40
.setWorld .setWorld
STA CurrentWorld ; set flag to dark world STA.l CurrentWorld ; set flag to dark world
LDA.l SmithDeleteOnSave : BEQ .transform LDA.l SmithDeleteOnSave : BEQ .transform
LDA FollowerIndicator LDA.l FollowerIndicator
CMP #$07 : BEQ .clear ; clear frog CMP.b #$07 : BEQ .clear ; clear frog
CMP #$08 : BEQ .clear ; clear dwarf - consider flute implications CMP.b #$08 : BEQ .clear ; clear dwarf - consider flute implications
BRA .done BRA .done
.clear .clear
LDA.b #$00 : STA FollowerIndicator : BRA .done ; clear follower LDA.b #$00 : STA.l FollowerIndicator : BRA .done ; clear follower
.transform .transform
LDA FollowerIndicator : CMP #$07 : BNE .done : INC : STA FollowerIndicator ; convert frog to dwarf LDA.l FollowerIndicator : CMP.b #$07 : BNE .done : INC : STA.l FollowerIndicator ; convert frog to dwarf
.done .done
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
SetDeathWorldChecked_Inverted: SetDeathWorldChecked_Inverted:
LDA $1B : BEQ .outdoors LDA.b IndoorsFlag : BEQ .outdoors
LDA $040C : CMP #$FF : BNE .dungeon LDA.w DungeonID : CMP.b #$FF : BNE .dungeon
LDA $A0 : ORA $A1 : BNE ++ LDA.b RoomIndex : ORA.b RoomIndex+1 : BNE ++
LDA GanonPyramidRespawn : BNE .castle ; if flag is set, force respawn at pyramid on death to ganon LDA.l GanonPyramidRespawn : BNE .castle ; if flag is set, force respawn at pyramid on death to ganon
++ ++
.outdoors .outdoors
JMP DoWorldFix_Inverted JMP DoWorldFix_Inverted
.dungeon .dungeon
LDA Bugfix_PreAgaDWDungeonDeathToFakeDW : BNE .done ; if the bugfix is enabled, we do nothing on death in dungeon LDA.l Bugfix_PreAgaDWDungeonDeathToFakeDW : BNE .done ; if the bugfix is enabled, we do nothing on death in dungeon
JMP DoWorldFix_Inverted_skip_mirror_check JMP DoWorldFix_Inverted_skip_mirror_check
.castle .castle
LDA #$00 : STA CurrentWorld ; set flag to dark world LDA.b #$00 : STA.l CurrentWorld ; set flag to dark world
LDA FollowerIndicator : CMP #$07 : BNE + : LDA.b #$08 : STA FollowerIndicator : + ; convert frog to dwarf LDA.l FollowerIndicator : CMP.b #$07 : BNE + : LDA.b #$08 : STA.l FollowerIndicator : + ; convert frog to dwarf
.done .done
RTL RTL
;================================================================================ ;================================================================================
@@ -103,9 +103,9 @@ RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
FakeWorldFix: FakeWorldFix:
LDA FixFakeWorld : BEQ + LDA.l FixFakeWorld : BEQ +
PHX PHX
LDX $8A : LDA.l OWTileWorldAssoc, X : STA CurrentWorld LDX.b OverworldIndex : LDA.l OWTileWorldAssoc, X : STA.l CurrentWorld
PLX PLX
+ +
RTL RTL
@@ -120,14 +120,14 @@ LDA CurrentWorld
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
MasterSwordFollowerClear: MasterSwordFollowerClear:
LDA FollowerIndicator LDA.l FollowerIndicator
CMP #$0E : BNE .exit ; clear master sword follower CMP.b #$0E : BNE .exit ; clear master sword follower
LDA.b #$00 : STA FollowerIndicator ; clear follower LDA.b #$00 : STA.l FollowerIndicator ; clear follower
.exit .exit
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
FixAgahnimFollowers: FixAgahnimFollowers:
LDA.b #$00 : STA FollowerIndicator ; clear follower LDA.b #$00 : STA.l FollowerIndicator ; clear follower
JML PrepDungeonExit ; thing we wrote over JML PrepDungeonExit ; thing we wrote over
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
@@ -137,10 +137,10 @@ macro SetMinimum(base,filler,compare)
?done: ?done:
endmacro endmacro
RefreshRainAmmo: RefreshRainAmmo:
LDA ProgressIndicator : CMP.b #$01 : BEQ .rain ; check if we're in rain state LDA.l ProgressIndicator : CMP.b #$01 : BEQ .rain ; check if we're in rain state
RTL RTL
.rain .rain
LDA StartingEntrance LDA.l StartingEntrance
+ CMP.b #$03 : BNE + ; Uncle + CMP.b #$03 : BNE + ; Uncle
%SetMinimum(CurrentMagic,MagicFiller,RainDeathRefillMagic_Uncle) %SetMinimum(CurrentMagic,MagicFiller,RainDeathRefillMagic_Uncle)
%SetMinimum(BombsEquipment,BombsFiller,RainDeathRefillBombs_Uncle) %SetMinimum(BombsEquipment,BombsFiller,RainDeathRefillBombs_Uncle)
@@ -165,28 +165,25 @@ RefreshRainAmmo:
.done .done
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
!INFINITE_ARROWS = "$7F50C8"
!INFINITE_BOMBS = "$7F50C9"
!INFINITE_MAGIC = "$7F50CA"
SetEscapeAssist: SetEscapeAssist:
LDA ProgressIndicator : CMP.b #$01 : BNE .no_train ; check if we're in rain state LDA.l ProgressIndicator : CMP.b #$01 : BNE .no_train ; check if we're in rain state
.rain .rain
LDA.l EscapeAssist LDA.l EscapeAssist
BIT.b #$04 : BEQ + : STA !INFINITE_MAGIC : + BIT.b #$04 : BEQ + : STA.l InfiniteArrows : +
BIT.b #$02 : BEQ + : STA !INFINITE_BOMBS : + BIT.b #$02 : BEQ + : STA.l InfiniteBombs : +
BIT.b #$01 : BEQ + : STA !INFINITE_ARROWS : + BIT.b #$01 : BEQ + : STA.l InfiniteArrows : +
BRA ++ BRA ++
.no_train ; choo choo .no_train ; choo choo
LDA.l EscapeAssist : BIT.b #$04 : BEQ + : LDA.b #$00 : STA !INFINITE_MAGIC : + LDA.l EscapeAssist : BIT.b #$04 : BEQ + : LDA.b #$00 : STA.l InfiniteMagic : +
LDA.l EscapeAssist : BIT.b #$02 : BEQ + : LDA.b #$00 : STA !INFINITE_BOMBS : + LDA.l EscapeAssist : BIT.b #$02 : BEQ + : LDA.b #$00 : STA.l InfiniteBombs : +
LDA.l EscapeAssist : BIT.b #$01 : BEQ + : LDA.b #$00 : STA !INFINITE_ARROWS : + LDA.l EscapeAssist : BIT.b #$01 : BEQ + : LDA.b #$00 : STA.l InfiniteArrows : +
++ ++
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
SetSilverBowMode: SetSilverBowMode:
LDA SilverArrowsUseRestriction : BEQ + ; fix bow type for restricted arrow mode LDA.l SilverArrowsUseRestriction : BEQ + ; fix bow type for restricted arrow mode
LDA BowEquipment : CMP.b #$3 : BCC + LDA.l BowEquipment : CMP.b #$3 : BCC +
SBC.b #$02 : STA BowEquipment SBC.b #$02 : STA.l BowEquipment
+ +
RTL RTL
;================================================================================ ;================================================================================

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

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

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

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

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

View File

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

View File

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

View File

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

View File

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

BIN
data/customitems.4bpp Normal file

Binary file not shown.

BIN
data/customitems.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

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

Binary file not shown.

BIN
data/fileselectgfx.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

View File

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

Binary file not shown.

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

View File

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

BIN
data/playernamecharmap.bin Normal file

Binary file not shown.

Binary file not shown.

View File

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

Binary file not shown.

View File

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

View File

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

BIN
data/smallchars.2bpp Normal file

Binary file not shown.

View File

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

View File

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

View File

@@ -2,200 +2,157 @@
; Dialog Pointer Override ; Dialog Pointer Override
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
DialogOverride: DialogOverride:
LDA $7F5035 : BEQ .skip LDA.l AltTextFlag : BEQ .skip
LDA $7F5700, X ; use alternate buffer LDA.l DialogBuffer, X ; use alternate buffer
RTL RTL
.skip .skip
LDA $7F1200, X LDA.l DecompressionBuffer+$1200, X
RTL RTL
;--------------------------------------------------------------------------------
; $7F5035 - Alternate Text Pointer Flag ; 0=Disable
; $7F5036 - Padding Byte (Must be Zero)
; $7F5700 - $7F57FF - Dialog Buffer
;--------------------------------------------------------------------------------
ResetDialogPointer: ResetDialogPointer:
STZ $1CF0 : STZ $1CF1 ; reset decompression buffer STZ.w TextID : STZ.w TextID+1 ; reset decompression buffer
LDA.b #$00 : STA $7F5035 ; zero out the alternate flag LDA.b #$00 : STA.l AltTextFlag ; zero out the alternate flag
LDA.b #$1C : STA $1CE9 ; thing we wrote over LDA.b #$1C : STA.w DelayTimer ; thing we wrote over
RTL 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) macro LoadDialogAddress(address)
PHA : PHX : PHY PHA : PHX : PHY
PHP PHP
PHB : PHK : PLB PHB : PHK : PLB
SEP #$20 ; set 8-bit accumulator SEP #$20 ; set 8-bit accumulator
REP #$10 ; set 16-bit index registers REP #$10 ; set 16-bit index registers
PEI ($00) PEI.b ($00)
LDA $02 : PHA LDA.b Scrap02 : PHA
STZ $1CF0 : STZ $1CF1 ; reset decompression buffer STZ.w TextID : STZ.w TextID+1 ; reset decompression buffer
LDA.b #$01 : STA $7F5035 ; set flag LDA.b #$01 : STA.l AltTextFlag ; set flag
%CopyDialog(<address>) %CopyDialog(<address>)
PLA : STA $02 PLA : STA.b Scrap02
REP #$20 REP #$20
PLA : STA $00 PLA : STA.b Scrap00
PLB PLB
PLP PLP
PLY : PLX : PLA PLY : PLX : PLA
endmacro endmacro
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
macro CopyDialog(address) macro CopyDialog(address)
LDA.b #<address> : STA $00 ; write pointer to direct page LDA.b #<address> : STA.b Scrap00 ; write pointer to direct page
LDA.b #<address>>>8 : STA $01 LDA.b #<address>>>8 : STA.b Scrap01
LDA.b #<address>>>16 : STA $02 LDA.b #<address>>>16 : STA.b Scrap02
%CopyDialogIndirect() %CopyDialogIndirect()
endmacro endmacro
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
macro CopyDialogIndirect() macro CopyDialogIndirect()
REP #$20 : LDA !OFFSET_POINTER : TAX : LDY.w #$0000 : SEP #$20 ; copy 2-byte offset pointer to X and set Y to 0 REP #$20 : LDA.l DialogOffsetPointer : TAX : LDY.w #$0000 : SEP #$20 ; copy 2-byte offset pointer to X and set Y to 0
?loop: ?loop:
LDA [$00], Y ; load the next character from the pointer LDA.b [$00], Y ; load the next character from the pointer
STA !DIALOG_BUFFER, X ; write to the buffer STA.l DialogBuffer, X ; write to the buffer
INX : INY INX : INY
CMP.b #$7F : BNE ?loop CMP.b #$7F : BNE ?loop
REP #$20 ; set 16-bit accumulator REP #$20 ; set 16-bit accumulator
TXA : INC : STA !OFFSET_RETURN ; copy out X into TXA : INC : STA.l DialogReturnPointer ; copy out X into
LDA.w #$0000 : STA !OFFSET_POINTER LDA.w #$0000 : STA.l DialogOffsetPointer
SEP #$20 ; set 8-bit accumulator SEP #$20 ; set 8-bit accumulator
endmacro endmacro
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
LoadDialogAddressIndirect: LoadDialogAddressIndirect:
STZ $1CF0 : STZ $1CF1 ; reset decompression buffer STZ.w TextID : STZ.w TextID+1 ; reset decompression buffer
LDA.b #$01 : STA $7F5035 ; set flag LDA.b #$01 : STA.l AltTextFlag ; set flag
%CopyDialogIndirect() %CopyDialogIndirect()
;%LoadDialogAddress(UncleText)
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
!ITEM_TEMPORARY = "$7F5040"
FreeDungeonItemNotice: FreeDungeonItemNotice:
STA !ITEM_TEMPORARY STA.w ScratchBufferV
PHA : PHX : PHY PHA : PHX : PHY
PHP PHP
PHB : PHK : PLB PHB : PHK : PLB
SEP #$20 ; set 8-bit accumulator SEP #$20 ; set 8-bit accumulator
REP #$10 ; set 16-bit index registers REP #$10 ; set 16-bit index registers
PEI ($00) PEI.b (Scrap00)
LDA $02 : PHA LDA.b Scrap02 : PHA
LDA.w ScratchBufferNV : PHA
LDA.w ScratchBufferNV+1 : PHA
;-------------------------------- ;--------------------------------
LDA.l FreeItemText : BNE + : JMP .skip : + LDA.l FreeItemText : BNE + : JMP .skip : +
LDA #$00 : STA $7F5010 ; initialize scratch LDA.b #$00 : STA.w ScratchBufferNV ; initialize scratch
LDA.l FreeItemText : AND.b #$01 : BEQ + ; show message for general small key LDA.l FreeItemText : AND.b #$01 : BEQ + ; show message for general small key
LDA !ITEM_TEMPORARY : CMP.b #$24 : BNE + ; general small key LDA.w ScratchBufferV : CMP.b #$24 : BNE + ; general small key
%CopyDialog(Notice_SmallKeyOf) %CopyDialog(Notice_SmallKeyOf)
LDA !OFFSET_RETURN : DEC #2 : STA !OFFSET_POINTER LDA.l DialogReturnPointer : DEC #2 : STA.l DialogOffsetPointer
%CopyDialog(Notice_Self) %CopyDialog(Notice_Self)
JMP .done JMP .done
+ : LDA.l FreeItemText : AND.b #$02 : BEQ + ; show message for general compass + : LDA.l FreeItemText : AND.b #$02 : BEQ + ; show message for general compass
LDA !ITEM_TEMPORARY : CMP.b #$25 : BNE + ; general compass LDA.w ScratchBufferV : CMP.b #$25 : BNE + ; general compass
%CopyDialog(Notice_CompassOf) %CopyDialog(Notice_CompassOf)
LDA !OFFSET_RETURN : DEC #2 : STA !OFFSET_POINTER LDA.l DialogReturnPointer : DEC #2 : STA.l DialogOffsetPointer
%CopyDialog(Notice_Self) %CopyDialog(Notice_Self)
JMP .done JMP .done
+ : LDA.l FreeItemText : AND.b #$04 : BEQ + ; show message for general map + : LDA.l FreeItemText : AND.b #$04 : BEQ + ; show message for general map
LDA !ITEM_TEMPORARY : CMP.b #$33 : BNE + ; general map LDA.w ScratchBufferV : CMP.b #$33 : BNE + ; general map
%CopyDialog(Notice_MapOf) %CopyDialog(Notice_MapOf)
LDA !OFFSET_RETURN : DEC #2 : STA !OFFSET_POINTER LDA.l DialogReturnPointer : DEC #2 : STA.l DialogOffsetPointer
%CopyDialog(Notice_Self) %CopyDialog(Notice_Self)
JMP .done JMP .done
+ : LDA.l FreeItemText : AND.b #$08 : BEQ + ; show message for general big key + : LDA.l FreeItemText : AND.b #$08 : BEQ + ; show message for general big key
LDA !ITEM_TEMPORARY : CMP.b #$32 : BNE + ; general big key LDA.w ScratchBufferV : CMP.b #$32 : BNE + ; general big key
%CopyDialog(Notice_BigKeyOf) %CopyDialog(Notice_BigKeyOf)
LDA !OFFSET_RETURN : DEC #2 : STA !OFFSET_POINTER LDA.l DialogReturnPointer : DEC #2 : STA.l DialogOffsetPointer
%CopyDialog(Notice_Self) %CopyDialog(Notice_Self)
JMP .done JMP .done
+ +
LDA.l FreeItemText : AND.b #$04 : BEQ + ; show message for dungeon map LDA.l FreeItemText : AND.b #$04 : BEQ + ; show message for dungeon map
LDA !ITEM_TEMPORARY : AND.b #$F0 ; looking at high bits only LDA.w ScratchBufferV : AND.b #$F0 ; looking at high bits only
CMP.b #$70 : BNE + ; map of... CMP.b #$70 : BNE + ; map of...
%CopyDialog(Notice_MapOf) %CopyDialog(Notice_MapOf)
JMP .dungeon JMP .dungeon
+ : LDA.l FreeItemText : AND.b #$02 : BEQ + ; show message for dungeon compass + : LDA.l FreeItemText : AND.b #$02 : BEQ + ; show message for dungeon compass
LDA !ITEM_TEMPORARY : AND.b #$F0 : CMP.b #$80 : BNE + ; compass of... LDA.w ScratchBufferV : AND.b #$F0 : CMP.b #$80 : BNE + ; compass of...
%CopyDialog(Notice_CompassOf) %CopyDialog(Notice_CompassOf)
JMP .dungeon JMP .dungeon
+ : LDA.l FreeItemText : AND.b #$08 : BEQ + ; show message for dungeon big key + : LDA.l FreeItemText : AND.b #$08 : BEQ + ; show message for dungeon big key
LDA !ITEM_TEMPORARY : AND.b #$F0 : CMP.b #$90 : BNE + ; big key of... LDA.w ScratchBufferV : AND.b #$F0 : CMP.b #$90 : BNE + ; big key of...
%CopyDialog(Notice_BigKeyOf) %CopyDialog(Notice_BigKeyOf)
BRA .dungeon JMP .dungeon
+ : LDA.l FreeItemText : AND.b #$01 : BEQ + ; show message for dungeon small key + : 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.w ScratchBufferV : AND.b #$F0 : CMP.b #$A0 : BNE + ; small key of...
LDA !ITEM_TEMPORARY : CMP.b #$AF : BNE ++ : JMP .skip : ++ LDA.w ScratchBufferV : CMP.b #$AF : BNE ++ : JMP .skip : ++
%CopyDialog(Notice_SmallKeyOf) %CopyDialog(Notice_SmallKeyOf)
PLA : AND.b #$0F : STA $7F5020 : LDA.b #$0F : !SUB $7F5020 : PHA LDA.b #$01 : STA.w ScratchBufferNV ; set up a flip for small keys
LDA #$01 : STA $7F5010 ; set up a flip for small keys
BRA .dungeon BRA .dungeon
+ + : LDA.l FreeItemText : AND.b #$20 : BEQ + ; show message for crystal
LDA.w ScratchBufferV : CMP.b #$B0 : !BLT + ; crystal #
CMP.b #$B7 : !BGE +
%CopyDialog(Notice_Crystal)
JMP .crystal
+
JMP .skip ; it's not something we are going to give a notice for JMP .skip ; it's not something we are going to give a notice for
.dungeon .dungeon
LDA !OFFSET_RETURN : DEC #2 : STA !OFFSET_POINTER LDA.l DialogReturnPointer : DEC #2 : STA.l DialogOffsetPointer
LDA !ITEM_TEMPORARY LDA.w ScratchBufferV
AND.b #$0F ; looking at low bits only AND.b #$0F
STA $7F5011 STA.w ScratchBufferNV+1
LDA $7F5010 : BEQ + LDA.w ScratchBufferNV : BEQ +
LDA $7F5010 LDA.w ScratchBufferNV
LDA #$0F : !SUB $7F5011 : STA $7F5011 ; flip the values for small keys LDA.b #$0F : !SUB.w ScratchBufferNV+1 : STA.w ScratchBufferNV+1 ; flip the values for small keys
+ +
LDA $7F5011 LDA.w ScratchBufferNV+1
ASL : TAX
REP #$20
LDA.l DungeonItemIDMap,X : CMP.w #$0003 : BCC .hc_sewers
CMP.w DungeonID : BNE +
BRA .self_notice
.hc_sewers
LDA.w DungeonID : CMP.w #$0003 : BCS +
.self_notice
SEP #$20
%CopyDialog(Notice_Self)
JMP.w .done
+
SEP #$20
LDA.w ScratchBufferNV+1
CMP.b #$00 : BNE + ; ...light world CMP.b #$00 : BNE + ; ...light world
%CopyDialog(Notice_LightWorld) : JMP .done %CopyDialog(Notice_LightWorld) : JMP .done
+ : CMP.b #$01 : BNE + ; ...dark world + : CMP.b #$01 : BNE + ; ...dark world
@@ -223,38 +180,61 @@ FreeDungeonItemNotice:
+ : CMP.b #$0C : BNE + ; ...desert palace + : CMP.b #$0C : BNE + ; ...desert palace
%CopyDialog(Notice_Desert) : JMP .done %CopyDialog(Notice_Desert) : JMP .done
+ : CMP.b #$0D : BNE + ; ...eastern palace + : CMP.b #$0D : BNE + ; ...eastern palace
%CopyDialog(Notice_Eastern) : BRA .done %CopyDialog(Notice_Eastern) : JMP .done
+ : CMP.b #$0E : BNE + ; ...hyrule castle + : CMP.b #$0E : BNE + ; ...hyrule castle
%CopyDialog(Notice_Castle) : BRA .done %CopyDialog(Notice_Castle) : JMP .done
+ : CMP.b #$0F : BNE + ; ...sewers + : CMP.b #$0F : BNE + ; ...sewers
%CopyDialog(Notice_Sewers) %CopyDialog(Notice_Sewers)
+ +
JMP .done
.crystal
LDA.l DialogReturnPointer : DEC #2 : STA.l DialogOffsetPointer
LDA.w 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 .done
STZ $1CF0 : STZ $1CF1 ; reset decompression buffer STZ.w TextID : STZ.w TextID+1 ; reset decompression buffer
LDA.b #$01 : STA $7F5035 ; set alternate dialog flag LDA.b #$01 : STA.l AltTextFlag ; set alternate dialog flag
STA $7F509F STA.l TextBoxDefer
;-------------------------------- ;--------------------------------
.skip .skip
PLA : STA $02 PLA : STA.w ScratchBufferNV+1
REP #$20 PLA : STA.w ScratchBufferNV
PLA : STA $00 PLA : STA.b Scrap02
PLB REP #$20
PLP PLA : STA.b Scrap00
PLY : PLX : PLA PLB
;JSL.l Main_ShowTextMessage_Alt ; .skip can be here so long as this line remains commented out PLP
PLY : PLX : PLA
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
DialogResetSelectionIndex: DialogResetSelectionIndex:
JSL.l Attract_DecompressStoryGfx ; what we wrote over JSL Attract_DecompressStoryGfx ; what we wrote over
STZ $1CE8 STZ.w MessageCursor
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
DialogItemReceive: DialogItemReceive:
BCS .nomessage ; if doubling the item value overflowed it must be a rando item BCS .nomessage ; if doubling the item value overflowed it must be a rando item
CPY #$98 : BCC ++ ;if the item is $4C or greater it must be a rando item CPY.b #$98 : BCC ++ ;if the item is $4C or greater it must be a rando item
.nomessage .nomessage
LDA.w #$FFFF LDA.w #$FFFF
@@ -267,11 +247,11 @@ RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
DialogFairyThrow: DialogFairyThrow:
LDA.l Restrict_Ponds : BEQ .normal LDA.l Restrict_Ponds : BEQ .normal
LDA BottleContentsOne LDA.l BottleContentsOne
ORA BottleContentsTwo : ORA BottleContentsThree : ORA BottleContentsFour : BNE .normal ORA.l BottleContentsTwo : ORA.l BottleContentsThree : ORA.l BottleContentsFour : BNE .normal
.noInventory .noInventory
LDA $0D80, X : !ADD #$08 : STA $0D80, X LDA.w SpriteActivity, X : !ADD #$08 : STA.w SpriteActivity, X
LDA.b #$51 LDA.b #$51
LDY.b #$01 LDY.b #$01
RTL RTL
@@ -281,14 +261,14 @@ RTL
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
DialogGanon1: DialogGanon1:
JSL.l CheckGanonVulnerability JSL CheckGanonVulnerability
REP #$20 REP #$20
LDA.w #$018C LDA.w #$018C
BCC + BCC +
LDA.w #$016D LDA.w #$016D
+ STA $1CF0 + STA.w TextID
SEP #$20 SEP #$20
JSL.l Sprite_ShowMessageMinimal_Alt JSL Sprite_ShowMessageMinimal_Alt
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
; #$0192 - no bow ; #$0192 - no bow
@@ -300,44 +280,44 @@ RTL
; s = silver arrow bow ; s = silver arrow bow
; p = 2nd progressive bow ; p = 2nd progressive bow
DialogGanon2: DialogGanon2:
JSL.l CheckGanonVulnerability JSL CheckGanonVulnerability
REP #$20 REP #$20
BCS + BCS +
LDA.w #$018D : BRA ++ LDA.w #$018D : BRA ++
+ +
LDA.l BowTracking LDA.l BowTracking
BIT.w #$0080 : BNE + ; branch if bow BIT.w #$0080 : BNE + ; branch if bow
LDA.w #$0192 : BRA ++ LDA.w #$0192 : BRA ++
+ +
BIT.w #$0040 : BEQ + ; branch if no silvers BIT.w #$0040 : BEQ + ; branch if no silvers
LDA.w #$0195 : BRA ++ LDA.w #$0195 : BRA ++
+ +
BIT.w #$0020 : BNE + ; branch if p bow BIT.w #$0020 : BNE + ; branch if p bow
LDA.w #$0194 : BRA ++ LDA.w #$0194 : BRA ++
+ +
BIT.w #$0080 : BEQ + ; branch if no bow BIT.w #$0080 : BEQ + ; branch if no bow
LDA.w #$0193 : BRA ++ LDA.w #$0193 : BRA ++
+ +
LDA.w #$016E LDA.w #$016E
++ ++
STA $1CF0 STA.w TextID
SEP #$20 SEP #$20
JSL.l Sprite_ShowMessageMinimal_Alt JSL Sprite_ShowMessageMinimal_Alt
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
DialogEtherTablet: DialogEtherTablet:
PHA PHA
LDA $0202 : CMP.b #$0F : BEQ + ; Show normal text if book is not equipped LDA.w ItemCursor : CMP.b #$0F : BEQ + ; Show normal text if book is not equipped
- -
PLA : JML Sprite_ShowMessageUnconditional ; Wacky Hylian Text PLA : JML Sprite_ShowMessageUnconditional ; Wacky Hylian Text
+ +
BIT $F4 : BVC - ; Show normal text if Y is not pressed BIT.b Joy1A_New : BVC - ; Show normal text if Y is not pressed
LDA.l AllowHammerTablets : BEQ ++ LDA.l AllowHammerTablets : BEQ ++
LDA HammerEquipment : BEQ .yesText : BRA .noText LDA.l HammerEquipment : BEQ .yesText : BRA .noText
++ ++
LDA SwordEquipment : CMP.b #$FF : BEQ .yesText : CMP.b #$02 : BCS .noText LDA.l SwordEquipment : CMP.b #$FF : BEQ .yesText : CMP.b #$02 : BCS .noText
;++ ;++
.yesText .yesText
PLA PLA
@@ -351,15 +331,15 @@ RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
DialogBombosTablet: DialogBombosTablet:
PHA PHA
LDA $0202 : CMP.b #$0F : BEQ + ; Show normal text if book is not equipped LDA.w ItemCursor : CMP.b #$0F : BEQ + ; Show normal text if book is not equipped
- -
PLA : JML Sprite_ShowMessageUnconditional ; Wacky Hylian Text PLA : JML Sprite_ShowMessageUnconditional ; Wacky Hylian Text
+ +
BIT $F4 : BVC - ; Show normal text if Y is not pressed BIT.b Joy1A_New : BVC - ; Show normal text if Y is not pressed
LDA.l AllowHammerTablets : BEQ ++ LDA.l AllowHammerTablets : BEQ ++
LDA HammerEquipment : BEQ .yesText : BRA .noText LDA.l HammerEquipment : BEQ .yesText : BRA .noText
++ ++
LDA SwordEquipment : CMP.b #$FF : BEQ .yesText : CMP.b #$02 : !BGE .noText LDA.l SwordEquipment : CMP.b #$FF : BEQ .yesText : CMP.b #$02 : !BGE .noText
;++ ;++
.yesText .yesText
PLA PLA
@@ -372,7 +352,7 @@ DialogBombosTablet:
RTL RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
DialogSahasrahla: DialogSahasrahla:
LDA.l PendantsField : AND #$04 : BEQ + ;Check if player has green pendant LDA.l PendantsField : AND.b #$04 : BEQ + ;Check if player has green pendant
LDA.b #$2F LDA.b #$2F
LDY.b #$00 LDY.b #$00
JML Sprite_ShowMessageUnconditional JML Sprite_ShowMessageUnconditional
@@ -381,17 +361,17 @@ RTL
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
DialogBombShopGuy: DialogBombShopGuy:
LDY.b #$15 LDY.b #$15
LDA.l CrystalsField : AND #$05 : CMP #$05 : BNE + ;Check if player has crystals 5 & 6 LDA.l CrystalsField : AND.b #$05 : CMP.b #$05 : BNE + ;Check if player has crystals 5 & 6
INY ; from 15 to 16 INY ; from 15 to 16
+ +
TYA TYA
LDY.b #$01 LDY.b #$01
JSL.l Sprite_ShowMessageUnconditional JSL Sprite_ShowMessageUnconditional
RTL RTL
;--------------------------------------------------------------------------------------------------- ;---------------------------------------------------------------------------------------------------
AgahnimAsksAboutPed: AgahnimAsksAboutPed:
LDA.l InvincibleGanon LDA.l GanonVulnerableMode
CMP.b #$06 : BNE .vanilla CMP.b #$06 : BNE .vanilla
LDA.l OverworldEventDataWRAM+$80 ; check ped flag LDA.l OverworldEventDataWRAM+$80 ; check ped flag
@@ -399,54 +379,54 @@ AgahnimAsksAboutPed:
BNE .vanilla BNE .vanilla
LDA.b #$8C ; message 018C for no ped LDA.b #$8C ; message 018C for no ped
STA.w $1CF0 STA.w TextID
.vanilla .vanilla
JML $05FA8E ; Sprite_ShowMessageMinimal JML Sprite_ShowMessageMinimal
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
Main_ShowTextMessage_Alt: Main_ShowTextMessage_Alt:
; Are we in text mode? If so then end the routine. ; Are we in text mode? If so then end the routine.
LDA $10 : CMP.b #$0E : BEQ .already_in_text_mode LDA.b GameMode : CMP.b #$0E : BEQ .already_in_text_mode
Sprite_ShowMessageMinimal_Alt: Sprite_ShowMessageMinimal_Alt:
STZ $11 STZ.b GameSubMode
PHX : PHY PHX : PHY
PEI ($00) PEI.b (Scrap00)
LDA.b $02 : PHA LDA.b Scrap02 : PHA
LDA.b #$1C : STA.b $02 LDA.b #$1C : STA.b Scrap02
REP #$30 REP #$30
LDA.w $1CF0 : ASL : TAX LDA.w TextID : ASL : TAX
LDA.l $7F71C0, X LDA.l $7F71C0, X
STA.b $00 STA.b Scrap00
SEP #$30 SEP #$30
LDY.b #$00 LDY.b #$00
LDA [$00], Y : CMP.b #$FE : BNE + LDA.b [Scrap00], Y : CMP.b #$FE : BNE +
INY : LDA [$00], Y : CMP.b #$6E : BNE + INY : LDA.b [Scrap00], Y : CMP.b #$6E : BNE +
INY : LDA [$00], Y : : BNE + INY : LDA.b [Scrap00], Y : : BNE +
INY : LDA [$00], Y : CMP.b #$FE : BNE + INY : LDA.b [Scrap00], Y : CMP.b #$FE : BNE +
INY : LDA [$00], Y : CMP.b #$6B : BNE + INY : LDA.b [Scrap00], Y : CMP.b #$6B : BNE +
INY : LDA [$00], Y : CMP.b #$04 : BNE + INY : LDA.b [Scrap00], Y : CMP.b #$04 : BNE +
STZ $1CE8 STZ.w MessageCursor
JMP .end JMP .end
+ +
STZ $0223 ; Otherwise set it so we are in text mode. STZ.w MessageJunk ; Otherwise set it so we are in text mode.
STZ $1CD8 ; Initialize the step in the submodule STZ.w MessageSubModule
; Go to text display mode (as opposed to maps, etc) ; Go to text display mode (as opposed to maps, etc)
LDA.b #$02 : STA $11 LDA.b #$02 : STA.b GameSubMode
; Store the current module in the temporary location. ; Store the current module in the temporary location.
LDA $10 : STA $010C LDA.b GameMode : STA.w GameModeCache
; Switch the main module ($10) to text mode. ; Switch the main module ($10) to text mode.
LDA.b #$0E : STA $10 LDA.b #$0E : STA.b GameMode
.end .end
PLA : STA.b $02 PLA : STA.b Scrap02
PLA : STA.b $01 PLA : STA.b Scrap01
PLA : STA.b $00 PLA : STA.b Scrap00
PLY : PLX PLY : PLX
Main_ShowTextMessage_Alt_already_in_text_mode: Main_ShowTextMessage_Alt_already_in_text_mode:
@@ -458,15 +438,15 @@ CalculateSignIndex:
; 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. ; with major glitches.
LDA $8A : ASL A : TAY ;what we wrote over LDA.b OverworldIndex : ASL A : TAY ;what we wrote over
LDA $0712 : BEQ .done ; If a small map, we can skip these calculations. LDA.w OWScreenSize : BEQ .done ; If a small map, we can skip these calculations.
LDA $21 : AND.w #$0002 : ASL #2 : EOR $8A : AND.w #$0008 : BEQ + LDA.b LinkPosY+1 : AND.w #$0002 : ASL #2 : EOR.b OverworldIndex : AND.w #$0008 : BEQ +
TYA : !ADD.w #$0010 : TAY ;add 16 if we are in lower half of big screen. TYA : !ADD.w #$0010 : TAY ;add 16 if we are in lower half of big screen.
+ +
LDA $23 : AND.w #$0002 : LSR : EOR $8A : AND.w #$0001 : BEQ + LDA.b LinkPosX+1 : AND.w #$0002 : LSR : EOR.b OverworldIndex : AND.w #$0001 : BEQ +
TYA : INC #2 : TAY ;add 16 if we are in lower half of big screen. 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: ; ensure even if things go horribly wrong, we don't read the sign out of bounds and crash:
@@ -475,6 +455,112 @@ CalculateSignIndex:
.done .done
RTL 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 ; A0 - A9 - 0 - 9
; AA - C3 - A - Z ; AA - C3 - A - Z

View File

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

View File

@@ -13,31 +13,31 @@ pullpc
CheckKholdShellCoordinates: CheckKholdShellCoordinates:
LDA.w $0D30, X LDA.w SpritePosXHigh, X
XBA XBA
LDA.w $0D10, X ; full 16 bit X coordinate of sprite LDA.w SpritePosXLow, X ; full 16 bit X coordinate of sprite
REP #$21 REP #$21 ; carry is guaranteed clear
SBC.w #$0020 SBC.w #$0020
CMP.b $22 CMP.b LinkPosX
BCS .not_colliding BCS .not_colliding
ADC.w #$0040 ADC.w #$0040 ; carry is guaranteed clear
CMP.b $22 CMP.b LinkPosX
BCC .not_colliding BCC .not_colliding
SEP #$20 SEP #$20
LDA.w $0D20, X LDA.w SpritePosYHigh, X
XBA XBA
LDA.w $0D00, X ; full 16 bit Y coordinate of sprite LDA.w SpritePosYLow, X ; full 16 bit Y coordinate of sprite
REP #$21 REP #$21 ; carry is guaranteed clear
SBC.w #$001F ; could go to 27 and let link squeeze in at Lanmo 2 (please adjust the following one) SBC.w #$001F ; could go to 27 and still let link squeeze in
CMP.b $20 CMP.b LinkPosY
BCS .not_colliding BCS .not_colliding
ADC.w #$0037 ADC.w #$0037 ; carry is guaranteed clear
CMP.b $20 CMP.b LinkPosY
BCC .not_colliding BCC .not_colliding
SEP #$20 ; collision detected SEP #$20 ; collision detected

View File

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

View File

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

View File

@@ -67,7 +67,7 @@ jsl QuadrantLoadOrderAfterScroll
org $82895d ; Bank 02 line 1812 (JSL Dungeon_LoadRoom : JSL Dungeon_InitStarTileChr : JSL $00D6F9 : INC $B0) org $82895d ; Bank 02 line 1812 (JSL Dungeon_LoadRoom : JSL Dungeon_InitStarTileChr : JSL $00D6F9 : INC $B0)
Splicer: Splicer:
jsl GfxFixer jsl GfxFixer
lda $b1 : beq .done lda.b $b1 : beq .done
rts rts
nop #5 nop #5
.done .done
@@ -98,7 +98,7 @@ org $8ffd65 ;(PC: 07fd65)
Dungeon_LoadCustomTileAttr: Dungeon_LoadCustomTileAttr:
org $81feb0 org $81feb0
Dungeon_ApproachFixedColor: Dungeon_ApproachFixedColor:
;org $01fec1 ;org $81fec1
;Dungeon_ApproachFixedColor_variable: ;Dungeon_ApproachFixedColor_variable:
;org $a0f972 ; Rando version ;org $a0f972 ; Rando version
;LoadRoomHook: ;LoadRoomHook:
@@ -120,7 +120,7 @@ jsl MirrorCheckOverride
org $85ef47 org $85ef47
Sprite_HeartContainer_Override: ;sprite_heart_upgrades.asm : 96-100 (LDA $040C : CMP.b #$1A : BNE .not_in_ganons_tower) 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 jsl GtBossHeartCheckOverride : bcs .not_in_ganons_tower
nop : stz $0dd0, X : rts nop : stz.w SpriteAITable, X : rts
.not_in_ganons_tower .not_in_ganons_tower
@@ -136,7 +136,7 @@ jsl EGFixOnMirror
org $82b82a org $82b82a
jsl FixShopCode jsl FixShopCode
org $9ddeea ; <- Bank1D.asm : 286 (JSL Sprite_LoadProperties) org $9ddeea ; <- Bank1D.asm : 286 (JSL SpritePrep_LoadProperties)
jsl VitreousKeyReset jsl VitreousKeyReset
org $9ed024 ; f5024 sprite_guruguru_bar.asm : 27 (LDA $040C : CMP.b #$12 : INY #2 org $9ed024 ; f5024 sprite_guruguru_bar.asm : 27 (LDA $040C : CMP.b #$12 : INY #2
@@ -169,8 +169,8 @@ jsl CutoffEntranceRug : bra .nextTile : nop
org $8799de ; <- Bank07.asm : 4088 (LDA.b #$15 : STA $5D) org $8799de ; <- Bank07.asm : 4088 (LDA.b #$15 : STA $5D)
JSL StoreTempBunnyState JSL StoreTempBunnyState
; ;
org $88c450 ; <- ancilla_receive_item.asm : 146-148 (STY $5D : STZ $02D8) org $88C450 ; <- ancilla_receive_item.asm : 146-148 (STY $5D : STZ $02D8)
JSL RetrieveBunnyState : NOP JSL RetrieveBunnyState : JMP.w + : NOP : +
org $82d9ce ; <- Bank02.asm : Dungeon_LoadEntrance 10829 (STA $A0 : STA $048E) org $82d9ce ; <- Bank02.asm : Dungeon_LoadEntrance 10829 (STA $A0 : STA $048E)
JSL CheckDarkWorldSpawn : NOP JSL CheckDarkWorldSpawn : NOP
@@ -188,7 +188,7 @@ Main_ShowTextMessage:
; Conditionally disable UW music changes in Door Rando ; Conditionally disable UW music changes in Door Rando
org $828ADB ; <- Bank02.asm:2088-2095 (LDX.b #$14 : LDA $A0 ...) org $828ADB ; <- Bank02.asm:2088-2095 (LDX.b #$14 : LDA $A0 ...)
JSL.l Underworld_DoorDown_Entry : CPX #$FF JSL Underworld_DoorDown_Entry : CPX #$FF
BEQ + : db $80, $1C ; BRA $028B04 BEQ + : db $80, $1C ; BRA $028B04
NOP #6 : + NOP #6 : +
@@ -219,7 +219,7 @@ JSL AlwaysPushThroughFDoors
; Modified from OWR - will need to remove once merged ; Modified from OWR - will need to remove once merged
; org $85AF75 ; org $85AF75
; Sprite_6C_MirrorPortal: ; Sprite_6C_MirrorPortal:
; JSL FixOvalFadeOutMirror : NOP #2 ; LDA $7EF3CA : BNE $05AFDF ; JSL FixOvalFadeOutMirror : NOP #2 ; LDA $7EF3CA : BNE $85AFDF
; org $85AFDF ; org $85AFDF
; Sprite_6C_MirrorPortal_missing_mirror: ; Sprite_6C_MirrorPortal_missing_mirror:

View File

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

View File

@@ -20,10 +20,10 @@
;=================================================================================================== ;===================================================================================================
pushpc pushpc
org $01B0E6 org $81B0E6
JSL StoreDoorInfo JSL StoreDoorInfo
org $01892F org $81892F
DoorDrawJankMove: DoorDrawJankMove:
JML PrepDoorDraw JML PrepDoorDraw
@@ -33,12 +33,12 @@ DoorDrawJankMove:
; we don't want to overwrite the JMP ($000E) that's already there ; we don't want to overwrite the JMP ($000E) that's already there
; Well, we could, but we don't need to ; Well, we could, but we don't need to
warnpc $018939 warnpc $818939
org $01BF43 org $81BF43
JSL AdjustEscapeDoorCollision JSL AdjustEscapeDoorCollision
org $01C132 ; ADC.w #$0040 : TAX : LDA.b $00 org $81C132 ; ADC.w #$0040 : TAX : LDA.b $00
JSL AdjustEscapeDoorCollision_LowEntrance : NOP #2 JSL AdjustEscapeDoorCollision_LowEntrance : NOP #2
pullpc pullpc
@@ -59,18 +59,18 @@ PrepDoorDraw:
; Much easier to just tell you to look at $01890D in the disassembly ; 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 ; and you should understand the vanilla program flow we need to reject
PEA.w DoorDrawJankMove_return-1 PEA.w DoorDrawJankMove_return-1
LDA.b $00 LDA.b Scrap00
STA.w $19EE ; for current routine STA.w $19EE ; for current routine
; copy vanilla code (but fast rom) ; copy vanilla code (but fast rom)
LDA.l $8186F0,X LDA.l $8186F0,X
STA.b $0E STA.b Scrap0E
LDX.b $02 LDX.b Scrap02
LDA.b $04 LDA.b Scrap04
; and to execute the jump, we'll use the JMP ($000E) we carefully avoided overwriting ; and to execute the jump, we'll use the JMP ($000E) we carefully avoided overwriting
JML.l $818939 JML $818939
;=================================================================================================== ;===================================================================================================
@@ -106,20 +106,20 @@ AdjustEscapeDoorGraphics:
; row 1 ; row 1
LDA.w #$8838 LDA.w #$8838
STA.l $7E2000+$080,X STA.l TileMapA+$080,X
ORA.w #$4000 ; horizontally flip ORA.w #$4000 ; horizontally flip
STA.l $7E2000+$086,X STA.l TileMapA+$086,X
; row 2 ; row 2
LDA.w #$8828 LDA.w #$8828
STA.l $7E2000+$100,X STA.l TileMapA+$100,X
ORA.w #$4000 ; horizontally flip ORA.w #$4000 ; horizontally flip
STA.l $7E2000+$106,X STA.l TileMapA+$106,X
LDA.w #$8829 LDA.w #$8829
STA.l $7E2000+$102,X STA.l TileMapA+$102,X
ORA.w #$4000 ; horizontally flip ORA.w #$4000 ; horizontally flip
STA.l $7E2000+$104,X STA.l TileMapA+$104,X
JSR IdentifySwampEntrance JSR IdentifySwampEntrance
BCS .fix_swamp_entrance_alternate BCS .fix_swamp_entrance_alternate
@@ -134,26 +134,26 @@ AdjustEscapeDoorGraphics:
; row 0 ; row 0
LDA.w #$14C4 LDA.w #$14C4
STA.l $7E2000+$000,X ; sanity check = should calculate to 7e3bbc STA.l TileMapA+$000,X ; sanity check = should calculate to 7e3bbc
ORA.w #$4000 ; horizontally flip ORA.w #$4000 ; horizontally flip
STA.l $7E2000+$006,X STA.l TileMapA+$006,X
LDA.w #$14C5 LDA.w #$14C5
STA.l $7E2000+$002,X STA.l TileMapA+$002,X
ORA.w #$4000 ; horizontally flip ORA.w #$4000 ; horizontally flip
STA.l $7E2000+$004,X STA.l TileMapA+$004,X
; row 1 ; row 1
LDA.w #$14E8 LDA.w #$14E8
STA.l $7E2000+$082,X STA.l TileMapA+$082,X
ORA.w #$4000 ; horizontally flip ORA.w #$4000 ; horizontally flip
STA.l $7E2000+$084,X STA.l TileMapA+$084,X
; row 2 ; row 2
LDA.w #$14F8 LDA.w #$14F8
STA.l $7E2000+$102,X STA.l TileMapA+$102,X
ORA.w #$4000 ; horizontally flip ORA.w #$4000 ; horizontally flip
STA.l $7E2000+$104,X STA.l TileMapA+$104,X
RTL RTL
.fix_swamp_entrance .fix_swamp_entrance
@@ -162,56 +162,56 @@ AdjustEscapeDoorGraphics:
; row 1 - outer section ; row 1 - outer section
LDA.w #$0908 LDA.w #$0908
STA.l $7E2000+$080,X STA.l TileMapA+$080,X
ORA.w #$4000 ; horizontally flip ORA.w #$4000 ; horizontally flip
STA.l $7E2000+$086,X STA.l TileMapA+$086,X
; row 2 ; row 2
LDA.w #$0918 LDA.w #$0918
STA.l $7E2000+$100,X STA.l TileMapA+$100,X
ORA.w #$4000 ; horizontally flip ORA.w #$4000 ; horizontally flip
STA.l $7E2000+$106,X STA.l TileMapA+$106,X
LDA.w #$14F8 LDA.w #$14F8
STA.l $7E2000+$102,X STA.l TileMapA+$102,X
ORA.w #$4000 ; horizontally flip ORA.w #$4000 ; horizontally flip
STA.l $7E2000+$104,X STA.l TileMapA+$104,X
.fix_swamp_entrance_alternate .fix_swamp_entrance_alternate
; row 0 ; row 0
LDA.w #$9DFC LDA.w #$9DFC
STA.l $7E2000+$000,X STA.l TileMapA+$000,X
STA.l $7E2000+$002,X STA.l TileMapA+$002,X
STA.l $7E2000+$004,X STA.l TileMapA+$004,X
STA.l $7E2000+$006,X STA.l TileMapA+$006,X
; row 1 - mid section ; row 1 - mid section
LDA.w #$14E8 LDA.w #$14E8
STA.l $7E2000+$082,X STA.l TileMapA+$082,X
ORA.w #$4000 ; horizontally flip ORA.w #$4000 ; horizontally flip
STA.l $7E2000+$084,X STA.l TileMapA+$084,X
; row 3 ; row 3
LDA.w #$A82C LDA.w #$A82C
STA.l $7E2000+$180,X STA.l TileMapA+$180,X
ORA.w #$4000 ; horizontally flip ORA.w #$4000 ; horizontally flip
STA.l $7E2000+$186,X STA.l TileMapA+$186,X
LDA.w #$A82D LDA.w #$A82D
STA.l $7E2000+$182,X STA.l TileMapA+$182,X
ORA.w #$4000 ; horizontally flip ORA.w #$4000 ; horizontally flip
STA.l $7E2000+$184,X STA.l TileMapA+$184,X
RTL RTL
IdentifySancEntrance: IdentifySancEntrance:
LDA.b $A0 : CMP.w #$0012 : BNE + LDA.b RoomIndex : CMP.w #$0012 : BNE +
LDA.b $0A : CMP.w #$0010 : BNE + LDA.b Scrap0A : CMP.w #$0010 : BNE +
SEC : RTS SEC : RTS
+ CLC : RTS + CLC : RTS
IdentifySwampEntrance: IdentifySwampEntrance:
LDA.b $A0 : CMP.w #$0036 : BNE + LDA.b RoomIndex : CMP.w #$0036 : BNE +
LDA.b $0A : CMP.w #$0010 : BNE + LDA.b Scrap0A : CMP.w #$0010 : BNE +
SEC : RTS SEC : RTS
+ CLC : RTS + CLC : RTS
@@ -250,7 +250,7 @@ AdjustEscapeDoorCollisionShared:
BCS .block_entrance BCS .block_entrance
; vanilla value ; vanilla value
LDA.b $00 LDA.b Scrap00
RTL RTL
@@ -274,21 +274,21 @@ IdentifyBlockedEntrance:
LDA.l ProgressIndicator : AND.w #$00FF : CMP.w #$0002 : BCS .leave_alone ; only in rain states (0 or 1) 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 ProgressFlags : AND.w #$0004 : BNE .leave_alone ; zelda's been rescued
LDA.l BlockSanctuaryDoorInRain : BEQ + ;flagged LDA.l BlockSanctuaryDoorInRain : BEQ + ;flagged
LDA.b $A0 : CMP.w #$0012 : BNE + LDA.b RoomIndex : CMP.w #$0012 : BNE +
; we're in the sanctuary ; we're in the sanctuary
; this code could be removed because you can't reach sanc without zelda currently ; 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 ; 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.l FollowerIndicator : AND.w #$00FF : CMP.w #$0001 : BEQ .leave_alone ; zelda is following
LDA.b $0A LDA.b Scrap0A
CMP.w #$000A : BCC .leave_alone CMP.w #$000A : BCC .leave_alone
CMP.w #$0014 : BCS .leave_alone CMP.w #$0014 : BCS .leave_alone
.block_door .block_door
SEC : RTS SEC : RTS
+ LDA.l BlockCastleDoorsInRain : AND.w #$00FF : BEQ .leave_alone + LDA.l BlockCastleDoorsInRain : AND.w #$00FF : BEQ .leave_alone
LDX #$FFFE LDX.w #$FFFE
- INX #2 - INX #2
LDA.l RemoveRainDoorsRoom, X : CMP.w #$FFFF : BEQ .leave_alone LDA.l RemoveRainDoorsRoom, X : CMP.w #$FFFF : BEQ .leave_alone
CMP $A0 : BNE - CMP.b RoomIndex : BNE -
LDA.l RainDoorMatch, X LDA.l RainDoorMatch, X
CMP.w $19EE : BNE .leave_alone CMP.w $19EE : BNE .leave_alone
BRA .block_door BRA .block_door

View File

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

View File

@@ -1,80 +1,103 @@
!BlankTile = $207F
!SlashTile = $2830
!HyphenTile = $2405
!PTile = $296C
!CTile = $295F
!LTile = $2D68
!DTile = $2D60
!RedSquare = $345E
!BlueSquare = $2C5E
DrHudOverride: DrHudOverride:
{ PHB
jsl.l NewDrawHud SEP #$30
jsr HudAdditions LDA.b #$7E
rtl PHA
} PLB
HudAdditions: DRHUD_DrawItemCounter:
{ ; hides total for mystery seeds
SEP #$10 LDA.l ItemCounterHUD : BEQ DRHUD_DrawIndicators
LDA.l DRFlags : AND #$0008 : BNE + : JMP .end_item_count : + LDA.l DRFlags+1 : LSR : BCC DRHUD_DrawIndicators
LDA.l TotalItemCounter : PHA : CMP #1000 : !BLT + REP #$30
JSL HexToDec4Digit_fast LDY.w #!HyphenTile : STY.w HUDGoalIndicator+$0A : STY.w HUDGoalIndicator+$0C
LDX.b $04 : TXA : ORA.w #$2490 : STA !GOAL_DRAW_ADDRESS ; draw 1000's digit STY.w HUDGoalIndicator+$0E : STY.w HUDGoalIndicator+$10
BRA .skip SEP #$30
+ JSL HexToDec_fast
.skip
LDA #$207F : STA !GOAL_DRAW_ADDRESS+2 : STA !GOAL_DRAW_ADDRESS+4
LDA.b 1,S : CMP.w #100 : !BLT +
LDX.b $05 : TXA : ORA.w #$2490 : STA !GOAL_DRAW_ADDRESS+2 ; draw 100's digit
+ PLA : CMP.w #10 : !BLT +
LDX.b $06 : TXA : ORA.w #$2490 : STA !GOAL_DRAW_ADDRESS+4 ; draw 10's digit
+ LDX.b $07 : TXA : ORA.w #$2490 : STA !GOAL_DRAW_ADDRESS+6 ; draw 1's digit
LDA.w #$2830 : STA !GOAL_DRAW_ADDRESS+8 ; draw slash
LDA.l DRFlags : AND #$0100 : BNE +
LDA.l MultiClientFlagsWRAM+1 : CMP #1000 : !BLT .three_digit_goal
JSL HexToDec4Digit_fast
LDX.b $04 : TXA : ORA.w #$2490 : STA !GOAL_DRAW_ADDRESS+10 ; draw 1000's digit
LDX.b $05 : TXA : ORA.w #$2490 : STA !GOAL_DRAW_ADDRESS+12 ; draw 100's digit
LDX.b $06 : TXA : ORA.w #$2490 : STA !GOAL_DRAW_ADDRESS+14 ; draw 10's digit
LDX.b $07 : TXA : ORA.w #$2490 : STA !GOAL_DRAW_ADDRESS+16 ; draw 1's digit
BRA .end_item_count
.three_digit_goal
JSL HexToDec_fast
LDX.b $05 : TXA : ORA.w #$2490 : STA !GOAL_DRAW_ADDRESS+10 ; draw 100's digit
LDX.b $06 : TXA : ORA.w #$2490 : STA !GOAL_DRAW_ADDRESS+12 ; draw 10's digit
LDX.b $07 : TXA : ORA.w #$2490 : STA !GOAL_DRAW_ADDRESS+14 ; draw 1's digit
BRA .end_item_count
+ LDA.w #$2405 : STA !GOAL_DRAW_ADDRESS+10 : STA !GOAL_DRAW_ADDRESS+12
STA !GOAL_DRAW_ADDRESS+14 : STA !GOAL_DRAW_ADDRESS+16
.end_item_count
LDX $1B : BNE + ; if outdoors DRHUD_DrawIndicators:
lda.l OWMode : and.w #((!FLAG_OW_CROSSED+!FLAG_OW_MIXED)<<8)+$ff : bne ++ : rts ; Skip if vanilla ow rando LDA.b IndoorsFlag : BNE .continue
++ lda CurrentHealth : and #$00ff : beq ++ JMP OWRHUD_DrawWorldIndicator
lda CurrentWorld : and #$00ff : beq +++ .continue
lda #$2d60 : bra .owdisplay LDA.b FrameCounter : AND.b #$10 : BEQ DRHUD_EnemyDropIndicator
+++ lda #$2d68 : bra .owdisplay
++ lda #$207f
.owdisplay sta $7ec702 : rts
+ ldx $040c : cpx #$ff : bne + : rts : + ; Skip if not in dungeon
lda.l DRMode : bne + : rts : + ; Skip if not door rando
phb : phk : plb
lda CompassField : and.l $0098c0, x : beq +
lda.w CompassBossIndicator, x : and #$00ff : cmp $a0 : bne +
lda $1a : and #$0010 : beq +
lda #$345e : sta $7ec790 : bra .next
+ lda #$207f : sta $7ec790
.next lda.w DRMode : and #$0002 : bne + : plb : rts : +
lda CurrentHealth : and #$00ff : beq +
lda.w DungeonReminderTable, x : bra .reminder
+ lda #$207f
.reminder sta $7ec702
+ lda.w DRFlags : and #$0004 : beq .restore
lda MapField : and.l $0098c0, x : beq .restore
txa : lsr : tax
lda.l GenericKeys : and #$00ff : bne + DRHUD_BossIndicator:
lda DungeonCollectedKeys, x : jsr ConvertToDisplay : sta $7ec7a2 LDA.l DRMode : BNE .continue
lda #$2830 : sta $7ec7a4 .early_exit
+ REP #$10
lda.w ChestKeys, x : jsr ConvertToDisplay : sta $7ec7a6 LDY.w #!BlankTile : STY.w HUDMultiIndicator
; todo 4b0 no longer in use JMP DRHUD_Finished
.continue
LDA.w DungeonID : CMP.b #$1B : BCS .early_exit
.restore SEP #$10 ; clears the high byte of X and prevents it from getting B register
plb : rts 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.l DRFlags : BIT.w #$0800 : BEQ +
LDA.w EnemyDropIndicator : STA.w HUDMultiIndicator
+ SEP #$20
LDA.w DungeonID : CMP.b #$1B : BCS 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
REP #$20
LDA.w MapField : AND.l DungeonMask, X : BEQ DRHUD_Finished
TXA : LSR : TAX
LDA.l GenericKeys : AND.w #$00FF : BNE .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
;===================================================================================================
;column distance for BK/Smalls ;column distance for BK/Smalls
HudOffsets: HudOffsets:
@@ -92,96 +115,94 @@ dw $0000, $0000, $0000, $0000, $000a, $000a, $000a, $0014, $000a, $0014, $0000,
DrHudDungeonItemsAdditions: DrHudDungeonItemsAdditions:
{ {
jsl DrawHUDDungeonItems jsl DrawHUDDungeonItems
lda.l HUDDungeonItems : and #$ff : bne + : rtl : + lda.l HUDDungeonItems : and.b #$ff : bne + : rtl : +
lda.l DRMode : cmp #$02 : beq + : rtl : + lda.l DRMode : cmp.b #$02 : beq + : rtl : +
phx : phy : php phx : phy : php
rep #$30 rep #$30
lda.w #$24f5 : sta $1606 : sta $1610 : sta $161a : sta $1624 lda.w #$24f5 : sta.w $1606 : sta.w $1610 : sta.w $161a : sta.w $1624
sta $1644 : sta $164a : sta $1652 : sta $1662 : sta $1684 : sta $16c4 sta.w $1644 : sta.w $164a : sta.w $1652 : sta.w $1662 : sta.w $1684 : sta.w $16c4
ldx #$0000 ldx.w #$0000
- sta $1704, x : sta $170e, x : sta $1718, x - sta.w $1704, x : sta.w $170e, x : sta.w $1718, x
inx #2 : cpx #$0008 : !blt - inx #2 : cpx.w #$0008 : !blt -
lda HudFlag : and.w #$0020 : beq + : JMP ++ : + lda.l HudFlag : and.w #$0020 : beq + : JMP ++ : +
lda HUDDungeonItems : and.w #$0007 : bne + : JMP ++ : + lda.l HUDDungeonItems : and.w #$0007 : bne + : JMP ++ : +
; bk symbols ; bk symbols
lda.w #$2811 : sta $1606 : sta $1610 : sta $161a : sta $1624 lda.w #$2811 : sta.w $1606 : sta.w $1610 : sta.w $161a : sta.w $1624
; sm symbols ; sm symbols
lda.w #$2810 : sta $160a : sta $1614 : sta $161e : sta $16e4 lda.w #$2810 : sta.w $160a : sta.w $1614 : sta.w $161e : sta.w $16e4
; blank out stuff ; blank out stuff
lda.w #$24f5 : sta $1724 lda.w #$24f5 : sta.w $1724
ldx #$0002 ldx.w #$0002
- lda #$0000 : !addl RowOffsets,x : !addl ColumnOffsets, x : tay - lda.w #$0000 : !addl RowOffsets,x : !addl ColumnOffsets, x : tay
lda.l DungeonReminderTable, x : sta $1644, y : iny #2 lda.l DungeonReminderTable, x : sta.w $1644, y : iny #2
lda.w #$24f5 : sta $1644, y lda.w #$24f5 : sta.w $1644, y
lda MapField : and.l $0098c0, x : beq + ; must have map lda.l MapField : and.l DungeonMask, x : beq + ; must have map
jsr BkStatus : sta $1644, y : bra .smallKey ; big key status jsr BkStatus : sta.w $1644, y : bra .smallKey ; big key status
+ lda BigKeyField : and.l $0098c0, x : beq .smallKey + lda.l BigKeyField : and.l DungeonMask, x : beq .smallKey
lda.w #$2826 : sta $1644, y lda.w #$2826 : sta.w $1644, y
.smallKey .smallKey
+ iny #2 + iny #2
cpx #$001a : bne + cpx.w #$001a : bne +
tya : !add #$003c : tay tya : !add.w #$003c : tay
+ stx $00 + stx.b Scrap00
txa : lsr : tax txa : lsr : tax
lda.w #$24f5 : sta $1644, y lda.w #$24f5 : sta.w $1644, y
lda.l GenericKeys : and #$00FF : bne + lda.l GenericKeys : and.w #$00FF : bne +
lda.l DungeonKeys, x : and #$00FF : beq + lda.l DungeonKeys, x : and.w #$00FF : beq +
jsr ConvertToDisplay2 : sta $1644, y jsr ConvertToDisplay2 : sta.w $1644, y
+ iny #2 : lda.w #$24f5 : sta $1644, y + iny #2 : lda.w #$24f5 : sta.w $1644, y
phx : ldx $00 phx : ldx.b Scrap00
lda MapField : and.l $0098c0, x : beq + ; must have map lda.l MapField : and.l DungeonMask, x : beq + ; must have map
plx : sep #$30 : lda.l ChestKeys, x : sta $02 plx : sep #$30 : lda.l ChestKeys, x : sta.b Scrap02
lda.l GenericKeys : bne +++ lda.l GenericKeys : bne +++
lda $02 : !sub DungeonCollectedKeys, x : sta $02 lda.b Scrap02 : !sub.l DungeonCollectedKeys, x : sta.b Scrap02
+++ lda $02 +++ lda.b Scrap02
rep #$30 rep #$30
jsr ConvertToDisplay2 : sta $1644, y ; small key totals jsr ConvertToDisplay2 : sta.w $1644, y ; small key totals
bra .skipStack bra .skipStack
+ plx + plx
.skipStack iny #2 .skipStack iny #2
cpx #$000d : beq + cpx.w #$000d : beq +
lda.w #$24f5 : sta $1644, y lda.w #$24f5 : sta.w $1644, y
+ +
ldx $00 ldx.b Scrap00
+ inx #2 : cpx #$001b : bcs ++ : JMP - + inx #2 : cpx.w #$001b : bcs ++ : JMP -
++ ++
lda HudFlag : and.w #$0020 : bne + : JMP ++ : + lda.l HudFlag : and.w #$0020 : bne + : JMP ++ : +
lda HUDDungeonItems : and.w #$000c : bne + : JMP ++ : + lda.l HUDDungeonItems : and.w #$000c : bne + : JMP ++ : +
; map symbols (do I want these) ; note compass symbol is 2c20 ; map symbols (do I want these) ; note compass symbol is 2c20
lda.w #$2821 : sta $1606 : sta $1610 : sta $161a : sta $1624 lda.w #$2821 : sta.w $1606 : sta.w $1610 : sta.w $161a : sta.w $1624
; blank out a couple thing from old hud ; blank out a couple thing from old hud
lda.w #$24f5 : sta $16e4 : sta $1724 lda.w #$24f5 : sta.w $16e4 : sta.w $1724
sta $160a : sta $1614 : sta $161e ; blank out sm key indicators sta.w $160a : sta.w $1614 : sta.w $161e ; blank out sm key indicators
ldx #$0002 ldx.w #$0002
- lda #$0000 ; start of hud area - lda.w #$0000 ; start of hud area
!addl RowOffsets, x : !addl ColumnOffsets, x : tay !addl RowOffsets, x : !addl ColumnOffsets, x : tay
lda.l DungeonReminderTable, x : sta $1644, y lda.l DungeonReminderTable, x : sta.w $1644, y
iny #2 iny #2
lda.w #$24f5 : sta $1644, y ; blank out map spot lda.w #$24f5 : sta.w $1644, y ; blank out map spot
lda MapField : and.l $0098c0, x : beq + ; must have map lda.l MapField : and.l DungeonMask, x : beq + ; must have map
JSR MapIndicatorShort : STA $1644, Y JSR MapIndicatorShort : STA.w $1644, Y
+ iny #2 + iny #2
cpx #$001a : bne + cpx.w #$001a : bne +
tya : !add #$003c : tay tya : !add.w #$003c : tay
+ lda CompassField : and.l $0098c0, x : beq + ; must have compass + lda.l CompassField : and.l DungeonMask, x : beq + ; must have compass
phx ; total chest counts phx ; total chest counts
txa : lsr : tax LDA.l CompassTotalsWRAM, x : !sub.l DungeonLocationsChecked, x
sep #$30 SEP #$30 : JSR HudHexToDec2DigitCopy : REP #$30
lda.l TotalLocations, x : !sub DungeonLocationsChecked, x : JSR HudHexToDec2DigitCopy lda.b Scrap06 : jsr ConvertToDisplay2 : sta.w $1644, y : iny #2
rep #$30 lda.b Scrap07 : jsr ConvertToDisplay2 : sta.w $1644, y
lda $06 : jsr ConvertToDisplay2 : sta $1644, y : iny #2
lda $07 : jsr ConvertToDisplay2 : sta $1644, y
plx plx
bra .skipBlanks bra .skipBlanks
+ lda.w #$24f5 : sta $1644, y : iny #2 : sta $1644, y + lda.w #$24f5 : sta.w $1644, y : iny #2 : sta.w $1644, y
.skipBlanks iny #2 .skipBlanks iny #2
cpx #$001a : beq + cpx.w #$001a : beq +
lda.w #$24f5 : sta $1644, y ; blank out spot lda.w #$24f5 : sta.w $1644, y ; blank out spot
+ inx #2 : cpx #$001b : !bge ++ : JMP - + inx #2 : cpx.w #$001b : !bge ++ : JMP -
++ ++
plp : ply : plx : rtl plp : ply : plx : rtl
} }
@@ -208,72 +229,35 @@ IndicatorCharacters:
dw $2426, $2817, $2818, $2819, $281A, $281B, $281C, $281D, $2590, $258B, $259B dw $2426, $2817, $2818, $2819, $281A, $281B, $281C, $281D, $2590, $258B, $259B
MapIndicator: MapIndicator:
LDA.l CrystalPendantFlags_3, X : AND #$00FF LDA.l CrystalPendantFlags_3, X : AND.w #$00FF
PHX PHX
ASL : TAX : LDA.l IndicatorCharacters, X ASL : TAX : LDA.l IndicatorCharacters, X
PLX PLX
RTS RTS
BkStatus: BkStatus:
lda BigKeyField : and.l $0098c0, x : bne +++ ; has the bk already lda.l BigKeyField : and.l DungeonMask, x : bne +++ ; has the bk already
lda.l BigKeyStatus, x : bne ++ lda.l BigKeyStatus, x : bne ++
lda #$2827 : rts ; 0/O for no BK lda.w #$2827 : rts ; 0/O for no BK
++ cmp #$0002 : bne + ++ cmp.w #$0002 : bne +
lda #$2420 : rts ; symbol for BnC lda.w #$2420 : rts ; symbol for BnC
+ lda #$24f5 : rts ; black otherwise + lda.w #$24f5 : rts ; black otherwise
+++ lda #$2826 : rts ; check mark +++ lda.w #$2826 : rts ; check mark
ConvertToDisplay: ConvertToDisplay:
and.w #$00ff : cmp #$000a : !blt + and.w #$00ff : cmp.w #$000a : !blt +
!add #$2553 : rts !add.w #$2553 : rts
+ !add #$2490 : rts + !add.w #$2490 : rts
ConvertToDisplay2: ConvertToDisplay2:
and.w #$00ff : beq ++ and.w #$00ff : beq ++
cmp #$000a : !blt + cmp.w #$000a : !blt +
!add #$2553 : rts ; 2580 with 258A as "A" for non transparent digits !add.w #$2553 : rts ; 2580 with 258A as "A" for non transparent digits
+ !add #$2816 : rts + !add.w #$2816 : rts
++ lda #$2827 : rts ; 0/O for 0 or placeholder digit ;2483 ++ lda.w #$2827 : rts ; 0/O for 0 or placeholder digit ;2483
CountAbsorbedKeys: CountAbsorbedKeys:
jsl IncrementSmallKeysNoPrimary : phx JML IncrementSmallKeysNoPrimary
lda $040c : cmp #$ff : beq +
lsr : tax
lda DungeonAbsorbedKeys, x : inc : sta DungeonAbsorbedKeys, x
+ plx : rtl
;================================================================================
; 16-bit A, 8-bit X
; in: A(b) - Byte to Convert
; out: $04 - $07 (high - low)
;================================================================================
HudHexToDec4DigitCopy:
LDY.b #$90
-
CMP.w #1000 : !BLT +
INY
SBC.w #1000 : BRA -
+
STY $04 : LDY #$90 ; Store 1000s digit & reset Y
-
CMP.w #100 : !BLT +
INY
SBC.w #100 : BRA -
+
STY $05 : LDY #$90 ; Store 100s digit & reset Y
-
CMP.w #10 : !BLT +
INY
SBC.w #10 : BRA -
+
STY $06 : LDY #$90 ; Store 10s digit & reset Y
CMP.w #1 : !BLT +
-
INY
DEC : BNE -
+
STY $07 ; Store 1s digit
RTS
;================================================================================ ;================================================================================
; 8-bit registers ; 8-bit registers
@@ -288,12 +272,12 @@ HudHexToDec2DigitCopy: ; modified
INY INY
SBC.b #10 : BRA - SBC.b #10 : BRA -
+ +
STY $06 : LDY #$00 ; Store 10s digit and reset Y STY.b Scrap06 : LDY.b #$00 ; Store 10s digit and reset Y
CMP.b #1 : !BLT + CMP.b #1 : !BLT +
- -
INY INY
DEC : BNE - DEC : BNE -
+ +
STY $07 ; Store 1s digit STY.b Scrap07 ; Store 1s digit
PLY PLY
RTS RTS

View File

@@ -13,24 +13,24 @@ CheckIfDoorsOpen: {
jsr TrapDoorFixer ; see normal.asm jsr TrapDoorFixer ; see normal.asm
; note we are 16bit mode right now ; note we are 16bit mode right now
lda.l DRMode : beq + lda.l DRMode : beq +
lda $040c : cmp #$00ff : bne .gtg lda.w DungeonID : cmp.w #$00ff : bne .gtg
+ lda $a0 : dec : tax : and #$000f ; hijacked code + lda.b RoomIndex : dec : tax : and.w #$000f ; hijacked code
sec : rtl ; set carry to indicate normal behavior sec : rtl ; set carry to indicate normal behavior
.gtg .gtg
phb : phk : plb phb : phk : plb
stx $00 : ldy #$0000 stx.b Scrap00 : ldy.w #$0000
.nextDoor .nextDoor
lda $a0 : asl : tax lda.b RoomIndex : asl : tax
lda.w KeyDoorOffset, x : beq .skipDoor lda.w KeyDoorOffset, x : beq .skipDoor
asl : sty $05 : !add $05 : tax asl : sty.b Scrap05 : !add.b Scrap05 : tax
lda.w PairedDoorTable, x : beq .skipDoor lda.w PairedDoorTable, x : beq .skipDoor
sta $02 : and #$00ff : asl a : tax sta.b Scrap02 : and.w #$00ff : asl a : tax
lda $02 : and #$ff00 : sta $03 lda.b Scrap02 : and.w #$ff00 : sta.b Scrap03
lda RoomDataWRAM.l, X : and #$f000 : and $03 : beq .skipDoor lda RoomDataWRAM.l, X : and.w #$f000 : and.b Scrap03 : beq .skipDoor
tyx : lda $068c : ora $0098c0,x : sta $068c tyx : lda.w $068c : ora.l DungeonMask,x : sta.w $068c
.skipDoor .skipDoor
iny #2 : cpy $00 : bne .nextDoor iny #2 : cpy.b Scrap00 : bne .nextDoor
plb : clc : rtl 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 ;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: MultiplyByY:
.loop cpy #$0001 : beq .done .loop cpy.w #$0001 : beq .done
cpy #$0003 : bne ++ cpy.w #$0003 : bne ++
jsr MultiBy3 : bra .done jsr MultiBy3 : bra .done
++ cpy #$0005 : bne ++ ++ cpy.w #$0005 : bne ++
jsr MultiBy5 : bra .done jsr MultiBy5 : bra .done
++ asl : sta $00 : tya : lsr : tay : lda $00 : bra .loop ++ asl : sta.b Scrap00 : tya : lsr : tay : lda.b Scrap00 : bra .loop
.done rts .done rts
;Divisor in Y. Width of division is in X for rounding toward middle ;Divisor in Y. Width of division is in X for rounding toward middle
DivideByY: DivideByY:
.loop .loop
cpy #$0000 : beq .done cpy.w #$0000 : beq .done
cpy #$0001 : beq .done cpy.w #$0001 : beq .done
cpy #$0003 : bne ++ cpy.w #$0003 : bne ++
jsr DivideBy3 : bra .done jsr DivideBy3 : bra .done
++ cpy #$0005 : bne ++ ++ cpy.w #$0005 : bne ++
jsr DivideBy5 : bra .done jsr DivideBy5 : bra .done
++ jsr DivideBy2 : sta $00 ++ jsr DivideBy2 : sta.b Scrap00
tya : lsr : tay tya : lsr : tay
txa : lsr : tax txa : lsr : tax
lda $00 : bra .loop lda.b Scrap00 : bra .loop
.done rts .done rts
MultiBy3: MultiBy3:
sta $00 : asl : !add $00 sta.b Scrap00 : asl : !add.b Scrap00
rts rts
MultiBy5: MultiBy5:
sta $00 : asl #2 : !add $00 sta.b Scrap00 : asl #2 : !add.b Scrap00
rts rts
;width of divison in x: rounds toward X/2 ;width of divison in x: rounds toward X/2
DivideBy2: DivideBy2:
sta $00 sta.b Scrap00
lsr : bcc .done lsr : bcc .done
sta $02 : txa : lsr : cmp $00 : !blt + sta.b Scrap02 : txa : lsr : cmp.b Scrap00 : !blt +
lda $02 : inc : bra .done lda.b Scrap02 : inc : bra .done
+ lda $02 + lda.b Scrap02
.done rts .done rts
DivideBy3: DivideBy3:
sta $00 sta.b Scrap00
ldx #$0000 ldx.w #$0000
lda #$0002 lda.w #$0002
.loop cmp $00 : !bge .store .loop cmp.b Scrap00 : !bge .store
inx : !add #$0003 : bra .loop inx : !add.w #$0003 : bra .loop
.store txa .store txa
rts rts
DivideBy5: DivideBy5:
sta $00 sta.b Scrap00
ldx #$0000 ldx.w #$0000
lda #$0003 lda.w #$0003
.loop cmp $00 : !bge .store .loop cmp.b Scrap00 : !bge .store
inx : !add #$0005 : bra .loop inx : !add.w #$0005 : bra .loop
.store txa .store txa
rts rts

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,9 +1,325 @@
;================================================================================ ;================================================================================
; Dungeon & Boss Drop Fixes ; Dungeon & Boss Drop Fixes
;-------------------------------------------------------------------------------- ;--------------------------------------------------------------------------------
DropSafeDungeon: SpawnDungeonPrize:
LDA $040C : CMP #$08 : BEQ + PHX : PHB
LDA $01C6FC, X : JML Sprite_SpawnFallingItem JSL AttemptItemSubstitution
+ JSL ResolveLootIDLong
STA.w ItemReceiptID
TAX
LDA.b #$29 : LDY.b #$06
JSL AddAncillaLong
BCS .failed_spawn
LDA.w ItemReceiptID
STA.w AncillaGet,X : STA.w SpriteID,X
JSR AddDungeonPrizeAncilla
.failed_spawn
PLB : PLX
RTL 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
LDA.w AncillaGet, X
JSL AttemptItemSubstitution
JSL ResolveLootIDLong
STA.w SpriteID,X
JSL TransferItemReceiptToBuffer_using_ReceiptID
PLY : PLX : PLA
RTL
SetItemPose:
PHA
LDA.w DungeonID : BMI .one_handed
LDA.w RoomItemsTaken : BIT.b #$80 : BNE +
.one_handed
PLA
JML 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 #$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 #$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 #$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 #$80 : BNE .prize
.no_prize
STZ.w ItemReceiptID
STZ.w ItemReceiptPose
PLA
RTL
.prize
STZ.w ItemReceiptPose
PLA
RTL
CheckSpawnPrize:
; In: A - DungeonID
; Out: c - Spawn prize if set
REP #$20
LDX.w DungeonID
LDA.l DungeonItemMasks,X : AND.l DungeonsCompleted : BEQ .spawn
SEP #$20
CLC
RTL
.spawn
SEP #$21
RTL
CheckDungeonCompletion:
LDX.w DungeonID
REP #$20
LDA.l DungeonItemMasks,X : AND.l DungeonsCompleted
SEP #$20
RTL
PendantMusicCheck:
; In: A - Item receipt ID
PHX
TAY
LDA.w ItemReceiptMethod : CMP.b #$03 : BNE .dont_wait
TYA
REP #$30
AND.w #$00FF : ASL : TAX
LDA.l InventoryTable_properties,X : BIT.w #$0080 : BNE .dont_wait
SEP #$31
PLX
RTL
.dont_wait
SEP #$30
PLX
CLC
RTL
PrepPrizeOAMCoordinates:
PHX : PHY
LDY.w AncillaLayer,X
LDA.w $F67F,Y : STA.b $65
STZ.b $64
LDA.w AncillaCoordYLow,X : STA.b Scrap00
LDA.w AncillaCoordYHigh,X : STA.b Scrap01
LDA.w AncillaCoordXLow,X : STA.b Scrap02
LDA.w AncillaCoordXHigh,X : STA.b Scrap03
REP #$20
LDA.b Scrap00
SEC : SBC.w $0122
STA.b Scrap00
LDA.b Scrap02
SEC : SBC.w $011E
STA.b Scrap02
STA.b Scrap04
REP #$20
LDA.w AncillaZCoord,X
AND.w #$00FF
STA.b ScrapBuffer72
LDA.b Scrap00
STA.b Scrap06
SEC
SBC.b ScrapBuffer72
STA.b Scrap00
SEP #$20
TXY
LDA.w AncillaGet,X : TAX
LDA.l SpriteProperties_chest_width,X : BNE .wide
TYX
LDA.w AncillaID,X : CMP.b #$3E : BEQ .rising_crystal
REP #$20
LDA.b Scrap00
CLC : ADC.w #$0008
STA.b Scrap08
LDA.b Scrap02
CLC : ADC.w #$0004
STA.b Scrap02 : STA.b Scrap0A
BRA .wide
.rising_crystal
REP #$20
LDA.b Scrap00
CLC : ADC.w #$0008 : STA.b Scrap08
LDA.b Scrap02 : STA.b Scrap0A
.wide
SEP #$20
PLY : PLX
RTL
PrepPrizeShadow:
PHX
LDA.w ItemReceiptID : TAX
LDA.l SpriteProperties_standing_width,X : BNE .wide
LDA.b Scrap02
SEC : SBC.b #$04
STA.b Scrap02
.wide
LDA.b #$20 : STA.b Scrap04 ; What we wrote over
PLX
RTL
CheckPoseItemCoordinates:
PHX
LDA.w ItemReceiptPose : BEQ .done
BIT.b #$02 : BEQ .done
LDA.w AncillaGet,X : TAX
LDA.l SpriteProperties_chest_width,X : BNE .done
LDA.b Scrap02
CLC : ADC.b #$04
STA.b Scrap02
.done
PLX
LDA.w AncillaGet,X
TAX
RTL
CrystalOrPendantBehavior:
; Out: c - Crystal Behavior if set, pendant if unset
PHA : PHX
LDA.w AncillaGet,X
REP #$31
AND.w #$00FF : ASL : TAX
LDA.l InventoryTable_properties,X : BIT.w #$0080 : BNE .crystal_behavior
SEP #$30
PLX : PLA
RTS
.crystal_behavior
SEP #$31
PLX : PLA
RTS
CheckDungeonWorld:
; Maintain vanilla door opening behavior with dungeon prizes
TXA : CMP.b #$05 : BCS .dark_world
REP #$02
RTL
.dark_world
SEP #$02
RTL
SetDungeonCompleted:
LDX.w DungeonID : BMI +
REP #$20
LDA.l DungeonItemMasks, X : ORA.l DungeonsCompleted : STA.l DungeonsCompleted
SEP #$20
+
RTS

View File

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

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