From b175086307dea313f6368988fb3b53f4864cf2ae Mon Sep 17 00:00:00 2001 From: Adrian Conlon Date: Thu, 7 May 2026 20:43:30 +0100 Subject: [PATCH] Mild overloading refactor for 6809 --- MC6809/MC6809.cs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/MC6809/MC6809.cs b/MC6809/MC6809.cs index 547c607..19bb2f8 100644 --- a/MC6809/MC6809.cs +++ b/MC6809/MC6809.cs @@ -570,11 +570,14 @@ namespace MC6809 protected override void Push(byte value) => this.PushS(value); - private void Push(Register16 stack, byte value) => this.MemoryWrite(stack.Decrement(), value); + private void Push(Register16 stack, byte value) + { + this.MemoryWrite(stack.Decrement(), value); + } private void PushS(byte value) => this.Push(this.S, value); - private void PushWord(Register16 stack, Register16 value) + private void Push(Register16 stack, Register16 value) { this.Push(stack, value.Low); this.Push(stack, value.High); @@ -912,7 +915,7 @@ namespace MC6809 if ((data & (byte)Bits.Bit7) != 0) { this.Tick(2); - this.PushWord(stack, this.PC); + this.Push(stack, this.PC); } if ((data & (byte)Bits.Bit6) != 0) @@ -920,19 +923,19 @@ namespace MC6809 this.Tick(2); // Pushing to the S stack means we must be pushing U - this.PushWord(stack, ReferenceEquals(stack, this.S) ? this.U : this.S); + this.Push(stack, ReferenceEquals(stack, this.S) ? this.U : this.S); } if ((data & (byte)Bits.Bit5) != 0) { this.Tick(2); - this.PushWord(stack, this.Y); + this.Push(stack, this.Y); } if ((data & (byte)Bits.Bit4) != 0) { this.Tick(2); - this.PushWord(stack, this.X); + this.Push(stack, this.X); } if ((data & (byte)Bits.Bit3) != 0)