Skip to content

Pool-allocate the bank-20 relocated region - #29

Merged
manz merged 2 commits into
masterfrom
dev/pool-bank20-reloc
May 15, 2026
Merged

Pool-allocate the bank-20 relocated region#29
manz merged 2 commits into
masterfrom
dev/pool-bank20-reloc

Conversation

@manz

@manz manz commented May 15, 2026

Copy link
Copy Markdown
Owner

Summary

The bank-20 relocated region in ff4.s used the legacy *=0x208000 org-pointer pattern: a hand-placed block mixing inline routines, .import modules, .if-gated sub-blocks, and .incbin asset blobs. Reading required tracing the implicit org through ~30 directives, and inserting code anywhere silently shifted everything below.

This branch declares the bank-20 free-space layout with the allocator pattern master adopted for bank-01 (commit 9b3eaa7). A single .pool bank20_reloc { range 0x208000 0x20FFFF; strategy order } owns the bank; a .alloc bank20_main in bank20_reloc { ... } block pins the 5 inline reloc helpers (conditional_bg1_vofs, clear_ram, multiply_item_index_12, multiply_by_12, brk_handler). strategy order keeps them in declaration order so the hardcoded conditional_bg1_vofs := 0x208000 constant still holds.

.import modules and .incbin asset blobs stay top-level because (a) modules without their own *= directive inherit the parent file's implicit org, and (b) assets.s carries multi-bank *= placements ($0AF000, $0FA710, $0E9800 patches plus $21+ freespace data) that a single .alloc would clip. A single *=0x208100 after the .alloc reseats the org chain in bank-20 so the imports land where they always have.

Dogfooding the new .pool / .alloc syntax against ff4.s surfaced four formatter and codegen bugs in a816, all filed and fixed upstream over the course of this work (overflow Q#10 through Q#14). Pin bumps land in the second commit: a816 to 1.1.0a22 (incrementally past a17, a18, a19, a20, a21 through PyPI releases as fixes shipped) and kintsuki to 0.0.0a13 (picks up the battle profiling hooks the tooling will need next).

The pre-commit hook switches from language: system to language: python with the pinned additional_dependencies so CI cannot drift from the developer venv.

Test plan

  • python3 build.py produces build/ff4.ips (262282 bytes) and build/ff4.sym (1064 symbols)
  • a816 format --check ff4.s passes idempotent on a22
  • Pre-commit hooks (a816 format + lint) pass on each commit without --no-verify
  • Symbol set diff vs prior master baseline: only the new bank20_main pool symbol; every other label preserved
  • Visual smoke pass on battle + field menus to confirm no symbol address regressions

@github-actions

Copy link
Copy Markdown

🎮 FF4 IPS Build Ready!

Your patch has been built successfully! Download the IPS file from the artifacts:

📦 Artifact: ff4-ips-pr-29
🔗 Download: Click here to go to the build page

The artifact will be available for 30 days.
Last updated: cc5a808

@manz
manz merged commit b4d59d3 into master May 15, 2026
1 check passed
@manz
manz deleted the dev/pool-bank20-reloc branch May 15, 2026 21:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant