1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-06-25 18:30:07 +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: {
const uint8_t result = interrupt_state_;
interrupt_state_ = 0;
pending_ &= ~(InterruptNow | InterruptInOne);
update_interrupts();
return result;
} break;

View File

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