1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-22 12:33:29 +00:00

Attempts to route out modifier state.

This commit is contained in:
Thomas Harte 2021-02-14 21:15:31 -05:00
parent a791680e6f
commit 52cf15c3e6
3 changed files with 28 additions and 5 deletions

View File

@ -199,8 +199,7 @@ void GLU::set_port_output(int port, uint8_t value) {
} }
} break; } break;
case 3: case 3:
// printf("IIe KWS: %d\n", (value >> 6)&3); modifier_state_ = value;
// printf("ADB data line output: %d\n", (value >> 3)&1);
// Output is inverted respective to input; the microcontroller // Output is inverted respective to input; the microcontroller
// sets a value of '1' in order to pull the ADB bus low. // 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) { uint8_t GLU::get_port_input(int port) {
switch(port) { switch(port) {
case 0: return register_latch_; case 0: return register_latch_;

View File

@ -41,6 +41,9 @@ class GLU: public InstructionSet::M50740::PortHandler {
void run_for(Cycles cycles); void run_for(Cycles cycles);
bool get_command_button() const;
bool get_option_button() const;
private: private:
InstructionSet::M50740::Executor executor_; InstructionSet::M50740::Executor executor_;
@ -59,6 +62,8 @@ class GLU: public InstructionSet::M50740::PortHandler {
Apple::ADB::Bus bus_; Apple::ADB::Bus bus_;
size_t controller_id_; size_t controller_id_;
uint8_t modifier_state_ = 0;
// For now, attach only a keyboard and mouse. // For now, attach only a keyboard and mouse.
Apple::ADB::Mouse mouse_; Apple::ADB::Mouse mouse_;
Apple::ADB::Keyboard keyboard_; Apple::ADB::Keyboard keyboard_;

View File

@ -514,9 +514,20 @@ class ConcreteMachine:
*value = rom_[rom_.size() - 65536 + address_suffix]; *value = rom_[rom_.size() - 65536 + address_suffix];
break; break;
// Analogue inputs. All TODO. // Analogue inputs. Joystick parts are TODO.
case Read(0xc060): case Read(0xc061): case Read(0xc062): case Read(0xc063): case Read(0xc061):
// Joystick buttons (and keyboard modifiers). *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; *value = 0x00;
is_1Mhz = true; is_1Mhz = true;
break; break;