mirror of
https://github.com/curioustorvald/tsvm.git
synced 2026-03-08 20:21:50 +09:00
pread/pwrite/ipf encoder/ipf decoder
This commit is contained in:
@@ -6,7 +6,7 @@ import java.io.ByteArrayOutputStream
|
||||
import java.util.zip.GZIPInputStream
|
||||
import java.util.zip.GZIPOutputStream
|
||||
|
||||
class CompressorDelegate(val vm: VM) {
|
||||
class CompressorDelegate(private val vm: VM) {
|
||||
|
||||
fun comp(str: String) = Companion.comp(str)
|
||||
fun comp(ba: ByteArray) = Companion.comp(ba)
|
||||
|
||||
@@ -6,7 +6,7 @@ import net.torvald.tsvm.peripheral.GraphicsAdapter
|
||||
/**
|
||||
* Created by minjaesong on 2021-10-15.
|
||||
*/
|
||||
class DMADelegate(val vm: VM) {
|
||||
class DMADelegate(private val vm: VM) {
|
||||
|
||||
private val READ = "READ".toByteArray(VM.CHARSET)
|
||||
private val FLUSH = "FLUSH".toByteArray(VM.CHARSET)
|
||||
|
||||
@@ -8,7 +8,7 @@ import net.torvald.tsvm.peripheral.GraphicsAdapter
|
||||
import net.torvald.tsvm.peripheral.fmod
|
||||
import kotlin.math.roundToInt
|
||||
|
||||
class GraphicsJSR223Delegate(val vm: VM) {
|
||||
class GraphicsJSR223Delegate(private val vm: VM) {
|
||||
|
||||
private fun getFirstGPU(): GraphicsAdapter? {
|
||||
return vm.findPeribyType(VM.PERITYPE_GPU_AND_TERM)?.peripheral as? GraphicsAdapter
|
||||
|
||||
@@ -137,7 +137,7 @@ object SerialHelper {
|
||||
data class DeviceStatus(val code: Int, val message: String)
|
||||
}
|
||||
|
||||
class SerialHelperDelegate(val vm: VM) {
|
||||
class SerialHelperDelegate(private val vm: VM) {
|
||||
fun sendMessage(portNo: Int, message: String) = SerialHelper.sendMessage(vm, portNo, message.toByteArray(VM.CHARSET))
|
||||
fun pullMessage(portNo: Int) = SerialHelper.pullMessage(vm, portNo).toString(VM.CHARSET)
|
||||
fun sendMessageGetBytes(portNo: Int, message: String) = SerialHelper.sendMessageGetBytes(vm, portNo, message.toByteArray(VM.CHARSET)).toString(VM.CHARSET)
|
||||
|
||||
@@ -11,7 +11,7 @@ import java.nio.charset.Charset
|
||||
/**
|
||||
* Pass the instance of the class to the ScriptEngine's binding, preferably under the namespace of "vm"
|
||||
*/
|
||||
class VMJSR223Delegate(val vm: VM) {
|
||||
class VMJSR223Delegate(private val vm: VM) {
|
||||
|
||||
fun poke(addr: Int, value: Int) = vm.poke(addr.toLong(), value.toByte())
|
||||
fun peek(addr: Int) = vm.peek(addr.toLong())!!.toInt().and(255)
|
||||
@@ -186,13 +186,13 @@ class VMJSR223Delegate(val vm: VM) {
|
||||
}
|
||||
}
|
||||
|
||||
class VMSerialDebugger(val vm: VM) {
|
||||
class VMSerialDebugger(private val vm: VM) {
|
||||
fun print(s: Any?) = System.out.print("$s")
|
||||
fun println(s: Any?) = System.out.println("$s")
|
||||
fun printerr(s: Any?) = System.err.println("$s")
|
||||
}
|
||||
|
||||
class Parallel(val vm: VM) {
|
||||
class Parallel(private val vm: VM) {
|
||||
fun spawnNewContext(): VMRunner {
|
||||
return VMRunnerFactory(vm.assetsDir, vm, "js")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user