Still not working!
parent
17ff02dfe1
commit
ed54f55acf
@ -1 +1 @@
|
|||||||
Subproject commit 3690b0031fd685abecc2f7d21678c61dca69f40f
|
Subproject commit 419245bf18a266be19f8b02a565fb5e7150a39a3
|
@ -0,0 +1,27 @@
|
|||||||
|
package net.brokenmoon.redcontrol.api;
|
||||||
|
|
||||||
|
import com.simon816.j65el02.Bus;
|
||||||
|
import com.simon816.j65el02.device.Device;
|
||||||
|
import com.simon816.j65el02.device.RedBus;
|
||||||
|
import com.simon816.j65el02.device.RedBusState;
|
||||||
|
import net.brokenmoon.redcontrol.RedControl;
|
||||||
|
|
||||||
|
public class TempBus extends Bus {
|
||||||
|
public TempBus(RedBus redBus) {
|
||||||
|
super(redBus);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void write(int address, int data, RedBusState state) {
|
||||||
|
Device device = findDevice(address,state);
|
||||||
|
RedControl.LOGGER.info("Writing to bus with device " + device + "at address " + (address - device.startAddress(state)) + " with data " + data + " with target " + state.activeDeviceId + " and redbus offset of " + state.offset);
|
||||||
|
device.write(address - device.startAddress(state) % 0x2000, data, state);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int read(int address, boolean cpuAccess, RedBusState state) {
|
||||||
|
Device device = findDevice(address,state);
|
||||||
|
RedControl.LOGGER.info("Reading from bus with device " + device + "at address " + (address - device.startAddress(state)) + " with target " + state.activeDeviceId + " and redbus offset of " + state.offset);
|
||||||
|
return device.read(address - device.startAddress(state) % 0x2000, cpuAccess, state) & 0xff;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,33 @@
|
|||||||
|
package net.brokenmoon.redcontrol.api;
|
||||||
|
|
||||||
|
import com.simon816.j65el02.device.RedBus;
|
||||||
|
import com.simon816.j65el02.device.RedBusState;
|
||||||
|
import net.brokenmoon.redcontrol.RedControl;
|
||||||
|
|
||||||
|
public class TempRedBus extends RedBus {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void write(int address, int data, RedBusState state) {
|
||||||
|
RedControl.LOGGER.info("Writing at " + address);
|
||||||
|
if (!state.enabled) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Peripheral peripheral = this.peripherals[state.activeDeviceId];
|
||||||
|
if (peripheral != null) {
|
||||||
|
peripheral.write(address, data & 0xff);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int read(int address, boolean cpuAccess, RedBusState state) {
|
||||||
|
RedControl.LOGGER.info("Reading at " + address);
|
||||||
|
if (!state.enabled) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
Peripheral peripheral = this.peripherals[state.activeDeviceId];
|
||||||
|
if (peripheral != null) {
|
||||||
|
return peripheral.read(address);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue