summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--asm.myr10
1 files changed, 9 insertions, 1 deletions
diff --git a/asm.myr b/asm.myr
index ab26cbb..9dcde13 100644
--- a/asm.myr
+++ b/asm.myr
@@ -221,7 +221,15 @@ const emitinstr = {p
| _:
-> `std.Err(std.fmt("invalid argument to SUB: {}", p[1]))
;;
-
+ | "SUBN":
+ if p.len < 3
+ -> `std.Err("SUBN missing arguments")
+ ;;
+ match (parselit(p[1]), parselit(p[2]))
+ | (`Register(m), `Register(n)): b = `std.Some([0x80 | (m & 0x0f), ((n & 0x0f) << 1) | 0x07])
+ | _:
+ -> `std.Err(std.fmt("invalid argument to SUBN: {}", p[1]))
+ ;;
| _:
-> `std.Err(std.fmt("unrecognized instruction {}", p[0]))
;;