From 026d8b1797dc90f989615c4366fcdf714928f14c Mon Sep 17 00:00:00 2001 From: Ian C Date: Mon, 9 Apr 2012 22:59:56 +0000 Subject: Updated clock. --- src/Noddybox.Emulation.EightBit.Z80/Z80Cpu.cs | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'src/Noddybox.Emulation.EightBit.Z80/Z80Cpu.cs') 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) -- cgit v1.2.3