mforth

Short list of next tasks

  • Reimplement cursor for VBE display modes.

  • Build system improvements.

  • Investigate supporting keyboard shortcuts.

  • Investigate adding a status line to show stack contents.

  • Investigate display scrollback.

  • Investigate exceptions.

Overview

I’d heard of Forth in retrocomputing circles several years ago, but it wasn’t until early last year that I decided to try implementing one. The motivation for that was my 16-bit real mode operating system, which needed a system shell. The constraints of that environment made it hard for me to progress.

I’ve more recently gotten more interested in the 386 and 68000 CPUs, so I’d like to have a sandbox environment to work with later PC compatibles and possibly the Amiga. So mforth is my 2nd attempt at writing a Forth, this time targeting the 386.

This page is a companion to my Twitch and YouTube development streams. The video stream format isn’t conducive to sharing background information and context, so this page should help close that gap.

Diagrams

Dictionary data structures

dict data structure

Interpreter

Quit

quit

Evaluate

evaluate

2024-06-19

2024-06-18

  • Fix bugs in ' word.

  • Implement abort, abort"

  • Add support for defining data structures.

  • Begin work for VBE display resolutions and bitmap fonts.

2024-06-13

  • Support single stepping through words in debugger using keyboard.

  • Make debugger work with words that modify the return stack.

  • Implement S>D, SM/REM, MOD words

2024-06-12

  • Change here and allot from JonesForth to ANS forth implementations.

  • Add a few words and enable Forth 2012 tests for them.

2024-06-11

  • Implement parse. Rewrite other words to use it.

  • Implement key to get keyboard input.

2024-06-10

  • Add prototype ELF parser. Ultimate purpose is to use debug symbols at runtime.

2024-06-07

  • Implement >in and source.

2024-06-06

  • Jones Forth’s implementation of create requires the new word to be on the stack before it’s executed. Most forths get the word to be created by taking it from the input stream after create. Changed create to use the latter method.

2024-06-05

  • Added a data stack underflow check. The system panics in the event of a stack underflow.

  • There was a bug in the parser for literals. Instead of fixing it in assembly, I rewrote the literal parser in C, fixing the bug in the process.

  • Investigated work for implementing an x86 assembler in forth. The simple strategy of assembling code into a forth dictionary entry and jumping to it fails, because the new code is in a non-executable data segment.

  • Rewrote the keyboard input driver, fixing a bug with hangs/missed keystrokes in the process.

  • Enabled some new tests from the forth 2012 test suite.