1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-12-23 20:29:42 +00:00

Implements Vic-20 restore key.

This commit is contained in:
Thomas Harte 2017-10-19 22:02:34 -04:00
parent b5b6219cb7
commit c2f6799f0c
2 changed files with 10 additions and 11 deletions

View File

@ -119,14 +119,10 @@ class KeyboardVIA: public MOS::MOS6522::IRQDelegatePortHandler {
/// Sets whether @c key @c is_pressed.
void set_key_state(uint16_t key, bool is_pressed) {
if(key == KeyRestore) {
// TODO: how is restore wired?
} else {
if(is_pressed)
columns_[key & 7] &= ~(key >> 3);
else
columns_[key & 7] |= (key >> 3);
}
if(is_pressed)
columns_[key & 7] &= ~(key >> 3);
else
columns_[key & 7] |= (key >> 3);
}
/// Sets all keys as unpressed.
@ -375,8 +371,11 @@ class ConcreteMachine:
return !media.tapes.empty() || (!media.disks.empty() && c1540_ != nullptr) || !media.cartridges.empty();
}
void set_key_state(uint16_t key, bool isPressed) override final {
keyboard_via_port_handler_->set_key_state(key, isPressed);
void set_key_state(uint16_t key, bool is_pressed) override final {
if(key != KeyRestore)
keyboard_via_port_handler_->set_key_state(key, is_pressed);
else
user_port_via_.set_control_line_input(MOS::MOS6522::Port::A, MOS::MOS6522::Line::One, !is_pressed);
}
void clear_all_keys() override final {

View File

@ -57,7 +57,7 @@ enum Key: uint16_t {
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 = 0xfffe
KeyRestore = 0xfffd
#undef key
};