dirkwhoffmann / vAmiga

vAmiga is a user-friendly Amiga 500, 1000, 2000 emulator for macOS
https://dirkwhoffmann.github.io/vAmiga
Other
299 stars 25 forks source link

Improve Agnus sequencer accuracy #713

Closed dirkwhoffmann closed 2 years ago

dirkwhoffmann commented 2 years ago

The current sequencer cannot handle the case that bitplane DMA is switched off in the middle of a scanline (i.e., while bitplane DMA is active). To address this scenario, the sequencer should be improved as follows:

sequencer

  1. Emulate the bpstopreq and the stop flipflop accurately.
  2. Emulate the T-flipflop counter accurately. Right now, when BPRUN equals 0, the counter equals 0 in my emulation. This is inaccurate because the LSB (cnt0) is represented by the HI line. Hence, if BPRUN equals 0, the counter still toggles between 0 and 1 in the real machine. This affects timing of line last which in turn affects timing of the stop flipflop.

Furthermore, there is a bug in the real OCS Agnus (ECS is even worse). If DMA is switched off after stopreq has been asserted, the flipflop doesn't seem to get cleared any more. Hence, if DMA is switched on again in the next scanline, DMA terminates early because stopreq is still asserted. I can't see this behaviour in the available schematics.

dirkwhoffmann commented 2 years ago

Part of v2.1b3