From 072e38f6ee44d583a7ca47c973ed4fd5566b628c Mon Sep 17 00:00:00 2001 From: Adrian Conlon Date: Sat, 9 Aug 2025 15:10:27 +0100 Subject: [PATCH] Add a couple of debug assertions --- Z80/Z80.cs | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/Z80/Z80.cs b/Z80/Z80.cs index ddcf172..af0aa4c 100644 --- a/Z80/Z80.cs +++ b/Z80/Z80.cs @@ -509,18 +509,18 @@ namespace Z80 protected override byte MemoryRead() { this.OnReadingMemory(); - this.Tick(); - this.LowerMREQ(); - this.LowerRD(); - this.Tick(); - _ = base.MemoryRead(); - this.RaiseRD(); - this.RaiseMREQ(); - if (this.M1.Lowered()) - { - this.RefreshMemory(); - } - this.Tick(); + this.Tick(); + this.LowerMREQ(); + this.LowerRD(); + this.Tick(); + _ = base.MemoryRead(); + this.RaiseRD(); + this.RaiseMREQ(); + if (this.M1.Lowered()) + { + this.RefreshMemory(); + } + this.Tick(); this.OnReadMemory(); return this.Bus.Data; } @@ -582,7 +582,9 @@ namespace Z80 this.Tick(); this.PushWord(this.PC); this.Bus.Address.Assign((byte)(data & ~1), this.IV); + Debug.Assert(this.Bus.Address.Low % 2 == 0); this.PC.Assign(this.GetWord()); + Debug.Assert(this.Bus.Address.Low % 2 == 1); Debug.Assert(this.Cycles == 19); break; default: