summaryrefslogtreecommitdiff
path: root/src/vm/instruction.test.js
diff options
context:
space:
mode:
authorsanine-a <sanine.not@pm.me>2023-05-24 13:06:45 -0500
committersanine-a <sanine.not@pm.me>2023-05-24 13:06:45 -0500
commit9f478261bc8fd1502090c701c998e48a4018e7ee (patch)
treec1758c322450af1eead232cb42491e558b5aba12 /src/vm/instruction.test.js
parent15323007750e0f0f7c36a6a6fa01ad1d303a4a16 (diff)
fix operand resolution to match specmain
Diffstat (limited to 'src/vm/instruction.test.js')
-rw-r--r--src/vm/instruction.test.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/vm/instruction.test.js b/src/vm/instruction.test.js
index cf23404..279b9b8 100644
--- a/src/vm/instruction.test.js
+++ b/src/vm/instruction.test.js
@@ -393,6 +393,21 @@ test('JMP correctly jumps', () => {
});
+test('JMP correctly responds to B-field predecrement', () => {
+ const core = new Core(CORESIZE);
+ const pc = 2;
+ core.data[pc] = {
+ opcode: 'JMP',
+ a: { mode: 'direct', value: -3 },
+ b: { mode: 'predecrement', value: 1 },
+ };
+ const ins = core.data[pc];
+
+ expect(JMP(core, pc, ins)).toEqual([CORESIZE-1]);
+ expect(core.data[pc+1].b.value).toBe(-1);
+});
+
+
test('JMZ correctly jumps in non-immediate mode', () => {
const core = new Core(CORESIZE);
const pc = 2;