TEVD DOM changes committing to the physical disk

This commit is contained in:
minjaesong
2022-12-18 16:30:06 +09:00
parent 7ebd0a329b
commit 7a349d6192
7 changed files with 88 additions and 49 deletions

View File

@@ -8,6 +8,7 @@ import kotlin.collections.CollectionsKt;
import net.torvald.tsvm.peripheral.*;
import java.io.File;
import java.util.HashMap;
public class AppLoader {
@@ -29,6 +30,8 @@ public class AppLoader {
appConfig.setWindowedMode(WIDTH, HEIGHT);
HashMap<String, VMWatchdog> watchdogs = new HashMap<>();
watchdogs.put("TEVD_SYNC", TevdSyncWatchdog.INSTANCE);
String diskPath = "assets/disk0";
@@ -36,11 +39,11 @@ public class AppLoader {
// VM vm = new VM(64 << 10, new TheRealWorld(), new VMProgramRom[]{BasicBios.INSTANCE, BasicRom.INSTANCE});
// VM vm = new VM(64 << 10, new TheRealWorld(), new VMProgramRom[]{OEMBios.INSTANCE, BasicRom.INSTANCE});
// VM vm = new VM("./assets", 64 << 10, new TheRealWorld(), new VMProgramRom[]{TandemBios.INSTANCE, BasicRom.INSTANCE}, 2);
// VM vm = new VM("./assets", 64 << 10, new TheRealWorld(), new VMProgramRom[]{TandemBios.INSTANCE, BasicRom.INSTANCE}, 2, watchdogs);
// VM vm = new VM(128 << 10, new TheRealWorld(), new VMProgramRom[]{BasicBios.INSTANCE, WPBios.INSTANCE});
VM vm = new VM("./assets", 8192 << 10, new TheRealWorld(), new VMProgramRom[]{TsvmBios.INSTANCE}, 8);
// VM vm = new VM("./assets", 8192 << 10, new TheRealWorld(), new VMProgramRom[]{OpenBios.INSTANCE}, 8);
// VM pipvm = new VM("./assets", 4096, new TheRealWorld(), new VMProgramRom[]{PipBios.INSTANCE, PipROM.INSTANCE}, 8);
VM vm = new VM("./assets", 8192 << 10, new TheRealWorld(), new VMProgramRom[]{TsvmBios.INSTANCE}, 8, watchdogs);
// VM vm = new VM("./assets", 8192 << 10, new TheRealWorld(), new VMProgramRom[]{OpenBios.INSTANCE}, 8, watchdogs);
// VM pipvm = new VM("./assets", 4096, new TheRealWorld(), new VMProgramRom[]{PipBios.INSTANCE, PipROM.INSTANCE}, 8, watchdogs);
vm.getIO().getBlockTransferPorts()[0].attachDevice(new TestDiskDrive(vm, 0, diskPath));
vm.getIO().getBlockTransferPorts()[1].attachDevice(new HttpModem(vm, 1024, -1));

View File

@@ -5,14 +5,10 @@ import com.badlogic.gdx.Gdx
import com.badlogic.gdx.files.FileHandle
import com.badlogic.gdx.graphics.*
import com.badlogic.gdx.graphics.g2d.SpriteBatch
import com.badlogic.gdx.utils.GdxRuntimeException
import com.badlogic.gdx.utils.JsonReader
import com.badlogic.gdx.utils.JsonValue
import com.badlogic.gdx.utils.JsonWriter
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.Job
import kotlinx.coroutines.cancel
import kotlinx.coroutines.launch
import net.torvald.terrarum.FlippingSpriteBatch
import net.torvald.terrarum.imagefont.TinyAlphNum
import net.torvald.terrarum.utils.JsonFetcher
@@ -64,6 +60,9 @@ class VMEmuExecutableWrapper(val windowWidth: Int, val windowHeight: Int, var pa
*/
class VMEmuExecutable(val windowWidth: Int, val windowHeight: Int, var panelsX: Int, var panelsY: Int, val diskPathRoot: String) : ApplicationAdapter() {
val TEVD_SYNC = TevdSyncWatchdog
val watchdogs = hashMapOf<String, VMWatchdog>("TEVD_SYNC" to TEVD_SYNC)
private data class VMRunnerInfo(val vm: VM, val name: String)
@@ -235,7 +234,7 @@ class VMEmuExecutable(val windowWidth: Int, val windowHeight: Int, var panelsX:
super.render()
val dt = Gdx.graphics.rawDeltaTime
val dt = Gdx.graphics.deltaTime
updateAkku += dt
var i = 0L
@@ -246,6 +245,8 @@ class VMEmuExecutable(val windowWidth: Int, val windowHeight: Int, var panelsX:
}
renderGame(dt)
watchdogs.forEach { (_, watchdog) -> watchdog.update(dt) }
}
private fun reboot(vm: VM) {
@@ -487,7 +488,7 @@ class VMEmuExecutable(val windowWidth: Int, val windowHeight: Int, var panelsX:
val cardslots = json.getInt("cardslots")
val roms = json.get("roms").iterator().map { VMProgramRom(it.asString()) }.toTypedArray()
val vm = VM(assetsDir, ramsize, TheRealWorld(), roms, cardslots)
val vm = VM(assetsDir, ramsize, TheRealWorld(), roms, cardslots, watchdogs)
// install peripherals
listOf("com1", "com2", "com3", "com4").map { json.get(it) }.forEachIndexed { index, jsonValue ->

View File

@@ -144,7 +144,7 @@ class VMGUI(val loaderInfo: EmulInstance, val viewportWidth: Int, val viewportHe
super.render()
val dt = Gdx.graphics.rawDeltaTime
val dt = Gdx.graphics.deltaTime
updateAkku += dt
var i = 0L
@@ -155,6 +155,8 @@ class VMGUI(val loaderInfo: EmulInstance, val viewportWidth: Int, val viewportHe
}
renderGame(dt)
vm.watchdogs.forEach { (_, watchdog) -> watchdog.update(dt) }
}
private fun updateGame(delta: Float) {