forked from hkc/cc-stuff
1
0
Fork 0

Seek it properly and offset

This commit is contained in:
Casey 2023-10-15 04:40:16 +03:00
parent 570e721e3e
commit a2d8c592a7
Signed by: hkc
GPG Key ID: F0F6CFE11CDB0960
1 changed files with 2 additions and 2 deletions

View File

@ -1,7 +1,7 @@
local tape = peripheral.find("tape_drive") local tape = peripheral.find("tape_drive")
local mon = peripheral.find("monitor") local mon = peripheral.find("monitor")
tape.seek(0) tape.seek(-tape.getSize())
mon.setTextScale(1) mon.setTextScale(1)
local w, h = string.byte(tape.read(2), 1, 2) local w, h = string.byte(tape.read(2), 1, 2)
@ -12,7 +12,7 @@ repeat
local buf = string.byte(tape.read(w), 1, -1) local buf = string.byte(tape.read(w), 1, -1)
local s, f, b = "", "", "" local s, f, b = "", "", ""
for x = 1, w do for x = 1, w do
s = s .. string.char(bit32.band(0x7F, buf[x])) s = s .. string.char(0x80 + bit32.band(0x7F, buf[x]))
local inv = bit32.band(0x80, buf[x]) local inv = bit32.band(0x80, buf[x])
f = f .. (inv and "f" or "0") f = f .. (inv and "f" or "0")
b = b .. (inv and "0" or "f") b = b .. (inv and "0" or "f")