mirror of
https://github.com/TomHarte/CLK.git
synced 2025-08-13 15:25:56 +00:00
Pull input from the typer.
This commit is contained in:
@@ -24,6 +24,8 @@
|
|||||||
#include "../SerialBus.hpp"
|
#include "../SerialBus.hpp"
|
||||||
#include "../1540/C1540.hpp"
|
#include "../1540/C1540.hpp"
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
using namespace Commodore;
|
using namespace Commodore;
|
||||||
using namespace Commodore::Plus4;
|
using namespace Commodore::Plus4;
|
||||||
|
|
||||||
@@ -177,9 +179,9 @@ public:
|
|||||||
tape_player_ = std::make_unique<Storage::Tape::BinaryTapePlayer>(clock);
|
tape_player_ = std::make_unique<Storage::Tape::BinaryTapePlayer>(clock);
|
||||||
|
|
||||||
insert_media(target.media);
|
insert_media(target.media);
|
||||||
if(!target.loading_command.empty()) {
|
// if(!target.loading_command.empty()) {
|
||||||
type_string(target.loading_command);
|
// type_string(target.loading_command);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
~ConcreteMachine() {
|
~ConcreteMachine() {
|
||||||
@@ -323,6 +325,16 @@ public:
|
|||||||
case 0xff05: timers_.write<5>(*value); break;
|
case 0xff05: timers_.write<5>(*value); break;
|
||||||
|
|
||||||
case 0xff08:
|
case 0xff08:
|
||||||
|
// Observation here: the kernel posts a 0 to this
|
||||||
|
// address upon completing each keyboard scan cycle,
|
||||||
|
// once per frame.
|
||||||
|
if(typer_ && !*value) {
|
||||||
|
if(!typer_->type_next_character()) {
|
||||||
|
clear_all_keys();
|
||||||
|
typer_.reset();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
keyboard_latch_ = ~(
|
keyboard_latch_ = ~(
|
||||||
((*value & 0x01) ? 0x00 : key_states_[0]) |
|
((*value & 0x01) ? 0x00 : key_states_[0]) |
|
||||||
((*value & 0x02) ? 0x00 : key_states_[1]) |
|
((*value & 0x02) ? 0x00 : key_states_[1]) |
|
||||||
@@ -524,6 +536,10 @@ private:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void clear_all_keys() final {
|
||||||
|
std::fill(key_states_.begin(), key_states_.end(), 0);
|
||||||
|
}
|
||||||
|
|
||||||
std::array<uint8_t, 8> key_states_{};
|
std::array<uint8_t, 8> key_states_{};
|
||||||
uint8_t keyboard_latch_ = 0xff;
|
uint8_t keyboard_latch_ = 0xff;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user