From 09e4d04160adb22be78149aa6c25f31590c73581 Mon Sep 17 00:00:00 2001 From: minjaesong Date: Tue, 27 Sep 2022 21:54:53 +0900 Subject: [PATCH] doc update --- .gitignore | 3 ++ assets/disk0/tvdos/bin/telcom.js | 9 +++-- doc/tsvmman.idx | 15 +++++---- doc/tsvmman.ilg | 6 ++-- doc/tsvmman.ind | 21 ++++++------ doc/tvdos.tex | 33 +++++++++++++++---- .../src/net/torvald/tsvm/AppLoader.java | 6 ++-- 7 files changed, 62 insertions(+), 31 deletions(-) diff --git a/.gitignore b/.gitignore index fb70f6e..651f29f 100644 --- a/.gitignore +++ b/.gitignore @@ -51,6 +51,9 @@ tmp_* *.out tsvmman.pdf *.toc +*.idx +*.ilg +*.ind assets/disk0/home/basic/* assets/disk0/movtestimg/*.jpg diff --git a/assets/disk0/tvdos/bin/telcom.js b/assets/disk0/tvdos/bin/telcom.js index 97726a1..6c4d08f 100644 --- a/assets/disk0/tvdos/bin/telcom.js +++ b/assets/disk0/tvdos/bin/telcom.js @@ -17,6 +17,10 @@ else { function greet() { if (!port) { println("COM port not specified; please run 'listen [1|2|3|4]' to open a port first.") + println("In listening mode, any text entered will be sent right to the COM") + println("Hit Ctrl+A while listening to return to the prompt.") + println("On the prompt, enter 'pull' to pull the message.") + println("Enter 'exit' to exit.") } } @@ -65,12 +69,13 @@ function sendMessage(line) { if (line.charAt(line.length - 1) == '\\') line = line.substring(0, line.length - 1) + '\x17' com.sendMessage(port - 1, line) - println(com.fetchResponse(port - 1)) + com.waitUntilReady(port - 1) + println(com.pullMessage(port - 1)) } } function print_prompt_text() { - print(`${getFocusStr[focus]()}> `) + print(`${getFocusStr[focus]()}>`) } con.curs_set(1) diff --git a/doc/tsvmman.idx b/doc/tsvmman.idx index 9d7bc4c..2153f10 100644 --- a/doc/tsvmman.idx +++ b/doc/tsvmman.idx @@ -19,10 +19,11 @@ \indexentry{MMIO-graphics|hyperpage}{26} \indexentry{boot process|hyperpage}{29} \indexentry{coreutils (DOS)|hyperpage}{30} -\indexentry{applications (DOS)|hyperpage}{31} -\indexentry{pipe (DOS)|hyperpage}{34} -\indexentry{filesystem (DOS)|hyperpage}{36} -\indexentry{file descriptor (DOS)|hyperpage}{36} -\indexentry{device file|hyperpage}{38} -\indexentry{input (DOS)|hyperpage}{40} -\indexentry{gl (DOS)|hyperpage}{41} +\indexentry{built-in apps (DOS)|hyperpage}{31} +\indexentry{user apps (DOS)|hyperpage}{33} +\indexentry{pipe (DOS)|hyperpage}{35} +\indexentry{filesystem (DOS)|hyperpage}{37} +\indexentry{file descriptor (DOS)|hyperpage}{37} +\indexentry{device file|hyperpage}{39} +\indexentry{input (DOS)|hyperpage}{41} +\indexentry{gl (DOS)|hyperpage}{43} diff --git a/doc/tsvmman.ilg b/doc/tsvmman.ilg index 30850bc..88cfddc 100644 --- a/doc/tsvmman.ilg +++ b/doc/tsvmman.ilg @@ -1,6 +1,6 @@ This is makeindex, version 2.16 [TeX Live 2022] (kpathsea + Thai support). -Scanning input file tsvmman.idx....done (28 entries accepted, 0 rejected). -Sorting entries....done (137 comparisons). -Generating output file tsvmman.ind....done (61 lines written, 0 warnings). +Scanning input file tsvmman.idx....done (29 entries accepted, 0 rejected). +Sorting entries....done (142 comparisons). +Generating output file tsvmman.ind....done (62 lines written, 0 warnings). Output written in tsvmman.ind. Transcript written in tsvmman.ilg. diff --git a/doc/tsvmman.ind b/doc/tsvmman.ind index b8724bb..cfa5177 100644 --- a/doc/tsvmman.ind +++ b/doc/tsvmman.ind @@ -1,12 +1,9 @@ \begin{theindex} - \item applications (DOS), \hyperpage{31} - - \indexspace - \item base64 (library), \hyperpage{13} \item block communication, \hyperpage{16} \item boot process, \hyperpage{29} + \item built-in apps (DOS), \hyperpage{31} \indexspace @@ -19,22 +16,22 @@ \indexspace - \item device file, \hyperpage{38} + \item device file, \hyperpage{39} \indexspace - \item file descriptor (DOS), \hyperpage{36} - \item filesystem (DOS), \hyperpage{36} + \item file descriptor (DOS), \hyperpage{37} + \item filesystem (DOS), \hyperpage{37} \indexspace - \item gl (DOS), \hyperpage{41} + \item gl (DOS), \hyperpage{43} \item graphics (library), \hyperpage{26} \item gzip (library), \hyperpage{12} \indexspace - \item input (DOS), \hyperpage{40} + \item input (DOS), \hyperpage{41} \indexspace @@ -51,11 +48,15 @@ \indexspace - \item pipe (DOS), \hyperpage{34} + \item pipe (DOS), \hyperpage{35} \indexspace \item stdio (library), \hyperpage{9} \item sys (library), \hyperpage{13} + \indexspace + + \item user apps (DOS), \hyperpage{33} + \end{theindex} diff --git a/doc/tvdos.tex b/doc/tvdos.tex index 08d3725..53ab3cd 100644 --- a/doc/tvdos.tex +++ b/doc/tvdos.tex @@ -52,9 +52,9 @@ Variables can be set or changed using \textbf{SET} commands. -\chapter{Applications} +\chapter{Built-in Apps} -\index{applications (DOS)}Applications are the programs shiped with the standard distribution of \thedos\ that is written for users' convenience. +\index{built-in apps (DOS)}Built-in Applications are the programs shipped with the standard distribution of \thedos\ that is written for users' convenience. This chapter will only briefly list and describe the applications. @@ -77,7 +77,20 @@ This chapter will only briefly list and describe the applications. -\chapter{Invoking Coreutils on JS} +\chapter{Writing Your Own Apps} + +\index{user apps (DOS)}User-made Applications are basically a standard Javascript program, but \thedos\ provides DOS extensions for convenience. + +User apps are invoked through \thedos\ to inject the command-line arguments and some necessary functionalities. + +\section{Command-line Arguments} + +The command line arguments are given via the array of strings named `exec\_args`. + +Index zero holds the name used to invoke the app, and the rest hold the actual arguments. + + +\section{Invoking Coreutils on the user Apps} DOS coreutils and some of the internal functions can be used on Javascript program. @@ -91,6 +104,12 @@ To invoke the coreutils, use \code{\_G.shell.coreutils.*} \end{outline} +\section{Termination Check Injection} + +Due to the non-preemptive nature of the virtual machine, the termination\footnote{Default key combination: Shift+Ctrl+T+R} signal must be explicitly captured by the app, and taking care of it by yourself can be extremely tedious. Fortunately \thedos\ parses the user-written program and injects those checks accordingly. + +While- and For-loops are always have such checks injected, but the `read()` is not checked for the termination. + \chapter{Pipes} @@ -195,10 +214,10 @@ Functions: \end{outline} -\chapter{DOS Libraries} +\chapter{Input Event Handling} -\section{Input} +\thedos\ provides the library for handling the keyboard and mouse events. \dosnamespaceis{Input}{input} @@ -229,7 +248,9 @@ Input events are Javascript array of: $$ [\mathrm{event\ name,\ arg_1,\ arg_2 \c \2\argsynopsis{\argN{5}}{Y-position of the mouse cursor on the previous frame} \end{outline} -\section{GL} +\chapter{The Graphics Library} + +\thedos\ provides the library for drawing pixels to the screen. \dosnamespaceis{Graphics}{gl} diff --git a/tsvm_executable/src/net/torvald/tsvm/AppLoader.java b/tsvm_executable/src/net/torvald/tsvm/AppLoader.java index 2001c00..0353f62 100644 --- a/tsvm_executable/src/net/torvald/tsvm/AppLoader.java +++ b/tsvm_executable/src/net/torvald/tsvm/AppLoader.java @@ -14,8 +14,8 @@ public class AppLoader { public static String appTitle = "tsvm"; public static Lwjgl3ApplicationConfiguration appConfig; - public static int WIDTH = 1080;//810;//720; - public static int HEIGHT = 436;//360;//480; + public static int WIDTH = 1080;//640; + public static int HEIGHT = 436;//480; public static void main(String[] args) { ShaderProgram.pedantic = false; @@ -38,7 +38,7 @@ public class AppLoader { // VM vm = new VM(64 << 10, new TheRealWorld(), new VMProgramRom[]{OEMBios.INSTANCE, BasicRom.INSTANCE}); VM vm = new VM("./assets", 64 << 10, new TheRealWorld(), new VMProgramRom[]{TandemBios.INSTANCE, BasicRom.INSTANCE}, 2); // VM vm = new VM(128 << 10, new TheRealWorld(), new VMProgramRom[]{BasicBios.INSTANCE, WPBios.INSTANCE}); -// VM vm = new VM("./assets", 8192 << 10, new TheRealWorld(), new VMProgramRom[]{TsvmBios.INSTANCE}); +// VM vm = new VM("./assets", 8192 << 10, new TheRealWorld(), new VMProgramRom[]{TsvmBios.INSTANCE}, 8); // VM vm = new VM("./assets", 8192 << 10, new TheRealWorld(), new VMProgramRom[]{OpenBios.INSTANCE}, 8); // VM pipvm = new VM("./assets", 4096, new TheRealWorld(), new VMProgramRom[]{PipBios.INSTANCE, PipROM.INSTANCE}, 8);