DSCF

.co.uk

PC32

A ColorForth compiler and editor for x86-64
git clone https://dscf.co.uk/clone/PC32.git
Back | Log | Files | Refs | Issues

PC32 ColorForth - Linux and Windows builds

A simple ColorForth compiler and editor for x86, it assembles its own instructions and runs fairly fast, this repo contains the ported version that should build on modern x64 linux and windows machines, original targets were debian 10 and windows 7.

Warning In order to build in modern systems it will pull the Debian 10 32bit toolchain into a local folder, this install is fairly large but can be deleted when the program is built(see make slim down below)

Requirements (host)

Targets

Run make help for this table.

Linux
make build ./a.out and the runtime bundle lib32/
make run build and run (./run.sh)
make appimage PC32-x86_64.AppImage (the program + bundle in one file)
make install install the PC32 command (default PREFIX=~/.local, no root; sudo make install PREFIX=/usr/local for all users)
make uninstall remove it again
make slim delete sysroot32/ (~600 MB, only needed to build)
Windows
make win cross-compile PC32.exe: one static 32-bit exe, Windows 7+ (32/64-bit)
make windist PC32-win32.zip: exe + a copy of the current data.blk + data/MC.bin + short readme
make winslim delete mingw/ (~370 MB, only needed to build)
make winclean remove PC32.exe and its objects
Both
make linuxdist PC32-linux-src.zip: source package (code, makefiles, tools, the PDF manual, vendored GLFW, data.blk, and a data/ with fnt.bin, sine.bin and MC.bin); unzip it and run make
make dist AppImage + Windows zip + Linux source zip
make clean / make distclean remove objects / everything generated (also the downloaded toolchains)

make appimage downloads appimagetool and the AppImage runtime into tools/appimage/ on first use.

How the Linux build works

How the Windows build works

Data files

Only data.blk (source/state) is needed. It is read and written in the working directory. The font (fnt.bin), the sine table (sine.bin) and the memory regions are built into the program, so no other file is required. data/MC.bin is shipped as example data for the Forth examples that use it (it is optional; if a word opens a missing file, copen creates it empty).

The AppImage and the Windows exe keep data.blk OUTSIDE the program, in the folder next to it (AppImage: override with PC32_DIR=/some/dir). The AppImage creates data.blk and data/MC.bin there on first run from copies bundled at build time. The Windows zip contains PC32.exe, data.blk and data/MC.bin.

Using the installed PC32 command

After make install, run PC32 in any folder that has a data.blk; it uses that folder's data.blk (and data/ for examples), so you can keep several projects in separate folders. PC32 --new creates a fresh data.blk and data/MC.bin there (it never overwrites). The program, its 32-bit loader/libraries and the seed files live in PREFIX/share/PC32 (about 93 MB on disk), the launcher is PREFIX/bin/PC32; if PREFIX/bin is not in your PATH, make install says so. Any extra argument (e.g. PC32 -w) starts a normal window instead of a maximized one.

Manual

docs/PC32_Manual.pdf describes how the compiler and the data.blk block format work.

Debugging