emulation: memlcd: reduce dirty bit count to 2 bytes

Previously, the memlcd had 22 bytes of dirty bits following a line. This
was reduced to 2 bytes, but the logic checking the dirty bytes had not
been updated.

Reduce the dirty byte count to 2 bytes.

Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
Sean Cross 2022-01-26 12:48:04 +08:00
parent 11f726223b
commit 96d241acfd

View file

@ -121,19 +121,22 @@ namespace Antmicro.Renode.Peripherals.Video
protected override void Repaint() protected override void Repaint()
{ {
var newbuf = new Byte[44 * Height];
for (int y = 0; y < Height; y++) for (int y = 0; y < Height; y++)
{ {
// We should redraw the line if: // We should redraw the line if:
// 1) The `updateDirty` bit is set and the current line is dirty, or // 1) The `updateDirty` bit is set and the current line is dirty, or
// 2) The `updateAll` bit is set. // 2) The `updateAll` bit is set.
bool shouldRedrawLine = updateAll; bool shouldRedrawLine = updateAll;
foreach (int i in Enumerable.Range(41, 22)) foreach (int i in Enumerable.Range(41, 2))
{ {
if (shouldRedrawLine) if (shouldRedrawLine)
{ {
break; break;
} }
// A line is considered "dirty" if any bit following the pixel data is
// nonzero. Because each line is 336 pixels wide (which yields 42 bytes
// of data per line), the remaining 2 bytes indicate whether the line
// is dirty or not.
if (updateDirty && (this.videoRam.data[y * 44 + i] != 0)) if (updateDirty && (this.videoRam.data[y * 44 + i] != 0))
{ {
shouldRedrawLine = true; shouldRedrawLine = true;