X-Git-Url: https://mograsim.net/gitweb/?a=blobdiff_plain;f=plugins%2Fnet.mograsim.plugin.core%2Fsrc%2Fnet%2Fmograsim%2Fplugin%2Flaunch%2FMainMemoryBlockExtension.java;h=16c6db0a394c8f2f5b32982df8b50c9c35883dc9;hb=648fc6e69e09fe4467cb6bac47934be1a7dcf0d6;hp=7e517ca5d80109f3f7842d63f9255794f3090662;hpb=549ea582fac6bd9e5c184119d0fc62882efea713;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 7e517ca5..16c6db0a 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 @@ -1,5 +1,7 @@ package net.mograsim.plugin.launch; +import static net.mograsim.plugin.preferences.PluginPreferences.MAX_MEMORY_CHANGE_INTERVAL; + import java.math.BigInteger; import java.util.HashSet; import java.util.Set; @@ -21,7 +23,6 @@ import net.mograsim.machine.MainMemory; import net.mograsim.machine.MainMemoryDefinition; import net.mograsim.machine.Memory.MemoryCellModifiedListener; import net.mograsim.plugin.MograsimActivator; -import net.mograsim.preferences.Preferences; public class MainMemoryBlockExtension extends PlatformObject implements IMemoryBlockExtension { @@ -72,7 +73,7 @@ public class MainMemoryBlockExtension extends PlatformObject implements IMemoryB if (baseAddrWords.compareTo(minAddrWords) < 0 || baseAddrWords.compareTo(maxAddrWords) > 0) throwDebugException("Base address out of range"); - if (baseAddrWords.add(lengthWords).compareTo(maxAddrWords) > 0) + if (baseAddrWords.add(lengthWords).subtract(BigInteger.ONE).compareTo(maxAddrWords) > 0) throwDebugException("End address out of range"); this.clients = new HashSet<>(); @@ -80,7 +81,8 @@ public class MainMemoryBlockExtension extends PlatformObject implements IMemoryB this.memListener = a -> queueFireContentChangeEvent(); this.memListenerRegistered = new AtomicBoolean(); - this.maxContentChangeInterval = Preferences.current().getInt("net.mograsim.plugin.core.maxmemchangeinterval"); + // TODO add a listener + this.maxContentChangeInterval = MograsimActivator.instance().getPluginPrefs().getInt(MAX_MEMORY_CHANGE_INTERVAL); this.contentChangeLock = new Object(); this.nextContentChangeAllowedMillis = System.currentTimeMillis() - maxContentChangeInterval - 1; } @@ -195,7 +197,7 @@ public class MainMemoryBlockExtension extends PlatformObject implements IMemoryB @Override public int getAddressSize() throws DebugException { - return Long.BYTES; + return (getBigLength().bitLength() + 7) / 8; } @Override