rewrite
This commit is contained in:
109
Build/lib/modules/cct-tto.kmod
Executable file
109
Build/lib/modules/cct-tto.kmod
Executable file
@@ -0,0 +1,109 @@
|
||||
local args={...}
|
||||
local apis=args[1]
|
||||
local drivers=args[2]
|
||||
local driver={}
|
||||
|
||||
driver.name="CCT TTO Module"
|
||||
driver.version="0.1.0"
|
||||
driver.description="CCT TTO Module Kernel Module"
|
||||
driver.arch="cct"
|
||||
driver.author="HyperionOS Dev Team"
|
||||
driver.license="MIT"
|
||||
driver.api={}
|
||||
|
||||
colors={
|
||||
0x000000, -- #000000
|
||||
0xFFFFFF, -- #FFFFFF
|
||||
0xFF0000, -- #FF0000
|
||||
0x00FF00, -- #00FF00
|
||||
0x0000FF, -- #0000FF
|
||||
0x00FFFF, -- #00FFFF
|
||||
0xFF00FF, -- #FF00FF
|
||||
0xFFFF00, -- #FFFF00
|
||||
0xFF6D00, -- #FF6D00
|
||||
0x6DFF55, -- #6DFF55
|
||||
0x24FFFF, -- #24FFFF
|
||||
0x924900, -- #924900
|
||||
0x6D6D55, -- #6D6D55
|
||||
0xDBDBAA, -- #DBDBAA
|
||||
0x6D00FF, -- #6D00FF
|
||||
0xB6FF00 -- #B6FF00
|
||||
}
|
||||
|
||||
icolors={
|
||||
[0x1] =0, -- #000000
|
||||
[0x2] =1, -- #FFFFFF
|
||||
[0x4] =2, -- #FF0000
|
||||
[0x8] =3, -- #00FF00
|
||||
[0x10] =4, -- #0000FF
|
||||
[0x20] =5, -- #00FFFF
|
||||
[0x40] =6, -- #FF00FF
|
||||
[0x80] =7, -- #FFFF00
|
||||
[0x100] =8, -- #FF6D00
|
||||
[0x200] =9, -- #6DFF55
|
||||
[0x400] =10, -- #24FFFF
|
||||
[0x800] =11, -- #924900
|
||||
[0x1000] =12, -- #6D6D55
|
||||
[0x2000] =13, -- #DBDBAA
|
||||
[0x4000] =14, -- #6D00FF
|
||||
[0x8000] =15 -- #B6FF00
|
||||
}
|
||||
|
||||
function driver.load()
|
||||
|
||||
end
|
||||
|
||||
function driver.unload()
|
||||
-- Nothing to unload
|
||||
end
|
||||
|
||||
function driver.reload()
|
||||
-- Nothing to reload
|
||||
end
|
||||
|
||||
function driver.main()
|
||||
-- Nothing to run
|
||||
end
|
||||
|
||||
function driver.api.print(text)
|
||||
apis.term.write(text.."\n")
|
||||
end
|
||||
|
||||
function driver.api.printInline(text)
|
||||
apis.term.write(text)
|
||||
end
|
||||
|
||||
function driver.api.clear()
|
||||
apis.term.clear()
|
||||
apis.term.setCursorPos(1,1)
|
||||
end
|
||||
|
||||
function driver.api.getSize()
|
||||
return apis.term.getSize()
|
||||
end
|
||||
|
||||
function driver.api.setBackgroundColor(index)
|
||||
apis.term.setBackgroundColor(colors[index] or 0)
|
||||
end
|
||||
|
||||
function driver.api.setForegroundColor(index)
|
||||
apis.term.setTextColor(colors[index] or 0)
|
||||
end
|
||||
|
||||
function driver.api.setCursorPos(x, y)
|
||||
apis.term.setCursorPos(x, y)
|
||||
end
|
||||
|
||||
function driver.api.getCursorPos()
|
||||
return apis.term.getCursorPos()
|
||||
end
|
||||
|
||||
function driver.api.getBackgroundColor()
|
||||
return icolors[apis.term.getBackgroundColor()]
|
||||
end
|
||||
|
||||
function driver.api.getForegroundColor()
|
||||
return icolors[apis.term.getTextColor()]
|
||||
end
|
||||
|
||||
drivers.register(driver)
|
||||
Reference in New Issue
Block a user