|
|
|
@ -4,6 +4,7 @@ import com.simon816.j65el02.Machine;
|
|
|
|
|
import com.simon816.j65el02.device.FileDiskDriver;
|
|
|
|
|
import com.simon816.j65el02.device.RPDrive;
|
|
|
|
|
import com.simon816.j65el02.device.RPMonitor;
|
|
|
|
|
import com.simon816.j65el02.device.RedBus;
|
|
|
|
|
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
import java.net.URISyntaxException;
|
|
|
|
@ -26,39 +27,39 @@ public class Main {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static Machine emu = new Machine(rpcboot, 8192);
|
|
|
|
|
|
|
|
|
|
static long interruptTimer = 50L;
|
|
|
|
|
//Adjust as needed to match original clock speed
|
|
|
|
|
static long frequency = 2L;
|
|
|
|
|
static BasicMonitorDriver monitorDriver;
|
|
|
|
|
|
|
|
|
|
static TimerTask interruptTask = new TimerTask(){
|
|
|
|
|
public void run(){
|
|
|
|
|
if(emu.cpu.isWaitingForInterrupt())
|
|
|
|
|
emu.interruptWait.release();
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static TimerTask cpuTask = new TimerTask(){
|
|
|
|
|
public void run(){
|
|
|
|
|
for(int i = 0; i < 50; i++)
|
|
|
|
|
emu.step();
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static Timer timer1 = new Timer();
|
|
|
|
|
static Timer timer2 = new Timer();
|
|
|
|
|
|
|
|
|
|
public static void main(String[] args) {
|
|
|
|
|
RedBus redBus = new RedBus();
|
|
|
|
|
Emulator core = new Emulator(redBus);
|
|
|
|
|
|
|
|
|
|
TimerTask interruptTask = new TimerTask(){
|
|
|
|
|
public void run(){
|
|
|
|
|
if(core.cpu.isWaitingForInterrupt())
|
|
|
|
|
core.setWaitingOnInterrupt();
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
TimerTask cpuTask = new TimerTask(){
|
|
|
|
|
public void run(){
|
|
|
|
|
for(int i = 0; i < 50; i++)
|
|
|
|
|
core.step();
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
FileDiskDriver tetrisDrive = new FileDiskDriver(disk, "tetrisDrive", "TETRIS", false);
|
|
|
|
|
monitorDriver = new BasicMonitorDriver(emu);
|
|
|
|
|
RPDrive diskDrive = new RPDrive(emu, tetrisDrive);
|
|
|
|
|
RPMonitor monitor = new RPMonitor(emu, monitorDriver);
|
|
|
|
|
emu.setPeripheral(emu.getDefaultDriveId(), diskDrive);
|
|
|
|
|
emu.setPeripheral(emu.getDefaultMonitorId(), monitor);
|
|
|
|
|
monitorDriver = new BasicMonitorDriver();
|
|
|
|
|
RPDrive diskDrive = new RPDrive(tetrisDrive);
|
|
|
|
|
RPMonitor monitor = new RPMonitor(monitorDriver);
|
|
|
|
|
redBus.setPeripheral(2, diskDrive);
|
|
|
|
|
redBus.setPeripheral(1, monitor);
|
|
|
|
|
System.out.println("Started emu thread");
|
|
|
|
|
System.out.println("Started display thread");
|
|
|
|
|
timer1.schedule(interruptTask, new Date(), interruptTimer);
|
|
|
|
|