aforth

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

commit 8cba17fe91abc37a6a8365565c9df07fe72aecc3
parent 429c8bd416004eb1e9f6c0b0366d122a751b62ca
Author: Henry Wilson <m3henry@googlemail.com>
Date:   Sat, 17 Jun 2017 00:15:59 +0100

added ...

Diffstat:
Mmain.s | 35+++++++++++++++++++++++++++++------
1 file changed, 29 insertions(+), 6 deletions(-)

diff --git a/main.s b/main.s @@ -77,16 +77,14 @@ dottest: forthword inputtest: forthword do tib - debug do dup do dup do load do swap const 8 do plus - debug do swap - debug + do dotdot do accept # do drop do dot @@ -127,7 +125,7 @@ star: forthword tib: forthword # scratch 80 - string "_______________________________________________________________" + string "________________________________________________________________________________" endword cr: forthword @@ -155,6 +153,26 @@ _dot: forthword do emit endword +dotdot: forthword + string "..." + do print + do _dotdot + do cr + endword + +_dotdot: forthword + do top + test equal stack 1f + do drop + do pushret + do _dotdot + do popret + const '\t' + do emit + do dup + do dot +1: endword + buff: .quad stack: .skip 1024 #1048576 @@ -187,6 +205,10 @@ stack: .skip 1024 #1048576 .set ARGA, %rdi .set ARGB, %rsi .set ARGC, %rdx + .set ARGD, %r10 + .set ARGE, %r8 + .set ARGF, %r9 + # Stack manipulation @@ -313,13 +335,14 @@ bangb: codeword jmp _drop2 top: codeword + push SP _dup - mov SP, TOS + pop TOS jmp next pushret: codeword push TOS - jmp drop + jmp _drop popret: codeword _dup