1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-12-27 16:31:31 +00:00

Adjusted: invalid register selection simply deselects all registers.

This commit is contained in:
Thomas Harte 2017-08-07 19:51:36 -04:00
parent 4709ae80cb
commit 41a30c147d

View File

@ -169,10 +169,11 @@ void AY38910::evaluate_output_volume() {
#pragma mark - Register manipulation
void AY38910::select_register(uint8_t r) {
selected_register_ = r & 0xf;
selected_register_ = r;
}
void AY38910::set_register_value(uint8_t value) {
if(selected_register_ > 15) return;
registers_[selected_register_] = value;
if(selected_register_ < 14) {
int selected_register = selected_register_;
@ -226,6 +227,7 @@ uint8_t AY38910::get_register_value() {
0xe0, 0xe0, 0xe0, 0x00, 0x00, 0xf0, 0x00, 0x00
};
if(selected_register_ > 15) return 0xff;
switch(selected_register_) {
default: return registers_[selected_register_] & ~register_masks[selected_register_];
case 14: return (registers_[0x7] & 0x40) ? registers_[14] : port_inputs_[0];