From 2339b7315f4d961de65162d775d9604e444dee3d Mon Sep 17 00:00:00 2001 From: Sean Cross Date: Mon, 5 Jul 2021 17:35:15 +0800 Subject: [PATCH] emulation: memlcd: add DEVBOOT register and defacement Add this new register as well as the defacement that occurs when it is enabled. Signed-off-by: Sean Cross --- emulation/peripherals/memlcd.cs | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/emulation/peripherals/memlcd.cs b/emulation/peripherals/memlcd.cs index f386857a8..431dceef0 100644 --- a/emulation/peripherals/memlcd.cs +++ b/emulation/peripherals/memlcd.cs @@ -74,15 +74,23 @@ namespace Antmicro.Renode.Peripherals.Video { for (int x = 0; x < Width; x++) { - if (((newbuf[(x + y * 44 * 8) / 8] >> (x % 8)) & 1) > 0) + if ((devBoot) && (y == devBootLine) && ((x >> 1) & 2) != 0) { - buffer[2 * (x + y * Width)] = 0xFF; - buffer[2 * (x + y * Width) + 1] = 0xFF; + buffer[2 * (x + y * Width)] = 0x00; + buffer[2 * (x + y * Width) + 1] = 0x00; } else { - buffer[2 * (x + y * Width)] = 0x0; - buffer[2 * (x + y * Width) + 1] = 0x0; + if (((newbuf[(x + y * 44 * 8) / 8] >> (x % 8)) & 1) > 0) + { + buffer[2 * (x + y * Width)] = 0xFF; + buffer[2 * (x + y * Width) + 1] = 0xFF; + } + else + { + buffer[2 * (x + y * Width)] = 0x0; + buffer[2 * (x + y * Width) + 1] = 0x0; + } } } } @@ -105,8 +113,13 @@ namespace Antmicro.Renode.Peripherals.Video Registers.PRESCALER.Define(this) .WithValueField(0, 32, valueProviderCallback: _ => { return 0; }) ; + Registers.DEVBOOT.Define(this) + .WithFlag(0, name: "DEVBOOT", valueProviderCallback: _ => { return devBoot; }, changeCallback: (_, val) => { if (val) { devBoot = true; } }) + ; } + private const int devBootLine = 12; + private bool devBoot = false; private bool updateDirty = false; private bool updateAll = false; @@ -119,6 +132,7 @@ namespace Antmicro.Renode.Peripherals.Video COMMAND = 0x0, BUSY = 0x04, PRESCALER = 0x08, + DEVBOOT = 0x18, } } }