mirror of
https://github.com/curioustorvald/tsvm.git
synced 2026-03-07 19:51:51 +09:00
stuffs
This commit is contained in:
BIN
FontROM7x14.kra
LFS
BIN
FontROM7x14.kra
LFS
Binary file not shown.
BIN
FontROM7x14.png
BIN
FontROM7x14.png
Binary file not shown.
|
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 3.8 KiB |
@@ -1,5 +1,6 @@
|
|||||||
// Boot script
|
// Boot script
|
||||||
var _TVDOS = {};
|
var _TVDOS = {};
|
||||||
|
_TVDOS.VERSION = "1.0";
|
||||||
_TVDOS.DRIVES = {}; // Object where key-value pair is <drive-letter> : [serial-port, drive-number]
|
_TVDOS.DRIVES = {}; // Object where key-value pair is <drive-letter> : [serial-port, drive-number]
|
||||||
// actually figure out the drive letter association
|
// actually figure out the drive letter association
|
||||||
// Drive A is always the device we're currently on
|
// Drive A is always the device we're currently on
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
const DOS_VERSION = "1.0";
|
const PROMPT_TEXT = ">";
|
||||||
let PROMPT_TEXT = ">";
|
|
||||||
let CURRENT_DRIVE = "A";
|
let CURRENT_DRIVE = "A";
|
||||||
|
|
||||||
let shell_pwd = [""];
|
let shell_pwd = [""];
|
||||||
|
|
||||||
const welcome_text = "TSVM Disk Operating System, version " + DOS_VERSION;
|
const welcome_text = "TSVM Disk Operating System, version " + _TVDOS.VERSION;
|
||||||
|
|
||||||
function get_prompt_text() {
|
function get_prompt_text() {
|
||||||
return CURRENT_DRIVE + ":\\" + shell_pwd.join("\\") + PROMPT_TEXT;
|
return CURRENT_DRIVE + ":\\" + shell_pwd.join("\\") + PROMPT_TEXT;
|
||||||
|
|||||||
106
assets/tvdos/flsh.js
Normal file
106
assets/tvdos/flsh.js
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
let CURRENT_DRIVE = "A";
|
||||||
|
|
||||||
|
let shell_pwd = [""];
|
||||||
|
|
||||||
|
const welcome_text = "TSVM Disk Operating System, version " + _TVDOS.VERSION;
|
||||||
|
|
||||||
|
function print_prompt_text() {
|
||||||
|
// oh-my-zsh-like prompt
|
||||||
|
con.color_pair(239,161);
|
||||||
|
print(" "+CURRENT_DRIVE);
|
||||||
|
con.color_pair(161,253);
|
||||||
|
con.addch(16);
|
||||||
|
con.color_pair(0,253);
|
||||||
|
print("\\"+shell_pwd.join("\\"));
|
||||||
|
con.color_pair(253,255);
|
||||||
|
con.addch(16);
|
||||||
|
con.addch(32);
|
||||||
|
con.color_pair(239,255);
|
||||||
|
}
|
||||||
|
|
||||||
|
function greet() {
|
||||||
|
con.color_pair(0,253);
|
||||||
|
//print(welcome_text + " ".repeat(_fsh.scrwidth - welcome_text.length));
|
||||||
|
print(welcome_text + " ".repeat(80 - welcome_text.length));
|
||||||
|
con.color_pair(239,255);
|
||||||
|
println();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
con.clear();
|
||||||
|
|
||||||
|
greet();
|
||||||
|
|
||||||
|
let cmdHistory = []; // zeroth element is the oldest
|
||||||
|
let cmdHistoryScroll = 0; // 0 for outside-of-buffer, 1 for most recent
|
||||||
|
while (true) {
|
||||||
|
print_prompt_text();
|
||||||
|
|
||||||
|
let cmdbuf = "";
|
||||||
|
|
||||||
|
while (true) {
|
||||||
|
let key = con.getch();
|
||||||
|
|
||||||
|
// printable chars
|
||||||
|
if (key >= 32 && key <= 126) {
|
||||||
|
let s = String.fromCharCode(key);
|
||||||
|
cmdbuf += s;
|
||||||
|
print(s);
|
||||||
|
}
|
||||||
|
// backspace
|
||||||
|
else if (key === 8 && cmdbuf.length > 0) {
|
||||||
|
cmdbuf = cmdbuf.substring(0, cmdbuf.length - 1);
|
||||||
|
print(String.fromCharCode(key));
|
||||||
|
}
|
||||||
|
// enter
|
||||||
|
else if (key === 10 || key === 13) {
|
||||||
|
println();
|
||||||
|
try {
|
||||||
|
println("You entered: " + cmdbuf);
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
println(e);
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
if (cmdbuf.trim().length > 0)
|
||||||
|
cmdHistory.push(cmdbuf);
|
||||||
|
|
||||||
|
cmdHistoryScroll = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// up arrow
|
||||||
|
else if (key === 19 && cmdHistory.length > 0 && cmdHistoryScroll < cmdHistory.length) {
|
||||||
|
cmdHistoryScroll += 1;
|
||||||
|
|
||||||
|
// back the cursor in order to type new cmd
|
||||||
|
let x = 0;
|
||||||
|
for (x = 0; x < cmdbuf.length; x++) print(String.fromCharCode(8));
|
||||||
|
cmdbuf = cmdHistory[cmdHistory.length - cmdHistoryScroll];
|
||||||
|
// re-type the new command
|
||||||
|
print(cmdbuf);
|
||||||
|
|
||||||
|
}
|
||||||
|
// down arrow
|
||||||
|
else if (key === 20) {
|
||||||
|
if (cmdHistoryScroll > 0) {
|
||||||
|
// back the cursor in order to type new cmd
|
||||||
|
let x = 0;
|
||||||
|
for (x = 0; x < cmdbuf.length; x++) print(String.fromCharCode(8));
|
||||||
|
cmdbuf = cmdHistory[cmdHistory.length - cmdHistoryScroll];
|
||||||
|
// re-type the new command
|
||||||
|
print(cmdbuf);
|
||||||
|
|
||||||
|
cmdHistoryScroll -= 1;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// back the cursor in order to type new cmd
|
||||||
|
let x = 0;
|
||||||
|
for (x = 0; x < cmdbuf.length; x++) print(String.fromCharCode(8));
|
||||||
|
cmdbuf = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -111,6 +111,12 @@ Description: closes any file that is open.
|
|||||||
|
|
||||||
Description: loads a file onto the main memory. The pointer to the file will be sent back to the host device.
|
Description: loads a file onto the main memory. The pointer to the file will be sent back to the host device.
|
||||||
|
|
||||||
|
LOADBOOT,<drive number>
|
||||||
|
|
||||||
|
Description: loads a bootloader so that it can be read by the host device through the serial connection.
|
||||||
|
Technically there's no limit on the size of the bootloader but it's up to the BIOS to read more than
|
||||||
|
a single block.
|
||||||
|
|
||||||
CHTYPE,<file type>,<drive number>
|
CHTYPE,<file type>,<drive number>
|
||||||
|
|
||||||
Description: changes the open file's file type (or its extension)
|
Description: changes the open file's file type (or its extension)
|
||||||
|
|||||||
@@ -72,8 +72,9 @@ class VMGUI(val appConfig: LwjglApplicationConfiguration) : ApplicationAdapter()
|
|||||||
|
|
||||||
//val fr = FileReader("./assets/tvdos/command.js")
|
//val fr = FileReader("./assets/tvdos/command.js")
|
||||||
//val fr = FileReader("./assets/zippytest.js")
|
//val fr = FileReader("./assets/zippytest.js")
|
||||||
val fr = FileReader("./assets/serialtest.js")
|
//val fr = FileReader("./assets/serialtest.js")
|
||||||
//val fr = FileReader("./assets/tvdos/fsh.js")
|
//val fr = FileReader("./assets/tvdos/fsh.js")
|
||||||
|
val fr = FileReader("./assets/tvdos/flsh.js")
|
||||||
//val fr = FileReader("./assets/tbas/basic.js")
|
//val fr = FileReader("./assets/tbas/basic.js")
|
||||||
//val fr = FileReader("./assets/jscon.js")
|
//val fr = FileReader("./assets/jscon.js")
|
||||||
val prg = fr.readText()
|
val prg = fr.readText()
|
||||||
|
|||||||
Reference in New Issue
Block a user