iigs-game-engine/docs/toolboxref.html
2022-07-24 21:21:10 -05:00

3370 lines
96 KiB
HTML

---
layout: page
title: Toolbox Reference
style: toolref
---
<link rel="stylesheet" href="{{ 'assets/css/toolref.css' | relative_url }}">
<div id="content">
<ul>
<li><a href="#HousekeepingRoutines">Housekeeping Functions</a></li>
<li><a href="#SpriteRoutines">Sprite Functions</a></li>
<li><a href="#TileRoutines">Tile Functions</a></li>
<li><a href="#PrimaryRoutines">Primary Background Functions</a></li>
<li><a href="#SecondaryRoutines">Secondary Background Functions</a></li>
<li><a href="#TimerRoutines">Timer Functions</a></li>
<li><a href="#OverlayRoutines">Overlay Functions</a></li>
<li><a href="#GlobalRoutines">Global State Functions</a></li>
<li><a href="#MiscRoutines">Miscellaneous Functions</a></li>
</ul>
<div class="api_intro">
<h1>GTE Tool Set</h1>
<p>
The <em>Generic Tile Engine (GTE)</em> Tool Set enables tile-based games to be implemented in an efficient manner.
The tool set provides support for sprites, animations, large scrolling backgrounds and special effects.
</p>
<p>
To effectively use this tool set, a user should be familiar with the following
</p>
<ul>
<li>The IIgs Hardware Reference</li>
<li>The QuickDraw II tool set</li>
<li>IIgs Technical Note #70</li>
</ul>
<p></p>
<h2>A preview of the GTE Tool Set routines</h2>
<p>
To introduce you to the capabilities of the GTE Tool Set the routines are grouped by function and briefly
described in Table 1. These routines are descibed in detail later where they are separated into housekeeping
routines (discussed in routine number order) and the rest of the GTE Tool Set routines (discussed in alphabetical
order).
</p>
<table class="intro">
<tbody>
<tr>
<th colspan="2">Table 1</th>
</tr>
<tr>
<th colspan="2" style="font-weight: normal;">GTE Tool Set routines and their functions</th>
</tr>
<tr class="intro_header">
<th>Routine</th>
<th>Description</th>
</tr>
<tr>
<th id="HousekeepingRoutines" colspan="2">Housekeeping Routines</th>
</tr>
<tr>
<td><a href="#GTEBootInit">GTEBootInit</a></td>
<td>Initializes the GTE Tool Set; called only by the Tool Locator — must not be called by an application</td>
</tr>
<tr>
<td><a href="#GTEStartUp">GTEStartUp</a></td>
<td>Starts up the GTE Tool Set for use by an application</td>
</tr>
<tr>
<td><a href="#GTEShutDown">GTEShutDown</a></td>
<td>Shuts down the GTE Tool Set when an application quits</td>
</tr>
<tr>
<td><a href="#GTEVersion">GTEVersion</a></td>
<td>Returns the version number of the GTE Tool Set</td>
</tr>
<tr>
<td><a href="#GTEReset">GTEReset</a></td>
<td>Resets the GTE Tool Set; called only when the system is reset — must not be called by an application</td>
</tr>
<tr>
<td><a href="#GTEStatus">GTEStatus</a></td>
<td>Indicates whether the GTE Tool Set is active</td>
</tr>
<tr>
<th id="SpriteRoutines" colspan="2">Sprite Routines</th>
<th></th>
</tr>
<tr>
<td><a href="#GTECreateSpriteStamp">GTECreateSpriteStamp</a></td>
<td> Creates a sprite stamp from the tile set</td>
</tr>
<tr>
<td><a href="#GTEAddSprite">GTEAddSprite</a></td>
<td>Add a active sprite to the scene</td>
</tr>
<tr>
<td><a href="#GTEMoveSprite">GTEMoveSprite</a></td>
<td>Changes a sprite's location</td>
</tr>
<tr>
<td><a href="#GTEUpdateSprite">GTEUpdateSprite</a></td>
<td>Changes a sprite's tile set reference and display flags</td>
</tr>
<tr>
<td><a href="#GTERemoveSprite">GTERemoveSprite</a></td>
<td> Removes a sprite from the scene</td>
</tr>
<tr>
<th id="TileRoutines" colspan="2">Tile Routines</th>
</tr>
<tr>
<td><a href="#GTELoadTileSet">GTELoadTileSet</a></td>
<td>Copies a tileset into the GTE tileset memory</td>
</tr>
<tr>
<td><a href="#GTESetTile">GTESetTile</a></td>
<td>Assigns a tile to a tile store</td>
</tr>
<tr>
<td><a href="#GTEGetTileAt">GTEGetTileAt</a></td>
<td>Retrieves the tile ID stored in the tile store</td>
</tr>
<tr>
<td><a href="#GTECopyTileToDynamic">GTECopyTileToDynamic</a></td>
<td>Copies a tile from the tileset memory into the managed dynamic tile memory. Changing the dynamic tile data
will result in all of the tiles updating
on the next call the <tt>GTERender()</tt></td>
</tr>
<tr>
<td><a href="#GTEGetTileDataAddr">GTEGetTileDataAddr</a></td>
<td>Returns the base address of the tiledata memory</td>
</tr>
<tr>
<td><a href="#GTEFillTileStore">GTEFillTileStore</a></td>
<td>Fills the entire tile store with a tile ID.</td>
</tr>
<tr>
<th id="PrimaryRoutines" colspan="2">Primary Background Routines</th>
</tr>
<tr>
<td><a href="#GTESetBG0Origin">GTESetBG0Origin</a></td>
<td>Sets the upper-left origin point in the primary background</td>
</tr>
<tr>
<td><a href="#GTERender">GTERender</a></td>
<td>Draws the current scene to the graphics screen</td>
</tr>
<tr>
<td><a href="#GTEGetBG0TileMapInfo">GTEGetBG0TileMapInfo</a></td>
<td>Returns a record describing the number of tiles in the primary tilemap and a pointer to the tilemap data.
</td>
</tr>
<tr>
<td><a href="#GTESetBG0TileMapInfo">GTESetBG0TileMapInfo</a></td>
<td>Defines a tile map for the primary background</td>
</tr>
<tr>
<td><a href="#GTERefresh">GTERefresh</a></td>
<td>Forces all of the tiles in the tile store to be refreshed on the next render.</td>
</tr>
<tr>
<th id="SecondaryRoutines" colspan="2">Secondary Background Routines</th>
</tr>
<tr>
<td><a href="#GTESetBG1Origin">GTESetBG1Origin</a></td>
<td>Sets the upper-left origin point in the secondary background</td>
</tr>
<tr>
<td><a href="#GTECopyPicToBG1">GTECopyPicToBG1</a></td>
<td>Copies an uncompressed pixel image into the secondard background buffer</td>
</tr>
<tr>
<td><a href="#GTESetBG1TileMapInfo">GTESetBG1TileMapInfo</a></td>
<td>Defines a tile map for the secondary background</td>
</tr>
<tr>
<td><a href="#GTESetBG1Displacement">GTESetBG1Displacement</a></td>
<td>Sets a displacement into the BG1 offset table.</td>
</tr>
<tr>
<td><a href="#GTESetBG1Rotation">GTESetBG1Rotation</a></td>
<td>Sets the rotation angle of the BG1 buffer.</td>
</tr>
<tr>
<td><a href="#GTEClearBG1Buffer">GTEClearBG1Buffer</a></td>
<td>Clears the BG1 pixel buffer with a 16-bit value.</td>
</tr>
<tr>
<th id="TimerRoutines" colspan="2">Timer Routines</th>
</tr>
<tr>
<td><a href="#GTEAddTimer">GTEAddTimer</a></td>
<td>Add a timer callback that is fired after a designated number of VBL ticks</td>
</tr>
<tr>
<td><a href="#GTERemoveTimer">GTERemoveTimer</a></td>
<td>Removes an active timer</td>
</tr>
<tr>
<td><a href="#GTEStartScript">GTEStartScript</a></td>
<td>Registers a GTE script to be handled in the background</td>
</tr>
<tr>
<th id="OverlayRoutines" colspan="2">Overlay Routines</th>
</tr>
<tr>
<td><a href="#GTESetOverlay">GTESetOverlay</a></td>
<td>Registers an overlay routine to be integrated into the renderer. Typically used for status bars or
messages.</td>
</tr>
<tr>
<td><a href="#GTEClearOverlay">GTEClearOverlay</a></td>
<td>Removes the current overlay from the renderer</td>
</tr>
<tr>
<th id="GlobalRoutines" colspan="2">Functions affecting the global state</th>
</tr>
<tr>
<td><a href="#GTESetScreenMode">GTESetScreenMode</a></td>
<td>Sets the playing field's port rectangle to a pre-defined size, or a specified width and height</td>
</tr>
<tr>
<td><a href="#GTESetPalette">GTESetPalette</a></td>
<td>Copies a palette to the Super HiRes palette memory</td>
</tr>
<tr>
<td><a href="#GTEBindSCBArray">GTEBindSCBArray</a></td>
<td>Takes an array of SCB bytes and binds them to either the Primary or Secondary background's vertical
position</td>
</tr>
<tr>
<td><a href="#GTEGetScreenInfo">GTEGetScreenInfo</a></td>
<td>Returns a records describing the origin, width and height of the playfield on the physical graphics
screen.</td>
</tr>
<tr>
<th id="MiscRoutines" colspan="2">Misc. Functions</th>
</tr>
<tr>
<td><a href="#GTEReadControl">GTEReadControl</a></td>
<td>Reads the keyboard and returns key events in a gamepad structure</td>
</tr>
<tr>
<td><a href="#GTEGetSeconds">GTEGetSeconds</a></td>
<td>Returns the number of seconds elapsed since the toolset was started</td>
</tr>
</tbody>
</table>
<h2>Using the GTE Tool Set</h2>
<p>
This section discusses how the GTE Tool Set routines fit into the general flow of an application and gives you an
idea of which routines you'll need to use under normal circumstances. Each routine is described in detail later in
this chapter.
The GTE Tool Set depends on the presence of the tool sets shown in Table 2 and requires at least the indicated
version of each tool set be present.
</p>
<table class="intro">
<tbody>
<tr>
<th colspan="4">Table 2</th>
</tr>
<tr>
<th colspan="4" style="font-weight: normal;">GTE Tool Set — other tool sets required</th>
</tr>
<tr class="intro_header">
<th colspan="2">Tool set number</th>
<th>Tool set name</th>
<th>Minimal version needed</th>
</tr>
<tr>
<td>$01</td>
<td>#01</td>
<td>Tool Locator</td>
<td>3.x</td>
</tr>
<tr>
<td>$02</td>
<td>#02</td>
<td>Memory Manager</td>
<td>3.x</td>
</tr>
<tr>
<td>$03</td>
<td>#03</td>
<td>Miscellaneous Tool Set</td>
<td>3.2</td>
</tr>
</tbody>
</table>
<p>
To use the GTE Tool Set routines, your application must call the GTEStartUp routine before making any other GTE
calls. To save memory, the GTE Tool Set may be started up with some features disabled. See the section <a
href="#GTEStartUp">GTEStartUp</a> in this chapter for further details.
</p>
<p>
Your application should also make the GTEShutDown call when the application quits.
</p>
</div>
<div class="api">
<h4 class="tn">$01XX</h4>
<h4 id="GTEBootInit">GTEBootInit</h4>
<p>
Initializes the GTE Tool Set; called only by the Tool Locator.
</p>
<div class="warning">
<p>
An application must never make this call
</p>
</div>
<div class="section">
<h5>Parameters</h5>
<p>
The stack is not affected by this call. There are no input or output parameters.
</p>
</div>
<div class="section">
<h5>Errors</h5>
<p>None</p>
</div>
<div class="section">
<h5>C</h5>
<p>Call must not be made by an application.</p>
</div>
</div>
<div class="api">
<h4 class="tn">$02XX</h4>
<h4 id="GTEStartUp">GTEStartUp</h4>
<p>
Starts up the GTE Tool Set for use by an application.
</p>
<div class="important">
<p>
Your application must make this call before it makes any other GTE Tool Set calls.
</p>
</div>
<p>
The GTE Tool Set uses two consecutive pages of bank zero for its direct page space starting at <it>dPageAddr</it>.
If the <tt>ENGINE_MODE_DYN_TILES</tt> flag is set in the <it>capFlags</it>, the GTE will attempt to allocate an
<em>additional</em> eight pages of bank zero space. If the <tt>ENGINE_MODE_BNK0_BUFF</tt> flag is set, then GTE
will attempt to allocate an ~32KB buffer from $2000 to $9CFF in Bank 0.
</p>
<div class="section">
<h5>Parameters</h5>
<table class="stack">
<colgroup>
<col class="col-1">
<col class="col-2">
<col class="col-3">
</colgroup>
<tbody>
<tr>
<th>Stack before call</th>
</tr>
<tr>
<td class="top">previous contents</td>
</tr>
<tr>
<td class="bot">dPageAddr</td>
<td></td>
<td><em>Word</em> &mdash; 16-bit address of two pages of page-aligned Bank 0 memory</td>
</tr>
<tr>
<td class="bot">capFlags</td>
<td></td>
<td><em>Word</em> &mdash; Capability flags to set the engine mode</td>
</tr>
<tr>
<td class="bot">userID</td>
<td></td>
<td><em>Word</em> &mdash; User ID to be associated with the block. All memory allocated by GTE will use this
ID</td>
</tr>
<tr>
<td class="bot"></td>
<td><em></em></td>
<td><em>SP</em></td>
</tr>
</tbody>
</table>
<table class="stack">
<colgroup>
<col class="col-1">
<col class="col-2">
<col class="col-3">
</colgroup>
<tbody>
<tr>
<th>Stack after call</th>
</tr>
<tr>
<td class="top">previous contents</td>
</tr>
<tr>
<td class="bot"></td>
<td><em></em></td>
<td><em>SP</em></td>
</tr>
</tbody>
</table>
<table role="table">
<thead>
<tr>
<th>capFlags</th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td>ENGINE_MODE_TWO_LAYER</td>
<td>$0001</td>
<td>Enables the second background layer. This will have a moderate impact on rendering performance.</td>
</tr>
<tr>
<td>ENGINE_MODE_DYN_TILES</td>
<td>$0002</td>
<td>Enables the use of dynamic (animated) tiles. This will have a small impact on performance and requires
allocating 8 pages of Bank 0 memory</td>
</tr>
<tr>
<td>ENGINE_MODE_BNK0_BUFF</td>
<td>$0004</td>
<td>Allocates a 32KB buffer in Bank 0 for advanced graphical effects and customizations.</td>
</tr>
</tbody>
</table>
</div>
<div class="section">
<h5>Errors</h5>
<table>
<tbody>
<tr>
<td colspan="2">Memory Manager Errors</td>
<td>Returned unchanged</td>
</tr>
</tbody>
</table>
</div>
<div class="section">
<h5>C</h5>
<p><tt>extern pascal GTEStartUp(dPageAddr, capFlags, userID)</tt></p>
<p><tt>Word dPageAddr;</tt></p>
<p><tt>Word capFlags;</tt></p>
<p><tt>Word userID;</tt></p>
</div>
</div>
<div class="api">
<h4 class="tn">$03XX</h4>
<h4 id="GTEShutDown">GTEShutDown</h4>
<p>
Shuts down the GTE Toolset when an application quits.
</p>
<div class="section">
<h5>Parameters</h5>
<p>
The stack is not affected by this call. There are no input or output parameters.
</p>
</div>
<div class="section">
<h5>Errors</h5>
<p>None</p>
</div>
<div class="section">
<h5>C</h5>
<p><tt>extern pascal void GTEShutDown()</tt></p>
</div>
</div>
<div class="api">
<h4 class="tn">$04XX</h4>
<h4 id="GTEVersion">GTEVersion</h4>
<p>
Returns the version number of the GTE Tool Set.
</p>
<div class="section">
<h5>Parameters</h5>
<table class="stack">
<colgroup>
<col class="col-1">
<col class="col-2">
<col class="col-3">
</colgroup>
<tbody>
<tr>
<th>Stack before call</th>
</tr>
<tr>
<td class="top">previous contents</td>
</tr>
<tr>
<td class="bot">wordspace</td>
<td></td>
<td><em>Word</em> &mdash; Space for result</td>
</tr>
<tr>
<td class="bot"></td>
<td><em></em></td>
<td><em>SP</em></td>
</tr>
</tbody>
</table>
<table class="stack">
<colgroup>
<col class="col-1">
<col class="col-2">
<col class="col-3">
</colgroup>
<tbody>
<tr>
<th>Stack after call</th>
</tr>
<tr>
<td class="top">previous contents</td>
</tr>
<tr>
<td class="bot">versionInfo</td>
<td></td>
<td><em>Word</em> &mdash; Version number of the GTE Tool Set.</td>
</tr>
<tr>
<td class="bot"></td>
<td><em></em></td>
<td><em>SP</em></td>
</tr>
</tbody>
</table>
</div>
<div class="section">
<h5>Errors</h5>
<p>None</p>
</div>
<div class="section">
<h5>C</h5>
<p><tt>extern pascal Word GTEVersion()</tt></p>
</div>
</div>
<div class="api">
<h4 class="tn">$05XX</h4>
<h4 id="GTEReset">GTEReset</h4>
<p>
Resets the GTE Tool Set; called only when the system is reset.
</p>
<div class="warning">
<p>
An application must never make this call
</p>
</div>
<div class="section">
<h5>Parameters</h5>
<p>The stack is not affected by this call. There are no input or output parameters</p>
</div>
<div class="section">
<h5>Errors</h5>
<p>None</p>
</div>
<div class="section">
<h5>C</h5>
<p>Call must not be made by an application.</p>
</div>
</div>
<div class="api">
<h4 class="tn">$06XX</h4>
<h4 id="GTEStatus">GTEStatus</h4>
<p>
Indicates whether the GTE Tool Set is active.
</p>
<div class="section">
<h5>Parameters</h5>
<table class="stack">
<colgroup>
<col class="col-1">
<col class="col-2">
<col class="col-3">
</colgroup>
<tbody>
<tr>
<th>Stack before call</th>
</tr>
<tr>
<td class="top">previous contents</td>
</tr>
<tr>
<td class="bot">wordspace</td>
<td></td>
<td><em>Word</em> &mdash; Space for result</td>
</tr>
<tr>
<td class="bot"></td>
<td><em></em></td>
<td><em>SP</em></td>
</tr>
</tbody>
</table>
<table class="stack">
<colgroup>
<col class="col-1">
<col class="col-2">
<col class="col-3">
</colgroup>
<tbody>
<tr>
<th>Stack after call</th>
</tr>
<tr>
<td class="top">previous contents</td>
</tr>
<tr>
<td class="bot">activeFlag</td>
<td></td>
<td><em>Word</em> &mdash; <span class="sc">boolean</span>; TRUE if GTE Tool Set active, FALSE if inactive
</td>
</tr>
<tr>
<td class="bot"></td>
<td><em></em></td>
<td><em>SP</em></td>
</tr>
</tbody>
</table>
</div>
<div class="section">
<h5>Errors</h5>
<p>None</p>
</div>
<div class="section">
<h5>C</h5>
<p><tt>extern pascal Boolean GTEStatus()</tt></p>
</div>
</div>
<div class="transition">
GTE Tool Set routines
</div>
<div class="api">
<h4 class="tn">$09XX</h4>
<h4 id="GTEReadControl">GTEReadControl</h4>
<p></p>
<div class="section">
<h5>Parameters</h5>
<table class="stack">
<colgroup>
<col class="col-1">
<col class="col-2">
<col class="col-3">
</colgroup>
<tbody>
<tr>
<th>Stack before call</th>
</tr>
<tr>
<td class="top">previous contents</td>
</tr>
<tr>
<td class="bot">wordspace</td>
<td></td>
<td><em>Word</em> &mdash; Space for result</td>
</tr>
<tr>
<td class="bot"></td>
<td><em></em></td>
<td><em>SP</em></td>
</tr>
</tbody>
</table>
<table class="stack">
<colgroup>
<col class="col-1">
<col class="col-2">
<col class="col-3">
</colgroup>
<tbody>
<tr>
<th>Stack after call</th>
</tr>
<tr>
<td class="top">previous contents</td>
</tr>
<tr>
<td class="bot">userInput</td>
<td></td>
<td><em>Word</em> &mdash; packed representation of user input
</td>
</tr>
<tr>
<td class="bot"></td>
<td><em></em></td>
<td><em>SP</em></td>
</tr>
</tbody>
</table>
</div>
<div class="section">
<h5>Errors</h5>
<p>None</p>
</div>
<div class="section">
<h5>C</h5>
<p><tt>extern pascal Word GTEReadControl()</tt></p>
</div>
<div class="example">
<h5>Returned value</h5>
<p>
The value returned in <em>userInput</em> bitfield are show below.
</p>
<table class="bits bitfield">
<colgroup span="5" style="background-color: #999;"></colgroup>
<colgroup span="3" style="background-color: #fff;"></colgroup>
<colgroup span="1" style="background-color: #999;"></colgroup>
<colgroup span="10" style="background-color: #fff;"></colgroup>
<tbody>
<tr>
<td>15</td><td>14</td><td>13</td><td>12</td><td>11</td><td>10</td><td>9</td><td>8</td><td>7</td><td>6</td><td>5</td><td>4</td><td>3</td><td>2</td><td>1</td><td>0</td>
</tr>
</tbody>
</table>
<table class="bitfield-definitions">
<tbody>
<tr><td>Bits 0-6</td><td><em>keyCode</em></td><td>Keyboard code read from the Keyboard register. If no key is currently pressed, this value is zero.</td></tr>
<tr><td>Bit 7</td><td>Reserved</td><td>Always zero.</td></tr>
<tr><td>Bit 8</td><td>PAD_BUTTON_B</td><td>Set to 1 if the <tt>B</tt> button of the gamepad is pressed. Mapped to the option key by default.</td></tr>
<tr><td>Bit 9</td><td>PAD_BUTTON_A</td><td>Set to 1 if the <tt>A</tt> button of the gamepad is pressed. Mapped to the command key by default.</td></tr>
<tr><td>Bit 10</td><td>PAD_KEY_DOWN</td><td>Set to 1 on the initial press of a key. If a key is held down, the <tt>keyCode</tt> will be set and this bit will be zero.</tt></td></tr>
<tr><td>Bits 11-15</td><td>Reserved</td><td>Always zero.</td></tr>
</tbody>
</table>
</div>
</div>
<div class="api">
<h4 class="tn">$0AXX</h4>
<h4 id="GTESetScreenMode">GTESetScreenMode</h4>
<p></p>
<div class="section">
<h5>Parameters</h5>
<table class="stack">
<colgroup>
<col class="col-1">
<col class="col-2">
<col class="col-3">
</colgroup>
<tbody>
<tr>
<th>Stack before call</th>
</tr>
<tr>
<td class="top">previous contents</td>
</tr>
<tr>
<td class="bot">width</td>
<td><em></em></td>
<td><em>Word</em>&mdash;Width of the playfield in pixels. Must be even.</td>
</tr>
<tr>
<td class="bot">height</td>
<td><em></em></td>
<td><em>Word</em>&mdash;Height of the playfield in pixels.</td>
</tr>
<tr>
<td class="bot"></td>
<td><em></em></td>
<td><em>SP</em></td>
</tr>
</tbody>
</table>
<table class="stack">
<colgroup>
<col class="col-1">
<col class="col-2">
<col class="col-3">
</colgroup>
<tbody>
<tr>
<th>Stack after call</th>
</tr>
<tr>
<td class="top">previous contents</td>
</tr>
<tr>
<td class="bot"></td>
<td><em></em></td>
<td><em>SP</em></td>
</tr>
</tbody>
</table>
</div>
<div class="section">
<h5>Errors</h5>
<p>None</p>
</div>
<div class="section">
<h5>C</h5>
<p><tt>extern pascal void GTESetScreenMode(width, height)</tt></p>
<p><tt>Word width;</tt></p>
<p><tt>Word height;</tt></p>
</div>
<div class="example">
<h5>Predefined Screen Sizes</h5>
<p>
If the <em>width</em> value is set to a small number, then one of the pre-defined screen sizes will be selected. Set
the <em>width</em> to the index number of the screen sizes in the table below to set the screen size to
those dimension. The <em>height</em> value must still be passed, but is ignored.
</p>
<table>
<thead>
<tr style="white-space: nowrap;">
<th>Play Field Id</th>
<th>Width</th>
<th>Height</th>
<th></th>
<th>Size (bytes)</th>
<th>Percent of Full Screen</th>
</tr>
</thead>
<tbody>
<tr>
<td>0</td>
<td>320</td>
<td>200</td>
<td>Full Screen</td>
<td>32,000</td>
<td>100%</td>
</tr>
<tr>
<td>1</td>
<td>272</td>
<td>192</td>
<td>Sword of Sodan</td>
<td>26,112</td>
<td>81.6%</td>
</tr>
<tr>
<td>2</td>
<td>256</td>
<td>200</td>
<td>NES (approx.)</td>
<td>25,600</td>
<td>80.0%</td>
</tr>
<tr>
<td>3</td>
<td>256</td>
<td>176</td>
<td>Task Force</td>
<td>22,528</td>
<td>70.4%</td>
</tr>
<tr>
<td>4</td>
<td>280</td>
<td>160</td>
<td>Defender of the World</td>
<td>22,400</td>
<td>70.0%</td>
</tr>
<tr>
<td>5</td>
<td>256</td>
<td>160</td>
<td>Rastan</td>
<td>20,480</td>
<td>64.0%</td>
</tr>
<tr>
<td>6</td>
<td>240</td>
<td>160</td>
<td>Game Boy Advanced</td>
<td>19,200</td>
<td>60.0%</td>
</tr>
<tr>
<td>7</td>
<td>288</td>
<td>128</td>
<td>Ancient Land of Y's</td>
<td>18,432</td>
<td>57.6%</td>
</tr>
<tr>
<td>8</td>
<td>160</td>
<td>144</td>
<td>Game Boy Color</td>
<td>11,520</td>
<td>36.0%</td>
</tr>
<tr>
<td>9</td>
<td>288</td>
<td>192</td>
<td>Agony (Amiga)</td>
<td>27,648</td>
<td>86.4%</td>
</tr>
<tr>
<td>10</td>
<td>160</td>
<td>102</td>
<td>Atari Lynx</td>
<td>8,160</td>
<td>25.5%</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="api">
<h4 class="tn">$0BXX</h4>
<h4 id="GTESetTile">GTESetTile</h4>
<p></p>
<div class="section">
<h5>Parameters</h5>
<table class="stack">
<colgroup>
<col class="col-1">
<col class="col-2">
<col class="col-3">
</colgroup>
<tbody>
<tr>
<th>Stack before call</th>
</tr>
<tr>
<td class="top">previous contents</td>
</tr>
<tr>
<td class="bot">x</td>
<td><em></em></td>
<td><em>Word</em>&mdash;Horizontal index of the TileStore tile to set. Must be in the range of 0 to 40.</td>
</tr>
<tr>
<td class="bot">y</td>
<td><em></em></td>
<td><em>Word</em>&mdash;Vertical index of the TileStore tile to set. Must be in the range of 0 to 25.</td>
</tr>
<tr>
<td class="bot">tileID</td>
<td><em></em></td>
<td><em>Word</em>&mdash;Tile ID to place in the TileStore.</td>
</tr>
<tr>
<td class="bot"></td>
<td><em></em></td>
<td><em>SP</em></td>
</tr>
</tbody>
</table>
<table class="stack">
<colgroup>
<col class="col-1">
<col class="col-2">
<col class="col-3">
</colgroup>
<tbody>
<tr>
<th>Stack after call</th>
</tr>
<tr>
<td class="top">previous contents</td>
</tr>
<tr>
<td class="bot"></td>
<td><em></em></td>
<td><em>SP</em></td>
</tr>
</tbody>
</table>
</div>
<div class="section">
<h5>Errors</h5>
<p>None</p>
</div>
<div class="section">
<h5>C</h5>
<p><tt>extern pascal void GTESetTile(x, y, tileID)</tt></p>
<p><tt>Word x;</tt></p>
<p><tt>Word y;</tt></p>
<p><tt>Word tileID;</tt></p>
</div>
<div class="example">
<h5>Tile Identifiers</h5>
<p>
The tile ID word is defined as follows
</p>
<table class="bits bitfield">
<colgroup span="1" style="background-color: #999;"></colgroup>
<colgroup span="6" style="background-color: lightblue;"></colgroup>
<colgroup span="9" style="background-color: white;"></colgroup>
<tbody>
<tr>
<td>15</td><td>14</td><td>13</td><td>12</td><td>11</td><td>10</td><td>9</td><td>8</td><td>7</td><td>6</td><td>5</td><td>4</td><td>3</td><td>2</td><td>1</td><td>0</td>
</tr>
</tbody>
</table>
<table class="bitfield-definitions">
<tbody>
<tr><td>Bits 0-8</td><td>tileIndex</td><td>The index of the tile in the current Tile Set. A Tile Set can be defined by calling the <tt>GTELoadTileSet</tt> function</td></tr>
<tr><td>Bit 9</td><td>fTileHFlip</td><td>Flips the tile horizontally when set.</td></tr>
<tr><td>Bit 10</td><td>fTileVFlip</td><td>Flips the tile vertically when set.</td></tr>
<tr><td>Bit 11</td><td>fTileDynamic</td><td>Identifies this tile as a dynamic tile. The <tt>tileIndex</tt> is used to identify the dynamic tile data slow and must be in the range 0 to 31.</td></tr>
<tr><td>Bit 12</td><td>fTileSolid</td><td>Hint bit that marks a tile as having no mask. Can improve performance when ENGINE_MODE_TWO_LAYER is set.</td></tr>
<tr><td>Bit 13</td><td>fTileFringe</td><td>Unused. Must be zero.</td></tr>
<tr><td>Bit 14</td><td>fTilePriority</td><td>Sets the tile to high priority. Sprites will render under this tile, if supported.</td></tr>
<tr><td>Bit 15</td><td>Reserved</td><td>Must be zero.</td></tr>
</tbody>
</table>
</div>
</div>
<div class="api">
<h4 class="tn">$0CXX</h4>
<h4 id="GTESetBG0Origin">GTESetBG0Origin</h4>
<p>
Sets the coordinate of the upper-left corner of the playfield within the primary background buffer. The coordiate values
are <em>unsigned</em>, so transitioning from 0 to -1 will result in a discontinuous jump in the background position.
</p>
<div class="section">
<h5>Parameters</h5>
<table class="stack">
<colgroup>
<col class="col-1">
<col class="col-2">
<col class="col-3">
</colgroup>
<tbody>
<tr>
<th>Stack before call</th>
</tr>
<tr>
<td class="top">previous contents</td>
</tr>
<tr>
<td class="bot">xpos</td>
<td></td>
<td><em>Word</em>&mdash;Unsigned horizontal position</td>
</tr>
<tr>
<td class="bot">ypos</td>
<td></td>
<td><em>Word</em>&mdash;Unsigned vertical position</td>
</tr>
<tr>
<td class="bot"></td>
<td><em></em></td>
<td><em>SP</em></td>
</tr>
</tbody>
</table>
<table class="stack">
<colgroup>
<col class="col-1">
<col class="col-2">
<col class="col-3">
</colgroup>
<tbody>
<tr>
<th>Stack after call</th>
</tr>
<tr>
<td class="top">previous contents</td>
</tr>
<tr>
<td class="bot"></td>
<td><em></em></td>
<td><em>SP</em></td>
</tr>
</tbody>
</table>
</div>
<div class="section">
<h5>Errors</h5>
<p>None</p>
</div>
<div class="section">
<h5>C</h5>
<p><tt>extern pascal void GTESetBG0Origin(x, y)</tt></p>
<p><tt>Word x;</tt></p>
<p><tt>Word y;</tt></p>
</div>
</div>
<div class="api">
<h4 class="tn">$0DXX</h4>
<h4 id="GTERender">GTERender</h4>
<p>Renders the current playfield to the graphics screen.</p>
<div class="section">
<h5>Parameters</h5>
<table class="stack">
<colgroup>
<col class="col-1">
<col class="col-2">
<col class="col-3">
</colgroup>
<tbody>
<tr>
<th>Stack before call</th>
</tr>
<tr>
<td class="top">previous contents</td>
</tr>
<tr>
<td class="bot">flags</td>
<td></td>
<td><em>Word</em>&mdash;Render control flags</td>
</tr>
<tr>
<td class="bot"></td>
<td><em></em></td>
<td><em>SP</em></td>
</tr>
</tbody>
</table>
<table class="stack">
<colgroup>
<col class="col-1">
<col class="col-2">
<col class="col-3">
</colgroup>
<tbody>
<tr>
<th>Stack after call</th>
</tr>
<tr>
<td class="top">previous contents</td>
</tr>
<tr>
<td class="bot"></td>
<td><em></em></td>
<td><em>SP</em></td>
</tr>
</tbody>
</table>
</div>
<table role="table">
<thead>
<tr>
<th>flags</th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td>RENDER_ALT_BG1</td>
<td>$0001</td>
<td>Set the data bank register to the alternate secondary background.</td>
</tr>
<tr>
<td>RENDER_BG1_HORZ_OFFSET</td>
<td>$0002</td>
<td>Offsets each scanline of the secondary background's horizontal position.</td>
</tr>
<tr>
<td>RENDER_BG1_VERT_OFFSET</td>
<td>$0004</td>
<td>Offsets each column of the secondary background's vertical position. Unimplemented.</td>
</tr>
<tr>
<td>RENDER_BG1_ROTATIONT</td>
<td>$0004</td>
<td>Use the internal rotation tables to render the secondary background</td>
</tr>
</tbody>
</table>
<div class="section">
<h5>Errors</h5>
<p>None</p>
</div>
<div class="section">
<h5>C</h5>
<p><tt>extern pascal void GTERender(flags)</tt></p>
<p><tt>Word flags;</tt></p>
</div>
</div>
<div class="api">
<h4 class="tn">$0EXX</h4>
<h4 id="GTELoadTileSet">GTELoadTileSet</h4>
<p>
Loads a tileset into the internal GTE memory buffer. The <span class="sc">pointer</span> must point to
tiles that are already in GTE tile format.
</p>
<p>
A tile set is an array of (up to) 512 tile definitions and each tile definition is 128 bytes. The tile definition
is comprised of four, 32-byte tiles; a normal tile, its mask, a horizontally flipped versio of the tile and its mask.
The first 128 bytes of a tileset must be set to zero.
</p>
<div class="section">
<h5>Parameters</h5>
<table class="stack">
<colgroup>
<col class="col-1">
<col class="col-2">
<col class="col-3">
</colgroup>
<tbody>
<tr>
<th>Stack before call</th>
</tr>
<tr>
<td class="top">previous contents</td>
</tr>
<tr>
<td class="bot">tileSetPtr</td>
<td></td>
<td><em>Long</em>&mdash;<span class="sc">pointer</span> to the tile set data.</td>
</tr>
<tr>
<td class="bot"></td>
<td><em></em></td>
<td><em>SP</em></td>
</tr>
</tbody>
</table>
<table class="stack">
<colgroup>
<col class="col-1">
<col class="col-2">
<col class="col-3">
</colgroup>
<tbody>
<tr>
<th>Stack after call</th>
</tr>
<tr>
<td class="top">previous contents</td>
</tr>
<tr>
<td class="bot"></td>
<td><em></em></td>
<td><em>SP</em></td>
</tr>
</tbody>
</table>
</div>
<div class="section">
<h5>Errors</h5>
<p>None</p>
</div>
<div class="section">
<h5>C</h5>
<p><tt>extern pascal void GTELoadTileSet(tileSetPtr)</tt></p>
<p><tt>Pointer tileSetPtr;</tt></p>
</div>
</div>
<div class="api">
<h4 class="tn">$0FXX</h4>
<h4 id="GTECreateSpriteStamp">GTECreateSpriteStamp</h4>
<p>
Creates a sprite stamp (cache sprite pixel data copy) from a sprite identifier and the current
tile set. The <em>vBuffAddr</em> points to a location in the internal virtual buffer area. In
most cases, an address for a sprite can be calculated from the <tt>VBUFF_SPRITE_START</tt> and
<tt>VBUFF_SPRITE_STEP</tt> constants as <tt>ADDR(n) = VBUFF_SPRITE_START + n*VBUFF_SPRITE_STEP</tt>.
</p>
<div class="section">
<h5>Parameters</h5>
<table class="stack">
<colgroup>
<col class="col-1">
<col class="col-2">
<col class="col-3">
</colgroup>
<tbody>
<tr>
<th>Stack before call</th>
</tr>
<tr>
<td class="top">previous contents</td>
</tr>
<tr>
<td class="bot">spriteIdent</td>
<td></td>
<td><em>Word</em>&mdash;sprite identifier word</td>
</tr>
<tr>
<td class="bot">vBuffAddr</td>
<td></td>
<td><em>Word</em>&mdash;Location in the sprite vitual buffer to allocate the stamp.</td>
</tr>
<tr>
<td class="bot"></td>
<td><em></em></td>
<td><em>SP</em></td>
</tr>
</tbody>
</table>
<table class="stack">
<colgroup>
<col class="col-1">
<col class="col-2">
<col class="col-3">
</colgroup>
<tbody>
<tr>
<th>Stack after call</th>
</tr>
<tr>
<td class="top">previous contents</td>
</tr>
<tr>
<td class="bot"></td>
<td><em></em></td>
<td><em>SP</em></td>
</tr>
</tbody>
</table>
</div>
<div class="section">
<h5>Errors</h5>
<p>None</p>
</div>
<div class="section">
<h5>C</h5>
<p><tt>extern pascal void GTECreateSpriteStamp(spriteIdent, vBuffAddr)</tt></p>
<p><tt>Word spriteIdent;</tt></p>
<p><tt>Word vBuffAddr;</tt></p>
</div>
<div class="example">
<h5>Sprite Identifier</h5>
<p>
The sprite identifier is a subset of the full sprite descriptor. Only the starting Tile Index and
the size bits are used.
</p>
<p>
When a sprite has a size greater than 8x8, the horizontal tiles are taken from the next tile index
and the vertical tiles are taken from <tt>tileID + 32</tt>. This is why tile sheets should be saved
with a width of 256 pixels.
</p>
<table class="bits bitfield">
<colgroup span="3" style="background-color: #999;"></colgroup>
<colgroup span="2" style="background-color: lightblue;"></colgroup>
<colgroup span="2" style="background-color: #999;"></colgroup>
<colgroup span="9" style="background-color: white;"></colgroup>
<tbody>
<tr>
<td>15</td><td>14</td><td>13</td><td>12</td><td>11</td><td>10</td><td>9</td><td>8</td><td>7</td><td>6</td><td>5</td><td>4</td><td>3</td><td>2</td><td>1</td><td>0</td>
</tr>
</tbody>
</table>
<table class="bitfield-definitions">
<tbody>
<tr><td>Bits 0-8</td><td>tileIndex</td><td>The index of a tile in the current Tile Set that defines the top-left part of the sprite</td></tr>
<tr><td>Bit 9-10</td><td>Reserved</td><td>Must be zero.</td></tr>
<tr><td>Bits 11-12</td><td>fSpriteSize</td><td>Sets the size of the sprite<ul><li>00 - 8x8</li><li>01 - 8x16</li><li>10 - 16x8</li><li>11 - 16x16</li></ul></td></tr>
<tr><td>Bit 13-15</td><td>Reserved</td><td>Must be zero.</td></tr>
</tbody>
</table>
</div>
</div>
<div class="api">
<h4 class="tn">$10XX</h4>
<h4 id="GTEAddSprite">GTEAddSprite</h4>
<p>
Adds a new sprite to the current scene. If a sprite is already assigned to the sprite slot, then
that sprite is removed and replaced with the new sprite.
</p>
<p>
A sprite can have negative coordinates and be placed off-screen. A sprite's coordinates are local
coordinates on the playfield; a sprite will not move automatically when <tt>GTESetBG0Origin</tt> is changed.
</p>
<div class="section">
<h5>Parameters</h5>
<table class="stack">
<colgroup>
<col class="col-1">
<col class="col-2">
<col class="col-3">
</colgroup>
<tbody>
<tr>
<th>Stack before call</th>
</tr>
<tr>
<td class="top">previous contents</td>
</tr>
<tr>
<td class="bot">spriteDescriptor</td>
<td></td>
<td><em>Word</em>&mdash;Sprite descriptor word that is used to set the status bits.</td>
</tr>
<tr>
<td class="bot">x</td>
<td></td>
<td><em>Word</em>&mdash;Signed horizontal sprite position on the playfield.</td>
</tr>
<tr>
<td class="bot">y</td>
<td></td>
<td><em>Word</em>&mdash;Signed vertical sprite position on the playfield.</td>
</tr>
<tr>
<td class="bot">spriteSlot</td>
<td></td>
<td><em>Word</em>&mdash;The slot to assign the sprite to. There are 16 slots and sprites in lower slots are drawn above the sprites in higher slots.</td>
</tr>
<tr>
<td class="bot"></td>
<td><em></em></td>
<td><em>SP</em></td>
</tr>
</tbody>
</table>
<table class="stack">
<colgroup>
<col class="col-1">
<col class="col-2">
<col class="col-3">
</colgroup>
<tbody>
<tr>
<th>Stack after call</th>
</tr>
<tr>
<td class="top">previous contents</td>
</tr>
<tr>
<td class="bot"></td>
<td><em></em></td>
<td><em>SP</em></td>
</tr>
</tbody>
</table>
</div>
<div class="section">
<h5>Errors</h5>
<p>None</p>
</div>
<div class="section">
<h5>C</h5>
<p><tt>extern pascal void GTEAddSprite(spriteDescriptor, x, y, spriteSlot)</tt></p>
<p><tt>Word spriteDescriptor;</tt></p>
<p><tt>Word x;</tt></p>
<p><tt>Word y;</tt></p>
<p><tt>Word spriteSlot;</tt></p>
</div>
<div class="example">
<h5>Sprite Descriptor</h5>
<p>
The sprite descriptor defines the rendering properties of a sprite.
</p>
<p>
When a sprite has a size greater than 8x8, the horizontal tiles are taken from the next tile index
and the vertical tiles are taken from <tt>tileID + 32</tt>. This is why tile sheets should be saved
with a width of 256 pixels.
</p>
<table class="bits bitfield">
<colgroup span="2" style="background-color: #999;"></colgroup>
<colgroup span="4" style="background-color: lightblue;"></colgroup>
<colgroup span="9" style="background-color: white;"></colgroup>
<tbody>
<tr>
<td>15</td><td>14</td><td>13</td><td>12</td><td>11</td><td>10</td><td>9</td><td>8</td><td>7</td><td>6</td><td>5</td><td>4</td><td>3</td><td>2</td><td>1</td><td>0</td>
</tr>
</tbody>
</table>
<table class="bitfield-definitions">
<tbody>
<tr><td>Bits 0-8</td><td>tileIndex</td><td>The index of a tile in the current Tile Set that defines the top-left part of the sprite</td></tr>
<tr><td>Bit 9</td><td>SPRITE_HFLIP</td><td>Flips the sprite horizontally.</td></tr>
<tr><td>Bit 10</td><td>SPRITE_VFLIP</td><td>Flips the sprite vertically.</td></tr>
<tr><td>Bits 11-12</td><td>SPRITE_SIZE</td><td>Sets the size of the sprite<ul><li>00 - 8x8</li><li>01 - 8x16</li><li>10 - 16x8</li><li>11 - 16x16</li></ul></td></tr>
<tr><td>Bit 13</td><td>SPRITE_HIDE</td><td>When set, does not render the sprite.</td></tr>
<tr><td>Bit 14-15</td><td>Reserved</td><td>Must be zero.</td></tr>
</tbody>
</table>
</div>
</div>
<div class="api">
<h4 class="tn">$11XX</h4>
<h4 id="GTEMoveSprite">GTEMoveSprite</h4>
<p>Repositions a sprite on the play field.</p>
<div class="section">
<h5>Parameters</h5>
<table class="stack">
<colgroup>
<col class="col-1">
<col class="col-2">
<col class="col-3">
</colgroup>
<tbody>
<tr>
<th>Stack before call</th>
</tr>
<tr>
<td class="top">previous contents</td>
</tr>
<tr>
<td class="bot">spriteSlot</td>
<td></td>
<td><em>Word</em>&mdash;Slot where the target sprite is located.</td>
</tr>
<tr>
<td class="bot">x</td>
<td></td>
<td><em>Word</em>&mdash;New horizontal position.</td>
</tr>
<tr>
<td class="bot">y</td>
<td></td>
<td><em>Word</em>&mdash;New vertical position</td>
</tr>
<tr>
<td class="bot"></td>
<td><em></em></td>
<td><em>SP</em></td>
</tr>
</tbody>
</table>
<table class="stack">
<colgroup>
<col class="col-1">
<col class="col-2">
<col class="col-3">
</colgroup>
<tbody>
<tr>
<th>Stack after call</th>
</tr>
<tr>
<td class="top">previous contents</td>
</tr>
<tr>
<td class="bot"></td>
<td><em></em></td>
<td><em>SP</em></td>
</tr>
</tbody>
</table>
</div>
<div class="section">
<h5>Errors</h5>
<p>None</p>
</div>
<div class="section">
<h5>C</h5>
<p><tt>extern pascal void GTEMoveSprite(spriteSlot, x, y)</tt></p>
<p><tt>Word spriteSlot;</tt></p>
<p><tt>Word x;</tt></p>
<p><tt>Word y;</tt></p>
</div>
</div>
<div class="api">
<h4 class="tn">$12XX</h4>
<h4 id="GTEUpdateSprite">GTEUpdateSprite</h4>
<p>
Changes the stamp or the status flags of a sprite. The size of the sprite cannot be changed.
Typically, an application will call <tt>GTEUpdateSprite</tt> immediately after <tt>GTEAddSprite</tt> to
set all of th desired sprite properties.
</p>
<div class="section">
<h5>Parameters</h5>
<table class="stack">
<colgroup>
<col class="col-1">
<col class="col-2">
<col class="col-3">
</colgroup>
<tbody>
<tr>
<th>Stack before call</th>
</tr>
<tr>
<td class="top">previous contents</td>
</tr>
<tr>
<td class="bot">spriteSlot</td>
<td></td>
<td><em>Word</em>&mdash;Sprite slot of the target sprite to update.</td>
</tr>
<tr>
<td class="bot">spriteFlags</td>
<td></td>
<td><em>Word</em>&mdash;A new set of sprite flags.</td>
</tr>
<tr>
<td class="bot">vBuffAddr</td>
<td></td>
<td><em>Word</em>&mdash;Sprite stamp virtual buffer address.</td>
</tr>
<tr>
<td class="bot"></td>
<td><em></em></td>
<td><em>SP</em></td>
</tr>
</tbody>
</table>
<table class="stack">
<colgroup>
<col class="col-1">
<col class="col-2">
<col class="col-3">
</colgroup>
<tbody>
<tr>
<th>Stack after call</th>
</tr>
<tr>
<td class="top">previous contents</td>
</tr>
<tr>
<td class="bot"></td>
<td><em></em></td>
<td><em>SP</em></td>
</tr>
</tbody>
</table>
</div>
<div class="section">
<h5>Errors</h5>
<p>None</p>
</div>
<div class="section">
<h5>C</h5>
<p><tt>extern pascal void GTEUpdateSprite(spriteSlot, spriteFlags, vBuffAddr)</tt></p>
<p><tt>Word spriteSlot;</tt></p>
<p><tt>Word spriteFlags;</tt></p>
<p><tt>Word vBuffAddr;</tt></p>
</div>
</div>
<div class="api">
<h4 class="tn">$13XX</h4>
<h4 id="GTERemoveSprite">GTERemoveSprite</h4>
<p>Removes a sprite from the play field.</p>
<div class="section">
<h5>Parameters</h5>
<table class="stack">
<colgroup>
<col class="col-1">
<col class="col-2">
<col class="col-3">
</colgroup>
<tbody>
<tr>
<th>Stack before call</th>
</tr>
<tr>
<td class="top">previous contents</td>
</tr>
<tr>
<td class="bot">spriteSlot</td>
<td></td>
<td><em>Word</em>&mdash;Sprite slot of the target sprite to update.</td>
</tr>
<tr>
<td class="bot"></td>
<td><em></em></td>
<td><em>SP</em></td>
</tr>
</tbody>
</table>
<table class="stack">
<colgroup>
<col class="col-1">
<col class="col-2">
<col class="col-3">
</colgroup>
<tbody>
<tr>
<th>Stack after call</th>
</tr>
<tr>
<td class="top">previous contents</td>
</tr>
<tr>
<td class="bot"></td>
<td><em></em></td>
<td><em>SP</em></td>
</tr>
</tbody>
</table>
</div>
<div class="section">
<h5>Errors</h5>
<p>None</p>
</div>
<div class="section">
<h5>C</h5>
<p><tt>extern pascal void GTERemoveSprite(spriteSlot)</tt></p>
<p><tt>Word spriteSlot;</tt></p>
</div>
</div>
<div class="api">
<h4 class="tn">$14XX</h4>
<h4 id="GTEGetSeconds">GTEGetSeconds</h4>
<p>Returns the number of seconds that have elapsed since the engine was started. This is a 16-bit value and will wrap around after 65536 seconds (~18 hours)</p>
<div class="section">
<h5>Parameters</h5>
<table class="stack">
<colgroup>
<col class="col-1">
<col class="col-2">
<col class="col-3">
</colgroup>
<tbody>
<tr>
<th>Stack before call</th>
</tr>
<tr>
<td class="top">previous contents</td>
</tr>
<tr>
<td class="bot">wordspace</td>
<td></td>
<td><em>Word</em>&mdash;Space for result.</td>
</tr>
<tr>
<td class="bot"></td>
<td><em></em></td>
<td><em>SP</em></td>
</tr>
</tbody>
</table>
<table class="stack">
<colgroup>
<col class="col-1">
<col class="col-2">
<col class="col-3">
</colgroup>
<tbody>
<tr>
<th>Stack after call</th>
</tr>
<tr>
<td class="top">previous contents</td>
</tr>
<tr>
<td class="bot">numSeconds</td>
<td></td>
<td><em>Word</em>&mdash;Number of elapsed seconds.</td>
</tr>
<tr>
<td class="bot"></td>
<td><em></em></td>
<td><em>SP</em></td>
</tr>
</tbody>
</table>
</div>
<div class="section">
<h5>Errors</h5>
<p>None</p>
</div>
<div class="section">
<h5>C</h5>
<p><tt>extern pascal Word GTEGetSeconds()</tt></p>
</div>
</div>
<div class="api">
<h4 class="tn">$15XX</h4>
<h4 id="GTECopyTileToDynamic">GTECopyTileToDynamic</h4>
<p>
Copies a tile by ID into one of the dynamic tile slots. If a dynamic tile associated with the
slot is visible, it will show the new data after the next call to <tt>GETRender</tt>.
</p>
<p>
The <tt>ENGINE_MODE_DYN_TILES</tt> flag must be set, otherwise this function does nothing.
</p>
<div class="section">
<h5>Parameters</h5>
<table class="stack">
<colgroup>
<col class="col-1">
<col class="col-2">
<col class="col-3">
</colgroup>
<tbody>
<tr>
<th>Stack before call</th>
</tr>
<tr>
<td class="top">previous contents</td>
</tr>
<tr>
<td class="bot">tileID</td>
<td></td>
<td><em>Word</em>&mdash;ID of the tile (0 to 511)</td>
</tr>
<tr>
<td class="bot">dynID</td>
<td></td>
<td><em>Word</em>&mdash;ID of the dynamic tile slot (0 to 31)</td>
</tr>
<tr>
<td class="bot"></td>
<td><em></em></td>
<td><em>SP</em></td>
</tr>
</tbody>
</table>
<table class="stack">
<colgroup>
<col class="col-1">
<col class="col-2">
<col class="col-3">
</colgroup>
<tbody>
<tr>
<th>Stack after call</th>
</tr>
<tr>
<td class="top">previous contents</td>
</tr>
<tr>
<td class="bot"></td>
<td><em></em></td>
<td><em>SP</em></td>
</tr>
</tbody>
</table>
</div>
<div class="section">
<h5>Errors</h5>
<p>None</p>
</div>
<div class="section">
<h5>C</h5>
<p><tt>extern pascal void GTECopyTileToDynamic(tileID, dynID)</tt></p>
<p><tt>Word tileID;</tt></p>
<p><tt>Word dynID;</tt></p>
</div>
</div>
<div class="api">
<h4 class="tn">$16XX</h4>
<h4 id="GTESetPalette">GTESetPalette</h4>
<p>
Sets one of the 16 palettes to the RGB values in the passed array. This is a convenience function that
immediately updated the visible palette. The palette change is <em>not</em> deferred.
</p>
<div class="section">
<h5>Parameters</h5>
<table class="stack">
<colgroup>
<col class="col-1">
<col class="col-2">
<col class="col-3">
</colgroup>
<tbody>
<tr>
<th>Stack before call</th>
</tr>
<tr>
<td class="top">previous contents</td>
</tr>
<tr>
<td class="bot">palNum</td>
<td></td>
<td><em>Word</em>&mdash;Palette number to changes (0 - 15)</td>
</tr>
<tr>
<td class="bot">palettePtr</td>
<td></td>
<td><em>Long</em>&mdash;<span class="sc">pointer</span> to the 32 bytes of RGB values.</td>
</tr>
<tr>
<td class="bot"></td>
<td><em></em></td>
<td><em>SP</em></td>
</tr>
</tbody>
</table>
<table class="stack">
<colgroup>
<col class="col-1">
<col class="col-2">
<col class="col-3">
</colgroup>
<tbody>
<tr>
<th>Stack after call</th>
</tr>
<tr>
<td class="top">previous contents</td>
</tr>
<tr>
<td class="bot"></td>
<td><em></em></td>
<td><em>SP</em></td>
</tr>
</tbody>
</table>
</div>
<div class="section">
<h5>Errors</h5>
<p>None</p>
</div>
<div class="section">
<h5>C</h5>
<p><tt>extern pascal void GTESetPalette(palNum, palettePtr)</tt></p>
<p><tt>Word palNum;</tt></p>
<p><tt>Pointer palettePtr;</tt></p>
</div>
</div>
<div class="api">
<h4 class="tn">$17XX</h4>
<h4 id="GTECopyPicToBG1">GTECopyPicToBG1</h4>
<p>
Copies an uncompressed SHR image into the secondard background pixel buffer. This is an easy way to load a
background image into the secondary layer. SCB values and palettes are <em>not</em> copied.
</p>
<div class="section">
<h5>Parameters</h5>
<table class="stack">
<colgroup>
<col class="col-1">
<col class="col-2">
<col class="col-3">
</colgroup>
<tbody>
<tr>
<th>Stack before call</th>
</tr>
<tr>
<td class="top">previous contents</td>
</tr>
<tr>
<td class="bot">width</td>
<td></td>
<td><em>Word</em>&mdash;Width of the source image data to be copied in bytes. Maximum value of 256.</td>
</tr>
<tr>
<td class="bot">height</td>
<td></td>
<td><em>Word</em>&mdash;Height of the source image data to be copied in rows. Maximum value of 208.</td>
</tr>
<tr>
<td class="bot">stride</td>
<td></td>
<td><em>Word</em>&mdash;Number of bytes in each row</td>
</tr>
<tr>
<td class="bot">picPtr</td>
<td></td>
<td><em>Long</em>&mdash;<span class="sc">pointer</span> to the uncompressed SHR data</td>
</tr>
<tr>
<td class="bot"></td>
<td><em></em></td>
<td><em>SP</em></td>
</tr>
</tbody>
</table>
<table class="stack">
<colgroup>
<col class="col-1">
<col class="col-2">
<col class="col-3">
</colgroup>
<tbody>
<tr>
<th>Stack after call</th>
</tr>
<tr>
<td class="top">previous contents</td>
</tr>
<tr>
<td class="bot"></td>
<td><em></em></td>
<td><em>SP</em></td>
</tr>
</tbody>
</table>
</div>
<div class="section">
<h5>Errors</h5>
<p>None</p>
</div>
<div class="section">
<h5>C</h5>
<p><tt>extern pascal void GTECopyPicToBG1(width, height, stride, picPtr)</tt></p>
<p><tt>Word width;</tt></p>
<p><tt>Word height;</tt></p>
<p><tt>Word stride;</tt></p>
<p><tt>Pointer picPtr;</tt></p>
</div>
</div>
<div class="api">
<h4 class="tn">$18XX</h4>
<h4 id="GTEBindSCBArray">GTEBindSCBArray</h4>
<p>
Binds an array of SCB values to either the primary or secondard background layer. This will automatically
update the SHR screen SCB values as the vertical offset of the designated background layer changes.
</p>
<p>
The SCB updates are not synchronized with the VBL, so care should be taken to select palette values that
minimize flicker when adjacent lines have different palette assignements and the page is scrolling
quickly.
</p>
<div class="section">
<h5>Parameters</h5>
<table class="stack">
<colgroup>
<col class="col-1">
<col class="col-2">
<col class="col-3">
</colgroup>
<tbody>
<tr>
<th>Stack before call</th>
</tr>
<tr>
<td class="top">previous contents</td>
</tr>
<tr>
<td class="bot">scbPtr</td>
<td></td>
<td><em>Long</em>&mdash;<span class="sc">pointer</span> to an array of SCB values. The size of the array is defined by the largest verical offset that the application expects to use.</td>
</tr>
<tr>
<td class="bot"></td>
<td><em></em></td>
<td><em>SP</em></td>
</tr>
</tbody>
</table>
<table class="stack">
<colgroup>
<col class="col-1">
<col class="col-2">
<col class="col-3">
</colgroup>
<tbody>
<tr>
<th>Stack after call</th>
</tr>
<tr>
<td class="top">previous contents</td>
</tr>
<tr>
<td class="bot"></td>
<td><em></em></td>
<td><em>SP</em></td>
</tr>
</tbody>
</table>
</div>
<div class="section">
<h5>Errors</h5>
<p>None</p>
</div>
<div class="section">
<h5>C</h5>
<p><tt>extern pascal void GTEBindSCBArray(scbPtr)</tt></p>
<p><tt>Pointer scbPtr;</tt></p>
</div>
</div>
<div class="api">
<h4 class="tn">$19XX</h4>
<h4 id="GTEGetBG0TileMapInfo">GTEGetBG0TileMapInfo</h4>
<p>
Returns information about the current BG0 tile map.
</p>
<div class="section">
<h5>Parameters</h5>
<table class="stack">
<colgroup>
<col class="col-1">
<col class="col-2">
<col class="col-3">
</colgroup>
<tbody>
<tr>
<th>Stack before call</th>
</tr>
<tr>
<td class="top">previous contents</td>
</tr>
<tr rowspan="2">
<td class="bot">longspace</td>
<td></td>
<td><em>Long</em>&mdash;Space for result</td>
</tr>
<tr>
<td class="bot">wordspace</td>
<td></td>
<td><em>Word</em>&mdash;Space for result</td>
</tr>
<tr>
<td class="bot">wordspace</td>
<td></td>
<td><em>Word</em>&mdash;Space for result</td>
</tr>
<tr>
<td class="bot"></td>
<td><em></em></td>
<td><em>SP</em></td>
</tr>
</tbody>
</table>
<table class="stack">
<colgroup>
<col class="col-1">
<col class="col-2">
<col class="col-3">
</colgroup>
<tbody>
<tr>
<th>Stack after call</th>
</tr>
<tr>
<td class="top">previous contents</td>
</tr>
<tr>
<td class="bot">tileMapPtr</td>
<td></td>
<td><em>Long</em>&mdash;<span class="sc">pointer</span> to the tile map.</td>
</tr>
<tr>
<td class="bot">height</td>
<td></td>
<td><em>Word</em>&mdash;Height of the tilemap in tiles.</td>
</tr>
<tr>
<td class="bot">width</td>
<td></td>
<td><em>Word</em>&mdash;Width of the tilemap in tiles.</td>
</tr>
<tr>
<td class="bot"></td>
<td><em></em></td>
<td><em>SP</em></td>
</tr>
</tbody>
</table>
</div>
<div class="section">
<h5>Errors</h5>
<p>None</p>
</div>
<div class="section">
<h5>C</h5>
<p><tt>extern pascal struct TileMapInfo GTEGetBG0TileMapInfo()</tt></p>
</div>
</div>
<div class="api">
<h4 class="tn">$1AXX</h4>
<h4 id="GTEGetScreenInfo">GTEGetScreenInfo</h4>
<p>
Returns information about the current position and size of the play field.
</p>
<div class="section">
<h5>Parameters</h5>
<table class="stack">
<colgroup>
<col class="col-1">
<col class="col-2">
<col class="col-3">
</colgroup>
<tbody>
<tr>
<th>Stack before call</th>
</tr>
<tr>
<td class="top">previous contents</td>
</tr>
<tr>
<td class="bot">wordspace</td>
<td></td>
<td><em>Word</em>&mdash;Space for result</td>
</tr>
<tr>
<td class="bot">wordspace</td>
<td></td>
<td><em>Word</em>&mdash;Space for result</td>
</tr>
<tr>
<td class="bot">wordspace</td>
<td></td>
<td><em>Word</em>&mdash;Space for result</td>
</tr>
<tr>
<td class="bot">wordspace</td>
<td></td>
<td><em>Word</em>&mdash;Space for result</td>
</tr>
<tr>
<td class="bot"></td>
<td><em></em></td>
<td><em>SP</em></td>
</tr>
</tbody>
</table>
<table class="stack">
<colgroup>
<col class="col-1">
<col class="col-2">
<col class="col-3">
</colgroup>
<tbody>
<tr>
<th>Stack after call</th>
</tr>
<tr>
<td class="top">previous contents</td>
</tr>
<tr>
<td class="bot">height</td>
<td></td>
<td><em>Word</em>&mdash;Height of the playfield in lines.</td>
</tr>
<tr>
<td class="bot">width</td>
<td></td>
<td><em>Word</em>&mdash;Width of the playfield in bytes.</td>
</tr>
<tr>
<td class="bot">y</td>
<td></td>
<td><em>Word</em>&mdash;Vertical coordinate of the upper-left corner.</td>
</tr>
<tr>
<td class="bot">x</td>
<td></td>
<td><em>Word</em>&mdash;Horizontal coordinate of the upper-left corner.</td>
</tr>
<tr>
<td class="bot"></td>
<td><em></em></td>
<td><em>SP</em></td>
</tr>
</tbody>
</table>
</div>
<div class="section">
<h5>Errors</h5>
<p>None</p>
</div>
<div class="section">
<h5>C</h5>
<p><tt>extern pascal struct ScreenInfo GTEGetScreenInfo()</tt></p>
</div>
</div>
<div class="api">
<h4 class="tn">$1BXX</h4>
<h4 id="GTESetBG1Origin">GTESetBG1Origin</h4>
<p>
Sets the coordinate of the upper-left corner of the playfield within the secondary background buffer. The coordiate values
are <em>unsigned</em>, so transitioning from 0 to -1 will result in a discontinuous jump in the background position.
</p>
<div class="section">
<h5>Parameters</h5>
<table class="stack">
<colgroup>
<col class="col-1">
<col class="col-2">
<col class="col-3">
</colgroup>
<tbody>
<tr>
<th>Stack before call</th>
</tr>
<tr>
<td class="top">previous contents</td>
</tr>
<tr>
<td class="bot"></td>
xpos
<td></td>
<td><em>Word</em>&mdash;Unsigned horizontal position</td>
</tr>
<tr>
<td class="bot"></td>
ypos
<td></td>
<td><em>Word</em>&mdash;Unsigned vertical position</td>
</tr>
<tr>
<td class="bot"></td>
<td><em></em></td>
<td><em>SP</em></td>
</tr>
</tbody>
</table>
<table class="stack">
<colgroup>
<col class="col-1">
<col class="col-2">
<col class="col-3">
</colgroup>
<tbody>
<tr>
<th>Stack after call</th>
</tr>
<tr>
<td class="top">previous contents</td>
</tr>
<tr>
<td class="bot"></td>
<td><em></em></td>
<td><em>SP</em></td>
</tr>
</tbody>
</table>
</div>
<div class="section">
<h5>Errors</h5>
<p>None</p>
</div>
<div class="section">
<h5>C</h5>
<p><tt>extern pascal void GTESetBG1Origin(x, y)</tt></p>
<p><tt>Word x;</tt></p>
<p><tt>Word y;</tt></p>
</div>
</div>
<div class="api">
<h4 class="tn">$1CXX</h4>
<h4 id="GTEGetTileAt">GTEGetTileAt</h4>
<p>
Returns the tile at a local coordinate poiint. The primary use of this function is to lookup
a Tile ID using a sprite's coordinates.
</p>
<div class="section">
<h5>Parameters</h5>
<table class="stack">
<colgroup>
<col class="col-1">
<col class="col-2">
<col class="col-3">
</colgroup>
<tbody>
<tr>
<th>Stack before call</th>
</tr>
<tr>
<td class="top">previous contents</td>
</tr>
<tr>
<td class="bot">wordspace</td>
<td></td>
<td><em>Word</em>&mdash;Space for result</td>
</tr>
<tr>
<td class="bot">x</td>
<td></td>
<td><em>Word</em>&mdash;Local play field horizontal coordinate</td>
</tr>
<tr>
<td class="bot">y</td>
<td></td>
<td><em>Word</em>&mdash;Local play field vertical coordinate</td>
</tr>
<tr>
<td class="bot"></td>
<td><em></em></td>
<td><em>SP</em></td>
</tr>
</tbody>
</table>
<table class="stack">
<colgroup>
<col class="col-1">
<col class="col-2">
<col class="col-3">
</colgroup>
<tbody>
<tr>
<th>Stack after call</th>
</tr>
<tr>
<td class="top">previous contents</td>
</tr>
<tr>
<td class="bot">TileID</td>
<td></td>
<td><em>Word</em>&mdash;Tile ID at the play field coordinates.</td>
</tr>
<tr>
<td class="bot"></td>
<td><em></em></td>
<td><em>SP</em></td>
</tr>
</tbody>
</table>
</div>
<div class="section">
<h5>Errors</h5>
<p>None</p>
</div>
<div class="section">
<h5>C</h5>
<p><tt>extern pascal Word GTEGetTileAt(x, y)</tt></p>
<p><tt>Word x;</tt></p>
<p><tt>Word y;</tt></p>
</div>
</div>
<div class="api">
<h4 class="tn">$1DXX</h4>
<h4 id="GTESetBG0TileMapInfo">GTESetBG0TileMapInfo</h4>
<p>
Sets a tile map that will be used to automatically populate the primary background layer based on the current origin. Behavior is
undefined if the origin is set to a value that is outside the bounds of the tilemap.
</p>
<div class="section">
<h5>Parameters</h5>
<table class="stack">
<colgroup>
<col class="col-1">
<col class="col-2">
<col class="col-3">
</colgroup>
<tbody>
<tr>
<th>Stack before call</th>
</tr>
<tr>
<td class="top">previous contents</td>
</tr>
<tr>
<td class="bot">width</td>
<td></td>
<td><em>Word</em>&mdash;Width of the tilemap in tiles.</td>
</tr>
<tr>
<td class="bot">height</td>
<td></td>
<td><em>Word</em>&mdash;Height of the tilemap in tiles.</td>
</tr>
<tr>
<td class="bot">tileMapPtr</td>
<td></td>
<td><em>Long</em>&mdash;<span class="sc">pointer</span> to the tile map</td>
</tr>
<tr>
<td class="bot"></td>
<td><em></em></td>
<td><em>SP</em></td>
</tr>
</tbody>
</table>
<table class="stack">
<colgroup>
<col class="col-1">
<col class="col-2">
<col class="col-3">
</colgroup>
<tbody>
<tr>
<th>Stack after call</th>
</tr>
<tr>
<td class="top">previous contents</td>
</tr>
<tr>
<td class="bot"></td>
<td><em></em></td>
<td><em>SP</em></td>
</tr>
</tbody>
</table>
</div>
<div class="section">
<h5>Errors</h5>
<p>None</p>
</div>
<div class="section">
<h5>C</h5>
<p><tt>extern pascal void GTESetBG0TileMapInfo(width, height, tileMapPtr)</tt></p>
<p><tt>Word width;</tt></p>
<p><tt>Word height;</tt></p>
<p><tt>Pointer tileMapPtr;</tt></p>
</div>
<div class="example">
<h5>Tile Map Entries</h5>
<p>
The values in a tilemap are an array of 16-bit values.
</p>
<table class="bits bitfield">
<colgroup span="1" style="background-color: #999;"></colgroup>
<colgroup span="6" style="background-color: lightblue;"></colgroup>
<colgroup span="9" style="background-color: white;"></colgroup>
<tbody>
<tr>
<td>15</td><td>14</td><td>13</td><td>12</td><td>11</td><td>10</td><td>9</td><td>8</td><td>7</td><td>6</td><td>5</td><td>4</td><td>3</td><td>2</td><td>1</td><td>0</td>
</tr>
</tbody>
</table>
<table class="bitfield-definitions">
<tbody>
<tr><td>Bits 0-8</td><td>tileIndex</td><td>The index of a tile in the current Tile Set</td></tr>
<tr><td>Bit 9</td><td>TILE_HFLIP_BIT</td><td>Flip the tile horizontally when rendering.</td></tr>
<tr><td>Bit 10</td><td>TILE_VFLIP_BIT</td><td>Flip the tile vertically when rendering.</td></tr>
<tr><td>Bit 11</td><td>TILE_DYN_BIT</td><td>Marks a tile to use the dynamic tile data. The <em>tileIndex</em> must be between 0 and 31 if this bit is set.</em></td></tr>
<tr><td>Bit 12</td><td>TILE_SOLID_BIT</td><td>A hint bit that is used in ENGINE_MODE_TWO_LAYER to improve performance.</td></tr>
<tr><td>Bit 13</td><td>TILE_FRINGE_BIT</td><td>Unused. Must be zero.</td></tr>
<tr><td>Bit 14</td><td>TILE_PRIORITY_BIT</td><td>Sets the tile to be high priority to render on top of sprites.</td></tr>
<tr><td>Bit 15</td><td>Reserved</td><td>Must be zero.</td></tr>
</tbody>
</table>
</div>
</div>
<div class="api">
<h4 class="tn">$1EXX</h4>
<h4 id="GTESetBG1TileMapInfo">GTESetBG1TileMapInfo</h4>
<p>
Sets a tile map that will be used to automatically populate the secondary background layer based on the current origin. Behavior is
undefined if the origin is set to a value that is outside the bounds of the tilemap.
</p>
<div class="section">
<h5>Parameters</h5>
<table class="stack">
<colgroup>
<col class="col-1">
<col class="col-2">
<col class="col-3">
</colgroup>
<tbody>
<tr>
<th>Stack before call</th>
</tr>
<tr>
<td class="top">previous contents</td>
</tr>
<tr>
<td class="bot">width</td>
<td></td>
<td><em>Word</em>&mdash;Width of the tilemap in tiles.</td>
</tr>
<tr>
<td class="bot">height</td>
<td></td>
<td><em>Word</em>&mdash;Height of the tilemap in tiles.</td>
</tr>
<tr>
<td class="bot">tileMapPtr</td>
<td></td>
<td><em>Long</em>&mdash;<span class="sc">pointer</span> to the tile map</td>
</tr>
<tr>
<td class="bot"></td>
<td><em></em></td>
<td><em>SP</em></td>
</tr>
</tbody>
</table>
<table class="stack">
<colgroup>
<col class="col-1">
<col class="col-2">
<col class="col-3">
</colgroup>
<tbody>
<tr>
<th>Stack after call</th>
</tr>
<tr>
<td class="top">previous contents</td>
</tr>
<tr>
<td class="bot"></td>
<td><em></em></td>
<td><em>SP</em></td>
</tr>
</tbody>
</table>
</div>
<div class="section">
<h5>Errors</h5>
<p>None</p>
</div>
<div class="section">
<h5>C</h5>
<p><tt>extern pascal void GTESetBG1TileMapInfo(width, height, tileMapPtr)</tt></p>
<p><tt>Word width;</tt></p>
<p><tt>Word height;</tt></p>
<p><tt>Pointer tileMapPtr;</tt></p>
</div>
</div>
<div class="api">
<h4 class="tn">$1FXX</h4>
<h4 id="GTEAddTimer">GTEAddTimer</h4>
<p>
Adds a timer with a callback function and a delay in VBL ticks. Timers may be repeated or one-shot timers. A one-shot
timer will remove itself after firing. Timers are handled on a best-effort basis. It is possible that a timer
callback could be invoked multiple times in a single frame and the callback functions should account for this possibility.
</p>
<p>
The intended use for timers is to provide a way to perform animations and game physics at a consistent rate,
regardless of the speed of the machine. If a timer has not been invoked for over one second, then it will
<em>not</em> fire multiple times, but treat the current timestamp as its starting point. This is to avoid a
"callback storm" if timers are added then a long period of time elapses. It is recommended that timers be
removed if they are not expected to be fired on a regular basis.
</p>
<div class="section">
<h5>Parameters</h5>
<table class="stack">
<colgroup>
<col class="col-1">
<col class="col-2">
<col class="col-3">
</colgroup>
<tbody>
<tr>
<th>Stack before call</th>
</tr>
<tr>
<td class="top">previous contents</td>
</tr>
<tr>
<td class="bot">wordspace</td>
<td></td>
<td><em>Word</em>&mdash;Space for result.</td>
</tr>
<tr>
<td class="bot">numTicks</td>
<td></td>
<td><em>Word</em>&mdash;Number of VBL ticks to wait before firing. </td>
</tr>
<tr>
<td class="bot">callback</td>
<td></td>
<td><em>Long</em>&mdash;A pointer to a user function.</td>
</tr>
<tr>
<td class="bot">flags</td>
<td></td>
<td><em>Word</em>&mdash;The only valid values are <tt>$0001</tt> for a one-shot timer or <tt>$0000</tt> for a timer that resets.</td>
</tr>
<tr>
<td class="bot"></td>
<td><em></em></td>
<td><em>SP</em></td>
</tr>
</tbody>
</table>
<table class="stack">
<colgroup>
<col class="col-1">
<col class="col-2">
<col class="col-3">
</colgroup>
<tbody>
<tr>
<th>Stack after call</th>
</tr>
<tr>
<td class="top">previous contents</td>
</tr>
<tr>
<td class="bot">timerID</td>
<td></td>
<td><em>Word</em>&mdash;An opaque identifier of the timer. This value must be passed to the <tt>GTERemoveTimer()</tt> function.</td>
</tr>
<tr>
<td class="bot"></td>
<td><em></em></td>
<td><em>SP</em></td>
</tr>
</tbody>
</table>
</div>
<div class="section">
<h5>Errors</h5>
<p>None</p>
</div>
<div class="section">
<h5>C</h5>
<p><tt>extern pascal Word GTEAddTimer(numTicks, callback, flags)</tt></p>
<p><tt>Word numticks;</tt></p>
<p><tt>Pointer callback;</tt></p>
<p><tt>Word flags;</tt></p>
</div>
</div>
<div class="api">
<h4 class="tn">$20XX</h4>
<h4 id="GTERemoveTimer">GTERemoveTimer</h4>
<p>Removed a timer that had been added to the system.</p>
<div class="section">
<h5>Parameters</h5>
<table class="stack">
<colgroup>
<col class="col-1">
<col class="col-2">
<col class="col-3">
</colgroup>
<tbody>
<tr>
<th>Stack before call</th>
</tr>
<tr>
<td class="top">previous contents</td>
</tr>
<tr>
<td class="bot">timerID</td>
<td></td>
<td><em>Word</em>&mdash;ID of the timer.</td>
</tr>
<tr>
<td class="bot"></td>
<td><em></em></td>
<td><em>SP</em></td>
</tr>
</tbody>
</table>
<table class="stack">
<colgroup>
<col class="col-1">
<col class="col-2">
<col class="col-3">
</colgroup>
<tbody>
<tr>
<th>Stack after call</th>
</tr>
<tr>
<td class="top">previous contents</td>
</tr>
<tr>
<td class="bot"></td>
<td><em></em></td>
<td><em>SP</em></td>
</tr>
</tbody>
</table>
</div>
<div class="section">
<h5>Errors</h5>
<p>None</p>
</div>
<div class="section">
<h5>C</h5>
<p><tt>extern pascal Word GTERemoveTimer(timerID)</tt></p>
<p><tt>Word timerID;</tt></p>
</div>
</div>
<div class="api">
<h4 class="tn">$21XX</h4>
<h4 id="GTEStartScript">GTEStartScript</h4>
<p>This API is under active development at this time.</p>
<div class="section">
<h5>Parameters</h5>
<table class="stack">
<colgroup>
<col class="col-1">
<col class="col-2">
<col class="col-3">
</colgroup>
<tbody>
<tr>
<th>Stack before call</th>
</tr>
<tr>
<td class="top">previous contents</td>
</tr>
<tr>
<td class="bot">numTicks</td>
<td></td>
<td><em>Word</em>&mdash;Number of ticks between script invocations.</td>
</tr>
<tr>
<td class="bot">scriptAddr</td>
<td></td>
<td><em>Long</em>&mdash;<span class="sc">pointer</span> to the script bytecode.</td>
</tr>
<tr>
<td class="bot"></td>
<td><em></em></td>
<td><em>SP</em></td>
</tr>
</tbody>
</table>
<table class="stack">
<colgroup>
<col class="col-1">
<col class="col-2">
<col class="col-3">
</colgroup>
<tbody>
<tr>
<th>Stack after call</th>
</tr>
<tr>
<td class="top">previous contents</td>
</tr>
<tr>
<td class="bot"></td>
<td><em></em></td>
<td><em>SP</em></td>
</tr>
</tbody>
</table>
</div>
<div class="section">
<h5>Errors</h5>
<p>None</p>
</div>
<div class="section">
<h5>C</h5>
<p><tt>extern pascal Word GTEStartScript(numTicks, scriptAddr)</tt></p>
<p><tt>Word numTicks;</tt></p>
<p><tt>Pointer scriptAddr;</tt></p>
</div>
</div>
<div class="api">
<h4 class="tn">$22XX</h4>
<h4 id="GTESetOverlay">GTESetOverlay</h4>
<p>This API is under active development at this time.</p>
<div class="section">
<h5>Parameters</h5>
<table class="stack">
<colgroup>
<col class="col-1">
<col class="col-2">
<col class="col-3">
</colgroup>
<tbody>
<tr>
<th>Stack before call</th>
</tr>
<tr>
<td class="top">previous contents</td>
</tr>
<tr>
<td class="bot">top</td>
<td></td>
<td><em>Word</em>&mdash;Top screen line of the overlay</td>
</tr>
<tr>
<td class="bot">bottom</td>
<td></td>
<td><em>Word</em>&mdash;Bottom screen line of the overlay.</td>
</tr>
<tr>
<td class="bot">procPtr</td>
<td></td>
<td><em>Long</em>&mdash;<span class="sc">pointer</span> to the callback function.</td>
</tr>
<tr>
<td class="bot"></td>
<td><em></em></td>
<td><em>SP</em></td>
</tr>
</tbody>
</table>
<table class="stack">
<colgroup>
<col class="col-1">
<col class="col-2">
<col class="col-3">
</colgroup>
<tbody>
<tr>
<th>Stack after call</th>
</tr>
<tr>
<td class="top">previous contents</td>
</tr>
<tr>
<td class="bot"></td>
<td><em></em></td>
<td><em>SP</em></td>
</tr>
</tbody>
</table>
</div>
<div class="section">
<h5>Errors</h5>
<p>None</p>
</div>
<div class="section">
<h5>C</h5>
<p><tt>extern pascal Word GTESetOverlay(top, bottom, procPtr)</tt></p>
<p><tt>Word top;</tt></p>
<p><tt>Word bottom;</tt></p>
<p><tt>Pointer procPtr;</tt></p>
</div>
</div>
<div class="api">
<h4 class="tn">$23XX</h4>
<h4 id="GTEClearOverlay">GTEClearOverlay</h4>
<p>Removes the active overlay. This API is under active development at this time.</p>
<div class="section">
<h5>Parameters</h5>
<table class="stack">
<colgroup>
<col class="col-1">
<col class="col-2">
<col class="col-3">
</colgroup>
<tbody>
<tr>
<th>Stack before call</th>
</tr>
<tr>
<td class="top">previous contents</td>
</tr>
<tr>
<td class="bot"></td>
<td><em></em></td>
<td><em>SP</em></td>
</tr>
</tbody>
</table>
<table class="stack">
<colgroup>
<col class="col-1">
<col class="col-2">
<col class="col-3">
</colgroup>
<tbody>
<tr>
<th>Stack after call</th>
</tr>
<tr>
<td class="top">previous contents</td>
</tr>
<tr>
<td class="bot"></td>
<td><em></em></td>
<td><em>SP</em></td>
</tr>
</tbody>
</table>
</div>
<div class="section">
<h5>Errors</h5>
<p>None</p>
</div>
<div class="section">
<h5>C</h5>
<p><tt>extern pascal Word GTEClearOverlay()</tt></p>
</div>
</div>
<div class="api">
<h4 class="tn">$24XX</h4>
<h4 id="GTEGetTileDataAddr">GTEGetTileDataAddr</h4>
<p>This API is under active development at this time.</p>
<div class="section">
<h5>Parameters</h5>
<table class="stack">
<colgroup>
<col class="col-1">
<col class="col-2">
<col class="col-3">
</colgroup>
<tbody>
<tr>
<th>Stack before call</th>
</tr>
<tr>
<td class="top">previous contents</td>
</tr>
<tr>
<td class="bot"></td>
<td><em></em></td>
<td><em>SP</em></td>
</tr>
</tbody>
</table>
<table class="stack">
<colgroup>
<col class="col-1">
<col class="col-2">
<col class="col-3">
</colgroup>
<tbody>
<tr>
<th>Stack after call</th>
</tr>
<tr>
<td class="top">previous contents</td>
</tr>
<tr>
<td class="bot"></td>
<td><em></em></td>
<td><em>SP</em></td>
</tr>
</tbody>
</table>
</div>
<div class="section">
<h5>Errors</h5>
<p>None</p>
</div>
<div class="section">
<h5>C</h5>
</div>
</div>
<div class="api">
<h4 class="tn">$25XX</h4>
<h4 id="GTEFillTileStore">GTEFillTileStore</h4>
<p>
Fills the entire Tile Store with a specific Tile ID value.
</p>
<div class="section">
<h5>Parameters</h5>
<table class="stack">
<colgroup>
<col class="col-1">
<col class="col-2">
<col class="col-3">
</colgroup>
<tbody>
<tr>
<th>Stack before call</th>
</tr>
<tr>
<td class="top">previous contents</td>
</tr>
<tr>
<td class="bot">tileID</td>
<td></td>
<td><em>Word</em>&mdash;Tile ID to store into the tile store memory.</td>
</tr>
<tr>
<td class="bot"></td>
<td><em></em></td>
<td><em>SP</em></td>
</tr>
</tbody>
</table>
<table class="stack">
<colgroup>
<col class="col-1">
<col class="col-2">
<col class="col-3">
</colgroup>
<tbody>
<tr>
<th>Stack after call</th>
</tr>
<tr>
<td class="top">previous contents</td>
</tr>
<tr>
<td class="bot"></td>
<td><em></em></td>
<td><em>SP</em></td>
</tr>
</tbody>
</table>
</div>
<div class="section">
<h5>Errors</h5>
<p>None</p>
</div>
<div class="section">
<h5>C</h5>
<p><tt>extern pascal void GTEFillTileStore(tileID)</tt></p>
<p><tt>Word tileID;</tt></p>
</div>
</div>
<div class="api">
<h4 class="tn">$26XX</h4>
<h4 id="GTERefresh">GTERefresh</h4>
<p>
Forces a refresh of the play field. This is implemented by adding all of the visible tiles to the dirty tile
queue which will force them to be redrawn on the next call to <tt>GTERender()</tt>.
</p>
<div class="section">
<h5>Parameters</h5>
<p>
The stack is not affected by this call. There are no input or output parameters.
</p>
</div>
<div class="section">
<h5>Errors</h5>
<p>None</p>
</div>
<div class="section">
<h5>C</h5>
<p><tt>extern pascal void GTERefresh()</tt></p>
</div>
</div>
<div class="api">
<h4 class="tn">$27XX</h4>
<h4 id="GTESetBG1Displacement">GTESetBG1Displacement</h4>
<p>
Sets a displacement into the BG1 offset table. Must be a value between 0 and 31.
</p>
<div class="section">
<h5>Parameters</h5>
<table class="stack">
<colgroup>
<col class="col-1">
<col class="col-2">
<col class="col-3">
</colgroup>
<tbody>
<tr>
<th>Stack before call</th>
</tr>
<tr>
<td class="top">previous contents</td>
</tr>
<tr>
<td class="bot">offset</td>
<td></td>
<td><em>Word</em>&mdash;Offset index.</td>
</tr>
<tr>
<td class="bot"></td>
<td><em></em></td>
<td><em>SP</em></td>
</tr>
</tbody>
</table>
<table class="stack">
<colgroup>
<col class="col-1">
<col class="col-2">
<col class="col-3">
</colgroup>
<tbody>
<tr>
<th>Stack after call</th>
</tr>
<tr>
<td class="top">previous contents</td>
</tr>
<tr>
<td class="bot"></td>
<td><em></em></td>
<td><em>SP</em></td>
</tr>
</tbody>
</table>
</div>
<div class="section">
<h5>Errors</h5>
<p>None</p>
</div>
<div class="section">
<h5>C</h5>
<p><tt>extern pascal void GTESetBG1Displacement(offset)</tt></p>
<p><tt>Word offset;</tt></p>
</div>
</div>
<div class="api">
<h4 class="tn">$28XX</h4>
<h4 id="GTESetBG1Rotation">GTESetBG1Rotation</h4>
<p>
Sets the rotation angle of the BG1 buffer. There are 64 sets in the angle tables, so
the value must be between 0 and 63.
</p>
<div class="section">
<h5>Parameters</h5>
<table class="stack">
<colgroup>
<col class="col-1">
<col class="col-2">
<col class="col-3">
</colgroup>
<tbody>
<tr>
<th>Stack before call</th>
</tr>
<tr>
<td class="top">previous contents</td>
</tr>
<tr>
<td class="bot">rotIndex</td>
<td></td>
<td><em>Word</em>&mdash;Rotation index. Must be between 0 and 63.</td>
</tr>
<tr>
<td class="bot"></td>
<td><em></em></td>
<td><em>SP</em></td>
</tr>
</tbody>
</table>
<table class="stack">
<colgroup>
<col class="col-1">
<col class="col-2">
<col class="col-3">
</colgroup>
<tbody>
<tr>
<th>Stack after call</th>
</tr>
<tr>
<td class="top">previous contents</td>
</tr>
<tr>
<td class="bot"></td>
<td><em></em></td>
<td><em>SP</em></td>
</tr>
</tbody>
</table>
</div>
<div class="section">
<h5>Errors</h5>
<p>None</p>
</div>
<div class="section">
<h5>C</h5>
<p><tt>extern pascal void GTESetBG1Rotation(rotIndex)</tt></p>
<p><tt>Word rotIndex;</tt></p>
</div>
</div>
<div class="api">
<h4 class="tn">$29XX</h4>
<h4 id="GTEClearBG1Buffer">GTEClearBG1Buffer</h4>
<p>
Clears the BG1 pixel buffer with a 16-bit value.
</p>
<div class="section">
<h5>Parameters</h5>
<table class="stack">
<colgroup>
<col class="col-1">
<col class="col-2">
<col class="col-3">
</colgroup>
<tbody>
<tr>
<th>Stack before call</th>
</tr>
<tr>
<td class="top">previous contents</td>
</tr>
<tr>
<td class="bot">value</td>
<td></td>
<td><em>Word</em>&mdash;16-bit value to fill all of BG1 memeory.</td>
</tr>
<tr>
<td class="bot"></td>
<td><em></em></td>
<td><em>SP</em></td>
</tr>
</tbody>
</table>
<table class="stack">
<colgroup>
<col class="col-1">
<col class="col-2">
<col class="col-3">
</colgroup>
<tbody>
<tr>
<th>Stack after call</th>
</tr>
<tr>
<td class="top">previous contents</td>
</tr>
<tr>
<td class="bot"></td>
<td><em></em></td>
<td><em>SP</em></td>
</tr>
</tbody>
</table>
</div>
<div class="section">
<h5>Errors</h5>
<p>None</p>
</div>
<div class="section">
<h5>C</h5>
<p><tt>extern pascal void GTEClearBG1Buffer(value)</tt></p>
<p><tt>Word value;</tt></p>
</div>
</div>
</div>