local target = "edit.lua" local function getFiles() local files = {"shell"} for _, f in ipairs(fs.list("/")) do if not fs.isDir(f) and f ~= "startup.lua" and f ~= "shell" then table.insert(files, f) end end return files end local function setBar(y, text, w) term.setCursorPos(1, y) term.setBackgroundColor(colors.blue) term.setTextColor(colors.white) term.clearLine() term.setCursorPos(math.floor((w - #text) / 2) + 1, y) term.write(text) end local function save(new) local lines = {} local f = fs.open("startup.lua", "r") for line in function() return f.readLine() end do table.insert(lines, line:find("^local target") and 'local target = "'..new..'"' or line) end f.close() local f = fs.open("startup.lua", "w") for _, l in ipairs(lines) do f.write(l .. "\n") end f.close() os.reboot() end local w, h = term.getSize() local isCol = term.isColor() term.clear() term.setTextColor(colors.yellow) local lx = w - 14 term.setCursorPos(lx+2, 1) term.write(".______.") term.setCursorPos(lx, 2) term.write(" / \\") term.setCursorPos(lx, 3) term.write("|energy * |") term.setTextColor(colors.green) term.setCursorPos(lx, 4) term.write("____________") term.setTextColor(colors.lime) term.setCursorPos(lx, 5) term.write("EPA POL PREV") term.setTextColor(colors.white) term.setCursorPos(1, 1) term.write(os.version() .. " (C) 2026") term.setCursorPos(1, 2) term.write("ID: " .. os.getComputerID()) term.setCursorPos(1, 5) term.write("Proccessor: CraftCPU " .. (isCol and "64-Bit" or "32-Bit")) term.setCursorPos(1, 6) term.write("Arch: Lua 5.1 VM") term.setCursorPos(1, h) term.write("Press Q for BIOS") local inMenu = false local step = isCol and 64 or 32 for i = 0, (isCol and 1024 or 512), step do term.setCursorPos(1, 8) term.write("Memory Test: " .. i .. "K OK") local t = os.startTimer(0.01) while true do local e, k = os.pullEvent() if e == "key" and k == keys.q then inMenu = true break elseif e == "timer" and k == t then break end end if inMenu then break end end if inMenu then local files, sel = getFiles(), 1 while true do term.setBackgroundColor(colors.lightGray) term.clear() setBar(1, "CMOS SETUP UTILITY", w) setBar(h-1, "L-Click: Boot | R-Click/S: Default", w) setBar(h, "Arrows: Select | Enter: Boot", w) local regions = {} for i, f in ipairs(files) do local txt = " " .. f .. (f == target and " (default) " or " ") term.setCursorPos(3, 2+i) if i == sel then term.setBackgroundColor(colors.red) term.setTextColor(colors.white) else term.setBackgroundColor(colors.lightGray) term.setTextColor(colors.blue) end term.write(txt) regions[i] = {y=2+i, x1=3, x2=3+#txt} end local e, p1, p2, p3 = os.pullEvent() if e == "key" then if p1 == keys.up then sel = (sel > 1) and sel - 1 or #files elseif p1 == keys.down then sel = (sel < #files) and sel + 1 or 1 elseif p1 == keys.enter then target = files[sel] break elseif p1 == keys.s then save(files[sel]) end elseif e == "mouse_click" or e == "monitor_touch" then for i, r in ipairs(regions) do if p3 == r.y and p2 >= r.x1 and p2 <= r.x2 then if p1 == 2 then save(files[i]) elseif i == sel then target = files[i] goto boot else sel = i end end end end end end ::boot:: term.setBackgroundColor(colors.black) term.setTextColor(colors.white) term.clear() term.setCursorPos(1, 1) shell.run(target)