From 98eadd12718239bc4ed5e3c2c746372877e9deda Mon Sep 17 00:00:00 2001 From: Ian C Date: Tue, 3 Apr 2012 22:51:16 +0000 Subject: Updates --- WPZX81/WPZX81/GamePage.xaml.cs | 2 +- WPZX81/WPZX81/Settings.cs | 6 ++++++ WPZX81/WPZX81/SplashScreenImage.jpg | Bin 64334 -> 171227 bytes WPZX81/WPZX81/ZX81/Emulation.cs | 33 ++++++++++++++++++--------------- 4 files changed, 25 insertions(+), 16 deletions(-) diff --git a/WPZX81/WPZX81/GamePage.xaml.cs b/WPZX81/WPZX81/GamePage.xaml.cs index 26b0324..6d19bbc 100644 --- a/WPZX81/WPZX81/GamePage.xaml.cs +++ b/WPZX81/WPZX81/GamePage.xaml.cs @@ -31,7 +31,7 @@ namespace WPZX81 // Create a timer for this page timer = new GameTimer(); - timer.UpdateInterval = TimeSpan.FromMilliseconds(40); // Updates at 25 fps + timer.UpdateInterval = TimeSpan.FromMilliseconds(20 * Settings.FramesPerUpdate); timer.Update += OnUpdate; timer.Draw += OnDraw; } diff --git a/WPZX81/WPZX81/Settings.cs b/WPZX81/WPZX81/Settings.cs index 7243bc3..f9ca28b 100644 --- a/WPZX81/WPZX81/Settings.cs +++ b/WPZX81/WPZX81/Settings.cs @@ -8,6 +8,12 @@ namespace WPZX81 /// public static class Settings { + + /// + /// Get the number of ZX81 50 frames per second and done for each update on our display. + /// + public static int FramesPerUpdate {get {return 2;}} + /// /// Get/set whether there is a sticky shift key. /// diff --git a/WPZX81/WPZX81/SplashScreenImage.jpg b/WPZX81/WPZX81/SplashScreenImage.jpg index 5cdc466..860b321 100644 Binary files a/WPZX81/WPZX81/SplashScreenImage.jpg and b/WPZX81/WPZX81/SplashScreenImage.jpg differ diff --git a/WPZX81/WPZX81/ZX81/Emulation.cs b/WPZX81/WPZX81/ZX81/Emulation.cs index 0f56e4b..78a2726 100644 --- a/WPZX81/WPZX81/ZX81/Emulation.cs +++ b/WPZX81/WPZX81/ZX81/Emulation.cs @@ -345,23 +345,26 @@ namespace WPZX81.ZX81 { Stopwatch s = Stopwatch.StartNew(); - if (fast) + for(int f = 1; f <= Settings.FramesPerUpdate; f++) { + if (fast) + { + clock.StartFrame(); + Z80.Run(); + clock.StartFrame(); + Z80.Run(); + clock.StartFrame(); + Z80.Run(); + } + clock.StartFrame(); Z80.Run(); - clock.StartFrame(); - Z80.Run(); - clock.StartFrame(); - Z80.Run(); - } - - clock.StartFrame(); - Z80.Run(); - Z80.MaskableInterrupt(0); + Z80.MaskableInterrupt(0); - if (Z80.StackPointer < 0x8000) - { - Housekeeping(); + if (Z80.StackPointer < 0x8000) + { + Housekeeping(); + } } s.Stop(); @@ -503,7 +506,7 @@ namespace WPZX81.ZX81 font = new Texture2D[256]; matrix = new byte[8]; mem = new byte[0x10000]; - clock = new Clock(16000 * 2, 50); + clock = new Clock(16000, 50); Z80 = new Z80Cpu(); Z80.Initialise(this, this, clock); Z80.EDNopEvent += EDCallback; @@ -518,7 +521,7 @@ namespace WPZX81.ZX81 byte IMemory.Read(ushort address) { - return mem[address]; + return mem[address & 0x7fff]; } void IMemory.Write(ushort address, byte value) -- cgit v1.2.3