ROM API documentation

Former-commit-id: 1106c3a0afcae589af94077bc6015c29e602ac21
Former-commit-id: 3e7ab3544be3e81f5b6e9c0ebdc5cbf5a303e9b7
This commit is contained in:
Song Minjae
2016-09-21 22:14:41 +09:00
parent cbff53ad23
commit 6caae90d7e
8 changed files with 3386 additions and 0 deletions

1292
work_files/romapidoc/mda.pdf Normal file

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,115 @@
\relax
\providecommand\hyper@newdestlabel[2]{}
\providecommand*{\memsetcounter}[2]{}
\providecommand\HyperFirstAtBeginDocument{\AtBeginDocument}
\HyperFirstAtBeginDocument{\ifx\hyper@anchor\@undefined
\global\let\oldcontentsline\contentsline
\gdef\contentsline#1#2#3#4{\oldcontentsline{#1}{#2}{#3}}
\global\let\oldnewlabel\newlabel
\gdef\newlabel#1#2{\newlabelxx{#1}#2}
\gdef\newlabelxx#1#2#3#4#5#6{\oldnewlabel{#1}{{#2}{#3}}}
\AtEndDocument{\ifx\hyper@anchor\@undefined
\let\contentsline\oldcontentsline
\let\newlabel\oldnewlabel
\fi}
\fi}
\global\let\hyper@last\relax
\gdef\HyperFirstAtBeginDocument#1{#1}
\providecommand\HyField@AuxAddToFields[1]{}
\providecommand\HyField@AuxAddToCoFields[2]{}
\@writefile{lof}{\addvspace {10pt}}
\@writefile{lot}{\addvspace {10pt}}
\@writefile{toc}{\contentsline {chapter}{\chapternumberline {1}APIs and Libraries}{5}{chapter.1}}
\gdef \LT@i {\LT@entry
{2}{155.06007pt}\LT@entry
{1}{45.25516pt}\LT@entry
{1}{134.68477pt}}
\@writefile{toc}{\contentsline {section}{\numberline {1.1}Filesystem}{6}{section.1.1}}
\@writefile{toc}{\contentsline {subsection}{\numberline {1.1.1}Functions}{6}{subsection.1.1.1}}
\gdef \LT@ii {\LT@entry
{2}{99.95pt}\LT@entry
{1}{235.05pt}}
\@writefile{toc}{\contentsline {subsection}{\numberline {1.1.2}File Handler}{7}{subsection.1.1.2}}
\gdef \LT@iii {\LT@entry
{2}{154.76003pt}\LT@entry
{1}{45.25516pt}\LT@entry
{1}{134.98482pt}}
\@writefile{toc}{\contentsline {section}{\numberline {1.2}Hexutils}{9}{section.1.2}}
\@writefile{toc}{\contentsline {subsection}{\numberline {1.2.1}Functions}{9}{subsection.1.2.1}}
\gdef \LT@iv {\LT@entry
{2}{136.82pt}\LT@entry
{1}{45.25516pt}\LT@entry
{1}{152.92484pt}}
\@writefile{toc}{\contentsline {section}{\numberline {1.3}Security}{10}{section.1.3}}
\@writefile{toc}{\contentsline {subsection}{\numberline {1.3.1}Functions}{10}{subsection.1.3.1}}
\gdef \LT@v {\LT@entry
{2}{102.18004pt}\LT@entry
{1}{45.25516pt}\LT@entry
{2}{180.42001pt}}
\@writefile{toc}{\contentsline {section}{\numberline {1.4}Shell}{11}{section.1.4}}
\gdef \LT@vi {\LT@entry
{2}{139.76003pt}\LT@entry
{1}{45.25516pt}\LT@entry
{1}{149.98482pt}}
\@writefile{toc}{\contentsline {section}{\numberline {1.5}Terminal}{12}{section.1.5}}
\@writefile{toc}{\contentsline {subsection}{\numberline {1.5.1}Functions}{12}{subsection.1.5.1}}
\gdef \LT@vii {\LT@entry
{1}{22.26001pt}\LT@entry
{1}{39.16003pt}\LT@entry
{1}{22.26001pt}\LT@entry
{1}{57.87003pt}\LT@entry
{1}{22.26001pt}\LT@entry
{1}{49.88002pt}\LT@entry
{1}{22.26001pt}\LT@entry
{1}{58.02002pt}}
\@writefile{toc}{\contentsline {subsection}{\numberline {1.5.2}Standard Colours}{14}{subsection.1.5.2}}
\gdef \LT@viii {\LT@entry
{1}{28.3155pt}\LT@entry
{1}{139.1845pt}\LT@entry
{1}{28.3155pt}\LT@entry
{1}{139.1845pt}}
\@writefile{toc}{\contentsline {subsection}{\numberline {1.5.3}Codepage}{15}{subsection.1.5.3}}
\@writefile{toc}{\contentsline {subsection}{\numberline {1.5.4}Accepted Control Sequences}{15}{subsection.1.5.4}}
\gdef \LT@ix {\LT@entry
{2}{134.13005pt}\LT@entry
{1}{45.25516pt}\LT@entry
{1}{155.61479pt}}
\gdef \LT@x {\LT@entry
{2}{123.76009pt}\LT@entry
{2}{36.06001pt}\LT@entry
{1}{175.1799pt}}
\@writefile{toc}{\contentsline {section}{\numberline {1.6}Lua Globals}{17}{section.1.6}}
\@writefile{toc}{\contentsline {subsection}{\numberline {1.6.1}Functions}{17}{subsection.1.6.1}}
\@writefile{toc}{\contentsline {subsection}{\numberline {1.6.2}Constants}{17}{subsection.1.6.2}}
\@writefile{lof}{\addvspace {10pt}}
\@writefile{lot}{\addvspace {10pt}}
\@writefile{toc}{\contentsline {chapter}{\chapternumberline {2}Compatibility Layers---ComputerCraft}{19}{chapter.2}}
\gdef \LT@xi {\LT@entry
{2}{108.45001pt}\LT@entry
{2}{125.76003pt}}
\@writefile{toc}{\contentsline {section}{\numberline {2.1}Bit}{20}{section.2.1}}
\@writefile{toc}{\contentsline {subsection}{\numberline {2.1.1}Functions}{20}{subsection.2.1.1}}
\gdef \LT@xii {\LT@entry
{1}{77.19011pt}\LT@entry
{1}{68.63008pt}\LT@entry
{1}{76.35007pt}\LT@entry
{1}{76.36005pt}}
\@writefile{toc}{\contentsline {section}{\numberline {2.2}Colors}{21}{section.2.2}}
\@writefile{toc}{\contentsline {subsection}{\numberline {2.2.1}Constants}{21}{subsection.2.2.1}}
\@writefile{toc}{\contentsline {subsection}{\numberline {2.2.2}Functions}{21}{subsection.2.2.2}}
\@writefile{toc}{\contentsline {section}{\numberline {2.3}Term}{22}{section.2.3}}
\@writefile{toc}{\contentsline {section}{\numberline {2.4}Filesystem}{23}{section.2.4}}
\@writefile{lof}{\addvspace {10pt}}
\@writefile{lot}{\addvspace {10pt}}
\@writefile{toc}{\contentsline {chapter}{\chapternumberline {3}Compatibility Layers---OpenComputers}{25}{chapter.3}}
\@writefile{lof}{\addvspace {10pt}}
\@writefile{lot}{\addvspace {10pt}}
\@writefile{toc}{\contentsline {chapter}{\chapternumberline {4}Peripherals}{27}{chapter.4}}
\gdef \LT@xiii {\LT@entry
{2}{71.78003pt}\LT@entry
{1}{45.25516pt}\LT@entry
{2}{153.90001pt}}
\@writefile{toc}{\contentsline {section}{\numberline {4.1}Line Printer}{28}{section.4.1}}
\@writefile{toc}{\contentsline {subsection}{\numberline {4.1.1}Functions}{28}{subsection.4.1.1}}
\memsetcounter{lastsheet}{29}
\memsetcounter{lastpage}{29}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,15 @@
\BOOKMARK [0][-]{chapter.1}{\376\377\000A\000P\000I\000s\000\040\000a\000n\000d\000\040\000L\000i\000b\000r\000a\000r\000i\000e\000s}{}% 1
\BOOKMARK [1][-]{section.1.1}{\376\377\000F\000i\000l\000e\000s\000y\000s\000t\000e\000m}{chapter.1}% 2
\BOOKMARK [1][-]{section.1.2}{\376\377\000H\000e\000x\000u\000t\000i\000l\000s}{chapter.1}% 3
\BOOKMARK [1][-]{section.1.3}{\376\377\000S\000e\000c\000u\000r\000i\000t\000y}{chapter.1}% 4
\BOOKMARK [1][-]{section.1.4}{\376\377\000S\000h\000e\000l\000l}{chapter.1}% 5
\BOOKMARK [1][-]{section.1.5}{\376\377\000T\000e\000r\000m\000i\000n\000a\000l}{chapter.1}% 6
\BOOKMARK [1][-]{section.1.6}{\376\377\000L\000u\000a\000\040\000G\000l\000o\000b\000a\000l\000s}{chapter.1}% 7
\BOOKMARK [0][-]{chapter.2}{\376\377\000C\000o\000m\000p\000a\000t\000i\000b\000i\000l\000i\000t\000y\000\040\000L\000a\000y\000e\000r\000s\040\024\000C\000o\000m\000p\000u\000t\000e\000r\000C\000r\000a\000f\000t}{}% 8
\BOOKMARK [1][-]{section.2.1}{\376\377\000B\000i\000t}{chapter.2}% 9
\BOOKMARK [1][-]{section.2.2}{\376\377\000C\000o\000l\000o\000r\000s}{chapter.2}% 10
\BOOKMARK [1][-]{section.2.3}{\376\377\000T\000e\000r\000m}{chapter.2}% 11
\BOOKMARK [1][-]{section.2.4}{\376\377\000F\000i\000l\000e\000s\000y\000s\000t\000e\000m}{chapter.2}% 12
\BOOKMARK [0][-]{chapter.3}{\376\377\000C\000o\000m\000p\000a\000t\000i\000b\000i\000l\000i\000t\000y\000\040\000L\000a\000y\000e\000r\000s\040\024\000O\000p\000e\000n\000C\000o\000m\000p\000u\000t\000e\000r\000s}{}% 13
\BOOKMARK [0][-]{chapter.4}{\376\377\000P\000e\000r\000i\000p\000h\000e\000r\000a\000l\000s}{}% 14
\BOOKMARK [1][-]{section.4.1}{\376\377\000L\000i\000n\000e\000\040\000P\000r\000i\000n\000t\000e\000r}{chapter.4}% 15

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,458 @@
% !TEX TS-program = lualatex
\documentclass[10pt, stock]{memoir}
\usepackage{fontspec}
\setmainfont{MyriadPro}
\usepackage{fapapersize}
\usefapapersize{148mm,210mm,15mm,15mm,20mm,15mm}
\usepackage{afterpage}
\usepackage{hyperref}
\usepackage{graphicx}
\usepackage{xcolor}
\usepackage{ltablex}
\usepackage{parskip}
\frenchspacing
\setlength{\parindent}{0pt}
\setlength{\parskip}{10pt}
\setsecnumdepth{subsection}
\aliaspagestyle{part}{empty}
\aliaspagestyle{chapter}{empty}
\makeatletter
\renewcommand\memendofchapterhook{%
\clearpage\m@mindentafterchapter\@afterheading}
\makeatother
\definecolor{black}{HTML}{000000}
\definecolor{white}{HTML}{FFFFFF}
\definecolor{dimgrey}{HTML}{555555}
\definecolor{brightgrey}{HTML}{AAAAAA}
\definecolor{yellow}{HTML}{FFFF00}
\definecolor{orange}{HTML}{FF6600}
\definecolor{red}{HTML}{DD0000}
\definecolor{magenta}{HTML}{FF0099}
\definecolor{purple}{HTML}{330099}
\definecolor{blue}{HTML}{0000CC}
\definecolor{cyan}{HTML}{0099FF}
\definecolor{lime}{HTML}{55FF00}
\definecolor{green}{HTML}{00AA00}
\definecolor{darkgreen}{HTML}{006600}
\definecolor{brown}{HTML}{663300}
\definecolor{tan}{HTML}{996633}
\newcommand{\unemph}[1]{\textcolor{brightgrey}{#1}}
% Title styling
\pretitle{\begin{flushright}\HUGE}
\posttitle{\par\end{flushright}\vskip 0.5em}
% new sections are new page
\let\oldsection\section
\renewcommand\section{\clearpage\oldsection}
% The title
\title{\textbf{ROMBASIC DEVELOPERS' \\ MANUAL} \\ \vspace{7mm} \large For the Game \emph{Terrarum}\quad ·\quad First Edition}
\date{}
\author{}
\hypersetup{
pdfauthor={Terrarum Developers},
pdftitle={ROMBASIC DEVELOPERS MANUAL},
unicode=true
}
\begin{document}
\begin{titlingpage}
\maketitle{}
\end{titlingpage}
\setcounter{page}{3}
\tableofcontents*
\chapter{APIs and Libraries}
\section{Filesystem}
The Filesystem API provides functions for manipulating files and the filesystem.
The path for the argument of functions blocks `\,.\,.\,' to be entered, preventing users from access outside of the computer and eliminating the potential of harming the real computer of the innocent players.
\subsection{Functions}
\begin{tabularx}{\textwidth}{l l X}
\textbf{\large Function} & \textbf{\large Return} & \textbf{\large Description}
\\ \\
\endhead
fs.list(\textbf{path}: string) & table & Returns list of files in \textbf{path}, in lua table.
\\ \\
fs.exists(\textbf{path}: string) & bool & Checks if \textbf{path} exists on the filesystem.
\\ \\
fs.isDir(\textbf{path}: string) & bool & Checks if \textbf{path} is a directory.
\\ \\
fs.isFile(\textbf{path}: string) & bool & Checks if \textbf{path} is a file.
\\ \\
fs.isReadOnly(\textbf{path}: string) & bool & Checks if \textbf{path} is read only.
\\ \\
fs.getSize(\textbf{path}: string) & int & Returns a size of the file/directory, in bytes.
\\ \\
fs.mkdir(\textbf{path}: string) & bool & Create a directory to \textbf{path}. Returns \textbf{true} upon success.
\\ \\
fs.mv(\textbf{from}: string, \textbf{dest}: string) & bool & Moves the directory to the destination. Subdirectories / files will also be moved. Returns \textbf{true} upon success.
\\ \\
fs.cp(\textbf{from}: string, \textbf{dest}: string) & bool & Copies the directory to the destination. Subdirectories / files will also be copied. Returns \textbf{true} upon success.
\\ \\
fs.rm(\textbf{path}: string) & bool & Deletes the \textbf{path}. If \textbf{path} is a directory, all its members will also be deleted. Returns \textbf{true} upon success.
\\ \\
fs.concat(\textbf{p1}: string, \textbf{p2}: string) & string & Concatenates two paths and return new path as string.
\\ \\
fs.open(\textbf{path}: string, \textbf{mode}: string) & file & Opens file and returns its handle. See section \emph{File Handler} for details.
\\ \\
fs.dofile(\textbf{path}: string) & nil & Loads the script on \textbf{path} and executes it.
\\ \\
fs.parent(\textbf{path}: string) & string & Returs parent directory to the \textbf{path}.
\end{tabularx}
\subsection{File Handler}
When it comes to opening a file, there are six modes available---r, w, a, rb, wb, ab, each represents \textbf{r}ead, \textbf{w}rite, \textbf{a}ppend and \textbf{b}yte.
\begin{tabularx}{\textwidth}{l X}
\textbf{\large Function} & \textbf{\large Description}
\\ \\
\endhead
file.close() & Closes the file. Any data wrote will be actually wrote to disk when this function is called.
\\ \\
file.flush() & (in write/append mode) Flushes the data to the file, keeps the handle available afterwards
\\ \\
\multicolumn{2}{c}{\textbf{Read mode}}
\\ \\
file.readLine() & Reads text from the file line by line. Returns string of line, or \emph{nil} if there is no next line.
\\ \\
file.readAll() & Reads and returns whole text in the file as string.
\\ \\
\multicolumn{2}{c}{\textbf{Read binary mode}}
\\ \\
file.read() & Reads single byte in the file as int, or \emph{-1} if end-of-file is reached.
\\ \\
file.readAll() & Reads and returns whole byte in the file as string.
\\ \\
\multicolumn{2}{c}{\textbf{Write/append mode}}
\\ \\
file.write(string) & Writes \textbf{string} to the file.
\\ \\
file.writeLine(string) & Writes \textbf{string} to the file and append line feed.
\\ \\
\multicolumn{2}{c}{\textbf{Write/append binary mode}}
\\ \\
file.write(int) & Writes \textbf{int} to the file.
\\ \\
file.writeBytes(string) & Writes \textbf{string} to the file and append line feed.
\end{tabularx}
\section{Hexutils}
The Hexutils library provides utility to convert byte value to hexadecimal string.
\subsection{Functions}
\begin{tabularx}{\textwidth}{l l X}
\textbf{\large Function} & \textbf{\large Return} & \textbf{\large Description}
\\ \\
\endhead
hexutils.toHexString(\textbf{bytes}: string) & string & Converts byte array to the string of its hexadecimal representations.
\end{tabularx}
\section{Security}
The Serurity API provides functions for security purposes, such as hashing and CSPRNG\footnote{Cryptographically secure psuedo-random number generator}.
\subsection{Functions}
\begin{tabularx}{\textwidth}{l l X}
\textbf{\large Function} & \textbf{\large Return} & \textbf{\large Description}
\\ \\
\endhead
security.toSHA1(string) & string & Returns SHA-256 hash of input string in array of bytes (as a string)
\\ \\
security.toSHA256(string) & string & Returns SHA-1 hash of input string in array of bytes
\\ \\
security.toMD5(string) & string & Returns MD-5 hash of input string in array of bytes
\\ \\
security.randomBytes(\textbf{len}: int) & string & Returns byte array of random values in desired \textbf{len}gth.
\\ \\
security.decodeBase64(string) & string & Decodes Base64 string and returns the result as string.
\\ \\
security.encodeBase64(string) & string & Encodes input string as Base64 format and returns the result as array of bytes.
\end{tabularx}
\section{Shell}
\begin{tabularx}{\textwidth}{l l X}
\textbf{\large Function} & \textbf{\large Return} & \textbf{\large Description}
\\ \\
\endhead
shell.run(\textbf{path}: string) & nil & Loads the script on \textbf{path} and executes it.
\end{tabularx}
\section{Terminal}
The Terminal API provides functions for sending text to the terminals, and drawing text-mode graphics. The API expects connected terminal to use Codepage 437. See section \emph{Codepage} for details.
\subsection{Functions}
\begin{tabularx}{\textwidth}{l l X}
\textbf{\large Function} & \textbf{\large Return} & \textbf{\large Description}
\\ \\
\endhead
term.write(string) & nil & Writes string to the current cursor position. Line feed is not appended.
\\ \\
term.print(string) & nil & Writes string to the current cursor position and make a new line.
\\ \\
term.newLine() & nil & Make a new line.
\\ \\
term.moveCursor(\textbf{x}: int, \textbf{y}: int) & nil & Moves cursor to (\textbf{x}, \textbf{y}), starting from 1.
\\ \\
term.width() & int & Returns the width of the terminal. Meant to be used with teletypes.
\\ \\
term.scroll(\textbf{n}: int) & nil & Make a new line \textbf{n} times.
\\ \\
term.isTeletype() & bool & Returns \textbf{true} if the terminal is teletype.
\\ \\
\multicolumn{3}{c}{\textbf{Graphic terminals only}}
\\ \\
term.emit(\textbf{c}: int, \textbf{x}: int, \textbf{y}: int) & nil & Emits \textbf{c} into (\textbf{x}, \textbf{y}), control sequence will not be processed and printed as symbols instead. Cursor will not be moved.
\\ \\
term.emitRaw(\textbf{bufferChar}: int) & nil & Emits \textbf{bufferChar} into into (\textbf{x}, \textbf{y}). Buffer char means a single character actually stored into the screen buffer, has four bits for back- and foreground colours respectively, and eight bits for a letter.
\\ \\
term.emitString(\textbf{s}, \textbf{x}: int, \textbf{y}: int) & nil & Emits \textbf{s} (a string) into (\textbf{x}, \textbf{y}), printing control sequences as symbols. Cursor will not be moved.
\\ \\
\begin{tabular}[t]{@{}l@{}}term.resetColour()\\term.resetColor()\end{tabular} & nil & Resets any colour changes to the defaults.
\\ \\
term.clear() & nil & Clears whole screen buffer and move cursor to (1, 1)
\\ \\
term.clearLine() & nil & Clears current line on the screen buffer, does not moves cursor.
\\ \\
term.getCursor() & int, int & Returns current coordinates of the cursor.
\\ \\
term.getX() & int & Returns X coordinate of the cursor.
\\ \\
term.getY() & int & Returns Y coordinate of the cursor.
\\ \\
term.blink(bool) & nil & Sets cursor blinking. \textbf{true} makes the cursor blink.
\\ \\
term.size() & int, int & Returns width and height of the terminal.
\\ \\
term.isCol() & bool & Returns if the terminal supports colour.
\\ \\
term.setForeCol(\textbf{col}: int) & nil & Sets foreground colour to \textbf{col}
\\ \\
term.setBackCol(\textbf{col}: int) & nil & Sets background colour to \textbf{col}.
\\ \\
term.foreCol() & int & Returns current foreground colour.
\\ \\
term.backCol() & int & Returns current background colour.
\end{tabularx}
\subsection{Standard Colours}
\begin{tabularx}{\textwidth}{c l c l c l c l}
0 & \textcolor{black}{Black} & 1 & White & 2 & \textcolor{dimgrey}{Dim grey} & 3 & \textcolor{brightgrey}{Bright grey}
\\ \\
4 & \textcolor{yellow}{Yellow} & 5 & \textcolor{orange}{Orange} & 6 & \textcolor{red}{Red} & 7 & \textcolor{magenta}{Magenta}
\\ \\
8 & \textcolor{purple}{Purple} & 9 & \textcolor{blue}{Blue} & 10 & \textcolor{cyan}{Cyan} & 11 & \textcolor{lime}{Lime}
\\ \\
12 & \textcolor{green}{Green} & 13 & \textcolor{darkgreen}{Dark green} & 14 & \textcolor{brown}{Brown} & 15 & \textcolor{tan}{Tan}
\end{tabularx}
Non-colour terminals support colour index of 0--3.
\subsection{Codepage}
{\center\includegraphics[height=21em]{mda.pdf}}
Character 0x9D (currency symbol) and 0xFA (middle dot) can be accessed with following Lua constants: \emph{MONEYSYM} and \emph{MIDDOT}.
\subsection{Accepted Control Sequences}
\begin{tabularx}{\textwidth}{c X c X}
\textbf{\large No.} & \textbf{\large Description} & \textbf{\large No.} & \textbf{\large Description}
\\ \\
\endhead
7 & BEL. Emits short beep. & 8 & BS. Moves cursor to left 1 character.
\\ \\
9 & TAB. Inserts appropriate horizontal space. Tab size is variable. & 10 & LF. Prints a new line.
\\ \\
12 & FF. Clears everything in screen buffer and moves cursor to (1, 1) & 13 & CR. Moves x coordinate of cursor to 1.
\\ \\
16 & DLE. Sets foreground colour to the default STDERR colour. & 127 & DEL. Backspace and deletes one character.
\\ \\
17 & DC1. Sets foreground colour to 0. (black) & 18 & DC2. Sets foreground colour to 1. (white)
\\ \\
19 & DC3. Sets foreground colour to 2. (dim grey) & 20 & DC4. Sets foreground colour to 3. (bright grey)
\end{tabularx}
\section{Lua Globals}
ROMBASIC adds global functions and constants for operability.
\subsection{Functions}
\begin{tabularx}{\textwidth}{l l X}
\textbf{\large Function} & \textbf{\large Return} & \textbf{\large Description}
\\ \\
\endhead
\unemph{\_G.}runScript(\textbf{fun}: str, \textbf{env}: str) & nil & Runs Lua script \textbf{fun} with the environment tag \textbf{env}.
\\ \\
\unemph{\_G.}getMem() & int & Returns the current memory usage in bytes.
\\ \\
\unemph{\_G.}getTotalMem() & int & Returns the total size of the memory installed in the computer, in bytes.
\\ \\
\unemph{\_G.}getFreeMem() & int & Returns the amount of free memory on the computer.
\end{tabularx}
\subsection{Constants}
\begin{tabularx}{\textwidth}{l l X}
\textbf{\large Name} & \textbf{\large Type} & \textbf{\large Description}
\\ \\
\endhead
\unemph{\_G.}MONEYSYM & string & Currency symbol used in the world. Code 0x9D
\\ \\
\unemph{\_G.}MIDDOT & string & Middle dot used in typography. Code 0xFA (note: 0xF9 is a Dot Product used in Mathematics)
\\ \\
\unemph{\_G.}DC1 & string & Ascii control sequence DC1. Used to change foreground colour to black.
\\ \\
\unemph{\_G.}DC2 & string & Ascii control sequence DC2. Used to change foreground colour to white.
\\ \\
\unemph{\_G.}DC3 & string & Ascii control sequence DC3. Used to change foreground colour to dim grey.
\\ \\
\unemph{\_G.}DC4 & string & Ascii control sequence DC4. Used to change foreground colour to bright grey.
\\ \\
\unemph{\_G.}DLE & string & Ascii control sequence DLE. Used to change foreground colour to terminal's default error text colour.
\\ \\
\_COMPUTER.prompt & string & Default text for prompt input indicator.
\\ \\
\_COMPUTER.verbose & bool & Sets whether print debug information to the console.
\\ \\
\_COMPUTER.loadedCLayer & table & List of names of compatibility layers has been loaded.
\\ \\
\_COMPUTER.bootloader & string & Path to the boot file. Should point to the EFI (/boot/efi).
\\ \\
\_COMPUTER.OEM & string & Manufacturer of the computer. If you \emph{are} a manufacturer, you may want to fill in this variable with your own company's name.
\end{tabularx}
\chapter[Compatibility Layers---ComputerCraft]{{\LARGE Compatibility Layers} \\ ComputerCraft}
\section{Bit}
The Bit API is for manipulating numbers using bitwise binary operations. The ROMBASIC already comes with Lua's bit32 library so make sure to use that for your casual usage.
\subsection{Functions}
\begin{tabularx}{\textwidth}{l X}
\textbf{\large Function} & \textbf{\large Notes}
\\ \\
\endhead
bit.blshift(n, bits) & Alias of bit32.lshift(n, bits)
\\ \\
bit.brshift(n, bits) & Alias of bit32.arshift(n, bits)
\\ \\
bit.blogic\_rshift(n, bits) & Alias of bit32.brshift(n, bits)
\\ \\
bit.bxor(m, n) & Alias of bit32.bxor(m, n)
\\ \\
bit.bor(m, n) & Alias of bit32.bor(m, n)
\\ \\
bit.band(m, n) & Alias of bit32.band(m, n)
\\ \\
bit.bnot(n) & Alias of bit32.bnot(n)
\end{tabularx}
\section{Colors}
The Colors API allows you to manipulate sets of colors. This is useful in colors on Advanced Computers and Advanced Monitors. British spellings are also supported.
\subsection{Constants}
When the colours are used in ComputerCraft's Term API, nearest console colours will be used. Below is the table of colours coded with their substitutions.
\begin{tabularx}{\textwidth}{l l l l}
colors.white & colors.\textcolor{orange}{orange} & colors.\textcolor{magenta}{magenta} & colors.\textcolor{cyan}{lightBlue}
\\ \\
colors.\textcolor{yellow}{yellow} & colors.\textcolor{lime}{lime} & colors.\textcolor{tan}{pink} & colors.\textcolor{dimgrey}{gray}
\\ \\
colors.\textcolor{brightgrey}{lightGray} & colors.\textcolor{cyan}{cyan} & colors.\textcolor{purple}{purple} & colors.\textcolor{blue}{blue}
\\ \\
colors.\textcolor{brown}{brown} & colors.\textcolor{green}{green} & colors.\textcolor{red}{red} & colors.\textcolor{black}{black}
\end{tabularx}
Note that pink is understood as \textcolor{tan}{tan} when it is used, lightBlue and cyan are merged to \textcolor{cyan}{cyan}.
\subsection{Functions}
All three functions are not supported, as there is no bundled cable thus there is no use of them.
\section{Term}
\section{Filesystem}
\chapter[Compatibility Layers---OpenComputers]{{\LARGE Compatibility Layers} \\ OpenComputers}
\chapter{Peripherals}
\section{Line Printer}
The line printer is a printer that operates on line basis. It only prints text in line-by-line, hence the name, on almost endlessly long roll of papers; it has no notion of page, it just prints. If you want some pages to keep, you must tear them out yourself.
Line printers do not work indefinitely; ignoring the obvious depletion of ink, belt for loading paper will be out of service on about 50 000 lines of printing, give or take a few, or paper will jam if the printer had struck with the unluckiness.
\subsection{Functions}
\begin{tabularx}{\textwidth}{l l X}
\textbf{\large Function} & \textbf{\large Return} & \textbf{\large Description}
\\ \\
\endhead
lp.print(string) & nil & Prints a line of string.
\\ \\
lp.scroll(\textbf{n}: int) & nil & Scrolls the paper by \textbf{n} lines.
\\ \\
lp.status() & int & Returns a status of the line printer.
\\ \\
lp.reset() & nil & Resets the line printer.
\end{tabularx}
\afterpage{\pagestyle{empty}\null\newpage}
\end{document}

View File

@@ -0,0 +1,29 @@
\contentsline {chapter}{\chapternumberline {1}APIs and Libraries}{5}{chapter.1}
\contentsline {section}{\numberline {1.1}Filesystem}{6}{section.1.1}
\contentsline {subsection}{\numberline {1.1.1}Functions}{6}{subsection.1.1.1}
\contentsline {subsection}{\numberline {1.1.2}File Handler}{7}{subsection.1.1.2}
\contentsline {section}{\numberline {1.2}Hexutils}{9}{section.1.2}
\contentsline {subsection}{\numberline {1.2.1}Functions}{9}{subsection.1.2.1}
\contentsline {section}{\numberline {1.3}Security}{10}{section.1.3}
\contentsline {subsection}{\numberline {1.3.1}Functions}{10}{subsection.1.3.1}
\contentsline {section}{\numberline {1.4}Shell}{11}{section.1.4}
\contentsline {section}{\numberline {1.5}Terminal}{12}{section.1.5}
\contentsline {subsection}{\numberline {1.5.1}Functions}{12}{subsection.1.5.1}
\contentsline {subsection}{\numberline {1.5.2}Standard Colours}{14}{subsection.1.5.2}
\contentsline {subsection}{\numberline {1.5.3}Codepage}{15}{subsection.1.5.3}
\contentsline {subsection}{\numberline {1.5.4}Accepted Control Sequences}{15}{subsection.1.5.4}
\contentsline {section}{\numberline {1.6}Lua Globals}{17}{section.1.6}
\contentsline {subsection}{\numberline {1.6.1}Functions}{17}{subsection.1.6.1}
\contentsline {subsection}{\numberline {1.6.2}Constants}{17}{subsection.1.6.2}
\contentsline {chapter}{\chapternumberline {2}Compatibility Layers---ComputerCraft}{19}{chapter.2}
\contentsline {section}{\numberline {2.1}Bit}{20}{section.2.1}
\contentsline {subsection}{\numberline {2.1.1}Functions}{20}{subsection.2.1.1}
\contentsline {section}{\numberline {2.2}Colors}{21}{section.2.2}
\contentsline {subsection}{\numberline {2.2.1}Constants}{21}{subsection.2.2.1}
\contentsline {subsection}{\numberline {2.2.2}Functions}{21}{subsection.2.2.2}
\contentsline {section}{\numberline {2.3}Term}{22}{section.2.3}
\contentsline {section}{\numberline {2.4}Filesystem}{23}{section.2.4}
\contentsline {chapter}{\chapternumberline {3}Compatibility Layers---OpenComputers}{25}{chapter.3}
\contentsline {chapter}{\chapternumberline {4}Peripherals}{27}{chapter.4}
\contentsline {section}{\numberline {4.1}Line Printer}{28}{section.4.1}
\contentsline {subsection}{\numberline {4.1.1}Functions}{28}{subsection.4.1.1}