From e2c615f20b5789602504e4b0249db0ac82eda629 Mon Sep 17 00:00:00 2001 From: Will Scullin Date: Mon, 7 Oct 2019 22:18:15 -0700 Subject: [PATCH] Fix ROL. --- js/cpu6502.js | 2 +- test/cpu.spec.js | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/js/cpu6502.js b/js/cpu6502.js index d12b9c8..c752222 100644 --- a/js/cpu6502.js +++ b/js/cpu6502.js @@ -616,7 +616,7 @@ export default function CPU6502(options) function rol(readAddrFn) { var addr = readAddrFn({rwm: true}); var oldVal = readByte(addr); - writeByte(oldVal); + writeByte(addr, oldVal); var val = rotateLeft(oldVal); writeByte(addr, val); } diff --git a/test/cpu.spec.js b/test/cpu.spec.js index a6d1431..15d82c3 100644 --- a/test/cpu.spec.js +++ b/test/cpu.spec.js @@ -3,6 +3,8 @@ import CPU6502 from '../js/cpu6502'; import Test6502 from '../js/roms/6502test'; import Test65C02 from '../js/roms/65C02test'; +import { toHex } from '../js/util'; + describe('CPU', function () { var cpu; var lastPC = 0; @@ -25,7 +27,7 @@ describe('CPU', function () { cpu.stepCyclesDebug(1000, traceCB); } while (!done); - expect(lastPC).toEqual(0x3469); + expect(toHex(lastPC)).toEqual(toHex(0x3469)); }); }); @@ -40,7 +42,7 @@ describe('CPU', function () { cpu.stepCyclesDebug(1000, traceCB); } while (!done); - expect(lastPC).toEqual(0x24f1); + expect(toHex(lastPC)).toEqual(toHex(0x24f1)); }); }); });