methods to reset font rom to default

This commit is contained in:
minjaesong
2021-10-19 09:33:45 +09:00
parent 4b293c537f
commit 0898e8478e
3 changed files with 37 additions and 9 deletions

View File

@@ -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 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 x = 0; x < 16; x++) {

View File

@@ -69,7 +69,8 @@ open class GraphicsAdapter(val vm: VM, val config: AdapterConfig, val sgr: Super
val channel = it % 4
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 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.fill()
}
4, 5 -> readFontRom(opcode - 4)
6, 7 -> writeFontRom(opcode - 6)
16, 17 -> readFontRom(opcode - 16)
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() {
ttyFore = TTY_FORE_DEFAULT

View File

@@ -157,10 +157,13 @@ From the start of the memory space:
1: reset palette to default
2: fill framebuffer with given colour (arg1)
3: do '1' then do '2'
4: copy Low Font ROM (char 0127) to mapping area
5: copy High Font ROM (char 128255) to mapping area
6: write contents of the font ROM mapping area to the Low Font ROM
7: write contents of the font ROM mapping area to the High Font ROM
16: copy Low Font ROM (char 0127) to mapping area
17: copy High Font ROM (char 128255) to mapping area
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
argument for "command" (arg1: Byte, arg2: Byte)
write to this address FIRST and then write to "command" to execute the command