summary refs log tree commit diff
path: root/runtime.ts
diff options
context:
space:
mode:
authorWlodekM <[email protected]>2025-04-02 21:30:45 +0300
committerWlodekM <[email protected]>2025-04-02 21:30:45 +0300
commitbd5c7ca279addd977623242f3a52dbfd6caf42a8 (patch)
treef5fe688380753acba1e53b86c0643443a8efb620 /runtime.ts
parent1c8ceec85d5ed4ad6126ac0d82cfe285cff7eb7a (diff)
debugging thing
Diffstat (limited to 'runtime.ts')
-rw-r--r--runtime.ts12
1 files changed, 9 insertions, 3 deletions
diff --git a/runtime.ts b/runtime.ts
index 4f6435d..d74e230 100644
--- a/runtime.ts
+++ b/runtime.ts
@@ -26,7 +26,7 @@ await cpu.loadInstructions()
 
 // mem address $0000
 ram[0xFFFC] = 0x00
-ram[0xFFFD] = 0x00
+ram[0xFFFD] = 0x01
 
 //TODO: read code from file
 // const code = [
@@ -43,7 +43,7 @@ const code = Deno.readFileSync('a.out')
 // write code to ram before execution
 for (let offset = 0; offset < code.length; offset++) {
     const byte = code[offset];
-    ram[offset] = byte;
+    ram[256 + offset] = byte;
 }
 
 // pull RESB low to reset the 65c02
@@ -54,7 +54,13 @@ cpu.cycle()
 cpu.io.reset.HI()
 
 while (!cpu.io.interruptRequest.high) {
-    cpu.cycle()
+    cpu.cycle();
+    const i = new Uint8Array(8);
+    await Deno.stdin.read(i);
+    if (i[0] == 'b'.charCodeAt(0)) {
+        console.log('BREAK!!')
+        break;
+    }
 }
 
 console.log('end of execution\n\nIO status:')