summary refs log tree commit diff
path: root/65c02.ts
diff options
context:
space:
mode:
Diffstat (limited to '65c02.ts')
-rw-r--r--65c02.ts16
1 files changed, 16 insertions, 0 deletions
diff --git a/65c02.ts b/65c02.ts
index f1368a9..fb8f050 100644
--- a/65c02.ts
+++ b/65c02.ts
@@ -157,6 +157,22 @@ export default class The65c02 {
             this.programCounter.set(resetVector);
             return;
         }
+        if (this.io.interruptRequest.high && !this.IRQBDisable) {
+            console.log('interrupt!')
+            this.IRQBDisable = true;
+            this.push(this.programCounter.num() & 0x00FF)
+            this.push(this.programCounter.num() & 0xFF00)
+            this.push(this.status.num())
+            let interruptVector = 0;
+            this.io.address.set(0xFFFE);
+            this.read()
+            interruptVector |= this.io.data.num();
+            this.io.address.set(0xFFFF);
+            this.read()
+            interruptVector |= this.io.data.num() << 8;
+            this.programCounter.set(interruptVector);
+            return;
+        }
         this.io.address.set(this.programCounter.num());
         this.read();
         const instruction = this.io.data