mirror of
https://git.k-space.ee/arti/vt1200.git
synced 2026-10-30 12:03:54 +02:00
The firmware's tftp_open hangs in its resolver from the rdebug process, so the payload speaks RFC 783 over the firmware socket API: socket(2,2,0), sendto(RRQ), recvfrom(DATA)/ACK into a malloc'd buffer, close. Verified live: 600 B fetched from 192.168.99.1 into the malloc buffer, server RRQ logged, and rdebug peek matches probe.bin byte-for-byte. Notes: dwt/notes/TCPIP.md (function table, ABI, limits) and the loader/transport hand-off in dwt/notes/LOADER_CROSS.md.
71 lines
2.0 KiB
Bash
Executable File
71 lines
2.0 KiB
Bash
Executable File
#!/bin/sh
|
|
# Build a VT1200 payload with the 1987 TI TMS34010 SDK (GSPA/GSPLNK under
|
|
# DOSBox). Same flow as dwt/gui/build.sh, but all work/output stays under
|
|
# dwt/tcpip/.
|
|
#
|
|
# dwt/tcpip/build.sh SOURCE.asm [ORIGIN_BITS]
|
|
#
|
|
# Output: dwt/tcpip/build/<name>.bin, .map, .lst
|
|
set -eu
|
|
|
|
ROOT=$(cd "$(dirname "$0")/../.." && pwd)
|
|
DIR=$(cd "$(dirname "$0")" && pwd)
|
|
SRC=${1:?usage: build.sh SOURCE.asm [ORIGIN_BITS]}
|
|
ORIGIN=${2:-01870000}
|
|
NAME=$(basename "$SRC" .asm)
|
|
BASE=$(printf '%s' "$NAME" | tr 'a-z' 'A-Z')
|
|
WORK="$DIR/work"
|
|
OUT="$DIR/build"
|
|
IMG="$ROOT/tools/tms34010-sdk/1987-05 TMS34010 SDK/1987-11-06 TMS34010 Simulator-C Tools-ASM Tools.img"
|
|
DOSBOX_CONF="$ROOT/harness/sdk-scratch/dosbox-bench.conf"
|
|
|
|
mkdir -p "$WORK" "$OUT"
|
|
|
|
if [ ! -x "$WORK/GSPA.EXE" ]; then
|
|
mcopy -s -n -i "$IMG" "::/A2/*" "$WORK/"
|
|
mcopy -s -n -i "$IMG" "::/C2/*" "$WORK/"
|
|
fi
|
|
|
|
cp "$SRC" "$WORK/$BASE.ASM"
|
|
|
|
case "$ORIGIN" in
|
|
[0-9]*) ;;
|
|
*) ORIGIN="0$ORIGIN" ;;
|
|
esac
|
|
|
|
printf '%s\n' \
|
|
'-a' \
|
|
"-o $BASE.out" \
|
|
"-m $BASE.map" \
|
|
"$BASE.obj" \
|
|
'SECTIONS' \
|
|
'{' \
|
|
" .text ${ORIGIN}h: {}" \
|
|
'}' > "$WORK/$BASE.CMD"
|
|
sed -i 's/$/\r/' "$WORK/$BASE.CMD"
|
|
|
|
rm -f "$WORK/$BASE.OBJ" "$WORK/$BASE.OUT" "$WORK/$BASE.LST" \
|
|
"$WORK/$BASE.MAP" "$WORK/$BASE.HI" "$WORK/$BASE.LO"
|
|
|
|
SDL_VIDEODRIVER=dummy SDL_AUDIODRIVER=dummy \
|
|
timeout 180 dosbox -conf "$DOSBOX_CONF" -noprimaryconf -nolocalconf \
|
|
-c "mount c $WORK" -c "c:" \
|
|
-c "gspa $BASE $BASE.obj $BASE.lst -l" \
|
|
-c "gsplnk $BASE.cmd" \
|
|
-c "exit" -exit >/dev/null 2>&1
|
|
|
|
if [ ! -f "$WORK/$BASE.OUT" ]; then
|
|
echo "build.sh: GSPLNK produced no $BASE.OUT" >&2
|
|
exit 1
|
|
fi
|
|
if grep -q '\*\*\*\*\*' "$WORK/$BASE.LST" 2>/dev/null; then
|
|
echo "build.sh: assembler diagnostics:" >&2
|
|
grep -n '\*\*\*\*\*' "$WORK/$BASE.LST" >&2
|
|
exit 1
|
|
fi
|
|
|
|
python3 "$ROOT/harness/hello-world/cofextract.py" "$WORK/$BASE.OUT" "$OUT/$NAME.bin"
|
|
sed 's/\r$//' "$WORK/$BASE.MAP" > "$OUT/$NAME.map"
|
|
cp "$WORK/$BASE.LST" "$OUT/$NAME.lst"
|
|
echo "build.sh: $OUT/$NAME.bin ($(wc -c < "$OUT/$NAME.bin") bytes) at bit $ORIGIN"
|