added netboot to SEBIOS.

This commit is contained in:
Izaya 2017-09-04 20:12:18 +10:00
parent 24e5d76527
commit caeeb10d25
1 changed files with 102 additions and 80 deletions

View File

@ -48,6 +48,23 @@ local function tryLoadFrom(address)
local buffer = boot_invoke(address,"read",rl)
return load(buffer, "=init")
end
elseif component.type(address) == "modem" then
boot_invoke(address,"open",9671)
boot_invoke(address,"broadcast",9671,computer.address())
s=""
local bt = computer.uptime()
while bt+10 > computer.uptime() do
computer.beep()
local ev={computer.pullSignal(0.5)}
if ev[1] == "modem_message" and ev[4] == 9671 then
bt=computer.uptime()
if ev[6] == "." then break end
s=s..ev[6]
end
end
if s ~= "" then
return load(s,"=init")
end
end
end
@ -58,6 +75,9 @@ end
for address in component.list("tape_drive") do
bootdevs[#bootdevs+1] = address
end
for address in component.list("modem") do
bootdevs[#bootdevs+1] = address
end
do
local gA,sA = component.list("gpu")(),component.list("screen")()
@ -79,7 +99,9 @@ do
wl(" ")
for k,v in ipairs(bootdevs) do
if v == cba then S = " * " else S = " " end
wl(S..tostring(k).." "..v.." "..component.type(v).." "..(component.invoke(v,"getLabel") or ""))
local e,l = pcall(component.invoke,v,"getLabel")
if not e then l = "" end
wl(S..tostring(k).." "..v.." "..component.type(v).." "..(l or ""))
end
end
rdraw()