/immu

An implementation of Forth using minimal thread code, with a dictionary made up of machine-independent vocabularies. Only those relating to bios, system, drives and primitives depend on the machine.

Primary LanguageAssemblyGNU General Public License v2.0GPL-2.0

immu

18/08/2024 I'm doing a full review of those files and MTC

See milliforth-6502

01/05/2024 I'm on vacancy for refresh some ideas

An implementation of Forth with inner interpreter using minimal indirect thread code and a dictionary made of machine independent vocabularies.

Only the inner interpreter and vocabularies related to systems, drives and primitives are machine dependent.

The Minimal Thread Code gives to Forth inner interpreter the decision of when use "push and pull" or "jump and link".

More information in Details

In 2023, the immu Forth was splitted for ISAs: 6502, Atmega328, and RiscV.

In september, 2023, a better code for MTC was born, using deep-first search.

See a presentation at the words in MTC

Go Slow

Ideally Forth was two types of words, primitives, aka leafs, that does not reference any forth word, and compounds, aka twigs, that are a list of references to forth words.

Usually leafs are CPU/MCU ISA dependents.

For now, immu just does the MTC and primitives:

    FALSE TRUE AND OR XOR SHR SHL NEGATE INVERT
    0= 0< = < + - UM+ U< U* (UM*) U/ (UM/MOD)
    >R R> R@ SP@ SP! RP@ RP! DROP ?DUP DUP OVER SWAP ROT 
    BRANCH ZBRANCH LIT EXEC JUMP ALIGN 
    0 1 2 4 1+ 2+ 4+ 1- 2- 4- >< (NIBBLE)
    CHAR CHAR+ CHAR- CELL CELL+ CELL-

Some minimal BIOS support for ( in schedule )

    KEY?, KEY, EMIT, 
    IO!, IO@, IRQ? ( for read/write devices and interrupts )
    clock, tick ( for timers )
    flash flush ( for read/write flash memory )

For mixed code, not really a good practice ( in schedule )

    :code ;code ( for inline assembler )

mixed

Need a primitive word to allow create new primitives. Something for 'jump to following address' and for 'resume to compound mode', two words.

In Fig-Forth was ;CODE and must be the last piece in a compound word. What about if need be in the middle ?

'Jump-to-following address' is: POSTPONE BRANCH , HERE CELL CELL + + ,

Working

I'm requesting for comments about immu and Minimal Thread Code for Forth.

I welcome your patience.

There are some insights and documentation at https://github.com/agsb/immu/tree/main/docs

For known about Forth Style

image

Imagem de Dean Marston por Pixabay