summaryrefslogtreecommitdiff
path: root/asm.myr
diff options
context:
space:
mode:
authorJakob L. Kreuze <zerodaysfordays@sdf.lonestar.org>2019-12-25 17:03:17 -0500
committerJakob L. Kreuze <zerodaysfordays@sdf.lonestar.org>2019-12-25 17:03:17 -0500
commit1b5bd4323c9cda73b8f99b616db8914a0f2015d1 (patch)
tree94eca2b57a3e5e1ceb0ddc3e8df1c8b9d289c6ee /asm.myr
parente5802d9272289ac852d585c90ddc55976b34ba9a (diff)
Implement RET and CALL instructions.
Diffstat (limited to 'asm.myr')
-rw-r--r--asm.myr11
1 files changed, 11 insertions, 0 deletions
diff --git a/asm.myr b/asm.myr
index dcacbda..800a6ef 100644
--- a/asm.myr
+++ b/asm.myr
@@ -55,11 +55,22 @@ const emitinstr = {p
match upcase(p[0])
| "CLS":
b = `std.Some([0x00, 0xe0])
+ | "RET":
+ b = `std.Some([0x00, 0xee])
| "SYS":
if p.len < 2
-> `std.Err("SYS missing subroutine address")
;;
match parsehex(p[1])
+ | `std.Some(n): b = `std.Some([0x00 | (n & 0x0f00), (n & 0xff)])
+ | `std.None: b = `std.Some([0x20, 0x00])
+ mark = `std.Some(strdup(p[1]))
+ ;;
+ | "CALL":
+ if p.len < 2
+ -> `std.Err("CALL missing subroutine address")
+ ;;
+ match parsehex(p[1])
| `std.Some(n): b = `std.Some([0x20 | (n & 0x0f00), (n & 0xff)])
| `std.None: b = `std.Some([0x20, 0x00])
mark = `std.Some(strdup(p[1]))