forked from izaya/LuPPC
Bluescreens!
This commit is contained in:
parent
16b0c05104
commit
ace9e5d15a
@ -3,29 +3,38 @@ local boot = {}
|
||||
function boot.boot()
|
||||
local gpu = modules.component.api.proxy(modules.component.api.list("gpu", true)())
|
||||
local w, h = gpu.getResolution()
|
||||
|
||||
local function bsod(err)
|
||||
gpu.setBackground(0x0000FF)
|
||||
gpu.setForeground(0xFFFFFF)
|
||||
gpu.fill(0, 0, w, h, " ")
|
||||
gpu.set(2, 2, "CRITICAL ERROR OCCURED")
|
||||
gpu.set(2, 3, "Lua BIOS Has failed:")
|
||||
gpu.set(2, 5, tostring(err))
|
||||
io.flush()
|
||||
native.sleep(2000000)
|
||||
gpu.setForeground(0xFFFFFF)
|
||||
gpu.setBackground(0x000000)
|
||||
end
|
||||
|
||||
print("r= " .. tostring(w) .. " " .. tostring(h))
|
||||
gpu.fill(0, 0, w, h, " ")
|
||||
gpu.set(10, 5, "HHHHHHHHHHHHH")
|
||||
gpu.set(11, 11, "VVVVVVVVVVVVVVVVV", true)
|
||||
print("LuPI L2 INIT")
|
||||
print("FIXME: boot stub")
|
||||
native.sleep(1000000)
|
||||
|
||||
local code = modules.component.api.invoke(modules.component.api.list("eeprom", true)(), "get")
|
||||
if not code then
|
||||
print("No bootcode")
|
||||
error("No bootcode")
|
||||
end
|
||||
---PASS SANDBOX!!!!!!
|
||||
local f, reason = load(code, "=BIOS", nil, modules.sandbox)
|
||||
if not f then
|
||||
print(reason)
|
||||
else
|
||||
local e, reason = pcall(f)
|
||||
if not e then
|
||||
print("ERROR")
|
||||
print(reason)
|
||||
--TODO: Make fancy bsod here
|
||||
bsod(reason)
|
||||
end
|
||||
print("System quit, Panic")
|
||||
end
|
||||
|
@ -125,6 +125,10 @@ sandbox = {
|
||||
return os.time(table)
|
||||
end,
|
||||
tmpname = nil,
|
||||
sleep = function(time)
|
||||
checkArg(1, time, "number")
|
||||
native.sleep(time * 1000000)
|
||||
end
|
||||
},
|
||||
debug = { --TODO: Consider expanding
|
||||
getinfo = function(...)
|
||||
|
Loading…
Reference in New Issue
Block a user