summary refs log tree commit diff
path: root/eater.ts
diff options
context:
space:
mode:
authorWlodekM <[email protected]>2025-04-04 10:38:16 +0300
committerWlodekM <[email protected]>2025-04-04 10:38:16 +0300
commit562e6237bb58919d800f431cb38de1784efbbe98 (patch)
treeaf9e7e1b3271a17df26079d2b709c130f0cacc3b /eater.ts
parente2568226af4af2d3b27e9e1a775e7244c5ef7191 (diff)
try to test,,, and fail
Diffstat (limited to 'eater.ts')
-rw-r--r--eater.ts13
1 files changed, 12 insertions, 1 deletions
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<string, { mnemonic: string, mode: string }>)[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)