@gaialabs/iog-baserom 0.2.7 → 0.2.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (135) hide show
  1. package/baserom/auto-use-items/CellKeysAutoUse.patch.asm +30 -0
  2. package/baserom/auto-use-items/CrystalBallAutoUse.patch.asm +131 -0
  3. package/baserom/auto-use-items/DiamondBlockAutoUse.patch.asm +50 -0
  4. package/baserom/auto-use-items/ElevatorKeyAutoUse.patch.asm +26 -0
  5. package/baserom/auto-use-items/GorgonFlowerAutoUse.patch.asm +153 -0
  6. package/baserom/auto-use-items/HieroglyphPuzzle.patch.asm +1187 -0
  7. package/baserom/auto-use-items/HopeStatueAutoUse.patch.asm +99 -0
  8. package/baserom/auto-use-items/IncanStatueAutoUse.patch.asm +75 -0
  9. package/baserom/auto-use-items/ItemUseStub.patch.asm +24 -0
  10. package/baserom/auto-use-items/MagicPowerAutoUse.patch.asm +55 -0
  11. package/baserom/auto-use-items/MeatAutoUse.patch.asm +33 -0
  12. package/baserom/auto-use-items/MushroomDropAutoUse.patch.asm +100 -0
  13. package/baserom/auto-use-items/PalaceKeyAutoUse.patch.asm +52 -0
  14. package/baserom/auto-use-items/PrisonKeyAutoUse.patch.asm +84 -0
  15. package/baserom/auto-use-items/PurificationStoneAutoUse.patch.asm +49 -0
  16. package/baserom/auto-use-items/RamaStatueAutoUse.patch.asm +100 -0
  17. package/baserom/auto-use-items/TearpotAutoUse.patch.asm +41 -0
  18. package/baserom/{spritemaps → boot-logo}/spm_boot_logos.sprite.asm +10 -0
  19. package/baserom/collectible-system/RelicMenu.patch.asm +250 -0
  20. package/baserom/collectible-system/key_item_core.asm +445 -0
  21. package/baserom/{patches → equipped-icon}/EquippedIcon.patch.asm +41 -24
  22. package/baserom/equipped-icon/ItemSwapping.patch.asm +99 -0
  23. package/baserom/{palettes → equipped-icon}/pal_item_exprite2.pal +0 -0
  24. package/baserom/{spritemaps → equipped-icon}/spm_sc02_main_characters.sprite.asm +10 -0
  25. package/baserom/equipped-icon/spriteset_aura.asm +131 -0
  26. package/baserom/equipped-icon/spriteset_dark_friar.asm +277 -0
  27. package/baserom/equipped-icon/spriteset_darkgaia_projectile.asm +233 -0
  28. package/baserom/fixes-tweaks/BCDHex.patch.asm +60 -0
  29. package/baserom/fixes-tweaks/HudRedesign.patch.asm +108 -0
  30. package/baserom/fixes-tweaks/NeilsFatherFix.patch.asm +26 -0
  31. package/baserom/fixes-tweaks/PyramidPortalExit.patch.asm +41 -0
  32. package/baserom/fixes-tweaks/SceneTitles.patch.asm +84 -0
  33. package/baserom/fixes-tweaks/ThankfulFlower.patch.asm +28 -0
  34. package/baserom/fixes-tweaks/Utils.patch.asm +111 -0
  35. package/baserom/{spritemaps → fixes-tweaks}/spm_goldship_sprites.sprite.asm +11 -0
  36. package/baserom/fonts/EnhancedOverworldText.patch.asm +44 -0
  37. package/baserom/fonts/EnhancedPrologueText.patch.asm +252 -0
  38. package/baserom/{graphics → fonts}/gfx_fonts.bin +0 -0
  39. package/baserom/fonts/gfx_overworld_font.bin +0 -0
  40. package/baserom/inventory/EnhancedSlotActor.patch.asm +50 -0
  41. package/baserom/inventory/InventoryCounters.patch.asm +407 -0
  42. package/baserom/inventory/InventoryManagement.patch.asm +390 -0
  43. package/baserom/kara-run/gfx_castle_sprites.bin +0 -0
  44. package/baserom/new-game-plus/NGPEpilogueSwitch.patch.asm +52 -0
  45. package/baserom/{patches → new-game-plus}/NewGamePlus.patch.asm +42 -23
  46. package/baserom/oakton/map_fr30.map +0 -0
  47. package/baserom/oakton/map_fr30_effect.map +0 -0
  48. package/baserom/options-menu/EnhancedInvItemPicker.patch.asm +130 -0
  49. package/baserom/options-menu/MinimalHudOption.patch.asm +109 -0
  50. package/baserom/options-menu/OptionsMenu.patch.asm +218 -0
  51. package/baserom/options-menu/TextSpeedOption.patch.asm +108 -0
  52. package/baserom/options-menu/options_input_remap.asm +373 -0
  53. package/baserom/options-menu/options_menu_core.asm +1221 -0
  54. package/baserom/patches/APUWaitFixes.patch.asm +30 -17
  55. package/baserom/patches/AccentMap.patch.asm +16 -5
  56. package/baserom/patches/MusicTransitions.patch.asm +41 -24
  57. package/baserom/player-input/MergeInputFlags.patch.asm +146 -0
  58. package/baserom/player-input/PlayerInput.patch.asm +51 -0
  59. package/baserom/red-jewels/AnnSparkle.patch.asm +28 -0
  60. package/baserom/red-jewels/ChestFlaggedHiddenRedJewel.patch.asm +50 -0
  61. package/baserom/red-jewels/FishermanRedJewel.patch.asm +55 -0
  62. package/baserom/red-jewels/LanceSparkle.patch.asm +38 -0
  63. package/baserom/red-jewels/RedJewelSparkle.patch.asm +49 -0
  64. package/baserom/red-jewels/SnakePanicSparkle.patch.asm +45 -0
  65. package/baserom/red-jewels/SparkleAlways.patch.asm.example +19 -0
  66. package/baserom/red-jewels/StoneGirlSparkle.patch.asm +26 -0
  67. package/baserom/red-jewels/TrappedSlaveSparkle.patch.asm +63 -0
  68. package/baserom/red-jewels/generic_sparkle.asm +57 -0
  69. package/baserom/run-button/RunButtonCore.patch.asm +89 -0
  70. package/baserom/run-button/RunButtonOption.patch.asm +50 -0
  71. package/baserom/{patches/BitmapPatch.patch.asm → scene-load/BitmapLoad.patch.asm} +27 -12
  72. package/baserom/scene-load/Cop51Decompress.patch.asm +98 -0
  73. package/baserom/scene-load/ExpriteLoader.patch.asm +82 -0
  74. package/baserom/scene-load/MapNameLookup.patch.asm +27 -0
  75. package/baserom/scene-load/MenuBGLoad.patch.asm +70 -0
  76. package/baserom/scene-load/SFXTable.patch.asm +92 -0
  77. package/baserom/scene-load/SceneMetaLoad.patch.asm +68 -0
  78. package/baserom/scene-load/SpritemapLoad.patch.asm +61 -0
  79. package/baserom/scene-load/TilemapLoad.patch.asm +109 -0
  80. package/baserom/scene-load/TilesetLoad.patch.asm +41 -0
  81. package/baserom/set_overworld.set +0 -0
  82. package/baserom/seths-jewel/SethsJewelGoldShip.patch.asm +22 -0
  83. package/baserom/seths-jewel/SethsJewelIcon.patch.asm +22 -0
  84. package/baserom/seths-jewel/SethsJewelItem.patch.asm +62 -0
  85. package/baserom/seths-jewel/SethsJewelSprites.patch.asm +49 -0
  86. package/baserom/{patches → sky-delivery}/SouthCapeDeliveryman.patch.asm +12 -3
  87. package/baserom/sky-delivery/WatermiaDeliveryman.patch.asm +15 -0
  88. package/dist/index.cjs +10159 -964
  89. package/dist/index.cjs.map +1 -1
  90. package/dist/index.d.cts +9 -1
  91. package/dist/index.d.cts.map +1 -1
  92. package/dist/index.d.mts +9 -1
  93. package/dist/index.d.mts.map +1 -1
  94. package/dist/index.mjs +10161 -967
  95. package/dist/index.mjs.map +1 -1
  96. package/package.json +10 -8
  97. package/baserom/asm/spriteset_aura.asm +0 -122
  98. package/baserom/asm/spriteset_dark_friar.asm +0 -268
  99. package/baserom/asm/spriteset_will_projectile.asm +0 -224
  100. package/baserom/patches/Cop51Patch.patch.asm +0 -81
  101. package/baserom/patches/DPShop.asm.old +0 -328
  102. package/baserom/patches/DeathWarp.asm.old +0 -174
  103. package/baserom/patches/ExpandedHealthBars.old +0 -203
  104. package/baserom/patches/ExpriteLoader.patch.asm +0 -66
  105. package/baserom/patches/GemShop.asm.old +0 -345
  106. package/baserom/patches/InventoryCounters.patch.asm +0 -292
  107. package/baserom/patches/InventoryManagement.patch.asm +0 -324
  108. package/baserom/patches/InventoryScript.asm.old +0 -319
  109. package/baserom/patches/ItemDictionary.asm.old +0 -86
  110. package/baserom/patches/ItemRewards.asm.old +0 -49
  111. package/baserom/patches/ItemSwapping.patch.asm +0 -80
  112. package/baserom/patches/MapNameLookup.patch.asm +0 -13
  113. package/baserom/patches/MenuBGPatch.patch.asm +0 -54
  114. package/baserom/patches/NGPEpilogueSwitch.patch.asm +0 -44
  115. package/baserom/patches/PixelConverter.patch.asm.old +0 -60
  116. package/baserom/patches/QuickScripts.asm.old +0 -210
  117. package/baserom/patches/RunButton.patch.asm +0 -79
  118. package/baserom/patches/SFXTable.patch.asm +0 -73
  119. package/baserom/patches/SceneLoadPatch.patch.asm +0 -52
  120. package/baserom/patches/SpritemapPatch.patch.asm +0 -45
  121. package/baserom/patches/Teleporter.patch.asm.old +0 -203
  122. package/baserom/patches/TilemapPatch.patch.asm +0 -94
  123. package/baserom/patches/TilesetPatch.patch.asm +0 -27
  124. package/baserom/patches/Utils.patch.asm +0 -414
  125. package/baserom/patches/WatermiaDeliveryman.patch.asm +0 -2
  126. /package/baserom/{graphics → boot-logo}/gfx_boot_exprite.raw.bin +0 -0
  127. /package/baserom/{graphics → boot-logo}/gfx_boot_logos.bin +0 -0
  128. /package/baserom/{palettes → boot-logo}/pal_boot_logos.pal +0 -0
  129. /package/baserom/{palettes → equipped-icon}/fx_palette_198000.pal +0 -0
  130. /package/baserom/{graphics → equipped-icon}/gfx_item_exprite.raw.bin +0 -0
  131. /package/baserom/{graphics → equipped-icon}/misc_fx_1CD580.bin +0 -0
  132. /package/baserom/{palettes → equipped-icon}/pal_item_exprite.pal +0 -0
  133. /package/baserom/{palettes → equipped-icon}/pal_sc02_main_characters.pal +0 -0
  134. /package/baserom/{graphics → fonts}/gfx_credits_font.bin +0 -0
  135. /package/baserom/{graphics → inventory}/gfx_inventory_sprites.bin +0 -0
@@ -0,0 +1,98 @@
1
+ ; ==============================================================================
2
+ ; COP #51 Decompress - raw copy and negative-size MVN paths
3
+ ; ==============================================================================
4
+ ; What it does: After reading source/dest operands, interprets the 2-byte size
5
+ ; header: zero triggers a $2000-byte MVN from ROM to WRAM; negative size uses
6
+ ; SEC SBC on the header then MVN (uncompressed byte count); positive still
7
+ ; runs QuintetLzDecompress then ClearActorRenderList.
8
+ ; Vanilla behavior: Always treated the header as LZ decompressed byte count,
9
+ ; skipped 2 bytes, and called QuintetLzDecompress only (no MVN fast path).
10
+ ; Hooks (overrides): cop_handlers_vram.Decompress (COP 51 handler; include name
11
+ ; cop_handlers_map is a legacy block key).
12
+ ; Depends on: ?INCLUDE cop_handlers_map; MVN stub at $0402; QuintetLzDecompress;
13
+ ; ClearActorRenderList.
14
+ ; State: COP operand pointer at stack $0A; SPTR $3E/$40, DCMP_SIZE $78, dest $7A.
15
+ ; Hazards/notes: Bank $00; PHD/PLD around handler; TCD zeros DP before work;
16
+ ; RTI restores X from Y (vanilla pattern).
17
+ ; ==============================================================================
18
+ ?BANK 00
19
+
20
+ ?INCLUDE 'cop_handlers_map'
21
+
22
+ !SPTR $3E
23
+ !DCMP_SIZE $78
24
+
25
+ --------------------------------------------
26
+
27
+ cop_handlers_vram.Decompress!:
28
+ PHY
29
+ PHD
30
+ LDA [$0A]
31
+ INC $0A
32
+ INC $0A
33
+ STA $003E
34
+ LDA [$0A]
35
+ INC $0A
36
+ AND #$00FF
37
+ SEP #$20
38
+ STA $0040
39
+ REP #$20
40
+ LDA [$0A]
41
+ INC $0A
42
+ INC $0A
43
+ STA $007A
44
+ LDA [$0A]
45
+ INC $0A
46
+ AND #$00FF
47
+ LDA #$0000
48
+ TCD
49
+
50
+ cop51_main:
51
+ LDA [SPTR]
52
+ BMI cop51_minus
53
+ BEQ cop51_zero
54
+ STA DCMP_SIZE
55
+ INC SPTR
56
+ INC SPTR
57
+ JSL $@QuintetLzDecompress
58
+ JSL $@ClearActorRenderList
59
+ BRA cop51_end
60
+
61
+ cop51_zero:
62
+ LDA #$2000
63
+ BRA cop51_domvn
64
+
65
+ cop51_minus:
66
+ LDA #$0000
67
+ SEC
68
+ SBC [SPTR]
69
+
70
+ cop51_domvn:
71
+ INC SPTR
72
+ INC SPTR
73
+
74
+ SEC
75
+ SBC #$0001
76
+ PHA
77
+
78
+ SEP #$20
79
+ LDA #$7E
80
+ STA $0404
81
+ LDA SPTR+2
82
+ STA $0405
83
+ REP #$20
84
+
85
+ LDX SPTR
86
+ LDY $7A
87
+
88
+ PLA
89
+ JSR $0402
90
+
91
+ cop51_end:
92
+ PLD
93
+ PLY
94
+ TYX
95
+ LDA $0A
96
+ STA $02, S
97
+ RTI
98
+
@@ -0,0 +1,82 @@
1
+ ; ==============================================================================
2
+ ; LoadPlayerGraphics - boot/continue exprite and extra skip scenes
3
+ ; ==============================================================================
4
+ ; What it does: Skips default player CHR upload for more scene ids; scene $FB
5
+ ; loads gfx_boot_exprite to VRAM $4200 via load_boot_exprite; scene $FA uses
6
+ ; load_continue (same VRAM target, caller-supplied source in X/A).
7
+ ; Vanilla behavior: Only $F7, $FE, $8C skipped entirely; always DMA gfx_000000
8
+ ; to $4200; combat-lock bit $08 on playerFlags chose misc_fx at $4400, else
9
+ ; scene $E8 used boss projectile tiles at $4400.
10
+ ; Hooks (overrides): scene_lifecycle.LoadPlayerGraphics.
11
+ ; Adds: load_boot_exprite, load_continue (JML/JSL targets; X/A = source, Y = size).
12
+ ; Depends on: ?INCLUDE scene_script, chunk_03BAE1; DmaWordToVram; labels
13
+ ; gfx_boot_exprite, gfx_000000, misc_fx_1CD580.
14
+ ; State: sceneCurrent $0644; playerFlags $09AE bit $08; VMADDL $2116.
15
+ ; Hazards/notes: load_exit/load_fb_asset are plain in-patch labels; patch removes
16
+ ; vanilla $E8 boss FX branch present in extracted scene_lifecycle.asm.
17
+ ; ==============================================================================
18
+
19
+ !scene_current 0644
20
+ !player_flags 09AE
21
+ !VMADDL 2116
22
+
23
+ load_boot_exprite:
24
+ LDX #$&gfx_boot_exprite
25
+ LDA #$^gfx_boot_exprite
26
+
27
+ load_continue:
28
+ LDY #$4200
29
+ STY $VMADDL
30
+ LDY #$1C00
31
+ JSL $@DmaWordToVram
32
+ PLP
33
+ RTL
34
+
35
+ ------------------------------------------------
36
+ ?INCLUDE 'scene_script'
37
+ ?INCLUDE 'chunk_03BAE1'
38
+ ------------------------------------------------
39
+
40
+ scene_lifecycle.LoadPlayerGraphics! {
41
+ PHP
42
+ LDA $scene_current
43
+ CMP #$F7
44
+ BEQ load_exit
45
+ CMP #$FB
46
+ BEQ load_fb_asset
47
+ CMP #$FA
48
+ BEQ load_exit
49
+ CMP #$FE
50
+ BEQ load_exit
51
+ CMP #$F0
52
+ BEQ load_exit
53
+ CMP #$90
54
+ BEQ load_exit
55
+ CMP #$8C
56
+ BEQ load_exit
57
+ CMP #$89
58
+ BEQ load_exit
59
+ LDX #$4200
60
+ STX $VMADDL
61
+ LDX #$&gfx_000000
62
+ LDA #$^gfx_000000
63
+ LDY #$1C00
64
+ JSL $@DmaWordToVram
65
+ LDA $player_flags
66
+ BIT #$08
67
+ BEQ loc_03E035
68
+ LDX #$4400
69
+ STX $VMADDL
70
+ LDX #$&misc_fx_1CD580
71
+ LDA #$^misc_fx_1CD580
72
+ LDY #$0800
73
+ JSL $@DmaWordToVram
74
+ BRA loc_03E04E
75
+
76
+ load_fb_asset:
77
+ JML load_boot_exprite
78
+
79
+ load_exit:
80
+ PLP
81
+ RTL
82
+ }
@@ -0,0 +1,27 @@
1
+ ; ==============================================================================
2
+ ; SpawnSceneActors epilogue - scene title pointer for name display
3
+ ; ==============================================================================
4
+ ; What it does: At the end of scene actor spawning, loads a pointer from
5
+ ; scene_actors_extract_table indexed by sceneCurrent ($0646) into $3E, then
6
+ ; still sets playerActorDp ($09F4) to $1000 before return.
7
+ ; Vanilla behavior: loc_03CEEC only stored $1000 to $09F4 and returned; $3E
8
+ ; was left on the actor list $FF terminator (title followed in ROM layout).
9
+ ; Hooks (overrides): actor_execution.loc_03CEEC (SpawnSceneActors exit).
10
+ ; Depends on: scene_actors.scene_actors_extract_table (extracted title pointer
11
+ ; table, parallel to scene id index).
12
+ ; State: Reads sceneCurrent $0646; writes scene data pointer $3E, playerActorDp
13
+ ; $09F4; DEC adjusts table entry to title string address.
14
+ ; Hazards/notes: No ?BANK in file (patch targets bank $00 actor_execution);
15
+ ; table must match post-Extract scene_actors layout.
16
+ ; ==============================================================================
17
+
18
+
19
+ actor_execution.loc_03CEEC!:
20
+ LDX $0646
21
+ LDA $@scene_actors_extract_table, X
22
+ DEC
23
+ STA $3E
24
+ LDA #$1000
25
+ STA $09F4
26
+ PLP
27
+ RTL
@@ -0,0 +1,70 @@
1
+ ; ==============================================================================
2
+ ; Scene char-tile load (opcode $17) - uncompressed menu/BG CHR
3
+ ; ==============================================================================
4
+ ; What it does: After reading the compressed-data pointer, treats $0000 or a
5
+ ; negative size word as uncompressed ROM data (skip QuintetLzDecompress) before
6
+ ; the existing VRAM targeting logic in SceneCmd_LoadCharTiles continues.
7
+ ; Vanilla behavior: Only a null pointer ($0000) skipped LZ; any other non-zero size
8
+ ; header triggered QuintetLzDecompress to $7E:7000.
9
+ ; Hooks (overrides): scene_script.SceneCmd_LoadCharTiles (pointer/size gate),
10
+ ; loc_028C81 (uncompressed entry aligns stream pointer).
11
+ ; Depends on: ?INCLUDE scene_script; LoadScriptPointer, Multiply8x8Unsigned,
12
+ ; QuintetLzDecompress, downstream loc_028C87 VRAM DMA path (vanilla).
13
+ ; State: gfxLayerFlags $066A from script; transfer size $0666; source $3E/$40;
14
+ ; decompress dest $7E:7000 when compression is used.
15
+ ; Hazards/notes: Bank $02; handler saves P via PHP at entry (vanilla).
16
+ ; ==============================================================================
17
+ ?BANK 02
18
+
19
+ ?INCLUDE 'scene_script'
20
+
21
+ !SPTR $3E
22
+
23
+ -----------------------------------------------------
24
+
25
+ scene_script.SceneCmd_LoadCharTiles! {
26
+ PHP
27
+ JSR $&ReadScriptByte
28
+ STA $066A
29
+ LDX #$003E
30
+ JSR $&LoadScriptPointer
31
+ REP #$20
32
+ LDA [$3E]
33
+ STA $00
34
+ INC $3E
35
+ INC $3E
36
+ LDA [$3E]
37
+ XBA
38
+ ORA $00
39
+ INC $3E
40
+ INC $3E
41
+ SEP #$20
42
+ JSL $@Multiply8x8Unsigned
43
+ REP #$20
44
+ STA $00
45
+ XBA
46
+ ASL
47
+ ASL
48
+ ASL
49
+ STA $0666
50
+ LDA [$3E]
51
+ INC $3E
52
+ INC $3E
53
+ CMP #$0000
54
+ BEQ loc_028C81
55
+ BMI loc_028C81
56
+ STA $78
57
+ SEP #$20
58
+ LDX #$7000
59
+ STX $7A
60
+ JSL $@QuintetLzDecompress
61
+ LDX #$7000
62
+ STX $3E
63
+ LDA #$7E
64
+ STA $40
65
+ BRA loc_028C87
66
+ }
67
+
68
+ scene_script.loc_028C81! {
69
+ SEP #$20
70
+ }
@@ -0,0 +1,92 @@
1
+ ; ==============================================================================
2
+ ; SPC sample chunk lookup - relocated SFX pointer table (bank $02)
3
+ ; ==============================================================================
4
+ ; What it does: Replaces the vanilla C5:0000 sample library walk with a direct
5
+ ; index into sfx_table (60 entries, 3 bytes each: size + bank) in this bank;
6
+ ; chunk payload reads use SAMPLE_PTR instead of the library base $4A/$4C.
7
+ ; Vanilla behavior: SpcNextChunkIndex reset $4A to $C5:0000 and SpcFindChunk
8
+ ; skipped variable-size chunks in ROM until the stream index matched; data
9
+ ; loop used [$4A],Y with bank byte $4C.
10
+ ; Hooks (overrides): spc_transfer.SpcNextChunkIndex, SpcFindChunk,
11
+ ; SpcSendChunkData, loc_02912C (byte loop read path).
12
+ ; Adds: sfx_table and sfx00-sfx3B labels (long pointers to sample blobs).
13
+ ; Depends on: ?INCLUDE chunk_028000 (SPC transfer engine in bank $02);
14
+ ; SpcSendHeader, SpcChunkDone (unchanged).
15
+ ; State: Stream index Y in $32; chunk index $2A; dest accumulator $2E/$2C;
16
+ ; handshake counter $30; sample pointer $4A (repurposed).
17
+ ; Hazards/notes: Bank $02 table must stay LoROM-mapped; chunk index byte bit $80
18
+ ; still marks empty slots (same as vanilla).
19
+ ; ==============================================================================
20
+ ?BANK 02
21
+
22
+ ?INCLUDE 'chunk_028000'
23
+
24
+ !SAMPLE_NUM $2A
25
+ !SAMPLE_SIZE $2C
26
+ !SPC_CMD $30
27
+ !SAMPLE_PTR $4A
28
+
29
+ --------------------------------------
30
+
31
+ sfx_table:
32
+ #@sfx00 #@sfx01 #@sfx02 #@sfx03 #@sfx04 #@sfx05 #@sfx06 #@sfx07
33
+ #@sfx08 #@sfx09 #@sfx0A #@sfx0B #@sfx0C #@sfx0D #@sfx0E #@sfx0F
34
+ #@sfx10 #@sfx11 #@sfx12 #@sfx13 #@sfx14 #@sfx15 #@sfx16 #@sfx17
35
+ #@sfx18 #@sfx19 #@sfx1A #@sfx1B #@sfx1C #@sfx1D #@sfx1E #@sfx1F
36
+ #@sfx20 #@sfx21 #@sfx22 #@sfx23 #@sfx24 #@sfx25 #@sfx26 #@sfx27
37
+ #@sfx28 #@sfx29 #@sfx2A #@sfx2B #@sfx2C #@sfx2D #@sfx2E #@sfx2F
38
+ #@sfx30 #@sfx31 #@sfx32 #@sfx33 #@sfx34 #@sfx35 #@sfx36 #@sfx37
39
+ #@sfx38 #@sfx39 #@sfx3A #@sfx3B
40
+
41
+
42
+ spc_transfer.SpcNextChunkIndex!:
43
+ ;REP #$20
44
+ LDX #&sfx_table
45
+ STX SAMPLE_PTR
46
+ SEP #$20
47
+ LDA #^sfx_table
48
+ STA SAMPLE_PTR+2
49
+ LDY $32
50
+ LDA [$46], Y
51
+ INY
52
+ STY $32
53
+ STA SAMPLE_NUM
54
+ STZ SAMPLE_NUM+1
55
+ BIT #$80
56
+ BEQ loc_0290E8
57
+ JMP $&SpcChunkDone
58
+
59
+ spc_transfer.SpcFindChunk!:
60
+ LDA SAMPLE_NUM
61
+ ASL
62
+ CLC
63
+ ADC SAMPLE_NUM
64
+ TAY
65
+ LDA [SAMPLE_PTR], Y
66
+ TAX
67
+ INY
68
+ INY
69
+ SEP #$20
70
+ LDA [SAMPLE_PTR], Y
71
+ STA SAMPLE_PTR+2
72
+ REP #$20
73
+ STZ SAMPLE_PTR
74
+ TXY
75
+ LDA [SAMPLE_PTR], Y
76
+ STA SAMPLE_SIZE
77
+ STA $34 -- ??
78
+ INY
79
+ INY
80
+ SEP #$20
81
+ LDA SPC_CMD
82
+ BRA SpcSendHeader
83
+
84
+ spc_transfer.SpcSendChunkData!:
85
+ LDA [SAMPLE_PTR], Y
86
+ INY
87
+
88
+ spc_transfer.loc_02912C!:
89
+ XBA
90
+ LDA [SAMPLE_PTR], Y
91
+ INY
92
+
@@ -0,0 +1,68 @@
1
+ ; ==============================================================================
2
+ ; Scene script meta tables - indexed scene and label lookup
3
+ ; ==============================================================================
4
+ ; What it does: FindCurrentScene uses scene_meta_list[sceneCurrent] instead of
5
+ ; scanning packed [id][commands] records; SkipScriptCommands uses
6
+ ; meta_label_list[label id] instead of scanning forward by opcode sizes.
7
+ ; Vanilla behavior: Linear scan in WRAM script blob at [$3A], comparing u16 scene
8
+ ; ids and skipping variable-length opcodes; jump/branch targets found by scan.
9
+ ; Hooks (overrides): scene_script.FindCurrentScene (+ stub loc_028CF5-028D3A
10
+ ; labels retained for merge), SkipScriptCommands (+ loc_028D44/046/08D stubs).
11
+ ; Depends on: ?INCLUDE scene_script, scene_meta; ReadScriptByte; tables in
12
+ ; scene_meta (scene_meta_list, meta_label_list).
13
+ ; State: sceneCurrent $0644; script base pointer DP $3A/$3C (engine init).
14
+ ; Hazards/notes: Bank $02; stub colon-label overrides are intentional no-ops for
15
+ ; excised vanilla scan loops; Y must hold stream offset on RTS.
16
+ ; ==============================================================================
17
+ ?BANK 02
18
+
19
+ ?INCLUDE 'scene_script'
20
+ ?INCLUDE 'scene_meta'
21
+
22
+ !scene_current 0644
23
+
24
+ ----------------------------------------
25
+
26
+ scene_script.FindCurrentScene! {
27
+ REP #$20
28
+ LDA $scene_current
29
+ ASL
30
+ TAY
31
+ LDA [$3A], Y
32
+ SEC
33
+ SBC $3A
34
+ TAY
35
+ SEP #$20
36
+ RTS
37
+
38
+ scene_script.loc_028CF5!:
39
+ scene_script.loc_028CFF!:
40
+ scene_script.loc_028D34!:
41
+ scene_script.loc_028D35!:
42
+ scene_script.loc_028D36!:
43
+ scene_script.loc_028D37!:
44
+ scene_script.loc_028D38!:
45
+ scene_script.loc_028D39!:
46
+ scene_script.loc_028D3A!:
47
+ }
48
+
49
+ -----------------------------------------
50
+ ;Utilize the new label jump table
51
+
52
+ scene_script.SkipScriptCommands! {
53
+ JSR $&ReadScriptByte
54
+ REP #$20
55
+ ASL
56
+ TAX
57
+ LDA $@meta_label_list, X
58
+ SEC
59
+ SBC $3A
60
+ TAY
61
+ SEP #$20
62
+ RTS
63
+
64
+ scene_script.loc_028D44!:
65
+ scene_script.loc_028D46!:
66
+ scene_script.loc_028D8D!:
67
+ }
68
+
@@ -0,0 +1,61 @@
1
+ ; ==============================================================================
2
+ ; Scene spritemap load (opcode $10) - signed size and uncompressed spm data
3
+ ; ==============================================================================
4
+ ; What it does: Reads the 16-bit size word from the script stream indirectly via
5
+ ; LoadScriptPointer (skips the 3-byte inline size field vanilla read from
6
+ ; [$3A],Y); treats negative size as absolute byte count; skips LZ when the
7
+ ; compressed pointer is $0000 or negative.
8
+ ; Vanilla behavior: Loaded size from [$3A],Y into $0666; only null pointer
9
+ ; bypassed QuintetLzDecompress (uncompressed path at loc_028C1B).
10
+ ; Hooks (overrides): scene_script.SceneCmd_LoadSpriteTiles (full handler body
11
+ ; through decompress call; vanilla exit/DMA paths unchanged below patch).
12
+ ; Depends on: ?INCLUDE scene_script; CheckSourceCacheHit slot $0684,
13
+ ; LoadScriptPointer, QuintetLzDecompress, DmaRomToWram (vanilla tail).
14
+ ; State: gfxSrcEnd $0666; source cache $0684; decompress size $78; staging $7E:4000.
15
+ ; Hazards/notes: Bank $02; patch truncates before loc_028C19 PLP/RTS (merged with vanilla).
16
+ ; ==============================================================================
17
+ ?BANK 02
18
+
19
+ ?INCLUDE 'scene_script'
20
+
21
+ !SPTR $3E
22
+
23
+ -----------------------------------------------------
24
+
25
+ scene_script.SceneCmd_LoadSpriteTiles! {
26
+ PHP
27
+ REP #$20
28
+ ;LDA [$3A], Y
29
+ ;STA $0666
30
+ ;SEP #$20
31
+ INY
32
+ INY
33
+ INY
34
+ LDX #$003E
35
+ JSR $&LoadScriptPointer
36
+ LDA [$3E]
37
+ BPL store_size
38
+
39
+ LDA #$0000
40
+ SEC
41
+ SBC [$3E]
42
+
43
+ store_size:
44
+ STA $0666
45
+
46
+ LDX #$0684
47
+ JSR $&CheckSourceCacheHit
48
+ BCC loc_028C19
49
+ REP #$20
50
+ LDA [$3E]
51
+ INC $3E
52
+ INC $3E
53
+ CMP #$0000
54
+ BEQ loc_028C1B
55
+ BMI loc_028C1B
56
+ STA $78
57
+ SEP #$20
58
+ LDX #$4000
59
+ STX $7A
60
+ JSL $@QuintetLzDecompress
61
+ }
@@ -0,0 +1,109 @@
1
+ ; ==============================================================================
2
+ ; Scene layer map load (opcode $06) - uncompressed tilemap and raw tile paths
3
+ ; ==============================================================================
4
+ ; What it does: When loading scene layer maps, treats a 2-byte size of $0001 as
5
+ ; "uncompressed geometry" (skip Quintet LZ) and DMAs raw map bytes; also allows
6
+ ; a null compressed tileset pointer to DMA ROM tile CHR without decompressing.
7
+ ; Vanilla behavior: Zero size ($0000) entered HandleEmptyGeometry; non-zero sizes
8
+ ; always went through QuintetLzDecompress in StoreMapAndDecompress / DmaLowVramTileset.
9
+ ; Hooks (overrides): scene_script.loc_02883D (map size gate and layer decompress path),
10
+ ; WriteMapBounds (empty-geometry DMA setup), DmaLowVramTileset (tile-only VRAM upload).
11
+ ; Depends on: ?INCLUDE scene_script; StoreMapAndDecompress, DmaRomToWram,
12
+ ; Multiply8x8Unsigned, QuintetLzDecompress (unchanged call sites).
13
+ ; State: Reads gfxLayerFlags $066A, script source pointer $3E/$40; writes map bounds
14
+ ; $0692/$0696, meta sizes $0666/$0668/$069A, decompress size $78, WRAM $7E:A000/C000.
15
+ ; Hazards/notes: Bank $02; 16-bit A in overridden entry paths; preserve layer bit tests
16
+ ; ($01 layer 0, $02 layer 1) matching vanilla routing.
17
+ ; ==============================================================================
18
+ ?BANK 02
19
+
20
+ ?INCLUDE 'scene_script'
21
+
22
+ !sptr 3E
23
+ !DCMP_SIZE 78
24
+ !META_SIZE 0666
25
+ !DST_OFF 0668
26
+ !map_bounds_x 0692
27
+ !map_bounds_y 0696
28
+ !A1T0L 4302
29
+ !A1B0 4304
30
+
31
+ ---------------------------------------------
32
+
33
+ scene_script.loc_02883D! {
34
+ REP #$20
35
+
36
+ LDA [$sptr]
37
+ INC $sptr
38
+ INC $sptr
39
+ CMP #$0001
40
+ BMI HandleEmptyGeometry
41
+ STA $DCMP_SIZE
42
+ STA $META_SIZE
43
+
44
+ SEP #$20
45
+ LDA $066A
46
+ BIT #$01
47
+ BEQ loc_02888E
48
+ LDX #$0000
49
+ JSR $&StoreMapAndDecompress
50
+ LDA $066A
51
+ BIT #$02
52
+ BEQ loc_028894
53
+ LDX #$A000
54
+ STX $3E
55
+ LDA #$7E
56
+ STA $40
57
+ LDX #$C000
58
+ STX $42
59
+ LDA #$7E
60
+ STA $44
61
+ JSR $&DmaRomToWram
62
+ LDA $01
63
+ STA $0695
64
+ XBA
65
+ LDA $03
66
+ STA $0699
67
+ JSL $@Multiply8x8Unsigned
68
+ STA $069D
69
+ BRA loc_028894
70
+ }
71
+
72
+ ---------------------------------------------
73
+
74
+ scene_script.WriteMapBounds! {
75
+ REP #$20
76
+ LDA $00
77
+ STA $map_bounds_x, X -- copy stored width
78
+ LDA $02
79
+ STA $map_bounds_y, X -- copy stored height
80
+ LDA $META_SIZE
81
+ STA $069A, X -- copy stored multiply result (used by 0 index)
82
+ STZ $DST_OFF -- zero dest offset
83
+
84
+ JSR $&DmaRomToWram
85
+ SEP #$20
86
+ RTS
87
+ }
88
+
89
+ ---------------------------------------------
90
+
91
+ scene_script.DmaLowVramTileset! {
92
+ REP #$20
93
+ LDA [$sptr]
94
+ INC $sptr
95
+ INC $sptr
96
+ CMP #$0000
97
+ BMI do_copy
98
+ BNE do_copy
99
+ STA $DCMP_SIZE
100
+ BRA loc_028943
101
+
102
+ do_copy:
103
+ SEP #$20
104
+ LDX $sptr
105
+ STX $A1T0L
106
+ LDA $40
107
+ STA $A1B0
108
+ BRA loc_028959
109
+ }
@@ -0,0 +1,41 @@
1
+ ; ==============================================================================
2
+ ; Scene metatile-set load (opcode $05) - uncompressed tileset blob
3
+ ; ==============================================================================
4
+ ; What it does: When loading metatile sets, treats compressed pointer $0000 or
5
+ ; negative as uncompressed ROM data (skip QuintetLzDecompress) before layer
6
+ ; DMA and BuildMetatileFlagTable (vanilla code after loc_02878A).
7
+ ; Vanilla behavior: BEQ loc_02878A skipped LZ only on exact zero pointer; any
8
+ ; other value ran QuintetLzDecompress to $7E:7000 first.
9
+ ; Hooks (overrides): scene_script.loc_028768 (pointer read and decompress gate).
10
+ ; Depends on: ?INCLUDE scene_script; CheckSourceCacheHit, DmaRomToWram,
11
+ ; BuildMetatileFlagTable (downstream vanilla).
12
+ ; State: gfxLayerFlags $066A; decompress size $78; staging $7E:7000; WRAM $2000/$2800.
13
+ ; Hazards/notes: Bank $02; patch ends at loc_028768 block close (merged tail).
14
+ ; ==============================================================================
15
+ ?BANK 02
16
+
17
+ ?INCLUDE 'scene_script'
18
+
19
+ !SPTR $3E
20
+ !DCMP_SIZE $78
21
+
22
+ -----------------------------------------------------
23
+
24
+ scene_script.loc_028768! {
25
+ LDA $066A
26
+ BEQ loc_0287BA
27
+ LDA [$3E]
28
+ STA $78
29
+ INC $3E
30
+ INC $3E
31
+ CMP #$0000
32
+ BEQ loc_02878A
33
+ BMI loc_02878A
34
+ LDX #$7000
35
+ STX $7A
36
+ JSL $@QuintetLzDecompress
37
+ LDX #$7000
38
+ STX $3E
39
+ LDA #$007E
40
+ STA $40
41
+ }
Binary file
@@ -0,0 +1,22 @@
1
+ ; ==============================================================================
2
+ ; Seth's Jewel - Gold Ship Seth NPC gift
3
+ ; ==============================================================================
4
+ ; What it does: Seth on the wrecked Gold Ship gives item $29 (Seth's Jewel) on first talk
5
+ ; instead of Red Jewel $01; repeat dialog unchanged after flag $E0.
6
+ ; Vanilla behavior: gs2B_seth GiveItem #01, "Will gets a Red Jewel!" text; same flags
7
+ ; $51 (despawn) and $E0 (already gave jewel); inventory-full -> HiddenRedJewelInventoryFull.
8
+ ; Hooks (overrides): gs2B_seth.code_059652 interact handler; dialogstring_05966E pickup line.
9
+ ; Depends on: ?INCLUDE gs2B_seth; hidden_red_jewel for code_059665 full-inventory JML.
10
+ ; State: Flag byte $E0 set on successful give; $51 unchanged from vanilla.
11
+ ; ==============================================================================
12
+
13
+
14
+ gs2B_seth.code_059652! {
15
+ COP [BranchOnFlagByte] ( #E0, #01, &code_059669 )
16
+ COP [PrintDialogString] ( &dialogstring_05966E )
17
+ COP [GiveItem] ( #29, &code_059665 )
18
+ COP [SetFlagByte] ( #E0 )
19
+ RTL
20
+ }
21
+
22
+ gs2B_seth.dialogstring_05966E! `[TPL:F][TPL:5]Seth: I found [N]a strange jewel [N]on board the ship. [N]I'll give it to you. [FIN][PAL:0]Will gets Seth's Jewel![PAL:0][END]`
@@ -0,0 +1,22 @@
1
+ ; ==============================================================================
2
+ ; Seth's Jewel (item $29) - equipped-item HUD icon
3
+ ; ==============================================================================
4
+ ; What it does: Appends HUD icon routine for item $29 using Red Jewel CHR tiles with a
5
+ ; custom 16-color palette (inventory purple on key colours via pal_item_exprite2+80).
6
+ ; Vanilla behavior: item_icon_list in EquippedIcon.patch.asm ends at index $28; no icon for $29.
7
+ ; Hooks (overrides): item_icon_list+= entry $29 (target lives in baserom EquippedIcon patch, not extracted).
8
+ ; Adds: item_icon_seths_jewel -> PEA palette, PEA gfx+240, LDX gfx+40, JMP item_icon_next.
9
+ ; Depends on: EquippedIcon item_icon_list / item_icon_next; gfx_item_exprite, pal_item_exprite2.
10
+ ; Hazards/notes: Palette slot at pal_item_exprite2+80 ($80-$9F bytes in equipped-icon bundle).
11
+ ; ==============================================================================
12
+
13
+ EquippedIcon.item_icon_list+= [
14
+ &item_icon_seths_jewel ;29
15
+ ]
16
+
17
+ item_icon_seths_jewel {
18
+ PEA #$&pal_item_exprite2+80
19
+ PEA #$&gfx_item_exprite+240
20
+ LDX #$&gfx_item_exprite+40
21
+ JMP item_icon_next
22
+ }