mirror of
https://github.com/MoleskiCoder/EightBitNet.git
synced 2025-01-10 15:29:47 +00:00
Speed up Z80 block operations by using values rather than reference objects, if possible.
Signed-off-by: Adrian Conlon <Adrian.conlon@gmail.com>
This commit is contained in:
parent
2652463106
commit
56f46a8236
24
Z80/Z80.cs
24
Z80/Z80.cs
@ -1800,7 +1800,7 @@ namespace EightBit
|
||||
hl2.High = this.MEMPTR.High;
|
||||
}
|
||||
|
||||
private void BlockCompare(Register16 source, Register16 counter)
|
||||
private void BlockCompare(ushort source, Register16 counter)
|
||||
{
|
||||
var value = this.BusRead(source);
|
||||
var result = (byte)(this.A - value);
|
||||
@ -1819,8 +1819,7 @@ namespace EightBit
|
||||
|
||||
private void CPI()
|
||||
{
|
||||
this.BlockCompare(this.HL, this.BC);
|
||||
++this.HL.Word;
|
||||
this.BlockCompare(this.HL.Word++, this.BC);
|
||||
++this.MEMPTR.Word;
|
||||
}
|
||||
|
||||
@ -1832,8 +1831,7 @@ namespace EightBit
|
||||
|
||||
private void CPD()
|
||||
{
|
||||
this.BlockCompare(this.HL, this.BC);
|
||||
--this.HL.Word;
|
||||
this.BlockCompare(this.HL.Word--, this.BC);
|
||||
--this.MEMPTR.Word;
|
||||
}
|
||||
|
||||
@ -1843,7 +1841,7 @@ namespace EightBit
|
||||
return ((this.F & (byte)StatusBits.PF) != 0) && ((this.F & (byte)StatusBits.ZF) == 0); // See CPD
|
||||
}
|
||||
|
||||
private void BlockLoad(Register16 source, Register16 destination, Register16 counter)
|
||||
private void BlockLoad(ushort source, ushort destination, Register16 counter)
|
||||
{
|
||||
var value = this.BusRead(source);
|
||||
this.BusWrite(destination, value);
|
||||
@ -1854,12 +1852,7 @@ namespace EightBit
|
||||
this.F = SetFlag(this.F, StatusBits.PF, --counter.Word);
|
||||
}
|
||||
|
||||
private void LDI()
|
||||
{
|
||||
this.BlockLoad(this.HL, this.DE, this.BC);
|
||||
++this.HL.Word;
|
||||
++this.DE.Word;
|
||||
}
|
||||
private void LDI() => this.BlockLoad(this.HL.Word++, this.DE.Word++, this.BC);
|
||||
|
||||
private bool LDIR()
|
||||
{
|
||||
@ -1867,12 +1860,7 @@ namespace EightBit
|
||||
return (this.F & (byte)StatusBits.PF) != 0; // See LDI
|
||||
}
|
||||
|
||||
private void LDD()
|
||||
{
|
||||
this.BlockLoad(this.HL, this.DE, this.BC);
|
||||
--this.HL.Word;
|
||||
--this.DE.Word;
|
||||
}
|
||||
private void LDD() => this.BlockLoad(this.HL.Word--, this.DE.Word--, this.BC);
|
||||
|
||||
private bool LDDR()
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user