1
0
Fork 0
cc-stuff/videotape.lua

28 lines
711 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")
2023-10-15 04:40:16 +03:00
tape.seek(-tape.getSize())
2023-10-15 04:26:23 +03:00
mon.setTextScale(1)
local w, h = string.byte(tape.read(2), 1, 2)
2023-10-15 04:45:49 +03:00
local b = ""
for _ = 1, w do b = b .. "0" end
local f = b
2023-10-15 04:26:23 +03:00
repeat
for y = 1, h do
mon.setCursorPos(1, y)
2023-10-15 04:40:58 +03:00
local buf = { string.byte(tape.read(w), 1, -1) }
2023-10-15 04:45:49 +03:00
local s = "" -- , f, b = "", "", ""
2023-10-15 04:26:23 +03:00
for x = 1, w do
2023-10-15 04:40:16 +03:00
s = s .. string.char(0x80 + bit32.band(0x7F, buf[x]))
2023-10-15 04:45:49 +03:00
-- local inv = bit32.band(0x80, buf[x])
-- f = f .. (inv and "f" or "0")
-- b = b .. (inv and "0" or "f")
2023-10-15 04:26:23 +03:00
end
mon.blit(s, f, b)
end
os.sleep(0.01)
until tape.isEnd()