HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
howerj
subleq
Forth2023–2026
howerj / subleq

subleq

16-bit SUBLEQ CPU running eForth - just for fun

3Distinct people
11Mentions
1Explicit recommenders
83GitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

16-bit SUBLEQ CPU running eForth - just for fun

GitHub

Where it is used

No documented product use has been verified yet.

What people are saying

I love both Forth and Lisp but SectorLisp it's far better. Also, for a small demo, check Eforth under Subleq/Muxleq: https://github.com/howerj/subleq edit subleq.fth/muxleq.fth…

anthk used a recommendation phrase. One indexed comment matches. This is a phrase match, not a verdict.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

Mentioned in the same Hacker News threads. That is not proof they are substitutes.

This week on Hacker News

Nov 7–Nov 14 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/14/2026, 3:56:07 PM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by year11 dated mentions

Observed mentions: 2023-01-02 05:11:37 UTC to 2026-08-20 12:09:33 UTC.

0123452023-01-01 00:00:00 UTC to 2024-01-01 00:00:00 UTC (exclusive): 1 mentions; 1 submissions, 0 comments20232024-01-01 00:00:00 UTC to 2025-01-01 00:00:00 UTC (exclusive): 2 mentions; 0 submissions, 2 comments20242025-01-01 00:00:00 UTC to 2026-01-01 00:00:00 UTC (exclusive): 5 mentions; 0 submissions, 5 comments2026-01-01 00:00:00 UTC to 2027-01-01 00:00:00 UTC (exclusive): 3 mentions; 0 submissions, 3 comments. Incomplete calendar period.2026*

* An incomplete calendar period is marked with an outlined bar. Its count is not directly comparable with a full period.

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
20232023-01-01 00:00:00 UTC2024-01-01 00:00:00 UTC110
20242024-01-01 00:00:00 UTC2025-01-01 00:00:00 UTC202
20252025-01-01 00:00:00 UTC2026-01-01 00:00:00 UTC505
2026 (partial)2026-01-01 00:00:00 UTC2027-01-01 00:00:00 UTC303

What Hacker News says

11 sources
anthk·Aug 20, 2026Recommendation phrase
I love both Forth and Lisp but SectorLisp it's far better. Also, for a small demo, check Eforth under Subleq/Muxleq: https://github.com/howerj/subleq edit subleq.fth/muxleq.fth and set these options to 1: 1 constant opt.multi ( Add in large "pause" primitive ) 1 constant opt.editor ( Add in Text Editor ) 1 constant opt.info ( Add info printing function ) 0 constant opt.generate-c ( Generate C code ) 1 constant opt.better-see ( Replace 'see' with better version ) 1 constant opt.control ( Add in more control structures ) 0 constant opt.allocate ( Add in "allocate"/"free" ) 1 constant opt.float ( Add in floating point code ) 0 constant opt.glossary ( Add in "glossary" word ) 1 constant opt.optimize ( Enable extra optimization ) 1 constant opt.divmod ( Use "opDivMod" primitive
Read the rest
) 0 constant opt.self ( self-interpreter [NOT WORKING] ) Then run this to create a new EForth image with float/do...loop and such: ./muxleq ./muxleq.dec < muxleq.fth > new.dec Subleq is the original one, muxleq it's multiplexed. The command it's the same, just replace muxleq with subleq (edit the fth file too). Usage: ./muxleq new.dec For a brief help: words On Forth syntax, the EForth Overview PDF will be enough, except for 8086 related code, where here it's different.
In Sectorforth is a 16-bit x86 Forth that fits in a 512-byte boot sector (2020)
Muxleq and Subleq: https://github.com/howerj/subleq https://github.com/howerj/muxleq Muxleq because of performance: cd muxleq cc -O2 -ffast-math -o muxleq muxleq.c Edit muxleq.fth, set these values like this: 1 constant opt.multi ( Add in large "pause" primitive ) 1 constant opt.editor ( Add in Text Editor ) 1 constant opt.info ( Add info printing function ) 0 constant opt.generate-c ( Generate C code ) 1 constant opt.better-see ( Replace 'see' with better version ) 1 constant opt.control ( Add in more control structures ) 0 constant opt.allocate ( Add in "allocate"/"free" ) 1 constant opt.float ( Add in floating point code ) 0 constant opt.glossary ( Add in "glossary" word ) 1 constant opt.optimize ( Enable extra optimization ) 1 constant opt.
Read the rest
divmod ( Use "opDivMod" primitive ) 0 constant opt.self ( self-interpreter [NOT WORKING] ) Then run: ./muxleq ./muxleq.dec < muxleq.fth > new.dec new.dec it's the enhanced SUBLEQ EForth image. To run it: ./muxleq new.dec For the available words, run words inside the interpreter. Enter bye to exit. Get Starting Forth but the ANS version (there's some PDF in search engines) and Thinking Forth.
In FORTH? Really!?
The easiest example: an interpreter for the Subleq VM. One instruction. Literal three or four lines, three more (if any) for I/O. https://github.com/howerj/subleq/ As a goodie you can run Eforth on top which almost writtes itself. Compiler, interpreter, editor, IDE and a Sokoban, all in a simple VM. Let's scale. Mu808/n808. Interpreters in C and AWK, a compiler in Python. https://codeberg.org/luxferre/n808 You have the exact assembly algorithm in the page. What you see it's what you get. Now, for real, I'd suggest getting lvltl (VTL-02) interpreter written in C for a "bigger" language running not just under a VM, but for small machines and simulators such as the 6502 based Kim-1 and Apple1. With that "not enough to be called Basic" a Sokoban might be written with a bit of patience.
In Revisiting "Let's Build a Compiler"
This is fun too https://github.com/howerj/subleq/ but you might need to edit subleq.fth and create a new image with some of the constants named opt.* settings set to 1 (enabled) in order to enable do...loop support and such. After you enabled them, try ./sublec ./sublrec.dec < ./sublec.fth > new.dec, wait a lot, and then run ./subleq sublec.dec . In order to save lots of time, clone the muxleq repo https://github.com/howerj/muxleq , edit muxleq.fth as always, and then run ./muxleq ./muxlec.dec < muxlec.fth > new.dec, and ./muxlec ./new.dec to run the new DEC EForth image. Is not especially fast but it's a ready to run Forth and the Subleq machine can be compiled even under Windows XP and up with Min-C or any bundled C compiled on GNU/Linux BSD, from cproc to tcc, gcc or clang. If some of your code runs fast under Muxleq+EForth,
Read the rest
it will fly under PForth and GForth. https://minc.commandlinerevolution.nl/english/home.html The speeds I get under an n270 atom with Muxleq are almost like a Forth machine under a boosted up 8 bit machine, kinda like an 8MHZ z80 with a native Forth, or a very low end M68k machine.
In Moving Forth: a series on writing Forth kernels
True. pas.f in Forth : .r u.r ; : position ( row -- ) cr 33 swap 2 * - spaces ; : pas ( 0 ... 0 -- 0 ... 0 ) 0 >r begin over + >r dup 0= until begin r> dup while dup 4 .r repeat ; : pass ( -- ) 0 1 0 18 0 ?do dup position >r pas r> 1+ loop drop ; : pax ( 0 ... 0 -- ) drop begin 0= until ; : pascal ( -- ) pass pax ; pascal cr The same mod2: : .r u.r ; : position ( row -- ) cr 33 swap 2 * - spaces ; : pas ( 0 ... 0 -- 0 ... 0 ) 0 >r begin over + >r dup 0= until begin r> dup while dup 2 mod 4 .r repeat ; : pass ( -- ) 0 1 0 18 0 ?do dup position >r pas r> 1+ loop drop ; : pax ( 0 ... 0 -- ) drop begin 0= until ; : pascal ( -- ) pass pax ; pascal cr A Forth for people in a hurry: git
Read the rest
clone https://github.com/howerj/subleq cd subleq sed -i 's,0 constant opt.control,1 constant opt.control,g' subleq.fth gmake subleq ./subleq subleq.dec < subleq.fth > new.dec ./subleq new.dec < pas.f
In Sierpiński Triangle? In My Bitwise and?
I wrote a Forth interpreter for a SUBLEQ machine (https://github.com/howerj/subleq), and for a bit-serial machine (https://github.com/howerj/bit-serial), both of which do not have a function call stack which is a requirement of Forth. SUBLEQ also does not allow indirect loading and stores as well and requires self-modifying code to do anything non-trivial. The approach I took for both machines was to build a virtual machine that could do those things, along with cooperative multithreading. The heap, if required, is written in Forth, along with a floating point word-set (various MCUs not having instructions for floating point numbers is still fairly common, and can be implemented as calls to software functions that implement them instead). I would imagine that other compilers took a similar approach which wasn't mentioned. EDIT: There were
Read the rest
some BASIC interpreters which did this as well, implementing a VM and then targetting that instead. P-Code is a similar thing.
In Subroutine calls in the ancient world, before computers had stacks or heaps
howerj·Jan 2, 2023Submission

Show HN: Computing with just one instruction – Forth on SUBLEQ

Hello HN, This is a project of mine which contains a working, self-hosting, Forth interpreter for a single instruction machine. The instruction is called "SUBLEQ", short for (SUB)tract and branch if (L)ess than or (EQ)ual. Everything has to be synthesized from that instruction, bitwise operators have to be implemented in terms of repeated subtraction and self modifying code used to create indirect loads and stores. In doing this it is possible to port a working language that is capable of generating new images for the machine. It's possible to play with it online at: https://howerj.github.io/subleq.htm (feedback welcome) The Forth is fairly feature full and includes cooperative multitasking.
5 points · Open discussion

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.