summaryrefslogtreecommitdiff
path: root/src/Noddybox.Emulation.EightBit.Z80/Z80Cpu.cs
diff options
context:
space:
mode:
authorIan C <ianc@noddybox.co.uk>2012-04-09 22:59:56 +0000
committerIan C <ianc@noddybox.co.uk>2012-04-09 22:59:56 +0000
commit026d8b1797dc90f989615c4366fcdf714928f14c (patch)
tree12793d0abf81d8ae74d4a7cc416a7700d00c74e3 /src/Noddybox.Emulation.EightBit.Z80/Z80Cpu.cs
parent9ae1a03d201ea52647c33f675bd9c9e7f3c4137a (diff)
Updated clock.
Diffstat (limited to 'src/Noddybox.Emulation.EightBit.Z80/Z80Cpu.cs')
-rw-r--r--src/Noddybox.Emulation.EightBit.Z80/Z80Cpu.cs17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/Noddybox.Emulation.EightBit.Z80/Z80Cpu.cs b/src/Noddybox.Emulation.EightBit.Z80/Z80Cpu.cs
index 06433dc..d575476 100644
--- a/src/Noddybox.Emulation.EightBit.Z80/Z80Cpu.cs
+++ b/src/Noddybox.Emulation.EightBit.Z80/Z80Cpu.cs
@@ -183,6 +183,13 @@ namespace Noddybox.Emulation.EightBit.Z80
}
}
+ private bool VBL {get; set;}
+
+ private void VBLHandler(object sender, ClockEventArgs e)
+ {
+ VBL = true;
+ }
+
#endregion
#region ICpu Members
@@ -193,6 +200,8 @@ namespace Noddybox.Emulation.EightBit.Z80
this.device = device;
this.clock = clock;
+ this.clock.EndOfVBL += VBLHandler;
+
Reset();
}
@@ -238,7 +247,9 @@ namespace Noddybox.Emulation.EightBit.Z80
public void Run()
{
- while(!clock.FrameDone)
+ VBL = false;
+
+ while(!VBL)
{
Step();
}
@@ -570,8 +581,8 @@ namespace Noddybox.Emulation.EightBit.Z80
private void TriggerEvent(EventType type, byte opcode)
{
Z80CpuEventArgs e = new Z80CpuEventArgs
- {
- Opcode = opcode,
+ {
+ Opcode = opcode
};
switch(type)