mirror of
https://github.com/curioustorvald/tsvm.git
synced 2026-06-12 15:44:05 +09:00
comment
This commit is contained in:
@@ -45,6 +45,7 @@ class VMGUI(val vm: VM, val appConfig: LwjglApplicationConfiguration) : Applicat
|
|||||||
|
|
||||||
|
|
||||||
//gpu = GraphicsAdapter(vm, GraphicsAdapter.DEFAULT_CONFIG_COLOR_CRT)
|
//gpu = GraphicsAdapter(vm, GraphicsAdapter.DEFAULT_CONFIG_COLOR_CRT)
|
||||||
|
//gpu = GraphicsAdapter(vm, GraphicsAdapter.DEFAULT_CONFIG_PMLCD)
|
||||||
//gpu = TexticsAdapter(vm)
|
//gpu = TexticsAdapter(vm)
|
||||||
gpu = CharacterLCDdisplay(vm)
|
gpu = CharacterLCDdisplay(vm)
|
||||||
|
|
||||||
|
|||||||
@@ -8,14 +8,14 @@ import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack
|
|||||||
import net.torvald.tsvm.VM
|
import net.torvald.tsvm.VM
|
||||||
|
|
||||||
class CharacterLCDdisplay(vm: VM) : GraphicsAdapter(vm, AdapterConfig(
|
class CharacterLCDdisplay(vm: VM) : GraphicsAdapter(vm, AdapterConfig(
|
||||||
"pmlcd_inverted", 240, 64, 40, 8, 249, 255, 262144L, "lcd2.png", 0.7f, TEXT_TILING_SHADER_LCD, DRAW_SHADER_FRAG_LCD, 2f
|
"pmlcd_inverted", 240, 64, 40, 8, 254, 255, 262144L, "lcd2.png", 0.7f, TEXT_TILING_SHADER_LCD, DRAW_SHADER_FRAG_LCD, 2f
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
|
|
||||||
private val machine = Texture("./assets/4008_portable_full.png")
|
private val machine = Texture("./assets/4008_portable_full.png")
|
||||||
private val lcdFont = TextureRegionPack(Texture("./assets/lcd.png"), 12, 16)
|
private val lcdFont = TextureRegionPack(Texture("./assets/lcd.png"), 12, 16)
|
||||||
|
|
||||||
override fun peek(addr: Long): Byte? {
|
/*override fun peek(addr: Long): Byte? {
|
||||||
return when (addr) {
|
return when (addr) {
|
||||||
in 0 until 250880 -> (-1).toByte()
|
in 0 until 250880 -> (-1).toByte()
|
||||||
else -> super.peek(addr)
|
else -> super.peek(addr)
|
||||||
@@ -27,7 +27,7 @@ class CharacterLCDdisplay(vm: VM) : GraphicsAdapter(vm, AdapterConfig(
|
|||||||
in 0 until 250880 -> { /*do nothing*/ }
|
in 0 until 250880 -> { /*do nothing*/ }
|
||||||
else -> super.poke(addr, byte)
|
else -> super.poke(addr, byte)
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
|
||||||
override fun render(delta: Float, batch: SpriteBatch, xoff: Float, yoff: Float) {
|
override fun render(delta: Float, batch: SpriteBatch, xoff: Float, yoff: Float) {
|
||||||
batch.shader = null
|
batch.shader = null
|
||||||
|
|||||||
@@ -66,26 +66,8 @@ open class GraphicsAdapter(val vm: VM, val config: AdapterConfig, val sgr: Super
|
|||||||
internal val spriteAndTextArea = UnsafeHelper.allocate(10660L)
|
internal val spriteAndTextArea = UnsafeHelper.allocate(10660L)
|
||||||
protected val unusedArea = ByteArray(92)
|
protected val unusedArea = ByteArray(92)
|
||||||
|
|
||||||
protected val paletteShader = AppLoader.loadShaderInline(DRAW_SHADER_VERT,
|
protected val paletteShader = AppLoader.loadShaderInline(DRAW_SHADER_VERT, config.paletteShader)
|
||||||
config.paletteShader
|
protected val textShader = AppLoader.loadShaderInline(DRAW_SHADER_VERT, config.fragShader)
|
||||||
/*if (theme.startsWith("pmlcd") && !theme.endsWith("_inverted"))
|
|
||||||
DRAW_SHADER_FRAG_LCD_NOINV
|
|
||||||
else if (theme.startsWith("pmlcd"))
|
|
||||||
DRAW_SHADER_FRAG_LCD
|
|
||||||
else
|
|
||||||
DRAW_SHADER_FRAG*/
|
|
||||||
)
|
|
||||||
protected val textShader = AppLoader.loadShaderInline(DRAW_SHADER_VERT,
|
|
||||||
config.fragShader
|
|
||||||
/*if (theme.startsWith("crt_") && !theme.endsWith("color"))
|
|
||||||
TEXT_TILING_SHADER_MONOCHROME
|
|
||||||
else if (theme.startsWith("pmlcd") && !theme.endsWith("_inverted"))
|
|
||||||
TEXT_TILING_SHADER_LCD_NOINV
|
|
||||||
else if (theme.startsWith("pmlcd"))
|
|
||||||
TEXT_TILING_SHADER_LCD
|
|
||||||
else
|
|
||||||
TEXT_TILING_SHADER_COLOUR*/
|
|
||||||
)
|
|
||||||
|
|
||||||
override var blinkCursor = true
|
override var blinkCursor = true
|
||||||
override var ttyRawMode = false
|
override var ttyRawMode = false
|
||||||
@@ -833,10 +815,6 @@ varying vec2 v_texCoords;
|
|||||||
uniform sampler2D u_texture;
|
uniform sampler2D u_texture;
|
||||||
uniform vec4 pal[256];
|
uniform vec4 pal[256];
|
||||||
|
|
||||||
float rand(vec2 co){
|
|
||||||
return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);
|
|
||||||
}
|
|
||||||
|
|
||||||
void main(void) {
|
void main(void) {
|
||||||
gl_FragColor = pal[int(texture2D(u_texture, v_texCoords).a * 255.0)];
|
gl_FragColor = pal[int(texture2D(u_texture, v_texCoords).a * 255.0)];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -84,6 +84,19 @@ MMIO
|
|||||||
|
|
||||||
88 RW: Rom mapping
|
88 RW: Rom mapping
|
||||||
|
|
||||||
|
89 RO: BMS flags
|
||||||
|
0b b000 00ca
|
||||||
|
a: 1 if charging (accepting power from the AC adapter)
|
||||||
|
c: 1 if battery is detected
|
||||||
|
b: 1 if the device is battery-operated
|
||||||
|
|
||||||
|
if the device is battery-operated but currently running off of an AC adapter and there is no battery inserted,
|
||||||
|
the flag would be 1000 0001
|
||||||
|
|
||||||
|
90 RO: BMS calculated battery percentage where 255 is 100%
|
||||||
|
91 RO: BMS battery voltage multiplied by 10 (127 = "12.7 V")
|
||||||
|
|
||||||
|
|
||||||
4076..4079 RW: 8-bit status code for the port
|
4076..4079 RW: 8-bit status code for the port
|
||||||
4080..4083 RO: 8-bit status code for connected device
|
4080..4083 RO: 8-bit status code for connected device
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user