mirror of
https://github.com/curioustorvald/tsvm.git
synced 2026-03-09 20:51:51 +09:00
wordprocessor wip
This commit is contained in:
@@ -23,24 +23,26 @@ public class AppLoader {
|
||||
appConfig.resizable = false;
|
||||
appConfig.title = appTitle;
|
||||
appConfig.forceExit = true;
|
||||
appConfig.width = 560;//720;
|
||||
appConfig.height = 448;//480;
|
||||
appConfig.width = 810;//720;
|
||||
appConfig.height = 300;//480;
|
||||
|
||||
|
||||
// val vm = VM(64.kB(), TheRealWorld(), arrayOf(GenericBios))
|
||||
//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(256 << 10, new TheRealWorld(), new VMProgramRom[]{BasicBios.INSTANCE, WPBios.INSTANCE});
|
||||
|
||||
// uncomment to target the TerranBASIC runner
|
||||
VM vm = new VM(64 << 10, new TheRealWorld(), new VMProgramRom[]{TBASRelBios.INSTANCE});
|
||||
//VM vm = new VM(64 << 10, new TheRealWorld(), new VMProgramRom[]{TBASRelBios.INSTANCE});
|
||||
|
||||
EmulInstance reference = new EmulInstance(appConfig, vm, "net.torvald.tsvm.peripheral.ReferenceGraphicsAdapter", "assets/disk0");
|
||||
EmulInstance reference2 = new EmulInstance(appConfig, vm, "net.torvald.tsvm.peripheral.ReferenceLikeLCD", "assets/disk0");
|
||||
EmulInstance term = new EmulInstance(appConfig, vm, "net.torvald.tsvm.peripheral.TexticsAdapter", "assets/disk0");
|
||||
EmulInstance portable = new EmulInstance(appConfig, vm, "net.torvald.tsvm.peripheral.CharacterLCDdisplay", "assets/disk0");
|
||||
|
||||
new LwjglApplication(new VMGUI(reference), appConfig);
|
||||
EmulInstance wp = new EmulInstance(appConfig, vm, "net.torvald.tsvm.peripheral.WpTerm", "assets/wpdisk");
|
||||
|
||||
new LwjglApplication(new VMGUI(wp), appConfig);
|
||||
}
|
||||
|
||||
public static ShaderProgram loadShaderFromFile(String vert, String frag) {
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
package net.torvald.tsvm.peripheral
|
||||
|
||||
import net.torvald.tsvm.CompressorDelegate
|
||||
import net.torvald.tsvm.CompressorDelegate.GZIP_HEADER
|
||||
import net.torvald.tsvm.VM
|
||||
import net.torvald.tsvm.startsWith
|
||||
import java.io.File
|
||||
|
||||
object OEMBios : VMProgramRom {
|
||||
|
||||
private val contents: ByteArray
|
||||
|
||||
init {
|
||||
val bytes = File("./assets/bios/TBMBIOS.js").readBytes()
|
||||
contents = bytes.sliceArray(0 until minOf(65536, bytes.size))
|
||||
}
|
||||
|
||||
override fun readAll(): String {
|
||||
// check if bios is compressed in gzip
|
||||
return if (contents.startsWith(GZIP_HEADER))
|
||||
CompressorDelegate.decomp(contents).toString(VM.CHARSET)
|
||||
else
|
||||
contents.toString(VM.CHARSET)
|
||||
}
|
||||
|
||||
override fun get(addr: Int): Byte = contents[addr]
|
||||
|
||||
}
|
||||
@@ -9,7 +9,7 @@ import net.torvald.tsvm.VM
|
||||
import net.torvald.tsvm.kB
|
||||
import kotlin.math.absoluteValue
|
||||
|
||||
class TexticsAdapter(vm: VM) : GraphicsAdapter(vm, AdapterConfig(
|
||||
open class TexticsAdapter(vm: VM, config: AdapterConfig = AdapterConfig(
|
||||
"crt_white",
|
||||
720,
|
||||
480,
|
||||
@@ -21,19 +21,7 @@ class TexticsAdapter(vm: VM) : GraphicsAdapter(vm, AdapterConfig(
|
||||
"./hp2640.png",
|
||||
0.32f,
|
||||
GraphicsAdapter.TEXT_TILING_SHADER_MONOCHROME
|
||||
)) {
|
||||
/*class TexticsAdapter(vm: VM) : GraphicsAdapter(vm, AdapterConfig(
|
||||
"crt_color",
|
||||
560,
|
||||
448,
|
||||
80,
|
||||
32,
|
||||
254,
|
||||
255,
|
||||
256.kB(),
|
||||
"./cp437_fira_code.png",
|
||||
0.64f
|
||||
)) {*/
|
||||
)) : GraphicsAdapter(vm, config) {
|
||||
|
||||
private val crtGradTex = Texture("./assets/crt_grad.png")
|
||||
|
||||
@@ -87,4 +75,18 @@ class TexticsAdapter(vm: VM) : GraphicsAdapter(vm, AdapterConfig(
|
||||
crtGradTex.dispose()
|
||||
super.dispose()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class WpTerm(vm: VM) : TexticsAdapter(vm = vm, AdapterConfig(
|
||||
"crt_amber",
|
||||
810,
|
||||
300,
|
||||
90,
|
||||
20,
|
||||
254,
|
||||
0,
|
||||
256.kB(),
|
||||
"./hp2640.png",
|
||||
0.32f,
|
||||
GraphicsAdapter.TEXT_TILING_SHADER_MONOCHROME
|
||||
))
|
||||
@@ -6,20 +6,15 @@ import net.torvald.tsvm.VM
|
||||
import net.torvald.tsvm.startsWith
|
||||
import java.io.File
|
||||
|
||||
interface VMProgramRom {
|
||||
fun readAll(): String
|
||||
operator fun get(addr: Int): Byte
|
||||
}
|
||||
|
||||
object GenericBios : VMProgramRom {
|
||||
open class VMProgramRom(path: String) {
|
||||
private val contents: ByteArray
|
||||
|
||||
init {
|
||||
val bytes = File("./assets/bios/bios1.bin").readBytes()
|
||||
val bytes = File(path).readBytes()
|
||||
contents = bytes.sliceArray(0 until minOf(65536, bytes.size))
|
||||
}
|
||||
|
||||
override fun readAll(): String {
|
||||
fun readAll(): String {
|
||||
// check if bios is compressed in gzip
|
||||
return if (contents.startsWith(GZIP_HEADER))
|
||||
CompressorDelegate.decomp(contents).toString(VM.CHARSET)
|
||||
@@ -27,100 +22,14 @@ object GenericBios : VMProgramRom {
|
||||
contents.toString(VM.CHARSET)
|
||||
}
|
||||
|
||||
override fun get(addr: Int): Byte = contents[addr]
|
||||
fun get(addr: Int): Byte = contents[addr]
|
||||
}
|
||||
|
||||
object QuickBios : VMProgramRom {
|
||||
private val contents: ByteArray
|
||||
|
||||
init {
|
||||
val bytes = File("./assets/bios/quick.js").readBytes()
|
||||
contents = bytes.sliceArray(0 until minOf(65536, bytes.size))
|
||||
}
|
||||
|
||||
override fun readAll(): String {
|
||||
// check if bios is compressed in gzip
|
||||
return if (contents.startsWith(GZIP_HEADER))
|
||||
CompressorDelegate.decomp(contents).toString(VM.CHARSET)
|
||||
else
|
||||
contents.toString(VM.CHARSET)
|
||||
}
|
||||
|
||||
override fun get(addr: Int): Byte = contents[addr]
|
||||
}
|
||||
|
||||
object BasicBios : VMProgramRom {
|
||||
private val contents: ByteArray
|
||||
|
||||
init {
|
||||
val bytes = File("./assets/bios/basicbios.js").readBytes()
|
||||
contents = bytes.sliceArray(0 until minOf(65536, bytes.size))
|
||||
}
|
||||
|
||||
override fun readAll(): String {
|
||||
// check if bios is compressed in gzip
|
||||
return if (contents.startsWith(GZIP_HEADER))
|
||||
CompressorDelegate.decomp(contents).toString(VM.CHARSET)
|
||||
else
|
||||
contents.toString(VM.CHARSET)
|
||||
}
|
||||
|
||||
override fun get(addr: Int): Byte = contents[addr]
|
||||
}
|
||||
|
||||
object TandemBios : VMProgramRom {
|
||||
private val contents: ByteArray
|
||||
|
||||
init {
|
||||
val bytes = File("./assets/bios/tandemport.js").readBytes()
|
||||
contents = bytes.sliceArray(0 until minOf(65536, bytes.size))
|
||||
}
|
||||
|
||||
override fun readAll(): String {
|
||||
// check if bios is compressed in gzip
|
||||
return if (contents.startsWith(GZIP_HEADER))
|
||||
CompressorDelegate.decomp(contents).toString(VM.CHARSET)
|
||||
else
|
||||
contents.toString(VM.CHARSET)
|
||||
}
|
||||
|
||||
override fun get(addr: Int): Byte = contents[addr]
|
||||
}
|
||||
|
||||
object BasicRom : VMProgramRom {
|
||||
private val contents: ByteArray
|
||||
|
||||
init {
|
||||
val bytes = File("./assets/bios/basic.bin").readBytes()
|
||||
contents = bytes.sliceArray(0 until minOf(65536, bytes.size))
|
||||
}
|
||||
|
||||
override fun readAll(): String {
|
||||
// check if bios is compressed in gzip
|
||||
return if (contents.startsWith(GZIP_HEADER))
|
||||
CompressorDelegate.decomp(contents).toString(VM.CHARSET)
|
||||
else
|
||||
contents.toString(VM.CHARSET)
|
||||
}
|
||||
|
||||
override fun get(addr: Int): Byte = contents[addr]
|
||||
}
|
||||
|
||||
object TBASRelBios : VMProgramRom {
|
||||
private val contents: ByteArray
|
||||
|
||||
init {
|
||||
val bytes = File("./assets/bios/tbasdist.js").readBytes()
|
||||
contents = bytes.sliceArray(0 until minOf(65536, bytes.size))
|
||||
}
|
||||
|
||||
override fun readAll(): String {
|
||||
// check if bios is compressed in gzip
|
||||
return if (contents.startsWith(GZIP_HEADER))
|
||||
CompressorDelegate.decomp(contents).toString(VM.CHARSET)
|
||||
else
|
||||
contents.toString(VM.CHARSET)
|
||||
}
|
||||
|
||||
override fun get(addr: Int): Byte = contents[addr]
|
||||
}
|
||||
object GenericBios : VMProgramRom("./assets/bios/bios1.bin")
|
||||
object OEMBios : VMProgramRom("./assets/bios/TBMBIOS.js")
|
||||
object QuickBios : VMProgramRom("./assets/bios/quick.js")
|
||||
object BasicBios : VMProgramRom("./assets/bios/basicbios.js")
|
||||
object TandemBios : VMProgramRom("./assets/bios/tandemport.js")
|
||||
object BasicRom : VMProgramRom("./assets/bios/basic.bin")
|
||||
object TBASRelBios : VMProgramRom("./assets/bios/tbasdist.js")
|
||||
object WPBios : VMProgramRom("./assets/bios/wp.js")
|
||||
Reference in New Issue
Block a user