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

Corrects in-service test; adds pending clearing upon enabled clearing.

This commit is contained in:
Thomas Harte 2019-10-28 22:51:00 -04:00
parent 553f3b6d8b
commit fd02b6fc18

View File

@ -95,10 +95,14 @@ void MFP68901::write(int address, uint8_t value) {
case 0x03: case 0x03:
LOG("Write: interrupt enable A " << PADHEX(2) << int(value)); LOG("Write: interrupt enable A " << PADHEX(2) << int(value));
interrupt_enable_ = (interrupt_enable_ & 0x00ff) | (value << 8); interrupt_enable_ = (interrupt_enable_ & 0x00ff) | (value << 8);
interrupt_pending_ = (interrupt_enable_ & 0x00ff) | (value << 8);
update_interrupts();
break; break;
case 0x04: case 0x04:
LOG("Write: interrupt enable B " << PADHEX(2) << int(value)); LOG("Write: interrupt enable B " << PADHEX(2) << int(value));
interrupt_enable_ = (interrupt_enable_ & 0xff00) | value; interrupt_enable_ = (interrupt_enable_ & 0xff00) | value;
interrupt_pending_ = (interrupt_enable_ & 0xff00) | value;
update_interrupts();
break; break;
case 0x05: case 0x05:
LOG("Write: interrupt pending A " << PADHEX(2) << int(value)); LOG("Write: interrupt pending A " << PADHEX(2) << int(value));
@ -312,10 +316,10 @@ void MFP68901::update_interrupts() {
interrupt_line_ = false; interrupt_line_ = false;
} else { } else {
if(interrupt_vector_ & 0x8) { if(interrupt_vector_ & 0x8) {
// Software interrupt mode: permit only if no higher interrupts // Software interrupt mode: permit only if neither this interrupt
// are currently in service. // nor a higher interrupt is currently in service.
const int highest_bit = 1 << (fls(firing_interrupts) - 1); const int highest_bit = 1 << (fls(firing_interrupts) - 1);
interrupt_line_ = !(interrupt_in_service_ & ~(highest_bit + highest_bit - 1)); interrupt_line_ = !(interrupt_in_service_ & ~(highest_bit - 1));
} else { } else {
// Auto-interrupt mode; just signal. // Auto-interrupt mode; just signal.
interrupt_line_ = true; interrupt_line_ = true;