aforth

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

commit 3b30307c5f3b6f51b17647d107fc844ef16087f8
parent 21b624f1a3a098eb8e2f54572b7d46a3ff388db9
Author: Henry Wilson <m3henry@googlemail.com>
Date:   Thu, 13 Jul 2017 18:38:38 +0100

downwards growing stack

Diffstat:
Mmacros.i | 6+++---
Mmain.s | 15++++++++-------
2 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/macros.i b/macros.i @@ -129,7 +129,7 @@ # Stack manipulation .macro _dup - advance SP + retreat SP mov TOS, (SP) .endm @@ -156,8 +156,8 @@ verb code \name "\altname\()" .endm .macro minstk depth:req - cmp $stack + ( \depth * 8 ), SP - jge 1f + cmp $stack - ( \depth * 8 ), SP + jle 1f mov $_uflow, IP jmp next 1: diff --git a/main.s b/main.s @@ -423,15 +423,15 @@ verb code DUP verb code drop2 "2DROP" minstk 2 -_drop2: retreat SP +_drop2: advance SP mov (SP), TOS - retreat SP + advance SP jmp next verb code DROP minstk 1 _drop: mov (SP), TOS - retreat SP + advance SP jmp next _uflow: do RESETDATA @@ -547,8 +547,8 @@ dountil: codeword # Memory management verb code DEPTH - mov SP, ACC - sub $stack, ACC + mov $stack, ACC + sub SP, ACC shr ACC shr ACC shr ACC @@ -735,13 +735,14 @@ verb code EXECUTE minstk 1 mov TOS, WP mov (SP), TOS - retreat SP + advance SP jmp *(WP) # "STACK" -stack: .skip 1048576 + .skip 1048576 +stack: .quad 0 # "CORE VARIABLES"