diff options
-rw-r--r-- | src/Noddybox.Emulation.EightBit.Z80/Z80Cpu.cs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/Noddybox.Emulation.EightBit.Z80/Z80Cpu.cs b/src/Noddybox.Emulation.EightBit.Z80/Z80Cpu.cs index 74a8df1..06433dc 100644 --- a/src/Noddybox.Emulation.EightBit.Z80/Z80Cpu.cs +++ b/src/Noddybox.Emulation.EightBit.Z80/Z80Cpu.cs @@ -123,6 +123,10 @@ namespace Noddybox.Emulation.EightBit.Z80 private bool HALT;
private int shift;
+ // Counters
+ //
+ private uint executedInstructions;
+
#endregion
#region Private members
@@ -228,6 +232,7 @@ namespace Noddybox.Emulation.EightBit.Z80 CheckInterrupts();
AddR(1);
shift = 0;
+ executedInstructions++;
DecodeByte(memory.Read(PC++));
}
@@ -330,6 +335,25 @@ namespace Noddybox.Emulation.EightBit.Z80 #region Public members
/// <summary>
+ /// Get/reset the number of executed instructions. If the reset is not zero, and expception is thrown.
+ /// </summary>
+ public uint ExecutedInstructions
+ {
+ get {return executedInstructions;}
+ set
+ {
+ if (value == 0)
+ {
+ executedInstructions = 0;
+ }
+ else
+ {
+ throw new ArgumentOutOfRangeException("Can only reset opcode count to zero");
+ }
+ }
+ }
+
+ /// <summary>
/// Set/get the current state of the accumulator.
/// </summary>
public byte Acummulator
|