Why is this not working please game

main
Astoria 7 months ago
parent 273add3a38
commit 5b4b61d96b

@ -1 +1 @@
Subproject commit c6de658396d537fd0c1fc0046d5222c2dc44de3d Subproject commit e82ee867d35793695a3d5013f654c1732c06b74c

@ -0,0 +1,9 @@
package net.brokenmoon.redcontrol.api;
import com.simon816.j65el02.device.RedBus;
public class FakeBus extends RCBus{
public FakeBus(RedBus redBus) {
super(redBus);
}
}

@ -1,18 +1,37 @@
package net.brokenmoon.redcontrol.api; package net.brokenmoon.redcontrol.api;
import com.simon816.j65el02.Bus;
import com.simon816.j65el02.Cpu; import com.simon816.j65el02.Cpu;
import com.simon816.j65el02.CpuState; import com.simon816.j65el02.CpuState;
import net.brokenmoon.redcontrol.blockentities.CpuEntity;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
public class RCCpu extends Cpu { public class RCCpu extends Cpu {
private final World world; private CpuEntity cpuEntity;
private final BlockPos pos;
public RCCpu(World world, BlockPos pos) { public RCCpu(CpuEntity cpuEntity) {
this.world = world; this.cpuEntity = cpuEntity;
this.pos = pos;
} }
public void setInterrupt(boolean val){
state.intWait = val;
}
@Override
private int readByte(int address) {
return this.cpuEntity.getBus().read(address, true);
}
@Override
private void writeMemory(int address, int value, boolean x) {
this.getBus().write(address, value);
boolean flag = x ? this.state.indexWidthFlag : this.state.mWidthFlag;
if (!this.state.emulationFlag && !flag) {
this.cpuEntity.getBus().write(address + 1, value >>> 8);
}
}
@Override
} }

@ -3,6 +3,7 @@ package net.brokenmoon.redcontrol.blockentities;
import com.simon816.j65el02.Bus; import com.simon816.j65el02.Bus;
import com.simon816.j65el02.device.*; import com.simon816.j65el02.device.*;
import net.brokenmoon.redcontrol.RedControl; import net.brokenmoon.redcontrol.RedControl;
import net.brokenmoon.redcontrol.api.FakeBus;
import net.brokenmoon.redcontrol.api.RCBus; import net.brokenmoon.redcontrol.api.RCBus;
import net.brokenmoon.redcontrol.api.RCCpu; import net.brokenmoon.redcontrol.api.RCCpu;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
@ -39,9 +40,9 @@ public class CpuEntity extends Peripheral{
public static void tick(World world, BlockPos pos, BlockState state, CpuEntity be) { public static void tick(World world, BlockPos pos, BlockState state, CpuEntity be) {
if(be.notTicked) { if(be.notTicked) {
be.cpu = new RCCpu(world, pos); be.cpu = new RCCpu(be);
be.setRCBus(new RCBus(new RedBus())); be.setRCBus(new RCBus(new RedBus()));
be.cpu.setBus(be.getRCBus()); be.cpu.setBus((FakeBus)be.getRCBus());
be.cpu.setBus(be.getRCBus()); be.cpu.setBus(be.getRCBus());
Memory ram = new Memory(0x0000, 0x2000); Memory ram = new Memory(0x0000, 0x2000);
try { try {

Loading…
Cancel
Save