summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--wpspec/wpspec/ApplicationIcon.pngbin2607 -> 4544 bytes
-rw-r--r--wpspec/wpspec/GamePage.xaml.cs48
-rw-r--r--wpspec/wpspec/Resources/Spectrum.keyboardbin921 -> 1032 bytes
-rw-r--r--wpspec/wpspec/Spectrum/Emulation.cs12
-rw-r--r--wpspec/wpspec/Spectrum/SpectrumKeySymbol.cs3
-rw-r--r--wpspec/wpspec/Spectrum/Tape.cs14
-rw-r--r--wpspec/wpspecLibContent/keyboard.pngbin41620 -> 46980 bytes
7 files changed, 53 insertions, 24 deletions
diff --git a/wpspec/wpspec/ApplicationIcon.png b/wpspec/wpspec/ApplicationIcon.png
index 5c6ac6a..09293bc 100644
--- a/wpspec/wpspec/ApplicationIcon.png
+++ b/wpspec/wpspec/ApplicationIcon.png
Binary files differ
diff --git a/wpspec/wpspec/GamePage.xaml.cs b/wpspec/wpspec/GamePage.xaml.cs
index a6bfd29..4c95e4f 100644
--- a/wpspec/wpspec/GamePage.xaml.cs
+++ b/wpspec/wpspec/GamePage.xaml.cs
@@ -40,6 +40,7 @@ namespace wpspec
private Rectangle locationZoomed;
private Texture2D keyboardImage;
private KeyboardDriver<SpectrumKeySymbol> keyboard;
+ private bool resetPressed;
#endregion
@@ -102,12 +103,14 @@ namespace wpspec
// Create a keyboard driver
//
+ resetPressed = false;
+
keyboardImage = contentManager.Load<Texture2D>("keyboard");
keyboard = new KeyboardDriver<SpectrumKeySymbol>
(SharedGraphicsDeviceManager.Current.GraphicsDevice,
keyboardImage,
- new Vector2(0, 560),
+ new Vector2(0, 540),
Shared.SpectrumKeyboard);
keyboard.KeyEvent += HandleKeyboardEvent;
@@ -180,14 +183,43 @@ namespace wpspec
private void HandleKeyboardEvent(object sender, KeyboardDriver<SpectrumKeySymbol>.KeyPressEventArgs e)
{
- if (e.Pressed)
+ switch (e.Key)
{
- Shared.Spectrum.KeyPressed(e.Key);
- }
- else
- {
- Shared.Spectrum.KeyReleased(e.Key);
- }
+ case SpectrumKeySymbol.KeyReset:
+ if (!e.Pressed)
+ {
+ if (resetPressed)
+ {
+ resetPressed = false;
+ Shared.Spectrum.Reset();
+ }
+ else
+ {
+ resetPressed = true;
+ }
+ }
+ break;
+
+ case SpectrumKeySymbol.KeyJoystick:
+ break;
+
+ case SpectrumKeySymbol.KeyKeypad:
+ break;
+
+ case SpectrumKeySymbol.KeyKeyboard:
+ break;
+
+ default:
+ if (e.Pressed)
+ {
+ Shared.Spectrum.KeyPressed(e.Key);
+ }
+ else
+ {
+ Shared.Spectrum.KeyReleased(e.Key);
+ }
+ break;
+ }
}
private void HandleTouchEvent(object sender, KeyboardDriver<SpectrumKeySymbol>.TouchLocationEventArgs e)
diff --git a/wpspec/wpspec/Resources/Spectrum.keyboard b/wpspec/wpspec/Resources/Spectrum.keyboard
index 3e94ca1..065b5b2 100644
--- a/wpspec/wpspec/Resources/Spectrum.keyboard
+++ b/wpspec/wpspec/Resources/Spectrum.keyboard
Binary files differ
diff --git a/wpspec/wpspec/Spectrum/Emulation.cs b/wpspec/wpspec/Spectrum/Emulation.cs
index 8cf6970..fdcc6ab 100644
--- a/wpspec/wpspec/Spectrum/Emulation.cs
+++ b/wpspec/wpspec/Spectrum/Emulation.cs
@@ -467,14 +467,9 @@ namespace wpspec.Spectrum
/// </summary>
public void Reset()
{
- // Initialise the Spectrum
+ // Initialise the Spectrum and randomize memory.
//
- for(int f = 0; f < 8; f++)
- {
- matrix[f] = 0x1f;
- }
-
- matrix[8] = 0;
+ ResetKeyboard();
Random rnd = new Random();
@@ -483,8 +478,9 @@ namespace wpspec.Spectrum
mem[f] = (byte)rnd.Next(Byte.MaxValue);
}
- // Initialise the Z80
+ // Initialise the Z80 and the clock.
//
+ clock.Reset();
Z80.Reset();
}
diff --git a/wpspec/wpspec/Spectrum/SpectrumKeySymbol.cs b/wpspec/wpspec/Spectrum/SpectrumKeySymbol.cs
index 8869d99..1838983 100644
--- a/wpspec/wpspec/Spectrum/SpectrumKeySymbol.cs
+++ b/wpspec/wpspec/Spectrum/SpectrumKeySymbol.cs
@@ -36,6 +36,7 @@ namespace wpspec.Spectrum
Key1, Key2, Key3, Key4, Key5, Key6, Key7, Key8, Key9, Key0,
KeyQ, KeyW, KeyE, KeyR, KeyT, KeyY, KeyU, KeyI, KeyO, KeyP,
KeyA, KeyS, KeyD, KeyF, KeyG, KeyH, KeyJ, KeyK, KeyL, KeyEnter,
- KeyCapsShift, KeyZ, KeyX, KeyC, KeyV, KeyB, KeyN, KeyM, KeySymbolShift, KeySpace
+ KeyCapsShift, KeyZ, KeyX, KeyC, KeyV, KeyB, KeyN, KeyM, KeySymbolShift, KeySpace,
+ KeyReset, KeyJoystick, KeyKeypad, KeyKeyboard
}
}
diff --git a/wpspec/wpspec/Spectrum/Tape.cs b/wpspec/wpspec/Spectrum/Tape.cs
index b8ce7be..81c183a 100644
--- a/wpspec/wpspec/Spectrum/Tape.cs
+++ b/wpspec/wpspec/Spectrum/Tape.cs
@@ -41,13 +41,13 @@ namespace wpspec.Spectrum
/// <returns>The next word.</returns>
public int ReadWord()
{
- int c1;
- int c2;
-
- c1=Read();
- c2=Read();
-
- return c1+(c2<<8);
+ int c1;
+ int c2;
+
+ c1=Read();
+ c2=Read();
+
+ return c1+(c2<<8);
}
/// <summary>
diff --git a/wpspec/wpspecLibContent/keyboard.png b/wpspec/wpspecLibContent/keyboard.png
index d07908c..73a29a7 100644
--- a/wpspec/wpspecLibContent/keyboard.png
+++ b/wpspec/wpspecLibContent/keyboard.png
Binary files differ