From 946121defb257adca38d47744945a215647e95b8 Mon Sep 17 00:00:00 2001 From: Adrian Conlon <98398945+AdrianConlon@users.noreply.github.com> Date: Sat, 3 May 2025 02:08:52 +0100 Subject: [PATCH] Fix HALT instruction --- Z80/Z80.cs | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/Z80/Z80.cs b/Z80/Z80.cs index 470264b..b7092cc 100644 --- a/Z80/Z80.cs +++ b/Z80/Z80.cs @@ -13,8 +13,6 @@ namespace Z80 { this._ports = ports; this.RaisedPOWER += this.Z80_RaisedPOWER; - this.LoweredHALT += this.Z80_LoweredHALT; - this.RaisedHALT += this.Z80_RaisedHALT; } private readonly InputOutput _ports; @@ -194,16 +192,6 @@ namespace Z80 this.ResetPrefixes(); } - private void Z80_RaisedHALT(object? sender, EventArgs e) - { - ++this.PC.Word; // Release the PC from HALT instruction - } - - private void Z80_LoweredHALT(object? sender, EventArgs e) - { - --this.PC.Word; // Keep the PC on the HALT instruction (i.e. executing NOP) - } - private void ResetPrefixes() { this._prefixCB = this._prefixDD = this._prefixED = this._prefixFD = false; @@ -494,11 +482,14 @@ namespace Z80 protected override void MemoryWrite() { + this.OnWritingMemory(); this.MemoryUpdate(3); + this.OnWroteMemory(); } protected override byte MemoryRead() { + this.OnReadingMemory(); this.Tick(); this.LowerMREQ(); this.LowerRD(); @@ -516,6 +507,7 @@ namespace Z80 this.RaiseRFSH(); } this.Tick(); + this.OnReadMemory(); return returned; }