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


README.md (2308 bytes)

1 # forthlisp-z80
2 
3 The same four layers as [forthlisp-stm32](https://github.com/equwal/forthlisp-stm32), for a
4 Z80 with a 64 KiB address space. A Z80 assembler in SBCL builds a Forth kernel written
5 from scratch, and a Z80-sized Scheme loads through that Forth. No third-party Forth.
6 
7 ```
8  4  LISP     lisp.fs + prelude.scm: a Z80-sized R7RS-small subset, loaded through the console
9  3  FORTH    kernel.lisp: an indirect-threaded Forth in Z80 assembly
10  2  SBCL     asm.lisp: a two-pass Z80 assembler in SBCL (test-asm.lisp checks it
11              against z80pack's z80asm)
12  1  ASM      Z80 instructions
13 ```
14 
15 ## Quickstart
16 
17 ```sh
18 git clone https://github.com/equwal/forthlisp        # the core, next to this repo
19 git clone https://github.com/equwal/forthlisp-z80
20 cd forthlisp-z80
21 ./build-emu.sh             # fetch and build z80pack cpmsim + z80asm (MIT) in ~/src/z80pack
22 ./z80-forth                # the kernel's own prompt
23 ./z80-lisp                 # Scheme:  (+ 1 2)  ->  3
24 ./test.sh                  # assembler, kernel words, conformance
25 ```
26 
27 Needs SBCL, a C compiler, git and `nc`. Override the tools with `SBCL`, `Z80PACK`,
28 `CPMSIM`, `Z80ASM`, `NC`, `STTY`. `PORT` picks the emulator's TCP console port.
29 
30 ## Emulator
31 
32 z80pack's `cpmsim` (MIT licence, by Udo Munk) runs headless with its console on a TCP
33 port. `build-emu.sh` clones it and makes three small build edits, explained in `NOTES.md`.
34 The emulator is fetched, not vendored.
35 
36 ## Tests
37 
38 - assembler encodings vs `z80asm`;
39 - kernel words over the console;
40 - the core's `r7rs-tests.scm`.
41 
42 `NOTES.md` gives the counts and every limit: heap size, integer range, line length,
43 stack depth.
44 
45 ## Influences
46 
47 - Paul Khuong, "SBCL: the ultimate assembly code breadboard"
48   (https://pvk.ca/Blog/2014/03/15/sbcl-the-ultimate-assembly-code-breadboard/)
49 - Ron Garret, gll-mag-patch (https://github.com/rongarret/gll-mag-patch)
50 - Ron Garret, "Lisping at JPL" (https://flownet.com/gat/jpl-lisp.html)
51 
52 ## Licence
53 
54 MIT (see `LICENSE`). z80pack is not part of this repo; `build-emu.sh` downloads it under
55 its own MIT licence.
56 
57 ## CI
58 
59 `ci-local.sh` (in the forthlisp core repo) runs every test layer of all three repos in a
60 clean `ubuntu:24.04` container. It runs after each publish, without a hosted CI service.
61 The last result is on https://dickt.store/forthlisp/.