Bluescreens!

This commit is contained in:
Łukasz Magiera 2016-01-06 22:25:01 +01:00
parent 16b0c05104
commit ace9e5d15a
2 changed files with 19 additions and 6 deletions

View File

@ -3,29 +3,38 @@ local boot = {}
function boot.boot() function boot.boot()
local gpu = modules.component.api.proxy(modules.component.api.list("gpu", true)()) local gpu = modules.component.api.proxy(modules.component.api.list("gpu", true)())
local w, h = gpu.getResolution() 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)) print("r= " .. tostring(w) .. " " .. tostring(h))
gpu.fill(0, 0, w, h, " ") gpu.fill(0, 0, w, h, " ")
gpu.set(10, 5, "HHHHHHHHHHHHH") gpu.set(10, 5, "HHHHHHHHHHHHH")
gpu.set(11, 11, "VVVVVVVVVVVVVVVVV", true) gpu.set(11, 11, "VVVVVVVVVVVVVVVVV", true)
print("LuPI L2 INIT") print("LuPI L2 INIT")
print("FIXME: boot stub")
native.sleep(1000000)
local code = modules.component.api.invoke(modules.component.api.list("eeprom", true)(), "get") local code = modules.component.api.invoke(modules.component.api.list("eeprom", true)(), "get")
if not code then if not code then
print("No bootcode") print("No bootcode")
error("No bootcode") error("No bootcode")
end end
---PASS SANDBOX!!!!!!
local f, reason = load(code, "=BIOS", nil, modules.sandbox) local f, reason = load(code, "=BIOS", nil, modules.sandbox)
if not f then if not f then
print(reason) print(reason)
else else
local e, reason = pcall(f) local e, reason = pcall(f)
if not e then if not e then
print("ERROR") bsod(reason)
print(reason)
--TODO: Make fancy bsod here
end end
print("System quit, Panic") print("System quit, Panic")
end end

View File

@ -125,6 +125,10 @@ sandbox = {
return os.time(table) return os.time(table)
end, end,
tmpname = nil, tmpname = nil,
sleep = function(time)
checkArg(1, time, "number")
native.sleep(time * 1000000)
end
}, },
debug = { --TODO: Consider expanding debug = { --TODO: Consider expanding
getinfo = function(...) getinfo = function(...)