|
|
|
@ -5,9 +5,11 @@ import com.simon816.j65el02.Cpu;
|
|
|
|
|
import com.simon816.j65el02.CpuState;
|
|
|
|
|
import com.simon816.j65el02.device.Memory;
|
|
|
|
|
import com.simon816.j65el02.device.RedBus;
|
|
|
|
|
import com.simon816.j65el02.device.RedBusState;
|
|
|
|
|
import net.brokenmoon.redcontrol.RedControl;
|
|
|
|
|
import net.brokenmoon.redcontrol.mixin.BusAccessor;
|
|
|
|
|
import net.brokenmoon.redcontrol.mixin.CpuAccessor;
|
|
|
|
|
import net.brokenmoon.redcontrol.mixin.MemoryAccessor;
|
|
|
|
|
import net.minecraft.nbt.NbtCompound;
|
|
|
|
|
|
|
|
|
|
import java.io.IOException;
|
|
|
|
@ -105,14 +107,15 @@ public class Emulator {
|
|
|
|
|
nbt.putLong("stepCounter", cpu.getCpuState().stepCounter);
|
|
|
|
|
|
|
|
|
|
//Redbus state write nbt
|
|
|
|
|
nbt.putInt("deviceId", cpu.redBusState.activeDeviceId);
|
|
|
|
|
nbt.putInt("offset", cpu.redBusState.offset);
|
|
|
|
|
nbt.putInt("memoryWindow", cpu.redBusState.memoryWindow);
|
|
|
|
|
nbt.putBoolean("enabled", cpu.redBusState.enabled);
|
|
|
|
|
nbt.putBoolean("enableWindow", cpu.redBusState.enableWindow);
|
|
|
|
|
RedBusState redBusState = ((CpuAccessor)cpu).getRedBusState();
|
|
|
|
|
nbt.putInt("deviceId", redBusState.activeDeviceId);
|
|
|
|
|
nbt.putInt("offset", redBusState.offset);
|
|
|
|
|
nbt.putInt("memoryWindow", redBusState.memoryWindow);
|
|
|
|
|
nbt.putBoolean("enabled", redBusState.enabled);
|
|
|
|
|
nbt.putBoolean("enableWindow", redBusState.enableWindow);
|
|
|
|
|
|
|
|
|
|
//Ram write nbt.
|
|
|
|
|
nbt.putByteArray("ramValues", this.ram.getMem());
|
|
|
|
|
nbt.putByteArray("ramValues", ((MemoryAccessor)this.ram).getMem());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void readNbt(NbtCompound nbt) {
|
|
|
|
@ -157,13 +160,14 @@ public class Emulator {
|
|
|
|
|
cpu.getCpuState().stepCounter = nbt.getLong("stepCounter");
|
|
|
|
|
|
|
|
|
|
//Redbus state write nbt
|
|
|
|
|
cpu.redBusState.activeDeviceId = nbt.getInt("deviceId");
|
|
|
|
|
cpu.redBusState.offset = nbt.getInt("offset");
|
|
|
|
|
cpu.redBusState.memoryWindow = nbt.getInt("memoryWindow");
|
|
|
|
|
cpu.redBusState.enabled = nbt.getBoolean("enabled");
|
|
|
|
|
cpu.redBusState.enableWindow = nbt.getBoolean("enableWindow");
|
|
|
|
|
RedBusState redBusState = ((CpuAccessor)cpu).getRedBusState();
|
|
|
|
|
redBusState.activeDeviceId = nbt.getInt("deviceId");
|
|
|
|
|
redBusState.offset = nbt.getInt("offset");
|
|
|
|
|
redBusState.memoryWindow = nbt.getInt("memoryWindow");
|
|
|
|
|
redBusState.enabled = nbt.getBoolean("enabled");
|
|
|
|
|
redBusState.enableWindow = nbt.getBoolean("enableWindow");
|
|
|
|
|
|
|
|
|
|
//Ram write nbt.
|
|
|
|
|
ram.setMem(nbt.getByteArray("ramValues"));
|
|
|
|
|
((MemoryAccessor)ram).setMem(nbt.getByteArray("ramValues"));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|