1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-06-25 18:30:07 +00:00

Add 8250 feature of 'count, regardless'.

This commit is contained in:
Thomas Harte 2021-08-08 22:32:41 -04:00
parent 5cc25d0846
commit f8380d2d4c
2 changed files with 13 additions and 6 deletions

View File

@ -79,10 +79,10 @@ void MOS6526<BusHandlerT, personality>::write(int address, uint8_t value) {
break;
// Counters; writes set the reload values.
case 4: counter_[0].template set_reload<0>(value); break;
case 5: counter_[0].template set_reload<8>(value); break;
case 6: counter_[1].template set_reload<0>(value); break;
case 7: counter_[1].template set_reload<8>(value); break;
case 4: counter_[0].template set_reload<0, personality == Personality::P8250>(value); break;
case 5: counter_[0].template set_reload<8, personality == Personality::P8250>(value); break;
case 6: counter_[1].template set_reload<0, personality == Personality::P8250>(value); break;
case 7: counter_[1].template set_reload<8, personality == Personality::P8250>(value); break;
// Time-of-day clock.
case 8: tod_.template write<0>(value); break;

View File

@ -189,12 +189,19 @@ struct MOS6526Storage {
uint16_t value = 0;
uint8_t control = 0;
template <int shift> void set_reload(uint8_t v) {
template <int shift, bool is_8250> void set_reload(uint8_t v) {
reload = (reload & (0xff00 >> shift)) | uint16_t(v << shift);
if constexpr (shift == 8) {
if(!(control&1)) {
// This seems to be a special 8250 feature per the Amiga
// Hardware Reference Manual; cf. Appendix F.
if(is_8250) {
control |= 1;
pending |= ReloadInOne;
} else {
if(!(control&1)) {
pending |= ReloadInOne;
}
}
}