Open viti95 opened 1 year ago
I'm kind of at a loss here... it's drawing the line in MPlot by making a bitmask (0x80 >> (x & 7)) and then ORing it to video memory.
That means it reads from video memory, which triggers the color compare on read, and writes the OR of the color compare result and (0x80 >> (x&7)) to video memory.
Write mode 1 writes for each pixel either the foreground color (if bit set) or latch contents (if bit clear). Foreground color is 3 (cyan).
Once it's written cyan to the leftmost pixel in the byte (0x80), reading back (color comparison) is 0x80, so the next byte sent to the card is 0x80 | (0x80 >> 1). Then 0xC0 | (0x80 >> 2). And so on. Which eventually fills the entire byte with cyan.
So I'm not clear how MPlot, ORing one bit at a time, despite documentation that the 1 bits are to become cyan (foreground color), is supposed to generate a line consisting entirely of the latch pattern.
I suppose it's worth looking into why the other lines don't draw though.
Hey wait a minute... a diagram in the PC & PS/2 Video Systems programming book gives me a clue.
Maybe the InColor loads the latch according to the "latch protect" bits, and then compares the latch against the colors, not the raw video memory contents. And the LATCH.LST script sets all the latch protect bits.
Ha, well, that's better at least.
Wait, I get it. I misread the Latch Protect as somehow protecting bitlanes, it protects individual bits across all four bitplanes. :facepalm: I wondered why the diagram showed 8 bits, not 4, for latch protect.
Describe the bug
Wrong behaviour testing Learn222 program with latch.lst listing (Hercules InColor driver floppy, TUTOR folder http://www.dosdays.co.uk/media/hercules/incolor/hercules_incolor.zip)
86Box (correct):
DosBox-X (wrong):
Steps to reproduce the behaviour
Expected behavior
Show correct screen changes
What operating system(s) this bug have occurred on?
Linux Lubuntu 22.04
What version(s) of DOSBox-X have this bug?
Tested on commit 2e6f70c3ed9dd35a384a2e221acbd9f5e9101a5e, pretty sure the bug is elsewhere
Used configuration
Output log
No response
Additional information
I think there is something wrong handling the latch register from the video card, but haven't debugged the issue in detail. Seems like the latch isn't preserved between calls.
Have you checked that no similar bug report(s) exist?
Code of Conduct & Contributing Guidelines