aforth

FORTH for Linux x86-64, written in assembly.
git clone git://henryandlizzy.uk/aforth
Log | Files | Refs | README

commit 217130d581612aaf8cb26562749cffd250ef16dc
parent 68df549b136c0c2f6d459246f16fb6ce164be111
Author: Henry Wilson <m3henry@googlemail.com>
Date:   Sun, 30 Jul 2017 14:27:04 +0100

added immediacy to word header

Diffstat:
Mmacros.i | 14++++++++------
Mmain.s | 13+++++++++++--
2 files changed, 19 insertions(+), 8 deletions(-)

diff --git a/macros.i b/macros.i @@ -2,7 +2,7 @@ .quad \label .endm -.macro forthword name +.macro forthword do enter .endm @@ -98,17 +98,19 @@ do plus .endm -.macro verb type:req name:req altname end -.ifnb \end - .quad 0 -.else +.macro verb type:req name:req altname immediate .quad 7b - 8 -.endif .ifnb \altname 7: strlit "\altname\()" .else 7: strlit "\name\()" .endif +.ifnb \immediate + .quad -1 +.else + .quad 0 +.endif + \name\(): \type\()word .endm diff --git a/main.s b/main.s @@ -41,7 +41,10 @@ enter: .data -verb forth COLD "COLD" end + .quad 0 +7: strlit "COLD" + .quad 0 +COLD: forthword _cold: do RESETDATA escape 0 escape 96 @@ -88,6 +91,10 @@ verb forth numin "\#IN" variable endword +verb forth MODE + variable + endword + verb forth INTERPRET set numin 0 3: do WORD @@ -116,7 +123,9 @@ verb forth INTERPRET do CR do ABORT goto 2f - 1: do EXECUTE + 1: const 8 + do plus + do EXECUTE 2: get numin get numtib do less