aforth

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

commit 9cd8622ef9beaa5c12c0a0d62c2b5e806557fef0
parent ff88c27be959921406b6e9751e0fc0a53edcf784
Author: Henry Wilson <m3henry@googlemail.com>
Date:   Tue, 20 Jun 2017 03:58:22 +0100

interactive mode

Diffstat:
Mmain.s | 73+++++++++++++++++++++++++++++++++++--------------------------------------
Mmakefile | 3+++
2 files changed, 38 insertions(+), 38 deletions(-)

diff --git a/main.s b/main.s @@ -121,7 +121,19 @@ verb forth ABORT verb forth QUIT const 10 const 4 - do inputtest +2: do TIB + const 80 + say "? " + do ACCEPT + test equal 0 1f + set numtib + do INTERPRET + do dotdot + goto 2b +1: saycr "Done." + do HALT + +verb forth INTERPRET set numin 0 1: do WORD do FIND @@ -129,27 +141,7 @@ verb forth QUIT get numtib do less if 1b - do dotdot - saycr "Done." - do HALT - -inputtest: forthword - do TIB - do DUP - const 80 - say "Enter something: >" - do ACCEPT - do DUP - set numtib - do CR - say "Read " - do DUP - do dot - saycr " characters." - - say "[" - do TYPE - saycr "]" + saycr " ok" endword verb forth WORD @@ -160,23 +152,23 @@ verb forth WORD get numtib do gequal if 3f - do TIB - get numin - do plus - do fetchb - do numin - do incaddr - do DUP - const ' ' - do equal - if 2f - do PAD + do TIB + get numin + do plus + do fetchb + do numin do incaddr - do OVER - do storeb - do inc - goto 1b -2: do DROP + do DUP + const ' ' + do lequal + if 2f + do PAD + do incaddr + do OVER + do storeb + do inc + goto 1b + 2: do DROP 3: do DROP do PAD endword @@ -230,6 +222,11 @@ verb forth STAR do EMIT endword +verb forth SPACE + const ' ' + do EMIT + endword + verb forth PAD scratch 90 endword diff --git a/makefile b/makefile @@ -2,6 +2,9 @@ all: bin/aFORTH @echo Testing... @/bin/echo -ne "+ . CR WORDY GREET" | bin/aFORTH +interactive: bin/aFORTH + @bin/aFORTH + bin/aFORTH: obj/main.o @echo Linking... @ld -o bin/aFORTH obj/main.o