From 1ecb85354b625b60a3d7bd1c799227c40ec61da1 Mon Sep 17 00:00:00 2001 From: minjaesong Date: Fri, 23 Dec 2022 02:25:53 +0900 Subject: [PATCH] tvdos installer wip --- assets/disk0/AUTOEXEC.BAT | 2 +- assets/disk0/root.live/AUTOEXEC.BAT | 8 ++----- assets/disk0/tvdos/bin/command.js | 10 +++++--- assets/disk0/tvdos/installer/!BOOTSEC | 1 + assets/disk0/tvdos/installer/AUTOEXEC.BAT | 8 +++++++ assets/disk0/tvdos/installer/install.js | 29 +++++++++++++++++++++++ doc/tvdos.tex | 2 +- 7 files changed, 49 insertions(+), 11 deletions(-) create mode 100644 assets/disk0/tvdos/installer/!BOOTSEC create mode 100644 assets/disk0/tvdos/installer/AUTOEXEC.BAT create mode 100644 assets/disk0/tvdos/installer/install.js diff --git a/assets/disk0/AUTOEXEC.BAT b/assets/disk0/AUTOEXEC.BAT index 8a0885f..1b2e864 100644 --- a/assets/disk0/AUTOEXEC.BAT +++ b/assets/disk0/AUTOEXEC.BAT @@ -1,7 +1,7 @@ echo "Starting TVDOS..." rem put set-xxx commands here: -set PATH=\tvdos\tuidev;$PATH +set PATH=\tvdos\installer;\tvdos\tuidev;$PATH set KEYBOARD=us_colemak rem this line specifies which shell to be presented after the boot precess: diff --git a/assets/disk0/root.live/AUTOEXEC.BAT b/assets/disk0/root.live/AUTOEXEC.BAT index b5e593a..72b469d 100644 --- a/assets/disk0/root.live/AUTOEXEC.BAT +++ b/assets/disk0/root.live/AUTOEXEC.BAT @@ -1,8 +1,4 @@ echo "Starting TVDOS Installation Medium..." - -rem put set-xxx commands here: -rem e.g. set PATH=\home\my-cool-project;$PATH +set PATH=\tvdos\installer;$PATH set KEYBOARD=us_qwerty - -rem this line specifies which shell to be presented after the boot precess: -command /fancy +command \ No newline at end of file diff --git a/assets/disk0/tvdos/bin/command.js b/assets/disk0/tvdos/bin/command.js index b802b46..2b79cf0 100644 --- a/assets/disk0/tvdos/bin/command.js +++ b/assets/disk0/tvdos/bin/command.js @@ -84,13 +84,17 @@ function printmotd() { con.mvaddch(cy, 4, 16);con.curs_right();print(' ') + const PCX_INIT = margin - 2 let tcnt = 0 - let pcx = margin - 1 + let pcx = PCX_INIT while (tcnt <= motd.length) { let char = motd.charAt(tcnt) if (char != '\n') { - print(motd.charAt(tcnt)) + // prevent the line starting from ' ' + if (pcx != PCX_INIT || char != ' ') { + print(motd.charAt(tcnt)) + } pcx += 1 } @@ -105,7 +109,7 @@ function printmotd() { // next line header let [ncy, __] = con.getyx() con.mvaddch(ncy, 4, 16);con.curs_right();print(' ') - pcx = margin - 1 + pcx = PCX_INIT } tcnt += 1 diff --git a/assets/disk0/tvdos/installer/!BOOTSEC b/assets/disk0/tvdos/installer/!BOOTSEC new file mode 100644 index 0000000..faca567 --- /dev/null +++ b/assets/disk0/tvdos/installer/!BOOTSEC @@ -0,0 +1 @@ +let p=_BIOS.FIRST_BOOTABLE_PORT;com.sendMessage(p[0],"DEVRST\x17");com.sendMessage(p[0],'OPENR"tvdos/TVDOS.SYS",'+p[1]);let r=com.getStatusCode(p[0]);if(0==r)if(com.sendMessage(p[0],"READ"),r=com.getStatusCode(p[0]),0==r){let g=com.pullMessage(p[0]);eval(g)}else println("I/O Error");else println("TVDOS.SYS not found");println("Shutting down...");println("It is now safe to turn off the power"); \ No newline at end of file diff --git a/assets/disk0/tvdos/installer/AUTOEXEC.BAT b/assets/disk0/tvdos/installer/AUTOEXEC.BAT new file mode 100644 index 0000000..7f37bc8 --- /dev/null +++ b/assets/disk0/tvdos/installer/AUTOEXEC.BAT @@ -0,0 +1,8 @@ +echo "Starting TVDOS..." + +rem put set-xxx commands here: +rem e.g. set PATH=\home\my-cool-project;$PATH +set KEYBOARD=us_qwerty + +rem this line specifies which shell to be presented after the boot precess: +command /fancy diff --git a/assets/disk0/tvdos/installer/install.js b/assets/disk0/tvdos/installer/install.js new file mode 100644 index 0000000..7907664 --- /dev/null +++ b/assets/disk0/tvdos/installer/install.js @@ -0,0 +1,29 @@ +println("let's install!") + + +function copyFiles(destDrive) { + function dir(path) { + return `${destDrive}:/${path}` + } + + const dos = _G.shell.coreutils + + dos.mkdir(dir("home")) + dos.mkdir(dir("tvdos")) + dos.mkdir(dir("tvdos\\bin")) + + // tvdos/bin + files.open("A:\\tvdos\\bin").list().forEach((file)=>{ + dos.cp(file.fullPath, `${destDrive}:${file.path}`) + }) + + // tvdos + ;["gl.js", "TVDOS.SYS", "us_colemak.key", "us_qwerty.key"].forEach((name)=>{ + dos.cp(`A:\\tvdos\\${name}`, `${destDrive}:\\tvdos\\${name}`) + }) + + // bare files in the root dir + ;["!BOOTSEC", "AUTOEXEC.BAT"].forEach((name)=>{ + dos.cp(`A:\\tvdos\\installer\\${name}`, `${destDrive}:\\${name}`) + }) +} \ No newline at end of file diff --git a/doc/tvdos.tex b/doc/tvdos.tex index 4de108d..2157247 100644 --- a/doc/tvdos.tex +++ b/doc/tvdos.tex @@ -153,7 +153,7 @@ Properties: \begin{outline} \1\propertysynopsis{size}{Int}{Returns a size of the file in bytes.} -\1\propertysynopsis{path}{String}{Returns a path (NOT including the drive letter) of the file. Paths are separated using reverse solidus.} +\1\propertysynopsis{path}{String}{Returns a path (NOT including the drive letter) of the file. Paths are started with, and separated using reverse solidus.} \1\propertysynopsis{fullPath}{String}{Returns a fully qualified path (including the drive letter) of the file. Paths are separated using reverse solidus.} \1\propertysynopsis{driverID}{String}{Returns a filesystem driver ID associated with the file.} \1\propertysynopsis{driver}{[Object object]}{Returns a filesystem driver (a Javascript object) for the file.}