beeps are now processed sorely on the computer, added speaker driver (wip)

Former-commit-id: c8339104815a62db51e5bd26460a87f1f653a775
Former-commit-id: f22320a45734b141c4f02ca61fbd79772e32c7c5
This commit is contained in:
Song Minjae
2016-09-28 00:44:02 +09:00
parent befaa460d6
commit 7fec3fc066
15 changed files with 306 additions and 192 deletions

View File

@@ -6,10 +6,30 @@
Some codes were taken from OpenComputers, which is distributed under MIT Some codes were taken from OpenComputers, which is distributed under MIT
--]] --]]
_G.computer = {}
computer.realTime = function() return 0 end computer.realTime = function() return 0 end
if totalMemory() == 0 then print("no RAM installed") __haltsystemexplicit__() return end -- global variables
_G._VERSION = "Luaj-jse 3.0.1 (Lua 5.2.3)"
_G.EMDASH = string.char(0xC4)
_G.UNCHECKED = string.char(0x9C) -- box unchecked
_G.CHECKED = string.char(0x9D) -- box checked
_G.MONEY = string.char(0x9E) -- currency sign
_G.MIDDOT = string.char(0xFA) -- middle dot sign
_G.DC1 = string.char(17) -- black
_G.DC2 = string.char(18) -- white
_G.DC3 = string.char(19) -- dim grey
_G.DC4 = string.char(20) -- light grey
_G.DLE = string.char(16) -- default error colour
_G.bell = function(patn) term.bell(patn or ".") end
_G.beep = _G.bell
if totalMemory() == 0 then
bell "="
print("no RAM installed")
__haltsystemexplicit__()
return
end
local hookInterval = 100 local hookInterval = 100
@@ -949,18 +969,7 @@ sandbox._G = sandbox
-- path for any ingame libraries -- path for any ingame libraries
package.path = "/net/torvald/terrarum/virtualcomputer/assets/lua/?.lua;" .. package.path package.path = "/net/torvald/terrarum/virtualcomputer/assets/lua/?.lua;" .. package.path
-- global variables -- global functions
_G._VERSION = "Luaj-jse 3.0.1 (Lua 5.2.3)"
_G.EMDASH = string.char(0xC4)
_G.UNCHECKED = string.char(0x9C) -- box unchecked
_G.CHECKED = string.char(0x9D) -- box checked
_G.MONEY = string.char(0x9E) -- currency sign
_G.MIDDOT = string.char(0xFA) -- middle dot sign
_G.DC1 = string.char(17) -- black
_G.DC2 = string.char(18) -- white
_G.DC3 = string.char(19) -- dim grey
_G.DC4 = string.char(20) -- light grey
_G.DLE = string.char(16) -- default error colour
_G.runscript = function(s, src, ...) _G.runscript = function(s, src, ...)
if s:byte(1) == 27 then error("Bytecode execution is prohibited.") end if s:byte(1) == 27 then error("Bytecode execution is prohibited.") end
@@ -973,8 +982,6 @@ _G.runscript = function(s, src, ...)
end end
end end
_G.__scanMode__ = "UNINIT" -- part of inputstream implementation _G.__scanMode__ = "UNINIT" -- part of inputstream implementation
_G.bell = function(patn) term.bell(patn or ".") end
_G.beep = _G.bell
local screenbufferdim = term.width() * term.height() local screenbufferdim = term.width() * term.height()
local screencolours = 4 local screencolours = 4
@@ -982,7 +989,6 @@ if term.isCol() then screencolours = 8
elseif term.isTeletype() then screencolours = 1 end elseif term.isTeletype() then screencolours = 1 end
local screenbuffersize = screenbufferdim * screencolours / 8 local screenbuffersize = screenbufferdim * screencolours / 8
--_G.computer = {} -- standard console colours
computer.prompt = DC3.."> "..DC4 computer.prompt = DC3.."> "..DC4
computer.verbose = true -- print debug info computer.verbose = true -- print debug info
computer.loadedCLayer = {} -- list of loaded compatibility layers computer.loadedCLayer = {} -- list of loaded compatibility layers
@@ -990,6 +996,7 @@ computer.bootloader = "/boot/efi"
computer.OEM = "" computer.OEM = ""
computer.beep = emittone computer.beep = emittone
computer.totalMemory = _G.totalMemory computer.totalMemory = _G.totalMemory
computer.bellpitch = 1000
local getMemory = function() local getMemory = function()
collectgarbage() collectgarbage()
return collectgarbage("count") * 1024 - 6.5*1048576 + screenbuffersize return collectgarbage("count") * 1024 - 6.5*1048576 + screenbuffersize

View File

@@ -22,6 +22,7 @@ import org.newdawn.slick.GameContainer
import org.newdawn.slick.Input import org.newdawn.slick.Input
import java.io.* import java.io.*
import java.nio.ByteBuffer import java.nio.ByteBuffer
import java.util.*
/** /**
* A part that makes "computer fixture" actually work * A part that makes "computer fixture" actually work
@@ -34,6 +35,8 @@ import java.nio.ByteBuffer
class BaseTerrarumComputer() { class BaseTerrarumComputer() {
val DEBUG_UNLIMITED_MEM = false val DEBUG_UNLIMITED_MEM = false
val DEBUG = false
lateinit var luaJ_globals: Globals lateinit var luaJ_globals: Globals
private set private set
@@ -112,6 +115,8 @@ class BaseTerrarumComputer() {
luaJ_globals.STDERR = termErr luaJ_globals.STDERR = termErr
luaJ_globals.STDIN = termIn luaJ_globals.STDIN = termIn
luaJ_globals["bit"] = luaJ_globals["bit32"]
// load libraries // load libraries
Term(luaJ_globals, term) Term(luaJ_globals, term)
Security(luaJ_globals) Security(luaJ_globals)
@@ -119,6 +124,8 @@ class BaseTerrarumComputer() {
HostAccessProvider(luaJ_globals, this) HostAccessProvider(luaJ_globals, this)
Input(luaJ_globals, this) Input(luaJ_globals, this)
Http(luaJ_globals, this) Http(luaJ_globals, this)
PcSpeakerDriver(luaJ_globals, this)
// secure the sandbox // secure the sandbox
luaJ_globals["io"] = LuaValue.NIL luaJ_globals["io"] = LuaValue.NIL
@@ -134,7 +141,7 @@ class BaseTerrarumComputer() {
luaJ_globals["totalMemory"] = LuaFunGetTotalMem(this) luaJ_globals["totalMemory"] = LuaFunGetTotalMem(this)
luaJ_globals["computer"] = LuaTable() luaJ_globals["computer"] = LuaTable()
luaJ_globals["emittone"] = ComputerEmitTone(this) if (DEBUG) luaJ_globals["emittone"] = ComputerEmitTone(this)
} }
var threadTimer = 0 var threadTimer = 0
@@ -158,6 +165,10 @@ class BaseTerrarumComputer() {
unsetThreadRun() unsetThreadRun()
} }
} }
driveBeepQueueManager(delta)
} }
fun keyPressed(key: Int, c: Char) { fun keyPressed(key: Int, c: Char) {
@@ -190,6 +201,8 @@ class BaseTerrarumComputer() {
class ThreadRunCommand : Runnable { class ThreadRunCommand : Runnable {
val DEBUGTHRE = true
val mode: Int val mode: Int
val arg1: Any val arg1: Any
val arg2: String val arg2: String
@@ -227,8 +240,6 @@ class BaseTerrarumComputer() {
if (DEBUGTHRE) e.printStackTrace(System.err) if (DEBUGTHRE) e.printStackTrace(System.err)
} }
} }
val DEBUGTHRE = true
} }
class LuaFunGetTotalMem(val computer: BaseTerrarumComputer) : ZeroArgFunction() { class LuaFunGetTotalMem(val computer: BaseTerrarumComputer) : ZeroArgFunction() {
@@ -248,6 +259,58 @@ class BaseTerrarumComputer() {
// BEEPER DRIVER // // BEEPER DRIVER //
/////////////////// ///////////////////
private val beepMaxLen = 10000
// let's regard it as a tracker...
private val beepQueue = ArrayList<Pair<Int, Float>>()
private var beepCursor = -1
private var beepQueueLineExecTimer = 0 // millisec
private var beepQueueFired = false
private fun driveBeepQueueManager(delta: Int) {
// start beep queue
if (beepQueue.size > 0 && beepCursor == -1) {
beepCursor = 0
}
// continue beep queue
if (beepCursor >= 0 && beepQueueLineExecTimer >= beepQueueGetLenOfPtn(beepCursor)) {
beepQueueLineExecTimer -= beepQueueGetLenOfPtn(beepCursor)
beepCursor += 1
beepQueueFired = false
}
// complete beep queue
if (beepCursor >= beepQueue.size) {
clearBeepQueue()
if (DEBUG) println("!! Beep queue clear")
}
// actually play queue
if (beepCursor >= 0 && beepQueue.size > 0 && !beepQueueFired) {
playTone(beepQueue[beepCursor].first, beepQueue[beepCursor].second)
beepQueueFired = true
}
if (beepQueueFired) beepQueueLineExecTimer += delta
}
fun clearBeepQueue() {
beepQueue.clear()
beepCursor = -1
beepQueueLineExecTimer = 0
}
fun enqueueBeep(duration: Int, freq: Float) {
beepQueue.add(Pair(Math.min(duration, beepMaxLen), freq))
}
fun beepQueueGetLenOfPtn(ptnIndex: Int) = beepQueue[ptnIndex].first
////////////////////
// TONE GENERATOR //
////////////////////
private val sampleRate = 44100 private val sampleRate = 44100
private var beepSource: Int? = null private var beepSource: Int? = null
private var beepBuffer: Int? = null private var beepBuffer: Int? = null
@@ -311,7 +374,7 @@ class BaseTerrarumComputer() {
return audioData return audioData
} }
internal fun playTone(leninmilli: Int, freq: Float) { private fun playTone(leninmilli: Int, freq: Float) {
audioData = makeAudioData(leninmilli, freq) audioData = makeAudioData(leninmilli, freq)

View File

@@ -0,0 +1,9 @@
package net.torvald.terrarum.virtualcomputer.luaapi
/**
* Virtual driver for 4-track squarewave soundcard
*
* Created by minjaesong on 16-09-27.
*/
class Kukeiha {
}

View File

@@ -0,0 +1,37 @@
package net.torvald.terrarum.virtualcomputer.luaapi
import li.cil.repack.org.luaj.vm2.Globals
import li.cil.repack.org.luaj.vm2.LuaTable
import li.cil.repack.org.luaj.vm2.LuaValue
import li.cil.repack.org.luaj.vm2.lib.TwoArgFunction
import li.cil.repack.org.luaj.vm2.lib.ZeroArgFunction
import net.torvald.terrarum.virtualcomputer.computer.BaseTerrarumComputer
/**
* PC Speaker driver and arpeggiator (MONOTONE-style 4 channels)
*
* Created by minjaesong on 16-09-27.
*/
class PcSpeakerDriver(globals: Globals, host: BaseTerrarumComputer) {
init {
globals["speaker"] = LuaTable()
globals["speaker"]["enqueue"] = EnqueueTone(host)
globals["speaker"]["clear"] = ClearQueue(host)
}
class EnqueueTone(val host: BaseTerrarumComputer) : TwoArgFunction() {
override fun call(millisec: LuaValue, freq: LuaValue): LuaValue {
host.enqueueBeep(millisec.checkint(), freq.tofloat())
return LuaValue.NONE
}
}
class ClearQueue(val host: BaseTerrarumComputer) : ZeroArgFunction() {
override fun call(): LuaValue {
host.clearBeepQueue()
return LuaValue.NONE
}
}
}

View File

@@ -23,6 +23,9 @@ open class SimpleTextTerminal(
phosphorColour: Color, override val width: Int, override val height: Int, private val host: BaseTerrarumComputer, phosphorColour: Color, override val width: Int, override val height: Int, private val host: BaseTerrarumComputer,
colour: Boolean = false, hires: Boolean = false colour: Boolean = false, hires: Boolean = false
) : Terminal { ) : Terminal {
private val DEBUG = false
/** /**
* Terminals must support AT LEAST 4 colours. * Terminals must support AT LEAST 4 colours.
* Color index 0 must be default background, index 3 must be default foreground * Color index 0 must be default background, index 3 must be default foreground
@@ -108,32 +111,6 @@ open class SimpleTextTerminal(
} }
wrap() wrap()
// start beep queue
if (beepQueue.size > 0 && beepCursor == -1) {
beepCursor = 0
}
// continue beep queue
if (beepCursor >= 0 && beepQueueLineExecTimer >= beepQueueGetLenOfPtn(beepCursor)) {
beepQueueLineExecTimer -= beepQueueGetLenOfPtn(beepCursor)
beepCursor += 1
beepQueueFired = false
}
// complete beep queue
if (beepCursor >= beepQueue.size) {
clearBeepQueue()
// println("!! Beep queue clear")
}
// actually play queue
if (beepCursor >= 0 && beepQueue.size > 0 && !beepQueueFired) {
beep(beepQueue[beepCursor].first, beepQueue[beepCursor].second)
beepQueueFired = true
}
if (beepQueueFired) beepQueueLineExecTimer += delta
} }
private fun wrap() { private fun wrap() {
@@ -332,48 +309,38 @@ open class SimpleTextTerminal(
foreColour = foreDefault foreColour = foreDefault
} }
private val maxDuration = 10000
// let's regard it as a tracker...
private val beepQueue = ArrayList<Pair<Int, Float>>()
private var beepCursor = -1
private var beepQueueLineExecTimer = 0 // millisec
private var beepQueueFired = false
/** /**
* @param duration: milliseconds * @param duration: milliseconds
* @param freg: Frequency (float) * @param freg: Frequency (float)
*/ */
override fun beep(duration: Int, freq: Float) { override fun beep(duration: Int, freq: Float) {
// println("!! Beep playing row $beepCursor, d ${Math.min(duration, maxDuration)} f $freq") // println("!! Beep playing row $beepCursor, d ${Math.min(duration, maxDuration)} f $freq")
host.playTone(Math.min(duration, maxDuration), freq) host.clearBeepQueue()
host.enqueueBeep(duration, freq)
} }
/** for "beep code" on modern BIOS. Pattern: - . */ /** for "beep code" on modern BIOS. */
override fun bell(pattern: String) { override fun bell(pattern: String) {
clearBeepQueue() host.clearBeepQueue()
val freq: Float =
if (host.luaJ_globals["computer"]["bellpitch"].isnil())
1000f
else
host.luaJ_globals["computer"]["bellpitch"].checkdouble().toFloat()
for (c in pattern) { for (c in pattern) {
when (c) { when (c) {
'.' -> { enqueueBeep(80, 1000f); enqueueBeep(80, 0f) } '.' -> { host.enqueueBeep(50, freq); host.enqueueBeep(50, 0f) }
'-' -> { enqueueBeep(250, 1000f); enqueueBeep(80, 0f) } '-' -> { host.enqueueBeep(200, freq); host.enqueueBeep(50, 0f) }
' ' -> { enqueueBeep(250, 0f) } '=' -> { host.enqueueBeep(500, freq); host.enqueueBeep(50, 0f) }
' ' -> { host.enqueueBeep(200, 0f) }
',' -> { host.enqueueBeep(50, 0f) }
else -> throw IllegalArgumentException("Unacceptable pattern: $c (from '$pattern')") else -> throw IllegalArgumentException("Unacceptable pattern: $c (from '$pattern')")
} }
} }
} }
fun clearBeepQueue() {
beepQueue.clear()
beepCursor = -1
beepQueueLineExecTimer = 0
}
fun enqueueBeep(duration: Int, freq: Float) {
beepQueue.add(Pair(Math.min(duration, maxDuration), freq))
}
fun beepQueueGetLenOfPtn(ptnIndex: Int) = beepQueue[ptnIndex].first
override var lastInputByte: Int = -1 override var lastInputByte: Int = -1
var sb: StringBuilder = StringBuilder() var sb: StringBuilder = StringBuilder()
private var inputOpen = false private var inputOpen = false
@@ -466,8 +433,6 @@ open class SimpleTextTerminal(
ASCII_DLE ASCII_DLE
) )
} }
private val DEBUG = true
} }
class ALException(errorCode: Int) : Exception("ALerror: $errorCode") { class ALException(errorCode: Int) : Exception("ALerror: $errorCode") {

View File

@@ -0,0 +1,10 @@
The Speaker API provides means to control computer's built-in beeper speaker.
\begin{tabularx}{\textwidth}{l l X}
\textbf{\large Function} & \textbf{\large Return} & \textbf{\large Description}
\\ \\
\endhead
speaker.enqueue(len: int, freq: num) & nil & Enqueues speaker driving information. Queues will be started automatically.
\\ \\
speaker.clear() & nil & Clears speaker queue.
\end{tabularx}

View File

@@ -1,3 +1,3 @@
\begin{itemize} \begin{itemize}
\item io library is limited to io.read (read a line from keyboard) and io.write (print without new line) \item io library is limited to io.read (read a line from keyboard) and io.write (print without new line). Use \emph{Filesystem} API for file I/O jobs.
\end{itemize} \end{itemize}

View File

@@ -8,7 +8,7 @@ ROMBASIC adds global functions and constants for operability.
\endhead \endhead
\unemph{\_G.}runScript(\textbf{fun}: str, \textbf{env}: str) & nil & Runs Lua script \textbf{fun} with the environment tag \textbf{env}. \unemph{\_G.}runScript(\textbf{fun}: str, \textbf{env}: str) & nil & Runs Lua script \textbf{fun} with the environment tag \textbf{env}.
\\ \\ \\ \\
\unemph{\_G.}bell(\textbf{pattern}: str) & nil & Strike bell (or beeper) with pattern. Accepted pattern letters: . - (space) Aliased to \unemph{\_G.}beep. \unemph{\_G.}bell(\textbf{pattern}: str) & nil & Strike bell (or beeper) with pattern. See section \emph{Bell Codes} for more information. Aliased to \unemph{\_G.}beep.
\\ \\ \\ \\
computer.totalMemory() & int & Returns the total size of the memory installed in the computer, in bytes. computer.totalMemory() & int & Returns the total size of the memory installed in the computer, in bytes.
\\ \\ \\ \\
@@ -52,4 +52,16 @@ ROMBASIC adds global functions and constants for operability.
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. 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.
\\ \\ \\ \\
computer.beep(\textbf{len}, \textbf{freq}) & nil & Generates square wave. \textbf{len} is integer, in milliseconds, \textbf{freq} is number, in Hertz. computer.beep(\textbf{len}, \textbf{freq}) & nil & Generates square wave. \textbf{len} is integer, in milliseconds, \textbf{freq} is number, in Hertz.
\end{tabularx}
\subsection{Bell Codes}
Bell Codes are patterns for driving bell/beeper. Each code is followed by short break of 50 milliseconds.
\begin{tabularx}{\textwidth}{l X l X}
\textbf{.} (dot) & Short beep. 50 ms & \textbf{-} (dash) & Medium beep. 200 ms
\\ \\
\textbf{=} (equal) & Long beep. 500 ms & \textbf{,} (comma) & Short break. 50 ms
\\ \\
(space) & Break. 200 ms
\end{tabularx} \end{tabularx}

View File

@@ -60,12 +60,17 @@
{2}{180.42001pt}} {2}{180.42001pt}}
\@writefile{toc}{\contentsline {section}{\numberline {1.6}Shell}{13}{section.1.6}} \@writefile{toc}{\contentsline {section}{\numberline {1.6}Shell}{13}{section.1.6}}
\gdef \LT@viii {\LT@entry \gdef \LT@viii {\LT@entry
{2}{161.65002pt}\LT@entry
{1}{45.25516pt}\LT@entry
{1}{128.09482pt}}
\@writefile{toc}{\contentsline {section}{\numberline {1.7}Speaker}{14}{section.1.7}}
\gdef \LT@ix {\LT@entry
{2}{139.76003pt}\LT@entry {2}{139.76003pt}\LT@entry
{1}{45.25516pt}\LT@entry {1}{45.25516pt}\LT@entry
{1}{149.98482pt}} {1}{149.98482pt}}
\@writefile{toc}{\contentsline {section}{\numberline {1.7}Terminal}{14}{section.1.7}} \@writefile{toc}{\contentsline {section}{\numberline {1.8}Terminal}{15}{section.1.8}}
\@writefile{toc}{\contentsline {subsection}{\numberline {1.7.1}Functions}{14}{subsection.1.7.1}} \@writefile{toc}{\contentsline {subsection}{\numberline {1.8.1}Functions}{15}{subsection.1.8.1}}
\gdef \LT@ix {\LT@entry \gdef \LT@x {\LT@entry
{1}{22.26001pt}\LT@entry {1}{22.26001pt}\LT@entry
{1}{39.16003pt}\LT@entry {1}{39.16003pt}\LT@entry
{1}{22.26001pt}\LT@entry {1}{22.26001pt}\LT@entry
@@ -74,58 +79,64 @@
{1}{49.88002pt}\LT@entry {1}{49.88002pt}\LT@entry
{1}{22.26001pt}\LT@entry {1}{22.26001pt}\LT@entry
{1}{58.02002pt}} {1}{58.02002pt}}
\@writefile{toc}{\contentsline {subsection}{\numberline {1.7.2}Standard Colours}{16}{subsection.1.7.2}} \@writefile{toc}{\contentsline {subsection}{\numberline {1.8.2}Standard Colours}{17}{subsection.1.8.2}}
\gdef \LT@x {\LT@entry \gdef \LT@xi {\LT@entry
{1}{28.3155pt}\LT@entry {1}{28.3155pt}\LT@entry
{1}{139.1845pt}\LT@entry {1}{139.1845pt}\LT@entry
{1}{28.3155pt}\LT@entry {1}{28.3155pt}\LT@entry
{1}{139.1845pt}} {1}{139.1845pt}}
\@writefile{toc}{\contentsline {subsection}{\numberline {1.7.3}Codepage}{17}{subsection.1.7.3}} \@writefile{toc}{\contentsline {subsection}{\numberline {1.8.3}Codepage}{18}{subsection.1.8.3}}
\@writefile{toc}{\contentsline {subsection}{\numberline {1.7.4}Accepted Control Sequences}{17}{subsection.1.7.4}} \@writefile{toc}{\contentsline {subsection}{\numberline {1.8.4}Accepted Control Sequences}{18}{subsection.1.8.4}}
\gdef \LT@xi {\LT@entry \gdef \LT@xii {\LT@entry
{2}{134.13005pt}\LT@entry {2}{134.13005pt}\LT@entry
{1}{45.25516pt}\LT@entry {1}{45.25516pt}\LT@entry
{1}{155.61479pt}} {1}{155.61479pt}}
\gdef \LT@xii {\LT@entry \gdef \LT@xiii {\LT@entry
{2}{118.04002pt}\LT@entry {2}{118.04002pt}\LT@entry
{2}{36.06001pt}\LT@entry {2}{36.06001pt}\LT@entry
{1}{180.89996pt}} {1}{180.89996pt}}
\@writefile{toc}{\contentsline {section}{\numberline {1.8}Lua Globals}{18}{section.1.8}} \@writefile{toc}{\contentsline {section}{\numberline {1.9}Lua Globals}{19}{section.1.9}}
\@writefile{toc}{\contentsline {subsection}{\numberline {1.8.1}Functions}{18}{subsection.1.8.1}} \@writefile{toc}{\contentsline {subsection}{\numberline {1.9.1}Functions}{19}{subsection.1.9.1}}
\@writefile{toc}{\contentsline {subsection}{\numberline {1.8.2}Constants}{18}{subsection.1.8.2}} \@writefile{toc}{\contentsline {subsection}{\numberline {1.9.2}Constants}{19}{subsection.1.9.2}}
\@writefile{toc}{\contentsline {section}{\numberline {1.9}Changes from Generic Lua Environment}{20}{section.1.9}} \gdef \LT@xiv {\LT@entry
{1}{49.09001pt}\LT@entry
{1}{90.49004pt}\LT@entry
{1}{53.81001pt}\LT@entry
{1}{104.22pt}}
\@writefile{toc}{\contentsline {subsection}{\numberline {1.9.3}Bell Codes}{20}{subsection.1.9.3}}
\@writefile{toc}{\contentsline {section}{\numberline {1.10}Changes from Generic Lua Environment}{22}{section.1.10}}
\@writefile{lof}{\addvspace {10pt}} \@writefile{lof}{\addvspace {10pt}}
\@writefile{lot}{\addvspace {10pt}} \@writefile{lot}{\addvspace {10pt}}
\@writefile{toc}{\contentsline {chapter}{\chapternumberline {2}Compatibility Layers---ComputerCraft}{21}{chapter.2}} \@writefile{toc}{\contentsline {chapter}{\chapternumberline {2}Compatibility Layers---ComputerCraft}{23}{chapter.2}}
\gdef \LT@xiii {\LT@entry \gdef \LT@xv {\LT@entry
{2}{108.45001pt}\LT@entry {2}{108.45001pt}\LT@entry
{2}{125.76003pt}} {2}{125.76003pt}}
\@writefile{toc}{\contentsline {section}{\numberline {2.1}Bit}{22}{section.2.1}} \@writefile{toc}{\contentsline {section}{\numberline {2.1}Bit}{24}{section.2.1}}
\@writefile{toc}{\contentsline {subsection}{\numberline {2.1.1}Functions}{22}{subsection.2.1.1}} \@writefile{toc}{\contentsline {subsection}{\numberline {2.1.1}Functions}{24}{subsection.2.1.1}}
\gdef \LT@xiv {\LT@entry \gdef \LT@xvi {\LT@entry
{1}{77.19011pt}\LT@entry {1}{77.19011pt}\LT@entry
{1}{68.63008pt}\LT@entry {1}{68.63008pt}\LT@entry
{1}{76.35007pt}\LT@entry {1}{76.35007pt}\LT@entry
{1}{76.36005pt}} {1}{76.36005pt}}
\@writefile{toc}{\contentsline {section}{\numberline {2.2}Colors}{23}{section.2.2}} \@writefile{toc}{\contentsline {section}{\numberline {2.2}Colors}{25}{section.2.2}}
\@writefile{toc}{\contentsline {subsection}{\numberline {2.2.1}Constants}{23}{subsection.2.2.1}} \@writefile{toc}{\contentsline {subsection}{\numberline {2.2.1}Constants}{25}{subsection.2.2.1}}
\@writefile{toc}{\contentsline {subsection}{\numberline {2.2.2}Functions}{23}{subsection.2.2.2}} \@writefile{toc}{\contentsline {subsection}{\numberline {2.2.2}Functions}{25}{subsection.2.2.2}}
\@writefile{toc}{\contentsline {section}{\numberline {2.3}Term}{24}{section.2.3}} \@writefile{toc}{\contentsline {section}{\numberline {2.3}Term}{26}{section.2.3}}
\@writefile{toc}{\contentsline {section}{\numberline {2.4}Filesystem}{25}{section.2.4}} \@writefile{toc}{\contentsline {section}{\numberline {2.4}Filesystem}{27}{section.2.4}}
\@writefile{lof}{\addvspace {10pt}} \@writefile{lof}{\addvspace {10pt}}
\@writefile{lot}{\addvspace {10pt}} \@writefile{lot}{\addvspace {10pt}}
\@writefile{toc}{\contentsline {chapter}{\chapternumberline {3}Compatibility Layers---OpenComputers}{27}{chapter.3}} \@writefile{toc}{\contentsline {chapter}{\chapternumberline {3}Compatibility Layers---OpenComputers}{29}{chapter.3}}
\@writefile{lof}{\addvspace {10pt}} \@writefile{lof}{\addvspace {10pt}}
\@writefile{lot}{\addvspace {10pt}} \@writefile{lot}{\addvspace {10pt}}
\@writefile{toc}{\contentsline {chapter}{\chapternumberline {4}Peripherals}{29}{chapter.4}} \@writefile{toc}{\contentsline {chapter}{\chapternumberline {4}Peripherals}{31}{chapter.4}}
\gdef \LT@xv {\LT@entry \gdef \LT@xvii {\LT@entry
{2}{71.78003pt}\LT@entry {2}{71.78003pt}\LT@entry
{1}{45.25516pt}\LT@entry {1}{45.25516pt}\LT@entry
{2}{153.90001pt}} {2}{153.90001pt}}
\@writefile{toc}{\contentsline {section}{\numberline {4.1}Line Printer}{30}{section.4.1}} \@writefile{toc}{\contentsline {section}{\numberline {4.1}Line Printer}{32}{section.4.1}}
\@writefile{toc}{\contentsline {subsection}{\numberline {4.1.1}Functions}{30}{subsection.4.1.1}} \@writefile{toc}{\contentsline {subsection}{\numberline {4.1.1}Functions}{32}{subsection.4.1.1}}
\@writefile{lof}{\addvspace {10pt}} \@writefile{lof}{\addvspace {10pt}}
\@writefile{lot}{\addvspace {10pt}} \@writefile{lot}{\addvspace {10pt}}
\@writefile{toc}{\contentsline {chapter}{\chapternumberline {5}References}{31}{chapter.5}} \@writefile{toc}{\contentsline {chapter}{\chapternumberline {5}References}{33}{chapter.5}}
\memsetcounter{lastsheet}{33} \memsetcounter{lastsheet}{35}
\memsetcounter{lastpage}{33} \memsetcounter{lastpage}{35}

View File

@@ -1,4 +1,4 @@
This is LuaTeX, Version beta-0.80.0 (TeX Live 2015) (rev 5238) (format=lualatex 2015.10.5) 27 SEP 2016 00:50 This is LuaTeX, Version beta-0.80.0 (TeX Live 2015) (rev 5238) (format=lualatex 2015.10.5) 28 SEP 2016 00:42
restricted \write18 enabled. restricted \write18 enabled.
file:line:error style messages enabled. file:line:error style messages enabled.
**romapidoc.tex **romapidoc.tex
@@ -552,7 +552,7 @@ luatexbase-attr: luatexbase.attributes["luaotfload@cursbase"] = 6
luatexbase-attr: luatexbase.attributes["luaotfload@curscurs"] = 7 luatexbase-attr: luatexbase.attributes["luaotfload@curscurs"] = 7
luatexbase-attr: luatexbase.attributes["luaotfload@cursdone"] = 8 luatexbase-attr: luatexbase.attributes["luaotfload@cursdone"] = 8
luatexbase-attr: luatexbase.attributes["luaotfload@state"] = 9 luatexbase-attr: luatexbase.attributes["luaotfload@state"] = 9
luaotfload | main : fontloader loaded in 0.029 seconds luaotfload | main : fontloader loaded in 0.032 seconds
luatexbase-mcb: inserting 'luaotfload.node_processor' luatexbase-mcb: inserting 'luaotfload.node_processor'
at position 1 in 'pre_linebreak_filter' at position 1 in 'pre_linebreak_filter'
luatexbase-mcb: inserting 'luaotfload.node_processor' luatexbase-mcb: inserting 'luaotfload.node_processor'
@@ -1534,6 +1534,13 @@ Underfull \hbox (badness 2707) in paragraph at lines 20--20
] (./api_shell.tex) [13 ] (./api_shell.tex) [13
] (./api_speaker.tex
Underfull \hbox (badness 6961) in paragraph at lines 10--10
[][]|\EU2/MyriadPro(0)/m/n/10 En-queues speaker driv-ing
[]
) [14
] (./api_terminal.tex ] (./api_terminal.tex
Underfull \hbox (badness 2165) in paragraph at lines 66--66 Underfull \hbox (badness 2165) in paragraph at lines 66--66
\EU2/MyriadPro(0)/m/n/10 nal. Graphic ter-mi-nals also can \EU2/MyriadPro(0)/m/n/10 nal. Graphic ter-mi-nals also can
@@ -1577,11 +1584,11 @@ Underfull \hbox (badness 10000) in paragraph at lines 66--66
[][]|\EU2/MyriadPro(0)/m/n/10 Re-turns cur-rent back-ground [][]|\EU2/MyriadPro(0)/m/n/10 Re-turns cur-rent back-ground
[] []
[14 [15
] [15] ] [16]
\cpimagew=\skip279 \cpimagew=\skip279
<mda.png, id=184, 4625.28pt x 1798.72pt> <mda.png, id=194, 4625.28pt x 1798.72pt>
File: mda.png Graphic file (type png) File: mda.png Graphic file (type png)
<use mda.png> <use mda.png>
Package pdftex.def Info: mda.png used on input line 88. Package pdftex.def Info: mda.png used on input line 88.
@@ -1589,22 +1596,17 @@ Package pdftex.def Info: mda.png used on input line 88.
Underfull \vbox (badness 10000) has occurred while \output is active [] Underfull \vbox (badness 10000) has occurred while \output is active []
[16] [17]
Underfull \hbox (badness 6658) in paragraph at lines 109--109 Underfull \hbox (badness 6658) in paragraph at lines 109--109
[][]|\EU2/MyriadPro(0)/m/n/10 DEL. Backspace and deletes [][]|\EU2/MyriadPro(0)/m/n/10 DEL. Backspace and deletes
[] []
) [17<./mda.png>] (./luaglobals.tex ) [18<./mda.png>] (./luaglobals.tex
Underfull \hbox (badness 1092) in paragraph at lines 16--16 Underfull \hbox (badness 1092) in paragraph at lines 16--16
\EU2/MyriadPro(0)/m/n/10 ory in-stalled in the com-puter, in \EU2/MyriadPro(0)/m/n/10 ory in-stalled in the com-puter, in
[] []
Overfull \hbox (38.91pt too wide) in alignment at lines 55--55
[] [] []
[]
Underfull \hbox (badness 3168) in paragraph at lines 55--55 Underfull \hbox (badness 3168) in paragraph at lines 55--55
[][]|\EU2/MyriadPro(0)/m/n/10 EM dash rep-re-sented by box-drawing [][]|\EU2/MyriadPro(0)/m/n/10 EM dash rep-re-sented by box-drawing
[] []
@@ -1639,76 +1641,68 @@ Underfull \hbox (badness 6364) in paragraph at lines 55--55
[][]|\EU2/MyriadPro(0)/m/n/10 Ascii con-trol se-quence DLE. Used to [][]|\EU2/MyriadPro(0)/m/n/10 Ascii con-trol se-quence DLE. Used to
[] []
[19
Package longtable Warning: Column widths have changed ] [20]) [21] (./luadifferences.tex) [22
(longtable) in table 1.12 on input line 55.
[18
]) [19] (./luadifferences.tex) [20
] ]
luaotfload | load : Lookup/name: "MyriadPro" -> "MyriadPro-Bold.otf" [21 luaotfload | load : Lookup/name: "MyriadPro" -> "MyriadPro-Bold.otf" [23
] (./cc_bit.tex) [22 ] (./cc_bit.tex) [24
] ]
(./cc_colors.tex) [23 (./cc_colors.tex) [25
] [24
] [25
] [26 ] [26
] [27] [28 ] [27
] [28
] [29] [30
] [29] (./peri_lp.tex) [30 ] [31] (./peri_lp.tex) [32
] ]
[31 [33
] [32 ] [34
] [33 ] [35
] ]
\tf@toc=\write5 \tf@toc=\write5
\openout5 = romapidoc.toc \openout5 = romapidoc.toc
Package atveryend Info: Empty hook `BeforeClearDocument' on input line 168.
Package atveryend Info: Empty hook `AfterLastShipout' on input line 168.
Package longtable Warning: Table widths have changed. Rerun LaTeX. (./romapidoc.aux)
Package atveryend Info: Executing hook `AtVeryEndDocument' on input line 168.
Package atveryend Info: Empty hook `BeforeClearDocument' on input line 165. Package atveryend Info: Executing hook `AtEndAfterFileList' on input line 168.
Package atveryend Info: Empty hook `AfterLastShipout' on input line 165.
(./romapidoc.aux)
Package atveryend Info: Executing hook `AtVeryEndDocument' on input line 165.
Package atveryend Info: Executing hook `AtEndAfterFileList' on input line 165.
Package rerunfilecheck Info: File `romapidoc.out' has not changed. Package rerunfilecheck Info: File `romapidoc.out' has not changed.
(rerunfilecheck) Checksum: A4B98F6CE220B3C970CC4D5ECA7A4CF8;2202. (rerunfilecheck) Checksum: 08AA264EF0CA42804AF136BDE97F5E44;2293.
Package atveryend Info: Empty hook `AtVeryVeryEnd' on input line 165. Package atveryend Info: Empty hook `AtVeryVeryEnd' on input line 168.
) )
Here is how much of LuaTeX's memory you used: Here is how much of LuaTeX's memory you used:
27266 strings out of 494693 27283 strings out of 494693
125070,662416 words of node,token memory allocated 125070,662416 words of node,token memory allocated
778 words of node memory still in use: 780 words of node memory still in use:
3 hlist, 1 vlist, 1 rule, 2 glue, 1 kern, 5 attribute, 141 glue_spec, 5 attri 3 hlist, 1 vlist, 1 rule, 2 glue, 1 kern, 5 attribute, 141 glue_spec, 5 attri
bute_list, 2 write nodes bute_list, 2 write nodes
avail lists: 2:14493,3:271,4:3580,5:1301,6:6145,7:343,8:21,9:884,10:390 avail lists: 2:14449,3:272,4:3579,5:1301,6:6145,7:343,8:22,9:884,10:390
30200 multiletter control sequences out of 65536+600000 30205 multiletter control sequences out of 65536+600000
62 fonts using 5300671 bytes 62 fonts using 5300671 bytes
67i,12n,59p,1189b,492s stack positions out of 5000i,500n,10000p,200000b,100000s 67i,12n,59p,1189b,492s stack positions out of 5000i,500n,10000p,200000b,100000s
</Library/Fonts/MyriadPro-It.otf></Library/Fonts/MyriadPro-Regular.otf></Library </Library/Fonts/MyriadPro-It.otf></Library/Fonts/MyriadPro-Regular.otf></Library
/Fonts/MyriadPro-Bold.otf> /Fonts/MyriadPro-Bold.otf>
Output written on romapidoc.pdf (33 pages, 95556 bytes). Output written on romapidoc.pdf (35 pages, 97609 bytes).
PDF statistics: 304 PDF objects out of 1000 (max. 8388607) PDF statistics: 320 PDF objects out of 1000 (max. 8388607)
255 compressed objects within 3 object streams 269 compressed objects within 3 object streams
85 named destinations out of 1000 (max. 131072) 91 named destinations out of 1000 (max. 131072)
153 words of extra memory for PDF output out of 10000 (max. 10000000) 161 words of extra memory for PDF output out of 10000 (max. 10000000)

View File

@@ -5,15 +5,16 @@
\BOOKMARK [1][-]{section.1.4}{\376\377\000K\000e\000y\000s}{chapter.1}% 5 \BOOKMARK [1][-]{section.1.4}{\376\377\000K\000e\000y\000s}{chapter.1}% 5
\BOOKMARK [1][-]{section.1.5}{\376\377\000S\000e\000c\000u\000r\000i\000t\000y}{chapter.1}% 6 \BOOKMARK [1][-]{section.1.5}{\376\377\000S\000e\000c\000u\000r\000i\000t\000y}{chapter.1}% 6
\BOOKMARK [1][-]{section.1.6}{\376\377\000S\000h\000e\000l\000l}{chapter.1}% 7 \BOOKMARK [1][-]{section.1.6}{\376\377\000S\000h\000e\000l\000l}{chapter.1}% 7
\BOOKMARK [1][-]{section.1.7}{\376\377\000T\000e\000r\000m\000i\000n\000a\000l}{chapter.1}% 8 \BOOKMARK [1][-]{section.1.7}{\376\377\000S\000p\000e\000a\000k\000e\000r}{chapter.1}% 8
\BOOKMARK [1][-]{section.1.8}{\376\377\000L\000u\000a\000\040\000G\000l\000o\000b\000a\000l\000s}{chapter.1}% 9 \BOOKMARK [1][-]{section.1.8}{\376\377\000T\000e\000r\000m\000i\000n\000a\000l}{chapter.1}% 9
\BOOKMARK [1][-]{section.1.9}{\376\377\000C\000h\000a\000n\000g\000e\000s\000\040\000f\000r\000o\000m\000\040\000G\000e\000n\000e\000r\000i\000c\000\040\000L\000u\000a\000\040\000E\000n\000v\000i\000r\000o\000n\000m\000e\000n\000t}{chapter.1}% 10 \BOOKMARK [1][-]{section.1.9}{\376\377\000L\000u\000a\000\040\000G\000l\000o\000b\000a\000l\000s}{chapter.1}% 10
\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}{}% 11 \BOOKMARK [1][-]{section.1.10}{\376\377\000C\000h\000a\000n\000g\000e\000s\000\040\000f\000r\000o\000m\000\040\000G\000e\000n\000e\000r\000i\000c\000\040\000L\000u\000a\000\040\000E\000n\000v\000i\000r\000o\000n\000m\000e\000n\000t}{chapter.1}% 11
\BOOKMARK [1][-]{section.2.1}{\376\377\000B\000i\000t}{chapter.2}% 12 \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}{}% 12
\BOOKMARK [1][-]{section.2.2}{\376\377\000C\000o\000l\000o\000r\000s}{chapter.2}% 13 \BOOKMARK [1][-]{section.2.1}{\376\377\000B\000i\000t}{chapter.2}% 13
\BOOKMARK [1][-]{section.2.3}{\376\377\000T\000e\000r\000m}{chapter.2}% 14 \BOOKMARK [1][-]{section.2.2}{\376\377\000C\000o\000l\000o\000r\000s}{chapter.2}% 14
\BOOKMARK [1][-]{section.2.4}{\376\377\000F\000i\000l\000e\000s\000y\000s\000t\000e\000m}{chapter.2}% 15 \BOOKMARK [1][-]{section.2.3}{\376\377\000T\000e\000r\000m}{chapter.2}% 15
\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}{}% 16 \BOOKMARK [1][-]{section.2.4}{\376\377\000F\000i\000l\000e\000s\000y\000s\000t\000e\000m}{chapter.2}% 16
\BOOKMARK [0][-]{chapter.4}{\376\377\000P\000e\000r\000i\000p\000h\000e\000r\000a\000l\000s}{}% 17 \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}{}% 17
\BOOKMARK [1][-]{section.4.1}{\376\377\000L\000i\000n\000e\000\040\000P\000r\000i\000n\000t\000e\000r}{chapter.4}% 18 \BOOKMARK [0][-]{chapter.4}{\376\377\000P\000e\000r\000i\000p\000h\000e\000r\000a\000l\000s}{}% 18
\BOOKMARK [0][-]{chapter.5}{\376\377\000R\000e\000f\000e\000r\000e\000n\000c\000e\000s}{}% 19 \BOOKMARK [1][-]{section.4.1}{\376\377\000L\000i\000n\000e\000\040\000P\000r\000i\000n\000t\000e\000r}{chapter.4}% 19
\BOOKMARK [0][-]{chapter.5}{\376\377\000R\000e\000f\000e\000r\000e\000n\000c\000e\000s}{}% 20

Binary file not shown.

View File

@@ -115,6 +115,9 @@
\section{Shell} \section{Shell}
\input{api_shell} \input{api_shell}
\section{Speaker}
\input{api_speaker}
\section{Terminal} \section{Terminal}
\input{api_terminal} \input{api_terminal}

View File

@@ -11,25 +11,27 @@
\contentsline {section}{\numberline {1.5}Security}{12}{section.1.5} \contentsline {section}{\numberline {1.5}Security}{12}{section.1.5}
\contentsline {subsection}{\numberline {1.5.1}Functions}{12}{subsection.1.5.1} \contentsline {subsection}{\numberline {1.5.1}Functions}{12}{subsection.1.5.1}
\contentsline {section}{\numberline {1.6}Shell}{13}{section.1.6} \contentsline {section}{\numberline {1.6}Shell}{13}{section.1.6}
\contentsline {section}{\numberline {1.7}Terminal}{14}{section.1.7} \contentsline {section}{\numberline {1.7}Speaker}{14}{section.1.7}
\contentsline {subsection}{\numberline {1.7.1}Functions}{14}{subsection.1.7.1} \contentsline {section}{\numberline {1.8}Terminal}{15}{section.1.8}
\contentsline {subsection}{\numberline {1.7.2}Standard Colours}{16}{subsection.1.7.2} \contentsline {subsection}{\numberline {1.8.1}Functions}{15}{subsection.1.8.1}
\contentsline {subsection}{\numberline {1.7.3}Codepage}{17}{subsection.1.7.3} \contentsline {subsection}{\numberline {1.8.2}Standard Colours}{17}{subsection.1.8.2}
\contentsline {subsection}{\numberline {1.7.4}Accepted Control Sequences}{17}{subsection.1.7.4} \contentsline {subsection}{\numberline {1.8.3}Codepage}{18}{subsection.1.8.3}
\contentsline {section}{\numberline {1.8}Lua Globals}{18}{section.1.8} \contentsline {subsection}{\numberline {1.8.4}Accepted Control Sequences}{18}{subsection.1.8.4}
\contentsline {subsection}{\numberline {1.8.1}Functions}{18}{subsection.1.8.1} \contentsline {section}{\numberline {1.9}Lua Globals}{19}{section.1.9}
\contentsline {subsection}{\numberline {1.8.2}Constants}{18}{subsection.1.8.2} \contentsline {subsection}{\numberline {1.9.1}Functions}{19}{subsection.1.9.1}
\contentsline {section}{\numberline {1.9}Changes from Generic Lua Environment}{20}{section.1.9} \contentsline {subsection}{\numberline {1.9.2}Constants}{19}{subsection.1.9.2}
\contentsline {chapter}{\chapternumberline {2}Compatibility Layers---ComputerCraft}{21}{chapter.2} \contentsline {subsection}{\numberline {1.9.3}Bell Codes}{20}{subsection.1.9.3}
\contentsline {section}{\numberline {2.1}Bit}{22}{section.2.1} \contentsline {section}{\numberline {1.10}Changes from Generic Lua Environment}{22}{section.1.10}
\contentsline {subsection}{\numberline {2.1.1}Functions}{22}{subsection.2.1.1} \contentsline {chapter}{\chapternumberline {2}Compatibility Layers---ComputerCraft}{23}{chapter.2}
\contentsline {section}{\numberline {2.2}Colors}{23}{section.2.2} \contentsline {section}{\numberline {2.1}Bit}{24}{section.2.1}
\contentsline {subsection}{\numberline {2.2.1}Constants}{23}{subsection.2.2.1} \contentsline {subsection}{\numberline {2.1.1}Functions}{24}{subsection.2.1.1}
\contentsline {subsection}{\numberline {2.2.2}Functions}{23}{subsection.2.2.2} \contentsline {section}{\numberline {2.2}Colors}{25}{section.2.2}
\contentsline {section}{\numberline {2.3}Term}{24}{section.2.3} \contentsline {subsection}{\numberline {2.2.1}Constants}{25}{subsection.2.2.1}
\contentsline {section}{\numberline {2.4}Filesystem}{25}{section.2.4} \contentsline {subsection}{\numberline {2.2.2}Functions}{25}{subsection.2.2.2}
\contentsline {chapter}{\chapternumberline {3}Compatibility Layers---OpenComputers}{27}{chapter.3} \contentsline {section}{\numberline {2.3}Term}{26}{section.2.3}
\contentsline {chapter}{\chapternumberline {4}Peripherals}{29}{chapter.4} \contentsline {section}{\numberline {2.4}Filesystem}{27}{section.2.4}
\contentsline {section}{\numberline {4.1}Line Printer}{30}{section.4.1} \contentsline {chapter}{\chapternumberline {3}Compatibility Layers---OpenComputers}{29}{chapter.3}
\contentsline {subsection}{\numberline {4.1.1}Functions}{30}{subsection.4.1.1} \contentsline {chapter}{\chapternumberline {4}Peripherals}{31}{chapter.4}
\contentsline {chapter}{\chapternumberline {5}References}{31}{chapter.5} \contentsline {section}{\numberline {4.1}Line Printer}{32}{section.4.1}
\contentsline {subsection}{\numberline {4.1.1}Functions}{32}{subsection.4.1.1}
\contentsline {chapter}{\chapternumberline {5}References}{33}{chapter.5}