Alex Kidd GX: how the port is being built - in Claudes Words
At time of writing, we are at Round 8 of 17
The overall approach
The port doesn’t emulate the Master System. It’s rewritten in native Z80 for the GX4000, on top of the Sonic GX engine (thanks to the Condense team). Sonic’s content was removed first in M1 and G0. Alex Kidd was then added as a separate “Round mode” with its own RAM layout and block grid. The game engine is Z80 assembly, assembled with rasm. All the conversion and testing tools are Python.
Each session I stage the latest git bundle, reference archives and your ROM copy from your folder into a cloud workspace. I clone the bundle, build the cartridge and run the tests. Then I commit and send back a new bundle plus .cpr cartridges.
Work goes round by round, in small parts (for example G6k part 0 → 1a → 1b → 2a → 2b → 3). Part 0 always measures the round on the original and proposes a plan. Every part ends with a working cartridge, a report and a fallback build, and nothing starts until you approve the previous part. So far Rounds 1–7 are complete, and Round 8 is at part 2a2, waiting for your review.
Memory mapping
The cartridge is up to 512 KB, which is 32 banks of 16 KB:
Bank 0 sits in the lower ROM and is always mapped. It holds the core round code: Alex, collision, sprites, scrolling. It has only 94 bytes free, so it’s the scarcest resource and is protected.
Banks 1–31 are paged into the upper ROM as needed, each with a role. Examples: tiles for one or more rounds (1, 15, 21, 23, 26), audio (7, 12), the pause screen and map (8), the sprite library and second sprite store (9), level tables (13), screens (14), shops (18–19), the motorcycle (20), shared enemy code (22), the hermit/old-man text scenes (24) and the Peticopter (25).
RAM has fixed areas. Audio player at #9F00–#A7FF, pause screen at #A800, shop variables at #A900, and the current round’s level tables copied to #B800–#BDFF at the start of each round.
Enemy pictures are split:
Pictures 0–127 are in bank 0 and are shared.
Pictures 128–254 belong to each round and are listed in that round’s own tables.
So a new enemy costs zero bank-0 bytes. Since Round 8 it also costs nothing in bank 3, which was nearly full.
Fitting 17 rounds into 512 KB
The running plan is the allocation-plan.md project doc. It’s updated at every round’s part 0.
Now: about 222 KB free, with banks 11 and 27–31 still completely empty.
Still needed for Rounds 8–17: an estimated 170–190 KB. That’s about 58 KB of tile code, 25 KB of screens, 15 KB of level tables, up to 16 KB of sprites, one new music track (the castle theme) and 40–60 KB of new round code.
Expected margin: 40–80 KB, with about 2–3 empty banks left at the end.
How it fits:
Reuse first. The converter automatically gives a round the already-built version of any block identical to an earlier round’s (grass, money bags, your redrawn balls). Most rounds reuse MUS_ROUND1. Enemies, the shop, the bike, the Peticopter, the text-box scene and Janken are shared routines.
Tiles share banks. Only the current round’s tiles are paged in, so several rounds can share one bank.
Round 16’s 36 screens will stream from bank 11 in sections, with no extra RAM and no visible loading pause.
The level-table bank (13) runs out around Round 12. The plan is to use 5 spare bits in each round’s table entry to point at another bank, at a cost of about 10 bytes of bank 0. I’ll propose it when it’s needed.
Why the graphics seem to change style or resolution
This comes from the hardware, not from mixing art sources:
Scenery is in Mode 0, the only CPC screen mode with 16 colours. Its pixels are twice as wide as tall, about 160 across. The Master System has 256 square pixels across, so the converter keeps every other column of the original’s tiles. That’s why thin details like the stakes, tree trunks and balls sometimes need a choice of columns, or a redraw from you.
Sprites (Alex, enemies, items, block pieces) are the GX4000’s hardware sprites. These are 16×16 at a much finer pixel size, so they keep nearly all the original’s detail and look sharper than the background. There are only 16 of them. The budget is Alex 4, block pieces 4, item 1, birds/fish 6 and 1 spare, which is why some big objects are built from several sprites.
Text and status displays use full-resolution sprites or Mode 1. Examples: the pause screen’s status row, “PUSH FIRE BUTTON”, and the text boxes, which switch modes partway down the screen. This keeps text crisp without degrading the scenery’s colours.
So the mix of chunky and sharp is mostly Mode 0 scenery next to high-resolution sprites and text. Your rule is that the original and the completed rounds are the visual reference, and existing graphics are reused rather than redrawn.
Sound
Capture: the original’s sound chip output is logged frame by frame from the ROM, using the Gearsystem-based tracer.
Conversion: the logs are converted from the Master System’s SN76489 to the GX4000’s AY chip. Music and effects from the original appear only in your private build. A public build would use sounds of my own design, modelled on the measurements.
Playback: the player runs from RAM in the frame’s spare time and outputs through the ASIC’s sound DMA. Music can sit in any bank. Effects are requested by stable ID (SFX_* / MUS_*, catalogued in sound-effects-library.md) with priorities, using one effect channel at a time, as the original does.
Rules: audio must never cause slow frames or timing changes, and volumes were lowered 3 steps for real hardware after the SCART distortion you heard in G6a.
Limit: the AY can’t make noise as low as the Master System’s, so the lowest rumbles are slightly higher.
Testing
One emulator at a time (CPCEC), run automatically on scripted inputs with screenshots.
Frame-by-frame comparisons check the port’s positions, enemy states and deaths against the original on the same inputs.
Bank-by-bank byte comparisons of old and new cartridges show which rounds’ code is untouched. Untouched rounds aren’t retested unless shared code changed. The full regression run (Rounds 1 → 8, shops, bike, Peticopter, capsule, flame immunity) runs at round ends and after shared-code changes.
Frame profiling catches slow frames, and the bank usage report goes into every part’s report.
Bug log: anything minor is recorded in bug-findings.md rather than fixed on the spot, then reviewed with you.
Comparing against the Master System original
The tracer runs the ROM and records its RAM, sprites, screen and sound every frame. I don’t use the Alex Kidd disassembly.
Behaviour is measured as a black box. For example: the monkey throws a seed every 128 frames, the bike stops at x + 66, the cane lasts 788 frames.
Methods include probe routes through each round, contact boxes measured from both sides, and screen and sound diffs.
Findings become permanent references in the round notes and are reused rather than re-measured. Your rule is to measure the original before changing the port.
Playability comes first. I measure what a feature needs to be built correctly, not every frame. Gameplay mechanics (what vehicles break, sounds, deaths) still count as required, not as minor differences.
How I ask you to check things
Each part ends with a cartridge (AlexKiddGX__PRIVATE.cpr). There’s often also an _endtest build that starts near the end of the round. You play it in WinAPE and on the real GX4000, often with a screen recording, and report back.
The report uses your agreed format. It says what was newly tested, what was retested because of a dependency, what was unchanged and not retested, and what still needs attention, along with known differences and bank usage.
Decisions come to you as options (A/B/C) with the measured facts. Examples: the bank 3 relief, the hermit’s box colours, the cane icon’s colour (#167, still open).
Graphics come to you before they go in. I export them as editable images or before/after screenshots, and your artwork is used exactly as supplied. Examples: the title logo, the balls, the currency symbol, the A-ball.
When a milestone is ready, I tell you to start a new conversation and give you a starter message, to keep usage down.
Right now the 2a2 cartridge needs your WinAPE / GX4000 check of Round 8’s shop and the motorbike, including the fix for the wrong block pieces after a crash. After your approval, the next part is 2b, the Cane of Flight.