mirror of
https://git.k-space.ee/arti/vt1200.git
synced 2026-10-30 12:03:54 +02:00
The 16-bit-displacement jump (low byte 0x00, two words) is JRcc, not the three-word JAcc (low byte 0x80). Printing it as ja made linear disassembly report the wrong control flow and made every such branch grow by a word when reassembled. Register 15 is the stack pointer in either file: 0x0F is A15 and 0x1F is B15. The disassembler printed both as sp, hiding B-file stack-pointer code. Print b15 when the R bit selects the B file. Validated with the 1987 TI GSPA/GSPLNK/GSPROM round trip: the 32 KB region at bit 3F208000 still reassembles byte-for-byte (md5 43adb6669571041985f3e26fd9ff7cb9), as do the 4 KB and 16 KB spans and the 0x8000/3F240000 region. The converter no longer needs its ja->jr or sp->b15 rewrites (5 fixups -> 3); a whole-ROM diff contains only those two output categories. The ROM is unchanged (b46a3e442ccb86134d2356bd70d22fd2).
24 lines
750 B
Bash
Executable File
24 lines
750 B
Bash
Executable File
#!/bin/sh
|
|
# Build the reference binaries used by verify_dis.py.
|
|
#
|
|
# work/dis34.orig - the pre-fix dis34 (from the checkpoint commit)
|
|
# work/dis34.sponly - the same source with *only* the B-file SP fix applied
|
|
#
|
|
# Usage: prepare_work.sh [GIT_REV]
|
|
set -eu
|
|
|
|
ROOT=$(cd "$(dirname "$0")/../.." && pwd)
|
|
DIR=$(cd "$(dirname "$0")" && pwd)
|
|
WORK="$DIR/work"
|
|
REV=${1:-acb92d3e44ec}
|
|
|
|
mkdir -p "$WORK"
|
|
git -C "$ROOT" show "$REV:tools/smart34010/dis34.c" > "$WORK/dis34.orig.c"
|
|
cc -Wall -O2 -o "$WORK/dis34.orig" "$WORK/dis34.orig.c"
|
|
|
|
sed 's/strcpy (p, "sp");/strcpy (p, file ? "b15" : "sp");/' \
|
|
"$WORK/dis34.orig.c" > "$WORK/dis34.sponly.c"
|
|
cc -Wall -O2 -o "$WORK/dis34.sponly" "$WORK/dis34.sponly.c"
|
|
|
|
echo "built $WORK/dis34.orig and $WORK/dis34.sponly"
|