Updated Am2900Machine and -Definition; Added MachineContext
[Mograsim.git] / net.mograsim.machine / src / net / mograsim / machine / Memory.java
index 8297ebb..77c0d48 100644 (file)
@@ -16,5 +16,20 @@ public interface Memory<T>
         */
        public void setCell(long address, T data);
        
-       public long size();
+       public default long size()
+       {
+               MemoryDefinition def = getDefinition();
+               return Long.max(0, def.getMaximalAddress() - def.getMinimalAddress() + 1);
+       }
+       
+       /**
+        * Registers an observer to be notified when a memory cell is modified
+        */
+       public void registerObserver(MemoryObserver ob);
+       
+       public void deregisterObserver(MemoryObserver ob);
+       
+       public void notifyObservers(long address);
+       
+       public MemoryDefinition getDefinition();
 }