From b2c1b83fcdf0f3c19a8364b347e67ef9640403bb Mon Sep 17 00:00:00 2001
From: Thomas Harte <thomas.harte@gmail.com>
Date: Thu, 19 Oct 2017 22:27:30 -0400
Subject: [PATCH] Consolidates Vic-20 keyboard code.

---
 Machines/Commodore/Vic-20/CharacterMapper.hpp | 25 -------
 .../{CharacterMapper.cpp => Keyboard.cpp}     | 67 ++++++++++++++++-
 Machines/Commodore/Vic-20/Keyboard.hpp        | 52 +++++++++++++
 Machines/Commodore/Vic-20/KeyboardMapper.cpp  | 73 -------------------
 Machines/Commodore/Vic-20/KeyboardMapper.hpp  | 24 ------
 Machines/Commodore/Vic-20/Vic20.cpp           |  3 +-
 Machines/Commodore/Vic-20/Vic20.hpp           | 24 ------
 .../Clock Signal.xcodeproj/project.pbxproj    | 22 ++----
 8 files changed, 123 insertions(+), 167 deletions(-)
 delete mode 100644 Machines/Commodore/Vic-20/CharacterMapper.hpp
 rename Machines/Commodore/Vic-20/{CharacterMapper.cpp => Keyboard.cpp} (64%)
 create mode 100644 Machines/Commodore/Vic-20/Keyboard.hpp
 delete mode 100644 Machines/Commodore/Vic-20/KeyboardMapper.cpp
 delete mode 100644 Machines/Commodore/Vic-20/KeyboardMapper.hpp

diff --git a/Machines/Commodore/Vic-20/CharacterMapper.hpp b/Machines/Commodore/Vic-20/CharacterMapper.hpp
deleted file mode 100644
index 15c6ecc5c..000000000
--- a/Machines/Commodore/Vic-20/CharacterMapper.hpp
+++ /dev/null
@@ -1,25 +0,0 @@
-//
-//  CharacterMapper.hpp
-//  Clock Signal
-//
-//  Created by Thomas Harte on 03/08/2017.
-//  Copyright © 2017 Thomas Harte. All rights reserved.
-//
-
-#ifndef Machines_Commodore_Vic20_CharacterMapper_hpp
-#define Machines_Commodore_Vic20_CharacterMapper_hpp
-
-#include "../../Typer.hpp"
-
-namespace Commodore {
-namespace Vic20 {
-
-class CharacterMapper: public ::Utility::CharacterMapper {
-	public:
-		uint16_t *sequence_for_character(char character);
-};
-
-}
-}
-
-#endif /* CharacterMapper_hpp */
diff --git a/Machines/Commodore/Vic-20/CharacterMapper.cpp b/Machines/Commodore/Vic-20/Keyboard.cpp
similarity index 64%
rename from Machines/Commodore/Vic-20/CharacterMapper.cpp
rename to Machines/Commodore/Vic-20/Keyboard.cpp
index 40c71ac08..7bede4a65 100644
--- a/Machines/Commodore/Vic-20/CharacterMapper.cpp
+++ b/Machines/Commodore/Vic-20/Keyboard.cpp
@@ -1,16 +1,77 @@
 //
-//  CharacterMapper.cpp
+//  KeyboardMapper.cpp
 //  Clock Signal
 //
-//  Created by Thomas Harte on 03/08/2017.
+//  Created by Thomas Harte on 10/10/2017.
 //  Copyright © 2017 Thomas Harte. All rights reserved.
 //
 
-#include "CharacterMapper.hpp"
+#include "Keyboard.hpp"
 #include "Vic20.hpp"
 
 using namespace Commodore::Vic20;
 
+uint16_t KeyboardMapper::mapped_key_for_key(Inputs::Keyboard::Key key) {
+#define BIND(source, dest)	case Inputs::Keyboard::Key::source:	return Commodore::Vic20::dest
+	switch(key) {
+		default: break;
+
+		BIND(k0, Key0);		BIND(k1, Key1);		BIND(k2, Key2);		BIND(k3, Key3);		BIND(k4, Key4);
+		BIND(k5, Key5);		BIND(k6, Key6);		BIND(k7, Key7);		BIND(k8, Key8);		BIND(k9, Key9);
+		BIND(Q, KeyQ);		BIND(W, KeyW);		BIND(E, KeyE);		BIND(R, KeyR);		BIND(T, KeyT);
+		BIND(Y, KeyY);		BIND(U, KeyU);		BIND(I, KeyI);		BIND(O, KeyO);		BIND(P, KeyP);
+		BIND(A, KeyA);		BIND(S, KeyS);		BIND(D, KeyD);		BIND(F, KeyF);		BIND(G, KeyG);
+		BIND(H, KeyH);		BIND(J, KeyJ);		BIND(K, KeyK);		BIND(L, KeyL);
+		BIND(Z, KeyZ);		BIND(X, KeyX);		BIND(C, KeyC);		BIND(V, KeyV);
+		BIND(B, KeyB);		BIND(N, KeyN);		BIND(M, KeyM);
+
+		BIND(BackTick, KeyLeft);
+		BIND(Hyphen, KeyPlus);
+		BIND(Equals, KeyDash);
+		BIND(F11, KeyGBP);
+		BIND(F12, KeyHome);
+
+		BIND(Tab, KeyControl);
+		BIND(OpenSquareBracket, KeyAt);
+		BIND(CloseSquareBracket, KeyAsterisk);
+
+		BIND(BackSlash, KeyRestore);
+		BIND(Hash, KeyUp);
+		BIND(F10, KeyUp);
+
+		BIND(Semicolon, KeyColon);
+		BIND(Quote, KeySemicolon);
+		BIND(F9, KeyEquals);
+
+		BIND(LeftMeta, KeyCBM);
+		BIND(LeftOption, KeyCBM);
+		BIND(RightOption, KeyCBM);
+		BIND(RightMeta, KeyCBM);
+
+		BIND(LeftShift, KeyLShift);
+		BIND(RightShift, KeyRShift);
+
+		BIND(Comma, KeyComma);
+		BIND(FullStop, KeyFullStop);
+		BIND(ForwardSlash, KeySlash);
+
+		BIND(Right, KeyRight);
+		BIND(Down, KeyDown);
+
+		BIND(Enter, KeyReturn);
+		BIND(Space, KeySpace);
+		BIND(BackSpace, KeyDelete);
+		
+		BIND(Escape, KeyRunStop);
+		BIND(F1, KeyF1);
+		BIND(F3, KeyF3);
+		BIND(F5, KeyF5);
+		BIND(F7, KeyF7);
+	}
+#undef BIND
+	return KeyboardMachine::Machine::KeyNotMapped;
+}
+
 uint16_t *CharacterMapper::sequence_for_character(char character) {
 #define KEYS(...)	{__VA_ARGS__, KeyboardMachine::Machine::KeyEndSequence}
 #define SHIFT(...)	{KeyLShift, __VA_ARGS__, KeyboardMachine::Machine::KeyEndSequence}
diff --git a/Machines/Commodore/Vic-20/Keyboard.hpp b/Machines/Commodore/Vic-20/Keyboard.hpp
new file mode 100644
index 000000000..0b5f62224
--- /dev/null
+++ b/Machines/Commodore/Vic-20/Keyboard.hpp
@@ -0,0 +1,52 @@
+//
+//  KeyboardMapper.hpp
+//  Clock Signal
+//
+//  Created by Thomas Harte on 10/10/2017.
+//  Copyright © 2017 Thomas Harte. All rights reserved.
+//
+
+#ifndef Machines_Commodore_Vic20_KeyboardMapper_hpp
+#define Machines_Commodore_Vic20_KeyboardMapper_hpp
+
+#include "../../KeyboardMachine.hpp"
+#include "../../Typer.hpp"
+
+namespace Commodore {
+namespace Vic20 {
+
+enum Key: uint16_t {
+#define key(line, mask) (((mask) << 3) | (line))
+	Key2		= key(7, 0x01),		Key4		= key(7, 0x02),		Key6			= key(7, 0x04),		Key8		= key(7, 0x08),
+	Key0		= key(7, 0x10),		KeyDash		= key(7, 0x20),		KeyHome			= key(7, 0x40),		KeyF7		= key(7, 0x80),
+	KeyQ		= key(6, 0x01),		KeyE		= key(6, 0x02),		KeyT			= key(6, 0x04),		KeyU		= key(6, 0x08),
+	KeyO		= key(6, 0x10),		KeyAt		= key(6, 0x20),		KeyUp			= key(6, 0x40),		KeyF5		= key(6, 0x80),
+	KeyCBM		= key(5, 0x01),		KeyS		= key(5, 0x02),		KeyF			= key(5, 0x04),		KeyH		= key(5, 0x08),
+	KeyK		= key(5, 0x10),		KeyColon	= key(5, 0x20),		KeyEquals		= key(5, 0x40),		KeyF3		= key(5, 0x80),
+	KeySpace	= key(4, 0x01),		KeyZ		= key(4, 0x02),		KeyC			= key(4, 0x04),		KeyB		= key(4, 0x08),
+	KeyM		= key(4, 0x10),		KeyFullStop	= key(4, 0x20),		KeyRShift		= key(4, 0x40),		KeyF1		= key(4, 0x80),
+	KeyRunStop	= key(3, 0x01),		KeyLShift	= key(3, 0x02),		KeyX			= key(3, 0x04),		KeyV		= key(3, 0x08),
+	KeyN		= key(3, 0x10),		KeyComma	= key(3, 0x20),		KeySlash		= key(3, 0x40),		KeyDown		= key(3, 0x80),
+	KeyControl	= key(2, 0x01),		KeyA		= key(2, 0x02),		KeyD			= key(2, 0x04),		KeyG		= key(2, 0x08),
+	KeyJ		= key(2, 0x10),		KeyL		= key(2, 0x20),		KeySemicolon	= key(2, 0x40),		KeyRight	= key(2, 0x80),
+	KeyLeft		= key(1, 0x01),		KeyW		= key(1, 0x02),		KeyR			= key(1, 0x04),		KeyY		= key(1, 0x08),
+	KeyI		= key(1, 0x10),		KeyP		= key(1, 0x20),		KeyAsterisk		= key(1, 0x40),		KeyReturn	= key(1, 0x80),
+	Key1		= key(0, 0x01),		Key3		= key(0, 0x02),		Key5			= key(0, 0x04),		Key7		= key(0, 0x08),
+	Key9		= key(0, 0x10),		KeyPlus		= key(0, 0x20),		KeyGBP			= key(0, 0x40),		KeyDelete	= key(0, 0x80),
+
+	KeyRestore 	= 0xfffd
+#undef key
+};
+
+struct KeyboardMapper: public KeyboardMachine::Machine::KeyboardMapper {
+	uint16_t mapped_key_for_key(Inputs::Keyboard::Key key);
+};
+
+struct CharacterMapper: public ::Utility::CharacterMapper {
+	uint16_t *sequence_for_character(char character);
+};
+
+}
+}
+
+#endif /* KeyboardMapper_hpp */
diff --git a/Machines/Commodore/Vic-20/KeyboardMapper.cpp b/Machines/Commodore/Vic-20/KeyboardMapper.cpp
deleted file mode 100644
index 013da837d..000000000
--- a/Machines/Commodore/Vic-20/KeyboardMapper.cpp
+++ /dev/null
@@ -1,73 +0,0 @@
-//
-//  KeyboardMapper.cpp
-//  Clock Signal
-//
-//  Created by Thomas Harte on 10/10/2017.
-//  Copyright © 2017 Thomas Harte. All rights reserved.
-//
-
-#include "KeyboardMapper.hpp"
-#include "Vic20.hpp"
-
-using namespace Commodore::Vic20;
-
-uint16_t KeyboardMapper::mapped_key_for_key(Inputs::Keyboard::Key key) {
-#define BIND(source, dest)	case Inputs::Keyboard::Key::source:	return Commodore::Vic20::dest
-	switch(key) {
-		default: break;
-
-		BIND(k0, Key0);		BIND(k1, Key1);		BIND(k2, Key2);		BIND(k3, Key3);		BIND(k4, Key4);
-		BIND(k5, Key5);		BIND(k6, Key6);		BIND(k7, Key7);		BIND(k8, Key8);		BIND(k9, Key9);
-		BIND(Q, KeyQ);		BIND(W, KeyW);		BIND(E, KeyE);		BIND(R, KeyR);		BIND(T, KeyT);
-		BIND(Y, KeyY);		BIND(U, KeyU);		BIND(I, KeyI);		BIND(O, KeyO);		BIND(P, KeyP);
-		BIND(A, KeyA);		BIND(S, KeyS);		BIND(D, KeyD);		BIND(F, KeyF);		BIND(G, KeyG);
-		BIND(H, KeyH);		BIND(J, KeyJ);		BIND(K, KeyK);		BIND(L, KeyL);
-		BIND(Z, KeyZ);		BIND(X, KeyX);		BIND(C, KeyC);		BIND(V, KeyV);
-		BIND(B, KeyB);		BIND(N, KeyN);		BIND(M, KeyM);
-
-		BIND(BackTick, KeyLeft);
-		BIND(Hyphen, KeyPlus);
-		BIND(Equals, KeyDash);
-		BIND(F11, KeyGBP);
-		BIND(F12, KeyHome);
-
-		BIND(Tab, KeyControl);
-		BIND(OpenSquareBracket, KeyAt);
-		BIND(CloseSquareBracket, KeyAsterisk);
-
-		BIND(BackSlash, KeyRestore);
-		BIND(Hash, KeyUp);
-		BIND(F10, KeyUp);
-
-		BIND(Semicolon, KeyColon);
-		BIND(Quote, KeySemicolon);
-		BIND(F9, KeyEquals);
-
-		BIND(LeftMeta, KeyCBM);
-		BIND(LeftOption, KeyCBM);
-		BIND(RightOption, KeyCBM);
-		BIND(RightMeta, KeyCBM);
-
-		BIND(LeftShift, KeyLShift);
-		BIND(RightShift, KeyRShift);
-
-		BIND(Comma, KeyComma);
-		BIND(FullStop, KeyFullStop);
-		BIND(ForwardSlash, KeySlash);
-
-		BIND(Right, KeyRight);
-		BIND(Down, KeyDown);
-
-		BIND(Enter, KeyReturn);
-		BIND(Space, KeySpace);
-		BIND(BackSpace, KeyDelete);
-		
-		BIND(Escape, KeyRunStop);
-		BIND(F1, KeyF1);
-		BIND(F3, KeyF3);
-		BIND(F5, KeyF5);
-		BIND(F7, KeyF7);
-	}
-#undef BIND
-	return KeyboardMachine::Machine::KeyNotMapped;
-}
diff --git a/Machines/Commodore/Vic-20/KeyboardMapper.hpp b/Machines/Commodore/Vic-20/KeyboardMapper.hpp
deleted file mode 100644
index c132c72e2..000000000
--- a/Machines/Commodore/Vic-20/KeyboardMapper.hpp
+++ /dev/null
@@ -1,24 +0,0 @@
-//
-//  KeyboardMapper.hpp
-//  Clock Signal
-//
-//  Created by Thomas Harte on 10/10/2017.
-//  Copyright © 2017 Thomas Harte. All rights reserved.
-//
-
-#ifndef Machines_Commodore_Vic20_KeyboardMapper_hpp
-#define Machines_Commodore_Vic20_KeyboardMapper_hpp
-
-#include "../../KeyboardMachine.hpp"
-
-namespace Commodore {
-namespace Vic20 {
-
-struct KeyboardMapper: public KeyboardMachine::Machine::KeyboardMapper {
-	uint16_t mapped_key_for_key(Inputs::Keyboard::Key key);
-};
-
-}
-}
-
-#endif /* KeyboardMapper_hpp */
diff --git a/Machines/Commodore/Vic-20/Vic20.cpp b/Machines/Commodore/Vic-20/Vic20.cpp
index 56fd12270..8298f7e9e 100644
--- a/Machines/Commodore/Vic-20/Vic20.cpp
+++ b/Machines/Commodore/Vic-20/Vic20.cpp
@@ -8,8 +8,7 @@
 
 #include "Vic20.hpp"
 
-#include "CharacterMapper.hpp"
-#include "KeyboardMapper.hpp"
+#include "Keyboard.hpp"
 
 #include "../../../Processors/6502/6502.hpp"
 #include "../../../Components/6560/6560.hpp"
diff --git a/Machines/Commodore/Vic-20/Vic20.hpp b/Machines/Commodore/Vic-20/Vic20.hpp
index 10bc09365..aac1025d5 100644
--- a/Machines/Commodore/Vic-20/Vic20.hpp
+++ b/Machines/Commodore/Vic-20/Vic20.hpp
@@ -13,7 +13,6 @@
 #include "../../CRTMachine.hpp"
 #include "../../KeyboardMachine.hpp"
 #include "../../JoystickMachine.hpp"
-#include "../../Typer.hpp"
 
 #include <cstdint>
 
@@ -38,29 +37,6 @@ enum Region {
 	PAL
 };
 
-enum Key: uint16_t {
-#define key(line, mask) (((mask) << 3) | (line))
-	Key2		= key(7, 0x01),		Key4		= key(7, 0x02),		Key6			= key(7, 0x04),		Key8		= key(7, 0x08),
-	Key0		= key(7, 0x10),		KeyDash		= key(7, 0x20),		KeyHome			= key(7, 0x40),		KeyF7		= key(7, 0x80),
-	KeyQ		= key(6, 0x01),		KeyE		= key(6, 0x02),		KeyT			= key(6, 0x04),		KeyU		= key(6, 0x08),
-	KeyO		= key(6, 0x10),		KeyAt		= key(6, 0x20),		KeyUp			= key(6, 0x40),		KeyF5		= key(6, 0x80),
-	KeyCBM		= key(5, 0x01),		KeyS		= key(5, 0x02),		KeyF			= key(5, 0x04),		KeyH		= key(5, 0x08),
-	KeyK		= key(5, 0x10),		KeyColon	= key(5, 0x20),		KeyEquals		= key(5, 0x40),		KeyF3		= key(5, 0x80),
-	KeySpace	= key(4, 0x01),		KeyZ		= key(4, 0x02),		KeyC			= key(4, 0x04),		KeyB		= key(4, 0x08),
-	KeyM		= key(4, 0x10),		KeyFullStop	= key(4, 0x20),		KeyRShift		= key(4, 0x40),		KeyF1		= key(4, 0x80),
-	KeyRunStop	= key(3, 0x01),		KeyLShift	= key(3, 0x02),		KeyX			= key(3, 0x04),		KeyV		= key(3, 0x08),
-	KeyN		= key(3, 0x10),		KeyComma	= key(3, 0x20),		KeySlash		= key(3, 0x40),		KeyDown		= key(3, 0x80),
-	KeyControl	= key(2, 0x01),		KeyA		= key(2, 0x02),		KeyD			= key(2, 0x04),		KeyG		= key(2, 0x08),
-	KeyJ		= key(2, 0x10),		KeyL		= key(2, 0x20),		KeySemicolon	= key(2, 0x40),		KeyRight	= key(2, 0x80),
-	KeyLeft		= key(1, 0x01),		KeyW		= key(1, 0x02),		KeyR			= key(1, 0x04),		KeyY		= key(1, 0x08),
-	KeyI		= key(1, 0x10),		KeyP		= key(1, 0x20),		KeyAsterisk		= key(1, 0x40),		KeyReturn	= key(1, 0x80),
-	Key1		= key(0, 0x01),		Key3		= key(0, 0x02),		Key5			= key(0, 0x04),		Key7		= key(0, 0x08),
-	Key9		= key(0, 0x10),		KeyPlus		= key(0, 0x20),		KeyGBP			= key(0, 0x40),		KeyDelete	= key(0, 0x80),
-
-	KeyRestore 	= 0xfffd
-#undef key
-};
-
 class Machine:
 	public CRTMachine::Machine,
 	public ConfigurationTarget::Machine,
diff --git a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj
index 38aef314d..ff22b64e9 100644
--- a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj	
+++ b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj	
@@ -84,7 +84,7 @@
 		4B54C0BC1F8D8E790050900F /* KeyboardMachine.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B54C0BB1F8D8E790050900F /* KeyboardMachine.cpp */; };
 		4B54C0BF1F8D8F450050900F /* KeyboardMapper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B54C0BD1F8D8F450050900F /* KeyboardMapper.cpp */; };
 		4B54C0C21F8D91CD0050900F /* KeyboardMapper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B54C0C11F8D91CD0050900F /* KeyboardMapper.cpp */; };
-		4B54C0C51F8D91D90050900F /* KeyboardMapper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B54C0C41F8D91D90050900F /* KeyboardMapper.cpp */; };
+		4B54C0C51F8D91D90050900F /* Keyboard.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B54C0C41F8D91D90050900F /* Keyboard.cpp */; };
 		4B54C0C81F8D91E50050900F /* KeyboardMapper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B54C0C61F8D91E50050900F /* KeyboardMapper.cpp */; };
 		4B54C0CB1F8D92590050900F /* KeyboardMapper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B54C0CA1F8D92580050900F /* KeyboardMapper.cpp */; };
 		4B55CE5D1C3B7D6F0093A61B /* CSOpenGLView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4B55CE5C1C3B7D6F0093A61B /* CSOpenGLView.m */; };
@@ -100,7 +100,6 @@
 		4B69FB441C4D941400B5F0AA /* TapeUEF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B69FB421C4D941400B5F0AA /* TapeUEF.cpp */; };
 		4B69FB461C4D950F00B5F0AA /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B69FB451C4D950F00B5F0AA /* libz.tbd */; };
 		4B6A4C991F58F09E00E3F787 /* 6502Base.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B6A4C951F58F09E00E3F787 /* 6502Base.cpp */; };
-		4B70412B1F92C2A700735E45 /* Joystick.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B7041291F92C2A700735E45 /* Joystick.cpp */; };
 		4B7136861F78724F008B8ED9 /* Encoder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B7136841F78724F008B8ED9 /* Encoder.cpp */; };
 		4B7136891F78725F008B8ED9 /* Shifter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B7136871F78725F008B8ED9 /* Shifter.cpp */; };
 		4B71368E1F788112008B8ED9 /* Parser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B71368C1F788112008B8ED9 /* Parser.cpp */; };
@@ -121,7 +120,6 @@
 		4B8378DC1F336631005CA9E4 /* CharacterMapper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B8378DA1F336631005CA9E4 /* CharacterMapper.cpp */; };
 		4B8378DF1F33675F005CA9E4 /* CharacterMapper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B8378DD1F33675F005CA9E4 /* CharacterMapper.cpp */; };
 		4B8378E21F336920005CA9E4 /* CharacterMapper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B8378E01F336920005CA9E4 /* CharacterMapper.cpp */; };
-		4B8378E51F3378C4005CA9E4 /* CharacterMapper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B8378E31F3378C4005CA9E4 /* CharacterMapper.cpp */; };
 		4B86E25B1F8C628F006FAA45 /* Keyboard.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B86E2591F8C628F006FAA45 /* Keyboard.cpp */; };
 		4B8805F01DCFC99C003085B1 /* Acorn.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B8805EE1DCFC99C003085B1 /* Acorn.cpp */; };
 		4B8805F41DCFD22A003085B1 /* Commodore.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B8805F21DCFD22A003085B1 /* Commodore.cpp */; };
@@ -640,8 +638,8 @@
 		4B54C0BE1F8D8F450050900F /* KeyboardMapper.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; name = KeyboardMapper.hpp; path = Oric/KeyboardMapper.hpp; sourceTree = "<group>"; };
 		4B54C0C01F8D91CD0050900F /* KeyboardMapper.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = KeyboardMapper.hpp; path = AmstradCPC/KeyboardMapper.hpp; sourceTree = "<group>"; };
 		4B54C0C11F8D91CD0050900F /* KeyboardMapper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = KeyboardMapper.cpp; path = AmstradCPC/KeyboardMapper.cpp; sourceTree = "<group>"; };
-		4B54C0C31F8D91D90050900F /* KeyboardMapper.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = KeyboardMapper.hpp; sourceTree = "<group>"; };
-		4B54C0C41F8D91D90050900F /* KeyboardMapper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = KeyboardMapper.cpp; sourceTree = "<group>"; };
+		4B54C0C31F8D91D90050900F /* Keyboard.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Keyboard.hpp; sourceTree = "<group>"; };
+		4B54C0C41F8D91D90050900F /* Keyboard.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Keyboard.cpp; sourceTree = "<group>"; };
 		4B54C0C61F8D91E50050900F /* KeyboardMapper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = KeyboardMapper.cpp; path = Electron/KeyboardMapper.cpp; sourceTree = "<group>"; };
 		4B54C0C71F8D91E50050900F /* KeyboardMapper.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = KeyboardMapper.hpp; path = Electron/KeyboardMapper.hpp; sourceTree = "<group>"; };
 		4B54C0C91F8D92580050900F /* KeyboardMapper.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = KeyboardMapper.hpp; path = ZX8081/KeyboardMapper.hpp; sourceTree = "<group>"; };
@@ -673,7 +671,6 @@
 		4B6A4C921F58F09E00E3F787 /* 6502AllRAM.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = 6502AllRAM.hpp; sourceTree = "<group>"; };
 		4B6A4C951F58F09E00E3F787 /* 6502Base.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = 6502Base.cpp; sourceTree = "<group>"; };
 		4B7041271F92C26900735E45 /* JoystickMachine.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = JoystickMachine.hpp; sourceTree = "<group>"; };
-		4B7041291F92C2A700735E45 /* Joystick.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = Joystick.cpp; sourceTree = "<group>"; };
 		4B70412A1F92C2A700735E45 /* Joystick.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = Joystick.hpp; sourceTree = "<group>"; };
 		4B7136841F78724F008B8ED9 /* Encoder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Encoder.cpp; sourceTree = "<group>"; };
 		4B7136851F78724F008B8ED9 /* Encoder.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Encoder.hpp; sourceTree = "<group>"; };
@@ -708,8 +705,6 @@
 		4B8378DE1F33675F005CA9E4 /* CharacterMapper.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = CharacterMapper.hpp; path = ZX8081/CharacterMapper.hpp; sourceTree = "<group>"; };
 		4B8378E01F336920005CA9E4 /* CharacterMapper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CharacterMapper.cpp; path = Oric/CharacterMapper.cpp; sourceTree = "<group>"; };
 		4B8378E11F336920005CA9E4 /* CharacterMapper.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = CharacterMapper.hpp; path = Oric/CharacterMapper.hpp; sourceTree = "<group>"; };
-		4B8378E31F3378C4005CA9E4 /* CharacterMapper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CharacterMapper.cpp; sourceTree = "<group>"; };
-		4B8378E41F3378C4005CA9E4 /* CharacterMapper.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = CharacterMapper.hpp; sourceTree = "<group>"; };
 		4B86E2591F8C628F006FAA45 /* Keyboard.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Keyboard.cpp; sourceTree = "<group>"; };
 		4B86E25A1F8C628F006FAA45 /* Keyboard.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Keyboard.hpp; sourceTree = "<group>"; };
 		4B8805EE1DCFC99C003085B1 /* Acorn.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Acorn.cpp; path = Parsers/Acorn.cpp; sourceTree = "<group>"; };
@@ -1547,11 +1542,9 @@
 		4B4DC81E1D2C2425003C5BF8 /* Vic-20 */ = {
 			isa = PBXGroup;
 			children = (
-				4B8378E31F3378C4005CA9E4 /* CharacterMapper.cpp */,
-				4B54C0C41F8D91D90050900F /* KeyboardMapper.cpp */,
+				4B54C0C41F8D91D90050900F /* Keyboard.cpp */,
 				4B4DC81F1D2C2425003C5BF8 /* Vic20.cpp */,
-				4B8378E41F3378C4005CA9E4 /* CharacterMapper.hpp */,
-				4B54C0C31F8D91D90050900F /* KeyboardMapper.hpp */,
+				4B54C0C31F8D91D90050900F /* Keyboard.hpp */,
 				4B4DC8201D2C2425003C5BF8 /* Vic20.hpp */,
 			);
 			path = "Vic-20";
@@ -1748,7 +1741,6 @@
 			children = (
 				4B86E2591F8C628F006FAA45 /* Keyboard.cpp */,
 				4B86E25A1F8C628F006FAA45 /* Keyboard.hpp */,
-				4B7041291F92C2A700735E45 /* Joystick.cpp */,
 				4B70412A1F92C2A700735E45 /* Joystick.hpp */,
 			);
 			name = Inputs;
@@ -2950,7 +2942,6 @@
 				4B95FA9D1F11893B0008E395 /* ZX8081OptionsPanel.swift in Sources */,
 				4B0CCC451C62D0B3001CAC5F /* CRT.cpp in Sources */,
 				4B8378DC1F336631005CA9E4 /* CharacterMapper.cpp in Sources */,
-				4B8378E51F3378C4005CA9E4 /* CharacterMapper.cpp in Sources */,
 				4B322E041F5A2E3C004EB04C /* Z80Base.cpp in Sources */,
 				4B4518A31F75FD1C00926311 /* HFE.cpp in Sources */,
 				4B8378E21F336920005CA9E4 /* CharacterMapper.cpp in Sources */,
@@ -2997,8 +2988,7 @@
 				4BEA52631DF339D7007E74F2 /* Speaker.cpp in Sources */,
 				4BC5E4921D7ED365008CF980 /* StaticAnalyser.cpp in Sources */,
 				4BC830D11D6E7C690000A26F /* Tape.cpp in Sources */,
-				4B54C0C51F8D91D90050900F /* KeyboardMapper.cpp in Sources */,
-				4B70412B1F92C2A700735E45 /* Joystick.cpp in Sources */,
+				4B54C0C51F8D91D90050900F /* Keyboard.cpp in Sources */,
 				4B69FB441C4D941400B5F0AA /* TapeUEF.cpp in Sources */,
 				4B86E25B1F8C628F006FAA45 /* Keyboard.cpp in Sources */,
 				4B4518851F75E91A00926311 /* DiskController.cpp in Sources */,