mirror of
https://github.com/TomHarte/CLK.git
synced 2024-11-16 19:08:08 +00:00
Got some keyboard reaction.
This commit is contained in:
parent
3dbb602419
commit
288d10c253
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
using namespace GI;
|
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)
|
void AY38910::select_register(uint8_t r)
|
||||||
{
|
{
|
||||||
printf("sel %d\n", r);
|
_selected_register = r & 0xf;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AY38910::set_register_value(uint8_t value)
|
void AY38910::set_register_value(uint8_t value)
|
||||||
{
|
{
|
||||||
printf("val %d\n", value);
|
_registers[_selected_register] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t AY38910::get_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];
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,8 @@ class AY38910: public ::Outputs::Filter<AY38910> {
|
|||||||
void set_register_value(uint8_t value);
|
void set_register_value(uint8_t value);
|
||||||
uint8_t get_register_value();
|
uint8_t get_register_value();
|
||||||
|
|
||||||
|
uint8_t get_port_output(bool port_b);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int _selected_register;
|
int _selected_register;
|
||||||
uint8_t _registers[16];
|
uint8_t _registers[16];
|
||||||
|
@ -88,7 +88,7 @@ class Machine:
|
|||||||
//
|
//
|
||||||
class Keyboard {
|
class Keyboard {
|
||||||
public:
|
public:
|
||||||
uint8_t row, column;
|
uint8_t row;
|
||||||
uint8_t rows[8];
|
uint8_t rows[8];
|
||||||
};
|
};
|
||||||
class VIA: public MOS::MOS6522<VIA>, public MOS::MOS6522IRQDelegate {
|
class VIA: public MOS::MOS6522<VIA>, public MOS::MOS6522IRQDelegate {
|
||||||
@ -119,7 +119,8 @@ class Machine:
|
|||||||
uint8_t get_port_input(Port port) {
|
uint8_t get_port_input(Port port) {
|
||||||
if(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
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user