modemwars/swiftlink/build.sh
2026-08-23 02:09:40 -05:00

25 lines
929 B
Bash
Executable file

#!/bin/bash
# build.sh - assemble the SwiftLink opponent module and install it on a copy of the game disk.
#
# ./build.sh [outputDisk.d64]
#
# The module is a drop-in replacement for the stock modem driver: same $E000 jump table, same shared
# variables, same wire protocol. Only the bottom layer changes - a 6551 ACIA on a SwiftLink cartridge
# instead of the bit-banged user-port UART.
set -e
cd "$(dirname "$0")"
ROOT=".."
OUT="${1:-$ROOT/Modem_Wars_SwiftLink.d64}"
mkdir -p build
ca65 -t none -I "$ROOT/disassembly" -o build/swiftlinkDriver.o swiftlinkDriverE000.s
ld65 -C link.cfg -o build/swiftlinkDriverE000.bin build/swiftlinkDriver.o
size=$(stat -c%s build/swiftlinkDriverE000.bin)
if [ "$size" != "4096" ]; then
echo "FAIL: module is $size bytes, must be exactly 4096"
exit 1
fi
python3 injectDriver.py build/swiftlinkDriverE000.bin "$ROOT/Modem_Wars_1988_Electronic_Arts_b4.d64" "$OUT"
echo "built $OUT"