Added Debugger
This commit is contained in:
@@ -5,6 +5,9 @@ namespace Core.Cpu
|
||||
{
|
||||
public partial class Z80
|
||||
{
|
||||
//T-State counter
|
||||
public long TotalTStates { get; set; }
|
||||
|
||||
// Main Register Set
|
||||
public RegisterPair AF;
|
||||
public RegisterPair BC;
|
||||
@@ -52,9 +55,24 @@ namespace Core.Cpu
|
||||
{
|
||||
// Fetch the next opcode and increment the Program Counter
|
||||
byte opcode = _memory.Read(PC++);
|
||||
int tStates = ExecuteOpcode(opcode);
|
||||
TotalTStates += tStates;
|
||||
|
||||
// Decode and execute
|
||||
return ExecuteOpcode(opcode);
|
||||
return tStates;
|
||||
}
|
||||
|
||||
public string GetFlagsString()
|
||||
{
|
||||
byte f = AF.Low;
|
||||
return $"S:{(f >> 7) & 1} " +
|
||||
$"Z:{(f >> 6) & 1} " +
|
||||
$"Y:{(f >> 5) & 1} " + // Undocumented flag
|
||||
$"H:{(f >> 4) & 1} " +
|
||||
$"X:{(f >> 3) & 1} " + // Undocumented flag
|
||||
$"P/V:{(f >> 2) & 1} " +
|
||||
$"N:{(f >> 1) & 1} " +
|
||||
$"C:{f & 1}";
|
||||
}
|
||||
|
||||
private int ExecuteOpcode(byte opcode)
|
||||
|
||||
Reference in New Issue
Block a user