Skip to content

Z80TestHarness Class ​

Definition ​

Base class for a Z80 emulator test harness. Implement this class to use it with the test suites.

c#
public abstract class Z80TestHarness : TestHarness<Cycle>

View source

Constructors ​

NameDescription
Z80TestHarness()

Properties ​

NameDescription
FlagCGets or sets the carry flag, C.
FlagHGets or sets the half-carry flag, H.
FlagNGets or sets the add/subtract flag, N.
FlagPVGets or sets the parity/overflow flag, P/V.
FlagSGets or sets the sign flag, S.
FlagXGets or sets the undocumented X flag, bit 3 of the F register.
FlagYGets or sets the undocumented Y flag, bit 5 of the F register.
FlagZGets or sets the zero flag, Z.
HALTAdvancesPCDoes the HALT instruction advance PC?
HaltedGets or sets whether the CPU is in the halted state.
IFF1Gets or sets the IFF1 interrupt flip-flop.
IFF2Gets or sets the IFF2 interrupt flip-flop.
IMGets or sets the interrupt mode.
InterruptGets or sets whether the external interrupt line is asserted.
IOReaderGets the IO reader implementation.
IOWriterGets the IO writer implementation.
NextRegisterWritesGets the Next registers written to, in the order they were written. Z80N only; a Z80 never writes to one.
RegisterAGets or sets the A register.
RegisterAFGets or sets the AF register pair.
RegisterBGets or sets the B register.
RegisterBCGets or sets the BC register pair.
RegisterCGets or sets the C register.
RegisterDGets or sets the D register.
RegisterDEGets or sets the DE register pair.
RegisterEGets or sets the E register.
RegisterFGets or sets the F register.
RegisterHGets or sets the H register.
RegisterHLGets or sets the HL register pair.
RegisterIGets or sets the I register.
RegisterIXGets or sets the IX register pair.
RegisterIXHGets or sets the IXH register.
RegisterIXLGets or sets the IXL register.
RegisterIYGets or sets the IY register pair.
RegisterIYHGets or sets the IYH register.
RegisterIYLGets or sets the IYL register.
RegisterLGets or sets the L register.
RegisterPCGets or sets the PC register.
RegisterQGets or sets the internal Q register.
RegisterRGets or sets the R register.
RegisterSPGets or sets the SP register.
RegisterWZGets or sets the internal WZ register, sometimes called MEMPTR.
RomAreaGets or sets the ROM area in memory. Memory writes in this area by the emulator should be ignored.
ShadowRegisterAFGets or sets the AF' register pair.
ShadowRegisterBCGets or sets the BC' register pair.
ShadowRegisterDEGets or sets the DE' register pair.
ShadowRegisterHLGets or sets the HL' register pair.

Methods ​

NameDescription
ExecuteInstruction()Executes a single instruction.
ExecuteInstruction(TextWriter)Executes a single instruction with debug output.
OnRomAreaChanged()Called when RomArea changes. Override to update your emulator with the ROM area.
Reset()Resets the test harness state.
SetIO<TIO>(TIO)Sets both the IO reader and writer to the same implementation.
WriteNextRegister(Byte, Byte)Records a write to a Next register. Z80N emulators should call this when they perform one. The register number is used as the port of the IOEvent.