From 86793f0afd74092be507325a40d85bc62bd47597 Mon Sep 17 00:00:00 2001 From: sanine-a Date: Tue, 23 May 2023 12:26:50 -0500 Subject: implement JMN --- src/vm/instruction.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/vm/instruction.js') diff --git a/src/vm/instruction.js b/src/vm/instruction.js index 2afd3f7..f323f84 100644 --- a/src/vm/instruction.js +++ b/src/vm/instruction.js @@ -124,3 +124,21 @@ exports.JMZ = function(core, pc, ins) { return [core.normalize(pc, 1)]; } } + + +exports.JMN = function(core, pc, ins) { + let test; + + if (ins.b.mode === AddrMode.Immediate) { + test = (ins.b.value !== 0); + } else { + const src = core.getValue(pc, ins.b); + test = (src.b.value !== 0); + } + + if (test) { + return [core.getLocation(pc, ins.a)]; + } else { + return [core.normalize(pc, 1)]; + } +} -- cgit v1.2.1