aboutsummaryrefslogtreecommitdiff
path: root/sts/ia32/macro.sts
diff options
context:
space:
mode:
Diffstat (limited to 'sts/ia32/macro.sts')
-rw-r--r--sts/ia32/macro.sts86
1 files changed, 86 insertions, 0 deletions
diff --git a/sts/ia32/macro.sts b/sts/ia32/macro.sts
new file mode 100644
index 0000000..fa9510b
--- /dev/null
+++ b/sts/ia32/macro.sts
@@ -0,0 +1,86 @@
+[ next 0
+ # ad ?' # ff ?' # 20 ?'
+]
+
+[ defasm 1
+ [ %1% 0
+ _%0% ?.
+ \]
+ ?$ ?? _%1%
+ ?$ # 4 ?+ ?.
+]
+
+[ defword 1
+ [ %1% 0
+ _%0% ?.
+ \]
+ ?$ ?? _%1%
+ _docol # 4 ?+ ?.
+]
+
+[ defconst 2
+ defasm %1%
+ # 68 ?' # %2% ?. ; push %2%
+ next
+]
+
+[ defarr 2
+ _data_segment ?choose
+ ?$ ?? _%1%_arr
+ # %2% # 4 ?* ?res
+ _code_segment ?choose
+ defasm %1%
+ # 68 ?' _%1%_arr ?. ; push _%1%_arr
+ next
+]
+
+[ defvar 1
+ defarr %1% 1
+]
+
+[ as 1
+ _data_segment ?choose
+ defword %1%
+ lit ?$ # 0 ?.
+ exit
+ _code_segment ?choose
+ lit ?. !
+]
+
+[ literal 0
+ lit # %1% ?.
+]
+
+[ set_entry 0
+ ?$ _threaded_code_entry ?!
+]
+
+[ if 0
+ 0branch ?$ # 0 ?.
+]
+
+[ fi 0
+ ?$ ?swap ?!
+]
+
+[ else 0
+ branch ?$ # 0 ?.
+ ?swap ?$ ?swap ?!
+]
+
+[ do 0
+ ?$
+]
+
+[ untilod 0
+ 0branch ?.
+]
+
+[ until 0
+ 0 = 0branch ?$ # 0 ?.
+]
+
+[ od 0
+ branch ?swap ?.
+ ?$ ?swap ?!
+]