From 08ee9a129c81cc1cafcfe830b02b4f9c036334ca Mon Sep 17 00:00:00 2001 From: Melodi <62381002+Melodi17@users.noreply.github.com> Date: Wed, 18 Mar 2026 06:50:43 +1000 Subject: add: Initial implementation of all instructions --- Q1.core/Arch/Chip.cs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'Q1.core/Arch/Chip.cs') diff --git a/Q1.core/Arch/Chip.cs b/Q1.core/Arch/Chip.cs index af131dd..69a0877 100644 --- a/Q1.core/Arch/Chip.cs +++ b/Q1.core/Arch/Chip.cs @@ -140,4 +140,13 @@ public class Chip else throw new InvalidOperationException($"Invalid register index: {index}"); } + public void Interrupt(u16 code) + { + if (code >= ChipLayout.IVT_COUNT) + throw new InvalidOperationException($"Invalid interrupt code: {code}"); + + this.Push(this.Pc); + u16 interruptVectorAddress = (u16) (ChipLayout.IVT_START + code * 2); + this.Pc = this.Bus.ReadWord(interruptVectorAddress); + } } \ No newline at end of file -- cgit v1.3.1