mirror of
https://github.com/curioustorvald/tsvm.git
synced 2026-06-08 22:34:03 +09:00
methods to reset font rom to default
This commit is contained in:
@@ -1,4 +1,10 @@
|
|||||||
sys.poke(-1299460, 4)
|
if ("reset" == (exec_args[1] || "").toLowerCase()) {
|
||||||
|
sys.poke(-1299460, 20)
|
||||||
|
sys.poke(-1299460, 21)
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
sys.poke(-1299460, 16)
|
||||||
|
|
||||||
let off = -1300607 - (14*0x4F)
|
let off = -1300607 - (14*0x4F)
|
||||||
let char = [0,42,85,62,65,85,65,81,93,65,62,0,0,0]
|
let char = [0,42,85,62,65,85,65,81,93,65,62,0,0,0]
|
||||||
@@ -22,7 +28,7 @@ for (let k = 0; k < 14*128; k += 14) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
sys.poke(-1299460, 6)
|
sys.poke(-1299460, 18)
|
||||||
|
|
||||||
for (let y=0; y < 16; y++) {
|
for (let y=0; y < 16; y++) {
|
||||||
for (let x = 0; x < 16; x++) {
|
for (let x = 0; x < 16; x++) {
|
||||||
|
|||||||
@@ -69,7 +69,8 @@ open class GraphicsAdapter(val vm: VM, val config: AdapterConfig, val sgr: Super
|
|||||||
val channel = it % 4
|
val channel = it % 4
|
||||||
rgba.shr((3 - channel) * 8).and(255) / 255f
|
rgba.shr((3 - channel) * 8).and(255) / 255f
|
||||||
}
|
}
|
||||||
protected var chrrom = Pixmap(Gdx2DPixmap(Gdx.files.internal("./assets/"+config.chrRomPath).read(), Gdx2DPixmap.GDX2D_FORMAT_ALPHA))
|
protected fun getOriginalChrrom() = Pixmap(Gdx2DPixmap(Gdx.files.internal("./assets/"+config.chrRomPath).read(), Gdx2DPixmap.GDX2D_FORMAT_ALPHA))
|
||||||
|
protected var chrrom: Pixmap = getOriginalChrrom()
|
||||||
protected var chrrom0 = Texture(1,1,Pixmap.Format.RGBA8888)
|
protected var chrrom0 = Texture(1,1,Pixmap.Format.RGBA8888)
|
||||||
protected val faketex: Texture
|
protected val faketex: Texture
|
||||||
|
|
||||||
@@ -298,8 +299,9 @@ open class GraphicsAdapter(val vm: VM, val config: AdapterConfig, val sgr: Super
|
|||||||
framebuffer.setColor(0f,0f,0f,arg1 / 255f)
|
framebuffer.setColor(0f,0f,0f,arg1 / 255f)
|
||||||
framebuffer.fill()
|
framebuffer.fill()
|
||||||
}
|
}
|
||||||
4, 5 -> readFontRom(opcode - 4)
|
16, 17 -> readFontRom(opcode - 16)
|
||||||
6, 7 -> writeFontRom(opcode - 6)
|
18, 19 -> writeFontRom(opcode - 18)
|
||||||
|
20, 21 -> resetFontRom(opcode - 20)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -368,6 +370,23 @@ open class GraphicsAdapter(val vm: VM, val config: AdapterConfig, val sgr: Super
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param mode 0-Low, 1-High
|
||||||
|
*/
|
||||||
|
open fun resetFontRom(mode: Int) {
|
||||||
|
val pixmap = getOriginalChrrom()
|
||||||
|
val data = ByteArray(chrrom0.width * chrrom0.height / 2)
|
||||||
|
val dataOffset = mode * chrrom0.width * chrrom0.height / 2
|
||||||
|
pixmap.pixels.position(dataOffset)
|
||||||
|
pixmap.pixels.get(data)
|
||||||
|
|
||||||
|
chrrom.pixels.position(dataOffset)
|
||||||
|
chrrom.pixels.put(data)
|
||||||
|
chrrom.pixels.position(0)
|
||||||
|
|
||||||
|
pixmap.dispose()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
override fun resetTtyStatus() {
|
override fun resetTtyStatus() {
|
||||||
ttyFore = TTY_FORE_DEFAULT
|
ttyFore = TTY_FORE_DEFAULT
|
||||||
|
|||||||
@@ -157,10 +157,13 @@ From the start of the memory space:
|
|||||||
1: reset palette to default
|
1: reset palette to default
|
||||||
2: fill framebuffer with given colour (arg1)
|
2: fill framebuffer with given colour (arg1)
|
||||||
3: do '1' then do '2'
|
3: do '1' then do '2'
|
||||||
4: copy Low Font ROM (char 0–127) to mapping area
|
|
||||||
5: copy High Font ROM (char 128–255) to mapping area
|
16: copy Low Font ROM (char 0–127) to mapping area
|
||||||
6: write contents of the font ROM mapping area to the Low Font ROM
|
17: copy High Font ROM (char 128–255) to mapping area
|
||||||
7: write contents of the font ROM mapping area to the High Font ROM
|
18: write contents of the font ROM mapping area to the Low Font ROM
|
||||||
|
19: write contents of the font ROM mapping area to the High Font ROM
|
||||||
|
20: reset Low Font ROM to default
|
||||||
|
21: reset High Font ROM to default
|
||||||
12 bytes
|
12 bytes
|
||||||
argument for "command" (arg1: Byte, arg2: Byte)
|
argument for "command" (arg1: Byte, arg2: Byte)
|
||||||
write to this address FIRST and then write to "command" to execute the command
|
write to this address FIRST and then write to "command" to execute the command
|
||||||
|
|||||||
Reference in New Issue
Block a user