summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIan C <ianc@noddybox.co.uk>2012-03-01 00:02:07 +0000
committerIan C <ianc@noddybox.co.uk>2012-03-01 00:02:07 +0000
commit788b8cc4dd404a826ce881c020ee6ca0388a5975 (patch)
treed6a0e0a2a03316ccfd14ea0f1433ce311fdb1d4e /src
parenta937b96b20e61cd0770119da3327c15575779793 (diff)
Initial working version of test suite. Fixed INC8 and DEC8 with results.
Diffstat (limited to 'src')
-rw-r--r--src/Noddybox.Emulation.EightBit.Z80/Z80Cpu.cs45
-rw-r--r--src/Noddybox.Emulation.EightBit.Z80/Z80CpuBaseOpcodes.cs9
-rw-r--r--src/Noddybox.Emulation.EightBit.Z80/Z80CpuEventArgs.cs55
-rw-r--r--src/Noddybox.Emulation/Clock.cs8
4 files changed, 35 insertions, 82 deletions
diff --git a/src/Noddybox.Emulation.EightBit.Z80/Z80Cpu.cs b/src/Noddybox.Emulation.EightBit.Z80/Z80Cpu.cs
index 676a1b1..a2e6fed 100644
--- a/src/Noddybox.Emulation.EightBit.Z80/Z80Cpu.cs
+++ b/src/Noddybox.Emulation.EightBit.Z80/Z80Cpu.cs
@@ -335,6 +335,24 @@ namespace Noddybox.Emulation.EightBit.Z80
}
/// <summary>
+ /// The current state of the IX register pair.
+ /// </summary>
+ public Register16 IX_Register
+ {
+ get { return IX; }
+ set { IX = value; }
+ }
+
+ /// <summary>
+ /// The current state of the IY register pair.
+ /// </summary>
+ public Register16 IY_Register
+ {
+ get { return IY; }
+ set { IY = value; }
+ }
+
+ /// <summary>
/// The current state of the stack pointer.
/// </summary>
public ushort StackPointer
@@ -400,7 +418,7 @@ namespace Noddybox.Emulation.EightBit.Z80
/// <summary>
/// The state of the IFF1 register.
/// </summary>
- public bool IFF1_Regsiter
+ public bool IFF1_Register
{
get { return IFF1; }
set { IFF1 = value; }
@@ -409,7 +427,7 @@ namespace Noddybox.Emulation.EightBit.Z80
/// <summary>
/// The state of the IFF2 register.
/// </summary>
- public bool IFF2_Regsiter
+ public bool IFF2_Register
{
get { return IFF2; }
set { IFF2 = value; }
@@ -490,17 +508,6 @@ namespace Noddybox.Emulation.EightBit.Z80
Z80CpuEventArgs e = new Z80CpuEventArgs
{
Opcode = opcode,
- A = this.A,
- F = this.F,
- BC = this.BC,
- DE = this.DE,
- HL = this.HL,
- SP = this.SP,
- PC = this.PC,
- AF_ = this.AF_,
- BC_ = this.BC_,
- DE_ = this.DE_,
- HL_ = this.HL_
};
switch(type)
@@ -513,18 +520,6 @@ namespace Noddybox.Emulation.EightBit.Z80
OnEDNopEvent(e);
break;
}
-
- A = e.A;
- F = e.F;
- BC = e.BC;
- DE = e.DE;
- HL = e.HL;
- SP = e.SP;
- PC = e.PC;
- AF_ = e.AF_;
- BC_ = e.BC_;
- DE_ = e.DE_;
- HL_ = e.HL_;
}
#endregion
diff --git a/src/Noddybox.Emulation.EightBit.Z80/Z80CpuBaseOpcodes.cs b/src/Noddybox.Emulation.EightBit.Z80/Z80CpuBaseOpcodes.cs
index 389ba41..24f8093 100644
--- a/src/Noddybox.Emulation.EightBit.Z80/Z80CpuBaseOpcodes.cs
+++ b/src/Noddybox.Emulation.EightBit.Z80/Z80CpuBaseOpcodes.cs
@@ -369,7 +369,7 @@ namespace Noddybox.Emulation.EightBit.Z80
{
reg++;
- F = Z80Flags.Carry;
+ F &= Z80Flags.Carry;
if (reg == 0x80)
{
@@ -380,6 +380,8 @@ namespace Noddybox.Emulation.EightBit.Z80
{
F |= Z80Flags.HalfCarry;
}
+
+ F |= SZtable[reg] | H35table[reg];
}
/// <summary>
@@ -390,7 +392,8 @@ namespace Noddybox.Emulation.EightBit.Z80
{
reg--;
- F = Z80Flags.Carry | Z80Flags.Neg;
+ F &= Z80Flags.Carry;
+ F |= Z80Flags.Neg;
if (reg == 0x7f)
{
@@ -401,6 +404,8 @@ namespace Noddybox.Emulation.EightBit.Z80
{
F |= Z80Flags.HalfCarry;
}
+
+ F |= SZtable[reg] | H35table[reg];
}
/// <summary>
diff --git a/src/Noddybox.Emulation.EightBit.Z80/Z80CpuEventArgs.cs b/src/Noddybox.Emulation.EightBit.Z80/Z80CpuEventArgs.cs
index fb0173a..84edfa1 100644
--- a/src/Noddybox.Emulation.EightBit.Z80/Z80CpuEventArgs.cs
+++ b/src/Noddybox.Emulation.EightBit.Z80/Z80CpuEventArgs.cs
@@ -28,60 +28,5 @@ namespace Noddybox.Emulation.EightBit.Z80
/// The opcode that was executed to trigger the event.
/// </summary>
public byte Opcode {get; set;}
-
- /// <summary>
- /// The current state of the accumulator.
- /// </summary>
- public byte A {get; set;}
-
- /// <summary>
- /// The current state of the flag register.
- /// </summary>
- public Z80Flags F {get; set;}
-
- /// <summary>
- /// The current state of the BC register pair.
- /// </summary>
- public Register16 BC {get; set;}
-
- /// <summary>
- /// The current state of the DE register pair.
- /// </summary>
- public Register16 DE {get; set;}
-
- /// <summary>
- /// The current state of the HL register pair.
- /// </summary>
- public Register16 HL {get; set;}
-
- /// <summary>
- /// The current state of the stack pointer.
- /// </summary>
- public ushort SP {get; set;}
-
- /// <summary>
- /// The current state of the program counter.
- /// </summary>
- public ushort PC {get; set;}
-
- /// <summary>
- /// The alternate AF' register.
- /// </summary>
- public Register16 AF_ {get; set;}
-
- /// <summary>
- /// The alternate BC' register.
- /// </summary>
- public Register16 BC_ {get; set;}
-
- /// <summary>
- /// The alternate DE' register.
- /// </summary>
- public Register16 DE_ {get; set;}
-
- /// <summary>
- /// The alternate HL' register.
- /// </summary>
- public Register16 HL_ {get; set;}
}
}
diff --git a/src/Noddybox.Emulation/Clock.cs b/src/Noddybox.Emulation/Clock.cs
index 72a2cc8..379287e 100644
--- a/src/Noddybox.Emulation/Clock.cs
+++ b/src/Noddybox.Emulation/Clock.cs
@@ -57,6 +57,14 @@ namespace Noddybox.Emulation
}
}
+ /// <summary>
+ /// Gets the ticks this frame so far.
+ /// </summary>
+ public uint Ticks
+ {
+ get {return frameCount;}
+ }
+
#endregion
#region Public members