From bc5fc660caa7881458e0d62905a1aec38dd2aaf0 Mon Sep 17 00:00:00 2001 From: "Jakob L. Kreuze" Date: Fri, 27 Dec 2019 17:08:40 -0500 Subject: Implement SE instruction. --- asm.myr | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'asm.myr') diff --git a/asm.myr b/asm.myr index 2d2d172..cd0db90 100644 --- a/asm.myr +++ b/asm.myr @@ -128,6 +128,18 @@ const emitinstr = {p -> `std.Err(std.fmt("invalid arguments to JP: {}, {}", p[1], p[2])) ;; ;; + | "SE": + if p.len < 3 + -> `std.Err("SE missing arguments") + ;; + match (parselit(p[1]), parselit(p[2])) + | (`Register(m), `Number(n)): + b = `std.Some([0x30 | (m & 0x0f), (n & 0xff)]) + | (`Register(m), `Register(n)): + b = `std.Some([0x50 | (m & 0x0f), (n & 0x0f) << 1]) + | _: + -> `std.Err(std.fmt("invalid arguments to SE: {}, {}", p[1], p[2])) + ;; | _: -> `std.Err(std.fmt("unrecognized instruction {}", p[0])) ;; -- cgit v1.3