// Path: src/main/java/com/kasirgalabs/etumulator/util/BaseDispatcher.java
// public class BaseDispatcher implements Dispatcher {
//     private final List<Observer> observers;
// 
//     public BaseDispatcher() {
//         observers = new ArrayList<>(10);
//     }
// 
//     @Override
//     public void addObserver(Observer observer) {
//         observers.add(observer);
//     }
// 
//     @Override
//     public void notifyObservers(Class<?> clazz, Object arg) {
//         for(int i = 0; i < observers.size(); i++) {
//             observers.get(i).update(clazz, arg);
//         }
//     }
// 
//     @Override
//     public void notifyObservers(Class<?> clazz) {
//         notifyObservers(clazz, null);
//     }
// }
// 
// Path: src/main/java/com/kasirgalabs/etumulator/util/Dispatcher.java
// public interface Dispatcher {
//     void addObserver(Observer observer);
// 
//     void notifyObservers(Class<?> clazz, Object arg);
// 
//     void notifyObservers(Class<?> clazz);
// }
// 
// Path: src/main/java/com/kasirgalabs/etumulator/util/Observable.java
// public interface Observable {
//     void addObserver(Observer observer);
// }
// 
// Path: src/main/java/com/kasirgalabs/etumulator/util/Observer.java
// public interface Observer {
//     void update(Class<?> clazz, Object arg);
// }


import com.google.inject.Inject;
import com.google.inject.Singleton;
import com.kasirgalabs.etumulator.util.BaseDispatcher;
import com.kasirgalabs.etumulator.util.Dispatcher;
import com.kasirgalabs.etumulator.util.Observable;
import com.kasirgalabs.etumulator.util.Observer;
import java.util.HashMap;
import java.util.Map;
                dispatcher.notifyObservers(Memory.class, address);
                break;
            case HALFWORD:
                memory.put(address, (byte) value);
                dispatcher.notifyObservers(Memory.class, address);
                memory.put(address + 1, (byte) (value >>> 8));
                dispatcher.notifyObservers(Memory.class, address);
                break;
            case WORD:
                memory.put(address, (byte) value);
                dispatcher.notifyObservers(Memory.class, address);
                memory.put(address + 1, (byte) (value >>> 8));
                dispatcher.notifyObservers(Memory.class, address);
                memory.put(address + 2, (byte) (value >>> 16));
                dispatcher.notifyObservers(Memory.class, address);
                memory.put(address + 3, (byte) (value >>> 24));
                dispatcher.notifyObservers(Memory.class, address);
        }
    }

    public boolean isAddressEmpty(int address, Size size) {
        boolean empty = false;
        for(int i = 0; i <= size.ordinal(); i++) {
            if(!memory.containsKey(address + i)) {
                empty = true;
            }
        }
        if(size == Size.WORD) {
            return empty || !memory.containsKey(address + 3);
        }
// Path: src/main/java/com/kasirgalabs/etumulator/util/BaseDispatcher.java
// public class BaseDispatcher implements Dispatcher {
//     private final List<Observer> observers;
// 
//     public BaseDispatcher() {
//         observers = new ArrayList<>(10);
//     }
// 
//     @Override
//     public void addObserver(Observer observer) {
//         observers.add(observer);
//     }
// 
//     @Override
//     public void notifyObservers(Class<?> clazz, Object arg) {
//         for(int i = 0; i < observers.size(); i++) {
//             observers.get(i).update(clazz, arg);
//         }
//     }
// 
//     @Override
//     public void notifyObservers(Class<?> clazz) {
//         notifyObservers(clazz, null);
//     }
// }
// 
// Path: src/main/java/com/kasirgalabs/etumulator/util/Dispatcher.java
// public interface Dispatcher {
//     void addObserver(Observer observer);
// 
//     void notifyObservers(Class<?> clazz, Object arg);
// 
//     void notifyObservers(Class<?> clazz);
// }
// 
// Path: src/main/java/com/kasirgalabs/etumulator/util/Observable.java
// public interface Observable {
//     void addObserver(Observer observer);
// }
// 
// Path: src/main/java/com/kasirgalabs/etumulator/util/Observer.java
// public interface Observer {
//     void update(Class<?> clazz, Object arg);
// }


// Path: src/main/java/com/kasirgalabs/etumulator/processor/Memory.java
import com.google.inject.Inject;
import com.google.inject.Singleton;
import com.kasirgalabs.etumulator.util.BaseDispatcher;
import com.kasirgalabs.etumulator.util.Dispatcher;
import com.kasirgalabs.etumulator.util.Observable;
import com.kasirgalabs.etumulator.util.Observer;
import java.util.HashMap;
import java.util.Map;

                dispatcher.notifyObservers(Memory.class, address);
                break;
            case HALFWORD:
                memory.put(address, (byte) value);
                dispatcher.notifyObservers(Memory.class, address);
                memory.put(address + 1, (byte) (value >>> 8));
                dispatcher.notifyObservers(Memory.class, address);
                break;
            case WORD:
                memory.put(address, (byte) value);
                dispatcher.notifyObservers(Memory.class, address);
                memory.put(address + 1, (byte) (value >>> 8));
                dispatcher.notifyObservers(Memory.class, address);
                memory.put(address + 2, (byte) (value >>> 16));
                dispatcher.notifyObservers(Memory.class, address);
                memory.put(address + 3, (byte) (value >>> 24));
                dispatcher.notifyObservers(Memory.class, address);
        }
    }

    public boolean isAddressEmpty(int address, Size size) {
        boolean empty = false;
        for(int i = 0; i <= size.ordinal(); i++) {
            if(!memory.containsKey(address + i)) {
                empty = true;
            }
        }
        if(size == Size.WORD) {
            return empty || !memory.containsKey(address + 3);
        }
        return empty;