Recently Written · git

forthlisp-z80

Z80 target for forthlisp: Z80 Forth kernel built by an SBCL assembler, z80pack cpmsim

git clone https://github.com/equwal/forthlisp-z80

Log | Files | Refs


z80-lisp (931 bytes)

1 #!/bin/sh
2 # z80-lisp -- boot the Z80 Forth, load the Scheme (lisp.fs + prelude.scm) through it, attach its REPL.
3 # PORT picks the TCP port of the emulated serial console (default 4455). Quit with ctrl-c.
4 set -e
5 SRC=$(cd "$(dirname "$0")" && pwd)
6 PORT=${PORT:-4455}
7 IMG=$SRC/kernel.mos
8 [ -x "${Z80PACK:-$HOME/src/z80pack}/cpmsim/cpmsim" ] || "$SRC/build-emu.sh" >&2
9 [ "$IMG" -nt "$SRC/kernel.lisp" ] && [ "$IMG" -nt "$SRC/asm.lisp" ] || "${SBCL:-sbcl}" --script "$SRC/kernel.lisp" "$IMG" >/dev/null
10 EPID=$(PORT=$PORT "$SRC/emu.sh" "$IMG")
11 trap 'kill $EPID 2>/dev/null; ${STTY:-stty} sane 2>/dev/null' EXIT HUP INT TERM
12 sleep 0.5   # let cpmsim open its listening socket
13 PORT=$PORT "${SBCL:-sbcl}" --script "$SRC/host.lisp" load
14 printf 'Z80 Scheme ready: type an expression, (forth) returns to Forth, ctrl-c quits\n> '
15 ${STTY:-stty} -echo -icanon 2>/dev/null || true   # the kernel echoes; no tty when piped
16 ${NC:-nc} 127.0.0.1 $PORT