wordprocessor wip

This commit is contained in:
minjaesong
2021-06-08 11:39:26 +09:00
parent d1313f1f6c
commit e1905f2ca5
6 changed files with 419 additions and 400 deletions

58
assets/bios/wp.js Normal file
View File

@@ -0,0 +1,58 @@
const COL_TEXT = 253
const COL_BACK = 255
const COL_SUPERTEXT = 239
const COL_DIMTEXT = 249
const COL_LNUMBACK = 18
const COL_LNUMFORE = 253
const COL_CARET_ROW = 81
const PAINT_START_X = 5
const PAINT_START_Y = 2
const BIG_STRIDE = 999
const TAB_SIZE = 4
const caretLeft = 10
const caretRight = 80
let scroll = 0
let scrollHor = 0
let textbuffer = [""]
let cursorRow = 0
let cursorCol = 0
let exit = false
let scene = -1 // -1: main, 0: filemenu, 1: editmenu , ...
let bulletinShown = false
let cursoringCol = 0
let windowWidth = 0
let windowHeight = 0
let paintWidth = 0
let paintHeight = 0
let scrollPeek = 0
function drawInit() {
windowWidth = con.getmaxyx()[1]
windowHeight = con.getmaxyx()[0]
paintWidth = windowWidth - PAINT_START_X + 1
paintHeight = windowHeight - PAINT_START_Y + 1
scrollPeek = Math.ceil((paintHeight / 7))
}
const scrollHorPeek = 1; // to accommodate the scroll indicator
function drawMain() {
con.curs_set(0)
drawInit()
con.clear()
con.color_pair(COL_TEXT, COL_BACK)
// column indicator
con.move(2,1)
for (let k = 0; k < 9; k++) print(`${k}....:....`)
con.color_pair(COL_BACK, COL_TEXT)
con.mvaddch(2,1+caretLeft,91)
con.mvaddch(2,1+caretRight,93)
con.color_pair(COL_BACK, COL_TEXT)
}
drawMain()

File diff suppressed because it is too large Load Diff

View File

@@ -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) {

View File

@@ -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]
}

View File

@@ -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
))

View File

@@ -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")