diff options
Diffstat (limited to 'src/Noddybox.Emulation.EightBit.Z80')
-rw-r--r-- | src/Noddybox.Emulation.EightBit.Z80/Z80Cpu.cs | 17 |
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)
|