1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-26 08:49:37 +00:00

Switched symbols and updated all-RAM 6502 in order to fix unit test target.

This commit is contained in:
Thomas Harte 2016-03-20 22:48:56 -04:00
parent 197cf2a834
commit 5966ac845f
4 changed files with 177 additions and 175 deletions

View File

@ -95,8 +95,8 @@ class ElectronDocument: MachineDocument {
}
override func flagsChanged(newModifiers: NSEvent) {
electron.setKey(kVK_Shift, isPressed: newModifiers.modifierFlags.contains(.ShiftKeyMask))
electron.setKey(kVK_Control, isPressed: newModifiers.modifierFlags.contains(.ControlKeyMask))
electron.setKey(kVK_Command, isPressed: newModifiers.modifierFlags.contains(.CommandKeyMask))
electron.setKey(VK_Shift, isPressed: newModifiers.modifierFlags.contains(.ShiftKeyMask))
electron.setKey(VK_Control, isPressed: newModifiers.modifierFlags.contains(.ControlKeyMask))
electron.setKey(VK_Command, isPressed: newModifiers.modifierFlags.contains(.CommandKeyMask))
}
}

View File

@ -70,73 +70,73 @@
@synchronized(self) {
switch(key)
{
case kVK_ANSI_0: _electron.set_key_state(Electron::Key::Key0, isPressed); break;
case kVK_ANSI_1: _electron.set_key_state(Electron::Key::Key1, isPressed); break;
case kVK_ANSI_2: _electron.set_key_state(Electron::Key::Key2, isPressed); break;
case kVK_ANSI_3: _electron.set_key_state(Electron::Key::Key3, isPressed); break;
case kVK_ANSI_4: _electron.set_key_state(Electron::Key::Key4, isPressed); break;
case kVK_ANSI_5: _electron.set_key_state(Electron::Key::Key5, isPressed); break;
case kVK_ANSI_6: _electron.set_key_state(Electron::Key::Key6, isPressed); break;
case kVK_ANSI_7: _electron.set_key_state(Electron::Key::Key7, isPressed); break;
case kVK_ANSI_8: _electron.set_key_state(Electron::Key::Key8, isPressed); break;
case kVK_ANSI_9: _electron.set_key_state(Electron::Key::Key9, isPressed); break;
case VK_ANSI_0: _electron.set_key_state(Electron::Key::Key0, isPressed); break;
case VK_ANSI_1: _electron.set_key_state(Electron::Key::Key1, isPressed); break;
case VK_ANSI_2: _electron.set_key_state(Electron::Key::Key2, isPressed); break;
case VK_ANSI_3: _electron.set_key_state(Electron::Key::Key3, isPressed); break;
case VK_ANSI_4: _electron.set_key_state(Electron::Key::Key4, isPressed); break;
case VK_ANSI_5: _electron.set_key_state(Electron::Key::Key5, isPressed); break;
case VK_ANSI_6: _electron.set_key_state(Electron::Key::Key6, isPressed); break;
case VK_ANSI_7: _electron.set_key_state(Electron::Key::Key7, isPressed); break;
case VK_ANSI_8: _electron.set_key_state(Electron::Key::Key8, isPressed); break;
case VK_ANSI_9: _electron.set_key_state(Electron::Key::Key9, isPressed); break;
case kVK_ANSI_Q: _electron.set_key_state(Electron::Key::KeyQ, isPressed); break;
case kVK_ANSI_W: _electron.set_key_state(Electron::Key::KeyW, isPressed); break;
case kVK_ANSI_E: _electron.set_key_state(Electron::Key::KeyE, isPressed); break;
case kVK_ANSI_R: _electron.set_key_state(Electron::Key::KeyR, isPressed); break;
case kVK_ANSI_T: _electron.set_key_state(Electron::Key::KeyT, isPressed); break;
case kVK_ANSI_Y: _electron.set_key_state(Electron::Key::KeyY, isPressed); break;
case kVK_ANSI_U: _electron.set_key_state(Electron::Key::KeyU, isPressed); break;
case kVK_ANSI_I: _electron.set_key_state(Electron::Key::KeyI, isPressed); break;
case kVK_ANSI_O: _electron.set_key_state(Electron::Key::KeyO, isPressed); break;
case kVK_ANSI_P: _electron.set_key_state(Electron::Key::KeyP, isPressed); break;
case kVK_ANSI_A: _electron.set_key_state(Electron::Key::KeyA, isPressed); break;
case kVK_ANSI_S: _electron.set_key_state(Electron::Key::KeyS, isPressed); break;
case kVK_ANSI_D: _electron.set_key_state(Electron::Key::KeyD, isPressed); break;
case kVK_ANSI_F: _electron.set_key_state(Electron::Key::KeyF, isPressed); break;
case kVK_ANSI_G: _electron.set_key_state(Electron::Key::KeyG, isPressed); break;
case kVK_ANSI_H: _electron.set_key_state(Electron::Key::KeyH, isPressed); break;
case kVK_ANSI_J: _electron.set_key_state(Electron::Key::KeyJ, isPressed); break;
case kVK_ANSI_K: _electron.set_key_state(Electron::Key::KeyK, isPressed); break;
case kVK_ANSI_L: _electron.set_key_state(Electron::Key::KeyL, isPressed); break;
case kVK_ANSI_Z: _electron.set_key_state(Electron::Key::KeyZ, isPressed); break;
case kVK_ANSI_X: _electron.set_key_state(Electron::Key::KeyX, isPressed); break;
case kVK_ANSI_C: _electron.set_key_state(Electron::Key::KeyC, isPressed); break;
case kVK_ANSI_V: _electron.set_key_state(Electron::Key::KeyV, isPressed); break;
case kVK_ANSI_B: _electron.set_key_state(Electron::Key::KeyB, isPressed); break;
case kVK_ANSI_N: _electron.set_key_state(Electron::Key::KeyN, isPressed); break;
case kVK_ANSI_M: _electron.set_key_state(Electron::Key::KeyM, isPressed); break;
case VK_ANSI_Q: _electron.set_key_state(Electron::Key::KeyQ, isPressed); break;
case VK_ANSI_W: _electron.set_key_state(Electron::Key::KeyW, isPressed); break;
case VK_ANSI_E: _electron.set_key_state(Electron::Key::KeyE, isPressed); break;
case VK_ANSI_R: _electron.set_key_state(Electron::Key::KeyR, isPressed); break;
case VK_ANSI_T: _electron.set_key_state(Electron::Key::KeyT, isPressed); break;
case VK_ANSI_Y: _electron.set_key_state(Electron::Key::KeyY, isPressed); break;
case VK_ANSI_U: _electron.set_key_state(Electron::Key::KeyU, isPressed); break;
case VK_ANSI_I: _electron.set_key_state(Electron::Key::KeyI, isPressed); break;
case VK_ANSI_O: _electron.set_key_state(Electron::Key::KeyO, isPressed); break;
case VK_ANSI_P: _electron.set_key_state(Electron::Key::KeyP, isPressed); break;
case VK_ANSI_A: _electron.set_key_state(Electron::Key::KeyA, isPressed); break;
case VK_ANSI_S: _electron.set_key_state(Electron::Key::KeyS, isPressed); break;
case VK_ANSI_D: _electron.set_key_state(Electron::Key::KeyD, isPressed); break;
case VK_ANSI_F: _electron.set_key_state(Electron::Key::KeyF, isPressed); break;
case VK_ANSI_G: _electron.set_key_state(Electron::Key::KeyG, isPressed); break;
case VK_ANSI_H: _electron.set_key_state(Electron::Key::KeyH, isPressed); break;
case VK_ANSI_J: _electron.set_key_state(Electron::Key::KeyJ, isPressed); break;
case VK_ANSI_K: _electron.set_key_state(Electron::Key::KeyK, isPressed); break;
case VK_ANSI_L: _electron.set_key_state(Electron::Key::KeyL, isPressed); break;
case VK_ANSI_Z: _electron.set_key_state(Electron::Key::KeyZ, isPressed); break;
case VK_ANSI_X: _electron.set_key_state(Electron::Key::KeyX, isPressed); break;
case VK_ANSI_C: _electron.set_key_state(Electron::Key::KeyC, isPressed); break;
case VK_ANSI_V: _electron.set_key_state(Electron::Key::KeyV, isPressed); break;
case VK_ANSI_B: _electron.set_key_state(Electron::Key::KeyB, isPressed); break;
case VK_ANSI_N: _electron.set_key_state(Electron::Key::KeyN, isPressed); break;
case VK_ANSI_M: _electron.set_key_state(Electron::Key::KeyM, isPressed); break;
case kVK_Space: _electron.set_key_state(Electron::Key::KeySpace, isPressed); break;
case kVK_ANSI_Grave:
case kVK_ANSI_Backslash:
case VK_Space: _electron.set_key_state(Electron::Key::KeySpace, isPressed); break;
case VK_ANSI_Grave:
case VK_ANSI_Backslash:
_electron.set_key_state(Electron::Key::KeyCopy, isPressed); break;
case kVK_Return: _electron.set_key_state(Electron::Key::KeyReturn, isPressed); break;
case kVK_ANSI_Minus: _electron.set_key_state(Electron::Key::KeyMinus, isPressed); break;
case VK_Return: _electron.set_key_state(Electron::Key::KeyReturn, isPressed); break;
case VK_ANSI_Minus: _electron.set_key_state(Electron::Key::KeyMinus, isPressed); break;
case kVK_RightArrow: _electron.set_key_state(Electron::Key::KeyRight, isPressed); break;
case kVK_LeftArrow: _electron.set_key_state(Electron::Key::KeyLeft, isPressed); break;
case kVK_DownArrow: _electron.set_key_state(Electron::Key::KeyDown, isPressed); break;
case kVK_UpArrow: _electron.set_key_state(Electron::Key::KeyUp, isPressed); break;
case VK_RightArrow: _electron.set_key_state(Electron::Key::KeyRight, isPressed); break;
case VK_LeftArrow: _electron.set_key_state(Electron::Key::KeyLeft, isPressed); break;
case VK_DownArrow: _electron.set_key_state(Electron::Key::KeyDown, isPressed); break;
case VK_UpArrow: _electron.set_key_state(Electron::Key::KeyUp, isPressed); break;
case kVK_Delete: _electron.set_key_state(Electron::Key::KeyDelete, isPressed); break;
case kVK_Escape: _electron.set_key_state(Electron::Key::KeyEscape, isPressed); break;
case VK_Delete: _electron.set_key_state(Electron::Key::KeyDelete, isPressed); break;
case VK_Escape: _electron.set_key_state(Electron::Key::KeyEscape, isPressed); break;
case kVK_ANSI_Comma: _electron.set_key_state(Electron::Key::KeyComma, isPressed); break;
case kVK_ANSI_Period: _electron.set_key_state(Electron::Key::KeyFullStop, isPressed); break;
case VK_ANSI_Comma: _electron.set_key_state(Electron::Key::KeyComma, isPressed); break;
case VK_ANSI_Period: _electron.set_key_state(Electron::Key::KeyFullStop, isPressed); break;
case kVK_ANSI_Semicolon:
case VK_ANSI_Semicolon:
_electron.set_key_state(Electron::Key::KeySemiColon, isPressed); break;
case kVK_ANSI_Quote: _electron.set_key_state(Electron::Key::KeyColon, isPressed); break;
case VK_ANSI_Quote: _electron.set_key_state(Electron::Key::KeyColon, isPressed); break;
case kVK_ANSI_Slash: _electron.set_key_state(Electron::Key::KeySlash, isPressed); break;
case VK_ANSI_Slash: _electron.set_key_state(Electron::Key::KeySlash, isPressed); break;
case kVK_Shift: _electron.set_key_state(Electron::Key::KeyShift, isPressed); break;
case kVK_Control: _electron.set_key_state(Electron::Key::KeyControl, isPressed); break;
case kVK_Command: _electron.set_key_state(Electron::Key::KeyFunc, isPressed); break;
case VK_Shift: _electron.set_key_state(Electron::Key::KeyShift, isPressed); break;
case VK_Control: _electron.set_key_state(Electron::Key::KeyControl, isPressed); break;
case VK_Command: _electron.set_key_state(Electron::Key::KeyFunc, isPressed); break;
case kVK_F12: _electron.set_key_state(Electron::Key::KeyBreak, isPressed); break;
case VK_F12: _electron.set_key_state(Electron::Key::KeyBreak, isPressed); break;
default:
// printf("%02x\n", key);

View File

@ -9,6 +9,11 @@
#ifndef KeyCodes_h
#define KeyCodes_h
/*
Carbon somehow still manages to get into the unit test target; I can't figure out how. So I've
renamed these contants from their origina kVK prefixes to just VK.
*/
/*
* Summary:
* Virtual keycodes
@ -25,122 +30,122 @@
* keycode.
*/
enum: uint16_t {
kVK_ANSI_A = 0x00,
kVK_ANSI_S = 0x01,
kVK_ANSI_D = 0x02,
kVK_ANSI_F = 0x03,
kVK_ANSI_H = 0x04,
kVK_ANSI_G = 0x05,
kVK_ANSI_Z = 0x06,
kVK_ANSI_X = 0x07,
kVK_ANSI_C = 0x08,
kVK_ANSI_V = 0x09,
kVK_ANSI_B = 0x0B,
kVK_ANSI_Q = 0x0C,
kVK_ANSI_W = 0x0D,
kVK_ANSI_E = 0x0E,
kVK_ANSI_R = 0x0F,
kVK_ANSI_Y = 0x10,
kVK_ANSI_T = 0x11,
kVK_ANSI_1 = 0x12,
kVK_ANSI_2 = 0x13,
kVK_ANSI_3 = 0x14,
kVK_ANSI_4 = 0x15,
kVK_ANSI_6 = 0x16,
kVK_ANSI_5 = 0x17,
kVK_ANSI_Equal = 0x18,
kVK_ANSI_9 = 0x19,
kVK_ANSI_7 = 0x1A,
kVK_ANSI_Minus = 0x1B,
kVK_ANSI_8 = 0x1C,
kVK_ANSI_0 = 0x1D,
kVK_ANSI_RightBracket = 0x1E,
kVK_ANSI_O = 0x1F,
kVK_ANSI_U = 0x20,
kVK_ANSI_LeftBracket = 0x21,
kVK_ANSI_I = 0x22,
kVK_ANSI_P = 0x23,
kVK_ANSI_L = 0x25,
kVK_ANSI_J = 0x26,
kVK_ANSI_Quote = 0x27,
kVK_ANSI_K = 0x28,
kVK_ANSI_Semicolon = 0x29,
kVK_ANSI_Backslash = 0x2A,
kVK_ANSI_Comma = 0x2B,
kVK_ANSI_Slash = 0x2C,
kVK_ANSI_N = 0x2D,
kVK_ANSI_M = 0x2E,
kVK_ANSI_Period = 0x2F,
kVK_ANSI_Grave = 0x32,
kVK_ANSI_KeypadDecimal = 0x41,
kVK_ANSI_KeypadMultiply = 0x43,
kVK_ANSI_KeypadPlus = 0x45,
kVK_ANSI_KeypadClear = 0x47,
kVK_ANSI_KeypadDivide = 0x4B,
kVK_ANSI_KeypadEnter = 0x4C,
kVK_ANSI_KeypadMinus = 0x4E,
kVK_ANSI_KeypadEquals = 0x51,
kVK_ANSI_Keypad0 = 0x52,
kVK_ANSI_Keypad1 = 0x53,
kVK_ANSI_Keypad2 = 0x54,
kVK_ANSI_Keypad3 = 0x55,
kVK_ANSI_Keypad4 = 0x56,
kVK_ANSI_Keypad5 = 0x57,
kVK_ANSI_Keypad6 = 0x58,
kVK_ANSI_Keypad7 = 0x59,
kVK_ANSI_Keypad8 = 0x5B,
kVK_ANSI_Keypad9 = 0x5C
VK_ANSI_A = 0x00,
VK_ANSI_S = 0x01,
VK_ANSI_D = 0x02,
VK_ANSI_F = 0x03,
VK_ANSI_H = 0x04,
VK_ANSI_G = 0x05,
VK_ANSI_Z = 0x06,
VK_ANSI_X = 0x07,
VK_ANSI_C = 0x08,
VK_ANSI_V = 0x09,
VK_ANSI_B = 0x0B,
VK_ANSI_Q = 0x0C,
VK_ANSI_W = 0x0D,
VK_ANSI_E = 0x0E,
VK_ANSI_R = 0x0F,
VK_ANSI_Y = 0x10,
VK_ANSI_T = 0x11,
VK_ANSI_1 = 0x12,
VK_ANSI_2 = 0x13,
VK_ANSI_3 = 0x14,
VK_ANSI_4 = 0x15,
VK_ANSI_6 = 0x16,
VK_ANSI_5 = 0x17,
VK_ANSI_Equal = 0x18,
VK_ANSI_9 = 0x19,
VK_ANSI_7 = 0x1A,
VK_ANSI_Minus = 0x1B,
VK_ANSI_8 = 0x1C,
VK_ANSI_0 = 0x1D,
VK_ANSI_RightBracket = 0x1E,
VK_ANSI_O = 0x1F,
VK_ANSI_U = 0x20,
VK_ANSI_LeftBracket = 0x21,
VK_ANSI_I = 0x22,
VK_ANSI_P = 0x23,
VK_ANSI_L = 0x25,
VK_ANSI_J = 0x26,
VK_ANSI_Quote = 0x27,
VK_ANSI_K = 0x28,
VK_ANSI_Semicolon = 0x29,
VK_ANSI_Backslash = 0x2A,
VK_ANSI_Comma = 0x2B,
VK_ANSI_Slash = 0x2C,
VK_ANSI_N = 0x2D,
VK_ANSI_M = 0x2E,
VK_ANSI_Period = 0x2F,
VK_ANSI_Grave = 0x32,
VK_ANSI_KeypadDecimal = 0x41,
VK_ANSI_KeypadMultiply = 0x43,
VK_ANSI_KeypadPlus = 0x45,
VK_ANSI_KeypadClear = 0x47,
VK_ANSI_KeypadDivide = 0x4B,
VK_ANSI_KeypadEnter = 0x4C,
VK_ANSI_KeypadMinus = 0x4E,
VK_ANSI_KeypadEquals = 0x51,
VK_ANSI_Keypad0 = 0x52,
VK_ANSI_Keypad1 = 0x53,
VK_ANSI_Keypad2 = 0x54,
VK_ANSI_Keypad3 = 0x55,
VK_ANSI_Keypad4 = 0x56,
VK_ANSI_Keypad5 = 0x57,
VK_ANSI_Keypad6 = 0x58,
VK_ANSI_Keypad7 = 0x59,
VK_ANSI_Keypad8 = 0x5B,
VK_ANSI_Keypad9 = 0x5C
};
/* keycodes for keys that are independent of keyboard layout*/
enum: uint16_t {
kVK_Return = 0x24,
kVK_Tab = 0x30,
kVK_Space = 0x31,
kVK_Delete = 0x33,
kVK_Escape = 0x35,
kVK_Command = 0x37,
kVK_Shift = 0x38,
kVK_CapsLock = 0x39,
kVK_Option = 0x3A,
kVK_Control = 0x3B,
kVK_RightShift = 0x3C,
kVK_RightOption = 0x3D,
kVK_RightControl = 0x3E,
kVK_Function = 0x3F,
kVK_F17 = 0x40,
kVK_VolumeUp = 0x48,
kVK_VolumeDown = 0x49,
kVK_Mute = 0x4A,
kVK_F18 = 0x4F,
kVK_F19 = 0x50,
kVK_F20 = 0x5A,
kVK_F5 = 0x60,
kVK_F6 = 0x61,
kVK_F7 = 0x62,
kVK_F3 = 0x63,
kVK_F8 = 0x64,
kVK_F9 = 0x65,
kVK_F11 = 0x67,
kVK_F13 = 0x69,
kVK_F16 = 0x6A,
kVK_F14 = 0x6B,
kVK_F10 = 0x6D,
kVK_F12 = 0x6F,
kVK_F15 = 0x71,
kVK_Help = 0x72,
kVK_Home = 0x73,
kVK_PageUp = 0x74,
kVK_ForwardDelete = 0x75,
kVK_F4 = 0x76,
kVK_End = 0x77,
kVK_F2 = 0x78,
kVK_PageDown = 0x79,
kVK_F1 = 0x7A,
kVK_LeftArrow = 0x7B,
kVK_RightArrow = 0x7C,
kVK_DownArrow = 0x7D,
kVK_UpArrow = 0x7E
VK_Return = 0x24,
VK_Tab = 0x30,
VK_Space = 0x31,
VK_Delete = 0x33,
VK_Escape = 0x35,
VK_Command = 0x37,
VK_Shift = 0x38,
VK_CapsLock = 0x39,
VK_Option = 0x3A,
VK_Control = 0x3B,
VK_RightShift = 0x3C,
VK_RightOption = 0x3D,
VK_RightControl = 0x3E,
VK_Function = 0x3F,
VK_F17 = 0x40,
VK_VolumeUp = 0x48,
VK_VolumeDown = 0x49,
VK_Mute = 0x4A,
VK_F18 = 0x4F,
VK_F19 = 0x50,
VK_F20 = 0x5A,
VK_F5 = 0x60,
VK_F6 = 0x61,
VK_F7 = 0x62,
VK_F3 = 0x63,
VK_F8 = 0x64,
VK_F9 = 0x65,
VK_F11 = 0x67,
VK_F13 = 0x69,
VK_F16 = 0x6A,
VK_F14 = 0x6B,
VK_F10 = 0x6D,
VK_F12 = 0x6F,
VK_F15 = 0x71,
VK_Help = 0x72,
VK_Home = 0x73,
VK_PageUp = 0x74,
VK_ForwardDelete = 0x75,
VK_F4 = 0x76,
VK_End = 0x77,
VK_F2 = 0x78,
VK_PageDown = 0x79,
VK_F1 = 0x7A,
VK_LeftArrow = 0x7B,
VK_RightArrow = 0x7C,
VK_DownArrow = 0x7D,
VK_UpArrow = 0x7E
};
#endif /* KeyCodes_h */

View File

@ -12,10 +12,7 @@
using namespace CPU6502;
AllRAMProcessor::AllRAMProcessor() : _timestamp(0)
{
setup6502();
}
AllRAMProcessor::AllRAMProcessor() : _timestamp(0) {}
int AllRAMProcessor::perform_bus_operation(CPU6502::BusOperation operation, uint16_t address, uint8_t *value)
{