diff --git a/modules/drivers/vt52.lua b/modules/drivers/vt52.lua index b154c2d..6bbb046 100644 --- a/modules/drivers/vt52.lua +++ b/modules/drivers/vt52.lua @@ -1,7 +1,7 @@ function tty(gA,sA,sI,fg,bg) - local gP,cx,cy,bg,fg = component.proxy(gA),1,1,bg or 0x000000, fg or 0xffffff + local sI = sI or 1 + local gP,cx,cy,bg,fg,Sx,Sy = component.proxy(gA),1,1,bg or 0x000000, fg or 0xffffff,1,1 gP.bind(sA) - gP.cs = sA local sx, sy = gP.getResolution() gP.setResolution(sx,sy) gP.setForeground(fg) @@ -31,7 +31,6 @@ function tty(gA,sA,sI,fg,bg) for c in str:gmatch(".") do if cm == 1 then cm = 0 - ic(true) if c == "A" then cy=cy-1 elseif c == "B" then cy=cy+1 elseif c == "C" then cx=cx+1 @@ -40,6 +39,19 @@ function tty(gA,sA,sI,fg,bg) elseif c == "Y" then cm=2 elseif c == "b" then cm=4 elseif c == "c" then cm=5 + elseif c == "j" then Sx,Sy = cx,cy + elseif c == "k" then cx,cy = Sx,Sy + elseif c == "l" then + gP.fill(1,cy,sx,1," ") + elseif c == "L" then + gP.copy(1,2,sx,cy-1,0,-1) + gP.fill(1,cy-1,sx,1," ") + elseif c == "p" then + gP.setForeground(bG) + gP.setBackground(fG) + elseif c == "q" then + gP.setForeground(fG) + gP.setBackground(bG) end elseif cm == 2 then cx,cm=string.byte(c)-31,3 @@ -64,7 +76,7 @@ function tty(gA,sA,sI,fg,bg) end end spawn("tty["..tostring(sI).."]: "..gA:sub(1,8)..","..sA:sub(1,8),function() log(pcall(function() - os.setenv("sI",sI) + if sI then os.setenv("sI",sI) end while true do local csi = os.getenv("sI") log(csi)