Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local component = require("component")
- local computer = require("computer")
- local eeprom = component.eeprom
- local donutCode = [[
- local c = component
- local m = math
- local s = string
- local gpu = c.proxy(c.list("gpu")())
- local screen = c.list("screen")()
- if gpu and screen then
- gpu.bind(screen)
- else
- error("GPU or screen not available")
- end
- local w, h = gpu.getResolution()
- local sin, cos = m.sin, m.cos
- local buffer1 = gpu.allocateBuffer(w, h)
- local buffer2 = gpu.allocateBuffer(w, h)
- local currentBuffer = buffer1
- local backBuffer = buffer2
- local function swapBuffers()
- gpu.setActiveBuffer(backBuffer)
- local temp = currentBuffer
- currentBuffer = backBuffer
- backBuffer = temp
- end
- local function cls()
- gpu.fill(1, 1, w, h, " ")
- end
- local function donut()
- local A, B = 0, 0
- local z, b = {}, {}
- while true do
- for i = 1, 1760 do b[i] = " " z[i] = 0 end
- for j = 0, 6.28, 0.07 do
- for i = 0, 6.28, 0.02 do
- local sini, cosj = sin(i), cos(j)
- local sinA, sinj, cosA = sin(A), sin(j), cos(A)
- local cosj2 = cosj + 2
- local mess = 1 / (sini * cosj2 * sinA + sinj * cosA + 5)
- local cosi, cosB, sinB = cos(i), cos(B), sin(B)
- local t = sini * cosj2 * cosA - sinj * sinA
- local x = m.floor(40 + 30 * mess * (cosi * cosj2 * cosB - t * sinB))
- local y = m.floor(12 + 15 * mess * (cosi * cosj2 * sinB + t * cosB))
- local o = x + 80 * y
- local N = m.floor(8 * ((sinj * sinA - sini * cosj * cosA) * cosB - sini * cosj * sinA - sinj * cosA - cosi * cosj * sinB))
- if y > 0 and y < 22 and x > 0 and x < 80 and mess > z[o] then
- z[o] = mess
- b[o] = s.sub(".,-~:;=!*#$@", N > 0 and N or 1, N > 0 and N or 1)
- end
- end
- end
- gpu.setActiveBuffer(backBuffer)
- cls()
- for k = 1, 1760 do
- if k % 80 ~= 0 then gpu.set(k % 80, m.floor(k / 80), b[k]) end
- end
- swapBuffers()
- gpu.setActiveBuffer(0)
- gpu.bitblt(0, 1, 1, w, h, currentBuffer, 1, 1)
- A = A + 0.08
- B = B + 0.06
- computer.pullSignal(0.01)
- end
- end
- donut()
- ]]
- eeprom.set(donutCode)
- eeprom.setLabel("OCBIOS-Donut")
- computer.beep(1000, 0.2)
- print("OCBIOS-Donut injected into EEPROM. Rebooting...")
- computer.shutdown(true)
Add Comment
Please, Sign In to add comment