summaryrefslogtreecommitdiff
path: root/sanctuary.s
diff options
context:
space:
mode:
Diffstat (limited to 'sanctuary.s')
-rw-r--r--sanctuary.s46
1 files changed, 45 insertions, 1 deletions
diff --git a/sanctuary.s b/sanctuary.s
index ad8720f..5859ac1 100644
--- a/sanctuary.s
+++ b/sanctuary.s
@@ -1,7 +1,51 @@
; sanctuary
-section .bss
+; macros {{{
+; in this forth pspush and pspop are only necessary if you need to
+; go deeper into the stack.
+; TODO: error handling (once i add that)
+%macro pspush 1
+ lea r14, [r14-8]
+ mov qword [r14], r15
+ mov r15, %1
+%endmacro
+
+%macro pspop 1
+ mov %1, r15
+ mov r15, qword [r14]
+ lea r14, [r14+8]
+%endmacro
+
+%define s_latest 0
+
+%macro defdict 3 ; name label flags
+ %strlen slen %1
+ global lfa_%2
+ lfa_%2: dq s_latest
+ %define s_latest lfa_%2
+ ffa_%2: db %3
+ nfa_%2: db slen
+ db %1
+%endmacro
+%macro defcode 3
+ defdict %1, %2, %3
+ %2:
+%endmacro
+
+; this is just taken from jewelforth, and does not correspond
+; to how user variables are planned to work in sanctuary
+; so todo make better later? i don't know if it really matters
+; because it will only apply to builtin variables.
+%macro defvar 3
+ %2: dq %4
+ defdict %1, %2, %3
+ ; pspush qword %2 ; todo
+ %2:
+%endmacro
+; }}}
+
+section .bss
resq 4091
wstk: resq 1