1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-12-25 03:32:01 +00:00

Ensure that reading the interrupt flags really clears the master bit.

Also makes some guesses on one-shot and reload timing. Alas the test isn't in itself specific enough to be more systematic here.
This commit is contained in:
Thomas Harte 2021-08-02 07:47:08 -04:00
parent c640132699
commit 77c627e822
2 changed files with 6 additions and 5 deletions

View File

@ -170,6 +170,7 @@ uint8_t MOS6526<BusHandlerT, personality>::read(int address) {
case 13: { case 13: {
const uint8_t result = interrupt_state_; const uint8_t result = interrupt_state_;
interrupt_state_ = 0; interrupt_state_ = 0;
pending_ &= ~(InterruptNow | InterruptInOne);
update_interrupts(); update_interrupts();
return result; return result;
} break; } break;

View File

@ -60,12 +60,12 @@ struct MOS6526Storage {
pending |= ApplyClockInTwo; pending |= ApplyClockInTwo;
} }
if(control & 0x08) { if(control & 0x08) {
pending |= OneShotInTwo; pending |= OneShotInOne;
} }
if((pending & ReloadNow) || (hit_zero && (pending & ApplyClockInTwo))) { if((pending & ReloadNow) || (hit_zero && (pending & ApplyClockInTwo))) {
value = reload; value = reload;
pending &= ~ApplyClockInOne; // Skip one decrement. pending &= ~ApplyClockNow; // Skip one decrement.
} }
if(pending & ApplyClockNow) { if(pending & ApplyClockNow) {
@ -86,12 +86,12 @@ struct MOS6526Storage {
private: private:
int pending = 0; int pending = 0;
static constexpr int ReloadInThree = 1 << 0; // static constexpr int ReloadInThree = 1 << 0;
static constexpr int ReloadInTwo = 1 << 1; // static constexpr int ReloadInTwo = 1 << 1;
static constexpr int ReloadInOne = 1 << 2; static constexpr int ReloadInOne = 1 << 2;
static constexpr int ReloadNow = 1 << 3; static constexpr int ReloadNow = 1 << 3;
static constexpr int OneShotInTwo = 1 << 4; // static constexpr int OneShotInTwo = 1 << 4;
static constexpr int OneShotInOne = 1 << 5; static constexpr int OneShotInOne = 1 << 5;
static constexpr int OneShotNow = 1 << 6; static constexpr int OneShotNow = 1 << 6;