As far as I'm aware, there are four hardware devices that can generate maskable interrupts: On key, timer 1, timer 2, and the link port.
Now, the way I see it, there are two flags associated with each hardware device. One is a flag that indicates that that item has generated an interrupt, and the other is a flag that enables or disables the hardware's interrupt generation (mask).
Thus, as far as I can see:
/INT = !([OnKeyGenerated] || [Timer1Generated] || [Timer2Generated] || [LinkGenerated])
Now, would writing to the mask values will clear the "generated" flag? ie,
Code: Select all
void UpdateOnKeyMask(bool isEnabled) {
OnKeyMask = isEnabled;
OnKeyGenerated &= isEnabled;
}
As a comparison, the SMS only has the VDP (video) attached to /INT; it has two register bits that stipulate whether it can generate line or frame interrupts. When an interrupt condition occurs and the requisite bit is enabled it asserts /INT; /INT is de-asserted when the VDP's control port is read. My implementation works accurately with the notoriously awkward to emulate games, so I'm assuming the fault is in my understanding of the TI's interrupt mechanism and not my implementation of the Z80's interrupts.