From e3feedee60a3b1b5177c8e0576f307a2f473a589 Mon Sep 17 00:00:00 2001 From: "Jakob L. Kreuze" Date: Fri, 27 Dec 2019 17:40:02 -0500 Subject: Implement SUBN instruction. --- asm.myr | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'asm.myr') 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])) ;; -- cgit v1.3