diff --git a/assets/emittest.js b/assets/emittest.js new file mode 100644 index 0000000..89a6732 --- /dev/null +++ b/assets/emittest.js @@ -0,0 +1,11 @@ +con.clear(); +con.move(1,1); +for (let i = 0; i < 2048; i++) { + if (i < 1024) con.color_pair(239, 0); else con.color_pair(0, 239); + + let cx = (i%80)+1; + let cy = ((i/80)|0)+1; + //serial.printerr(cx+","+cy); + con.move(cy,cx); + con.addch(i%256); +} \ No newline at end of file diff --git a/assets/tbas/basic.js b/assets/tbas/basic.js index 05e8d94..5f50c8d 100644 --- a/assets/tbas/basic.js +++ b/assets/tbas/basic.js @@ -549,7 +549,7 @@ bStatus.builtin = { let varname = asgnObj.asgnVarName // check for variable name collision (e.g. 10 K=1TO10 \n 20 FOR I=K should work but 20 FOR K=K must not) - if (bStatus.vars[varname] !== undefined)) throw lang.dupDef(lnum, varname); + if (bStatus.vars[varname] !== undefined) throw lang.dupDef(lnum, varname); // assign new variable bStatus.vars[varname] = asgnObj.asgnValue diff --git a/cp437_fira_code.kra b/cp437_fira_code.kra new file mode 100644 index 0000000..eb45025 --- /dev/null +++ b/cp437_fira_code.kra @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f5b072f194909e4952f5ae26242956a8780767777df5a15df3c5cd07f06de5df +size 92849 diff --git a/cp437_fira_code.png b/cp437_fira_code.png new file mode 100644 index 0000000..bcec388 Binary files /dev/null and b/cp437_fira_code.png differ diff --git a/src/net/torvald/tsvm/AppLoader.java b/src/net/torvald/tsvm/AppLoader.java index 8eeae89..aa9d2ab 100644 --- a/src/net/torvald/tsvm/AppLoader.java +++ b/src/net/torvald/tsvm/AppLoader.java @@ -30,8 +30,8 @@ public class AppLoader { // val vm = VM(64.kB(), TheRealWorld(), arrayOf(GenericBios)) - //VM vm = new VM(64 << 10, new TheRealWorld(), new VMProgramRom[]{GenericBios.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[]{GenericBios.INSTANCE}); + //VM vm = new VM(64 << 10, new TheRealWorld(), new VMProgramRom[]{BasicBios.INSTANCE, BasicRom.INSTANCE}); new LwjglApplication(new VMGUI(vm, appConfig), appConfig); } diff --git a/src/net/torvald/tsvm/peripheral/GraphicsAdapter.kt b/src/net/torvald/tsvm/peripheral/GraphicsAdapter.kt index b997482..c5ee8ac 100644 --- a/src/net/torvald/tsvm/peripheral/GraphicsAdapter.kt +++ b/src/net/torvald/tsvm/peripheral/GraphicsAdapter.kt @@ -323,7 +323,7 @@ open class GraphicsAdapter(val vm: VM, val config: AdapterConfig) : for (i in 0 until TEXT_COLS * TEXT_ROWS step 4) { spriteAndTextArea.setInt(memTextForeOffset + i, foreBits) spriteAndTextArea.setInt(memTextBackOffset + i, backBits) - spriteAndTextArea.setInt(memTextOffset + i, -1) + spriteAndTextArea.setInt(memTextOffset + i, 0) } spriteAndTextArea.setShort(memTextCursorPosOffset, 0) } @@ -763,7 +763,7 @@ open class GraphicsAdapter(val vm: VM, val config: AdapterConfig) : val DEFAULT_CONFIG_COLOR_CRT = AdapterConfig( "crt_color", - 560, 448, 80, 32, 254, 255, 256.kB(), "./FontROM7x14.png", 0.32f + 560, 448, 80, 32, 254, 255, 256.kB(), "./cp437_fira_code.png", 0.32f ) val DEFAULT_CONFIG_PMLCD = AdapterConfig( "pmlcd_inverted", @@ -882,6 +882,8 @@ uniform vec2 tilesInAtlas = ivec2(16.0, 16.0); uniform vec2 atlasTexSize = ivec2(128.0, 224.0); vec2 tileSizeInPx = atlasTexSize / tilesInAtlas; // should be like ivec2(16, 16) +float fontGamma = 1.8; + ivec2 getTileXY(int tileNumber) { return ivec2(tileNumber % int(tilesInAtlas.x), tileNumber / int(tilesInAtlas.x)); } @@ -897,6 +899,15 @@ int getTileFromColor(vec4 color) { return _colToInt(color) & 0xFFFFF; } +vec4 fontMix(vec4 zero, vec4 one, float scale) { + return vec4(zero.r * (1 - pow(scale, fontGamma)) + one.r * pow(scale, fontGamma), + zero.g * (1 - pow(scale, fontGamma)) + one.g * pow(scale, fontGamma), + zero.b * (1 - pow(scale, fontGamma)) + one.b * pow(scale, fontGamma), + zero.a * (1 - pow(scale, fontGamma)) + one.a * pow(scale, fontGamma) + ); +} + + void main() { // READ THE FUCKING MANUAL, YOU DONKEY !! // @@ -933,7 +944,8 @@ void main() { vec4 tileCol = texture2D(tilesAtlas, finalUVCoordForTile); // apply colour. I'm expecting FONT ROM IMAGE to be greyscale - gl_FragColor = mix(backColFromMap, foreColFromMap, tileCol.r); + // TODO non-linear mix with gamma 2.2 + gl_FragColor = fontMix(backColFromMap, foreColFromMap, tileCol.r); } """.trimIndent() diff --git a/src/net/torvald/tsvm/peripheral/TexticsAdapter.kt b/src/net/torvald/tsvm/peripheral/TexticsAdapter.kt index e7a0cc6..ef123f4 100644 --- a/src/net/torvald/tsvm/peripheral/TexticsAdapter.kt +++ b/src/net/torvald/tsvm/peripheral/TexticsAdapter.kt @@ -7,14 +7,14 @@ import net.torvald.tsvm.kB class TexticsAdapter(vm: VM, theme: String) : GraphicsAdapter(vm, AdapterConfig( "crt_green", - 720, - 400, + 560, + 448, 80, - 25, + 32, 239, 0, 256.kB(), - "./tty.png", + "./cp437_fira_code.png", 0.7f )) {