mirror of
https://github.com/dingusdev/dingusppc.git
synced 2024-12-26 09:29:28 +00:00
viacuda: One exit path for read.
This commit is contained in:
parent
b454ab45fe
commit
4479ecb1bb
@ -139,37 +139,49 @@ void ViaCuda::cuda_init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint8_t ViaCuda::read(int reg) {
|
uint8_t ViaCuda::read(int reg) {
|
||||||
|
uint8_t value;
|
||||||
/* reading from some VIA registers triggers special actions */
|
/* reading from some VIA registers triggers special actions */
|
||||||
switch (reg & 0xF) {
|
switch (reg & 0xF) {
|
||||||
case VIA_B:
|
case VIA_B:
|
||||||
return (this->via_regs[VIA_B]);
|
value = (this->via_regs[VIA_B]);
|
||||||
|
break;
|
||||||
case VIA_A:
|
case VIA_A:
|
||||||
case VIA_ANH:
|
case VIA_ANH:
|
||||||
|
value = this->via_regs[reg & 0xF];
|
||||||
LOG_F(WARNING, "Attempted read from VIA Port A!");
|
LOG_F(WARNING, "Attempted read from VIA Port A!");
|
||||||
break;
|
break;
|
||||||
case VIA_IER:
|
case VIA_IER:
|
||||||
return (this->_via_ier | 0x80); // bit 7 always reads as "1"
|
value = (this->_via_ier | 0x80); // bit 7 always reads as "1"
|
||||||
|
break;
|
||||||
case VIA_IFR:
|
case VIA_IFR:
|
||||||
return this->_via_ifr;
|
value = this->_via_ifr;
|
||||||
|
break;
|
||||||
case VIA_T1CL:
|
case VIA_T1CL:
|
||||||
this->_via_ifr &= ~VIA_IF_T1;
|
this->_via_ifr &= ~VIA_IF_T1;
|
||||||
update_irq();
|
update_irq();
|
||||||
return this->calc_counter_val(this->t1_counter, this->t1_start_time) & 0xFFU;
|
value = this->calc_counter_val(this->t1_counter, this->t1_start_time) & 0xFFU;
|
||||||
|
break;
|
||||||
case VIA_T1CH:
|
case VIA_T1CH:
|
||||||
return this->calc_counter_val(this->t1_counter, this->t1_start_time) >> 8;
|
value = this->calc_counter_val(this->t1_counter, this->t1_start_time) >> 8;
|
||||||
|
break;
|
||||||
case VIA_T2CL:
|
case VIA_T2CL:
|
||||||
this->_via_ifr &= ~VIA_IF_T2;
|
this->_via_ifr &= ~VIA_IF_T2;
|
||||||
update_irq();
|
update_irq();
|
||||||
return this->calc_counter_val(this->t2_counter, this->t2_start_time) & 0xFFU;
|
value = this->calc_counter_val(this->t2_counter, this->t2_start_time) & 0xFFU;
|
||||||
|
break;
|
||||||
case VIA_T2CH:
|
case VIA_T2CH:
|
||||||
return this->calc_counter_val(this->t2_counter, this->t2_start_time) >> 8;
|
value = this->calc_counter_val(this->t2_counter, this->t2_start_time) >> 8;
|
||||||
|
break;
|
||||||
case VIA_SR:
|
case VIA_SR:
|
||||||
|
value = this->via_regs[reg & 0xF];
|
||||||
this->_via_ifr &= ~VIA_IF_SR;
|
this->_via_ifr &= ~VIA_IF_SR;
|
||||||
update_irq();
|
update_irq();
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
value = this->via_regs[reg & 0xF];
|
||||||
}
|
}
|
||||||
|
|
||||||
return (this->via_regs[reg & 0xF]);
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ViaCuda::write(int reg, uint8_t value) {
|
void ViaCuda::write(int reg, uint8_t value) {
|
||||||
|
Loading…
Reference in New Issue
Block a user