aboutsummaryrefslogtreecommitdiffstats
path: root/atk16_schasm/main.scm
diff options
context:
space:
mode:
Diffstat (limited to 'atk16_schasm/main.scm')
-rw-r--r--atk16_schasm/main.scm27
1 files changed, 27 insertions, 0 deletions
diff --git a/atk16_schasm/main.scm b/atk16_schasm/main.scm
new file mode 100644
index 0000000..79f7686
--- /dev/null
+++ b/atk16_schasm/main.scm
@@ -0,0 +1,27 @@
+(import (chicken base))
+
+(load "lib.scm")
+
+(define FL (reg 13))
+(define PC (reg 14))
+(define SP (reg 15))
+
+(ld SP (imm 0))
+
+(at-addr #x10)
+(def-label 'reset-vector)
+(emit #xF800)
+(emit #xF801)
+
+(at-addr #x20)
+(def-label 'main)
+(add (reg 1) (reg 2))
+(add (reg 3) (imm #xFF))
+
+;; abs jump
+(ld PC (imm (label 'main)))
+
+;; rel jump
+(add PC (imm 10))
+
+(mov (reg 0) (reg 1))