diff --git a/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Hardware/Interfaces/IKeyboard.cs b/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Hardware/Interfaces/IKeyboard.cs index fe4f188ca6..0240fd52f5 100644 --- a/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Hardware/Interfaces/IKeyboard.cs +++ b/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Hardware/Interfaces/IKeyboard.cs @@ -20,14 +20,22 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum string[] KeyboardMatrix { get; set; } /// - /// For 16/48k models + /// Other keyboard keys that are not in the matrix + /// (usually keys derived from key combos) /// - bool Issue2 { get; set; } + string[] NonMatrixKeys { get; set; } /// - /// The current keyboard line status + /// Represents the spectrum key state /// - //byte[] LineStatus { get; set; } + int[] KeyLine { get; set; } + + /// + /// There are some slight differences in how PortIN and PortOUT functions + /// between Issue2 and Issue3 keyboards (16k/48k spectrum only) + /// It is possible that some very old games require Issue2 emulation + /// + bool IsIssue2Keyboard { get; set; } /// /// Sets the spectrum key status @@ -64,6 +72,8 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum /// byte GetByteFromKeyMatrix(string key); + + void SyncState(Serializer ser); } } diff --git a/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Machine/SpectrumBase.Input.cs b/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Machine/SpectrumBase.Input.cs index 01ac5ab51a..d9fb158b9f 100644 --- a/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Machine/SpectrumBase.Input.cs +++ b/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Machine/SpectrumBase.Input.cs @@ -15,14 +15,29 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum { Spectrum.InputCallbacks.Call(); - for (var i = 0; i < KeyboardDevice.KeyboardMatrix.Length; i++) - { - string key = KeyboardDevice.KeyboardMatrix[i]; - bool prevState = KeyboardDevice.GetKeyStatus(key); - bool currState = Spectrum._controller.IsPressed(key); + lock (this) + { + // parse single keyboard matrix keys + for (var i = 0; i < KeyboardDevice.KeyboardMatrix.Length; i++) + { + string key = KeyboardDevice.KeyboardMatrix[i]; + //bool prevState = KeyboardDevice.GetKeyStatus(key); + bool currState = Spectrum._controller.IsPressed(key); - if (currState != prevState) + //if (currState != prevState) KeyboardDevice.SetKeyStatus(key, currState); + } + + // non matrix keys + foreach (string k in KeyboardDevice.NonMatrixKeys) + { + if (!k.StartsWith("Key")) + continue; + + bool currState = Spectrum._controller.IsPressed(k); + + KeyboardDevice.SetKeyStatus(k, currState); + } } // Tape control @@ -45,3 +60,4 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum } } } + diff --git a/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Machine/SpectrumBase.Port.cs b/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Machine/SpectrumBase.Port.cs index a8b715a214..a37b24d22d 100644 --- a/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Machine/SpectrumBase.Port.cs +++ b/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Machine/SpectrumBase.Port.cs @@ -26,18 +26,19 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum { CPU.TotalExecutedCycles += 4; - byte result = 0xFF; + int result = 0xFF; // get the high byte from Regs[6] ushort high = CPU.Regs[6]; // combine the low byte (passed in as port) and the high byte (maybe not needed) - ushort word = Convert.ToUInt16((port << 8 | high)); + //ushort word = Convert.ToUInt16((port << 8 | high)); + int word = (high << 8) + port; // Check whether the low bit is reset // Technically the ULA should respond to every even I/O address - bool lowBitReset = (port & 0x0001) == 0; - + bool lowBitReset = (port & 0x0001) == 0; + // Kempston Joystick //not implemented yet @@ -53,15 +54,80 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum 0xf7fe 1, 2, 3, 4, 5 0x7ffe SPACE, SYM SHFT, M, N, B */ + if ((word & 0x8000) == 0) + result &= KeyboardDevice.KeyLine[7]; + + if ((word & 0x4000) == 0) + result &= KeyboardDevice.KeyLine[6]; + + if ((word & 0x2000) == 0) + result &= KeyboardDevice.KeyLine[5]; + + if ((word & 0x1000) == 0) + result &= KeyboardDevice.KeyLine[4]; + + if ((word & 0x800) == 0) + result &= KeyboardDevice.KeyLine[3]; + + if ((word & 0x400) == 0) + result &= KeyboardDevice.KeyLine[2]; + + if ((word & 0x200) == 0) + result &= KeyboardDevice.KeyLine[1]; + + if ((word & 0x100) == 0) + result &= KeyboardDevice.KeyLine[0]; + + result = result & 0x1f; //mask out lower 4 bits + result = result | 0xa0; //set bit 5 & 7 to 1 + + if (TapeDevice.CurrentMode == TapeOperationMode.Load) + { + if (!TapeDevice.GetEarBit(CPU.TotalExecutedCycles)) + { + result &= ~(TAPE_BIT); // reset is EAR ON + } + else + { + result |= (TAPE_BIT); // set is EAR Off + } + } + else + { + if (KeyboardDevice.IsIssue2Keyboard) + { + if ((LastULAOutByte & (EAR_BIT + MIC_BIT)) == 0) + { + result &= ~(TAPE_BIT); + } + else + { + result |= TAPE_BIT; + } + } + else + { + if ((LastULAOutByte & EAR_BIT) == 0) + { + result &= ~(TAPE_BIT); + } + else + { + result |= TAPE_BIT; + } + } + } + /* // read keyboard input if (high != 0) - result = KeyboardDevice.GetLineStatus((byte)high); + result &= KeyboardDevice.GetLineStatus((byte)high); var ear = TapeDevice.GetEarBit(CPU.TotalExecutedCycles); if (!ear) { result = (byte)(result & Convert.ToInt32("10111111", 2)); } + */ } else { @@ -75,7 +141,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum // if unused port the floating memory bus should be returned (still todo) } - return result; + return (byte)(result & 0xff); } /// @@ -103,10 +169,10 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum | | | | E | M | Border | +-------------------------------+ */ - + // Border - LSB 3 bits hold the border colour BorderColour = value & BORDER_BIT; - + // Buzzer BuzzerDevice.ProcessPulseValue(false, (value & EAR_BIT) != 0); diff --git a/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Machine/ZXSpectrum48K/ZX48.Keyboard.cs b/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Machine/ZXSpectrum48K/ZX48.Keyboard.cs index 501dd6186b..c20faa7fa4 100644 --- a/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Machine/ZXSpectrum48K/ZX48.Keyboard.cs +++ b/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/Machine/ZXSpectrum48K/ZX48.Keyboard.cs @@ -13,9 +13,23 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum public class Keyboard48 : IKeyboard { public SpectrumBase _machine { get; set; } - private byte[] LineStatus; - public bool Issue2 { get; set; } + private byte[] LineStatus; private string[] _keyboardMatrix; + private int[] _keyLine; + private bool _isIssue2Keyboard; + private string[] _nonMatrixKeys; + + public bool IsIssue2Keyboard + { + get { return _isIssue2Keyboard; } + set { _isIssue2Keyboard = value; } + } + + public int[] KeyLine + { + get { return _keyLine; } + set { _keyLine = value; } + } public string[] KeyboardMatrix { @@ -23,6 +37,12 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum set { _keyboardMatrix = value; } } + public string[] NonMatrixKeys + { + get { return _nonMatrixKeys; } + set { _nonMatrixKeys = value; } + } + public Keyboard48(SpectrumBase machine) { _machine = machine; @@ -44,23 +64,185 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum // 0xbffe - 30 - 34 "Key Return", "Key L", "Key K", "Key J", "Key H", // 0x7ffe - 35 - 39 - "Key Space", "Key Sym Shift", "Key M", "Key N", "Key B" + "Key Space", "Key Symbol Shift", "Key M", "Key N", "Key B" }; + var nonMatrix = new List(); + foreach (var key in ZXSpectrum.ZXSpectrumControllerDefinition.BoolButtons) + { + if (!KeyboardMatrix.Any(s => s == key)) + nonMatrix.Add(key); + } + NonMatrixKeys = nonMatrix.ToArray(); + LineStatus = new byte[8]; + _keyLine = new int[] { 255, 255, 255, 255, 255, 255, 255, 255 }; + IsIssue2Keyboard = false; } - public void SetKeyStatus(string key, bool isPressed) + public void SetKeyStatus(string key, bool isPressed) { + /* byte keyByte = GetByteFromKeyMatrix(key); var lineIndex = keyByte / 5; var lineMask = 1 << keyByte % 5; LineStatus[lineIndex] = isPressed ? (byte)(LineStatus[lineIndex] | lineMask) : (byte)(LineStatus[lineIndex] & ~lineMask); + */ + + int k = GetByteFromKeyMatrix(key); + + if (isPressed) + { + switch (k) + { + // 0xfefe - 0 - 4 + case 0: _keyLine[0] = (_keyLine[0] & ~(0x01)); break; + case 1: _keyLine[0] = (_keyLine[0] & ~(0x02)); break; + case 2: _keyLine[0] = (_keyLine[0] & ~(0x04)); break; + case 3: _keyLine[0] = (_keyLine[0] & ~(0x08)); break; + case 4: _keyLine[0] = (_keyLine[0] & ~(0x10)); break; + // 0xfdfe - 5 - 9 + case 5: _keyLine[1] = (_keyLine[1] & ~(0x01)); break; + case 6: _keyLine[1] = (_keyLine[1] & ~(0x02)); break; + case 7: _keyLine[1] = (_keyLine[1] & ~(0x04)); break; + case 8: _keyLine[1] = (_keyLine[1] & ~(0x08)); break; + case 9: _keyLine[1] = (_keyLine[1] & ~(0x10)); break; + // 0xfbfe - 10 - 14 + case 10: _keyLine[2] = (_keyLine[2] & ~(0x01)); break; + case 11: _keyLine[2] = (_keyLine[2] & ~(0x02)); break; + case 12: _keyLine[2] = (_keyLine[2] & ~(0x04)); break; + case 13: _keyLine[2] = (_keyLine[2] & ~(0x08)); break; + case 14: _keyLine[2] = (_keyLine[2] & ~(0x10)); break; + // 0xf7fe - 15 - 19 + case 15: _keyLine[3] = (_keyLine[3] & ~(0x01)); break; + case 16: _keyLine[3] = (_keyLine[3] & ~(0x02)); break; + case 17: _keyLine[3] = (_keyLine[3] & ~(0x04)); break; + case 18: _keyLine[3] = (_keyLine[3] & ~(0x08)); break; + case 19: _keyLine[3] = (_keyLine[3] & ~(0x10)); break; + // 0xeffe - 20 - 24 + case 20: _keyLine[4] = (_keyLine[4] & ~(0x01)); break; + case 21: _keyLine[4] = (_keyLine[4] & ~(0x02)); break; + case 22: _keyLine[4] = (_keyLine[4] & ~(0x04)); break; + case 23: _keyLine[4] = (_keyLine[4] & ~(0x08)); break; + case 24: _keyLine[4] = (_keyLine[4] & ~(0x10)); break; + // 0xdffe - 25 - 29 + case 25: _keyLine[5] = (_keyLine[5] & ~(0x01)); break; + case 26: _keyLine[5] = (_keyLine[5] & ~(0x02)); break; + case 27: _keyLine[5] = (_keyLine[5] & ~(0x04)); break; + case 28: _keyLine[5] = (_keyLine[5] & ~(0x08)); break; + case 29: _keyLine[5] = (_keyLine[5] & ~(0x10)); break; + // 0xbffe - 30 - 34 + case 30: _keyLine[6] = (_keyLine[6] & ~(0x01)); break; + case 31: _keyLine[6] = (_keyLine[6] & ~(0x02)); break; + case 32: _keyLine[6] = (_keyLine[6] & ~(0x04)); break; + case 33: _keyLine[6] = (_keyLine[6] & ~(0x08)); break; + case 34: _keyLine[6] = (_keyLine[6] & ~(0x10)); break; + // 0x7ffe - 35 - 39 + case 35: _keyLine[7] = (_keyLine[7] & ~(0x01)); break; + case 36: _keyLine[7] = (_keyLine[7] & ~(0x02)); break; + case 37: _keyLine[7] = (_keyLine[7] & ~(0x04)); break; + case 38: _keyLine[7] = (_keyLine[7] & ~(0x08)); break; + case 39: _keyLine[7] = (_keyLine[7] & ~(0x10)); break; + } + } + else + { + switch (k) + { + // 0xfefe - 0 - 4 + case 0: _keyLine[0] = (_keyLine[0] | (0x01)); break; + case 1: _keyLine[0] = (_keyLine[0] | (0x02)); break; + case 2: _keyLine[0] = (_keyLine[0] | (0x04)); break; + case 3: _keyLine[0] = (_keyLine[0] | (0x08)); break; + case 4: _keyLine[0] = (_keyLine[0] | (0x10)); break; + // 0xfdfe - 5 - 9 + case 5: _keyLine[1] = (_keyLine[1] | (0x01)); break; + case 6: _keyLine[1] = (_keyLine[1] | (0x02)); break; + case 7: _keyLine[1] = (_keyLine[1] | (0x04)); break; + case 8: _keyLine[1] = (_keyLine[1] | (0x08)); break; + case 9: _keyLine[1] = (_keyLine[1] | (0x10)); break; + // 0xfbfe - 10 - 14 + case 10: _keyLine[2] = (_keyLine[2] | (0x01)); break; + case 11: _keyLine[2] = (_keyLine[2] | (0x02)); break; + case 12: _keyLine[2] = (_keyLine[2] | (0x04)); break; + case 13: _keyLine[2] = (_keyLine[2] | (0x08)); break; + case 14: _keyLine[2] = (_keyLine[2] | (0x10)); break; + // 0xf7fe - 15 - 19 + case 15: _keyLine[3] = (_keyLine[3] | (0x01)); break; + case 16: _keyLine[3] = (_keyLine[3] | (0x02)); break; + case 17: _keyLine[3] = (_keyLine[3] | (0x04)); break; + case 18: _keyLine[3] = (_keyLine[3] | (0x08)); break; + case 19: _keyLine[3] = (_keyLine[3] | (0x10)); break; + // 0xeffe - 20 - 24 + case 20: _keyLine[4] = (_keyLine[4] | (0x01)); break; + case 21: _keyLine[4] = (_keyLine[4] | (0x02)); break; + case 22: _keyLine[4] = (_keyLine[4] | (0x04)); break; + case 23: _keyLine[4] = (_keyLine[4] | (0x08)); break; + case 24: _keyLine[4] = (_keyLine[4] | (0x10)); break; + // 0xdffe - 25 - 29 + case 25: _keyLine[5] = (_keyLine[5] | (0x01)); break; + case 26: _keyLine[5] = (_keyLine[5] | (0x02)); break; + case 27: _keyLine[5] = (_keyLine[5] | (0x04)); break; + case 28: _keyLine[5] = (_keyLine[5] | (0x08)); break; + case 29: _keyLine[5] = (_keyLine[5] | (0x10)); break; + // 0xbffe - 30 - 34 + case 30: _keyLine[6] = (_keyLine[6] | (0x01)); break; + case 31: _keyLine[6] = (_keyLine[6] | (0x02)); break; + case 32: _keyLine[6] = (_keyLine[6] | (0x04)); break; + case 33: _keyLine[6] = (_keyLine[6] | (0x08)); break; + case 34: _keyLine[6] = (_keyLine[6] | (0x10)); break; + // 0x7ffe - 35 - 39 + case 35: _keyLine[7] = (_keyLine[7] | (0x01)); break; + case 36: _keyLine[7] = (_keyLine[7] | (0x02)); break; + case 37: _keyLine[7] = (_keyLine[7] | (0x04)); break; + case 38: _keyLine[7] = (_keyLine[7] | (0x08)); break; + case 39: _keyLine[7] = (_keyLine[7] | (0x10)); break; + } + } + + // Combination keys that are not in the keyboard matrix + // but are available on the Spectrum+, 128k +2 & +3 + // (GetByteFromKeyMatrix() should return 255) + // Processed after the matrix keys - only presses handled (unpressed get done above) + if (k == 255) + { + if (isPressed) + { + switch (key) + { + // Delete key (simulates Caps Shift + 0) + case "Key Delete": + _keyLine[0] = _keyLine[0] & ~(0x1); + _keyLine[4] = _keyLine[4] & ~(0x1); + break; + // Cursor left (simulates Caps Shift + 5) + case "Key Left Cursor": + _keyLine[0] = _keyLine[0] & ~(0x1); + _keyLine[3] = _keyLine[3] & ~(0x10); + break; + // Cursor right (simulates Caps Shift + 8) + case "Key Right Cursor": + _keyLine[0] = _keyLine[0] & ~(0x1); + _keyLine[4] = _keyLine[4] & ~(0x04); + break; + // Cursor up (simulates Caps Shift + 7) + case "Key Up Cursor": + _keyLine[0] = _keyLine[0] & ~(0x1); + _keyLine[4] = _keyLine[4] & ~(0x08); + break; + // Cursor down (simulates Caps Shift + 6) + case "Key Down Cursor": + _keyLine[0] = _keyLine[0] & ~(0x1); + _keyLine[4] = _keyLine[4] & ~(0x10); + break; + } + } + } } - public bool GetKeyStatus(string key) + public bool GetKeyStatus(string key) { byte keyByte = GetByteFromKeyMatrix(key); var lineIndex = keyByte / 5; @@ -68,8 +250,9 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum return (LineStatus[lineIndex] & lineMask) != 0; } - public byte GetLineStatus(byte lines) + public byte GetLineStatus(byte lines) { + /* lock(this) { byte status = 0; @@ -86,9 +269,23 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum return result; } + */ + + switch (lines) + { + case 0xfe: return (byte)KeyLine[0]; + case 0xfd: return (byte)KeyLine[1]; + case 0xfb: return (byte)KeyLine[2]; + case 0xf7: return (byte)KeyLine[3]; + case 0xef: return (byte)KeyLine[4]; + case 0xdf: return (byte)KeyLine[5]; + case 0xbf: return (byte)KeyLine[6]; + case 0x7f: return (byte)KeyLine[7]; + default: return 0; + } } - public byte ReadKeyboardByte(ushort addr) + public byte ReadKeyboardByte(ushort addr) { return GetLineStatus((byte)(addr >> 8)); } @@ -103,6 +300,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum { ser.BeginSection("Keyboard"); ser.Sync("LineStatus", ref LineStatus, false); + ser.Sync("_keyLine", ref _keyLine, false); ser.EndSection(); } } diff --git a/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/ZXSpectrum.Controllers.cs b/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/ZXSpectrum.Controllers.cs index 6d06bc54c3..d0f40166ec 100644 --- a/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/ZXSpectrum.Controllers.cs +++ b/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/ZXSpectrum.Controllers.cs @@ -4,79 +4,30 @@ using BizHawk.Emulation.Common; namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum { public partial class ZXSpectrum - { + { /// - /// The standard 48K Spectrum keyboard + /// Controller mapping includes all keyboard keys from the following models: /// https://upload.wikimedia.org/wikipedia/commons/thumb/3/33/ZXSpectrum48k.jpg/1200px-ZXSpectrum48k.jpg + /// https://upload.wikimedia.org/wikipedia/commons/c/ca/ZX_Spectrum%2B.jpg /// - private static readonly ControllerDefinition ZXSpectrumControllerDefinition48 = new ControllerDefinition + public static readonly ControllerDefinition ZXSpectrumControllerDefinition = new ControllerDefinition { - Name = "ZXSpectrum Controller 48K", + Name = "ZXSpectrum Controller", BoolButtons = { // Joystick interface (not yet emulated) - Could be Kempston/Cursor/Protek "P1 Up", "P1 Down", "P1 Left", "P1 Right", "P1 Button", // Keyboard - row 1 - "Key 1", "Key 2", "Key 3", "Key 4", "Key 5", "Key 6", "Key 7", "Key 8", "Key 9", "Key 0", + /*"Key True Video", "Key Inv Video",*/ "Key 1", "Key 2", "Key 3", "Key 4", "Key 5", "Key 6", "Key 7", "Key 8", "Key 9", "Key 0", "Key Break", // Keyboard - row 2 - "Key Q", "Key W", "Key E", "Key R", "Key T", "Key Y", "Key U", "Key I", "Key O", "Key P", + "Key Delete", /*"Key Graph",*/ "Key Q", "Key W", "Key E", "Key R", "Key T", "Key Y", "Key U", "Key I", "Key O", "Key P", // Keyboard - row 3 - "Key A", "Key S", "Key D", "Key F", "Key G", "Key H", "Key J", "Key K", "Key L", "Key Return", + /*"Key Extend Mode", "Key Edit",*/ "Key A", "Key S", "Key D", "Key F", "Key G", "Key H", "Key J", "Key K", "Key L", "Key Return", // Keyboard - row 4 - "Key Caps Shift", "Key Z", "Key X", "Key C", "Key V", "Key B", "Key N", "Key M", "Key Sym Shift", "Key Space", - // Tape functions - "Play Tape", "Stop Tape", "RTZ Tape", "Record Tape" - } - }; - - /// - /// The newer spectrum keyboard (models 48k+, 128k) - /// https://upload.wikimedia.org/wikipedia/commons/c/ca/ZX_Spectrum%2B.jpg - /// - private static readonly ControllerDefinition ZXSpectrumControllerDefinition128 = new ControllerDefinition - { - Name = "ZXSpectrum Controller 48KPlus", - BoolButtons = - { - // Joystick interface (not yet emulated) - Could be Kempston/Cursor/Protek - "P1 Up", "P1 Down", "P1 Left", "P1 Right", "P1 Button", - // Keyboard - row 1 - "Key True Video", "Key Inv Video", "Key 1", "Key 2", "Key 3", "Key 4", "Key 5", "Key 6", "Key 7", "Key 8", "Key 9", "Key 0", "Key Break", - // Keyboard - row 2 - "Key Delete", "Key Graph", "Key Q", "Key W", "Key E", "Key R", "Key T", "Key Y", "Key U", "Key I", "Key O", "Key P", - // Keyboard - row 3 - "Key Extend Mode", "Key Edit", "Key A", "Key S", "Key D", "Key F", "Key G", "Key H", "Key J", "Key K", "Key L", "Key Return", - // Keyboard - row 4 - "Key Caps Shift", "Key Caps Lock", "Key Z", "Key X", "Key C", "Key V", "Key B", "Key N", "Key M", "Key Period", + "Key Caps Shift", /*"Key Caps Lock",*/ "Key Z", "Key X", "Key C", "Key V", "Key B", "Key N", "Key M", /*"Key Period",*/ // Keyboard - row 5 - "Key Symbol Shift", "Key Semi-Colon", "Key Inverted-Comma", "Key Left Cursor", "Key Right Cursor", "Key Space", "Key Up Cursor", "Key Down Cursor", "Key Comma", "Key Symbol Shift", - // Tape functions - "Play Tape", "Stop Tape", "RTZ Tape", "Record Tape" - } - }; - - /// - /// The amstrad models - same as the previous keyboard layout but with built in ZX Interface 2 joystick ports - /// https://upload.wikimedia.org/wikipedia/commons/c/ca/ZX_Spectrum%2B.jpg - /// - private static readonly ControllerDefinition ZXSpectrumControllerDefinitionPlus = new ControllerDefinition - { - Name = "ZXSpectrum Controller 48KPlus", - BoolButtons = - { - // Joystick interface (not yet emulated) - "P1 Up", "P1 Down", "P1 Left", "P1 Right", "P1 Button", - // Keyboard - row 1 - "Key True Video", "Key Inv Video", "Key 1", "Key 2", "Key 3", "Key 4", "Key 5", "Key 6", "Key 7", "Key 8", "Key 9", "Key 0", "Key Break", - // Keyboard - row 2 - "Key Delete", "Key Graph", "Key Q", "Key W", "Key E", "Key R", "Key T", "Key Y", "Key U", "Key I", "Key O", "Key P", - // Keyboard - row 3 - "Key Extend Mode", "Key Edit", "Key A", "Key S", "Key D", "Key F", "Key G", "Key H", "Key J", "Key K", "Key L", "Key Return", - // Keyboard - row 4 - "Key Caps Shift", "Key Caps Lock", "Key Z", "Key X", "Key C", "Key V", "Key B", "Key N", "Key M", "Key Period", - // Keyboard - row 5 - "Key Symbol Shift", "Key Semi-Colon", "Key Inverted-Comma", "Key Left Cursor", "Key Right Cursor", "Key Space", "Key Up Cursor", "Key Down Cursor", "Key Comma", "Key Symbol Shift", + "Key Symbol Shift", /*"Key Semi-Colon", "Key Quote",*/ "Key Left Cursor", "Key Right Cursor", "Key Space", "Key Up Cursor", "Key Down Cursor", /*"Key Comma",*/ // Tape functions "Play Tape", "Stop Tape", "RTZ Tape", "Record Tape" } diff --git a/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/ZXSpectrum.cs b/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/ZXSpectrum.cs index 806b02ccc3..1a56bdfd4d 100644 --- a/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/ZXSpectrum.cs +++ b/BizHawk.Emulation.Cores/Computers/SinclairSpectrum/ZXSpectrum.cs @@ -37,7 +37,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum switch (Settings.MachineType) { case MachineType.ZXSpectrum48: - ControllerDefinition = ZXSpectrumControllerDefinition48; + ControllerDefinition = ZXSpectrumControllerDefinition; Init(MachineType.ZXSpectrum48, Settings.BorderType, SyncSettings.TapeLoadSpeed, _file); break; default: