From d6fc1bfe5c598d1ca8e8b01e5dfce65e2ab63b21 Mon Sep 17 00:00:00 2001 From: Astoria Date: Wed, 10 Apr 2024 13:35:38 -0500 Subject: [PATCH] WORKS WITHOUT REDBUS STORING DATA --- .gitmodules | 2 +- J65el02 | 2 +- .../net/brokenmoon/BasicMonitorDriver.java | 2 +- src/main/java/net/brokenmoon/Main.java | 43 ++++++++++--------- 4 files changed, 25 insertions(+), 24 deletions(-) diff --git a/.gitmodules b/.gitmodules index bff4449..1ddf0c6 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ [submodule "J65el02"] path = J65el02 - url = git@github.com:simon816/J65el02.git + url = https://github.com/walksanatora/J65el02.git diff --git a/J65el02 b/J65el02 index b687ef5..341d5a5 160000 --- a/J65el02 +++ b/J65el02 @@ -1 +1 @@ -Subproject commit b687ef534c10ae6723564aa3f6ced9746f07f4a0 +Subproject commit 341d5a5fe2d200583bccaefce8884927fe6605b1 diff --git a/src/main/java/net/brokenmoon/BasicMonitorDriver.java b/src/main/java/net/brokenmoon/BasicMonitorDriver.java index c1eb6d1..1277b1f 100644 --- a/src/main/java/net/brokenmoon/BasicMonitorDriver.java +++ b/src/main/java/net/brokenmoon/BasicMonitorDriver.java @@ -28,7 +28,7 @@ public class BasicMonitorDriver implements MonitorDriver, KeyListener { int xoffset = 30; int yoffset = 26; - public BasicMonitorDriver(Machine emu) { + public BasicMonitorDriver() { this.emu = emu; try{ display = ImageIO.read(Objects.requireNonNull(getClass().getResourceAsStream("/display.png"))); diff --git a/src/main/java/net/brokenmoon/Main.java b/src/main/java/net/brokenmoon/Main.java index 1854d3c..186a77a 100644 --- a/src/main/java/net/brokenmoon/Main.java +++ b/src/main/java/net/brokenmoon/Main.java @@ -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);