games/swarm: an original Galaxian-style game in C for the Z-80 - a 46-alien formation sways overhead and peels off in looping, firing dives, flagships bring escorts. With more aliens than sprites, the formation is drawn into the graphics and swayed by the hardware X scroll; a diver is wiped out of the graphics and becomes a sprite until it flies back. test-swarm.py has an autopilot destroy a whole swarm. tools/boardemu.py: the frame counter now moves on once per wait, not on every read (it had been running two frames per wait, so anything done on odd frames never happened in tests). The other games' tests still pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
26 lines
1.1 KiB
Bash
26 lines
1.1 KiB
Bash
#!/bin/bash
|
|
# Build Star Swarm: swarm.ihx, Intel HEX for tools/send-hex.py.
|
|
# The program runs at 8600h with its variables at D000h, inside BASIC's
|
|
# program area (8482h-D6D5h) and clear of the SWARM loader program at its start.
|
|
set -e
|
|
cd "$(dirname "$0")"
|
|
mkdir -p out
|
|
python3 gen.py out/data.h
|
|
sdasz80 -plosgff out/crt0.rel crt0.s
|
|
sdcc -mz80 --opt-code-size --max-allocs-per-node 20000 --std-sdcc11 -Iout -c -o out/swarm.rel swarm.c
|
|
sdcc -mz80 --no-std-crt0 --code-loc 0x8620 --data-loc 0xD000 -o out/swarm.ihx out/crt0.rel out/swarm.rel
|
|
python3 - <<'EOF'
|
|
import re
|
|
m = open("out/swarm.map").read()
|
|
def sym(n):
|
|
return int(re.search(r"([0-9A-F]{8})\s+" + n + r"\b", m).group(1), 16)
|
|
code_end = sym("s__CODE") + sym("l__CODE")
|
|
data_end = sym("s__DATA") + sym("l__DATA")
|
|
init = sym("l__INITIALIZED") + sym("l__INITIALIZER")
|
|
print("code 8600-%04X (%d bytes), variables D000-%04X" % (code_end - 1, code_end - 0x8600, data_end - 1))
|
|
assert code_end <= 0xD000, "code runs into the variables"
|
|
assert data_end <= 0xD6D6, "variables run past BASIC's program area"
|
|
assert init == 0, "initialised variables are not supported"
|
|
EOF
|
|
cp out/swarm.ihx swarm.ihx
|