system control on sbin

This commit is contained in:
minjaesong
2023-01-31 15:00:45 +09:00
parent 5be05e8eec
commit 7990bcb987
4 changed files with 60 additions and 3 deletions

View File

@@ -12,6 +12,8 @@ const fullFilePath = _G.shell.resolvePathInput(exec_args[1])
const FILE_LENGTH = files.open(fullFilePath.full).size
con.clear();con.curs_set(0)
graphics.clearPixels(255)
graphics.clearPixels2(240)
let seqread = require("seqread")

View File

@@ -2,7 +2,7 @@ const SND_BASE_ADDR = audio.getBaseAddr()
if (!SND_BASE_ADDR) return 10
const MP2_BITRATES = ["VBR", 32, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384]
const MP2_BITRATES = ["???", 32, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384]
const MP2_CHANNELMODES = ["Stereo", "Joint", "Dual", "Mono"]
const pcm = require("pcm")
const interactive = exec_args[2] && exec_args[2].toLowerCase() == "/i"

View File

@@ -0,0 +1,54 @@
// synopsis: sysctl {reset|...} target
const verbs = {
"reset": ["Reset", "Resetting"]
}
const actions = {
"reset": {
"mmu": ()=>{
for (let k = 0; k < sys.maxmem(); k += 64) {
try {
sys.free(k)
}
catch (e) {}
}
},
"graphics": ()=>{
graphics.resetPalette()
con.reset_graphics()
graphics.clearPixels(255)
graphics.clearPixels2(240)
graphics.setGraphicsMode(0)
graphics.setBackground(34,51,68)
sys.poke(-1299460, 20)
sys.poke(-1299460, 21)
}
"audio": ()=>{
for (let k = 0; k < 4; k++) {
audio.stop(k)
audio.purgeQueue(k)
audio.resetParams(k)
}
}
}
}
const verb = exec_args[1]
const target = exec_args[2]
if (verb && !target) {
println(`sysctl: no target specified for ${verbs[verb][1]}`)
return 1
}
if (!verb) {
println("Usage: sysctl {reset|...} target")
return 10
}
let actionfun = actions[verb][target]
if (actionfun) actionfun()
else {
printerrln(`sysctl: unknown target ${target}`)
return 1
}

View File

@@ -971,14 +971,15 @@ Address & RW & Description \\
-131086 & RW & Current Layer Arrangement Index \\
-131087..-131088 & RW & Framebuffer Horizontal Scroll \\
-131089..-131090 & RW & Framebuffer Vertical Scroll \\
-132097..-131120 & RW & Scanline Offsets \\
-132097..-133120 & RW & Scanline Offsets \\
-133121..-135168 & RW & Font ROM Mapping Area \\
-196609..-262144 & RW & Draw Instructions Area \\
-1048577..-1299456 & RW & First Framebuffer \\
-1299457 & RW & Screen Background RED \\
-1299458 & RW & Screen Background GREEN \\
-1299459 & RW & Screen Background BLUE \\
-1299460 & RW & Command \\
-1299461..-1299472 & RW & Command Arguments \\
-1300607..-1302526 & RW & Font ROM Mapping Area \\
-1302527..-1302528 & RW & Text Cursor Position in $row \times 80 + col$ \\
-1302529..-1305088 & RW & Text Foreground Colours \\
-1305089..-1307648 & RW & Text Background Colours \\