mirror of
https://git.k-space.ee/arti/vt1200.git
synced 2026-10-30 12:03:54 +02:00
Andrew Morton's Unix-hosted assembler/linker for the TMS34010, fetched from the gsptools archive and patched to build on x86-64. The K&R sources silently truncate pointers there: implicit int parameter declarations and fixed-argument printf wrappers. The patch fixes those and the flex 2.6 yy_init mismatch. hello.as34.g is harness/hello-world/hello.asm in as34 syntax. as34/ld34 reproduce the GSPA-built payload byte-for-byte (82 bytes, md5 db91788991ebba476b55a11127a36475), and the MAME hello.lua run reports the same markers, the same 1024-word VRAM block and a byte-identical frame. build.sh downloads the upstream tarball at build time (sha256 pinned); the tree is not vendored.
62 lines
2.0 KiB
Bash
Executable File
62 lines
2.0 KiB
Bash
Executable File
#!/bin/sh
|
|
# Build as34 (assembler), ld34 (linker) and dis34 (disassembler) from Andrew
|
|
# Morton's gsptools, patched to build on a 64-bit Linux host.
|
|
#
|
|
# Everything is fetched/built under tools/as34/build (override with
|
|
# AS34_BUILD_DIR) so the repository tree stays clean.
|
|
#
|
|
# The upstream tarball is an UNCOMPRESSED tar with a .tar.gz name; that is
|
|
# how the Wayback Machine archived it.
|
|
set -eu
|
|
|
|
here=$(cd "$(dirname "$0")" && pwd)
|
|
builddir=${AS34_BUILD_DIR:-"$here/build"}
|
|
tarball="$builddir/gsp.tar.gz"
|
|
srcdir="$builddir/src"
|
|
treesrc="$srcdir/gsp/binutils"
|
|
|
|
TARBALL_SHA256=efff8e59f7e3bf0285c4bd44d63e2357d6c26a85d939d4843d6be3471af9ef46
|
|
TARBALL_URL="https://web.archive.org/web/20070206220404if_/http://www.zip.com.au/~akpm/gsp.tar.gz"
|
|
|
|
mkdir -p "$builddir"
|
|
|
|
if [ ! -f "$tarball" ]; then
|
|
echo "fetching $tarball"
|
|
curl -fL --max-time 300 -o "$tarball" "$TARBALL_URL"
|
|
fi
|
|
|
|
echo "$TARBALL_SHA256 $tarball" | sha256sum -c -
|
|
|
|
if [ ! -d "$treesrc" ]; then
|
|
mkdir -p "$srcdir"
|
|
tar xf "$tarball" -C "$srcdir"
|
|
fi
|
|
|
|
if [ ! -f "$srcdir/.patched" ]; then
|
|
patch -p1 -d "$srcdir/gsp" < "$here/as34-port.patch"
|
|
touch "$srcdir/.patched"
|
|
fi
|
|
|
|
# -std=gnu17: C23 removed K&R definitions, which this 1998 code uses.
|
|
# -fcommon: the sources rely on tentative definitions being merged.
|
|
# as34 needs -DBISON to select the flex/bison input path in as.l.
|
|
CC_BASE="gcc -std=gnu17 -O2 -fcommon \
|
|
-Wno-implicit-function-declaration -Wno-int-conversion \
|
|
-Wno-incompatible-pointer-types -Wno-builtin-declaration-mismatch \
|
|
-Wno-implicit-int -Wno-return-mismatch -Wno-format -Wno-unused-result"
|
|
|
|
echo "building as34"
|
|
make -C "$treesrc/as34" clean >/dev/null 2>&1 || true
|
|
make -C "$treesrc/as34" \
|
|
CC="$CC_BASE -DBISON" \
|
|
XCFLAGS="-include $here/proto.h"
|
|
|
|
echo "building ld34 and dis34"
|
|
make -C "$treesrc/ld34" clean >/dev/null 2>&1 || true
|
|
make -C "$treesrc/ld34" ld34 CC="$CC_BASE"
|
|
make -C "$treesrc/ld34" dis34 CC="$CC_BASE"
|
|
|
|
echo
|
|
echo "built:"
|
|
ls -l "$treesrc/as34/as34" "$treesrc/ld34/ld34" "$treesrc/ld34/dis34"
|