Bastion Raid: isometric scrolling shooter, graphics scroll and border

Ports 35h-37h scroll the graphics layer (wrapping at 320 x 240); bit 1 of
36h hides a border (4 columns, 2 rows) where a program draws the strip
coming into view unseen. The video loads its own column/row counters from
the scroll registers each line and frame. CLS resets both. Testbench
checks scroll, wrap and border.

games/raid: an original Zaxxon-style game in C - fly over a fortress that
scrolls diagonally, climb over low walls and through doorways in tall
ones, shoot turrets, fuel tanks, radar and fighters, destroy the reactor.
The world is drawn pixel by pixel from a formula, two columns and a row a
frame (about 40% of the Z-80). test-raid.py flies the level with an
autopilot and checks the frame budget; tools/boardemu.py is now shared by
both games' tests. send-hex.py sets the date before saving.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
brad ArantandClaude Opus 5.5 committed 2026-11-29 10:00:25 -08:00
1 parent 743071cff3
commit 62d0883a7f
19 files changed
+1807 -163

No files matched your search

+26 -1
View File
@@ -232,6 +232,13 @@ sprite-graphics collision flags. BASIC moves them with `OUT` (ports 112–119)
and reads the frame counter and collisions with `INP` (120, 128–135); see the
manual. `basic/examples/sprites.bas` is a small example.
**Scrolling:** ports 35h–37h set the point of the 320×240 graphics shown at
the top left; the picture wraps round. Bit 1 of port 36h hides the graphics in
a border (4 columns each side, 2 rows top and bottom) so a program can draw the
strip scrolling into view unseen. The video keeps its own column and row
counters, loaded from the scroll registers at the end of each line and frame,
so scrolling adds no arithmetic to the pixel pipeline.
**Held keys:** port 88h reads the arrows/WASD, fire, Enter, Shift and Esc as
held-down bits, and 89h any key by scan code (`rtl/ps2_keyboard.v`,
`ps2_keystate`), so games don't depend on typematic repeat.
@@ -248,6 +255,19 @@ tools/send-bas.py games/keep/keep.bas --baud 3000000 # the loade
python3 games/keep/test-keep.py --play --shots /tmp/keep # emulator test (pyte, Pillow)
```
**Bastion Raid** (`games/raid/`) is an isometric scrolling shooter: fly over a
fortress, climb over low walls and through the doorways in tall ones, shoot
turrets, fuel tanks and fighters, and destroy the reactor core. `RUN "RAID"`.
It draws the world pixel by pixel from a formula into the scrolled graphics:
two columns and a row a frame, about 40% of the Z-80's time. Build and install
it the same way (`games/raid/build.sh`, then `send-hex.py raid.ihx --save
RAIDGAME` and `raid.bas` saved as `RAID`). `test-raid.py --play` flies the
whole level with an autopilot, checks every frame fits in a 60th of a second,
and takes screenshots.
`tools/boardemu.py` models the board's game hardware (graphics, scrolling,
sprites, held keys, terminal) around `tools/z80emu.py` for both tests.
`gen.py` holds the art and the castle map and checks that every room joins up
and every key, door and the crown can be reached. `test-keep.py` runs the game
in `tools/z80emu.py` on a model of the board's ports, takes screenshots, and
@@ -412,7 +432,8 @@ stack fill the top half.
| 20h / 21h | | 7-segment display, right / left byte |
| 30h, 31h, 32h | | graphics X low byte, X bit 8, Y |
| 33h | colour at X,Y | plot at X,Y, then X+1 |
| 34h | bit 0: fill busy | fill the whole graphics layer with a colour; also turns the sprites off unless bit 7 is set |
| 34h | bit 0: fill busy | fill the whole graphics layer with a colour; also turns the sprites off and resets the scroll unless bit 7 is set |
| 35h, 36h, 37h | | scroll: X low byte; X bit 8 and bit 1 = hide the border; Y (0–239) |
| 40h | bit 0: SPI byte busy, bit 1: command refused | 1 starts a flash command (chip select low), 0 ends it |
| 41h | byte received during the last transfer | send a byte to the flash |
| 60h | why the monitor was entered (1 Pause, 2 port 61h, 3 step, 4/5 breakpoint) | bit 0: monitor bank in; bit 1: stop after one instruction |
@@ -508,6 +529,8 @@ older boards, Macronix `mx25l3273f` on newer ones).
- It holds Ctrl and right Shift on the PS/2 line and reads them back on the
held-key ports, then releases them.
- In the monitor, it sends an Intel HEX record and checks memory.
- It scrolls the graphics and checks where pixels land, wrapping round, with
and without the border, and that `CLS` resets it.
- Against a model flash (`sim/spiflash_model.v`) it sets the date, saves,
loads, runs and lists a program (checking the date in `DIR`), tries to erase
address 0 and checks the model saw no write below 240000h, then writes a data
@@ -534,6 +557,8 @@ which Vivado needs on newer distros.
| `tools/send-bas.py`, `tools/get-bas.py` | Send a BASIC program to the board / copy one back, run commands |
| `tools/send-hex.py` | Load an Intel HEX file through the monitor and save it as a memory file |
| `games/keep/` | The Iron Keep: game (C), art and map generator, loader, emulator test |
| `games/raid/` | Bastion Raid: game (C), art and level generator, loader, emulator test with autopilot |
| `tools/boardemu.py` | Model of the board's game hardware around `z80emu.py`, with screenshots |
| `basic/` | BASIC interpreter (C), start-up code, build script, `basic.mem` |
| `tools/z80emu.py`, `tools/cputest.py`, `scripts/cpusim.sh` | CPU test bench: reference emulator, random tests |
| `rtl/term_ctrl.v` | VT220 engine (parser, modes, attributes, copy/fill engine, smooth scroll) |