2017-10-20 02:27:30 +00:00
|
|
|
//
|
2017-10-21 14:21:40 +00:00
|
|
|
// Keyboard.hpp
|
2017-10-20 02:27:30 +00:00
|
|
|
// Clock Signal
|
|
|
|
//
|
|
|
|
// Created by Thomas Harte on 10/10/2017.
|
2018-05-13 19:19:52 +00:00
|
|
|
// Copyright 2017 Thomas Harte. All rights reserved.
|
2017-10-20 02:27:30 +00:00
|
|
|
//
|
|
|
|
|
2017-10-21 14:21:40 +00:00
|
|
|
#ifndef Machines_Commodore_Vic20_Keyboard_hpp
|
|
|
|
#define Machines_Commodore_Vic20_Keyboard_hpp
|
2017-10-20 02:27:30 +00:00
|
|
|
|
|
|
|
#include "../../KeyboardMachine.hpp"
|
2017-10-21 14:30:02 +00:00
|
|
|
#include "../../Utility/Typer.hpp"
|
2017-10-20 02:27:30 +00:00
|
|
|
|
2023-05-10 21:02:18 +00:00
|
|
|
namespace Commodore::Vic20 {
|
2017-10-20 02:27:30 +00:00
|
|
|
|
|
|
|
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),
|
2020-03-02 02:42:30 +00:00
|
|
|
KeyO = key(6, 0x10), KeyAt = key(6, 0x20), KeyUpArrow = key(6, 0x40), KeyF5 = key(6, 0x80),
|
2017-10-20 02:27:30 +00:00
|
|
|
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),
|
2020-03-02 02:42:30 +00:00
|
|
|
KeyLeftArrow= key(1, 0x01), KeyW = key(1, 0x02), KeyR = key(1, 0x04), KeyY = key(1, 0x08),
|
2017-10-20 02:27:30 +00:00
|
|
|
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),
|
|
|
|
|
2020-03-02 02:42:30 +00:00
|
|
|
// Virtual keys.
|
|
|
|
KeyUp = 0xfff0,
|
|
|
|
KeyLeft = 0xfff1,
|
2020-03-02 02:47:28 +00:00
|
|
|
KeyF2 = 0xfff2,
|
|
|
|
KeyF4 = 0xfff3,
|
|
|
|
KeyF6 = 0xfff4,
|
|
|
|
KeyF8 = 0xfff5,
|
2020-03-02 02:42:30 +00:00
|
|
|
|
2023-05-16 20:40:09 +00:00
|
|
|
// Physical keys not within the usual matrix.
|
2020-03-02 02:42:30 +00:00
|
|
|
KeyRestore = 0xfffd,
|
2017-10-20 02:27:30 +00:00
|
|
|
#undef key
|
|
|
|
};
|
|
|
|
|
2020-04-02 03:19:34 +00:00
|
|
|
struct KeyboardMapper: public MachineTypes::MappedKeyboardMachine::KeyboardMapper {
|
2020-05-21 03:34:26 +00:00
|
|
|
uint16_t mapped_key_for_key(Inputs::Keyboard::Key key) const final;
|
2017-10-20 02:27:30 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct CharacterMapper: public ::Utility::CharacterMapper {
|
2020-05-21 03:34:26 +00:00
|
|
|
const uint16_t *sequence_for_character(char character) const final;
|
2017-10-20 02:27:30 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2017-10-21 14:21:40 +00:00
|
|
|
#endif /* Keyboard_hpp */
|