adding 9-bit font used on HP 264x terminals

This commit is contained in:
minjaesong
2020-11-22 17:24:00 +09:00
parent 7a6a660da1
commit fcf3dca3e4
7 changed files with 31 additions and 25 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 13 KiB

BIN
hp2640.kra LFS Normal file

Binary file not shown.

BIN
hp2640.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

View File

@@ -22,8 +22,8 @@ public class AppLoader {
appConfig.resizable = false; appConfig.resizable = false;
appConfig.title = appTitle; appConfig.title = appTitle;
appConfig.forceExit = true; appConfig.forceExit = true;
appConfig.width = 960;//560; appConfig.width = 720;//560;
appConfig.height = 400;//448; appConfig.height = 375;//448;
// val vm = VM(64.kB(), TheRealWorld(), arrayOf(GenericBios)) // val vm = VM(64.kB(), TheRealWorld(), arrayOf(GenericBios))

View File

@@ -33,9 +33,9 @@ class VMGUI(val vm: VM, val appConfig: LwjglApplicationConfiguration) : Applicat
override fun create() { override fun create() {
super.create() super.create()
//gpu = TexticsAdapter(vm, theme = GraphicsAdapter.THEME_COLORCRT)
//gpu = GraphicsAdapter(vm, GraphicsAdapter.DEFAULT_CONFIG_COLOR_CRT) //gpu = GraphicsAdapter(vm, GraphicsAdapter.DEFAULT_CONFIG_COLOR_CRT)
gpu = CharacterLCDdisplay(vm) gpu = TexticsAdapter(vm)
//gpu = CharacterLCDdisplay(vm)
vm.peripheralTable[1] = PeripheralEntry( vm.peripheralTable[1] = PeripheralEntry(
VM.PERITYPE_GPU_AND_TERM, VM.PERITYPE_GPU_AND_TERM,

View File

@@ -153,9 +153,11 @@ open class GraphicsAdapter(val vm: VM, val config: AdapterConfig) :
spriteAndTextArea[k + memTextOffset] = 0 spriteAndTextArea[k + memTextOffset] = 0
} }
unusedArea[0] = 2 if (theme.contains("color")) {
unusedArea[1] = 3 unusedArea[0] = 2
unusedArea[2] = 4 unusedArea[1] = 3
unusedArea[2] = 4
}
setCursorPos(0, 0) setCursorPos(0, 0)
@@ -882,8 +884,6 @@ uniform vec2 tilesInAtlas = ivec2(16.0, 16.0);
uniform vec2 atlasTexSize = ivec2(128.0, 224.0); uniform vec2 atlasTexSize = ivec2(128.0, 224.0);
vec2 tileSizeInPx = atlasTexSize / tilesInAtlas; // should be like ivec2(16, 16) vec2 tileSizeInPx = atlasTexSize / tilesInAtlas; // should be like ivec2(16, 16)
float fontGamma = 1.8;
ivec2 getTileXY(int tileNumber) { ivec2 getTileXY(int tileNumber) {
return ivec2(tileNumber % int(tilesInAtlas.x), tileNumber / int(tilesInAtlas.x)); return ivec2(tileNumber % int(tilesInAtlas.x), tileNumber / int(tilesInAtlas.x));
} }
@@ -899,15 +899,6 @@ int getTileFromColor(vec4 color) {
return _colToInt(color) & 0xFFFFF; 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() { void main() {
// READ THE FUCKING MANUAL, YOU DONKEY !! // // READ THE FUCKING MANUAL, YOU DONKEY !! //
@@ -945,7 +936,7 @@ void main() {
// apply colour. I'm expecting FONT ROM IMAGE to be greyscale // apply colour. I'm expecting FONT ROM IMAGE to be greyscale
// TODO non-linear mix with gamma 2.2 // TODO non-linear mix with gamma 2.2
gl_FragColor = fontMix(backColFromMap, foreColFromMap, tileCol.r); gl_FragColor = mix(backColFromMap, foreColFromMap, tileCol.r);
} }
""".trimIndent() """.trimIndent()

View File

@@ -5,18 +5,30 @@ import com.badlogic.gdx.graphics.Texture
import net.torvald.tsvm.VM import net.torvald.tsvm.VM
import net.torvald.tsvm.kB import net.torvald.tsvm.kB
class TexticsAdapter(vm: VM, theme: String) : GraphicsAdapter(vm, AdapterConfig( class TexticsAdapter(vm: VM) : GraphicsAdapter(vm, AdapterConfig(
"crt_green", "crt",
720,
375,
80,
25,
254,
255,
256.kB(),
"./hp2640.png",
0.32f
)) {
/*class TexticsAdapter(vm: VM) : GraphicsAdapter(vm, AdapterConfig(
"crt_color",
560, 560,
448, 448,
80, 80,
32, 32,
239, 254,
0, 255,
256.kB(), 256.kB(),
"./cp437_fira_code.png", "./cp437_fira_code.png",
0.7f 0.64f
)) { )) {*/
override fun peek(addr: Long): Byte? { override fun peek(addr: Long): Byte? {
return when (addr) { return when (addr) {