From 562e6237bb58919d800f431cb38de1784efbbe98 Mon Sep 17 00:00:00 2001 From: WlodekM Date: Fri, 4 Apr 2025 10:38:16 +0300 Subject: try to test,,, and fail --- eater.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'eater.ts') diff --git a/eater.ts b/eater.ts index 4440635..20af12a 100644 --- a/eater.ts +++ b/eater.ts @@ -1,5 +1,6 @@ // deno-lint-ignore-file no-process-globals import The65c02 from "./65c02.ts"; +import matrix from "./opcode_matrix.json" with { type: "json" }; // eater.ts // a runtime meant to mimic ben eater's 65c02 computer @@ -71,6 +72,16 @@ const clock = setInterval(() => { } if(cpu.io.interruptRequest.high && !cpu.IRQBDisable) cpu.io.interruptRequest.LO(); + const instId = ram[cpu.programCounter.num()] + .toString(16) + .padStart(2, '0'); + const goog = (matrix as Record)[instId]; + if (!goog) { + console.log('uh', instId, 'unknown') + throw 'oh no'; + } + const instr = goog; + console.debug(cpu.programCounter.num().toString(16).padStart(4, '0'),instr.mnemonic, instr.mode) cpu.cycle(); // 1MHz i think -}, 1) +}, 100) -- cgit 1.4.1-2-gfad0