cc-stuff/videotape.lua

28 lines
711 B
Lua

local tape = peripheral.find("tape_drive")
local mon = peripheral.find("monitor")
tape.seek(-tape.getSize())
mon.setTextScale(1)
local w, h = string.byte(tape.read(2), 1, 2)
local b = ""
for _ = 1, w do b = b .. "0" end
local f = b
repeat
for y = 1, h do
mon.setCursorPos(1, y)
local buf = { string.byte(tape.read(w), 1, -1) }
local s = "" -- , f, b = "", "", ""
for x = 1, w do
s = s .. string.char(0x80 + bit32.band(0x7F, buf[x]))
-- local inv = bit32.band(0x80, buf[x])
-- f = f .. (inv and "f" or "0")
-- b = b .. (inv and "0" or "f")
end
mon.blit(s, f, b)
end
os.sleep(0.01)
until tape.isEnd()