cc-stuff/videotape.lua

24 lines
609 B
Lua
Raw Normal View History

2023-10-15 04:26:23 +03:00
local tape = peripheral.find("tape_drive")
local mon = peripheral.find("monitor")
tape.seek(0)
mon.setTextScale(1)
local w, h = string.byte(tape.read(2), 1, 2)
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(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()