summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--asm.myr12
1 files changed, 12 insertions, 0 deletions
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]))
;;