aforth

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

commit f788f8f17a41845687f0743965502d0802a72af3
parent 135d2474e73f3a0a6d02048cb32f4c798244136d
Author: Henry Wilson <m3henry@googlemail.com>
Date:   Tue,  1 Aug 2017 20:57:38 +0100

flags in the top 16-bits of addresses

Diffstat:
Mcompiler.s | 27+++++++++++++++++++++++++--
Minterpreter.s | 6+++---
Mmemory.s | 2++
3 files changed, 30 insertions(+), 5 deletions(-)

diff --git a/compiler.s b/compiler.s @@ -4,6 +4,12 @@ verb forth HERE variable endword +.macro hereflg flags:req + get HERE + const \flags + do SETFLAGS +.endm + verb forth modeI "[" immediate set MODE 0 endword @@ -132,13 +138,13 @@ verb forth plusloop "+LOOP" immediate verb forth IF "IF" immediate compile iszero compile dobranch - get HERE + hereflg 'I' compile 0 endword verb forth ELSE "ELSE" immediate compile dogoto - get HERE + hereflg 'I' compile 0 do SWAP get HERE @@ -151,3 +157,20 @@ verb forth THEN "THEN" immediate do SWAP do store endword + +#verb forth STRIPFLAGS +# const 0x0000FFFFFFFFFFFF +# do AND +# endword + +verb forth GETFLAGS + const 0x0001000000000000 + do divide + endword + +verb forth SETFLAGS + const 0x0001000000000000 + do mult + do OR + endword + diff --git a/interpreter.s b/interpreter.s @@ -33,8 +33,8 @@ verb forth INTERPRET 5: get MODE unless 2f const docon - do COMPILE - do COMPILE + do comma + do comma goto 2f 1: do DUP const 8 @@ -45,7 +45,7 @@ verb forth INTERPRET if 1f do EXECUTE goto 2f - 1: do COMPILE + 1: do comma 2: get numin get numtib do less diff --git a/memory.s b/memory.s @@ -13,6 +13,8 @@ fetchb: codeword verb code store ">@" minstk 2 + mov $0x0000FFFFFFFFFFFF, ACC + and ACC, TOS mov (SP), ACC mov ACC, (TOS) jmp _drop2