documentation wip

This commit is contained in:
minjaesong
2021-09-24 16:18:08 +09:00
parent f7631619d3
commit 4bc666b627
14 changed files with 838 additions and 1 deletions

View File

@@ -432,8 +432,9 @@ shell.execute = function(line) {
errorlevel = SIGTERM.name;
else if (e instanceof IllegalAccessException || `${e}`.startsWith("net.torvald.tsvm.ErrorIllegalAccess"))
errorlevel = SIGSEGV.name;
// exception catched means something went wrong, so if errorlevel is found to be zero, force set to 1.
else
if (errorlevel === 0 || errorlevel == undefined)
errorlevel = 1;
}
finally {

3
doc/bibliography.tex Normal file
View File

@@ -0,0 +1,3 @@
\begin{itemlist}
\item Song, Minjae. 2021. ``Terran BASIC Reference Manual for Language Version 1.2, Third Edition''.
\end{itemlist}

4
doc/changesmeta.tex Normal file
View File

@@ -0,0 +1,4 @@
\chapter{Version Changes}
\input{changes1.2}
\input{changes1.1}

506
doc/implementation.tex Normal file
View File

@@ -0,0 +1,506 @@
\chapter{Serial Communication}
Some pheripherals such as disk drives are connected through the ``Serial Communication''.
Unlike the name suggests, Serial Communication is not at all \emph{serial}; it's more like a \emph{block commuication}.
\section{Concept of Block Communication}
Sender and Receiver are somehow connected and the commuication channel between two devices are open as long as both sides are connected and being recognised. There are two blocks per port: send-block and receive-block, and the contents of the blocks are memory-mapped\footnote{Both blocks are mapped to the same port; writing to the address writes to the send-block while reading reads from the receive-block. Reading from write-block or writing to the read-block is not possible}. \emph{Write} writes sender's send-block onto the receiver's receive-block while \emph{Read} pulls the message from the receiver's send-block and writes to sender's receive-block.
While read/write is being processed, each side emits ``busy'' flag indicating they are \emph{busy}. Sending/receiving data while one side is busy is considered as an undefined behaviour.
The status flags and blocks are memory-mapped to these address:
\footnote{RW stands for read-write status. RW means both reading and writing is posseble, RO means it's read-only}
\begin{tabulary}{\textwidth}{rcL}
Address & RW & Description \\
\hline
-4077 & RW & Status Code (-128--127) for Writing Port 1 \\
-4078 & RW & Status Code (-128--127) for Writing Port 2 \\
-4079 & RW & Status Code (-128--127) for Writing Port 3 \\
-4080 & RW & Status Code (-128--127) for Writing Port 4 \\
-4081 & RO & Status Code (-128--127) of the Receiver 1 \\
-4082 & RO & Status Code (-128--127) of the Receiver 2 \\
-4083 & RO & Status Code (-128--127) of the Receiver 3 \\
-4084 & RO & Status Code (-128--127) of the Receiver 4 \\
-4085..-4086 & RO & Transfer Status Bits for Port 1 \\
-4087..-4088 & RO & Transfer Status Bits for Port 2 \\
-4089..-4090 & RO & Transfer Status Bits for Port 3 \\
-4091..-4092 & RO & Transfer Status Bits for Port 4 \\
-4093 & RW & Transfer Control for Port 1 \\
-4094 & RW & Transfer Control for Port 1 \\
-4095 & RW & Transfer Control for Port 1 \\
-4096 & RW & Transfer Control for Port 1 \\
-4097..-8192 & RW & Message Block for Port 1 \\
-8193..-12288 & RW & Message Block for Port 2 \\
-12289..-16384 & RW & Message Block for Port 3 \\
-16385..-20480 & RW & Message Block for Port 4
\end{tabulary}
\chapter{Human Interface}
\section{Keycodes}
\index{keycodes}This is a table of keycodes recognised by the LibGDX, a framework that \thismachine\ runs on.
\begin{longtable}{*{2}{m{\textwidth}}}\hline
\endfirsthead
\endhead
\endfoot
\hline
\endlastfoot
\centering
\begin{tabulary}{\textwidth}{rl}
Key & Code \\
\hline
\ttfamily{1} & 8 \\
\ttfamily{2} & 9 \\
\ttfamily{3} & 10 \\
\ttfamily{4} & 11 \\
\ttfamily{5} & 12 \\
\ttfamily{6} & 13 \\
\ttfamily{7} & 14 \\
\ttfamily{8} & 15 \\
\ttfamily{9} & 16 \\
\ttfamily{0} & 17 \\
$\hookleftarrow$ & 66 \\
\condensedfont{BkSp} & 67 \\
\condensedfont{Tab} & 61 \\
\ttfamily{`} & 68 \\
\ttfamily{'} & 75 \\
\ttfamily{;} & 43 \\
\ttfamily{,} & 55 \\
\ttfamily{.} & 56 \\
\ttfamily{/} & 76 \\
\ttfamily{[}\hspace*{0.083em} & 71 \\
\ttfamily{]}\hspace*{-0.083em} & 72 \\
\ttfamily{-} & 69 \\
\end{tabulary}
\begin{tabulary}{\textwidth}{rl}
Key & Code \\
\hline
\ttfamily{+} & 70 \\
\ttfamily{A} & 29 \\
\ttfamily{B} & 30 \\
\ttfamily{C} & 31 \\
\ttfamily{D} & 32\\
\ttfamily{E} & 33 \\
\ttfamily{F} & 34 \\
\ttfamily{G} & 35 \\
\ttfamily{H} & 36 \\
\ttfamily{I} & 37 \\
\ttfamily{J} & 38 \\
\ttfamily{K} & 39 \\
\ttfamily{L} & 40 \\
\ttfamily{M} & 41 \\
\ttfamily{N} & 42 \\
\ttfamily{O} & 43 \\
\ttfamily{P} & 44 \\
\ttfamily{Q} & 45 \\
\ttfamily{R} & 46 \\
\ttfamily{S} & 47 \\
\ttfamily{T} & 48 \\
\ttfamily{U} & 49 \\
\end{tabulary}
\begin{tabulary}{\textwidth}{rl}
Key & Code \\
\hline
\ttfamily{V} & 50 \\
\ttfamily{W} & 51 \\
\ttfamily{X} & 52 \\
\ttfamily{Y} & 53 \\
\ttfamily{Z} & 54 \\
\condensedfont{LCtrl} & 57 \\
\condensedfont{RCtrl} & 58 \\
\condensedfont{LShift} & 59 \\
\condensedfont{RShift} & 60 \\
\condensedfont{LAlt} & 129 \\
\condensedfont{RAlt} & 130 \\
$\uparrow$ & 19 \\
$\downarrow$ & 20 \\
$\leftarrow$ & 21 \\
$\rightarrow$ & 22 \\
\condensedfont{Ins} & 133 \\
\condensedfont{Del} & 112 \\
\condensedfont{PgUp} & 92 \\
\condensedfont{PgDn} & 93 \\
\condensedfont{Home} & 3 \\
\condensedfont{End} & 132 \\
F1 & 244 \\
\end{tabulary}
\begin{tabulary}{\textwidth}{rl}
Key & Code \\
\hline
F2 & 245 \\
F3 & 246 \\
F4 & 247 \\
F5 & 248 \\
F6 & 249 \\
F7 & 250 \\
F8 & 251 \\
F9 & 252 \\
F10 & 253 \\
F11 & 254 \\
\condensedfont{Num} \ttfamily{0} & 144 \\
\condensedfont{Num} \ttfamily{1} & 145 \\
\condensedfont{Num} \ttfamily{2} & 146 \\
\condensedfont{Num} \ttfamily{3} & 147 \\
\condensedfont{Num} \ttfamily{4} & 148 \\
\condensedfont{Num} \ttfamily{5} & 149 \\
\condensedfont{Num} \ttfamily{6} & 150 \\
\condensedfont{Num} \ttfamily{7} & 151 \\
\condensedfont{Num} \ttfamily{8} & 152 \\
\condensedfont{Num} \ttfamily{9} & 153 \\
\condensedfont{NumLk} & 78 \\
\ttfamily{*} & 17 \\
\end{tabulary}
\end{longtable}
Keys not listed on the table may not be available depending on the system, for example, F12 may not be recognised.
\chapter{Text and Graphics Display}
\section{Code Page}
\label{codepage}
\index{code page}By default \thismachine\ uses slightly modified version of CP-437, this is a character map of it:
{\centering
\includegraphics[width=\linewidth]{tsvmcp.png}
\captionof{figure}{\thismachine\ Character Map}
\label{fig:codepage}
}
\newpage
\section{Colour Palette}
\label{colourpalette}
\index{colour palette}By default the reference graphics adapter of the \thismachine\ uses following colour palette:
{\centering
\includegraphics[width=\linewidth]{tsvmpal.png}
\captionof{figure}{\thismachine\ Colour Palette}
\label{fig:codepage}
}
{\centering
\fontsize{7pt}{0pt} % second argument is baselineskip but it's useless in table
\newlength{\extrarowheighttwo}
\setlength{\extrarowheighttwo}{\extrarowheight}
\setlength{\extrarowheight}{-0.4ex}
\begin{longtable}{*{2}{m{\textwidth}}}\hline
\endfirsthead
\endhead
\endfoot
\hline
\endlastfoot
\centering
\begin{tabulary}{\textwidth}{rl}
{\ttfamily 0} & {\ttfamily \#000F} \\
{\ttfamily 1} & {\ttfamily \#004F} \\
{\ttfamily 2} & {\ttfamily \#008F} \\
{\ttfamily 3} & {\ttfamily \#00BF} \\
{\ttfamily 4} & {\ttfamily \#00FF} \\
{\ttfamily 5} & {\ttfamily \#020F} \\
{\ttfamily 6} & {\ttfamily \#024F} \\
{\ttfamily 7} & {\ttfamily \#028F} \\
{\ttfamily 8} & {\ttfamily \#02BF} \\
{\ttfamily 9} & {\ttfamily \#02FF} \\
{\ttfamily 10} & {\ttfamily \#040F} \\
{\ttfamily 11} & {\ttfamily \#044F} \\
{\ttfamily 12} & {\ttfamily \#048F} \\
{\ttfamily 13} & {\ttfamily \#04BF} \\
{\ttfamily 14} & {\ttfamily \#04FF} \\
{\ttfamily 15} & {\ttfamily \#060F} \\
{\ttfamily 16} & {\ttfamily \#064F} \\
{\ttfamily 17} & {\ttfamily \#068F} \\
{\ttfamily 18} & {\ttfamily \#06BF} \\
{\ttfamily 19} & {\ttfamily \#06FF} \\
{\ttfamily 20} & {\ttfamily \#090F} \\
{\ttfamily 21} & {\ttfamily \#094F} \\
{\ttfamily 22} & {\ttfamily \#098F} \\
{\ttfamily 23} & {\ttfamily \#09BF} \\
{\ttfamily 24} & {\ttfamily \#09FF} \\
{\ttfamily 25} & {\ttfamily \#0B0F} \\
{\ttfamily 26} & {\ttfamily \#0B4F} \\
{\ttfamily 27} & {\ttfamily \#0B8F} \\
{\ttfamily 28} & {\ttfamily \#0BBF} \\
{\ttfamily 29} & {\ttfamily \#0BFF} \\
{\ttfamily 30} & {\ttfamily \#0D0F} \\
{\ttfamily 31} & {\ttfamily \#0D4F} \\
{\ttfamily 32} & {\ttfamily \#0D8F} \\
{\ttfamily 33} & {\ttfamily \#0DBF} \\
{\ttfamily 34} & {\ttfamily \#0DFF} \\
{\ttfamily 35} & {\ttfamily \#0F0F} \\
{\ttfamily 36} & {\ttfamily \#0F4F} \\
{\ttfamily 37} & {\ttfamily \#0F8F} \\
{\ttfamily 38} & {\ttfamily \#0FBF} \\
{\ttfamily 39} & {\ttfamily \#0FFF} \\
{\ttfamily 40} & {\ttfamily \#300F} \\
{\ttfamily 41} & {\ttfamily \#304F} \\
{\ttfamily 42} & {\ttfamily \#308F} \\
\end{tabulary}
\begin{tabulary}{\textwidth}{|rl}
{\ttfamily 43} & {\ttfamily \#30BF} \\
{\ttfamily 44} & {\ttfamily \#30FF} \\
{\ttfamily 45} & {\ttfamily \#320F} \\
{\ttfamily 46} & {\ttfamily \#324F} \\
{\ttfamily 47} & {\ttfamily \#328F} \\
{\ttfamily 48} & {\ttfamily \#32BF} \\
{\ttfamily 49} & {\ttfamily \#32FF} \\
{\ttfamily 50} & {\ttfamily \#340F} \\
{\ttfamily 51} & {\ttfamily \#344F} \\
{\ttfamily 52} & {\ttfamily \#348F} \\
{\ttfamily 53} & {\ttfamily \#34BF} \\
{\ttfamily 54} & {\ttfamily \#34FF} \\
{\ttfamily 55} & {\ttfamily \#360F} \\
{\ttfamily 56} & {\ttfamily \#364F} \\
{\ttfamily 57} & {\ttfamily \#368F} \\
{\ttfamily 58} & {\ttfamily \#36BF} \\
{\ttfamily 59} & {\ttfamily \#36FF} \\
{\ttfamily 60} & {\ttfamily \#390F} \\
{\ttfamily 61} & {\ttfamily \#394F} \\
{\ttfamily 62} & {\ttfamily \#398F} \\
{\ttfamily 63} & {\ttfamily \#39BF} \\
{\ttfamily 64} & {\ttfamily \#39FF} \\
{\ttfamily 65} & {\ttfamily \#3B0F} \\
{\ttfamily 66} & {\ttfamily \#3B4F} \\
{\ttfamily 67} & {\ttfamily \#3B8F} \\
{\ttfamily 68} & {\ttfamily \#3BBF} \\
{\ttfamily 69} & {\ttfamily \#3BFF} \\
{\ttfamily 70} & {\ttfamily \#3D0F} \\
{\ttfamily 71} & {\ttfamily \#3D4F} \\
{\ttfamily 72} & {\ttfamily \#3D8F} \\
{\ttfamily 73} & {\ttfamily \#3DBF} \\
{\ttfamily 74} & {\ttfamily \#3DFF} \\
{\ttfamily 75} & {\ttfamily \#3F0F} \\
{\ttfamily 76} & {\ttfamily \#3F4F} \\
{\ttfamily 77} & {\ttfamily \#3F8F} \\
{\ttfamily 78} & {\ttfamily \#3FBF} \\
{\ttfamily 79} & {\ttfamily \#3FFF} \\
{\ttfamily 80} & {\ttfamily \#600F} \\
{\ttfamily 81} & {\ttfamily \#604F} \\
{\ttfamily 82} & {\ttfamily \#608F} \\
{\ttfamily 83} & {\ttfamily \#60BF} \\
{\ttfamily 84} & {\ttfamily \#60FF} \\
{\ttfamily 85} & {\ttfamily \#620F} \\
\end{tabulary}
\begin{tabulary}{\textwidth}{|rl}
{\ttfamily 86} & {\ttfamily \#624F} \\
{\ttfamily 87} & {\ttfamily \#628F} \\
{\ttfamily 88} & {\ttfamily \#62BF} \\
{\ttfamily 89} & {\ttfamily \#62FF} \\
{\ttfamily 90} & {\ttfamily \#640F} \\
{\ttfamily 91} & {\ttfamily \#644F} \\
{\ttfamily 92} & {\ttfamily \#648F} \\
{\ttfamily 93} & {\ttfamily \#64BF} \\
{\ttfamily 94} & {\ttfamily \#64FF} \\
{\ttfamily 95} & {\ttfamily \#660F} \\
{\ttfamily 96} & {\ttfamily \#664F} \\
{\ttfamily 97} & {\ttfamily \#668F} \\
{\ttfamily 98} & {\ttfamily \#66BF} \\
{\ttfamily 99} & {\ttfamily \#66FF} \\
{\ttfamily 100} & {\ttfamily \#690F} \\
{\ttfamily 101} & {\ttfamily \#694F} \\
{\ttfamily 102} & {\ttfamily \#698F} \\
{\ttfamily 103} & {\ttfamily \#69BF} \\
{\ttfamily 104} & {\ttfamily \#69FF} \\
{\ttfamily 105} & {\ttfamily \#6B0F} \\
{\ttfamily 106} & {\ttfamily \#6B4F} \\
{\ttfamily 107} & {\ttfamily \#6B8F} \\
{\ttfamily 108} & {\ttfamily \#6BBF} \\
{\ttfamily 109} & {\ttfamily \#6BFF} \\
{\ttfamily 110} & {\ttfamily \#6D0F} \\
{\ttfamily 111} & {\ttfamily \#6D4F} \\
{\ttfamily 112} & {\ttfamily \#6D8F} \\
{\ttfamily 113} & {\ttfamily \#6DBF} \\
{\ttfamily 114} & {\ttfamily \#6DFF} \\
{\ttfamily 115} & {\ttfamily \#6F0F} \\
{\ttfamily 116} & {\ttfamily \#6F4F} \\
{\ttfamily 117} & {\ttfamily \#6F8F} \\
{\ttfamily 118} & {\ttfamily \#6FBF} \\
{\ttfamily 119} & {\ttfamily \#6FFF} \\
{\ttfamily 120} & {\ttfamily \#900F} \\
{\ttfamily 121} & {\ttfamily \#904F} \\
{\ttfamily 122} & {\ttfamily \#908F} \\
{\ttfamily 123} & {\ttfamily \#90BF} \\
{\ttfamily 124} & {\ttfamily \#90FF} \\
{\ttfamily 125} & {\ttfamily \#920F} \\
{\ttfamily 126} & {\ttfamily \#924F} \\
{\ttfamily 127} & {\ttfamily \#928F} \\
{\ttfamily 128} & {\ttfamily \#92BF} \\
\end{tabulary}
\begin{tabulary}{\textwidth}{|rl}
{\ttfamily 129} & {\ttfamily \#92FF} \\
{\ttfamily 130} & {\ttfamily \#940F} \\
{\ttfamily 131} & {\ttfamily \#944F} \\
{\ttfamily 132} & {\ttfamily \#948F} \\
{\ttfamily 133} & {\ttfamily \#94BF} \\
{\ttfamily 134} & {\ttfamily \#94FF} \\
{\ttfamily 135} & {\ttfamily \#960F} \\
{\ttfamily 136} & {\ttfamily \#964F} \\
{\ttfamily 137} & {\ttfamily \#968F} \\
{\ttfamily 138} & {\ttfamily \#96BF} \\
{\ttfamily 139} & {\ttfamily \#96FF} \\
{\ttfamily 140} & {\ttfamily \#990F} \\
{\ttfamily 141} & {\ttfamily \#994F} \\
{\ttfamily 142} & {\ttfamily \#998F} \\
{\ttfamily 143} & {\ttfamily \#99BF} \\
{\ttfamily 144} & {\ttfamily \#99FF} \\
{\ttfamily 145} & {\ttfamily \#9B0F} \\
{\ttfamily 146} & {\ttfamily \#9B4F} \\
{\ttfamily 147} & {\ttfamily \#9B8F} \\
{\ttfamily 148} & {\ttfamily \#9BBF} \\
{\ttfamily 149} & {\ttfamily \#9BFF} \\
{\ttfamily 150} & {\ttfamily \#9D0F} \\
{\ttfamily 151} & {\ttfamily \#9D4F} \\
{\ttfamily 152} & {\ttfamily \#9D8F} \\
{\ttfamily 153} & {\ttfamily \#9DBF} \\
{\ttfamily 154} & {\ttfamily \#9DFF} \\
{\ttfamily 155} & {\ttfamily \#9F0F} \\
{\ttfamily 156} & {\ttfamily \#9F4F} \\
{\ttfamily 157} & {\ttfamily \#9F8F} \\
{\ttfamily 158} & {\ttfamily \#9FBF} \\
{\ttfamily 159} & {\ttfamily \#9FFF} \\
{\ttfamily 160} & {\ttfamily \#C00F} \\
{\ttfamily 161} & {\ttfamily \#C04F} \\
{\ttfamily 162} & {\ttfamily \#C08F} \\
{\ttfamily 163} & {\ttfamily \#C0BF} \\
{\ttfamily 164} & {\ttfamily \#C0FF} \\
{\ttfamily 165} & {\ttfamily \#C20F} \\
{\ttfamily 166} & {\ttfamily \#C24F} \\
{\ttfamily 167} & {\ttfamily \#C28F} \\
{\ttfamily 168} & {\ttfamily \#C2BF} \\
{\ttfamily 169} & {\ttfamily \#C2FF} \\
{\ttfamily 170} & {\ttfamily \#C40F} \\
{\ttfamily 171} & {\ttfamily \#C44F} \\
\end{tabulary}
\begin{tabulary}{\textwidth}{|rl}
{\ttfamily 172} & {\ttfamily \#C48F} \\
{\ttfamily 173} & {\ttfamily \#C4BF} \\
{\ttfamily 174} & {\ttfamily \#C4FF} \\
{\ttfamily 175} & {\ttfamily \#C60F} \\
{\ttfamily 176} & {\ttfamily \#C64F} \\
{\ttfamily 177} & {\ttfamily \#C68F} \\
{\ttfamily 178} & {\ttfamily \#C6BF} \\
{\ttfamily 179} & {\ttfamily \#C6FF} \\
{\ttfamily 180} & {\ttfamily \#C90F} \\
{\ttfamily 181} & {\ttfamily \#C94F} \\
{\ttfamily 182} & {\ttfamily \#C98F} \\
{\ttfamily 183} & {\ttfamily \#C9BF} \\
{\ttfamily 184} & {\ttfamily \#C9FF} \\
{\ttfamily 185} & {\ttfamily \#CB0F} \\
{\ttfamily 186} & {\ttfamily \#CB4F} \\
{\ttfamily 187} & {\ttfamily \#CB8F} \\
{\ttfamily 188} & {\ttfamily \#CBBF} \\
{\ttfamily 189} & {\ttfamily \#CBFF} \\
{\ttfamily 190} & {\ttfamily \#CD0F} \\
{\ttfamily 191} & {\ttfamily \#CD4F} \\
{\ttfamily 192} & {\ttfamily \#CD8F} \\
{\ttfamily 193} & {\ttfamily \#CDBF} \\
{\ttfamily 194} & {\ttfamily \#CDFF} \\
{\ttfamily 195} & {\ttfamily \#CF0F} \\
{\ttfamily 196} & {\ttfamily \#CF4F} \\
{\ttfamily 197} & {\ttfamily \#CF8F} \\
{\ttfamily 198} & {\ttfamily \#CFBF} \\
{\ttfamily 199} & {\ttfamily \#CFFF} \\
{\ttfamily 200} & {\ttfamily \#F00F} \\
{\ttfamily 201} & {\ttfamily \#F04F} \\
{\ttfamily 202} & {\ttfamily \#F08F} \\
{\ttfamily 203} & {\ttfamily \#F0BF} \\
{\ttfamily 204} & {\ttfamily \#F0FF} \\
{\ttfamily 205} & {\ttfamily \#F20F} \\
{\ttfamily 206} & {\ttfamily \#F24F} \\
{\ttfamily 207} & {\ttfamily \#F28F} \\
{\ttfamily 208} & {\ttfamily \#F2BF} \\
{\ttfamily 209} & {\ttfamily \#F2FF} \\
{\ttfamily 210} & {\ttfamily \#F40F} \\
{\ttfamily 211} & {\ttfamily \#F44F} \\
{\ttfamily 212} & {\ttfamily \#F48F} \\
{\ttfamily 213} & {\ttfamily \#F4BF} \\
{\ttfamily 214} & {\ttfamily \#F4FF} \\
\end{tabulary}
\begin{tabulary}{\textwidth}{|rl}
{\ttfamily 215} & {\ttfamily \#F60F} \\
{\ttfamily 216} & {\ttfamily \#F64F} \\
{\ttfamily 217} & {\ttfamily \#F68F} \\
{\ttfamily 218} & {\ttfamily \#F6BF} \\
{\ttfamily 219} & {\ttfamily \#F6FF} \\
{\ttfamily 220} & {\ttfamily \#F90F} \\
{\ttfamily 221} & {\ttfamily \#F94F} \\
{\ttfamily 222} & {\ttfamily \#F98F} \\
{\ttfamily 223} & {\ttfamily \#F9BF} \\
{\ttfamily 224} & {\ttfamily \#F9FF} \\
{\ttfamily 225} & {\ttfamily \#FB0F} \\
{\ttfamily 226} & {\ttfamily \#FB4F} \\
{\ttfamily 227} & {\ttfamily \#FB8F} \\
{\ttfamily 228} & {\ttfamily \#FBBF} \\
{\ttfamily 229} & {\ttfamily \#FBFF} \\
{\ttfamily 230} & {\ttfamily \#FD0F} \\
{\ttfamily 231} & {\ttfamily \#FD4F} \\
{\ttfamily 232} & {\ttfamily \#FD8F} \\
{\ttfamily 233} & {\ttfamily \#FDBF} \\
{\ttfamily 234} & {\ttfamily \#FDFF} \\
{\ttfamily 235} & {\ttfamily \#FF0F} \\
{\ttfamily 236} & {\ttfamily \#FF4F} \\
{\ttfamily 237} & {\ttfamily \#FF8F} \\
{\ttfamily 238} & {\ttfamily \#FFBF} \\
{\ttfamily 239} & {\ttfamily \#FFFF} \\
{\ttfamily 240} & {\ttfamily \#000F} \\
{\ttfamily 241} & {\ttfamily \#111F} \\
{\ttfamily 242} & {\ttfamily \#222F} \\
{\ttfamily 243} & {\ttfamily \#333F} \\
{\ttfamily 244} & {\ttfamily \#444F} \\
{\ttfamily 245} & {\ttfamily \#555F} \\
{\ttfamily 246} & {\ttfamily \#666F} \\
{\ttfamily 247} & {\ttfamily \#777F} \\
{\ttfamily 248} & {\ttfamily \#888F} \\
{\ttfamily 249} & {\ttfamily \#999F} \\
{\ttfamily 250} & {\ttfamily \#AAAF} \\
{\ttfamily 251} & {\ttfamily \#BBBF} \\
{\ttfamily 252} & {\ttfamily \#CCCF} \\
{\ttfamily 253} & {\ttfamily \#DDDF} \\
{\ttfamily 254} & {\ttfamily \#EEEF} \\
{\ttfamily 255} & {\ttfamily \#0000} \\
\, & \, \\
\, & \, \\
\end{tabulary}
\end{longtable}
\captionof{table}{Index--RGBA Table of the Colour Palette}
}
\setlength{\extrarowheight}{\extrarowheighttwo}
\section{Graphics MMIO}
\begin{tabulary}{\textwidth}{rL}
Address & Description \\
\hline
-1048577..-1299456 & Screen Buffer \\
-1299457 & Screen Background RED \\
-1299458 & Screen Background GREEN \\
-1299459 & Screen Background BLUE \\
-1299460 & Command \\
-1299461..-1299472 & Command Arguments \\
-1299473..-1299474 & Screen Buffer Scroll Offset X \\
-1299475..-1299476 & Screen Buffer Scroll Offset Y \\
-1302527..-1302528 & Text Cursor Position in $row \times 80 + col$, stored in Little Endian \\
-1302529..-1305088 & Text Foreground Colours \\
-1305089..-1307648 & Text Background Colours \\
-1307649..-1310208 & Text Buffer \\
-1310209..-1310720 & Palettes in This Pattern: {\ttfamily 0b RRRR GGGG; 0b BBBB AAAA} \\
\end{tabulary}

3
doc/intro.tex Normal file
View File

@@ -0,0 +1,3 @@
\thismachine\ is a virtual machine programmable using mainly, but not limited to, Javascript, and can have 7 virtual peripherals that can be communicated using MMIOs exclusively. \thismachine\ has default graphics of 80-column 32-rows text mode with one 560\times448 pixels framebuffer with 256 palette colours with 4096 colours to choose from.
This is the documentation for \thismachine\ \tsvmver.

23
doc/makepdf.sh Executable file
View File

@@ -0,0 +1,23 @@
#!/bin/bash
export LC_ALL="en_US.UTF-8"
TEXJOBNAME=tsvmman
echo "Making pdfs from dot-graph"
for f in *.dot; do
echo $f;
dot -Tpdf -o ${f%.*}.pdf $f;
done
rm $TEXJOBNAME.idx
rm $TEXJOBNAME.ind
rm $TEXJOBNAME.toc
rm $TEXJOBNAME.ilg
rm $TEXJOBNAME.aux
# we REALLY need triple-compilation here because LaTeX, otherwise 'constants' will point to p.24 when it should be p.26
lualatex $TEXJOBNAME.tex
lualatex $TEXJOBNAME.tex
makeindex $TEXJOBNAME
lualatex $TEXJOBNAME.tex

15
doc/meta.tex Normal file
View File

@@ -0,0 +1,15 @@
\chapter*{\ }
\copyright\ 2021-- \ Minjae Song (``CuriousTorvald'')
Copyrighted under the terms of MIT License
\oreallypress, Cyberworld
\quad\\
\begin{center}
\begin{tabulary}{\textwidth}{ll}
Zeroth Edition (for version 1.0): & \thepublishingdate
\end{tabulary}
\end{center}

BIN
doc/tsvmcp.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

3
doc/tsvmman.idx Normal file
View File

@@ -0,0 +1,3 @@
\indexentry{keycodes|hyperpage}{10}
\indexentry{code page|hyperpage}{11}
\indexentry{colour palette|hyperpage}{12}

6
doc/tsvmman.ilg Normal file
View File

@@ -0,0 +1,6 @@
This is makeindex, version 2.15 [TeX Live 2021] (kpathsea + Thai support).
Scanning input file tsvmman.idx....done (3 entries accepted, 0 rejected).
Sorting entries....done (5 comparisons).
Generating output file tsvmman.ind....done (10 lines written, 0 warnings).
Output written in tsvmman.ind.
Transcript written in tsvmman.ilg.

10
doc/tsvmman.ind Normal file
View File

@@ -0,0 +1,10 @@
\begin{theindex}
\item code page, \hyperpage{11}
\item colour palette, \hyperpage{12}
\indexspace
\item keycodes, \hyperpage{10}
\end{theindex}

256
doc/tsvmman.tex Normal file
View File

@@ -0,0 +1,256 @@
% !TEX TS-program = LuaLaTeX
%% Copyright (c) 2021 CuriousTorvald.
\documentclass[10pt, stock, openany, chapter]{memoir}
\usepackage{fontspec}
\setmainfont[Ligatures=TeX]{TeX Gyre Heros}
\newfontfamily\condensedfont{TeX Gyre Heros Cn}
\newfontfamily\monofont[Ligatures={NoCommon, NoDiscretionary, NoHistoric, NoRequired, NoContextual}]{TeX Gyre Cursor}
\usepackage{fapapersize}
\usefapapersize{148mm,210mm,15mm,15mm,20mm,15mm} % A5 paper
\usepackage{afterpage}
\usepackage{hyperref}
\usepackage{graphicx}
\usepackage{tabulary}
\usepackage{longtable}
\usepackage[table]{xcolor}
\usepackage{ltablex}
\usepackage{parskip}
\usepackage{multicol}
\usepackage{soul}
\usepackage{verbatim}
\usepackage{etoolbox}
\usepackage[most]{tcolorbox}
\usepackage{listings}
\usepackage{amsmath,amssymb}
\usepackage{calc}
\usepackage{ifthen}
\usepackage[pdf]{graphviz}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{makeidx}
\usepackage{multirow}
\usepackage{textcomp}
\usepackage{makecell}
\usepackage{anyfontsize}
\usepackage{cancel}
\usepackage{lineno} % debug
\renewcommand\theadalign{bc}
\makeatletter
\newlength{\mytextsize}
\setlength{\mytextsize}{\f@size pt}
\newlength{\mybaselineskip}
\setlength{\mybaselineskip}{1.3\mytextsize}
\patchcmd{\verbatim@input}{\@verbatim}{\scriptsize\@verbatim}{}{}
\makeatother
\setlength{\baselineskip}{\mybaselineskip}
\frenchspacing
\setlength{\parindent}{0pt}
\setlength{\parskip}{\mytextsize}
\setsecnumdepth{subsection}
%% More compact itemize %%
\newenvironment{itemlist}{\vspace{0pt}\itemize}{\enditemize}
%% Idioms %%
\hyphenation{Java-script}
\hyphenation{ECMA-script}
\newcommand\forceindent{\hskip1.5em}
%% BASIC operators %%
\newcommand\tildechar{{\large\raisebox{-0.22ex}{\char`\~}}}
% Title styling
\pretitle{\begin{flushright}}
\posttitle{\par\end{flushright}}
\preauthor{\begin{flushright}}
\postauthor{\par\end{flushright}}
% new sections are new page
%\let\oldsection\chapter
%\renewcommand\chapter{\clearpage\oldsection}
% shorten spaces before section header
\setbeforesubsecskip{\mytextsize}
\setbeforesubsubsecskip{\mytextsize}
% extra space for table
\setlength{\extrarowheight}{0.166ex}
% chapter title -- no now page after
\renewcommand\chapterheadstart{} % kill the drop
\renewcommand\afterchapternum{\vskip 0.5em} % space between number and title
\setlength{\afterchapskip}{\baselineskip} % reduce space after chapter title
\makeatletter
\renewcommand\memendofchapterhook{%
\m@mindentafterchapter\@afterheading}
\makeatother
\definecolor{lgrey}{HTML}{eeeeee}
\sethlcolor{lgrey}
\renewcommand{\thefootnote}{\fnsymbol{footnote}}
\newcommand{\code}[1]{{\monofont\hl{\,#1\,}}}
\newcommand{\codebf}[1]{{\monofont \textbf{\hl{\,#1\,}}}}
%%\newcommand{\codeline}[1]{{\monofont\hl{\,#1\,}}}
\newcommand{\codeline}[1]{%
\colorbox{lgrey}{%
\begin{tabular*}{\textwidth}{l}%
\monofont #1 \\% TODO fill the cell with \hl colour
\end{tabular*}%
}}
\newtcolorbox{lgreybox}[1][]{%
breakable,
enhanced,
colback=lgrey,
attach title to upper,
fontupper=\monofont,
#1
}
\definecolor{sourcecomment}{HTML}{888888}
\lstset{frame=tb,
language=[Visual]Basic,
aboveskip=3mm,
belowskip=3mm,
showstringspaces=false,
columns=flexible,
basicstyle={\small\ttfamily},
numbers=none,
numberstyle=\textbf,
keywordstyle=,
commentstyle=\color{sourcecomment},
stringstyle=\textbf,
breaklines=true,
breakatwhitespace=true,
tabsize=3
}
\newcommand{\cnttoenglish}[2]{{%
\ifthenelse{#1=1}{one}{%
\ifthenelse{#1=2}{two}{%
\ifthenelse{#1=3}{three}{%
\ifthenelse{#1=4}{four}{%
\ifthenelse{#1=5}{five}{%
\ifthenelse{#1=6}{six}{%
\ifthenelse{#1=7}{seven}{%
\ifthenelse{#1=8}{eight}{%
\ifthenelse{#1=9}{nine}{%
\ifthenelse{#1=10}{ten}{%
\ifthenelse{#1=11}{eleven}{%
\ifthenelse{#1=12}{twelve}{%
\arabic{#1}%
}}}}}}}}}}}}} \ifthenelse{#1=1}{#2}{#2s}}
\addtocontents{toc}{\protect\thispagestyle{empty}} % no page number for the TOC header page
\aliaspagestyle{part}{empty} % aliasing PART as empty so that page number would not be printed
\aliaspagestyle{chapter}{section} % aliasing CHAPTER as section so that page numbering style would be the same as section
% The title
\newcommand{\thismachine}{TSVM}
\newcommand{\tsvmver}{1.2}
\newcommand{\theedition}{Zeroth Edition}
\newcommand{\thepublishingdate}{0000-00-00}
\newcommand{\oreallypress}{\begingroup\hspace{0.083em}\large\textbf{O'REALLY\raisebox{1ex}{\scriptsize ?}} \large Press\endgroup}
\title{\HUGE\textbf{\MakeUppercase{\thismachine} \\ PROGRAMMING GUIDE} \\ \Large \vspace{1em} For Version \tsvmver\hspace{0.75em}|\hspace{0.75em}\theedition}
\date{}
\author{}
\hypersetup{
pdfauthor={CuriousTorvald},
pdftitle={\thismachine\ Programming Guide for Version \tsvmver, \theedition},
unicode=true,
pdfcreator=\oreallypress
}
\makeindex
\begin{document}
\maketitle{}
\thispagestyle{empty}
\vfill
\oreallypress
\newpage
\input{meta}
\thispagestyle{empty}
\newpage
\setcounter{page}{3}
\tableofcontents*
%\linenumbers % debug
\openright
\chapter{Introduction}
\input{intro}
\openany
% \input{changesmeta}
\part{The Virtual Machine}
\chapter{Virtual Machine}
\input{implementation}
\part{TVDOS}
\input{tvdos}
\chapter{Bibliography}
\input{bibliography}
{
\let\clearpage\relax
\chapter*{\ \\ Disclaimers}
\oreallypress{} is entirely fictional publishing entity; \oreallypress{} has no affiliation whatsoever with any of the real-world publishers.
% Level of humour used in this document is \emph{super-corny}. Do not use this atrocious humour for a purpose of real-world entertainment; we take no responsibility for the consequences---losing your friends, get shunned by people, etc.
}
\chapter{Copyright}
The source code for \thismachine\ and this documentation are distributed under the following terms:
\copyright\ 2020-- \ Minjae Song (``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.
\printindex
\afterpage{\pagestyle{empty}\null\newpage}
\end{document}

BIN
doc/tsvmpal.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

7
doc/tvdos.tex Normal file
View File

@@ -0,0 +1,7 @@
\chapter{Introduction}
TVDOS is a Disk Operating System (usually) bundled with the distribution of the \thismachine.
All TVDOS-related features requires the DOS to be fully loaded.
\chapter{Filesystem}