From: Daniel Kirschten Date: Sun, 29 Sep 2019 16:38:36 +0000 (+0200) Subject: Fixed a bug in MainMemoryBlockExtension X-Git-Url: https://mograsim.net/gitweb/?a=commitdiff_plain;h=435134a2171ff1092eb87cbd1abe5fd3935118cc;p=Mograsim.git Fixed a bug in MainMemoryBlockExtension --- diff --git a/plugins/net.mograsim.plugin.core/src/net/mograsim/plugin/launch/MainMemoryBlockExtension.java b/plugins/net.mograsim.plugin.core/src/net/mograsim/plugin/launch/MainMemoryBlockExtension.java index 9355ae26..ff633fe1 100644 --- a/plugins/net.mograsim.plugin.core/src/net/mograsim/plugin/launch/MainMemoryBlockExtension.java +++ b/plugins/net.mograsim.plugin.core/src/net/mograsim/plugin/launch/MainMemoryBlockExtension.java @@ -228,10 +228,11 @@ public class MainMemoryBlockExtension extends PlatformObject implements IMemoryB { BigInteger word = mem.getCellAsBigInteger(j.longValue()); byte[] wordBytes = word.toByteArray(); + int l = wordBytes[0] == 0 ? 1 : 0; int k; - for (k = 0; k < cellWidthBytes - wordBytes.length; k++) + for (k = 0; k < cellWidthBytes - wordBytes.length + l; k++) bytes[i + k] = new MemoryByte(); - for (int l = 0; k < cellWidthBytes; k++) + for (; k < cellWidthBytes; k++, l++) bytes[i + k] = new MemoryByte(wordBytes[l]); } else for (int k = 0; k < cellWidthBytes; k++)