mirror of
https://github.com/curioustorvald/tsvm.git
synced 2026-03-07 19:51:51 +09:00
gpu: reading existence of other banks using mmio
This commit is contained in:
@@ -49,7 +49,7 @@ graphics.setFramebufferScroll(0,-((1.0-tdiff/tlen)*164)|0);}
|
||||
|
||||
// show how much ram is there
|
||||
con.color_pair(239,14);
|
||||
let vramstr="VIDEO RAM : 256 Kbytes";
|
||||
let vramstr=`VIDEO RAM : ${256 * sys.peek(-131084)} Kbytes`;
|
||||
let uramstr=` USER RAM : ${system.maxmem()>>>10} Kbytes`;
|
||||
con.move(20,(80-vramstr.length)/2);println(vramstr);
|
||||
con.move(21,(80-uramstr.length)/2);println(uramstr);
|
||||
|
||||
@@ -241,17 +241,18 @@ MMIO
|
||||
Text mode rows
|
||||
6 RW
|
||||
Text-mode attributes
|
||||
0b kkkk 00rc (k: currently using character rom, r: TTY Raw mode, c: Cursor blink)
|
||||
0b 0000 00rc (r: TTY Raw mode, c: Cursor blink)
|
||||
7 RW
|
||||
Graphics-mode attributes
|
||||
0b 0000 000g (g: Use sprites(wipes out text buffer))
|
||||
0b 0000 rrrr (r: Resolution/colour depth)
|
||||
8 RO
|
||||
Last used colour (set by poking at the framebuffer)
|
||||
9 RW
|
||||
current TTY foreground colour (useful for print() function)
|
||||
10 RW
|
||||
current TTY background colour (useful for print() function)
|
||||
|
||||
11 RO
|
||||
Number of Banks, or VRAM size (1 = 256 kB, max 4)
|
||||
|
||||
Text-mode-font-ROM is immutable and does not belong to VRAM
|
||||
Even in the text mode framebuffer is still being drawn onto the screen, and the texts are drawn on top of it
|
||||
|
||||
@@ -15,6 +15,10 @@ class GraphicsJSR223Delegate(val vm: VM) {
|
||||
return vm.findPeribyType(VM.PERITYPE_GPU_AND_TERM)?.peripheral as? GraphicsAdapter
|
||||
}
|
||||
|
||||
fun getVramSize() {
|
||||
getFirstGPU()?.mmio_read(11)
|
||||
}
|
||||
|
||||
fun resetPalette() {
|
||||
getFirstGPU()?.poke(250883L, 1)
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ data class AdapterConfig(
|
||||
)
|
||||
|
||||
data class SuperGraphicsAddonConfig(
|
||||
val hasSecondBank: Boolean = false
|
||||
val bankCount: Int = 1
|
||||
)
|
||||
|
||||
class ReferenceGraphicsAdapter(assetsRoot: String, vm: VM) : GraphicsAdapter(assetsRoot, vm, GraphicsAdapter.DEFAULT_CONFIG_COLOR_CRT)
|
||||
@@ -268,7 +268,7 @@ open class GraphicsAdapter(private val assetsRoot: String, val vm: VM, val confi
|
||||
8L -> lastUsedColour
|
||||
9L -> ttyFore.toByte()
|
||||
10L -> ttyBack.toByte()
|
||||
11L -> 1
|
||||
11L -> sgr.bankCount.toByte()
|
||||
|
||||
in 0 until VM.MMIO_SIZE -> -1
|
||||
else -> null
|
||||
|
||||
Reference in New Issue
Block a user