Live data from Hacker News

Sectorforth is a 16-bit x86 Forth that fits in a 512-byte boot sector (2020)

github.com

1–10 of 17 posts

Re: Sectorforth is a 16-bit x86 Forth that fits in a 512-byte boot sector (2020)

#6
post #5
post #2

Not that impressive considering this uses BIOS routines heavily and whole operating systems including basic interpreter fit in a couple of KiB

512 bytes is quite a bit less than "a couple of kilobytes"

It's much better than 512, it fits in 336 bytes iirc.

Re: Sectorforth is a 16-bit x86 Forth that fits in a 512-byte boot sector (2020)

#7
post #4

Eight primitives and a colon compiler in 512 bytes is a nice demonstration of how much you can bootstrap from almost nothing. The examples building up from there are the best part.

Really shows how approachable it would have been to have just a tiny bit more added to the API of 'PC BIOS' to make for an extremely portable driver platform system to allow OS independent arbitrary hardware drivers as Forth that the system BIOS could compile at boot and run beneath the OS. Though of course the PC BIOS API from when that mattered isn't in anything like a modern protect mode operating profile.

Re: Sectorforth is a 16-bit x86 Forth that fits in a 512-byte boot sector (2020)

#8
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 )
   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  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.

Re: Sectorforth is a 16-bit x86 Forth that fits in a 512-byte boot sector (2020)

#9
post #8

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.be…

Any opinion on which Forth implementation is good for 8-bit CPUs, in particular 8051?
Post reply on HN