project64/JS-API-Documentation.html

2072 lines
172 KiB
HTML
Raw Normal View History

<!DOCTYPE html>
<!-- Generated Sep 02 2021 -->
<!-- YAML source: https://github.com/shygoo/pj64d-docs -->
<head>
<title>Project64 JavaScript API 2021.09.02</title>
<link href='https://fonts.googleapis.com/css?family=Open+Sans:400,400italic,700,700italic' rel='stylesheet' type='text/css'>
<style>
:root {
--clr-bg0: #EEE;
--clr-bg1: #FFF;
--clr-bg2: #DDD;
--clr-bg3: #CCC;
--clr-bg4: #BBB;
--clr-text: #222;
--clr-hr: #ECC;
--clr-link: #090;
--clr-link-hover: #070;
--clr-link-unstable: #990;
--clr-link-unstable-hover: #770;
--clr-highlight: #DFD;
--clr-tag-blue: #8AD;
--clr-tag-red: #D77;
--clr-js-keyword: #22F;
--clr-js-string: #880;
--clr-js-number: #722;
--clr-js-comment: #272;
--clr-js-word: #222;
--clr-js-etc: #666;
}
[data-theme="dark"] {
--clr-bg0: #222;
--clr-bg1: #2A2A2A;
--clr-bg2: #444;
--clr-bg3: #555;
--clr-bg4: #666;
--clr-text: #FFF;
--clr-hr: #744;
--clr-link: #8D8;
--clr-link-hover: #7C7;
--clr-link-unstable: #DD8;
--clr-link-unstable-hover: #CC7;
--clr-highlight: #252;
--clr-tag-blue: #247;
--clr-tag-red: #722;
--clr-js-keyword: #67F;
--clr-js-string: #FFA;
--clr-js-number: #FAA;
--clr-js-comment: #7A7;
--clr-js-word: #FFF;
--clr-js-etc: #AAA;
}
*::-webkit-scrollbar {
background: #FFF;
background: var(--clr-bg1);
border: 1px solid #FFF;
border-color: var(--clr-bg1);
width: 1.2em;
padding: 2px;
margin: 2px;
}
*::-webkit-scrollbar-thumb {
background: #DDD;
background: var(--clr-bg2);
border: 2px solid #FFF;
border-color: var(--clr-bg1);
}
*::-webkit-scrollbar-thumb:hover {
background: #CCC;
background: var(--clr-bg3);
}
*::-webkit-scrollbar-thumb:active {
background: #BBB;
background: var(--clr-bg4);
}
body {
margin: 0px;
background: #EEE;
background: var(--clr-bg0);
font-family: 'Open Sans', sans-serif;
font-size: 14px;
color: #222;
color: var(--clr-text);
}
a {
color: #090;
color: var(--clr-link);
text-decoration: none;
}
a:hover {
color: #070;
color: var(--clr-link-hover);
}
table {
border-collapse: collapse;
border-spacing: 0px;
font-size: inherit;
}
thead {
font-weight: bold;
background: #EEE;
background: var(--clr-bg0);
}
td {
border: 1px solid #CCC;
border-color: var(--clr-bg3);
padding: 2px 6px;
}
ul {
color: #222;
color: var(--clr-text);
padding-inline-start: 20px;
}
hr {
border: none;
border-top: 1px solid #ECC;
border-color: var(--clr-hr);
}
div.pagetitle {
font-size: 1.5em;
font-weight: bold;
}
div.module {
border-top: 1px solid #ECC;
border-color: var(--clr-hr);
padding: 20px;
margin-bottom: 10px;
background: #FFF;
background: var(--clr-bg1);
}
div.modtitle {
font-size: 2em;
font-weight: bold;
}
div.prop {
border-top: 1px solid #DDD;
border-color: var(--clr-bg2);
padding-top: 20px;
margin-top: 20px;
font-size: 1.3em;
font-weight: bold;
}
span.title:target {
background: #DFD;
background: var(--clr-highlight);
}
span.title2 {
font-size: 1.3em;
font-weight: bold;
}
div.tsproto {
font-size: 0.8em;
font-family: monospace;
}
div.desc {
margin-top: 10px;
padding: 5px;
}
span.snip {
display: inline-block;
background: #EEE;
background: var(--clr-bg0);
font-family: monospace;
padding-left: 2px;
padding-right: 2px;
}
div.tag {
float:right;
font-size: 12px;
padding: 2px 8px;
border-radius: 4px;
font-weight: normal;
}
div.tag.blue {
background: #8AD;
background: var(--clr-tag-blue);
}
div.tag.red {
background: #D77;
background: var(--clr-tag-red);
}
div.sidebar {
width: 440px;
position: fixed;
top: 0px;
left: 0px;
bottom: 0px;
overflow-y: auto;
background: #FFF;
background: var(--clr-bg1);
}
div.sidebar-content {
font-size: 13px;
padding: 10px;
}
div.content {
margin-left: 440px;
padding: 10px;
}
pre.ex {
margin-top: 10px;
padding: 10px;
font-family: monospace;
font-size: 0.9em;
background: #EEE;
background: var(--clr-bg0);
color: #666;
color: var(--clr-js-etc);
white-space: pre-wrap;
}
a.unstable {
color: var(--clr-link-unstable);
}
a.unstable:hover {
color: var(--clr-link-unstable-hover);
}
span.js-keyword { color: #22F; color: var(--clr-js-keyword); }
span.js-string { color: #880; color: var(--clr-js-string); }
span.js-number { color: #722; color: var(--clr-js-number); }
span.js-comment { color: #272; color: var(--clr-js-comment); }
span.js-word { color: #222; color: var(--clr-js-word); }
</style>
<script>
if(localStorage && localStorage.getItem('theme')) {
document.documentElement.setAttribute('data-theme', localStorage.getItem('theme'));
}
else if(window.matchMedia && window.matchMedia("(prefers-color-scheme: dark)").matches) {
document.documentElement.setAttribute('data-theme', 'dark');
}
window.addEventListener('load', function() {
if(document.documentElement.getAttribute('data-theme') == 'dark') {
document.querySelector('#darkmode-toggle').checked = true;
}
document.querySelector('#darkmode-toggle').onchange = function(e) {
var theme = e.target.checked ? 'dark' : 'default';
document.documentElement.setAttribute('data-theme', theme);
if(localStorage) {
localStorage.setItem('theme', theme);
}
}
});
</script>
</head>
<body>
<div class="sidebar">
<div class="sidebar-content">
<div class="pagetitle">Project64 JavaScript API</div>
2021.09.02
<hr>
<ul>
<p><li><a class="" href="#Project64 JavaScript API">Project64 JavaScript API</a><ul>
<li><a class="" href="#Required_settings">Required settings</a></li>
<li><a class="" href="#Script_console">Script console</a></li>
<li><a class="" href="#JavaScript_environment">JavaScript environment</a></li>
</ul></li></p>
<p><li><a class="" href="#console">console</a>: Console interface<ul>
<li><a class="" href="#console_log">console.log(message[, ...])</a></li>
<li><a class="" href="#console_print">console.print(message[, ...])</a></li>
<li><a class="" href="#console_error">console.error(err)</a></li>
<li><a class="" href="#console_clear">console.clear()</a></li>
<li><a class="" href="#console_listen">console.listen(inputListener)</a></li>
</ul></li></p>
<p><li><a class="" href="#pj64">pj64</a>: Project64 interface<ul>
<li><a class="" href="#pj64_open">pj64.open(romPath)</a></li>
<li><a class="" href="#pj64_close">pj64.close()</a></li>
<li><a class="" href="#pj64_reset">pj64.reset([soft])</a></li>
<li><a class="" href="#pj64_pause">pj64.pause()</a></li>
<li><a class="" href="#pj64_resume">pj64.resume()</a></li>
<li><a class="" href="#pj64_limitfps">pj64.limitfps(limitFps)</a></li>
<li><a class="" href="#pj64_installDirectory">pj64.installDirectory</a></li>
<li><a class="" href="#pj64_scriptsDirectory">pj64.scriptsDirectory</a></li>
<li><a class="" href="#pj64_modulesDirectory">pj64.modulesDirectory</a></li>
<li><a class="" href="#pj64_romDirectory">pj64.romDirectory</a></li>
<li><a class="" href="#pj64_romInfo">pj64.romInfo</a></li>
</ul></li></p>
<p><li><a class="" href="#mem">mem</a>: N64 memory interface<ul>
<li><a class="" href="#mem__">mem.u8|u16|u32|s8|s16|s32|f32|f64</a></li>
<li><a class="" href="#mem_bindvar">mem.bindvar(object, address, name, typeId)</a></li>
<li><a class="" href="#mem_bindvars">mem.bindvars(object, vars)</a></li>
<li><a class="" href="#mem_bindstruct">mem.bindstruct(object, address, properties)</a></li>
<li><a class="" href="#mem_typedef">mem.typedef(properties)</a></li>
<li><a class="" href="#mem_getblock">mem.getblock(address, length)</a></li>
<li><a class="" href="#mem_setblock">mem.setblock(address, data[, length])</a></li>
<li><a class="" href="#mem_getstring">mem.getstring(address[, length])</a></li>
<li><a class="" href="#mem_setstring">mem.setstring(address, data[, length])</a></li>
<li><a class="" href="#mem_ramSize">mem.ramSize</a></li>
<li><a class="" href="#mem_romSize">mem.romSize</a></li>
<li><a class="" href="#mem_ptr">mem.ptr</a></li>
</ul></li></p>
<p><li><a class="" href="#events">events</a>: Event hooking interface<ul>
<li><a class="" href="#events_onstatechange">events.onstatechange(callback)</a></li>
<li><a class="" href="#EmuStateChangeEvent">EmuStateChangeEvent</a></li>
<li><a class="" href="#events_onexec">events.onexec(address, callback)</a></li>
<li><a class="" href="#CPUExecEvent">CPUExecEvent</a></li>
<li><a class="" href="#events_onread">events.onread(address, callback)</a></li>
<li><a class="" href="#events_onwrite">events.onwrite(address, callback)</a></li>
<li><a class="" href="#CPUReadWriteEvent">CPUReadWriteEvent</a></li>
<li><a class="" href="#events_onopcode">events.onopcode(address, opcode, mask, callback)</a></li>
<li><a class="" href="#CPUOpcodeEvent">CPUOpcodeEvent</a></li>
<li><a class="" href="#events_ongprvalue">events.ongprvalue(address, regFlags, value, callback)</a></li>
<li><a class="" href="#GPR_flags">General purpose register flags</a></li>
<li><a class="" href="#CPURegValueEvent">CPURegValueEvent</a></li>
<li><a class="" href="#events_onpifread">events.onpifread(callback)</a></li>
<li><a class="" href="#GenericEvent">GenericEvent</a></li>
<li><a class="" href="#events_onsptask">events.onsptask(callback)</a></li>
<li><a class="" href="#SPTaskEvent">SPTaskEvent</a></li>
<li><a class="" href="#events_onpidma">events.onpidma(callback)</a></li>
<li><a class="" href="#PIEvent">PIEvent</a></li>
<li><a class="" href="#events_onmousedown">events.onmousedown(callback)</a></li>
<li><a class="" href="#events_onmouseup">events.onmouseup(callback)</a></li>
<li><a class="" href="#events_onmousemove">events.onmousemove(callback)</a></li>
<li><a class="" href="#MouseEvent">MouseEvent</a></li>
<li><a class="" href="#events_remove">events.remove(callbackId)</a></li>
<li><a class="" href="#AddressRange">new AddressRange(start, end)</a></li>
</ul></li></p>
<p><li><a class="" href="#N64Image">N64Image</a>: N64 image class<ul>
<li><a class="" href="#new_N64Image">new N64Image(width, height[, format [, pixels[, palette]]])</a></li>
<li><a class="" href="#N64Image_fromPNG">N64Image.fromPNG(pngData[, format])</a></li>
<li><a class="" href="#N64Image_format">N64Image.format(gbiFmt, gbiSiz[, gbiTlutFmt])</a></li>
<li><a class="" href="#N64Image_bpp">N64Image.bpp(format)</a></li>
<li><a class="" href="#image_toPNG">image.toPNG()</a></li>
<li><a class="" href="#image_update">image.update()</a></li>
<li><a class="" href="#image_format">image.format</a></li>
<li><a class="" href="#image_width">image.width</a></li>
<li><a class="" href="#image_height">image.height</a></li>
<li><a class="" href="#image_pixels">image.pixels</a></li>
<li><a class="" href="#image_palette">image.palette</a></li>
</ul></li></p>
<p><li><a class="" href="#cpu">cpu</a>: CPU register interface<ul>
<li><a class="" href="#cpu_pc">cpu.pc</a></li>
<li><a class="" href="#cpu_hi">cpu.hi</a></li>
<li><a class="" href="#cpu_lo">cpu.lo</a></li>
<li><a class="" href="#cpu_uhi">cpu.uhi</a></li>
<li><a class="" href="#cpu_ulo">cpu.ulo</a></li>
<li><a class="" href="#cpu_gpr__">cpu.gpr.r0|at|v0|v1..ra</a></li>
<li><a class="" href="#cpu_ugpr__">cpu.ugpr.r0|at|v0|v1..ra</a></li>
<li><a class="" href="#cpu_fpr__">cpu.fpr.f0..f31</a></li>
<li><a class="" href="#cpu_dfpr__">cpu.dfpr.f0..f30</a></li>
<li><a class="" href="#cpu_cop0">cpu.cop0.index..errorepc</a></li>
</ul></li></p>
<p><li><a class="" href="#debug">debug</a>: Debugger interface<ul>
<li><a class="" href="#debug_breakhere">debug.breakhere([silent])</a></li>
<li><a class="" href="#debug_resume">debug.resume()</a></li>
<li><a class="" href="#debug_step">debug.step()</a></li>
<li><a class="" href="#debug_skip">debug.skip()</a></li>
<li><a class="" href="#debug_showmemory">debug.showmemory(address[, physical])</a></li>
<li><a class="" href="#debug_showcommands">debug.showcommands(address)</a></li>
<li><a class="" href="#debug_paused">debug.paused</a></li>
</ul></li></p>
<p><li><a class="" href="#asm">asm</a>: ASM utilities<ul>
<li><a class="" href="#asm_encode">asm.encode(command[, address])</a></li>
<li><a class="" href="#asm_decode">asm.decode(opcode[, address])</a></li>
<li><a class="" href="#asm_gprname">asm.gprname(regIndex)</a></li>
</ul></li></p>
<p><li><a class="" href="#fs">fs</a>: File system interface<ul>
<li><a class="" href="#fs_open">fs.open(path, mode)</a></li>
<li><a class="" href="#fs_close">fs.close(fd)</a></li>
<li><a class="" href="#fs_write">fs.write(fd, buffer[, offset[, length[, position]]])</a></li>
<li><a class="" href="#fs_writefile">fs.writefile(path, buffer)</a></li>
<li><a class="" href="#fs_read">fs.read(fd, buffer, offset, length, position)</a></li>
<li><a class="" href="#fs_readfile">fs.readfile(path)</a></li>
<li><a class="" href="#fs_fstat">fs.fstat(fd)</a></li>
<li><a class="" href="#fs_stat">fs.stat(path)</a></li>
<li><a class="" href="#fs_unlink">fs.unlink(path)</a></li>
<li><a class="" href="#fs_mkdir">fs.mkdir(path)</a></li>
<li><a class="" href="#fs_rmdir">fs.rmdir(path)</a></li>
<li><a class="" href="#fs_readdir">fs.readdir(path)</a></li>
<li><a class="" href="#fs_Stats">fs.Stats</a></li>
</ul></li></p>
<p><li><a class="" href="#Socket">Socket</a>: TCP socket class<ul>
<li><a class="" href="#new_Socket">new Socket([options])</a></li>
<li><a class="" href="#socket_connect">socket.connect(port, host[, connectListener])</a></li>
<li><a class="" href="#socket_write">socket.write(data[, callback])</a></li>
<li><a class="" href="#socket_end">socket.end([data[, callback]])</a></li>
<li><a class="" href="#socket_close">socket.close()</a></li>
<li><a class="" href="#socket_on_connect">socket.on('connect', listener)</a></li>
<li><a class="" href="#socket_on_lookup">socket.on('lookup', listener)</a></li>
<li><a class="" href="#socket_on_data">socket.on('data', listener)</a></li>
<li><a class="" href="#socket_on_end">socket.on('end', listener)</a></li>
<li><a class="" href="#socket_on_close">socket.on('close', listener)</a></li>
<li><a class="" href="#socket_on_drain">socket.on('drain', listener)</a></li>
<li><a class="" href="#socket_on_error">socket.on('error', listener)</a></li>
<li><a class="" href="#socket_off">socket.off(eventName, listener)</a></li>
<li><a class="" href="#socket_remoteAddress">socket.remoteAddress</a></li>
<li><a class="" href="#socket_remotePort">socket.remotePort</a></li>
<li><a class="" href="#socket_localAddress">socket.localAddress</a></li>
<li><a class="" href="#socket_localPort">socket.localPort</a></li>
<li><a class="" href="#socket_addressFamily">socket.addressFamily</a></li>
</ul></li></p>
<p><li><a class="" href="#Server">Server</a>: TCP server class<ul>
<li><a class="" href="#new_Server">new Server()</a></li>
<li><a class="" href="#server_listen">server.listen(port[, address])</a></li>
<li><a class="" href="#server_close">server.close()</a></li>
<li><a class="" href="#server_on_connection">server.on('connection', listener)</a></li>
<li><a class="" href="#server_on_listening">server.on('listening', listener)</a></li>
<li><a class="" href="#server_on_close">server.on('close', listener)</a></li>
<li><a class="" href="#server_on_error">server.on('error', listener)</a></li>
<li><a class="" href="#server_off">server.off(eventName, listener)</a></li>
<li><a class="" href="#server_port">server.port</a></li>
<li><a class="" href="#server_address">server.address</a></li>
<li><a class="" href="#server_addressFamily">server.addressFamily</a></li>
</ul></li></p>
<p><li><a class="" href="#script">script</a>: Script instance configuration interface<ul>
<li><a class="" href="#script_keepalive">script.keepalive(keepAlive)</a></li>
<li><a class="" href="#script_timeout">script.timeout(milliseconds)</a></li>
</ul></li></p>
<p><li><a class="" href="#Globals">Globals</a><ul>
<li><a class="" href="#global">global</a></li>
<li><a class="" href="#require">require(id)</a></li>
<li><a class="" href="#exec">exec(command[, options])</a></li>
<li><a class="" href="#alert">alert(message[, caption])</a></li>
<li><a class="" href="#setTimeout">setTimeout(callback, delay)</a></li>
<li><a class="" href="#clearTimeout">clearTimeout(timeoutId)</a></li>
<li><a class="" href="#setInterval">setInterval(callback, delay)</a></li>
<li><a class="" href="#clearInterval">clearInterval(intervalId)</a></li>
<li><a class="" href="#number_hex">number.hex([numChars])</a></li>
<li><a class="" href="#type_ids">Type IDs</a></li>
<li><a class="" href="#N64_memory_addresses">N64 memory addresses</a></li>
<li><a class="" href="#Miscellaneous">Miscellaneous</a></li>
</ul></li></p>
</ul>
<hr>
<label style="font-size: 12px; vertical-align: middle; user-select: none;">
<input id="darkmode-toggle" type="checkbox" style="vertical-align: bottom; margin-right: 5px;"/>
Dark theme
</label>
</div>
</div>
<div class="content">
<!-- Project64 JavaScript API -->
<div class="module">
<div class="modtitle"><span class="title" id="Project64 JavaScript API">Project64 JavaScript API</span></div>
<!-- Required_settings -->
<p><div class="prop"><span class="title" id="Required_settings">Required settings</span></div>
</p>
<p>The following settings must be used to enable the script console.</p>
<p>Go to <i>Options &gt; Configuration</i> and uncheck <i>Hide advanced settings</i>.
Optional: You may also want to uncheck <i>Pause emulation when window is not active</i> for general debugging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71t+aOu2D9TmysDXZbwAAvEwePYXLVmNSIppkWWDygTszAMCweJIp3JGwQAEAAIAhM1lroAAAAMCQgAUKAAAADADWQMHYktQaKAAAxMG7BjrefwcKXjRJCCgAAAwK1kABAACAAXhRa6BBm8CPEuPQRgAAAJNigVoeVyA8AAAAhsFEWKCnJ92tgT6dQEEBAAA8PRNggZ6S1M+5dVqXu+h9cLkgs31xdrfga9PevMdi5c3lOR/7CzXfrdDjG3R+vptH+hjVWNawKy0oXiZ144O3CQTDgDeT7zcAAF4mY2+Btvc+SCfWcys7tLMiN6ylL42u2ElBYu8n378TuwNVpGn7vTowFqtxfTa3UqB0Oo5v0BX6bMq8KlOVi2GR5Aqlj1F9Lu9nH+iXVBQY2EbwXLA3lrgBAPByGUkLNOqzS5saX6Ts0UohTenCivR2cvWlIa07M7W7/s5n8/ald3LzeOVhxZSzTu+127NI36CzP6oN6y2c+t7rzexZqA+3SRQe6Jc0tI0AxOWi7PgxLPt5Be4c0MLCAXXMp46eKJLs21Ncp6TKnOTfcMwYSQs06tOh3SCpe0KeytNCmNjbiTz8QsYIDWaJ3knrkfPe
<p>Click <i>Advanced</i>, then check <i>Enable Debugger</i>.
Optional: Check <i>Always use interpreter core</i> --
This is required for some of the <a href="#events">events</a> interface functions to work, but it may impact game performance.</p>
<p><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZ4AAABxCAYAAADlGcXsAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAB+VSURBVHhe7Z0/TCvPdse/JNWv+l2lT2PMRc+hQleOBNJtXgwyNLiAFlcGXgFOgRSkmypIRHERg64E3ApSQiRoDAJyS5CCnqiIIy6G5vYRv0R6qSIyZ/6sZ9e767Ux4LXPRxrsnZ2dmV3b58w5M8wZeHp6egbDMAzDvBF/pl8ZhmEY5k1gxcMwDMO8Kax4GIZhmDfFNceztb2n3zFMfFheyut3zTk+PtbvGIZ5LxoUz9//3Yo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uf/osi+hVWPAwTP2Jj8ZDi6Xehy8+gEVY8DBM/emeOh2EYhokFsV3VRiPWfkoMwzC9Als8DMMwzJvSe//HwzAMw3Q1fWfxyHjoHyJEInxH4tBHhmGYdukdi+ei6Oy2ygKb6RS0SWiriWGYcHrG4rmo7Ol3wJ6Kl8swHYF2p46aGIZpTo9YPBeQeiedR56CSOyVZCwNg3FdUaLIvYpHbE94LCQT4pfiU5j3VnLinxjramKiXsaOgWFZX65zQfnyVD2/3keG6ULot2F+I/b3nukMffBce8LiedwuQeqd3DKWc6R5rnFkQukJYS8Fef5Qhnk9dP7XMIGlVXVgLCQTdS9N0QVpN1gnNCxFCqQ4TIsuhQbksGPqNFH9SLlQg054WXFtSuTTl0nkpzduVJ10kbhmkSoM7CMTB37+/IlsNouzszOd40UPcqIKk9cWPHb9rDziTdTPr8s+5661eLyvhsa2HnF2JNWFjFpIoXOl6jk6
<!-- Script_console -->
<p><div class="prop"><span class="title" id="Script_console">Script console</span></div>
</p>
<p>Go to <i>Debugger > Scripts...</i> to open the script console.</p>
<p><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAARsAAABiCAYAAABgd3ecAAAACXBIWXMAAA7DAAAOwwHHb6hkAAAILklEQVR4Xu2dTWsUSRiA+6f4A/Qks5Cc97S3yO5hD8Ig7HgV7x5yGvBgJsfFuxcH9CDzF7JCICxERHL0sB41YARRa7uqq7qrqqt7ejKdsqvzvPJAV9dH90Tq4a1KUsl++/1PAQBw1SAbAIgCsgGAKGTCi7//BQlBEP1GUDbHH643yIYg+g9kEwDZEET/gWwCIBuC6D+QTQBkQxD9x4ayWYk7WSYyi1v7Z4F2PrLfjnh4FKobHutlsxKz/PMcnOliGU337ejShiDGF5eQjS0NLZ+7K6tNCGRTBbIhrmdsKZucowNxK5uJQ6edD7KpAtkQ1zO2l82HM/HwdibuPNNlJR+zzDIS0v2eVXXV8ssf0ytb493aP7hUnf8ed+7uqHvF8+r0JpuzA7FjvcNK3bTb6OtV1W4HCx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b/scvdvfOgogAD1FsrlREVEAK5mXGHmcHPsHIp2jAALQUySbGxURBbCSewvg9IrVnf5fXb6MjO/f832/FEAAeopkc6MiogCKFKIAAtBTJJsbFREFUKQQBRCAniLZ3KiIKIAihSiAAPQUyeZGReTqCuDNz/64Wn353/zpz8v/uY4CCEBPkWxuVESu7wrgdljDJcV5FVEAAegpks2NishVXgGExxBRAAHoKZLNjYqIK4BwAlcAAXgOItncqIi4AggniiiAAPQUyeZGRcQVwOfo3X+uvv2P/1x9nq2jC1cAAXgOItncqIi4AvgcnVMAlcZHF1EAAegpks2NiogrgM+RMvfsuAIIwHMQyeZGRcQVwEOihG33uVr9bfXuXSz/bvVhfe/bf/63ZpvNus//+W+bTYdstx+K3F9XH/5js/TDL/9t9W53e3995G75tgCmxzHzy79uVm8fMzkWRfJiIgogAD1FsrlREXEF8IAPq7+u3oz39wpZrIsyd6SQ/eG77bbbbYaS1tyO/bXrx8fFvnfPF4XzwHHMjeuGfd495s0fmsdzNlcAAXgOItncqIhc7RXA9irY7opdwd1VtzF3RWrc92S/Q/FqMpaxsbBlt9tlgyh860L4y2b9dnd3OVDodvvaXKU8uB1niyiAAPQUyeZGRcQVwAOmxWxm+5Vr9lXw7v684GW322WDpABO1h+R7iuiCF6CK4AAPAeRbG5URK72CuBDRXka/j7e3rrxa9ltWYvSNytfwxXCeYHLbs9LW/vV8LB8U+LS44ht2nLX7PPD7srkka+pKYsogAD0FMnmRkXEFcBDhoLVJCtk49/ZW99+84dhqyHf/uGv+wUvuz1/jrHQzbfdrh0yWZ4UwN2Vv03O+fqbfa4AAvAcRLK5URFxBbCntug91Hj1MFvHRUQUQAB6imRzoyLiCmBPFymA4xU/X/U+JlcAAXgOItncqIi4AggniiiAAPQUyeZGRcQVQDiBK4AAPAeRbG5URK7yCuBYAv3pz4v+uY4CCEBPkWxuVESu7wqgyCNGAQSgp0g2NyoiCqBIIQogAD1FsrlREVEA
<p>You can view the scripts directory in the file explorer by clicking the <span class="snip">...</span> button.
JavaScript (<span class="snip">*.js</span>) files in the root of this directory are visible to the console.</p>
<p>A script may be toggled by double clicking it, or selecting it and then clicking the <i>Run/Stop</i> button.</p>
<p>While a script is active you may select it and enter code in the input box at the bottom of of the window.
Entered code is evaluated in the selected script's instance (namespace is not shared between instances).
You can use the up and down arrow keys to scroll through input history.</p>
<p>You may configure a script to run automatically when Project64 is started by right clicking it and clicking <i>Autorun...</i></p>
<p><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAOUAAAB9CAYAAABd/KQ4AAAACXBIWXMAAA7DAAAOwwHHb6hkAAAI9klEQVR4Xu2dsYtUSR7H+3+QwYFxhhmjCzZtg4kNDi65Mbngkj5BN7kBwWQdWViWOfvYQPrAzEnMBDvYAdFsU/tAaIMREZtNZJNlBR3QW0St61+997rrval+dpf9q66Z/XzhQ79Xv+rqYXyf/tV7gjYMIZHzfbtjXr9+XctgMPCOC3U1l52dHft5Z8+ePVYgJYkepKwHKUn0IGU9Xikb3zwzpv0nXnmd/+swSFmPv1Pmv0CAeSLXlQQp65nYKQE0kCBlPXRKiAadcjrolBAVCVLWc3I7Zec38+LX38ymrwYLgU45HSe3U4ZIicjqSJCyHjolRINOOR26nVLEyNc05nfT6cj4L+bB8OzFTz87c7La5k+/Z1Nt8vlWrkPz4Nds9MHdn01ndHy0LhmP51J6f44Kdw+zcv6e0s+C3HNDgpT1qHbKB+bQXC7Oj0giNRGsRpKDX/K5+RwrjnMs67n14n2y9ujz5Etgws9RpajZNcfvuXzgvB+CoVNOR22ndLvFqLPNwLg7FRlf3MXapXWtDE4KQQqJfMfumEUkHEp616nny40zQbLRWlk3nzgPgpEgZT2qnbIsS4V8u+jbxo7Oq9L5jt0xi0fKUr0G71oS5JwHdMrpUL2nlAva3t8dqRVbylwgEbEihO2kVal8x1WR3G2tHc/E8v4cMscVzlnzwaiD12yxYWYkSFmPaqfMLnonPkmKe8Dh8eUDO8vmxfA+7oh0vuPqZxSSVefmVZvSuEfKUYfMMmnr/vjxY4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ImNVSKRUyKdPnywip/Dhwweo8N2/bppXr17VIrsM37hQV3O5du2a/bzqRZ86SEmi5/t2x/vf+7kMBgPvuFBXc9nZ2bGf57vwUwYpSfQgZT1ISaIHKes4a/4PipCEqgHeGysAAAAASUVORK5CYII="></p>
<!-- JavaScript_environment -->
<p><div class="prop"><span class="title" id="JavaScript_environment">JavaScript environment</span></div>
</p>
<p>Project64's script system uses the <a target="blank" href="https://duktape.org/">Duktape JavaScript engine</a>. Duktape supports ECMAScript E5 and some features from ES2015+.</p>
<ul>
<li><a target="blank" href="https://wiki.duktape.org/postes5features">Post-ES5 features</a></li>
<li><a target="blank" href="https://duktape.org/guide.html#duktapebuiltins">Duktape built-ins</a></li>
</ul>
</div>
<!-- console -->
<div class="module">
<div class="modtitle"><span class="title" id="console">console</span></div>
Console interface
<!-- console_log -->
<p><div class="prop"><span class="title" id="console_log">console.log(message[, ...])</span></div>
<div class="tsproto">console.log(message: any, ...optionalParams): void</div>
</p>
Prints all provided arguments to the console with a trailing newline.
<pre class="ex">
<span class="js-word">console</span>.<span class="js-word">log</span>(<span class="js-string">"Hello"</span>, <span class="js-string">"world!"</span>);
</pre>
<!-- console_print -->
<p><div class="prop"><span class="title" id="console_print">console.print(message[, ...])</span></div>
<div class="tsproto">console.print(message: any, ...optionalParams): void</div>
</p>
Prints all provided arguments to the console.
<pre class="ex">
<span class="js-word">console</span>.<span class="js-word">print</span>(<span class="js-string">"Hello "</span>);
<span class="js-word">console</span>.<span class="js-word">print</span>(<span class="js-string">"world!\n"</span>);
</pre>
<!-- console_error -->
<p><div class="prop"><span class="title" id="console_error">console.error(err)</span></div>
<div class="tsproto">console.print(err: Error): void</div>
</p>
Prints the stack property of an error object.
<!-- console_clear -->
<p><div class="prop"><span class="title" id="console_clear">console.clear()</span></div>
<div class="tsproto">console.clear(): void</div>
</p>
Clears the console.
<!-- console_listen -->
<p><div class="prop"><span class="title" id="console_listen">console.listen(inputListener)</span></div>
<div class="tsproto">console.listen(inputListener: null | (input: string) => void): void</div>
</p>
<p>Overrides the default input behavior; console input will be passed to <span class="snip">inputListener</span> instead of being evaluated as JS code.</p>
<p>The listener may be unset by calling <span class="snip">console.listen(null)</span>.</p>
<pre class="ex">
<span class="js-word">console</span>.<span class="js-word">listen</span>(<span class="js-keyword">function</span>(<span class="js-word">input</span>) {
<span class="js-keyword">var</span> <span class="js-word">args</span> = <span class="js-word">input</span>.<span class="js-word">split</span>(<span class="js-string">" "</span>);
<span class="js-keyword">var</span> <span class="js-word">command</span> = <span class="js-word">args</span>.<span class="js-word">shift</span>();
<span class="js-keyword">switch</span>(<span class="js-word">command</span>) {
<span class="js-keyword">case</span> <span class="js-string">"ping"</span>:
<span class="js-word">console</span>.<span class="js-word">log</span>(<span class="js-string">"pong (args were:"</span>, <span class="js-word">args</span>.<span class="js-word">join</span>(<span class="js-string">", "</span>), <span class="js-string">")"</span>);
<span class="js-keyword">return</span>;
<span class="js-keyword">case</span> <span class="js-string">"end"</span>:
<span class="js-word">console</span>.<span class="js-word">log</span>(<span class="js-string">"done"</span>);
<span class="js-word">console</span>.<span class="js-word">listen</span>(<span class="js-keyword">null</span>);
<span class="js-keyword">return</span>;
<span class="js-keyword">default</span>:
<span class="js-word">console</span>.<span class="js-word">log</span>(<span class="js-string">"unknown command '"</span> + <span class="js-word">command</span> + <span class="js-string">"'"</span>);
}
});
</pre>
</div>
<!-- pj64 -->
<div class="module">
<div class="modtitle"><span class="title" id="pj64">pj64</span></div>
Project64 interface
<!-- pj64_open -->
<p><div class="prop"><span class="title" id="pj64_open">pj64.open(romPath)</span></div>
<div class="tsproto">pj64.open(romPath: string): void</div>
</p>
Opens a ROM.
<!-- pj64_close -->
<p><div class="prop"><span class="title" id="pj64_close">pj64.close()</span></div>
<div class="tsproto">pj64.close(): void</div>
</p>
Closes the current ROM.
<!-- pj64_reset -->
<p><div class="prop"><span class="title" id="pj64_reset">pj64.reset([soft])</span></div>
<div class="tsproto">pj64.reset(soft?: boolean = false): void</div>
</p>
Resets emulation. Performs a soft reset if <span class="snip">soft</span> is true.
<!-- pj64_pause -->
<p><div class="prop"><span class="title" id="pj64_pause">pj64.pause()</span></div>
<div class="tsproto">pj64.pause(): void</div>
</p>
Pauses emulation.
<!-- pj64_resume -->
<p><div class="prop"><span class="title" id="pj64_resume">pj64.resume()</span></div>
<div class="tsproto">pj64.resume(): void</div>
</p>
Resumes emulation.
<!-- pj64_limitfps -->
<p><div class="prop"><span class="title" id="pj64_limitfps">pj64.limitfps(limitFps)</span></div>
<div class="tsproto">pj64.limitfps(limitFps: boolean)</div>
</p>
Enables or disables the FPS limit.
<!-- pj64.installDirectory -->
<p><div class="prop"><span class="title" id="pj64_installDirectory">pj64.installDirectory</span></div>
<div class="tsproto">pj64.installDirectory: string</div>
</p>
Path to the directory containing the Project64 executable. Read-only.
<!-- pj64.scriptsDirectory -->
<p><div class="prop"><span class="title" id="pj64_scriptsDirectory">pj64.scriptsDirectory</span></div>
<div class="tsproto">pj64.scriptsDirectory: string</div>
</p>
Path to the scripts directory. Read-only.
<!-- pj64.modulesDirectory -->
<p><div class="prop"><span class="title" id="pj64_modulesDirectory">pj64.modulesDirectory</span></div>
<div class="tsproto">pj64.modulesDirectory: string</div>
</p>
Path to the script modules directory. Read-only.
<!-- pj64.romDirectory -->
<p><div class="prop"><span class="title" id="pj64_romDirectory">pj64.romDirectory</span></div>
<div class="tsproto">pj64.romDirectory: string</div>
</p>
<p>Path to the current ROM directory. Read-only.</p>
<!-- pj64.romInfo -->
<p><div class="prop"><span class="title" id="pj64_romInfo">pj64.romInfo</span></div>
<div class="tsproto">pj64.romInfo: null | Object</div>
</p>
<p>Object containing information about the current ROM. <span class="snip">null</span> if no ROM is loaded.</p>
<table>
<tr><td><span class="snip">pj64.romInfo.goodName</span> </td><td>RDB "Good Name".</td></tr>
<tr><td><span class="snip">pj64.romInfo.fileName</span> </td><td>Name of the ROM file including the file extension.</td></tr>
<tr><td><span class="snip">pj64.romInfo.filePath</span> </td><td>Path to the ROM file.</td></tr>
<tr><td><span class="snip">pj64.romInfo.crc1</span> </td><td>Internal CRC 1.</td></tr>
<tr><td><span class="snip">pj64.romInfo.crc2</span> </td><td>Internal CRC 2.</td></tr>
<tr><td><span class="snip">pj64.romInfo.name</span> </td><td>Internal name.</td></tr>
<tr><td><span class="snip">pj64.romInfo.mediaFormat</span> </td><td>Internal media format number.</td></tr>
<tr><td><span class="snip">pj64.romInfo.id</span> </td><td>Internal ID character pair.</td></tr>
<tr><td><span class="snip">pj64.romInfo.countryCode</span> </td><td>Internal country code character.</td></tr>
<tr><td><span class="snip">pj64.romInfo.version</span> </td><td>Internal version number.</td></tr>
</table>
</div>
<!-- mem -->
<div class="module">
<div class="modtitle"><span class="title" id="mem">mem</span></div>
N64 memory interface
<!-- mem__ -->
<p><div class="prop"><span class="title" id="mem__">mem.u8|u16|u32|s8|s16|s32|f32|f64</span></div>
</p>
Arrays for reading and writing memory. Virtual addresses are used as indices.
<pre class="ex">
<span class="js-comment">// Read some data from ROM and RAM</span>
<span class="js-keyword">var</span> <span class="js-word">firstWordInROM</span> = <span class="js-word">mem</span>.<span class="js-word">u32</span>[<span class="js-number">0xB0000000</span>];
<span class="js-keyword">var</span> <span class="js-word">firstWordInRAM</span> = <span class="js-word">mem</span>.<span class="js-word">u32</span>[<span class="js-number">0x80000000</span>];
</pre>
<pre class="ex">
<span class="js-comment">// Move player to 0,0,0 (SM64 US)</span>
<span class="js-keyword">const</span> <span class="js-word">pPlayerX</span> = <span class="js-number">0x8033B1AC</span>;
<span class="js-keyword">const</span> <span class="js-word">pPlayerY</span> = <span class="js-number">0x8033B1B0</span>;
<span class="js-keyword">const</span> <span class="js-word">pPlayerZ</span> = <span class="js-number">0x8033B1B4</span>;
<span class="js-word">mem</span>.<span class="js-word">f32</span>[<span class="js-word">pPlayerX</span>] = <span class="js-number">0</span>;
<span class="js-word">mem</span>.<span class="js-word">f32</span>[<span class="js-word">pPlayerY</span>] = <span class="js-number">0</span>;
<span class="js-word">mem</span>.<span class="js-word">f32</span>[<span class="js-word">pPlayerZ</span>] = <span class="js-number">0</span>;
</pre>
<!-- mem_bindvar -->
<p><div class="prop"><span class="title" id="mem_bindvar">mem.bindvar(object, address, name, typeId)</span></div>
<div class="tsproto">mem.bindvar(object: Object, address: number, name: string, typeId: number): void</div>
</p>
Adds a memory-bound property to <span class="snip">object</span>.
Valid types are <span class="snip">u8</span>, <span class="snip">u16</span>, <span class="snip">u32</span>, <span class="snip">s8</span>, <span class="snip">s16</span>, <span class="snip">s32</span>, <span class="snip">f32</span>, <span class="snip">f64</span>.
See <a href="#type_ids">Type IDs</a> for more details.
<pre class="ex">
<span class="js-word">mem</span>.<span class="js-word">bindvar</span>(<span class="js-word">global</span>, <span class="js-number">0x8033B1AC</span>, <span class="js-string">'playerX'</span>, <span class="js-word">f32</span>);
<span class="js-word">mem</span>.<span class="js-word">bindvar</span>(<span class="js-word">global</span>, <span class="js-number">0x8033B1B0</span>, <span class="js-string">'playerY'</span>, <span class="js-word">f32</span>);
<span class="js-word">mem</span>.<span class="js-word">bindvar</span>(<span class="js-word">global</span>, <span class="js-number">0x8033B1B4</span>, <span class="js-string">'playerZ'</span>, <span class="js-word">f32</span>);
<span class="js-word">console</span>.<span class="js-word">log</span>(<span class="js-string">"Player's coordinates are "</span>, <span class="js-word">playerX</span>, <span class="js-word">playerY</span>, <span class="js-word">playerZ</span>);
</pre>
<!-- mem_bindvars -->
<p><div class="prop"><span class="title" id="mem_bindvars">mem.bindvars(object, vars)</span></div>
<div class="tsproto">mem.bindvars(object: Object, vars: any[]): Object</div>
</p>
<p>Adds multiple memory-bound properties to <span class="snip">object</span>.
<span class="snip">vars</span> must be an array in which each item is an array containing an address, name, and <a href="#type_ids">type ID</a> (in order) describing a variable.</p>
<p>Returns <span class="snip">object</span>.</p>
<pre class="ex">
<span class="js-word">mem</span>.<span class="js-word">bindvars</span>(<span class="js-word">global</span>, [
[ <span class="js-number">0x8033B1AC</span>, <span class="js-string">'playerX'</span>, <span class="js-word">f32</span> ],
[ <span class="js-number">0x8033B1B0</span>, <span class="js-string">'playerY'</span>, <span class="js-word">f32</span> ],
[ <span class="js-number">0x8033B1B4</span>, <span class="js-string">'playerZ'</span>, <span class="js-word">f32</span> ]
]);
<span class="js-word">console</span>.<span class="js-word">log</span>(<span class="js-string">"Player's coordinates are "</span>, <span class="js-word">playerX</span>, <span class="js-word">playerY</span>, <span class="js-word">playerZ</span>);
</pre>
<!-- mem_bindstruct -->
<p><div class="prop"><span class="title" id="mem_bindstruct">mem.bindstruct(object, address, properties)</span></div>
<div class="tsproto">mem.bindstruct(object: Object, address: number, properties: Object): Object</div>
</p>
<p>Adds multiple memory-bound properties to <span class="snip">object</span>.
<span class="snip">properties</span> must be an object in which each key/value pair specifies the name and <a href="#type_ids">type ID</a> of a variable.</p>
<p>Returns <span class="snip">object</span>.</p>
<pre class="ex">
<span class="js-keyword">var</span> <span class="js-word">playerPos</span> = <span class="js-word">mem</span>.<span class="js-word">bindstruct</span>({}, <span class="js-number">0x8033B1AC</span>, { <span class="js-word">x</span>: <span class="js-word">f32</span>, <span class="js-word">y</span>: <span class="js-word">f32</span>, <span class="js-word">z</span>: <span class="js-word">f32</span> });
<span class="js-word">console</span>.<span class="js-word">log</span>(<span class="js-string">"Player's coordinates are "</span>, <span class="js-word">playerPos</span>.<span class="js-word">x</span>, <span class="js-word">playerPos</span>.<span class="js-word">y</span>, <span class="js-word">playerPos</span>.<span class="js-word">z</span>);
</pre>
<!-- mem_typedef -->
<p><div class="prop"><span class="title" id="mem_typedef">mem.typedef(properties)</span></div>
<div class="tsproto">mem.typedef(properties: Object): MemTypeConstructor</div>
</p>
Returns a constructor function that will create an object representing a structure in memory, given its address.
<pre class="ex">
<span class="js-keyword">const</span> <span class="js-word">vec3f</span> = <span class="js-word">mem</span>.<span class="js-word">typedef</span>({ <span class="js-word">x</span>: <span class="js-word">f32</span>, <span class="js-word">y</span>: <span class="js-word">f32</span>, <span class="js-word">z</span>: <span class="js-word">f32</span> });
<span class="js-keyword">var</span> <span class="js-word">playerAngle</span> = <span class="js-keyword">new</span> <span class="js-word">vec3f</span>(<span class="js-number">0x8033B19C</span>);
<span class="js-keyword">var</span> <span class="js-word">playerPos</span> = <span class="js-keyword">new</span> <span class="js-word">vec3f</span>(<span class="js-number">0x8033B1AC</span>);
</pre>
<!-- mem_getblock -->
<p><div class="prop"><span class="title" id="mem_getblock">mem.getblock(address, length)</span></div>
<div class="tsproto">mem.getblock(address: number, length: number): Buffer</div>
</p>
Returns a block of data from memory as a <a target="blank" href="https://nodejs.org/docs/v6.9.1/api/buffer.html">Buffer</a> object.
<pre class="ex">
<span class="js-word">fs</span>.<span class="js-word">writefile</span>(<span class="js-string">"ram_dump.bin"</span>, <span class="js-word">mem</span>.<span class="js-word">getblock</span>(<span class="js-word">K0BASE</span>, <span class="js-word">mem</span>.<span class="js-word">ramSize</span>));
</pre>
<!-- mem_setblock -->
<p><div class="prop"><span class="title" id="mem_setblock">mem.setblock(address, data[, length])</span></div>
<div class="tsproto">mem.setblock(address: number, data: string | Buffer | TypedArray, length: number): Buffer</div>
</p>
Writes a block of data into memory. <span class="snip">data</span> may be one of the following types&#58;
<a target="blank" href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer">ArrayBuffer</a>,
<a target="blank" href="https://nodejs.org/docs/v6.9.1/api/buffer.html">Buffer</a>,
<a target="blank" href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView">DataView</a>,
<a target="blank" href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray">TypedArray</a>, string.
<pre class="ex">
<span class="js-word">mem</span>.<span class="js-word">setblock</span>(<span class="js-number">0x80400000</span>, <span class="js-word">fs</span>.<span class="js-word">readfile</span>(<span class="js-string">"textures.bin"</span>));
</pre>
<!-- mem_getstring -->
<p><div class="prop"><span class="title" id="mem_getstring">mem.getstring(address[, length])</span></div>
<div class="tsproto">mem.getblock(address: number, length?: number): string</div>
</p>
Returns a zero-terminated ASCII string from memory.
<pre class="ex">
<span class="js-keyword">const</span> <span class="js-word">romName</span> = <span class="js-word">mem</span>.<span class="js-word">getstring</span>(<span class="js-number">0xB0000020</span>, <span class="js-number">0x14</span>);
</pre>
<!-- mem_setstring -->
<p><div class="prop"><span class="title" id="mem_setstring">mem.setstring(address, data[, length])</span></div>
<div class="tsproto">mem.setstring(address: number, data: string | Buffer | TypedArray, length?: number): Buffer</div>
</p>
Writes a string into memory (alias of <a href="#mem_setblock">mem.setblock</a>).
<!-- mem_ramSize -->
<p><div class="prop"><span class="title" id="mem_ramSize">mem.ramSize</span></div>
<div class="tsproto">mem.ramSize: number</div>
</p>
The size of RDRAM in bytes. <span class="snip">0</span> if RDRAM is not initialized.
<!-- mem_romSize -->
<p><div class="prop"><span class="title" id="mem_romSize">mem.romSize</span></div>
<div class="tsproto">mem.romSize: number</div>
</p>
The size of cartridge ROM in bytes. <span class="snip">0</span> if ROM is not initialized.
<!-- mem_ptr -->
<p><div class="prop"><span class="title" id="mem_ptr">mem.ptr</span></div>
<div class="tsproto">mem.ptr: pointer</div>
</p>
Native pointer to Project64's N64 memory buffer. May be used by native modules for faster memory access.
<pre class="ex">
<span class="js-comment">// C</span>
<span class="js-word">duk_ret_t</span> <span class="js-word">example</span>(<span class="js-word">duk_context</span>* <span class="js-word">ctx</span>)
{
<span class="js-word">uint8_t</span>* <span class="js-word">memory</span> = <span class="js-word">NULL</span>;
<span class="js-word">duk_get_global_string</span>(<span class="js-word">ctx</span>, <span class="js-string">"mem"</span>);
<span class="js-word">duk_get_prop_string</span>(<span class="js-word">ctx</span>, -<span class="js-number">1</span>, <span class="js-string">"ptr"</span>);
<span class="js-word">memory</span> = <span class="js-word">duk_get_pointer</span>(<span class="js-word">ctx</span>, -<span class="js-number">1</span>);
<span class="js-word">duk_pop_n</span>(<span class="js-word">ctx</span>, <span class="js-number">3</span>);
<span class="js-comment">// do something to memory here</span>
<span class="js-keyword">return</span> <span class="js-number">0</span>;
}
</pre>
</div>
<!-- events -->
<div class="module">
<div class="modtitle"><span class="title" id="events">events</span></div>
Event hooking interface
<!-- events_onstatechange -->
<p><div class="prop"><span class="title" id="events_onstatechange">events.onstatechange(callback)</span></div>
<div class="tsproto">events.onstatechange(callback: (e: EmuStateChangeEvent) => void): number</div>
</p>
Registers a callback that is invoked when the state of the emulator changes.
<span class="snip">callback</span> receives an <a href="#EmuStateChangeEvent">EmuStateChangeEvent</a> object.
<p>Returns a callback ID.</p>
<!-- EmuStateChangeEvent -->
<p><div class="prop"><span class="title" id="EmuStateChangeEvent">EmuStateChangeEvent</span></div>
</p>
<p>
<table>
<tr><td><span class="snip">e.callbackId</span></td><td>ID of the callback associated with the event.</td></tr>
<tr><td><span class="snip">e.state</span></td><td>State number. See table below.</td></tr>
</table>
</p>
<table>
<tr><td><span class="snip">EMU_STARTED</span></td><td>Emulation started.</td></tr>
<tr><td><span class="snip">EMU_STOPPED</span></td><td>Emulation stopped.</td></tr>
<tr><td><span class="snip">EMU_PAUSED</span></td><td>Emulation paused.</td></tr>
<tr><td><span class="snip">EMU_RESUMED</span></td><td>Emulation resumed from a pause.</td></tr>
<tr><td><span class="snip">EMU_RESETTING</span></td><td>Emulation is resetting.</td></tr>
<tr><td><span class="snip">EMU_RESET</span></td><td>Emulation reset.</td></tr>
<tr><td><span class="snip">EMU_LOADED_ROM</span></td><td>A ROM or 64DD image has been loaded.</td></tr>
<tr><td><span class="snip">EMU_DEBUG_PAUSED</span></td><td>Emulation paused via debugger break.</td></tr>
<tr><td><span class="snip">EMU_DEBUG_RESUMED</span></td><td>Emulation resumed via the debugger.</td></tr>
</table>
<!-- events_onexec -->
<p><div class="prop"><span class="title" id="events_onexec">events.onexec(address, callback)</span><div class="tag blue">Requires interpreter core</div></div>
<div class="tsproto">events.onexec(address: number | AddressRange, callback: (e: CPUExecEvent) => void): number</div>
</p>
Registers a callback that is invoked at the beginning of a CPU step if the program counter is at <span class="snip">address</span>.
<span class="snip">address</span> may be a single address or an object containing <span class="snip">start</span> and <span class="snip">end</span> address properties (e.g. <a href="#AddressRange">AddressRange</a>).
<span class="snip">callback</span> receives a <a href="#CPUExecEvent">CPUExecEvent</a> object.
<p>Returns a callback ID.</p>
<pre class="ex">
<span class="js-word">events</span>.<span class="js-word">onexec</span>(<span class="js-number">0x802CB1C0</span>, <span class="js-keyword">function</span>() {
<span class="js-word">console</span>.<span class="js-word">log</span>(<span class="js-string">"func_802CB1C0 was called"</span>);
});
</pre>
<pre class="ex">
<span class="js-comment">// Log every CPU step</span>
<span class="js-word">events</span>.<span class="js-word">onexec</span>(<span class="js-word">ADDR_ANY</span>, <span class="js-keyword">function</span>(<span class="js-word">e</span>) {
<span class="js-word">console</span>.<span class="js-word">log</span>(<span class="js-word">e</span>.<span class="js-word">pc</span>.<span class="js-word">hex</span>() + <span class="js-string">": "</span> + <span class="js-word">asm</span>.<span class="js-word">decode</span>(<span class="js-word">mem</span>.<span class="js-word">u32</span>[<span class="js-word">e</span>.<span class="js-word">pc</span>], <span class="js-word">e</span>.<span class="js-word">pc</span>));
});
</pre>
<!-- CPUExecEvent -->
<p><div class="prop"><span class="title" id="CPUExecEvent">CPUExecEvent</span></div>
</p>
<table>
<tr><td><span class="snip">e.callbackId</span></td><td>ID of the callback associated with the event.</td></tr>
<tr><td><span class="snip">e.pc</span></td><td>Program counter address.</td></tr>
</table>
<!-- events_onread -->
<p><div class="prop"><span class="title" id="events_onread">events.onread(address, callback)</span><div class="tag blue">Requires interpreter core</div></div>
<div class="tsproto">events.onread(address: number | AddressRange, callback: (e: CPUReadWriteEvent) => void): number</div>
</p>
Registers a callback that is invoked at the beginning of a CPU step if the CPU is going to read from <span class="snip">address</span>.
<span class="snip">address</span> may be a single address or an object containing <span class="snip">start</span> and <span class="snip">end</span> address properties (e.g. <a href="#AddressRange">AddressRange</a>).
<span class="snip">callback</span> receives a <a href="#CPUReadWriteEvent">CPUReadWriteEvent</a> object.
<p>Returns a callback ID.</p>
<!-- events_onwrite -->
<p><div class="prop"><span class="title" id="events_onwrite">events.onwrite(address, callback)</span><div class="tag blue">Requires interpreter core</div></div>
<div class="tsproto">events.onwrite(address: number | AddressRange, callback: (e: CPUReadWriteEvent) => void): number</div>
</p>
Registers a callback that is invoked at the beginning of a CPU step if the CPU is going to write to <span class="snip">address</span>.
<span class="snip">address</span> may be a single address or an object containing <span class="snip">start</span> and <span class="snip">end</span> address properties (e.g. <a href="#AddressRange">AddressRange</a>).
<span class="snip">callback</span> receives a <a href="#CPUReadWriteEvent">CPUReadWriteEvent</a> object.
<p>Returns a callback ID.</p>
<pre class="ex">
<span class="js-word">events</span>.<span class="js-word">onwrite</span>(<span class="js-word">PI_WR_LEN_REG</span>, <span class="js-keyword">function</span>(<span class="js-word">e</span>) {
<span class="js-keyword">var</span> <span class="js-word">romAddr</span> = <span class="js-word">mem</span>.<span class="js-word">u32</span>[<span class="js-word">PI_CART_ADDR_REG</span>] + <span class="js-word">K1BASE</span>;
<span class="js-keyword">var</span> <span class="js-word">ramAddr</span> = <span class="js-word">mem</span>.<span class="js-word">u32</span>[<span class="js-word">PI_DRAM_ADDR_REG</span>] + <span class="js-word">K0BASE</span>;
<span class="js-keyword">var</span> <span class="js-word">length</span> = <span class="js-word">e</span>.<span class="js-word">value</span> + <span class="js-number">1</span>;
<span class="js-word">console</span>.<span class="js-word">log</span>(<span class="js-string">"Loaded "</span> + <span class="js-word">romAddr</span>.<span class="js-word">hex</span>() + <span class="js-string">" -> "</span> + <span class="js-word">ramAddr</span>.<span class="js-word">hex</span>() + <span class="js-string">" (Length: "</span> + <span class="js-word">length</span>.<span class="js-word">hex</span>() + <span class="js-string">")"</span>);
});
</pre>
<!-- CPUReadWriteEvent -->
<p><div class="prop"><span class="title" id="CPUReadWriteEvent">CPUReadWriteEvent</span></div>
</p>
<p>
<table>
<tr><td><span class="snip">e.callbackId</span></td><td>ID of the callback associated with the event.</td></tr>
<tr><td><span class="snip">e.pc</span></td><td>Program counter address.</td></tr>
<tr><td><span class="snip">e.address</span></td><td>Address that the CPU is going to read/write.</td></tr>
<tr><td><span class="snip">e.fpu</span></td><td><span class="snip">true</span> if the source/destination register is on the floating point unit.</td></tr>
<tr><td><span class="snip">e.reg</span></td><td>Index of the source/destination register.</td></tr>
<tr><td><span class="snip">e.valueType</span></td><td>The value's <a href="#type_ids">type ID</a>. Varies depending on the opcode; refer to the table below.</td></tr>
<tr><td><span class="snip">e.value</span></td><td>Value that the CPU is going to read/write.</td></tr>
<tr><td><span class="snip">e.valueHi</span></td><td>Upper 32 bits of the value if <span class="snip">e.valueType</span> is <span class="snip">u64</span>; otherwise <span class="snip">undefined</span>.</td></tr>
</table>
</p>
<p>
<table>
<thead><tr><td><b>e.type</b></td><td><b>Opcode(s)</b></td></tr></thead>
<tr><td><span class="snip">s8</span></td><td>LB, SB</td></tr>
<tr><td><span class="snip">u8</span></td><td>LBU</td></tr>
<tr><td><span class="snip">s16</span></td><td>LH, SH</td></tr>
<tr><td><span class="snip">u16</span></td><td>LHU</td></tr>
<tr><td><span class="snip">s32</span></td><td>LL, LW, LWL, LWR, SW, SWL, SWR</td></tr>
<tr><td><span class="snip">u32</span></td><td>LWU</td></tr>
<tr><td><span class="snip">u64</span></td><td>LD, LDL, LDR, SD, SDL, SDR</td></tr>
<tr><td><span class="snip">f32</span></td><td>LWC1, SWC1</td></tr>
<tr><td><span class="snip">f64</span></td><td>LDC1, SDC1</td></tr>
</table>
</p>
<!-- events_onopcode -->
<p><div class="prop"><span class="title" id="events_onopcode">events.onopcode(address, opcode, mask, callback)</span><div class="tag blue">Requires interpreter core</div></div>
<div class="tsproto">events.onopcode(address: number | AddressRange, opcode: number, mask: number, callback: (e: CPUOpcodeEvent) => void): number</div>
</p>
Registers a callback that is invoked at the beginning of a CPU step if the program counter is at <span class="snip">address</span> and
<span class="snip">opcode</span> is equal to the current opcode ANDed with <span class="snip">mask</span>.
<span class="snip">callback</span> receives a <a href="#CPUOpcodeEvent">CPUOpcodeEvent</a> object.
<p>Returns a callback ID.</p>
<pre class="ex">
<span class="js-comment">// Log every JAL</span>
<span class="js-keyword">const</span> <span class="js-word">JAL</span> = <span class="js-word">asm</span>.<span class="js-word">encode</span>(<span class="js-string">"jal 0"</span>);
<span class="js-keyword">const</span> <span class="js-word">ANY_TARGET</span> = <span class="js-number">0xFC000000</span>; <span class="js-comment">// Mask off target field</span>
<span class="js-word">events</span>.<span class="js-word">onopcode</span>(<span class="js-word">ADDR_ANY</span>, <span class="js-word">JAL</span>, <span class="js-word">ANY_TARGET</span>, <span class="js-keyword">function</span>(<span class="js-word">e</span>) {
<span class="js-word">console</span>.<span class="js-word">log</span>(<span class="js-word">e</span>.<span class="js-word">pc</span>.<span class="js-word">hex</span>() + <span class="js-string">": "</span> + <span class="js-word">asm</span>.<span class="js-word">decode</span>(<span class="js-word">mem</span>.<span class="js-word">u32</span>[<span class="js-word">e</span>.<span class="js-word">pc</span>], <span class="js-word">e</span>.<span class="js-word">pc</span>));
});
</pre>
<!-- CPUOpcodeEvent -->
<p><div class="prop"><span class="title" id="CPUOpcodeEvent">CPUOpcodeEvent</span></div>
</p>
<table>
<tr><td><span class="snip">e.callbackId</span></td><td>ID of the callback associated with the event.</td></tr>
<tr><td><span class="snip">e.pc</span></td><td>Program counter address.</td></tr>
<tr><td><span class="snip">e.opcode</span></td><td>The opcode.</td></tr>
</table>
<!-- events_ongprvalue -->
<p><div class="prop"><span class="title" id="events_ongprvalue">events.ongprvalue(address, regFlags, value, callback)</span><div class="tag blue">Requires interpreter core</div></div>
<div class="tsproto">events.ongprvalue(address: number | AddressRange, regFlags: number, value: number, callback: (e: CPURegValueEvent) => void): number</div>
</p>
Registers a callback that is invoked at the beginning of a CPU step if the program counter is at <span class="snip">address</span> and at least one of
the general purpose registers specified by <span class="snip">regFlags</span> is equal to <span class="snip">value</span> (lower 32 bits only).
<span class="snip">callback</span> receives a <a href="#CPURegValueEvent">CPURegValueEvent</a> object.
<p>Returns a callback ID.</p>
<p>See <a href="#GPR_flags">General purpose register flags</a> for a list of valid flags. Multiple registers may be specified via bitwise OR.</p>
<pre class="ex">
<span class="js-comment">// Break when any general purpose register contains 0x49533634</span>
<span class="js-keyword">const</span> <span class="js-word">IS64_SIGNATURE</span> = <span class="js-number">0x49533634</span>;
<span class="js-word">events</span>.<span class="js-word">ongprvalue</span>(<span class="js-word">ADDR_ANY</span>, <span class="js-word">GPR_ANY</span>, <span class="js-word">IS64_SIGNATURE</span>, <span class="js-keyword">function</span>() {
<span class="js-word">debug</span>.<span class="js-word">breakhere</span>();
});
</pre>
<!-- GPR_flags -->
<p><div class="prop"><span class="title" id="GPR_flags">General purpose register flags</span></div>
</p>
Global flags for <a href="#events_ongprvalue">events.ongprvalue</a>'s <span class="snip">regFlags</span> parameter.
<p><span class="snip">GPR_ANY</span></p>
<p><span class="snip">GPR_R0</span> <span class="snip">GPR_AT</span> <span class="snip">GPR_V0</span> <span class="snip">GPR_V1</span> <span class="snip">GPR_A0</span> <span class="snip">GPR_A1</span> <span class="snip">GPR_A2</span> <span class="snip">GPR_A3</span></p>
<p><span class="snip">GPR_T0</span> <span class="snip">GPR_T1</span> <span class="snip">GPR_T2</span> <span class="snip">GPR_T3</span> <span class="snip">GPR_T4</span> <span class="snip">GPR_T5</span> <span class="snip">GPR_T6</span> <span class="snip">GPR_T7</span></p>
<p><span class="snip">GPR_S0</span> <span class="snip">GPR_S1</span> <span class="snip">GPR_S2</span> <span class="snip">GPR_S3</span> <span class="snip">GPR_S4</span> <span class="snip">GPR_S5</span> <span class="snip">GPR_S6</span> <span class="snip">GPR_S7</span></p>
<p><span class="snip">GPR_T8</span> <span class="snip">GPR_T9</span> <span class="snip">GPR_K0</span> <span class="snip">GPR_K1</span> <span class="snip">GPR_GP</span> <span class="snip">GPR_SP</span> <span class="snip">GPR_FP</span> <span class="snip">GPR_RA</span></p>
<!-- CPURegValueEvent -->
<p><div class="prop"><span class="title" id="CPURegValueEvent">CPURegValueEvent</span></div>
</p>
<table>
<tr><td><span class="snip">e.callbackId</span></td><td>ID of the callback associated with the event.</td></tr>
<tr><td><span class="snip">e.pc</span></td><td>Program counter address.</td></tr>
<tr><td><span class="snip">e.value</span></td><td>The value.</td></tr>
<tr><td><span class="snip">e.reg</span></td><td>Index of the register containing the value.</td></tr>
</table>
<!-- events_onpifread -->
<p><div class="prop"><span class="title" id="events_onpifread">events.onpifread(callback)</span></div>
<div class="tsproto">events.onpifread(callback: (e: GenericEvent) => void): number</div>
</p>
Registers a callback that is invoked when PIF RAM data is going to be read into RDRAM.
<span class="snip">callback</span> receives a <a href="#GenericEvent">GenericEvent</a> object.
<p>Returns a callback ID.</p>
<p>Useful for monitoring and overriding controller input.</p>
<pre class="ex">
<span class="js-comment">// Log P1's controller input</span>
<span class="js-word">events</span>.<span class="js-word">onpifread</span>(<span class="js-keyword">function</span>() {
<span class="js-keyword">if</span>(<span class="js-word">mem</span>.<span class="js-word">u32</span>[<span class="js-word">PIF_RAM_START</span> + <span class="js-number">0x00</span>] == <span class="js-number">0xFF010401</span>) {
<span class="js-word">console</span>.<span class="js-word">log</span>(<span class="js-word">mem</span>.<span class="js-word">u32</span>[<span class="js-word">PIF_RAM_START</span> + <span class="js-number">0x04</span>].<span class="js-word">hex</span>());
}
});
</pre>
<pre class="ex">
<span class="js-comment">// Play an M64 TAS file</span>
<span class="js-keyword">var</span> <span class="js-word">m64file</span> = <span class="js-word">fs</span>.<span class="js-word">readfile</span>(<span class="js-string">"sm64-1key.m64"</span>);
<span class="js-keyword">var</span> <span class="js-word">numSamples</span> = <span class="js-word">m64file</span>.<span class="js-word">readUInt32LE</span>(<span class="js-number">0x018</span>);
<span class="js-keyword">var</span> <span class="js-word">sampleIndex</span> = <span class="js-number">0</span>;
<span class="js-word">events</span>.<span class="js-word">onpifread</span>(<span class="js-keyword">function</span>() {
<span class="js-keyword">for</span>(<span class="js-keyword">var</span> <span class="js-word">nController</span> = <span class="js-number">0</span>; <span class="js-word">nController</span> < <span class="js-number">4</span>; <span class="js-word">nController</span>++) {
<span class="js-keyword">var</span> <span class="js-word">cmdAddr</span> = <span class="js-word">PIF_RAM_START</span> + (<span class="js-word">nController</span> * <span class="js-number">8</span>);
<span class="js-keyword">if</span>(<span class="js-word">mem</span>.<span class="js-word">u32</span>[<span class="js-word">cmdAddr</span> + <span class="js-number">0x00</span>] == <span class="js-number">0xFF010401</span> && <span class="js-word">sampleIndex</span> < <span class="js-word">numSamples</span>) {
<span class="js-word">mem</span>.<span class="js-word">u32</span>[<span class="js-word">cmdAddr</span> + <span class="js-number">0x04</span>] = <span class="js-word">m64file</span>.<span class="js-word">readUInt32BE</span>(<span class="js-number">0x400</span> + <span class="js-word">sampleIndex</span> * <span class="js-number">4</span>);
<span class="js-word">sampleIndex</span>++;
}
}
});
</pre>
<!-- GenericEvent -->
<p><div class="prop"><span class="title" id="GenericEvent">GenericEvent</span></div>
</p>
<table>
<tr><td><span class="snip">e.callbackId</span></td><td>ID of the callback associated with the event.</td></tr>
</table>
<!-- events_onsptask -->
<p><div class="prop"><span class="title" id="events_onsptask">events.onsptask(callback)</span></div>
<div class="tsproto">events.onsptask(callback: (e: SPTaskEvent) => void): number</div>
</p>
Registers a callback that is invoked when a task is sent to the RSP.
<span class="snip">callback</span> receives an <a href="#SPTaskEvent">SPTaskEvent</a> object.
<p>Returns a callback ID.</p>
<p>Useful for monitoring and overriding display lists and audio lists.</p>
<pre class="ex">
<span class="js-word">events</span>.<span class="js-word">onsptask</span>(<span class="js-keyword">function</span>(<span class="js-word">e</span>) {
<span class="js-keyword">if</span> (<span class="js-word">e</span>.<span class="js-word">taskType</span> == <span class="js-word">M_GFXTASK</span>) {
<span class="js-word">console</span>.<span class="js-word">log</span>(<span class="js-string">"Display list address: "</span> + <span class="js-word">e</span>.<span class="js-word">dataAddress</span>);
}
<span class="js-keyword">else</span> <span class="js-keyword">if</span> (<span class="js-word">e</span>.<span class="js-word">taskType</span> == <span class="js-word">M_AUDTASK</span>) {
<span class="js-word">console</span>.<span class="js-word">log</span>(<span class="js-string">"Audio list address: "</span> + <span class="js-word">e</span>.<span class="js-word">dataAddress</span>);
}
});
</pre>
<!-- SPTaskEvent -->
<p><div class="prop"><span class="title" id="SPTaskEvent">SPTaskEvent</span></div>
</p>
<table>
<tr><td><span class="snip">e.callbackId</span> </td><td>ID of the callback associated with the event.</td></tr>
<tr><td><span class="snip">e.taskType</span> </td><td>The task type. <span class="snip">M_GFXTASK</span> (1) for graphics tasks, or <span class="snip">M_AUDTASK</span> (2) for audio tasks.</td></tr>
<tr><td><span class="snip">e.taskFlags</span> </td><td>Task flags.</td></tr>
<tr><td><span class="snip">e.ucodeBootAddress</span> </td><td>Address of the boot microcode.</td></tr>
<tr><td><span class="snip">e.ucodeBootSize</span> </td><td>Size of the boot microcode.</td></tr>
<tr><td><span class="snip">e.ucodeAddress</span> </td><td>Address of the task microcode.</td></tr>
<tr><td><span class="snip">e.ucodeSize</span> </td><td>Size of the task microcode.</td></tr>
<tr><td><span class="snip">e.ucodeDataAddress</span> </td><td>Address of the microcode data.</td></tr>
<tr><td><span class="snip">e.ucodeDataSize</span> </td><td>Size of the microcode data.</td></tr>
<tr><td><span class="snip">e.dramStackAddress</span> </td><td>Address of the DRAM matrix stack.</td></tr>
<tr><td><span class="snip">e.dramStackSize</span> </td><td>Size of the DRAM matrix stack.</td></tr>
<tr><td><span class="snip">e.outputBuffAddress</span></td><td>DP command buffer address for "_dram" and "_fifo" graphics microcodes.</td></tr>
<tr><td><span class="snip">e.outputBuffSize</span> </td><td>DP command buffer size for "_dram" and "_fifo" graphics microcodes.</td></tr>
<tr><td><span class="snip">e.dataAddress</span> </td><td>Address of the display list or audio list.</td></tr>
<tr><td><span class="snip">e.dataSize</span> </td><td>Size of the display list or audio list.</td></tr>
<tr><td><span class="snip">e.yieldDataAddress</span> </td><td>Address of the yield data buffer.</td></tr>
<tr><td><span class="snip">e.yieldDataSize</span> </td><td>Size of the yield data buffer.</td></tr>
</table>
<p>Note: The properties of this object differ slightly from those in the DMEM OSTask structure;
all physical addresses are converted to KSEG0 addresses.</p>
<!-- events_onpidma -->
<p><div class="prop"><span class="title" id="events_onpidma">events.onpidma(callback)</span></div>
<div class="tsproto">events.onpidma(callback: (e: PIEvent) => void)</div>
</p>
Registers a callback that is invoked when a PI DMA transfer is going to occur.
<span class="snip">callback</span> receives a <a href="#PIEvent">PIEvent</a> object.
<p>Returns a callback ID.</p>
<pre class="ex">
<span class="js-comment">// Log all cartridge <-> RDRAM data transfers</span>
<span class="js-word">events</span>.<span class="js-word">onpidma</span>(<span class="js-keyword">function</span>(<span class="js-word">e</span>) {
<span class="js-keyword">var</span> <span class="js-word">dir</span> = <span class="js-word">e</span>.<span class="js-word">direction</span> == <span class="js-word">OS_READ</span> ? <span class="js-string">'READ'</span> : <span class="js-string">'WRITE'</span>;
<span class="js-word">console</span>.<span class="js-word">log</span>(<span class="js-string">'[PI]'</span>, <span class="js-word">dir</span>, <span class="js-word">e</span>.<span class="js-word">dramAddress</span>.<span class="js-word">hex</span>(), <span class="js-word">e</span>.<span class="js-word">cartAddress</span>.<span class="js-word">hex</span>(), <span class="js-word">e</span>.<span class="js-word">length</span>.<span class="js-word">hex</span>());
});
</pre>
<!-- PIEvent -->
<p><div class="prop"><span class="title" id="PIEvent">PIEvent</span></div>
</p>
<table>
<tr><td><span class="snip">e.callbackId</span> </td><td>The ID of the callback associated with the event.</td></tr>
<tr><td><span class="snip">e.direction</span> </td><td>The direction of the DMA transfer. May be <span class="snip">OS_READ</span> (0), or <span class="snip">OS_WRITE</span> (1).</td></tr>
<tr><td><span class="snip">e.dramAddress</span> </td><td>The address in PI_DRAM_ADDR_REG (+<span class="snip">K0BASE</span>).</td></tr>
<tr><td><span class="snip">e.cartAddress</span> </td><td>The address in PI_CART_ADDR_REG (+<span class="snip">K1BASE</span>).</td></tr>
<tr><td><span class="snip">e.length</span> </td><td>The value of PI_RD_LEN_REG or PI_WR_LEN_REG (+1), depending on the transfer direction.</td></tr>
</table>
<!-- events_onmousedown -->
<p><div class="prop"><span class="title" id="events_onmousedown">events.onmousedown(callback)</span></div>
<div class="tsproto">events.onmousedown(callback: (e: MouseEvent) => void): number</div>
</p>
Registers a callback that is invoked when a mouse button is pressed over the main screen.
<span class="snip">callback</span> receives a <a href="#MouseEvent">MouseEvent</a> object.
<p>Returns a callback ID.</p>
<!-- events_onmouseup -->
<p><div class="prop"><span class="title" id="events_onmouseup">events.onmouseup(callback)</span></div>
<div class="tsproto">events.onmouseup(callback: (e: MouseEvent) => void): number</div>
</p>
Registers a callback that is invoked when a mouse button is released over the main screen.
<span class="snip">callback</span> receives a <a href="#MouseEvent">MouseEvent</a> object.
<p>Returns a callback ID.</p>
<!-- events_onmousemove -->
<p><div class="prop"><span class="title" id="events_onmousemove">events.onmousemove(callback)</span></div>
<div class="tsproto">events.onmousemove(callback: (e: MouseEvent) => void): number</div>
</p>
Registers a callback that is invoked when the mouse is moved over the main screen.
<span class="snip">callback</span> receives a <a href="#MouseEvent">MouseEvent</a> object.
<p>Returns a callback ID.</p>
<!-- MouseEvent -->
<p><div class="prop"><span class="title" id="MouseEvent">MouseEvent</span></div>
</p>
<p>
<table>
<tr><td><span class="snip">e.callbackId</span></td><td>ID of the callback associated with the event.</td></tr>
<tr><td><span class="snip">e.button</span></td><td>The mouse button number. See table below.</td></tr>
<tr><td><span class="snip">e.x</span></td><td>Cursor X position.</td></tr>
<tr><td><span class="snip">e.y</span></td><td>Cursor Y position.</td></tr>
</table>
</p>
<p>
<table>
<tr><td><span class="snip">MouseEvent.LEFT</span></td><td>0</td></tr>
<tr><td><span class="snip">MouseEvent.MIDDLE</span></td><td>1</td></tr>
<tr><td><span class="snip">MouseEvent.RIGHT</span></td><td>2</td></tr>
<tr><td><span class="snip">MouseEvent.NONE</span></td><td>-1</td></tr>
</table>
</p>
<!-- events_remove -->
<p><div class="prop"><span class="title" id="events_remove">events.remove(callbackId)</span></div>
<div class="tsproto">events.remove(callbackId: number): void</div>
</p>
Unregisters the callback specified by <span class="snip">callbackId</span>.
<pre class="ex">
<span class="js-comment">// This callback will only be invoked once</span>
<span class="js-word">events</span>.<span class="js-word">onexec</span>(<span class="js-number">0x802CB1C0</span>, <span class="js-keyword">function</span>(<span class="js-word">e</span>) {
<span class="js-word">console</span>.<span class="js-word">log</span>(<span class="js-string">"func_802CB1C0 was called"</span>);
<span class="js-word">events</span>.<span class="js-word">remove</span>(<span class="js-word">e</span>.<span class="js-word">callbackId</span>);
});
</pre>
<!-- AddressRange -->
<p><div class="prop"><span class="title" id="AddressRange">new AddressRange(start, end)</span></div>
<div class="tsproto">new AddressRange(start: number, end: number)</div>
</p>
Creates an immutable object with <span class="snip">start</span> and <span class="snip">end</span> address properties.
<p>The following <span class="snip">AddressRange</span> objects are defined globally&#58;</p>
<table>
<tr><td><span class="snip">ADDR_ANY</span> </td><td>0x00000000 &#58; 0xFFFFFFFF</td><td>Any address</td></tr>
<tr><td><span class="snip">ADDR_ANY_KUSEG</span> </td><td>0x00000000 &#58; 0x7FFFFFFF</td><td>MIPS user mode TLB mapped segment</td></tr>
<tr><td><span class="snip">ADDR_ANY_KSEG0</span> </td><td>0x80000000 &#58; 0x9FFFFFFF</td><td>MIPS cached unmapped segment</td></tr>
<tr><td><span class="snip">ADDR_ANY_KSEG1</span> </td><td>0xA0000000 &#58; 0xBFFFFFFF</td><td>MIPS uncached unmapped segment</td></tr>
<tr><td><span class="snip">ADDR_ANY_KSEG2</span> </td><td>0xC0000000 &#58; 0xFFFFFFFF</td><td>MIPS kernel mode TLB mapped segment</td></tr>
<tr><td><span class="snip">ADDR_ANY_RDRAM</span> </td><td>0x80000000 &#58; 0x807FFFFF</td><td>Cached RDRAM</td></tr>
<tr><td><span class="snip">ADDR_ANY_RDRAM_UNC</span> </td><td>0xA0000000 &#58; 0xA07FFFFF</td><td>Uncached RDRAM</td></tr>
<tr><td><span class="snip">ADDR_ANY_CART_ROM</span> </td><td>0x90000000 &#58; 0x95FFFFFF</td><td>Cached cartridge ROM</td></tr>
<tr><td><span class="snip">ADDR_ANY_CART_ROM_UNC</span> </td><td>0xB0000000 &#58; 0xB5FFFFFF</td><td>Uncached cartridge ROM</td></tr>
</table>
</div>
<!-- N64Image -->
<div class="module">
<div class="modtitle"><span class="title" id="N64Image">N64Image</span></div>
N64 image class
<!-- new_N64Image -->
<p><div class="prop"><span class="title" id="new_N64Image">new N64Image(width, height[, format [, pixels[, palette]]])</span></div>
<div class="tsproto">new N64Image(width: number, height: number, format: number = IMG_RGBA32, pixels?: Buffer, palette?: Buffer)</div>
</p>
Creates an <a href="#N64Image">N64Image</a> object.
<p>
<span class="snip">width</span>&#58; Width of the image.<br>
<span class="snip">height</span>&#58; Height of the image.<br>
<span class="snip">format</span>&#58; Optional image format. <span class="snip">IMG_RGBA32</span> by default. See the table below for supported formats.<br>
<span class="snip">pixels</span>&#58; Optional <a target="blank" href="https://nodejs.org/docs/v6.9.1/api/buffer.html">Buffer</a> object containing pixel data.
The byte length must be equal to <span class="snip">(width * height * N64Image.bpp(format)) / 8</span>. Copied to <a href="#image_pixels">image.pixels</a>.<br>
<span class="snip">palette</span>&#58; Optional <a target="blank" href="https://nodejs.org/docs/v6.9.1/api/buffer.html">Buffer</a> object containing palette data. Copied to <a href="#image_palette">image.palette</a>.
</p>
<table>
<thead>
<tr><td>Format</td><td>Pixels</td><td>Palette</td></tr>
</thead>
<tr><td><span class="snip">IMG_RGBA16</span> </td><td>16-bit colors (r5g5b5a1) </td><td>(not used)</td></tr>
<tr><td><span class="snip">IMG_RGBA32</span> </td><td>32-bit colors (r8g8b8a8) </td><td>(not used)</td></tr>
<tr><td><span class="snip">IMG_CI4_RGBA16</span></td><td>4-bit color indices </td><td>16-bit colors (r5g5b5a1)</td></tr>
<tr><td><span class="snip">IMG_CI4_IA16</span> </td><td>4-bit color indices </td><td>16-bit intensity/alpha values (i8a8)</td></tr>
<tr><td><span class="snip">IMG_CI8_RGBA16</span></td><td>8-bit color indices </td><td>16-bit colors (r5g5b5a1)</td></tr>
<tr><td><span class="snip">IMG_CI8_IA16</span> </td><td>8-bit color indices </td><td>16-bit intensity/alpha values (i8a8)</td></tr>
<tr><td><span class="snip">IMG_IA4</span> </td><td>4-bit intensity/alpha values (i3a1) </td><td>(not used)</td></tr>
<tr><td><span class="snip">IMG_IA8</span> </td><td>8-bit intensity/alpha values (i4a4) </td><td>(not used)</td></tr>
<tr><td><span class="snip">IMG_IA16</span> </td><td>16-bit intensity/alpha values (i8a8)</td><td>(not used)</td></tr>
<tr><td><span class="snip">IMG_I4</span> </td><td>4-bit intensity values </td><td>(not used)</td></tr>
<tr><td><span class="snip">IMG_I8</span> </td><td>8-bit intensity values </td><td>(not used)</td></tr>
</table>
<!-- N64Image_fromPNG -->
<p><div class="prop"><span class="title" id="N64Image_fromPNG">N64Image.fromPNG(pngData[, format])</span></div>
<div class="tsproto">N64Image.fromPNG(pngData: Buffer, format?: number = IMG_RGBA32): N64Image</div>
</p>
Static function. Creates an <a href="#N64Image">N64Image</a> object from a PNG file.
<pre class="ex">
<span class="js-keyword">var</span> <span class="js-word">image</span> = <span class="js-word">N64Image</span>.<span class="js-word">fromPNG</span>(<span class="js-word">fs</span>.<span class="js-word">readfile</span>(<span class="js-string">"image.png"</span>));
</pre>
Color quantization is not implemented. An error is thrown if <span class="snip">format</span> is a color-index (CI) type
and the color count of the PNG image exceeds the maximum number of colors supported. The maximum
number of colors supported by the CI4 and CI8 formats are 16 and 256, respectively.
<!-- N64Image_format -->
<p><div class="prop"><span class="title" id="N64Image_format">N64Image.format(gbiFmt, gbiSiz[, gbiTlutFmt])</span></div>
<div class="tsproto">N64Image.format(gbiFmt: number, gbiSiz: number, gbiTlutFmt?: number): number</div>
</p>
<p>Static function. Returns a simplified image format number from a given GBI pixel size and format configuration.
Returns <span class="snip">-1</span> if the configuration is invalid or unsupported. See the table below for supported configurations.</p>
<table>
<thead>
<tr><td><span class="snip">gbiFmt</span> </td><td><span class="snip">gbiSiz</span> </td><td><span class="snip">gbiTlutFmt</span> </td><td>Return value</td></tr>
</thead>
<tr><td><span class="snip">G_IM_FMT_RGBA</span> </td><td><span class="snip">G_IM_SIZ_16b</span> </td><td>(not used) </td><td><span class="snip">IMG_RGBA16</span></td></tr>
<tr><td><span class="snip">G_IM_FMT_RGBA</span> </td><td><span class="snip">G_IM_SIZ_32b</span> </td><td>(not used) </td><td><span class="snip">IMG_RGBA32</span></td></tr>
<tr><td><span class="snip">G_IM_FMT_CI</span> </td><td><span class="snip">G_IM_SIZ_4b</span> </td><td><span class="snip">G_TT_RGBA16</span></td><td><span class="snip">IMG_CI4_RGBA16</span></td></tr>
<tr><td><span class="snip">G_IM_FMT_CI</span> </td><td><span class="snip">G_IM_SIZ_4b</span> </td><td><span class="snip">G_TT_IA16</span> </td><td><span class="snip">IMG_CI4_IA16</span></td></tr>
<tr><td><span class="snip">G_IM_FMT_CI</span> </td><td><span class="snip">G_IM_SIZ_8b</span> </td><td><span class="snip">G_TT_RGBA16</span></td><td><span class="snip">IMG_CI8_RGBA16</span></td></tr>
<tr><td><span class="snip">G_IM_FMT_CI</span> </td><td><span class="snip">G_IM_SIZ_8b</span> </td><td><span class="snip">G_TT_IA16</span> </td><td><span class="snip">IMG_CI8_IA16</span></td></tr>
<tr><td><span class="snip">G_IM_FMT_IA</span> </td><td><span class="snip">G_IM_SIZ_4b</span> </td><td>(not used) </td><td><span class="snip">IMG_IA4</span></td></tr>
<tr><td><span class="snip">G_IM_FMT_IA</span> </td><td><span class="snip">G_IM_SIZ_8b</span> </td><td>(not used) </td><td><span class="snip">IMG_IA8</span></td></tr>
<tr><td><span class="snip">G_IM_FMT_IA</span> </td><td><span class="snip">G_IM_SIZ_16b</span> </td><td>(not used) </td><td><span class="snip">IMG_IA16</span></td></tr>
<tr><td><span class="snip">G_IM_FMT_I</span> </td><td><span class="snip">G_IM_SIZ_4b</span> </td><td>(not used) </td><td><span class="snip">IMG_I4</span></td></tr>
<tr><td><span class="snip">G_IM_FMT_I</span> </td><td><span class="snip">G_IM_SIZ_8b</span> </td><td>(not used) </td><td><span class="snip">IMG_I8</span></td></tr>
</table>
<!-- N64Image_bpp -->
<p><div class="prop"><span class="title" id="N64Image_bpp">N64Image.bpp(format)</span></div>
<div class="tsproto">N64Image.bpp(format: number): number</div>
</p>
Static function. Returns the number of bits used per pixel for a given image format number or <span class="snip">G_IM_SIZ_*</span> constant. Does not include bits used for palette data.
<pre class="ex">
<span class="js-word">N64Image</span>.<span class="js-word">bpp</span>(<span class="js-word">IMG_CI8_RGBA16</span>); <span class="js-comment">// 8</span>
<span class="js-word">N64Image</span>.<span class="js-word">bpp</span>(<span class="js-word">G_IM_SIZ_16b</span>); <span class="js-comment">// 16</span>
</pre>
<!-- image_toPNG -->
<p><div class="prop"><span class="title" id="image_toPNG">image.toPNG()</span></div>
<div class="tsproto">image.toPNG(): Buffer</div>
</p>
Returns a PNG representation of the image data as a <a target="blank" href="https://nodejs.org/docs/v6.9.1/api/buffer.html">Buffer</a> object.
<pre class="ex">
<span class="js-word">fs</span>.<span class="js-word">writefile</span>(<span class="js-string">"image.png"</span>, <span class="js-word">image</span>.<span class="js-word">toPNG</span>());
</pre>
<!-- image_update -->
<p><div class="prop"><span class="title" id="image_update">image.update()</span></div>
<div class="tsproto">image.update(): void</div>
</p>
Updates the internal bitmap. Should be called after alterations are made to <span class="snip">image.pixels</span> or <span class="snip">image.palette</span>.
<!-- image_format -->
<p><div class="prop"><span class="title" id="image_format">image.format</span></div>
<div class="tsproto">image.format: number</div>
</p>
The format ID. Read-only.
<!-- image_width -->
<p><div class="prop"><span class="title" id="image_width">image.width</span></div>
<div class="tsproto">image.width: number</div>
</p>
Width of the image. Read-only.
<!-- image_height -->
<p><div class="prop"><span class="title" id="image_height">image.height</span></div>
<div class="tsproto">image.height: number</div>
</p>
Height of the image. Read-only.
<!-- image_pixels -->
<p><div class="prop"><span class="title" id="image_pixels">image.pixels</span></div>
<div class="tsproto">image.pixels: Buffer</div>
</p>
The pixel data of the image.
<!-- image_palette -->
<p><div class="prop"><span class="title" id="image_palette">image.palette</span></div>
<div class="tsproto">image.palette: Buffer</div>
</p>
The palette data of the image. <span class="snip">null</span> if the image does not use a color-index format.
</div>
<!-- cpu -->
<div class="module">
<div class="modtitle"><span class="title" id="cpu">cpu</span></div>
CPU register interface
<!-- cpu_pc -->
<p><div class="prop"><span class="title" id="cpu_pc">cpu.pc</span></div>
</p>
Variable representing the CPU's program counter.
<!-- cpu_hi -->
<p><div class="prop"><span class="title" id="cpu_hi">cpu.hi</span></div>
</p>
Variable representing the lower 32 bits of the CPU's HI register.
<!-- cpu_lo -->
<p><div class="prop"><span class="title" id="cpu_lo">cpu.lo</span></div>
</p>
Variable representing the lower 32 bits of the CPU's LO register.
<!-- cpu_uhi -->
<p><div class="prop"><span class="title" id="cpu_uhi">cpu.uhi</span></div>
</p>
Variable representing the upper 32 bits of the CPU's HI register.
<!-- cpu_ulo -->
<p><div class="prop"><span class="title" id="cpu_ulo">cpu.ulo</span></div>
</p>
Variable representing the upper 32 bits of the CPU's LO register.
<!-- cpu_gpr__ -->
<p><div class="prop"><span class="title" id="cpu_gpr__">cpu.gpr.r0|at|v0|v1..ra</span></div>
<div><span class="title2">cpu.gpr[0..31]</span></div><div class="tsproto">cpu.gpr.r0|at|v0|v1|a0|a1|a2|a3|t0|t1|t2|t3|t4|t5|t6|t7|s0|s1|s2|s3|s4|s5|s6|s7|t8|t9|k0|k1|gp|sp|fp|ra</div>
</p>
Variables representing the lower 32 bits of the CPU's general purpose registers.
<!-- cpu_ugpr__ -->
<p><div class="prop"><span class="title" id="cpu_ugpr__">cpu.ugpr.r0|at|v0|v1..ra</span></div>
<div><span class="title2">cpu.ugpr[0..31]</span></div><div class="tsproto">cpu.ugpr.r0|at|v0|v1|a0|a1|a2|a3|t0|t1|t2|t3|t4|t5|t6|t7|s0|s1|s2|s3|s4|s5|s6|s7|t8|t9|k0|k1|gp|sp|fp|ra</div>
</p>
Variables representing the upper 32 bits of the CPU's general purpose registers.
<!-- cpu_fpr__ -->
<p><div class="prop"><span class="title" id="cpu_fpr__">cpu.fpr.f0..f31</span></div>
<div><span class="title2">cpu.fpr[0..31]</span></div></p>
Variables representing the CPU's 32-bit floating-point registers.
<!-- cpu_dfpr__ -->
<p><div class="prop"><span class="title" id="cpu_dfpr__">cpu.dfpr.f0..f30</span></div>
<div><span class="title2">cpu.dfpr[0..30]</span></div></p>
Variables representing the CPU's 64-bit floating-point registers.
<!-- cpu_cop0 -->
<p><div class="prop"><span class="title" id="cpu_cop0">cpu.cop0.index..errorepc</span></div>
</p>
<p>Variables representing the CPU's Coprocessor 0 registers.</p>
<table>
<tr><td><span class="snip">cpu.cop0.index</span> </td><td>Index register.</td></tr>
<tr><td><span class="snip">cpu.cop0.random</span> </td><td>Random register.</td></tr>
<tr><td><span class="snip">cpu.cop0.entrylo0</span> </td><td>EntryLo0 register.</td></tr>
<tr><td><span class="snip">cpu.cop0.entrylo1</span> </td><td>EntryLo1 register.</td></tr>
<tr><td><span class="snip">cpu.cop0.context</span> </td><td>Context register.</td></tr>
<tr><td><span class="snip">cpu.cop0.pagemask</span> </td><td>PageMask register.</td></tr>
<tr><td><span class="snip">cpu.cop0.wired</span> </td><td>Wired register.</td></tr>
<tr><td><span class="snip">cpu.cop0.badvaddr</span> </td><td>BadVAddr register.</td></tr>
<tr><td><span class="snip">cpu.cop0.count</span> </td><td>Count register.</td></tr>
<tr><td><span class="snip">cpu.cop0.entryhi</span> </td><td>EntryHi register.</td></tr>
<tr><td><span class="snip">cpu.cop0.compare</span> </td><td>Compare register.</td></tr>
<tr><td><span class="snip">cpu.cop0.status</span> </td><td>Status register.</td></tr>
<tr><td><span class="snip">cpu.cop0.cause</span> </td><td>Cause register. Generates an interrupt when written.</td></tr>
<tr><td><span class="snip">cpu.cop0.epc</span> </td><td>EPC register.</td></tr>
<tr><td><span class="snip">cpu.cop0.config</span> </td><td>Config register.</td></tr>
<tr><td><span class="snip">cpu.cop0.taglo</span> </td><td>TagLo register.</td></tr>
<tr><td><span class="snip">cpu.cop0.taghi</span> </td><td>TagHi register.</td></tr>
<tr><td><span class="snip">cpu.cop0.errorepc</span> </td><td>ErrorEPC register.</td></tr>
</table>
</div>
<!-- debug -->
<div class="module">
<div class="modtitle"><span class="title" id="debug">debug</span></div>
Debugger interface
<!-- debug_breakhere -->
<p><div class="prop"><span class="title" id="debug_breakhere">debug.breakhere([silent])</span></div>
<div class="tsproto">debug.breakhere(silent?: boolean = false): void</div>
</p>
Pauses emulation via the debugger. The CPU commands window is not shown if <span class="snip">silent</span> is true.
<p>
Emulation may be resumed by calling <a href="#debug_resume">debug.resume()</a> or clicking the "Go" button in the CPU commands window.
</p>
<pre class="ex">
<span class="js-comment">// Break if the CPU tries to write 5 to 0x80339EA8</span>
<span class="js-word">events</span>.<span class="js-word">onwrite</span>(<span class="js-number">0x80339EA8</span>, <span class="js-keyword">function</span>(<span class="js-word">e</span>) {
<span class="js-keyword">if</span>(<span class="js-word">e</span>.<span class="js-word">value</span> == <span class="js-number">5</span>) {
<span class="js-word">debug</span>.<span class="js-word">breakhere</span>();
}
});
</pre>
<!-- debug_resume -->
<p><div class="prop"><span class="title" id="debug_resume">debug.resume()</span></div>
<div class="tsproto">debug.resume(): void</div>
</p>
Resumes emulation from a debugger pause.
<!-- debug_step -->
<p><div class="prop"><span class="title" id="debug_step">debug.step()</span></div>
<div class="tsproto">debug.step(): void</div>
</p>
Executes a single CPU command. Does nothing if emulation is not paused by the debugger.
<!-- debug_skip -->
<p><div class="prop"><span class="title" id="debug_skip">debug.skip()</span></div>
<div class="tsproto">debug.skip(): void</div>
</p>
Skips the current CPU command. Useful for preventing or overriding an operation.
<pre class="ex">
<span class="js-comment">// Do not let the CPU write to 0x8033B21E</span>
<span class="js-word">events</span>.<span class="js-word">onwrite</span>(<span class="js-number">0x8033B21E</span>, <span class="js-keyword">function</span>() {
<span class="js-word">debug</span>.<span class="js-word">skip</span>();
});
</pre>
<!-- debug_showmemory -->
<p><div class="prop"><span class="title" id="debug_showmemory">debug.showmemory(address[, physical])</span></div>
<div class="tsproto">debug.showmemory(address: number, physical?: boolean = false): void</div>
</p>
Shows the memory window at <span class="snip">address</span>. Physical address space is used if <span class="snip">physical</span> is <span class="snip">true</span>.
<!-- debug_showcommands -->
<p><div class="prop"><span class="title" id="debug_showcommands">debug.showcommands(address)</span></div>
<div class="tsproto">debug.showcommands(address: number): void</div>
</p>
Shows the CPU commands window at <span class="snip">address</span>.
<!-- debug_paused -->
<p><div class="prop"><span class="title" id="debug_paused">debug.paused</span></div>
<div class="tsproto">debug.paused: boolean</div>
</p>
<span class="snip">true</span> if emulation is currently paused by the debugger.
</div>
<!-- asm -->
<div class="module">
<div class="modtitle"><span class="title" id="asm">asm</span></div>
ASM utilities
<!-- asm_encode -->
<p><div class="prop"><span class="title" id="asm_encode">asm.encode(command[, address])</span></div>
<div class="tsproto">asm.encode(command: string, address?: number): number</div>
</p>
Encodes a single MIPS R4300i opcode. <span class="snip">address</span> is an optional parameter that may be used to hint the address of the instruction for branch offset calculation.
<p>Returns the opcode as a number.</p>
<pre class="ex">
<span class="js-word">asm</span>.<span class="js-word">encode</span>(<span class="js-string">"nop"</span>); <span class="js-comment">// 0x00000000</span>
<span class="js-word">asm</span>.<span class="js-word">encode</span>(<span class="js-string">"addiu sp, sp, -24"</span>); <span class="js-comment">// 0x27BDFFE8</span>
<span class="js-word">asm</span>.<span class="js-word">encode</span>(<span class="js-string">"b 0x80400000"</span>, <span class="js-number">0x803FFF00</span>); <span class="js-comment">// 0x1000003F</span>
<span class="js-word">asm</span>.<span class="js-word">encode</span>(<span class="js-string">"b 0x80400000"</span>, <span class="js-number">0x80400100</span>); <span class="js-comment">// 0x1000FFBF</span>
</pre>
<!-- asm_decode -->
<p><div class="prop"><span class="title" id="asm_decode">asm.decode(opcode[, address])</span></div>
<div class="tsproto">asm.decode(opcode: number, address?: number)</div>
</p>
Decodes a single MIPS R4300i opcode. <span class="snip">address</span> is an optional parameter that may be used to hint the address of the instruction for branch address calculation.
<p>Returns a line of assembly code as a string.</p>
<pre class="ex">
<span class="js-word">asm</span>.<span class="js-word">decode</span>(<span class="js-number">0x00000000</span>); <span class="js-comment">// "NOP"</span>
<span class="js-word">asm</span>.<span class="js-word">decode</span>(<span class="js-number">0x27BDFFE8</span>); <span class="js-comment">// "ADDIU SP, SP, -0x18"</span>
<span class="js-word">asm</span>.<span class="js-word">decode</span>(<span class="js-number">0x1000003F</span>, <span class="js-number">0x803FFF00</span>); <span class="js-comment">// "B 0x80400000"</span>
<span class="js-word">asm</span>.<span class="js-word">decode</span>(<span class="js-number">0x1000FFBF</span>, <span class="js-number">0x80400100</span>); <span class="js-comment">// "B 0x80400000"</span>
</pre>
<!-- asm_gprname -->
<p><div class="prop"><span class="title" id="asm_gprname">asm.gprname(regIndex)</span></div>
<div class="tsproto">asm.gprname(regIndex: number): string</div>
</p>
Returns the name of the general purpose register specified by <span class="snip">regIndex</span>.
<pre class="ex">
<span class="js-word">asm</span>.<span class="js-word">gprname</span>(<span class="js-number">4</span>); <span class="js-comment">// Returns "a0"</span>
</pre>
</div>
<!-- fs -->
<div class="module">
<div class="modtitle"><span class="title" id="fs">fs</span></div>
File system interface
<!-- fs_open -->
<p><div class="prop"><span class="title" id="fs_open">fs.open(path, mode)</span></div>
<div class="tsproto">fs.open(path: string, mode: string): number</div>
</p>
Opens the file pointed to by <span class="snip">path</span> in the mode specified by <span class="snip">mode</span>.
See <a target="blank" href="https://pubs.opengroup.org/onlinepubs/009604599/functions/fopen.html">fopen</a> for a list of valid modes.
<p>Returns a file descriptor.</p>
<!-- fs_close -->
<p><div class="prop"><span class="title" id="fs_close">fs.close(fd)</span></div>
<div class="tsproto">fs.close(fd): void</div>
</p>
Closes the file referenced by <span class="snip">fd</span>.
<!-- fs_write -->
<p><div class="prop"><span class="title" id="fs_write">fs.write(fd, buffer[, offset[, length[, position]]])</span></div>
<div class="tsproto">fs.write(fd: number, buffer: string | Buffer | ArrayBuffer, offset?: number, length?: number, position?: number): number</div>
</p>
Writes <span class="snip">buffer</span> to the file referenced by file descriptor <span class="snip">fd</span>. <span class="snip">buffer</span> may be one of the following types&#58;
<a target="blank" href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer">ArrayBuffer</a>,
<a target="blank" href="https://nodejs.org/docs/v6.9.1/api/buffer.html">Buffer</a>,
<a target="blank" href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView">DataView</a>,
<a target="blank" href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray">TypedArray</a>, string.
<p>
<span class="snip">offset</span>&#58; Optional position in the source buffer.<br>
<span class="snip">length</span>&#58; Optional maximum number of bytes to write.<br>
<span class="snip">position</span>&#58; Optional file position.
</p>
<p>Returns the number of bytes written.</p>
<pre class="ex">
<span class="js-keyword">var</span> <span class="js-word">fd</span> = <span class="js-word">fs</span>.<span class="js-word">open</span>(<span class="js-string">"file.txt"</span>, <span class="js-string">"wb"</span>);
<span class="js-word">fs</span>.<span class="js-word">write</span>(<span class="js-word">fd</span>, <span class="js-string">"Hello "</span>);
<span class="js-word">fs</span>.<span class="js-word">write</span>(<span class="js-word">fd</span>, <span class="js-string">"world!\n"</span>);
<span class="js-word">fs</span>.<span class="js-word">close</span>(<span class="js-word">fd</span>);
</pre>
<!-- fs_writefile -->
<p><div class="prop"><span class="title" id="fs_writefile">fs.writefile(path, buffer)</span></div>
<div class="tsproto">fs.writefile(path: string, buffer: string | Buffer | ArrayBuffer): void</div>
</p>
Writes <span class="snip">buffer</span> to the file specified by <span class="snip">path</span>.
<pre class="ex">
<span class="js-word">fs</span>.<span class="js-word">writefile</span>(<span class="js-string">"ram_dump.bin"</span>, <span class="js-word">mem</span>.<span class="js-word">getblock</span>(<span class="js-word">K0BASE</span>, <span class="js-word">mem</span>.<span class="js-word">ramSize</span>));
</pre>
<!-- fs_read -->
<p><div class="prop"><span class="title" id="fs_read">fs.read(fd, buffer, offset, length, position)</span></div>
<div class="tsproto">fs.read(fd: number, buffer: Buffer | ArrayBuffer, offset: number, length: number, position: number) : number</div>
</p>
Reads data from the file referenced by <span class="snip">fd</span> into <span class="snip">buffer</span>. <span class="snip">buffer</span> may be one of the following types&#58;
<a target="blank" href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer">ArrayBuffer</a>,
<a target="blank" href="https://nodejs.org/docs/v6.9.1/api/buffer.html">Buffer</a>,
<a target="blank" href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView">DataView</a>,
<a target="blank" href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray">TypedArray</a>.<br><br>
<span class="snip">offset</span>&#58; Position in the source buffer.<br>
<span class="snip">length</span>&#58; Number of bytes to read.<br>
<span class="snip">position</span>&#58; File position.
<p>Returns the number of bytes read.</p>
<!-- fs_readfile -->
<p><div class="prop"><span class="title" id="fs_readfile">fs.readfile(path)</span></div>
<div class="tsproto">fs.readfile(path: string): Buffer</div>
</p>
Returns a <a target="blank" href="https://nodejs.org/docs/v6.9.1/api/buffer.html">Buffer</a> object representing the data of the file specified by <span class="snip">path</span>.
<!-- fs_fstat -->
<p><div class="prop"><span class="title" id="fs_fstat">fs.fstat(fd)</span></div>
<div class="tsproto">fs.fstat(fd: number): fs.Stats</div>
</p>
Returns an <a href="#fs_Stats">fs.Stats</a> object containing information about the file referenced by <span class="snip">fd</span>.
<!-- fs_stat -->
<p><div class="prop"><span class="title" id="fs_stat">fs.stat(path)</span></div>
<div class="tsproto">fs.stat(path: string): fs.Stats</div>
</p>
Returns an <a href="#fs_Stats">fs.Stats</a> object containing information about the file specified by <span class="snip">path</span>.
<!-- fs_unlink -->
<p><div class="prop"><span class="title" id="fs_unlink">fs.unlink(path)</span></div>
<div class="tsproto">fs.unlink(path: string): boolean</div>
</p>
Deletes the file specified by <span class="snip">path</span>. Returns <span class="snip">true</span> if the operation is successful.
<!-- fs_mkdir -->
<p><div class="prop"><span class="title" id="fs_mkdir">fs.mkdir(path)</span></div>
<div class="tsproto">fs.mkdir(path: string): boolean</div>
</p>
Creates a directory. Returns <span class="snip">true</span> if the operation is successful.
<!-- fs_rmdir -->
<p><div class="prop"><span class="title" id="fs_rmdir">fs.rmdir(path)</span></div>
<div class="tsproto">fs.rmdir(path: string): boolean</div>
</p>
Deletes a directory. The directory must be empty. Returns <span class="snip">true</span> if the operation is successful.
<!-- fs_readdir -->
<p><div class="prop"><span class="title" id="fs_readdir">fs.readdir(path)</span></div>
<div class="tsproto">fs.readdir(path: string): string[]</div>
</p>
Returns an array of file names from a directory.
<!-- fs_Stats -->
<p><div class="prop"><span class="title" id="fs_Stats">fs.Stats</span></div>
</p>
<p>Object containing information about a file or directory. Generated by <a href="#fs_fstat">fs.fstat/fs.stat</a>.</p>
<p>
<table>
<tr><td><span class="snip">stats.dev</span></td><td>ID of the device the file resides on</td></tr>
<tr><td><span class="snip">stats.ino</span></td><td>inode number</td></tr>
<tr><td><span class="snip">stats.mode</span></td><td>File permissions</td></tr>
<tr><td><span class="snip">stats.nlink</span></td><td>Number of links to the file</td></tr>
<tr><td><span class="snip">stats.uid</span></td><td>User ID</td></tr>
<tr><td><span class="snip">stats.gid</span></td><td>Group ID</td></tr>
<tr><td><span class="snip">stats.rdev</span></td><td>Device ID (if file is character or block special)</td></tr>
<tr><td><span class="snip">stats.size</span></td><td>Size of the file in bytes</td></tr>
<tr><td><span class="snip">stats.atimeMs</span></td><td>Last access timestamp in milliseconds</td></tr>
<tr><td><span class="snip">stats.mtimeMs</span></td><td>Last modification timestamp in milliseconds</td></tr>
<tr><td><span class="snip">stats.ctimeMs</span></td><td>Creation timestamp in milliseconds</td></tr>
<tr><td><span class="snip">stats.atime</span></td><td>JS Date object representing the last access time</td></tr>
<tr><td><span class="snip">stats.mtime</span></td><td>JS Date object representing the last modification time</td></tr>
<tr><td><span class="snip">stats.ctime</span></td><td>JS Date object representing the creation time</td></tr>
</table>
</p>
<b>stats.isDirectory()</b><br>
<div class="tsproto">stats.isDirectory(): boolean</div>
<p>Returns <span class="snip">true</span> if the <span class="snip">fs.Stats</span> object describes a directory.</p>
<b>stats.isFile()</b><br>
<div class="tsproto">stats.isFile(): boolean</div>
<p>Returns <span class="snip">true</span> if the <span class="snip">fs.Stats</span> object describes a regular file.</p>
</div>
<!-- Socket -->
<div class="module">
<div class="modtitle"><span class="title" id="Socket">Socket</span></div>
TCP socket class
<!-- new_Socket -->
<p><div class="prop"><span class="title" id="new_Socket">new Socket([options])</span></div>
<div class="tsproto">new Socket(options?: Object)</div>
</p>
<p>Creates a <a href="#Socket">Socket</a> object. <span class="snip">options</span> may contain the following properties:</p>
<table>
<tr><td><span class="snip">allowHalfOpen</span></td><td>If <span class="snip">true</span>, the socket will not automatically fully close when the read half is closed. <span class="snip">false</span> by default.</td></tr>
</table>
<!-- socket_connect -->
<p><div class="prop"><span class="title" id="socket_connect">socket.connect(port, host[, connectListener])</span></div>
<div class="tsproto">socket.connect(port: number, host: string, connectListener: () => void): void</div>
</p>
Initiates a TCP connection.
Optional <span class="snip">connectListener</span> is invoked when the connection is established (i.e the socket is writable).
<pre class="ex">
<span class="js-keyword">var</span> <span class="js-word">client</span> = <span class="js-keyword">new</span> <span class="js-word">Socket</span>();
<span class="js-word">client</span>.<span class="js-word">connect</span>(<span class="js-number">80</span>, <span class="js-string">'www.example.com'</span>, <span class="js-keyword">function</span>() {
<span class="js-keyword">var</span> <span class="js-word">response</span> = <span class="js-string">''</span>;
<span class="js-word">client</span>.<span class="js-word">on</span>(<span class="js-string">'data'</span>, <span class="js-keyword">function</span>(<span class="js-word">data</span>) {
<span class="js-word">response</span> += <span class="js-word">data</span>.<span class="js-word">toString</span>();
});
<span class="js-word">client</span>.<span class="js-word">on</span>(<span class="js-string">'end'</span>, <span class="js-keyword">function</span>() {
<span class="js-word">console</span>.<span class="js-word">log</span>(<span class="js-word">response</span>);
});
<span class="js-keyword">const</span> <span class="js-word">message</span> = [
<span class="js-string">"GET / HTTP/1.1"</span>,
<span class="js-string">"Host: www.example.com"</span>,
<span class="js-string">"Connection: close"</span>,
<span class="js-string">"\r\n"</span>
].<span class="js-word">join</span>(<span class="js-string">"\r\n"</span>);
<span class="js-word">client</span>.<span class="js-word">end</span>(<span class="js-word">message</span>);
});
</pre>
<!-- socket_write -->
<p><div class="prop"><span class="title" id="socket_write">socket.write(data[, callback])</span></div>
<div class="tsproto">socket.write(data: Buffer | string, callback?: () => void): void</div>
</p>
<p>Sends <span class="snip">data</span> on the socket.</p>
Optional <span class="snip">callback</span> is invoked when all bytes of <span class="snip">data</span> are sent.
<!-- socket_end -->
<p><div class="prop"><span class="title" id="socket_end">socket.end([data[, callback]])</span></div>
<div class="tsproto">socket.end(data?: Buffer | string, callback?: () => void): void</div>
</p>
<p>Sends optional <span class="snip">data</span> and closes the write half of the socket after all buffered writes are sent.</p>
Optional <span class="snip">callback</span> is invoked when all buffered writes are sent and the write half of the socket is closed.
<!-- socket_close -->
<p><div class="prop"><span class="title" id="socket_close">socket.close()</span></div>
<div class="tsproto">socket.close(): void</div>
</p>
Fully closes the socket.
<!-- socket_on_connect -->
<p><div class="prop"><span class="title" id="socket_on_connect">socket.on('connect', listener)</span></div>
<div class="tsproto">socket.on('connect', listener: () => void): Socket</div>
</p>
<p>Registers a listener for the <span class="snip">'connect'</span> event.</p>
<span class="snip">listener</span> is invoked when the connection is established.
<p>Returns the Socket object.</p>
<!-- socket_on_lookup -->
<p><div class="prop"><span class="title" id="socket_on_lookup">socket.on('lookup', listener)</span></div>
<div class="tsproto">socket.on('lookup', listener: (Object) => void): Socket</div>
</p>
<p>Registers a listener for the <span class="snip">'lookup'</span> event.</p>
<p><span class="snip">listener</span> receives an object with the following properties when the host name is resolved:</p>
<table>
<tr><td><span class="snip">err</span></td><td><span class="snip">null</span>, or an <span class="snip">Error</span> object if an error occurred <span style="color:red;">(TODO)</span></td></tr>
<tr><td><span class="snip">address</span></td><td>IP address string</td></tr>
<tr><td><span class="snip">port</span></td><td>Port number</td></tr>
<tr><td><span class="snip">family</span></td><td>"IPv4" or "IPv6"</td></tr>
</table>
<p>Returns the Socket object.</p>
<!-- socket_on_data -->
<p><div class="prop"><span class="title" id="socket_on_data">socket.on('data', listener)</span></div>
<div class="tsproto">socket.on('data', listener: (data: Buffer) => void): Socket</div>
</p>
<p>Registers a listener for the <span class="snip">'data'</span> event.</p>
<span class="snip">listener</span> receives data as a <a target="blank" href="https://nodejs.org/docs/v6.9.1/api/buffer.html">Buffer</a> object.
<p>Returns the Socket object.</p>
<!-- socket_on_end -->
<p><div class="prop"><span class="title" id="socket_on_end">socket.on('end', listener)</span></div>
<div class="tsproto">socket.on('end', listener: () => void): Socket</div>
</p>
<p>Registers a listener for the <span class="snip">'end'</span> event.</p>
<span class="snip">listener</span> is invoked when the other side closes the read half of the socket.
<p>Returns the Socket object.</p>
<!-- socket_on_close -->
<p><div class="prop"><span class="title" id="socket_on_close">socket.on('close', listener)</span></div>
<div class="tsproto">socket.on('close', listener: () => void): Socket</div>
</p>
<p>Registers a listener for the <span class="snip">'close'</span> event.</p>
<span class="snip">listener</span> is invoked when the socket is fully closed.
<p>Returns the Socket object.</p>
<!-- socket_on_drain -->
<p><div class="prop"><span class="title" id="socket_on_drain">socket.on('drain', listener)</span></div>
<div class="tsproto">socket.on('drain', listener: () => void): Socket</div>
</p>
<p>Registers a listener for the <span class="snip">'drain'</span> event.</p>
<span class="snip">listener</span> is invoked when all buffered writes are sent.
<p>Returns the Socket object.</p>
<!-- socket_on_error -->
<p><div class="prop"><span class="title" id="socket_on_error">socket.on('error', listener)</span></div>
<div class="tsproto">socket.on('error', listener: (Error) => void): Socket</div>
</p>
<p>Registers a listener for the <span class="snip">'error'</span> event.</p>
<span class="snip">listener</span> receives an <span class="snip">Error</span> object when an error occurs.
<p>Returns the Socket object.</p>
<!-- socket_off -->
<p><div class="prop"><span class="title" id="socket_off">socket.off(eventName, listener)</span></div>
<div class="tsproto">socket.off(eventName: string, listener: function): Socket</div>
</p>
Removes a listener.
<p>Returns the Socket object.</p>
<!-- socket_remoteAddress -->
<p><div class="prop"><span class="title" id="socket_remoteAddress">socket.remoteAddress</span></div>
<div class="tsproto">socket.remoteAddress: string</div>
</p>
The remote address. <span class="snip">""</span> if the socket is not connected.
<!-- socket_remotePort -->
<p><div class="prop"><span class="title" id="socket_remotePort">socket.remotePort</span></div>
<div class="tsproto">socket.remotePort: number</div>
</p>
The remote port. <span class="snip">0</span> if the socket is not connected.
<!-- socket_localAddress -->
<p><div class="prop"><span class="title" id="socket_localAddress">socket.localAddress</span></div>
<div class="tsproto">socket.localAddress: string</div>
</p>
The local address. <span class="snip">""</span> if the socket is not connected.
<!-- socket_localPort -->
<p><div class="prop"><span class="title" id="socket_localPort">socket.localPort</span></div>
<div class="tsproto">socket.localPort: number</div>
</p>
The local port. <span class="snip">""</span> if the socket is not connected.
<!-- socket_addressFamily -->
<p><div class="prop"><span class="title" id="socket_addressFamily">socket.addressFamily</span></div>
<div class="tsproto">socket.addressFamily: string</div>
</p>
The address family. <span class="snip">""</span> if the socket is not connected.
</div>
<!-- Server -->
<div class="module">
<div class="modtitle"><span class="title" id="Server">Server</span></div>
TCP server class
<!-- new_Server -->
<p><div class="prop"><span class="title" id="new_Server">new Server()</span></div>
<div class="tsproto">new Server()</div>
</p>
Creates a <a href="#Server">Server</a> object.
<pre class="ex">
<span class="js-keyword">var</span> <span class="js-word">server</span> = <span class="js-keyword">new</span> <span class="js-word">Server</span>();
<span class="js-word">server</span>.<span class="js-word">listen</span>(<span class="js-number">1337</span>, <span class="js-string">"127.0.0.1"</span>);
<span class="js-word">server</span>.<span class="js-word">on</span>(<span class="js-string">'connection'</span>, <span class="js-keyword">function</span>(<span class="js-word">c</span>) {
<span class="js-word">c</span>.<span class="js-word">on</span>(<span class="js-string">'data'</span>, <span class="js-keyword">function</span>(<span class="js-word">data</span>) {
<span class="js-keyword">if</span>(<span class="js-word">data</span>.<span class="js-word">toString</span>() == <span class="js-string">'ping'</span>) {
<span class="js-word">c</span>.<span class="js-word">write</span>(<span class="js-string">'pong'</span>);
}
});
<span class="js-word">c</span>.<span class="js-word">on</span>(<span class="js-string">'end'</span>, <span class="js-keyword">function</span>() {
<span class="js-word">console</span>.<span class="js-word">log</span>(<span class="js-string">"client ended connection"</span>);
})
});
</pre>
<!-- server_listen -->
<p><div class="prop"><span class="title" id="server_listen">server.listen(port[, address])</span></div>
<div class="tsproto">server.listen(port: number, address: string): void</div>
</p>
Binds the server to the specified address and port and starts listening.
<!-- server_close -->
<p><div class="prop"><span class="title" id="server_close">server.close()</span></div>
<div class="tsproto">server.close(): void</div>
</p>
Stops listening for new connections (does not affect existing connections).
<!-- server_on_connection -->
<p><div class="prop"><span class="title" id="server_on_connection">server.on('connection', listener)</span></div>
<div class="tsproto">server.on('connection', listener: (Socket) => void): Server</div>
</p>
<p>Registers a listener for the <span class="snip">'connection'</span> event.</p>
<span class="snip">listener</span> receives a <a href="#Socket">Socket</a> object when a client has connected.
<p>Returns the Server object.</p>
<!-- server_on_listening -->
<p><div class="prop"><span class="title" id="server_on_listening">server.on('listening', listener)</span></div>
<div class="tsproto">server.on('listening', listener: () => void): Server</div>
</p>
<p>Registers a listener for the <span class="snip">'listening'</span> event.</p>
<span class="snip">listener</span> is invoked when the server begins listening for connections.
<p>Returns the Server object.</p>
<!-- server_on_close -->
<p><div class="prop"><span class="title" id="server_on_close">server.on('close', listener)</span></div>
<div class="tsproto">server.on('close', listener: () => void): Server</div>
</p>
<p>Registers a listener for the <span class="snip">'close'</span> event.</p>
<span class="snip">listener</span> is invoked when the server is closed.
<p>Returns the Server object.</p>
<!-- server_on_error -->
<p><div class="prop"><span class="title" id="server_on_error">server.on('error', listener)</span></div>
<div class="tsproto">server.on('error', listener: (Error) => void): Server</div>
</p>
<p>Registers a listener for the <span class="snip">'error'</span> event.</p>
<span class="snip">listener</span> receives an <span class="snip">Error</span> object when an error occurs.
<p>Returns the Server object.</p>
<!-- server_off -->
<p><div class="prop"><span class="title" id="server_off">server.off(eventName, listener)</span></div>
<div class="tsproto">server.off(eventName: string, listener: function): Server</div>
</p>
Removes a listener.
<p>Returns the Server object.</p>
<!-- server_port -->
<p><div class="prop"><span class="title" id="server_port">server.port</span></div>
<div class="tsproto">server.port: number</div>
</p>
The bound port number. <span class="snip">0</span> if the server is not listening.
<!-- server_address -->
<p><div class="prop"><span class="title" id="server_address">server.address</span></div>
<div class="tsproto">server.address: string</div>
</p>
The bound address. <span class="snip">""</span> if the server is not listening.
<!-- server_addressFamily -->
<p><div class="prop"><span class="title" id="server_addressFamily">server.addressFamily</span></div>
<div class="tsproto">server.addressFamily: string</div>
</p>
The bound address family. <span class="snip">""</span> if the server is not listening.
</div>
<!-- script -->
<div class="module">
<div class="modtitle"><span class="title" id="script">script</span></div>
Script instance configuration interface
<!-- script_keepalive -->
<p><div class="prop"><span class="title" id="script_keepalive">script.keepalive(keepAlive)</span></div>
<div class="tsproto">script.keepalive(keepAlive: boolean): void</div>
</p>
Prevents the script instance from being destroyed when it has nothing left to do.
Useful when the default console input behavior is desired.
<!-- script_timeout -->
<p><div class="prop"><span class="title" id="script_timeout">script.timeout(milliseconds)</span></div>
<div class="tsproto">script.timeout(milliseconds: number): void</div>
</p>
Sets the maximum amount of time tasks may run on the script instance before errors are thrown. By default this value is 500 milliseconds.
Setting this value to zero will allow tasks to run indefinitely.
</div>
<!-- Globals -->
<div class="module">
<div class="modtitle"><span class="title" id="Globals">Globals</span></div>
<!-- global -->
<p><div class="prop"><span class="title" id="global">global</span></div>
<div class="tsproto">global: Object</div>
</p>
Reference to the global object.
<pre class="ex">
<span class="js-word">global</span>.<span class="js-word">test</span> = <span class="js-number">1</span>;
<span class="js-word">console</span>.<span class="js-word">log</span>(<span class="js-word">test</span>); <span class="js-comment">// "1"</span>
</pre>
<!-- require -->
<p><div class="prop"><span class="title" id="require">require(id)</span></div>
<div class="tsproto">require(id: string): Object</div>
</p>
Loads a module and returns its <span class="snip">module.exports</span> object. <span class="snip">id</span> may be one of the following:
<p>
<ul>
<li>The name of a JavaScript (*.js) or DLL (*.dll) file in the <span class="snip">Scripts/modules</span> directory.</i>
<li>If <span class="snip">id</span> begins with <span class="snip">./</span> or <span class="snip">../</span>, the path of a JavaScript or DLL file relative to the calling module's location.</i>
</ul>
</p>
<pre class="ex">
<span class="js-comment">/* Scripts/module_example.js */</span>
<span class="js-keyword">const</span> <span class="js-word">mymodule</span> = <span class="js-word">require</span>(<span class="js-string">'mymodule/lib.js'</span>); <span class="js-comment">// Loads Scripts/modules/mymodule/lib.js</span>
<span class="js-word">mymodule</span>.<span class="js-word">init</span>(); <span class="js-comment">// Prints "Loaded mymodule"</span>
</pre>
<pre class="ex">
<span class="js-comment">/* Scripts/modules/mymodule/lib.js */</span>
<span class="js-keyword">function</span> <span class="js-word">init</span>() {
<span class="js-word">console</span>.<span class="js-word">log</span>(<span class="js-string">"Loaded mymodule"</span>);
}
<span class="js-word">module</span>.<span class="js-word">exports</span> = {
<span class="js-word">init</span>: <span class="js-word">init</span>
};
</pre>
<p>Native modules use the <a target="blank" href="https://github.com/svaarala/duktape/blob/master/doc/c-module-convention.rst">Duktape C module convention</a>.</p>
<!-- exec -->
<p><div class="prop"><span class="title" id="exec">exec(command[, options])</span></div>
<div class="tsproto">exec(command: string, options?: Object): string</div>
</p>
Executes a system command. Does not return until the subprocess exits.
<p>Returns the standard output of the subprocess as a string.</p>
<p><span class="snip">options</span> may contain any of the following properties:</p>
<table>
<tr><td><span class="snip">showWindow</span></td><td>If <span class="snip">true</span>, the window of the subprocess is visible. <span class="snip">false</span> by default.</td></tr>
<tr><td><span class="snip">verbose</span></td><td>If <span class="snip">true</span>, the output of the subprocess is sent to the script manager console. <span class="snip">false</span> by default.</td></tr>
<tr><td><span class="snip">cwd</span></td><td>Current working directory of the subprocess. By default this is the directory containing Project64.</td></tr>
</table>
<p>This function throws an error if the operation fails or if the exit code of the subprocess is non-zero.
The thrown error object contains the following properties:</p>
<table>
<tr><td><span class="snip">status</span></td><td>The exit code of the subprocess.</td></tr>
<tr><td><span class="snip">stdout</span></td><td>The standard output of the subprocess.</td></tr>
<tr><td><span class="snip">stderr</span></td><td>The standard error output of the subprocess.</td></tr>
<tr><td><span class="snip">pid</span></td><td>The PID of the subprocess.</td></tr>
</table>
<pre class="ex">
<span class="js-keyword">try</span> {
<span class="js-word">exec</span>(<span class="js-string">"dir"</span>, { <span class="js-word">verbose</span>: <span class="js-keyword">true</span> });
} <span class="js-keyword">catch</span>(<span class="js-word">err</span>) {
<span class="js-word">console</span>.<span class="js-word">log</span>(<span class="js-string">"exec() failed with code"</span>, <span class="js-word">err</span>.<span class="js-word">status</span>);
<span class="js-word">console</span>.<span class="js-word">log</span>(<span class="js-word">err</span>.<span class="js-word">stderr</span>);
}
</pre>
<!-- alert -->
<p><div class="prop"><span class="title" id="alert">alert(message[, caption])</span></div>
<div class="tsproto">alert(message: string, caption?: string): void</div>
</p>
Shows a message box over the main window. Does not return until the message box is dismissed.
<!-- setTimeout -->
<p><div class="prop"><span class="title" id="setTimeout">setTimeout(callback, delay)</span></div>
<div class="tsproto">setTimeout(callback: () => void, delay: number): number</div>
</p>
<span class="snip">callback</span> is invoked once after the number of milliseconds specified by <span class="snip">delay</span>.
<p>Returns a timeout ID.</p>
<!-- clearTimeout -->
<p><div class="prop"><span class="title" id="clearTimeout">clearTimeout(timeoutId)</span></div>
<div class="tsproto">setTimeout(timeoutId: number): void</div>
</p>
Cancels the timeout specified by <span class="snip">timeoutId</span>.
<!-- setInterval -->
<p><div class="prop"><span class="title" id="setInterval">setInterval(callback, delay)</span></div>
<div class="tsproto">setInterval(callback: () => void, delay: number): number</div>
</p>
<span class="snip">callback</span> is invoked periodically. <span class="snip">delay</span> specifies the amount of time in milliseconds to wait before each invocation.
<p>Returns an interval ID.</p>
<!-- clearInterval -->
<p><div class="prop"><span class="title" id="clearInterval">clearInterval(intervalId)</span></div>
<div class="tsproto">setTimeout(intervalId: number): void</div>
</p>
Cancels the interval specified by <span class="snip">intervalId</span>.
<!-- number_hex -->
<p><div class="prop"><span class="title" id="number_hex">number.hex([numChars])</span></div>
<div class="tsproto">number.hex(numChars?: number): string</div>
</p>
Returns a hexadecimal string representation of the number object.
The returned string is prepended with zeroes so that its character length is <span class="snip">numChars</span> or 8 by default.
<pre class="ex">
<span class="js-keyword">var</span> <span class="js-word">n</span> = <span class="js-number">123</span>;
<span class="js-word">n</span>.<span class="js-word">hex</span>(); <span class="js-comment">// 0000007B</span>
<span class="js-word">n</span>.<span class="js-word">hex</span>(<span class="js-number">4</span>); <span class="js-comment">// 007B</span>
</pre>
<!-- type_ids -->
<p><div class="prop"><span class="title" id="type_ids">Type IDs</span></div>
</p>
<table>
<tr><td><span class="snip">u8</span> </td><td>Unsigned 8-bit integer</td></tr>
<tr><td><span class="snip">u16</span> </td><td>Unsigned 16-bit integer</td></tr>
<tr><td><span class="snip">u32</span> </td><td>Unsigned 32-bit integer</td></tr>
<tr><td><span class="snip">s8</span> </td><td>Signed 8-bit integer</td></tr>
<tr><td><span class="snip">s16</span> </td><td>Signed 16-bit integer</td></tr>
<tr><td><span class="snip">s32</span> </td><td>Signed 32-bit integer</td></tr>
<tr><td><span class="snip">f32</span> </td><td>32-bit single precision floating-point</td></tr>
<tr><td><span class="snip">f64</span> </td><td>64-bit double precision floating-point</td></tr>
<tr><td><span class="snip">u64</span> </td><td>Unsigned 64-bit integer</td></tr>
<tr><td><span class="snip">s64</span> </td><td>Signed 64-bit integer</td></tr>
</table>
<p>Note: The <a href="#mem_bindvar">mem.bind*</a>/<a href="#mem_typedef">mem.typedef</a> APIs do not currently support <span class="snip">u64</span> and <span class="snip">s64</span>.</p>
<!-- N64_memory_addresses -->
<p><div class="prop"><span class="title" id="N64_memory_addresses">N64 memory addresses</span></div>
</p>
<p>
<table>
<tr><td><span class="snip">RDRAM_CONFIG_REG</span> </td><td>0xA3F00000</td></tr>
<tr><td><span class="snip">RDRAM_DEVICE_TYPE_REG</span> </td><td>0xA3F00000</td></tr>
<tr><td><span class="snip">RDRAM_DEVICE_ID_REG</span> </td><td>0xA3F00004</td></tr>
<tr><td><span class="snip">RDRAM_DELAY_REG</span> </td><td>0xA3F00008</td></tr>
<tr><td><span class="snip">RDRAM_MODE_REG</span> </td><td>0xA3F0000C</td></tr>
<tr><td><span class="snip">RDRAM_REF_INTERVAL_REG</span> </td><td>0xA3F00010</td></tr>
<tr><td><span class="snip">RDRAM_REF_ROW_REG</span> </td><td>0xA3F00014</td></tr>
<tr><td><span class="snip">RDRAM_RAS_INTERVAL_REG</span> </td><td>0xA3F00018</td></tr>
<tr><td><span class="snip">RDRAM_MIN_INTERVAL_REG</span> </td><td>0xA3F0001C</td></tr>
<tr><td><span class="snip">RDRAM_ADDR_SELECT_REG</span> </td><td>0xA3F00020</td></tr>
<tr><td><span class="snip">RDRAM_DEVICE_MANUF_REG</span> </td><td>0xA3F00024</td></tr>
<tr><td><span class="snip">SP_MEM_ADDR_REG</span> </td><td>0xA4040000</td></tr>
<tr><td><span class="snip">SP_DRAM_ADDR_REG</span> </td><td>0xA4040004</td></tr>
<tr><td><span class="snip">SP_RD_LEN_REG</span> </td><td>0xA4040008</td></tr>
<tr><td><span class="snip">SP_WR_LEN_REG</span> </td><td>0xA404000C</td></tr>
<tr><td><span class="snip">SP_STATUS_REG</span> </td><td>0xA4040010</td></tr>
<tr><td><span class="snip">SP_DMA_FULL_REG</span> </td><td>0xA4040014</td></tr>
<tr><td><span class="snip">SP_DMA_BUSY_REG</span> </td><td>0xA4040018</td></tr>
<tr><td><span class="snip">SP_SEMAPHORE_REG</span> </td><td>0xA404001C</td></tr>
<tr><td><span class="snip">SP_PC_REG</span> </td><td>0xA4080000</td></tr>
<tr><td><span class="snip">SP_IBIST_REG</span> </td><td>0xA4080004</td></tr>
<tr><td><span class="snip">DPC_START_REG</span> </td><td>0xA4100000</td></tr>
<tr><td><span class="snip">DPC_END_REG</span> </td><td>0xA4100004</td></tr>
<tr><td><span class="snip">DPC_CURRENT_REG</span> </td><td>0xA4100008</td></tr>
<tr><td><span class="snip">DPC_STATUS_REG</span> </td><td>0xA410000C</td></tr>
<tr><td><span class="snip">DPC_CLOCK_REG</span> </td><td>0xA4100010</td></tr>
<tr><td><span class="snip">DPC_BUFBUSY_REG</span> </td><td>0xA4100014</td></tr>
<tr><td><span class="snip">DPC_PIPEBUSY_REG</span> </td><td>0xA4100018</td></tr>
<tr><td><span class="snip">DPC_TMEM_REG</span> </td><td>0xA410001C</td></tr>
<tr><td><span class="snip">DPS_TBIST_REG</span> </td><td>0xA4200000</td></tr>
<tr><td><span class="snip">DPS_TEST_MODE_REG</span> </td><td>0xA4200004</td></tr>
<tr><td><span class="snip">DPS_BUFTEST_ADDR_REG</span> </td><td>0xA4200008</td></tr>
<tr><td><span class="snip">DPS_BUFTEST_DATA_REG</span> </td><td>0xA420000C</td></tr>
<tr><td><span class="snip">MI_INIT_MODE_REG</span> </td><td>0xA4300000</td></tr>
<tr><td><span class="snip">MI_MODE_REG</span> </td><td>0xA4300000</td></tr>
<tr><td><span class="snip">MI_VERSION_REG</span> </td><td>0xA4300004</td></tr>
<tr><td><span class="snip">MI_NOOP_REG</span> </td><td>0xA4300004</td></tr>
<tr><td><span class="snip">MI_INTR_REG</span> </td><td>0xA4300008</td></tr>
<tr><td><span class="snip">MI_INTR_MASK_REG</span> </td><td>0xA430000C</td></tr>
<tr><td><span class="snip">VI_STATUS_REG</span> </td><td>0xA4400000</td></tr>
<tr><td><span class="snip">VI_CONTROL_REG</span> </td><td>0xA4400000</td></tr>
<tr><td><span class="snip">VI_ORIGIN_REG</span> </td><td>0xA4400004</td></tr>
<tr><td><span class="snip">VI_DRAM_ADDR_REG</span> </td><td>0xA4400004</td></tr>
<tr><td><span class="snip">VI_WIDTH_REG</span> </td><td>0xA4400008</td></tr>
<tr><td><span class="snip">VI_H_WIDTH_REG</span> </td><td>0xA4400008</td></tr>
<tr><td><span class="snip">VI_INTR_REG</span> </td><td>0xA440000C</td></tr>
<tr><td><span class="snip">VI_V_INTR_REG</span> </td><td>0xA440000C</td></tr>
<tr><td><span class="snip">VI_CURRENT_REG</span> </td><td>0xA4400010</td></tr>
<tr><td><span class="snip">VI_V_CURRENT_LINE_REG</span> </td><td>0xA4400010</td></tr>
<tr><td><span class="snip">VI_BURST_REG</span> </td><td>0xA4400014</td></tr>
<tr><td><span class="snip">VI_TIMING_REG</span> </td><td>0xA4400014</td></tr>
<tr><td><span class="snip">VI_V_SYNC_REG</span> </td><td>0xA4400018</td></tr>
<tr><td><span class="snip">VI_H_SYNC_REG</span> </td><td>0xA440001C</td></tr>
<tr><td><span class="snip">VI_LEAP_REG</span> </td><td>0xA4400020</td></tr>
<tr><td><span class="snip">VI_H_SYNC_LEAP_REG</span> </td><td>0xA4400020</td></tr>
<tr><td><span class="snip">VI_H_START_REG</span> </td><td>0xA4400024</td></tr>
<tr><td><span class="snip">VI_H_VIDEO_REG</span> </td><td>0xA4400024</td></tr>
<tr><td><span class="snip">VI_V_START_REG</span> </td><td>0xA4400028</td></tr>
<tr><td><span class="snip">VI_V_VIDEO_REG</span> </td><td>0xA4400028</td></tr>
<tr><td><span class="snip">VI_V_BURST_REG</span> </td><td>0xA440002C</td></tr>
<tr><td><span class="snip">VI_X_SCALE_REG</span> </td><td>0xA4400030</td></tr>
<tr><td><span class="snip">VI_Y_SCALE_REG</span> </td><td>0xA4400034</td></tr>
<tr><td><span class="snip">AI_DRAM_ADDR_REG</span> </td><td>0xA4500000</td></tr>
<tr><td><span class="snip">AI_LEN_REG</span> </td><td>0xA4500004</td></tr>
<tr><td><span class="snip">AI_CONTROL_REG</span> </td><td>0xA4500008</td></tr>
<tr><td><span class="snip">AI_STATUS_REG</span> </td><td>0xA450000C</td></tr>
<tr><td><span class="snip">AI_DACRATE_REG</span> </td><td>0xA4500010</td></tr>
<tr><td><span class="snip">AI_BITRATE_REG</span> </td><td>0xA4500014</td></tr>
<tr><td><span class="snip">PI_DRAM_ADDR_REG</span> </td><td>0xA4600000</td></tr>
<tr><td><span class="snip">PI_CART_ADDR_REG</span> </td><td>0xA4600004</td></tr>
<tr><td><span class="snip">PI_RD_LEN_REG</span> </td><td>0xA4600008</td></tr>
<tr><td><span class="snip">PI_WR_LEN_REG</span> </td><td>0xA460000C</td></tr>
<tr><td><span class="snip">PI_STATUS_REG</span> </td><td>0xA4600010</td></tr>
<tr><td><span class="snip">PI_BSD_DOM1_LAT_REG</span> </td><td>0xA4600014</td></tr>
<tr><td><span class="snip">PI_BSD_DOM1_PWD_REG</span> </td><td>0xA4600018</td></tr>
<tr><td><span class="snip">PI_BSD_DOM1_PGS_REG</span> </td><td>0xA460001C</td></tr>
<tr><td><span class="snip">PI_BSD_DOM1_RLS_REG</span> </td><td>0xA4600020</td></tr>
<tr><td><span class="snip">PI_BSD_DOM2_LAT_REG</span> </td><td>0xA4600024</td></tr>
<tr><td><span class="snip">PI_BSD_DOM2_PWD_REG</span> </td><td>0xA4600028</td></tr>
<tr><td><span class="snip">PI_BSD_DOM2_PGS_REG</span> </td><td>0xA460002C</td></tr>
<tr><td><span class="snip">PI_BSD_DOM2_RLS_REG</span> </td><td>0xA4600030</td></tr>
<tr><td><span class="snip">RI_MODE_REG</span> </td><td>0xA4700000</td></tr>
<tr><td><span class="snip">RI_CONFIG_REG</span> </td><td>0xA4700004</td></tr>
<tr><td><span class="snip">RI_CURRENT_LOAD_REG</span> </td><td>0xA4700008</td></tr>
<tr><td><span class="snip">RI_SELECT_REG</span> </td><td>0xA470000C</td></tr>
<tr><td><span class="snip">RI_REFRESH_REG</span> </td><td>0xA4700010</td></tr>
<tr><td><span class="snip">RI_COUNT_REG</span> </td><td>0xA4700010</td></tr>
<tr><td><span class="snip">RI_LATENCY_REG</span> </td><td>0xA4700014</td></tr>
<tr><td><span class="snip">RI_RERROR_REG</span> </td><td>0xA4700018</td></tr>
<tr><td><span class="snip">RI_WERROR_REG</span> </td><td>0xA470001C</td></tr>
<tr><td><span class="snip">SI_DRAM_ADDR_REG</span> </td><td>0xA4800000</td></tr>
<tr><td><span class="snip">SI_PIF_ADDR_RD64B_REG</span> </td><td>0xA4800004</td></tr>
<tr><td><span class="snip">SI_PIF_ADDR_WR64B_REG</span> </td><td>0xA4800010</td></tr>
<tr><td><span class="snip">SI_STATUS_REG</span> </td><td>0xA4800018</td></tr>
</table>
</p>
<p>
<table>
<tr><td><span class="snip">PIF_ROM_START</span> </td><td>0xBFC00000</td></tr>
<tr><td><span class="snip">PIF_RAM_START</span> </td><td>0xBFC007C0</td></tr>
<tr><td><span class="snip">SP_DMEM_START</span> </td><td>0xA4000000</td></tr>
<tr><td><span class="snip">SP_IMEM_START</span> </td><td>0xA4001000</td></tr>
</table>
</p>
<p>
<table>
<tr><td><span class="snip">KUBASE</span> </td><td>0x00000000</td></tr>
<tr><td><span class="snip">K0BASE</span> </td><td>0x80000000</td></tr>
<tr><td><span class="snip">K1BASE</span> </td><td>0xA0000000</td></tr>
<tr><td><span class="snip">K2BASE</span> </td><td>0xC0000000</td></tr>
</table>
</p>
<p>
<table>
<tr><td><span class="snip">UT_VEC</span> </td><td>0x80000000</td></tr>
<tr><td><span class="snip">R_VEC</span> </td><td>0xBFC00000</td></tr>
<tr><td><span class="snip">XUT_VEC</span> </td><td>0x80000080</td></tr>
<tr><td><span class="snip">ECC_VEC</span> </td><td>0x80000100</td></tr>
<tr><td><span class="snip">E_VEC</span> </td><td>0x80000180</td></tr>
</table>
</p>
<!-- Miscellaneous -->
<p><div class="prop"><span class="title" id="Miscellaneous">Miscellaneous</span></div>
</p>
<p>
<table>
<tr><td><span class="snip">M_GFXTASK</span></td><td>1</td></tr>
<tr><td><span class="snip">M_AUDTASK</span></td><td>2</td></tr>
</table>
</p>
<p>
<table>
<tr><td><span class="snip">OS_READ</span></td><td>0</td></tr>
<tr><td><span class="snip">OS_WRITE</span></td><td>1</td></tr>
</table>
</p>
<p>
<table>
<tr><td><span class="snip">G_IM_FMT_RGBA</span></td><td>0</td></tr>
<tr><td><span class="snip">G_IM_FMT_YUV</span></td><td>1</td></tr>
<tr><td><span class="snip">G_IM_FMT_CI</span></td><td>2</td></tr>
<tr><td><span class="snip">G_IM_FMT_IA</span></td><td>3</td></tr>
<tr><td><span class="snip">G_IM_FMT_I</span></td><td>4</td></tr>
</table>
</p>
<p>
<table>
<tr><td><span class="snip">G_IM_SIZ_4b</span></td><td>0</td></tr>
<tr><td><span class="snip">G_IM_SIZ_8b</span></td><td>1</td></tr>
<tr><td><span class="snip">G_IM_SIZ_16b</span></td><td>2</td></tr>
<tr><td><span class="snip">G_IM_SIZ_32b</span></td><td>3</td></tr>
</table>
</p>
<p>
<table>
<tr><td><span class="snip">G_TT_NONE</span> </td><td>0x0000</td></tr>
<tr><td><span class="snip">G_TT_RGBA16</span></td><td>0x8000</td></tr>
<tr><td><span class="snip">G_TT_IA16</span> </td><td>0xC000</td></tr>
</table>
</p>
</div>
</div>
</body>