Closed jburks closed 1 year ago
I have no objection to this. So go ahead 😄
SCANLINE[8] overlapping IRQLINE[8] at IEN[7] is generating more unexpected behavior bugs by software devs than I had anticipated. Primarily due to enabling and disabling interrupts by reading IEN, setting or clearing the desired interrupt bits, then writing it back out. The read-modify-write cycle only preserves IRQLINE[8] if the SCANLINE value when the code is executed happens to be in the same half of the display as IRQLINE.
Weighing the options: nobody wants to lose IRQLINE; moving SCANLINE[8] to IEN[6] is almost as simple and allows read-modify-write cycles to work as developers are expecting. Since SCANLINE is brand new, and the emulator does not have support for it yet, no software other than the test programs for the SCANLINE feature make use of it; this change does not impact any existing software.
I will put together another PR that moves SCANLINE[8] from IEN[7] to IEN[6] during reads and restores IRQLINE[8] to IEN[7] during reads so that RMW cycles work again.
This request came from some of the users on the Discord server. I had always responded that VERA was out of register space. Recently someone suggested that there is almost never a software use case for reading the line IRQ value, but many software use cases for polling/waiting for a specific scan line; it would be better to have the line IRQ return the current scanline when read.
I have made this change and one of the community members wrote a test case to demo/exercise it. The results looked great. If there is no objection to adding this feature, I will prep a PR in the next day or two with the two-line change that enables it.