aboutsummaryrefslogtreecommitdiff
path: root/sts/common
diff options
context:
space:
mode:
Diffstat (limited to 'sts/common')
-rw-r--r--sts/common/.print.sts.swpbin0 -> 12288 bytes
-rw-r--r--sts/common/common.sts3
-rw-r--r--sts/common/const.sts95
-rw-r--r--sts/common/macro.sts9
-rw-r--r--sts/common/print.sts30
5 files changed, 137 insertions, 0 deletions
diff --git a/sts/common/.print.sts.swp b/sts/common/.print.sts.swp
new file mode 100644
index 0000000..d3a74a8
--- /dev/null
+++ b/sts/common/.print.sts.swp
Binary files differ
diff --git a/sts/common/common.sts b/sts/common/common.sts
new file mode 100644
index 0000000..e0e33cf
--- /dev/null
+++ b/sts/common/common.sts
@@ -0,0 +1,3 @@
+module sts/common/macro.sts
+module sts/common/const.sts
+module sts/common/print.sts
diff --git a/sts/common/const.sts b/sts/common/const.sts
new file mode 100644
index 0000000..b1a08b0
--- /dev/null
+++ b/sts/common/const.sts
@@ -0,0 +1,95 @@
+defconst newline 0a
+defconst space 20
+defconst '!' 21
+defconst '"' 22
+defconst '#' 23
+defconst '$' 24
+defconst percent 25 ; '%' (25) symbol is reserved by smack
+defconst '&' 26
+defconst ''' 27
+defconst '(' 28
+defconst ')' 29
+defconst '*' 2a
+defconst '+' 2b
+defconst ',' 2c
+defconst '-' 2d
+defconst '.' 2e
+defconst '/' 2f
+defconst '0' 30
+defconst '1' 31
+defconst '2' 32
+defconst '3' 33
+defconst '4' 34
+defconst '5' 35
+defconst '6' 36
+defconst '7' 37
+defconst '8' 38
+defconst '9' 39
+defconst ':' 3a
+defconst '<' 3c
+defconst '=' 3d
+defconst '>' 3e
+defconst '?' 3f
+defconst '@' 40
+defconst 'A' 41
+defconst 'B' 42
+defconst 'C' 43
+defconst 'D' 44
+defconst 'E' 45
+defconst 'F' 46
+defconst 'G' 47
+defconst 'H' 48
+defconst 'I' 49
+defconst 'J' 4a
+defconst 'K' 4b
+defconst 'L' 4c
+defconst 'M' 4d
+defconst 'N' 4e
+defconst 'O' 4f
+defconst 'P' 50
+defconst 'Q' 51
+defconst 'R' 52
+defconst 'S' 53
+defconst 'T' 54
+defconst 'U' 55
+defconst 'V' 56
+defconst 'W' 57
+defconst 'X' 58
+defconst 'Y' 59
+defconst 'Z' 5a
+defconst '[' 5b
+defconst '\' 5c
+defconst ']' 5d
+defconst '^' 5e
+defconst '_' 5f
+defconst '`' 60
+defconst 'a' 61
+defconst 'b' 62
+defconst 'c' 63
+defconst 'd' 64
+defconst 'e' 65
+defconst 'f' 66
+defconst 'g' 67
+defconst 'h' 68
+defconst 'i' 69
+defconst 'j' 6a
+defconst 'k' 6b
+defconst 'l' 6c
+defconst 'm' 6d
+defconst 'n' 6e
+defconst 'o' 6f
+defconst 'p' 70
+defconst 'q' 71
+defconst 'r' 72
+defconst 's' 73
+defconst 't' 74
+defconst 'u' 75
+defconst 'v' 76
+defconst 'w' 77
+defconst 'x' 78
+defconst 'y' 79
+defconst 'z' 7a
+defconst '{' 7b
+defconst '|' 7c
+defconst '}' 7d
+defconst '~' 7e
diff --git a/sts/common/macro.sts b/sts/common/macro.sts
new file mode 100644
index 0000000..162bf2f
--- /dev/null
+++ b/sts/common/macro.sts
@@ -0,0 +1,9 @@
+[ local 1
+ top as %1%
+]
+
+[ change 0
+ 1 + dup get
+ swap 2 get swap set
+ swap drop
+]
diff --git a/sts/common/print.sts b/sts/common/print.sts
new file mode 100644
index 0000000..a3bea56
--- /dev/null
+++ b/sts/common/print.sts
@@ -0,0 +1,30 @@
+defword get_hex
+ f and
+ dup 9 > if
+ a - 'a' +
+ else
+ '0' +
+ fi
+exit
+
+defword print_hex
+ dup 1c shr get_hex sys_write
+ dup 18 shr get_hex sys_write
+ dup 14 shr get_hex sys_write
+ dup 10 shr get_hex sys_write
+ dup c shr get_hex sys_write
+ dup 8 shr get_hex sys_write
+ dup 4 shr get_hex sys_write
+ get_hex sys_write
+exit
+
+defword print_stack
+ dup
+ do
+ over over - 2 + get print_hex
+ 1 - dup 0 = until
+ space sys_write
+ od newline sys_write
+ drop
+ drop
+exit