mirror of
https://github.com/curioustorvald/tsvm.git
synced 2026-03-07 11:51:49 +09:00
new clcd ui (this will be the new default portable machine)
This commit is contained in:
BIN
assets/clcd.kra
LFS
Normal file
BIN
assets/clcd.kra
LFS
Normal file
Binary file not shown.
BIN
assets/clcd.png
Normal file
BIN
assets/clcd.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.7 KiB |
@@ -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 outfile = files.open(_G.shell.resolvePathInput(exec_args[3]).full)
|
||||||
|
|
||||||
let ipfType = (exec_args[1]|0) - 1
|
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]}`)
|
if (encodefun === undefined) throw Error(`Unknown IPF format: ${exec_args[1]}`)
|
||||||
|
|
||||||
// read input file
|
// read input file
|
||||||
|
|||||||
BIN
assets/lcd.png
BIN
assets/lcd.png
Binary file not shown.
|
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.7 KiB |
BIN
assets/lcd2.png
BIN
assets/lcd2.png
Binary file not shown.
|
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.7 KiB |
71
tsvm_core/src/net/torvald/tsvm/peripheral/CLCDDisplay.kt
Normal file
71
tsvm_core/src/net/torvald/tsvm/peripheral/CLCDDisplay.kt
Normal file
@@ -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()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -9,7 +9,7 @@ import net.torvald.tsvm.TsvmTextureRegionPack
|
|||||||
import net.torvald.tsvm.VM
|
import net.torvald.tsvm.VM
|
||||||
|
|
||||||
class CharacterLCDdisplay(assetsRoot: String, vm: VM) : GraphicsAdapter(assetsRoot, vm, AdapterConfig(
|
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
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
|
|
||||||
|
|||||||
@@ -12,8 +12,8 @@ public class AppLoader {
|
|||||||
public static String appTitle = "tsvm";
|
public static String appTitle = "tsvm";
|
||||||
public static Lwjgl3ApplicationConfiguration appConfig;
|
public static Lwjgl3ApplicationConfiguration appConfig;
|
||||||
|
|
||||||
public static int WIDTH = 640;//810;//720;
|
public static int WIDTH = 1080;//810;//720;
|
||||||
public static int HEIGHT = 480;//360;//480;
|
public static int HEIGHT = 436;//360;//480;
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
ShaderProgram.pedantic = false;
|
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[]{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[]{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(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[]{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);
|
VM pipvm = new VM("./assets", 4096, new TheRealWorld(), new VMProgramRom[]{PipBios.INSTANCE, PipROM.INSTANCE}, 8);
|
||||||
|
|
||||||
String diskPath = "assets/disk0";
|
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 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 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 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 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(
|
EmulInstance pip = new EmulInstance(pipvm, null, diskPath, 640, 480, CollectionsKt.listOf(new Pair(1, new PeripheralEntry2(
|
||||||
32768L,
|
32768L,
|
||||||
@@ -51,6 +51,6 @@ public class AppLoader {
|
|||||||
pipvm, 160, 140
|
pipvm, 160, 140
|
||||||
))));
|
))));
|
||||||
|
|
||||||
new Lwjgl3Application(new VMGUI(reference, WIDTH, HEIGHT), appConfig);
|
new Lwjgl3Application(new VMGUI(portable, WIDTH, HEIGHT), appConfig);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user