summary refs log tree commit diff
path: root/instructions/cmp.ts
diff options
context:
space:
mode:
Diffstat (limited to 'instructions/cmp.ts')
-rw-r--r--instructions/cmp.ts9
1 files changed, 9 insertions, 0 deletions
diff --git a/instructions/cmp.ts b/instructions/cmp.ts
new file mode 100644
index 0000000..1b2db94
--- /dev/null
+++ b/instructions/cmp.ts
@@ -0,0 +1,9 @@
+import { PC } from "../pc.ts";
+
+export default {
+    function(this: PC, [reg, val]: number[]) {
+        const r = this.lib.parseReg(reg)
+        this.returnFlag = +(this.registers[r] == +val)
+    },
+    args: 2
+}
\ No newline at end of file