diff options
| author | Jakob L. Kreuze <zerodaysfordays@sdf.lonestar.org> | 2019-12-25 17:03:17 -0500 |
|---|---|---|
| committer | Jakob L. Kreuze <zerodaysfordays@sdf.lonestar.org> | 2019-12-25 17:03:17 -0500 |
| commit | 1b5bd4323c9cda73b8f99b616db8914a0f2015d1 (patch) | |
| tree | 94eca2b57a3e5e1ceb0ddc3e8df1c8b9d289c6ee /asm.myr | |
| parent | e5802d9272289ac852d585c90ddc55976b34ba9a (diff) | |
Implement RET and CALL instructions.
Diffstat (limited to 'asm.myr')
| -rw-r--r-- | asm.myr | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -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])) |