MICRO MACHINES STE - experimental Amiga-based port

Run DRIVE.PRG with the RES folder alongside it.
Tested in Hatari: Atari STE, 2 MB RAM, PAL, TOS 1.62.
Menus and frontend: original 320x208. Gameplay: 320x240.
Frontend pages use original 17-level image fades; animation starts after fade-in.
Gameplay has a scrolling 320x224 view and a fixed 320x16 bottom HUD.
Challenge camera now uses the original Amiga init/step routines (8px/tick limit).
It follows the original screen-space vehicle position, independently of page swaps.
Physics and the existing respawn/refill timing are unchanged.
Do not copy only the PRG: resources are now loaded from files.

Default Player 1: arrows + Left Shift
Default Player 2: WASD + Right Shift
Space on title opens the original control-options page.
1 / 2: cycle the corresponding player's control device; Space: return.
Choices: joystick port 0 (mouse port), port 1, arrows/Left Shift, WASD/Right Shift.
Players cannot share a device. Only the selected device drives each player.
Assignments are retained between menus and races until leaving the program.
Shift / joystick Fire: accelerate / confirm
Space on title: control options
Left / Right: steer
Down: brake / reverse
R: restart current course
N: force a win / skip to next championship race (test shortcut)
Escape: return to TOS

Starts with the original title and cycling vehicle illustrations.
Press Shift / Fire, choose ONE PLAYER (Left), then CHALLENGE (Right).
Left/Right selects a menu option; Shift / Fire confirms.
The options layout and conflict-free device cycling use original Amiga FRT code.
ONE PLAYER -> HEAD TO HEAD is also playable: choose a driver and one rival.
Head to Head starts at 4:4 points, with the original elimination/point rules.
Win to advance through 26 courses; a loss costs one of three lives.
TWO PLAYER is playable: each player confirms their own driver.
Then choose TOURNAMENT or SINGLE RACE with Left/Right and Fire.
Tournament: original random non-repeating courses, first to four race wins.
The tournament seed varies with launch/menu input timing, not a fixed constant.
Single Race: choose one of ten original courses; results offer another race.
Both humans share the camera and original eight-point versus rules.
Driver selection: Left/Right to scroll, Fire to choose.
Win the boat qualifier, then select three different opponents.
The qualifying briefing and success/failure screens precede the challenge.
Before each race: participant lineup, Fire to drive the cars offscreen,
then the course-progress overview, Fire to load and start the race.
Choose a new opponent when the championship eliminates a rival.
Occupied and eliminated characters cannot be selected again.
After choosing, the original portrait animation finishes automatically.
All 25 championship races and three solo bonus courses are included.
The original Amiga MID code controls advancement and lives:
three starting lives, top two advance in races 1-24, win the final.
Three consecutive wins earn a bonus; win it for an extra life.
On results/messages, release and press Fire after the input lock.
R only restarts during a race/results, not on modal messages.
All eleven original characters are available for the human driver.
N is a debug shortcut: it also auto-selects characters on selection pages.

Only the current race OR current frontend resource is resident in RAM.
Menu and intermission .SHR files reference the shared RES/MENU.DAT library.
Race .SHR files reference RES/RACE.DAT: tiles, vehicles and effects are shared
between courses on disk. Only the current race is copied/relocated in RAM.
Keep that file with the matching .SHR files; do not mix different builds.
Only the current scene is reconstructed in RAM, with its original palettes
and exact graphics. The shared library is never loaded into RAM as a whole.
Disk access happens between screens, not during driving.
Shared graphics/maps and all four music modules are packed with Imploder.
The byte-exact original Amiga FRT depacker expands each record in place.
No extra packed-input heap/buffer is needed; scene allocations are unchanged.
Keep the compressed libraries and recipes together from the same build.
Original Amiga AC1D music now plays through Leonard Paula and STE stereo DMA.
Replay and mixing run from VBL, independently of menu drawing (as in UGH).
Music follows the original menu/results/bonus/champion scene routing.
The initial menu tune continues across its subpages; course overview is silent.
There is no music during countdown or racing, as on Amiga.
One MD module at a time occupies a reusable 22606-byte slot, as on Amiga.
Modules are loaded between FRT calls; audio does not stream during playback.
Music continues during menu resource loads via a chained TOS VBL handler.
Original GAM engines and effects use a Lotus-style 12.5-kHz mono backend.
Engine pitch/volume follow original RPM logic; effect pitch/gain is baked offline.
Both original effect queue slots remain independent before the mono fold.
Challenge plays only the human engine; two-car modes play both engines.
A short, cursor-driven ring reduces trigger delay and preserves loop phase.
DMA stops on scene changes and before resource replacement.
Music stays on Leonard Paula at 12.5 kHz; DMA ownership switches between screens.
DMA stops before returning to TOS.
Missing/damaged resources show the filename and error stage.
Original whirlpools and animated water hazards now affect every racer.
BOBs use original masks/anchors and restore their background before tile updates.
Boats are progressively hidden under bath bridges using original clipping rules.
Helicopter rotor frames and height presentation follow the original Amiga code.
Gameplay uses fixed black/white/four player colours plus ten background colours.
Tiles, vehicle/effect sprites, hazard BOBs and race fades share the new palette.
Original vehicle shadows, boat trails and splashes now render as masked BOBs.
Shadows respect bath bridges; helicopters have no shadow, as in the original.
Tank shots now use original flight/impact logic and projectile/shadow BOBs.
Use Up (special action) to shoot a tank; Shift/Fire remains the accelerator.
The HUD uses original Amiga art, font, lap/rank logic and bonus clock.
Its separate palette stays fixed while the track scrolls and follows race fades.

Results now animate original FRT happy/sad portraits with timed card reveals.
Life loss, bonus outcomes and rival elimination use original motion/timing.
Champion screens include the recovered trophy and emerging winner portrait.
Finished vehicles now show original 1st-4th BOB markers during the ending coast.
As on Amiga, versus modes and solo bonuses do not show these markers.
Renderer now skips transparent words and directly copies opaque effect words.
Four-boat start benchmark: 60 updates in 81 PAL VBLs, Hatari 8 MHz.
Vehicles share an EMS pass context and preserve caller registers once per pass.
Controlled four-car EMS draw+restore tests use about 8-11% fewer cycles.
Small two-word effects omit transparent chunks in background save/restore.
Controlled wake/effect draw+restore tests use about 9-11% fewer cycles.
True double buffering: gameplay draws only into a private scrolling ring.
VBL shows completed frames and holds the previous one if rendering runs late.
All nine graphics banks fit in 2 MB with audio enabled.
Maps stay 16-bit in RAM, saving 144 KiB versus expanded 32-bit maps.
Word offsets are prepared in place; scrolling does not multiply tile indices.
All vehicle/start/explosion/place frames use original AGT EMS drawing.
EMS masks and colour blocks are deduplicated; no runtime preshift caches remain.
Double buffering added about 159 KiB; word maps recover 144 KiB of that cost.
AGT-style tile submission costs about 6% fewer cycles per incoming strip.
Older hand-written EMS/IMS experiments remain excluded from the normal build.
Small 5-8-row FX use predecoded row operations and inverse masks.
Colors remain in the original raw graphics; clipping keeps the reference path.
The FX kernel gains about 2-4%, not a measured whole-game FPS increase.
Predecoded resources cost 10-25 KiB for the currently loaded bank only.
Terrain division by 12 uses an exact shared 16 KiB quotient/remainder table.
All registers and flags match the original division on the full input domain.
The isolated pair costs 172 instead of 340 cycles in the native 68000 test.
The controlled four-boat benchmark still takes 81 PAL VBLs for 60 steps.
Terrain-code results use one 512-byte cache for the active bank, warmed at init.
Nonzero decoder calls cost 130 instead of 176-178 native 68000 cycles.
Results, register side effects and flags match the original Amiga helper.
Total resident overhead including metadata and code is 612 bytes.
FX packet preparation shares aligned camera coordinates across a command pass.
Eight to 32 accepted FX use about 5-8% fewer preparation cycles; tiny batches
pay extra setup. This does not change camera tracking or per-page clipping.
Seven terrain offset multiplies now use exact shared tables totaling 292 bytes.
They save 16-24 native 68000 cycles per multiply; total resident growth is
344 bytes. The four-boat benchmark remains 81 PAL VBLs for 60 updates.
FX background restore walks 976-byte records backwards after one end-pointer
calculation. Tests with 8-32 small effects use 16-18% fewer restore cycles;
one effect pays 8 extra cycles. This adds 4 code bytes, with no new buffers.
Gameplay sound effects are now included; physical STE audio testing is welcome.
Physical STE and full-championship playtesting pending.
