Skip to content

Commit

Permalink
Handle writeM in the CPU class
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidSouther committed Feb 1, 2024
1 parent 0680c88 commit 45062ba
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions simulator/src/cpu/cpu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ export function cpuTock(
D = ALU;
}

const oldA = A;
if (!bits.c) {
A = instruction & 0x7fff;
} else if (bits.d1) {
Expand All @@ -110,7 +109,7 @@ export function cpuTock(
flag = alu2[1];

const output: CPUOutput = {
addressM: bits.d3 ? oldA : A,
addressM: A,
outM: ALU,
writeM: bits.d3,
};
Expand Down Expand Up @@ -193,7 +192,8 @@ export class CPU {
}

tick() {
const [{ addressM, outM, writeM }, { A, D, PC }] = cpu(
const addressM = this.#a;
const [{ outM, writeM }, { A, D, PC }] = cpu(
{
inM: this.RAM.get(this.#a),
instruction: this.ROM.get(this.#pc),
Expand Down

0 comments on commit 45062ba

Please sign in to comment.