diff options
author | sanine <sanine.not@pm.me> | 2023-05-23 00:23:41 -0500 |
---|---|---|
committer | sanine <sanine.not@pm.me> | 2023-05-23 00:23:41 -0500 |
commit | 19a297f42a2f321ead4c03290d38a8ccdbf8dc18 (patch) | |
tree | 0ecac73237caee2a0b5b2b7603fbe98636e634de /src/vm/core.js | |
parent | 6a4548df5e405adb080320080c67b7054b75bcaf (diff) |
test & fix indirection & predecrement
Diffstat (limited to 'src/vm/core.js')
-rw-r--r-- | src/vm/core.js | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/vm/core.js b/src/vm/core.js index 074e156..6303ee5 100644 --- a/src/vm/core.js +++ b/src/vm/core.js @@ -31,13 +31,13 @@ class Core { return this.normalize(pc, address.value); case AddrMode.Indirect: { let loc = this.normalize(pc, address.value); - let b = this.data[loc]; + let b = this.data[loc].b.value; return this.normalize(loc, b); } case AddrMode.Predecrement: { let loc = this.normalize(pc, address.value); - this.data[loc].b -= 1; - let b = this.data[loc].b; + this.data[loc].b.value -= 1; + let b = this.data[loc].b.value; return this.normalize(loc, b); } default: @@ -46,7 +46,8 @@ class Core { } getValue(pc, address) { - return this.data[this.getLocation(pc, address)]; + const index = this.getLocation(pc, address); + return this.data[index]; } } |