aboutsummaryrefslogtreecommitdiffstats
path: root/atk16_schasm/main.scm
diff options
context:
space:
mode:
authorJan Tuomi <jan@jantuomi.fi>2025-02-28 10:13:33 +0200
committerJan Tuomi <jan@jantuomi.fi>2025-02-28 10:13:33 +0200
commit3db2fadbfbefc03395bff5d3fafe1abddf01c393 (patch)
tree17b9f129e1c77b3fe88c3927fda522ec57c46e2f /atk16_schasm/main.scm
parent47706066cdaa967f9f81dfd454bbdf2bffa4df97 (diff)
Start working on new ISA, add scheme assembler
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))