From 435134a2171ff1092eb87cbd1abe5fd3935118cc Mon Sep 17 00:00:00 2001 From: Daniel Kirschten Date: Sun, 29 Sep 2019 18:38:36 +0200 Subject: [PATCH] Fixed a bug in MainMemoryBlockExtension --- .../net/mograsim/plugin/launch/MainMemoryBlockExtension.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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++) -- 2.17.1