implementation of mmio 1024..2047

This commit is contained in:
minjaesong
2021-04-20 14:49:58 +09:00
parent 95c33f7d5e
commit d85b1a99dc
3 changed files with 40 additions and 3 deletions

View File

@@ -9,7 +9,6 @@ let DEBUG_PRINT = true;
let errorlevel = 0;
const termWidth = con.getmaxyx()[1];
const termHeight = con.getmaxyx()[0];
const welcome_text = (termWidth > 40) ? "TSVM Disk Operating System, version " + _TVDOS.VERSION
@@ -17,6 +16,14 @@ const welcome_text = (termWidth > 40) ? "TSVM Disk Operating System, version " +
const greetLeftPad = (termWidth - welcome_text.length - 6) >> 1;
const greetRightPad = termWidth - greetLeftPad - welcome_text.length - 6;
function makeHash() {
let e = "YBNDRFG8EJKMCPQXOTLVWIS2A345H769";
let m = e.length;
return e[Math.floor(Math.random()*m)] + e[Math.floor(Math.random()*m)] + e[Math.floor(Math.random()*m)] + e[Math.floor(Math.random()*m)] + e[Math.floor(Math.random()*m)]
}
const shellID = makeHash();
function print_prompt_text() {
if (goFancy) {
con.color_pair(239,161);
@@ -59,6 +66,12 @@ function greet() {
println(welcome_text);
}
function sendLcdMsg(s) {
for (let i = 1024; i < 1048; i++) {
sys.poke(-i-1, (s === undefined) ? 0 : s.charCodeAt(i - 1024)|0);
}
}
function trimStartRevSlash(s) {
var cnt = 0;
while (cnt < s.length) {
@@ -362,7 +375,18 @@ shell.execute = function(line) {
});
}
else {
return execApp(programCode, tokens)|0; // return value of undefined will cast into 0
if (_G.shellProgramTitles === undefined) _G.shellProgramTitles = [];
_G.shellProgramTitles.push(cmd.toUpperCase())
sendLcdMsg(_G.shellProgramTitles[_G.shellProgramTitles.length - 1]);
serial.println(_G.shellProgramTitles);
let ret = execApp(programCode, tokens)|0; // return value of undefined will cast into 0
_G.shellProgramTitles.pop();
sendLcdMsg(_G.shellProgramTitles[_G.shellProgramTitles.length - 1]);
serial.println(_G.shellProgramTitles);
return ret;
}
}
}
@@ -370,7 +394,6 @@ shell.execute = function(line) {
Object.freeze(shell);
_G.shell = shell;
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
if (exec_args[1] !== undefined) {