1
0
mirror of https://github.com/ShadowKatStudios/OC-Minitel.git synced 2024-12-25 09:58:04 +11:00

all the stuff to make your own tiny terminal

This commit is contained in:
Izaya 2018-05-23 05:00:18 +10:00
parent 73694b480f
commit b790d3f39b
4 changed files with 33 additions and 17 deletions

10
Embedded/fget.lua Normal file
View File

@ -0,0 +1,10 @@
function fget(A,P,V)
local b,tb,s="","",net.open(A,V or 70)
s:w("t"..P.."\n")
repeat
UC.pullSignal()
tb=s:r(2048)
b=b..tb
until tb == "" and s.s == "c"
return b:sub(2)
end

View File

@ -1,6 +1,10 @@
#!/bin/bash
echo vt100.lua
lua minify.lua vt100.lua mini-vt100.lua
echo miniprompt.lua
lua minify.lua miniprompt.lua mini-miniprompt.lua
echo fget.lua
lua minify.lua fget.lua mini-fget.lua
echo init-wrapper.lua
lua minify.lua init-wrapper.lua mini-init-wrapper.lua
echo microtel-3.lua
@ -15,3 +19,9 @@ echo microtel-5-flisten.lua
lua minify.lua microtel/microtel-5-flisten.lua microtel/mini-microtel-5-flisten.lua
echo microtel-5-open.lua
lua minify.lua microtel/microtel-5-open.lua microtel/mini-microtel-5-open.lua
# fun stuff now
cat microtel/mini-microtel-{3,4,5-core,5-open}.lua mini-vt100.lua mini-miniprompt.lua > nminiprompt.lua
lua minify.lua nminiprompt.lua mini-nminiprompt.lua
echo -e "GC,UC=component,computer" | cat - mini-nminiprompt.lua > mini-fnminiprompt.lua
mv mini-fnminiprompt.lua mini-nminiprompt.lua

View File

@ -1,3 +1,6 @@
{
{"read,write,print=R,W,P","print,read,write=P,R,W\npcall(load(component.invoke(component.list(\"eeprom\")(),\"getData\")))"},
{"component","GC"},
{"computer","UC"},
{"vt100emu","VT"},
}

View File

@ -12,24 +12,12 @@ function vt100emu(gpu)
gpu.setResolution(mx,my)
gpu.fill(1,1,mx,my," ")
local function dcursor()
pc = gpu.get(cx,cy)
gpu.setForeground(0)
gpu.setBackground(0xFFFFFF)
gpu.set(cx,cy,pc)
gpu.setForeground(0xFFFFFF)
gpu.setBackground(0)
end
local function udcursor()
pc = gpu.get(cx,cy)
gpu.setForeground(0xFFFFFF)
gpu.setBackground(0)
gpu.set(cx,cy,pc)
end
function termwrite(s)
s=s:gsub("\8","\27[D")
udcursor()
pc = gpu.get(cx,cy)
gpu.setForeground(0xFFFFFF)
gpu.setBackground(0)
gpu.set(cx,cy,pc)
for i = 1, s:len() do
local cc = s:sub(i,i)
@ -107,7 +95,12 @@ function vt100emu(gpu)
lc = cc
end
dcursor()
pc = gpu.get(cx,cy)
gpu.setForeground(0)
gpu.setBackground(0xFFFFFF)
gpu.set(cx,cy,pc)
gpu.setForeground(0xFFFFFF)
gpu.setBackground(0)
end
return termwrite