diff --git a/assets/clcd.kra b/assets/clcd.kra new file mode 100644 index 0000000..9781035 --- /dev/null +++ b/assets/clcd.kra @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9421834ba5ad160d97a55ab426d7bcbfcb2ab092e5ef276cf79361419b49e265 +size 31181 diff --git a/assets/clcd.png b/assets/clcd.png new file mode 100644 index 0000000..a21142e Binary files /dev/null and b/assets/clcd.png differ diff --git a/assets/disk0/tvdos/bin/encodeipf.js b/assets/disk0/tvdos/bin/encodeipf.js index c4e2e90..1ac8d3a 100644 --- a/assets/disk0/tvdos/bin/encodeipf.js +++ b/assets/disk0/tvdos/bin/encodeipf.js @@ -9,7 +9,7 @@ let infile = files.open(_G.shell.resolvePathInput(exec_args[2]).full) let outfile = files.open(_G.shell.resolvePathInput(exec_args[3]).full) let ipfType = (exec_args[1]|0) - 1 -let encodefun = ([graphics.decodeIpf1, graphics.decodeIpf2])[ipfType] +let encodefun = ([graphics.encodeIpf1, graphics.encodeIpf2])[ipfType] if (encodefun === undefined) throw Error(`Unknown IPF format: ${exec_args[1]}`) // read input file diff --git a/assets/lcd.png b/assets/lcd.png index 736ab02..bdbdd6e 100644 Binary files a/assets/lcd.png and b/assets/lcd.png differ diff --git a/assets/lcd2.png b/assets/lcd2.png index 1be472a..7fd5a14 100644 Binary files a/assets/lcd2.png and b/assets/lcd2.png differ diff --git a/tsvm_core/src/net/torvald/tsvm/peripheral/CLCDDisplay.kt b/tsvm_core/src/net/torvald/tsvm/peripheral/CLCDDisplay.kt new file mode 100644 index 0000000..b3c9a06 --- /dev/null +++ b/tsvm_core/src/net/torvald/tsvm/peripheral/CLCDDisplay.kt @@ -0,0 +1,71 @@ +package net.torvald.tsvm.peripheral + +import com.badlogic.gdx.graphics.Color +import com.badlogic.gdx.graphics.Texture +import com.badlogic.gdx.graphics.g2d.SpriteBatch +import com.badlogic.gdx.graphics.glutils.FrameBuffer +import net.torvald.terrarum.modulecomputers.virtualcomputer.tvd.toUlong +import net.torvald.tsvm.TsvmTextureRegionPack +import net.torvald.tsvm.VM + +/** + * Mimicks Commodore CLCD + * + * Created by minjaesong on 2022-09-21. + */ +class CLCDDisplay(assetsRoot: String, vm: VM) : GraphicsAdapter(assetsRoot, vm, AdapterConfig( + "pmlcd_inverted", 480, 128, 80, 16, 253, 255, 262144L, "lcd2.png", 0.7f, TEXT_TILING_SHADER_LCD, DRAW_SHADER_FRAG_LCD, 2f +) +) { + + private val machine = Texture("$assetsRoot/clcd.png") + private val lcdFont = TsvmTextureRegionPack(Texture("$assetsRoot/lcd.png"), 12, 16) + + /*override fun peek(addr: Long): Byte? { + return when (addr) { + in 0 until 250880 -> (-1).toByte() + else -> super.peek(addr) + } + } + + override fun poke(addr: Long, byte: Byte) { + when (addr) { + in 0 until 250880 -> { /*do nothing*/ } + else -> super.poke(addr, byte) + } + }*/ + + override fun render( + delta: Float, + batch: SpriteBatch, + xoff: Float, + yoff: Float, + flipY: Boolean, + uiFBO: FrameBuffer? + ) { + batch.shader = null + batch.inUse { + batch.color = Color.WHITE + batch.draw(machine, xoff, yoff) + } + super.render(delta, batch, xoff+60, yoff+90, flipY, uiFBO) + } + + + + fun currentTimeInMills(): Long { + vm.poke(-69, -1) + var r = 0L + for (i in 0L..7L) { + r = r or vm.peek(-81 - i)!!.toUlong().shl(8 * i.toInt()) + } + return r + } + + + override fun dispose() { + machine.dispose() + lcdFont.dispose() + super.dispose() + } +} \ No newline at end of file diff --git a/tsvm_core/src/net/torvald/tsvm/peripheral/CharacterLCDdisplay.kt b/tsvm_core/src/net/torvald/tsvm/peripheral/CharacterLCDdisplay.kt index cfc6fb4..82a2052 100644 --- a/tsvm_core/src/net/torvald/tsvm/peripheral/CharacterLCDdisplay.kt +++ b/tsvm_core/src/net/torvald/tsvm/peripheral/CharacterLCDdisplay.kt @@ -9,7 +9,7 @@ import net.torvald.tsvm.TsvmTextureRegionPack import net.torvald.tsvm.VM class CharacterLCDdisplay(assetsRoot: String, vm: VM) : GraphicsAdapter(assetsRoot, vm, AdapterConfig( - "pmlcd_inverted", 240, 64, 40, 8, 253, 255, 262144L, "lcd2.png", 0.7f, TEXT_TILING_SHADER_LCD, DRAW_SHADER_FRAG_LCD, 2f + "pmlcd_inverted", 480, 128, 40, 16, 253, 255, 262144L, "lcd2.png", 0.7f, TEXT_TILING_SHADER_LCD, DRAW_SHADER_FRAG_LCD, 2f ) ) { diff --git a/tsvm_executable/src/net/torvald/tsvm/AppLoader.java b/tsvm_executable/src/net/torvald/tsvm/AppLoader.java index 7a0cd8c..78d403c 100644 --- a/tsvm_executable/src/net/torvald/tsvm/AppLoader.java +++ b/tsvm_executable/src/net/torvald/tsvm/AppLoader.java @@ -12,8 +12,8 @@ public class AppLoader { public static String appTitle = "tsvm"; public static Lwjgl3ApplicationConfiguration appConfig; - public static int WIDTH = 640;//810;//720; - public static int HEIGHT = 480;//360;//480; + public static int WIDTH = 1080;//810;//720; + public static int HEIGHT = 436;//360;//480; public static void main(String[] args) { ShaderProgram.pedantic = false; @@ -30,10 +30,10 @@ 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(64 << 10, new TheRealWorld(), new VMProgramRom[]{TandemBios.INSTANCE, BasicRom.INSTANCE}); + VM vm = new VM("./assets", 64 << 10, new TheRealWorld(), new VMProgramRom[]{TandemBios.INSTANCE, BasicRom.INSTANCE}, 2); // 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}); - VM vm = new VM("./assets", 8192 << 10, new TheRealWorld(), new VMProgramRom[]{OpenBios.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); String diskPath = "assets/disk0"; @@ -41,7 +41,7 @@ public class AppLoader { EmulInstance reference = new EmulInstance(vm, "net.torvald.tsvm.peripheral.ReferenceGraphicsAdapter2", diskPath, 560, 448); EmulInstance reference2 = new EmulInstance(vm, "net.torvald.tsvm.peripheral.ReferenceLikeLCD", diskPath, 560, 448); EmulInstance term = new EmulInstance(vm, "net.torvald.tsvm.peripheral.Term", diskPath, 720, 480); - EmulInstance portable = new EmulInstance(vm, "net.torvald.tsvm.peripheral.CharacterLCDdisplay", diskPath, 628, 302); + EmulInstance portable = new EmulInstance(vm, "net.torvald.tsvm.peripheral.CLCDDisplay", diskPath, 1080, 436); EmulInstance wp = new EmulInstance(vm, "net.torvald.tsvm.peripheral.WpTerm", "assets/wpdisk", 810, 360); EmulInstance pip = new EmulInstance(pipvm, null, diskPath, 640, 480, CollectionsKt.listOf(new Pair(1, new PeripheralEntry2( 32768L, @@ -51,6 +51,6 @@ public class AppLoader { pipvm, 160, 140 )))); - new Lwjgl3Application(new VMGUI(reference, WIDTH, HEIGHT), appConfig); + new Lwjgl3Application(new VMGUI(portable, WIDTH, HEIGHT), appConfig); } }