diff --git a/assets/JS_INIT.js b/assets/JS_INIT.js index ff84f35..f8c3317 100644 --- a/assets/JS_INIT.js +++ b/assets/JS_INIT.js @@ -493,11 +493,14 @@ con.color_back = function(n) { // 0..7; -1 for transparent print("\x1B["+(((n|0) % 8)+40)+"m"); }; con.color_pair = function(fore, back) { // 0..255 - print("\x1B[38;5;"+fore+"m"); - print("\x1B[48;5;"+back+"m"); +// print("\x1B[38;5;"+fore+"m"); +// print("\x1B[48;5;"+back+"m"); + graphics.setTextFore(fore) + graphics.setTextBack(back) }; con.clear = function() { - print("\x1B[2J"); +// print("\x1B[2J"); + graphics.clearText() }; // @params arg 0 to hide, nonzero to show con.curs_set = function(arg) { diff --git a/tsvm_core/src/net/torvald/tsvm/GraphicsJSR223Delegate.kt b/tsvm_core/src/net/torvald/tsvm/GraphicsJSR223Delegate.kt index e72e1ee..125e9ad 100644 --- a/tsvm_core/src/net/torvald/tsvm/GraphicsJSR223Delegate.kt +++ b/tsvm_core/src/net/torvald/tsvm/GraphicsJSR223Delegate.kt @@ -35,6 +35,14 @@ class GraphicsJSR223Delegate(val vm: VM) { } } + fun setTextFore(b: Int) { + getFirstGPU()?.let { it.ttyFore = b } + } + + fun setTextBack(b: Int) { + getFirstGPU()?.let { it.ttyBack = b } + } + /*fun loadBulk(fromAddr: Int, toAddr: Int, length: Int) { getFirstGPU()?._loadbulk(fromAddr, toAddr, length) }