commit d8ae74c37d320bf84a644ec007acc138e7caf0b3
parent a52f12979a0b6a8f60457ce7de04b838044107ec
Author: Henry Wilson <m3henry@googlemail.com>
Date: Sat, 10 Jun 2017 16:28:30 +0100
so many stars
Diffstat:
2 files changed, 28 insertions(+), 11 deletions(-)
diff --git a/README.md b/README.md
@@ -1 +1,5 @@
# aforth
+
+A FORTH written in assembly language
+
+Written by Henry Wilson
diff --git a/main.s b/main.s
@@ -1,7 +1,17 @@
.data
-dict:
+cold: .8byte enter
+_cold: .8byte abort
+
+abort: .8byte enter
+ .8byte quit
+
+quit: .8byte enter
.8byte star
+ .8byte doloop
+ .8byte 16
+
+dict: .8byte star
.8byte star
.8byte cr
.8byte star
@@ -82,11 +92,21 @@ exit: .8byte . + 8
pop IP
jmp next
+docon: .8byte . + 8
+ mov TOS, (SP)
+ add $8, SP
+ mov (IP), TOS
+ add $8, IP
+ jmp next
+doloop: .8byte . + 8
+ sub (IP), IP
+ jmp next
-_start:
- mov $stack, SP
- mov $dict, IP
+ .text
+
+_start: mov $stack, SP
+ mov $_cold, IP
next:
mov (IP), WP
add $8, IP
@@ -101,10 +121,3 @@ enter:
execute: # not done!
mov TOS, WP
jmp _drop
-
-docon: .8byte . + 8
- mov TOS, (SP)
- add $8, SP
- mov (IP), TOS
- add $8, IP
- jmp next