diff options
| author | Melodi <62381002+Melodi17@users.noreply.github.com> | 2025-08-08 23:57:26 +1000 |
|---|---|---|
| committer | Melodi <62381002+Melodi17@users.noreply.github.com> | 2025-08-08 23:57:26 +1000 |
| commit | e62b66dd08ca445d1f7e5b802a503ad3ec83b2df (patch) | |
| tree | 8cdb4ee09d1eefe096f51d6c9150dc361d08ccb9 /Emulator/Chip/Q1Cpu.cs | |
| parent | 33e1c5fc6e37549b4eba833ae7e534f9da250b10 (diff) | |
added branching to compiler and comment generation
Diffstat (limited to 'Emulator/Chip/Q1Cpu.cs')
| -rw-r--r-- | Emulator/Chip/Q1Cpu.cs | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/Emulator/Chip/Q1Cpu.cs b/Emulator/Chip/Q1Cpu.cs index d1fcf7a..16489e4 100644 --- a/Emulator/Chip/Q1Cpu.cs +++ b/Emulator/Chip/Q1Cpu.cs @@ -5,10 +5,6 @@ using Assembler; public partial class Q1Cpu { - public const u16 StackStart = 0x2FFF; - public const u16 StackLength = 16 * 2; // 16 16-bit values - public const u16 ProgramStart = 0x1FFF; - public Random Random; public u16 AX = 0; // Accumulator register @@ -35,10 +31,10 @@ public partial class Q1Cpu this.V = new u16[16]; - this.SP = Q1Cpu.StackStart; + this.SP = Q1Layout.StackStart; this.PushStack(0xFFFF); - this.PC = Q1Cpu.ProgramStart; + this.PC = Q1Layout.ProgramStart; } public void Clock() @@ -88,7 +84,7 @@ public partial class Q1Cpu private void PushStack(u16 value) { - if (this.SP + 2 >= Q1Cpu.StackStart + Q1Cpu.StackLength) + if (this.SP + 2 >= Q1Layout.StackStart + Q1Layout.StackLength) throw new InvalidOperationException("Stack overflow"); this.Bus.WriteWord(this.SP, value); @@ -97,7 +93,7 @@ public partial class Q1Cpu private u16 PopStack() { - if (this.SP - 2 < Q1Cpu.StackStart) + if (this.SP - 2 < Q1Layout.StackStart) throw new InvalidOperationException("Stack underflow"); this.SP -= 2; |
