mirror of
https://github.com/MoleskiCoder/EightBitNet.git
synced 2026-04-25 09:16:41 +00:00
Some speed-up refactoring of the Z80 core
This commit is contained in:
+4
-25
@@ -13,9 +13,6 @@ namespace Z80
|
|||||||
{
|
{
|
||||||
this._ports = ports;
|
this._ports = ports;
|
||||||
this.RaisedPOWER += this.Z80_RaisedPOWER;
|
this.RaisedPOWER += this.Z80_RaisedPOWER;
|
||||||
this.RaisedRFSH += this.Z80_RaisedRFSH;
|
|
||||||
this.ExecutingInstruction += this.Z80_ExecutingInstruction;
|
|
||||||
this.ExecutedInstruction += this.Z80_ExecutedInstruction;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private readonly InputOutput _ports;
|
private readonly InputOutput _ports;
|
||||||
@@ -66,16 +63,8 @@ namespace Z80
|
|||||||
|
|
||||||
public Register16 IX { get; } = new(0xffff);
|
public Register16 IX { get; } = new(0xffff);
|
||||||
|
|
||||||
public byte IXH { get => this.IX.High; set => this.IX.High = value; }
|
|
||||||
|
|
||||||
public byte IXL { get => this.IX.Low; set => this.IX.Low = value; }
|
|
||||||
|
|
||||||
public Register16 IY { get; } = new(0xffff);
|
public Register16 IY { get; } = new(0xffff);
|
||||||
|
|
||||||
public byte IYH { get => this.IY.High; set => this.IY.High = value; }
|
|
||||||
|
|
||||||
public byte IYL { get => this.IY.Low; set => this.IY.Low = value; }
|
|
||||||
|
|
||||||
// ** From the Z80 CPU User Manual
|
// ** From the Z80 CPU User Manual
|
||||||
// Memory Refresh(R) Register.The Z80 CPU contains a memory _refresh counter,
|
// Memory Refresh(R) Register.The Z80 CPU contains a memory _refresh counter,
|
||||||
// enabling dynamic memories to be used with the same ease as static memories.Seven bits
|
// enabling dynamic memories to be used with the same ease as static memories.Seven bits
|
||||||
@@ -124,19 +113,11 @@ namespace Z80
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Z80_ExecutingInstruction(object? sender, EventArgs e)
|
public override void PoweredStep()
|
||||||
{
|
{
|
||||||
this._modifiedF = 0;
|
this._modifiedF = 0;
|
||||||
this._displaced = this._prefixCB = this._prefixDD = this._prefixED = this._prefixFD = false;
|
this._displaced = this._prefixCB = this._prefixDD = this._prefixED = this._prefixFD = false;
|
||||||
}
|
|
||||||
|
|
||||||
private void Z80_ExecutedInstruction(object? sender, EventArgs e)
|
|
||||||
{
|
|
||||||
this.Q = this._modifiedF;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void PoweredStep()
|
|
||||||
{
|
|
||||||
if (this.RESET.Lowered())
|
if (this.RESET.Lowered())
|
||||||
{
|
{
|
||||||
this.HandleRESET();
|
this.HandleRESET();
|
||||||
@@ -173,6 +154,8 @@ namespace Z80
|
|||||||
// CPU.The HALT acknowledge signal is active during this time indicating that the processor
|
// CPU.The HALT acknowledge signal is active during this time indicating that the processor
|
||||||
// is in the HALT state.
|
// is in the HALT state.
|
||||||
this.Execute(this.FetchInstruction());
|
this.Execute(this.FetchInstruction());
|
||||||
|
|
||||||
|
this.Q = this._modifiedF;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Z80_RaisedPOWER(object? sender, EventArgs e)
|
private void Z80_RaisedPOWER(object? sender, EventArgs e)
|
||||||
@@ -200,11 +183,6 @@ namespace Z80
|
|||||||
this.ResetRegisterSet();
|
this.ResetRegisterSet();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Z80_RaisedRFSH(object? sender, EventArgs e)
|
|
||||||
{
|
|
||||||
++this.REFRESH;
|
|
||||||
}
|
|
||||||
|
|
||||||
#region Z80 specific pins
|
#region Z80 specific pins
|
||||||
|
|
||||||
#region NMI pin
|
#region NMI pin
|
||||||
@@ -311,6 +289,7 @@ namespace Z80
|
|||||||
{
|
{
|
||||||
RaisingRFSH?.Invoke(this, EventArgs.Empty);
|
RaisingRFSH?.Invoke(this, EventArgs.Empty);
|
||||||
this.RFSH.Raise();
|
this.RFSH.Raise();
|
||||||
|
++this.REFRESH;
|
||||||
RaisedRFSH?.Invoke(this, EventArgs.Empty);
|
RaisedRFSH?.Invoke(this, EventArgs.Empty);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user