Open LoveBug2084 opened 2 years ago
I think the reason b-em behaves as it does is because vc (vertical count) is incremented immediately before the comparison, so it can never be zero:
oldvc = vc;
vc++;
vc &= 127;
if (vc == crtc[6]) // vertical displayed total.
vdispen = 0;
vdispen becomes dispen which is "display enable", i.e. setting it to zero means display memory is no longer read and the output will be black. I will experiment. Maybe this could be solved by changing the comparison to >=
I have decided against changing the comparison to >= as there was some discussion on how the 6845 actually did the comparisons between internal counters and registers that set the limit for the counter concerned and it was an = comparison. Someone has, I think, written something clever to take advantage of this.
So instead, if register 6 is zero at the point where vdispen would previously have been set to true, it now remains false, so nothing will be displayed. As implemented in b-em this also means the video RAM would not be scanned. I wonder if this is also true on the real hardware. The BBC micro relies on the sequential nature of the memory being read to generate the screen display to refresh the dynamic RAM so, if the real 6845 doesn't do anything with the memory address counter if reg 6 is zero then the RAM may soon loose its contents.
Anyway, the fix is in https://github.com/stardot/b-em/tree/sf/issue173
We should really do some testing now with things that do advanced things.
ive noticed that on a real bbc if you program R6 with 0 you'll get a black screen in b-em (also jsbeeb) results in a corrupted display kind of like its wrapping around in the counter value