From 96d241acfd226af0fd4e7e401d23b6beecc67c89 Mon Sep 17 00:00:00 2001 From: Sean Cross Date: Wed, 26 Jan 2022 12:48:04 +0800 Subject: [PATCH] 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 --- emulation/peripherals/memlcd.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/emulation/peripherals/memlcd.cs b/emulation/peripherals/memlcd.cs index 9e0bd1088..2a70459ff 100644 --- a/emulation/peripherals/memlcd.cs +++ b/emulation/peripherals/memlcd.cs @@ -121,19 +121,22 @@ namespace Antmicro.Renode.Peripherals.Video protected override void Repaint() { - var newbuf = new Byte[44 * Height]; for (int y = 0; y < Height; y++) { // We should redraw the line if: // 1) The `updateDirty` bit is set and the current line is dirty, or // 2) The `updateAll` bit is set. bool shouldRedrawLine = updateAll; - foreach (int i in Enumerable.Range(41, 22)) + foreach (int i in Enumerable.Range(41, 2)) { if (shouldRedrawLine) { 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)) { shouldRedrawLine = true;