From 15d3aeaeeaa6075a5a5397d510e17672b3bd3132 Mon Sep 17 00:00:00 2001 From: minjaesong Date: Tue, 6 Sep 2022 14:55:04 +0900 Subject: [PATCH] doc: coreutils for tvdos --- assets/disk0/tvdos/bin/command.js | 1 + doc/implementation.tex | 4 ++-- doc/tsvmman.idx | 30 ++++++++++++++++-------------- doc/tsvmman.ilg | 6 +++--- doc/tsvmman.ind | 28 +++++++++++++++------------- doc/tsvmman.tex | 6 ++++++ doc/tvdos.tex | 21 +++++++++++++++++++++ 7 files changed, 64 insertions(+), 32 deletions(-) diff --git a/assets/disk0/tvdos/bin/command.js b/assets/disk0/tvdos/bin/command.js index 21ec6dc..56b4135 100644 --- a/assets/disk0/tvdos/bin/command.js +++ b/assets/disk0/tvdos/bin/command.js @@ -465,6 +465,7 @@ shell.coreutils.erase = shell.coreutils.del shell.coreutils.rm = shell.coreutils.del shell.coreutils.ls = shell.coreutils.dir shell.coreutils.time = shell.coreutils.date +shell.coreutils.md = shell.coreutils.mkdir // end of command aliases Object.freeze(shell.coreutils) shell.stdio = { diff --git a/doc/implementation.tex b/doc/implementation.tex index 39c6fa2..00c3025 100644 --- a/doc/implementation.tex +++ b/doc/implementation.tex @@ -151,12 +151,12 @@ Sys library allows programmers to manipulate the system in low-level. \1\formalsynopsis{read}{}[String]{Reads a text the user has typed and returns is as a string. The reading will be terminated when the user hits the Return key.} \1\formalsynopsis{readNoEcho}{}[String]{Identical to \code{read} but the text the user is typing will not be printed to the screen.} \1\formalsynopsis{spin}{}[]{Do nothing for 4 miliseconds. Always use this function for busy-waiting as the virtual machine will hang without one.} -\1\formalsynopsis{waitForMemChg}{address: Int, andMask: Int, xorMask: Int}[]{Do nothing until a memory value is changed. More specifically, this function will \code{spin} while:\\$ (\textrm{peek}(addr)\ \textrm{xor}\ xorMask)\ \textrm{and}\ andMask = 0 $} +\1\formalsynopsis{waitForMemChg}{address: Int, andMask: Int, xorMask: Int}[]{Do nothing until a memory value is changed. More specifically, this function will \code{spin} while:$$ (\textrm{peek}(addr)\ \textrm{xor}\ xorMask)\ \textrm{and}\ andMask = 0 $$} \1\formalsynopsis{getSysRq}{}[Boolean]{Returns true if System Request key is down.} \1\formalsynopsis{unsetSysRq}{}{After using the System Request key, call this function to `release' the key so that other programs can use it.} \1\formalsynopsis{maxmem}{}[Int]{returns the size of the Scratchpad Memory in bytes.} \1\formalsynopsis{getUsedMem}{}[Int]{Returns how many memories can be \code{malloc}'d.} -\1\formalsynopsis{getMallocStatus}{}[IntArray(2)]{Returns the \code{malloc} status in following order:\\$ [Malloc\ unit\ size\ ,\ allocated\ block\ counts] $} +\1\formalsynopsis{getMallocStatus}{}[IntArray(2)]{Returns the \code{malloc} status in following order:$$ [Malloc\ unit\ size\ ,\ allocated\ block\ counts] $$} \end{outline} diff --git a/doc/tsvmman.idx b/doc/tsvmman.idx index 0212c9d..854589b 100644 --- a/doc/tsvmman.idx +++ b/doc/tsvmman.idx @@ -7,17 +7,19 @@ \indexentry{base64 (library)|hyperpage}{11} \indexentry{base64 (library)|hyperpage}{11} \indexentry{sys (library)|hyperpage}{12} -\indexentry{block communication|hyperpage}{14} -\indexentry{com (library)|hyperpage}{14} -\indexentry{com (library)|hyperpage}{14} -\indexentry{MMIO-com|hyperpage}{16} -\indexentry{keycodes|hyperpage}{18} -\indexentry{code page|hyperpage}{20} -\indexentry{colour palette|hyperpage}{22} -\indexentry{MMIO-graphics|hyperpage}{24} -\indexentry{boot process|hyperpage}{27} -\indexentry{filesystem (DOS)|hyperpage}{29} -\indexentry{file descriptor (DOS)|hyperpage}{29} -\indexentry{device file|hyperpage}{31} -\indexentry{input (DOS)|hyperpage}{33} -\indexentry{gl (DOS)|hyperpage}{33} +\indexentry{block communication|hyperpage}{15} +\indexentry{com (library)|hyperpage}{15} +\indexentry{com (library)|hyperpage}{15} +\indexentry{MMIO-com|hyperpage}{17} +\indexentry{keycodes|hyperpage}{19} +\indexentry{code page|hyperpage}{21} +\indexentry{colour palette|hyperpage}{23} +\indexentry{MMIO-graphics|hyperpage}{25} +\indexentry{boot process|hyperpage}{28} +\indexentry{commands (DOS)|hyperpage}{29} +\indexentry{coreutils (DOS)|hyperpage}{29} +\indexentry{filesystem (DOS)|hyperpage}{30} +\indexentry{file descriptor (DOS)|hyperpage}{30} +\indexentry{device file|hyperpage}{32} +\indexentry{input (DOS)|hyperpage}{34} +\indexentry{gl (DOS)|hyperpage}{34} diff --git a/doc/tsvmman.ilg b/doc/tsvmman.ilg index 96b09dc..3193d5b 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 (23 entries accepted, 0 rejected). -Sorting entries....done (101 comparisons). -Generating output file tsvmman.ind....done (51 lines written, 0 warnings). +Scanning input file tsvmman.idx....done (25 entries accepted, 0 rejected). +Sorting entries....done (120 comparisons). +Generating output file tsvmman.ind....done (53 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 cd6b723..c22607e 100644 --- a/doc/tsvmman.ind +++ b/doc/tsvmman.ind @@ -1,34 +1,36 @@ \begin{theindex} \item base64 (library), \hyperpage{11} - \item block communication, \hyperpage{14} - \item boot process, \hyperpage{27} + \item block communication, \hyperpage{15} + \item boot process, \hyperpage{28} \indexspace - \item code page, \hyperpage{20} - \item colour palette, \hyperpage{22} - \item com (library), \hyperpage{14} + \item code page, \hyperpage{21} + \item colour palette, \hyperpage{23} + \item com (library), \hyperpage{15} + \item commands (DOS), \hyperpage{29} \item con (library), \hyperpage{8} \item console (library), \hyperpage{8} + \item coreutils (DOS), \hyperpage{29} \indexspace - \item device file, \hyperpage{31} + \item device file, \hyperpage{32} \indexspace - \item file descriptor (DOS), \hyperpage{29} - \item filesystem (DOS), \hyperpage{29} + \item file descriptor (DOS), \hyperpage{30} + \item filesystem (DOS), \hyperpage{30} \indexspace - \item gl (DOS), \hyperpage{33} + \item gl (DOS), \hyperpage{34} \item gzip (library), \hyperpage{10} \indexspace - \item input (DOS), \hyperpage{33} + \item input (DOS), \hyperpage{34} \indexspace @@ -36,12 +38,12 @@ \indexspace - \item keycodes, \hyperpage{18} + \item keycodes, \hyperpage{19} \indexspace - \item MMIO-com, \hyperpage{16} - \item MMIO-graphics, \hyperpage{24} + \item MMIO-com, \hyperpage{17} + \item MMIO-graphics, \hyperpage{25} \indexspace diff --git a/doc/tsvmman.tex b/doc/tsvmman.tex index 7418dc5..6a5eab4 100644 --- a/doc/tsvmman.tex +++ b/doc/tsvmman.tex @@ -87,6 +87,12 @@ \textbf{#1}(#2)\IfNoValueF{#3}{: #3}\\#4% } +% usage: \inlinesynopsis{any name}{description} +% usage: \inlinesynopsis{function name}{arguments info}{description} +\NewDocumentCommand\dossynopsis{ommg}{% + \IfNoValueF{#1}{#1.}\textbf{#2}\IfNoValueTF{#4}{ --- #3}{ \textit{#3} --- #4}% +} + \newcommand\propertysynopsis[3]{\textbf{#1}: #2\\#3} \newcommand\argsynopsis[2]{\textbf{#1}: #2} diff --git a/doc/tvdos.tex b/doc/tvdos.tex index 991b036..05f0671 100644 --- a/doc/tvdos.tex +++ b/doc/tvdos.tex @@ -32,6 +32,27 @@ Variables can be set or changed using \textbf{SET} commands. \chapter{DOS Commands} +\index{commands (DOS)}\index{coreutils (DOS)}DOS commands are only valid under the DOS environment. + +To invoke the DOS commands from the Javascript-side, use:\\ \code{\_G.shell.coreutils.*} + +\begin{outline} +\1\dossynopsis{cat}{file}{Reads a file and pipes its contents to the pipe, or to the console if no pipes are specified.} +\1\dossynopsis{cd}{dir}{Change the current working directory. Alias: chdir} +\1\dossynopsis{cls}{Clears the text buffer and the framebuffer if available.} +\1\dossynopsis{cp}{from to}{Make copies of the specified file. The source file must not be a directory. Alias: copy} +\1\dossynopsis{date}{Prints the system date. Alias: time} +\1\dossynopsis{dir}{path}{Lists the contents of the specifed path, or the current working directory if no arguments were given. Alias: ls} +\1\dossynopsis{del}{file}{Deletes the file. Aliases: erase, rm} +\1\dossynopsis{echo}{text}{Print the given text or a variable.} +\1\dossynopsis{exit}{Exits the current command processor.} +\1\dossynopsis{mkdir}{path}{Creates a directory. Aliase: md} +\1\dossynopsis{rem}{Comment-out the line.} +\1\dossynopsis{set}{key=value}{Sets the global variable \code{key} to \code{value}, or displays the list of global variables if no arguments were given.} +\1\dossynopsis{ver}{Prints the version of \thedos.} +\end{outline} + + \chapter{File I/O} \index{filesystem (DOS)}In \thedos, drives are assigned with a drive letter, and the drive currently booted on is always drive \textbf{A}.