From 204571b7925c588c3ed9a22f7717ca2bc385e3fe Mon Sep 17 00:00:00 2001 From: minjaesong Date: Thu, 22 Dec 2022 21:27:14 +0900 Subject: [PATCH] command.js print motd --- assets/disk0/AUTOEXEC.BAT | 2 +- assets/disk0/COPYING | 19 ++++++++++ assets/disk0/etc/motd | 7 ++++ assets/disk0/root.bootable/COPYING | 19 ++++++++++ assets/disk0/root.live/!BOOTSEC | 1 + assets/disk0/root.live/AUTOEXEC.BAT | 8 +++++ assets/disk0/root.live/COPYING | 19 ++++++++++ assets/disk0/root.live/etc/motd | 7 ++++ assets/disk0/tvdos/bin/command.js | 55 +++++++++++++++++++++++++++++ 9 files changed, 136 insertions(+), 1 deletion(-) create mode 100644 assets/disk0/COPYING create mode 100644 assets/disk0/etc/motd create mode 100644 assets/disk0/root.bootable/COPYING create mode 100644 assets/disk0/root.live/!BOOTSEC create mode 100644 assets/disk0/root.live/AUTOEXEC.BAT create mode 100644 assets/disk0/root.live/COPYING create mode 100644 assets/disk0/root.live/etc/motd diff --git a/assets/disk0/AUTOEXEC.BAT b/assets/disk0/AUTOEXEC.BAT index 5b468f5..8a0885f 100644 --- a/assets/disk0/AUTOEXEC.BAT +++ b/assets/disk0/AUTOEXEC.BAT @@ -5,4 +5,4 @@ set PATH=\tvdos\tuidev;$PATH set KEYBOARD=us_colemak rem this line specifies which shell to be presented after the boot precess: -command +command /fancy diff --git a/assets/disk0/COPYING b/assets/disk0/COPYING new file mode 100644 index 0000000..25e8056 --- /dev/null +++ b/assets/disk0/COPYING @@ -0,0 +1,19 @@ +Copyright (c) 2020-2022 CuriousTorvald + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/assets/disk0/etc/motd b/assets/disk0/etc/motd new file mode 100644 index 0000000..3f760cd --- /dev/null +++ b/assets/disk0/etc/motd @@ -0,0 +1,7 @@ +Welcome to TVDOS Installer! + +With this Live Boot environment you can freely try out the DOS without actual installation. The disk is write-protected so all the important files are safe. + +To install the TVDOS to your disk, simply run 'install'. + +TVDOS is provided "as is", without warranty of any kind; in no event shall the authors or copyright holders be liable for any claim, damages or other liabilities. Run 'less COPYING' for more information. \ No newline at end of file diff --git a/assets/disk0/root.bootable/COPYING b/assets/disk0/root.bootable/COPYING new file mode 100644 index 0000000..25e8056 --- /dev/null +++ b/assets/disk0/root.bootable/COPYING @@ -0,0 +1,19 @@ +Copyright (c) 2020-2022 CuriousTorvald + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/assets/disk0/root.live/!BOOTSEC b/assets/disk0/root.live/!BOOTSEC new file mode 100644 index 0000000..b8af513 --- /dev/null +++ b/assets/disk0/root.live/!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("The Installation Medium seems to be damaged. Please contact your reseller or system administrators.");else println("TVDOS.SYS not found");println();println("Remove the Installation Medium, close the tray (if any), then shut off and restart the computer to finish the installation."); \ No newline at end of file diff --git a/assets/disk0/root.live/AUTOEXEC.BAT b/assets/disk0/root.live/AUTOEXEC.BAT new file mode 100644 index 0000000..b5e593a --- /dev/null +++ b/assets/disk0/root.live/AUTOEXEC.BAT @@ -0,0 +1,8 @@ +echo "Starting TVDOS Installation Medium..." + +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/root.live/COPYING b/assets/disk0/root.live/COPYING new file mode 100644 index 0000000..25e8056 --- /dev/null +++ b/assets/disk0/root.live/COPYING @@ -0,0 +1,19 @@ +Copyright (c) 2020-2022 CuriousTorvald + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/assets/disk0/root.live/etc/motd b/assets/disk0/root.live/etc/motd new file mode 100644 index 0000000..6b12d6a --- /dev/null +++ b/assets/disk0/root.live/etc/motd @@ -0,0 +1,7 @@ +Welcome to TVDOS Live Boot Medium! + +With the Live Media you can freely try out the DOS without actual installation. The disk is write-protected so all the important files are safe. + +To install the TVDOS to your disk, simply run 'install'. + +TVDOS is provided "as is", without warranty of any kind; in no event shall the authors or copyright holders be liable for any claim, damages or other liabilities. Run 'less COPYING' for more information. \ No newline at end of file diff --git a/assets/disk0/tvdos/bin/command.js b/assets/disk0/tvdos/bin/command.js index c0aff8a..b802b46 100644 --- a/assets/disk0/tvdos/bin/command.js +++ b/assets/disk0/tvdos/bin/command.js @@ -67,6 +67,60 @@ function greet() { println(welcome_text) } +function printmotd() { + let motdFile = files.open("A:/etc/motd") + if (!motdFile.exists) return + let motd = motdFile.sread().trim() + let width = con.getmaxyx()[1] + + + if (goFancy) { + let margin = 4 + let internalWidth = width - 2*margin + + con.video_reverse() + + let [cy, cx] = con.getyx() + + con.mvaddch(cy, 4, 16);con.curs_right();print(' ') + + let tcnt = 0 + let pcx = margin - 1 + while (tcnt <= motd.length) { + let char = motd.charAt(tcnt) + + if (char != '\n') { + print(motd.charAt(tcnt)) + pcx += 1 + } + + if ('\n' == char || pcx % internalWidth == 0 && pcx != 0 || tcnt == motd.length) { + // current line ending + let [_, ncx] = con.getyx() + for (let k = 0; k < width - margin - ncx + 1; k++) print(' ') + con.addch(17);println() + + if (tcnt == motd.length) break + + // next line header + let [ncy, __] = con.getyx() + con.mvaddch(ncy, 4, 16);con.curs_right();print(' ') + pcx = margin - 1 + } + + tcnt += 1 + } + + con.video_reverse() + } + else { + println() + println(motd) + } + + println() +} + /*uninterruptible*/ function sendLcdMsg(s) { // making it uninterruptible sys.poke(-1025, (s === undefined) ? 0 : s.charCodeAt(0)|0) @@ -761,6 +815,7 @@ let cmdExit = false if (goInteractive) { con.curs_set(1) greet() + printmotd() let cmdHistory = [] // zeroth element is the oldest let cmdHistoryScroll = 0 // 0 for outside-of-buffer, 1 for most recent