This commit is contained in:
2020-05-15 21:03:35 -06:00
parent 70394e1f7e
commit 95ccf00ff6
3 changed files with 1007 additions and 59 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -8,6 +8,7 @@ namespace MCEmuCore.GBMonolith
enum Register { A, B, C, D, E, H, L };
private readonly byte[] Registers = new byte[7];
public readonly FlagRegister Flags = new FlagRegister();
public ushort SP, PC;
#region Register Accessors
public byte A
@@ -159,9 +160,6 @@ namespace MCEmuCore.GBMonolith
}
#endregion
public ushort SP { get; set; }
public ushort PC { get; set; }
#region Constructors
public CpuRegisters()
{
@@ -266,9 +264,9 @@ namespace MCEmuCore.GBMonolith
set
{
if (value)
Value |= 0b1000_0000;
register |= 0b1000_0000;
else
Value &= 0b0111_1111;
register &= 0b0111_0000;
}
}
public bool Subtract
@@ -277,9 +275,9 @@ namespace MCEmuCore.GBMonolith
set
{
if (value)
Value |= 0b0100_0000;
register |= 0b0100_0000;
else
Value &= 0b1011_1111;
register &= 0b1011_0000;
}
}
public bool HalfCarry
@@ -288,9 +286,9 @@ namespace MCEmuCore.GBMonolith
set
{
if (value)
Value |= 0b0010_0000;
register |= 0b0010_0000;
else
Value &= 0b1101_1111;
register &= 0b1101_0000;
}
}
public bool Carry
@@ -299,9 +297,9 @@ namespace MCEmuCore.GBMonolith
set
{
if (value)
Value |= 0b0001_0000;
register |= 0b0001_0000;
else
Value &= 0b1110_1111;
register &= 0b1110_0000;
}
}
#endregion

View File

@@ -6,6 +6,7 @@ namespace MCEmuCore.GBMonolith
{
static void Main(string[] args)
{
var cpu = new Cpu();
TestRegisters();
}
@@ -54,7 +55,6 @@ namespace MCEmuCore.GBMonolith
cpuRegisters.Flags.HalfCarry = true;
cpuRegisters.Flags.Carry = false;
cpuRegisters.PrintFlags();
Console.ReadLine();
}
}
}