Files
vt1200/dwt/gui/build.sh
T
SDD a5769d3d2e dwt: GUI/X architecture note; Xlib callable but XOpenDisplay hangs
Static: the VT1200 GUI is an X11 dix server in ROM plus Xlib clients
(SERVER, SESSIONMGR/Terminal Manager, WM, VTE).  Internal clients use the
local service "xserver" via the display string "0::0"; TCP 6000 is a
separate authorised listener.  Function table and the 4-call hello-window
sequence are in dwt/notes/GUI_APPS.md.

Dynamic: a poke+jump payload proved the firmware ABI (strlen=4) and then
called XOpenDisplay; it never returns (stage 2, display 0, X-server client
watermark unchanged) and the rdebug service dies.  Verdict: hard for a
self-contained window; shared-RAM UI mutation (opcode 8) is the working
route.
2026-10-18 14:08:42 +03:00

76 lines
2.2 KiB
Bash
Executable File

#!/bin/sh
# Build a VT1200 payload with the 1987 TI TMS34010 SDK (GSPA/GSPLNK under
# DOSBox) -- the same flow as harness/hello-world/build.sh and
# dwt/visual/build.sh, but with all scratch/output under dwt/gui/.
#
# dwt/gui/build.sh SOURCE.asm [ORIGIN_BITS]
#
# Output: dwt/gui/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:-01840000}
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 [ ! -f "$WORK/$BASE.OBJ" ]; then
echo "build.sh: GSPA produced no $BASE.OBJ" >&2
grep -n '\*\*\*\*\*' "$WORK/$BASE.LST" >&2 || true
exit 1
fi
if grep -q '\*\*\*\*\*' "$WORK/$BASE.LST"; 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"