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