+
+ // Listeners
+ private MemoryCellModifiedListener cellModifiedListener = address ->
+ {
+ setDirty(true);
+ table.refresh();
+ };
+
+ private ActiveMicroInstructionChangedListener instChangeListener = (oldAddress, newAddress) ->
+ {
+ highlight((int) (newAddress - memory.getDefinition().getMinimalAddress()));
+ };
+
+ private MIMemoryReassignedListener reassignedListener = newAssignee ->
+ {
+ // clear highlighting if the memory is reassigned
+ if (newAssignee != memory)
+ highlight(-1);
+ };
+
+ private ActiveMachineListener activeMachineListener = (oldMachine, newMachine) ->
+ {
+ // clear highlighting if the active machine changes
+ if (newMachine.isEmpty() || !newMachine.equals(oldMachine))
+ {
+ highlight(-1);
+ oldMachine.ifPresent(m -> m.getMicroInstructionMemory().deregisterMemoryReassignedListener(reassignedListener));
+ }
+ };