X-Git-Url: https://mograsim.net/gitweb/?a=blobdiff_plain;f=plugins%2Fnet.mograsim.plugin.core%2Fsrc%2Fnet%2Fmograsim%2Fplugin%2Flaunch%2FMainMemoryBlockExtension.java;h=ff633fe1998034c14b51f6f4a710d0dbd9eb5f3b;hb=0eb525202d3c871a2a20f789af1728248f3cff11;hp=9355ae2693e753e120982e9b3101f6dd595b6557;hpb=071016cea4c9942b7f5c26f4b7f0bbeb8ca37baf;p=Mograsim.git 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++)