mirror of
https://github.com/TomHarte/CLK.git
synced 2024-11-25 16:31:42 +00:00
Attempts to route out modifier state.
This commit is contained in:
parent
a791680e6f
commit
52cf15c3e6
@ -199,8 +199,7 @@ void GLU::set_port_output(int port, uint8_t value) {
|
||||
}
|
||||
} break;
|
||||
case 3:
|
||||
// printf("IIe KWS: %d\n", (value >> 6)&3);
|
||||
// printf("ADB data line output: %d\n", (value >> 3)&1);
|
||||
modifier_state_ = value;
|
||||
|
||||
// Output is inverted respective to input; the microcontroller
|
||||
// sets a value of '1' in order to pull the ADB bus low.
|
||||
@ -211,6 +210,14 @@ void GLU::set_port_output(int port, uint8_t value) {
|
||||
}
|
||||
}
|
||||
|
||||
bool GLU::get_command_button() const {
|
||||
return modifier_state_ & 0x20;
|
||||
}
|
||||
|
||||
bool GLU::get_option_button() const {
|
||||
return modifier_state_ & 0x10;
|
||||
}
|
||||
|
||||
uint8_t GLU::get_port_input(int port) {
|
||||
switch(port) {
|
||||
case 0: return register_latch_;
|
||||
|
@ -41,6 +41,9 @@ class GLU: public InstructionSet::M50740::PortHandler {
|
||||
|
||||
void run_for(Cycles cycles);
|
||||
|
||||
bool get_command_button() const;
|
||||
bool get_option_button() const;
|
||||
|
||||
private:
|
||||
InstructionSet::M50740::Executor executor_;
|
||||
|
||||
@ -59,6 +62,8 @@ class GLU: public InstructionSet::M50740::PortHandler {
|
||||
Apple::ADB::Bus bus_;
|
||||
size_t controller_id_;
|
||||
|
||||
uint8_t modifier_state_ = 0;
|
||||
|
||||
// For now, attach only a keyboard and mouse.
|
||||
Apple::ADB::Mouse mouse_;
|
||||
Apple::ADB::Keyboard keyboard_;
|
||||
|
@ -514,9 +514,20 @@ class ConcreteMachine:
|
||||
*value = rom_[rom_.size() - 65536 + address_suffix];
|
||||
break;
|
||||
|
||||
// Analogue inputs. All TODO.
|
||||
case Read(0xc060): case Read(0xc061): case Read(0xc062): case Read(0xc063):
|
||||
// Joystick buttons (and keyboard modifiers).
|
||||
// Analogue inputs. Joystick parts are TODO.
|
||||
case Read(0xc061):
|
||||
*value = adb_glu_->get_command_button() ? 0x80 : 0x00;
|
||||
is_1Mhz = true;
|
||||
break;
|
||||
|
||||
case Read(0xc062):
|
||||
*value = adb_glu_->get_option_button() ? 0x80 : 0x00;
|
||||
is_1Mhz = true;
|
||||
break;
|
||||
|
||||
case Read(0xc060):
|
||||
case Read(0xc063):
|
||||
// Joystick buttons.
|
||||
*value = 0x00;
|
||||
is_1Mhz = true;
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user