diff options
author | sanine-a <sanine.not@pm.me> | 2023-05-23 12:43:07 -0500 |
---|---|---|
committer | sanine-a <sanine.not@pm.me> | 2023-05-23 12:43:07 -0500 |
commit | c7f8ede9223502a96a74adf0cb790ac41de04742 (patch) | |
tree | ce4e142946bf78bec033d231afd0bdebb7af087c /src/vm/instruction.test.js | |
parent | 4d5377870ee554036ac9aab570ac2bc809fc88bd (diff) |
correct indirection code to match spec
Diffstat (limited to 'src/vm/instruction.test.js')
-rw-r--r-- | src/vm/instruction.test.js | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/vm/instruction.test.js b/src/vm/instruction.test.js index 82d9819..cf23404 100644 --- a/src/vm/instruction.test.js +++ b/src/vm/instruction.test.js @@ -76,7 +76,7 @@ test('MOV correctly handles indirection', () => { b: { mode: 'immediate', value: 2 }, }); - expect(core.data[pc+1]).toEqual({ + expect(core.data[pc+2]).toEqual({ opcode: 'DAT', a: { mode: 'immediate', value: 0 }, b: { mode: 'immediate', value: 100 }, @@ -93,18 +93,18 @@ test('MOV correctly handles predecrement indirection', () => { core.data[pc] = { opcode: 'MOV', a: { mode: 'immediate', value: 100 }, - b: { mode: 'predecrement', value: -1 }, + b: { mode: 'predecrement', value: 1 }, }; const ins = core.data[pc]; expect(core.data[pc+1].opcode).toBe('DAT'); expect(MOV(core, pc, ins)).toEqual([pc+1]); - expect(core.data[pc-1]).toEqual({ + expect(core.data[pc+1]).toEqual({ opcode: 'DAT', a: { mode: 'immediate', value: 0 }, b: { mode: 'immediate', value: -1 }, }); - expect(core.data[pc-2]).toEqual({ + expect(core.data[pc-1]).toEqual({ opcode: 'DAT', a: { mode: 'immediate', value: 0 }, b: { mode: 'immediate', value: 100 }, @@ -130,7 +130,7 @@ test('MOV correctly handles core boundaries', () => { b: { mode: 'immediate', value: -1 }, }); - expect(core.data[0]).toEqual({ + expect(core.data[CORESIZE-2]).toEqual({ opcode: 'DAT', a: { mode: 'immediate', value: 0 }, b: { mode: 'immediate', value: 100 }, |