doc: dos input

This commit is contained in:
minjaesong
2022-09-06 19:11:08 +09:00
parent 26a5d4af5d
commit 8232053695
6 changed files with 51 additions and 27 deletions

View File

@@ -153,12 +153,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:$$ (\mathrm{peek}(addr)\ \mathrm{xor}\ xorMask)\ \mathrm{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:$$ [\mathrm{Malloc\ unit\ size,\ allocated\ block\ counts}] $$}
\end{outline}

View File

@@ -25,4 +25,4 @@
\indexentry{file descriptor (DOS)|hyperpage}{34}
\indexentry{device file|hyperpage}{36}
\indexentry{input (DOS)|hyperpage}{38}
\indexentry{gl (DOS)|hyperpage}{38}
\indexentry{gl (DOS)|hyperpage}{39}

View File

@@ -25,7 +25,7 @@
\indexspace
\item gl (DOS), \hyperpage{38}
\item gl (DOS), \hyperpage{39}
\item graphics (library), \hyperpage{26}
\item gzip (library), \hyperpage{11}

View File

@@ -203,6 +203,8 @@
\newcommand{\thepublishingdate}{0000-00-00}
\newcommand{\oreallypress}{\begingroup\hspace{0.083em}\large\textbf{O'REALLY\raisebox{1ex}{\scriptsize ?}} \large Press\endgroup}
\newcommand{\argN}[1]{arg\textsubscript{#1}}
\title{\vskip56pt \includegraphics[width=0.555\textwidth]{tsvmlogo_large} \vskip3pt \titlefont\Huge\textbf{PROGRAMMING GUIDE} \\ \Large \vspace{1.2em} For Version \tsvmver\hspace{0.75em}|\hspace{0.75em}\theedition}
\date{}
\author{}

View File

@@ -102,7 +102,7 @@ Named pipes can be retrieved on \code{\_G.shell.pipes.*}
\section{The File Descriptor}
\index{file descriptor (DOS)}A file is virtualised through the \emph{file descriptor} which provides the functions to manipulate the file. Do note that when a file descriptor is created, the file is not yet opened by the drive.
To create a file descriptor, use the provided function \code{files.open(fullpath)}. \code{fullpath} is a fully qualified path of the file that includes the drive letter.
To create a file descriptor, use the provided function \code{files.open(fullPath)}. \code{fullPath} is a fully qualified path of the file that includes the drive letter.
\section{Manipulating a File}
A file has folliwing properties and can be manipulated using following functions:
@@ -112,7 +112,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{fullpath}{String}{Returns a fully qualified path (including the drive letter) of the file. Paths are 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.}
\1\propertysynopsis{isDirectory}{Boolean}{Returns true if the path is a directory.}
@@ -147,7 +147,7 @@ Functions:
\section{The Device Files}
\index{device file}Some devices are also virtualised through the file descriptor, and they are given a special path. (their fullpath does not contain a drive letter)
\index{device file}Some devices are also virtualised through the file descriptor, and they are given a special path. (their fullPath does not contain a drive letter)
\begin{outline}
\1\inlinesynopsis{RND}{returns random bytes upon reading}
@@ -167,7 +167,6 @@ Functions:
\2\argsynopsis{swrite}{identical to \code{print()}.}
\1\inlinesynopsis{FBIPF}{decodes IPF-formatted image to the framebuffer. Use the \emph{Graphics} library for the encoding.}
\2\argsynopsis{pwrite, bwrite}{decodes the given IPF binary data. Offsets and counts for \code{pwrite} are ignored.}
\end{outline}
@@ -179,9 +178,31 @@ Functions:
\dosnamespaceis{Input}{input}
\begin{outline}
\1\inlinesynopsis{changeKeyLayout}{layoutName}{Changes the key layout. The key layout file must be stored as \code{A:/tvdos/layoutName.key}}
\1\inlinesynopsis{withEvent}{callback}{Invokes the callback function when an input event is available.}
\end{outline}
\subsection{Input Events}
Input events are Javascript array of: $$ [\mathrm{event\ name,\ arg_1,\ arg_2 \cdots arg_n}] $$, where:
\begin{outline}
\1event name --- one of following: \textbf{key\_down}, \textbf{mouse\_down}, \textbf{mouse\_move}
\1arguments for \textbf{key\_down}:
\2\argsynopsis{\argN{1}}{Key Symbol (string) of the head key}
\2\argsynopsis{\argN{2}}{Repeat count of the key event}
\2\argsynopsis{\argN{3}..\argN{10}}{The keycodes of the pressed keys}
\1arguments for \textbf{mouse\_down}:
\2\argsynopsis{\argN{1}}{X-position of the mouse cursor}
\2\argsynopsis{\argN{2}}{Y-position of the mouse cursor}
\2\argsynopsis{\argN{3}}{Always the integer 1.}
\1arguments for \textbf{mouse\_move}:
\2\argsynopsis{\argN{1}}{X-position of the mouse cursor}
\2\argsynopsis{\argN{2}}{Y-position of the mouse cursor}
\2\argsynopsis{\argN{3}}{1 if the mouse button is held down (i.e. dragging), 0 otherwise}
\2\argsynopsis{\argN{4}}{X-position of the mouse cursor on the previous frame (previous V-blank of the screen)}
\2\argsynopsis{\argN{5}}{Y-position of the mouse cursor on the previous frame}
\end{outline}
\section{GL}