diff --git a/Components/AY38910/AY38910.cpp b/Components/AY38910/AY38910.cpp index 245dfa516..04be00902 100644 --- a/Components/AY38910/AY38910.cpp +++ b/Components/AY38910/AY38910.cpp @@ -10,7 +10,7 @@ using namespace GI; -AY38910::AY38910() +AY38910::AY38910() : _selected_register(0) { } @@ -24,15 +24,20 @@ void AY38910::skip_samples(unsigned int number_of_samples) void AY38910::select_register(uint8_t r) { - printf("sel %d\n", r); + _selected_register = r & 0xf; } void AY38910::set_register_value(uint8_t value) { - printf("val %d\n", value); + _registers[_selected_register] = value; } uint8_t AY38910::get_register_value() { - return 0; + return _registers[_selected_register]; +} + +uint8_t AY38910::get_port_output(bool port_b) +{ + return _registers[port_b ? 15 : 14]; } diff --git a/Components/AY38910/AY38910.hpp b/Components/AY38910/AY38910.hpp index 217a58607..b71eb3bde 100644 --- a/Components/AY38910/AY38910.hpp +++ b/Components/AY38910/AY38910.hpp @@ -24,6 +24,8 @@ class AY38910: public ::Outputs::Filter { void set_register_value(uint8_t value); uint8_t get_register_value(); + uint8_t get_port_output(bool port_b); + private: int _selected_register; uint8_t _registers[16]; diff --git a/Machines/Oric/Oric.hpp b/Machines/Oric/Oric.hpp index 9c988924b..af9ce4a47 100644 --- a/Machines/Oric/Oric.hpp +++ b/Machines/Oric/Oric.hpp @@ -88,7 +88,7 @@ class Machine: // class Keyboard { public: - uint8_t row, column; + uint8_t row; uint8_t rows[8]; }; class VIA: public MOS::MOS6522, public MOS::MOS6522IRQDelegate { @@ -119,7 +119,8 @@ class Machine: uint8_t get_port_input(Port port) { if(port) { - return (keyboard->rows[keyboard->row & 7] & keyboard->column) ? 0x08 : 0x00; + uint8_t column = ay8910->get_port_output(false) ^ 0xff; + return (keyboard->rows[keyboard->row & 7] & column) ? 0x08 : 0x00; } else {