Support left/alt right for apple keys. TOC/doc fixes

This commit is contained in:
Joshua Bell 2013-08-16 00:13:24 -07:00
parent 68f03887ca
commit 9f83bcaad3
2 changed files with 306 additions and 313 deletions

View File

@ -13,6 +13,7 @@ a:hover { text-decoration: underline; }
code, .code, dt { font-family: 'Lucida Console', 'Courier New', Courier, monospace; font-weight: bold; color: #406040; }
h1 { margin-top: 0; }
h2 { border-top: solid 2px black; border-bottom: solid 2px black; }
pre.code { margin: 12pt; }
.nyi { opacity: 0.65; }
@ -28,7 +29,7 @@ This is intended as a quick reference for the <a href="index.htm">Applesoft BASI
</p>
<p>
<a href="#Extensions">Extensions</a> beyond Applesoft BASIC are called out with footnotes.
<a href="#extensions">Extensions</a> beyond Applesoft BASIC are called out with footnotes.
</p>
<p>See also:</p>
@ -40,7 +41,7 @@ This is intended as a quick reference for the <a href="index.htm">Applesoft BASI
</ul>
</section>
<section id="Statements">
<section id="statements">
<!-- ================================================== -->
<h2>Statements</h2>
<!-- ================================================== -->
@ -51,7 +52,7 @@ This is intended as a quick reference for the <a href="index.htm">Applesoft BASI
<dt>CLEAR<dd>Clear all variables
<dt>[LET] <var>var</var> = <var>expr</var><dd>Assign variable
<dt>DIM <var>var</var>( <var>size</var> [ , <var>size2</var> ...] ) [ , <var>var2</var>( <var>size</var> [ , <var>size2</var> ...] ) ... ] <dd>Allocate array
<dt>DEF FN <var>f</var>(<var>var</var> ) = <var>expr</var><dd>Define function of a single variable <a href="#Extension_StringFuncs">[1]</a>
<dt>DEF FN <var>f</var>(<var>var</var> ) = <var>expr</var><dd>Define function of a single variable <a href="#def_fn_string">[1]</a>
</dl>
</section>
@ -177,11 +178,11 @@ This is intended as a quick reference for the <a href="index.htm">Applesoft BASI
</dl>
</section>
<section id="Compatibility_Shims">
<section id="shims">
<h3>Compatibility Shims</h3>
<dl>
<dt>SPEED= <var>expr</var><dd>Set character output delay - <em>has no effect</em>
<dt id="Poke">POKE <var>expr</var>, <var>expr</var><dd>Set memory location to value
<dt>POKE <var>expr</var>, <var>expr</var><dd>Set memory location to value
<ul>
<li><code>POKE 32,<var>n</var></code> - Text window left edge
<li><code>POKE 33,<var>n</var></code> - Text window width
@ -201,7 +202,7 @@ This is intended as a quick reference for the <a href="index.htm">Applesoft BASI
<li><code>POKE 49239,0</code> - hires
</ul>
<dt id="Call">CALL <var>expr</var><dd>Call native routine
<dt>CALL <var>expr</var><dd>Call native routine
<ul>
<li><code>CALL -3100</code> - reveal hi-res page 1
<li><code>CALL -3086</code> - clear current hi-res page to black
@ -248,7 +249,7 @@ This is intended as a quick reference for the <a href="index.htm">Applesoft BASI
<h3>Type Conversion Functions</h3>
<dl>
<dt>ASC( <var>expr</var> )<dd>ASCII code for first character of string
<dt>CHR$( <var>expr</var> )<dd>Character at specified ASCII code point<a href="#Extensions_CHR">[3]</a>
<dt>CHR$( <var>expr</var> )<dd>Character at specified ASCII code point<a href="#chr_extras">[3]</a>
<dt>STR$( <var>expr</var> )<dd>String representation of number
<dt>VAL( <var>expr</var> )<dd>Parse string into number
</dl>
@ -258,15 +259,15 @@ This is intended as a quick reference for the <a href="index.htm">Applesoft BASI
<dt>PDL( <var>expr</var> )<dd>Paddle position (paddle number)
<dt>POS( <var>expr</var> )<dd>Horizontal cursor position
<dt>SCRN( <var>expr</var>, <var>expr</var> )<dd>Lores color at pixel (x,y)
<dt>HSCRN( <var>expr</var>, <var>expr</var> )<dd>Hires color at pixel (x,y)<a href="#Extension_HSCRN">[4]</a>
<dt>HSCRN( <var>expr</var>, <var>expr</var> )<dd>Hires color at pixel (x,y)<a href="#hscrn">[4]</a>
<dt>USR( <var>expr</var> )<dd>Execute assembly code at address, return accumulator value <var>- NOT IMPLEMENTED</var>
</dl>
<h3>User Defined Functions</h3>
<dl>
<dt>FN <var>f</var>( <var>expr</var> )<dd>Execute user defined function <a href="#Extension_StringFuncs">[1]</a>
<dt>FN <var>f</var>( <var>expr</var> )<dd>Execute user defined function <a href="#def_fn_string">[1]</a>
</dl>
<h3 id="Function_Compatibility_Shims">Function Compatibility Shims</h3>
<h3 id="function_shims">Function Compatibility Shims</h3>
<dl>
<dt id="peek">PEEK( <var>expr</var> )<dd>Value at memory location
<ul>
@ -287,18 +288,17 @@ This is intended as a quick reference for the <a href="index.htm">Applesoft BASI
<li><code>PEEK(49250)</code> - Read Paddle Button #1 - <em>Use the End key</em>
<li><code>PEEK(49251)</code> - Read Paddle Button #2 - <em>Use the PageUp or Shift key</em>
</ul>
</dl>
</section>
<section id="Operators">
<section id="operators">
<!-- ================================================== -->
<h2>Operators</h2>
<!-- ================================================== -->
<h3>Comparison Operators</h3>
<dl>
<dt>=<dd>Equality<a href="#Extensions_DoubleEquals">[2]</a>
<dt>=<dd>Equality<a href="#eqeq">[2]</a>
<dt>&lt;<dd>Less than
<dt>&gt;<dd>Greater than
<dt>&lt;=<dt>=&lt;<dd>Less than or equal
@ -353,7 +353,7 @@ This is intended as a quick reference for the <a href="index.htm">Applesoft BASI
</dl>
</section>
<section id="DOSQuickReference">
<section id="dos">
<!-- ================================================== -->
<h2>DOS 3.3 / ProDOS Quick Reference</h2>
<!-- ================================================== -->
@ -421,8 +421,8 @@ a best-effort has been made testing on available systems and browsers.
<p>
The <em>Open Apple</em> and <em>Closed Apple</em> keys on later Apple II models
correspond to the Button #0 and Button #1 inputs and are emulated on modern keyboards
with the <em>Home</em> and <em>End</em> keys respectively. (Unfortunately, browsers
are currently unable to distinguish the left and right <em>Alt</em> or <em>Command</em> keys.)
with the <em>Left Alt</em> and <em>Right Alt</em> keys respectively if possible,
otherwise the <em>Home</em> and <em>End</em> keys respectively.
</p>
<p>
@ -479,7 +479,7 @@ If 80-column firmware is active, the following additional codes are available:
<tr><td><code>CHR$(22)</code><td>Scroll display down, preserving cursor position
<tr><td><code>CHR$(23)</code><td>Scroll display up, preserving cursor position
<tr><td><code>CHR$(24)</code><td>Disable mousetext
<tr><td><code>CHR$(25)</code><td>Move cursor to upper left (but don't clear window)
<tr><td><code>CHR$(25)</code><td>Move cursor to upper left (but do not clear window)
<tr><td><code>CHR$(26)</code><td>Clear the current line
<tr><td><code>CHR$(27)</code><td>Enable mousetext
<tr><td><code>CHR$(28)</code><td>Forward space (move cursor right, wrap down)
@ -529,10 +529,10 @@ object representing the program.</p>
<p>Overall program parsing is done with a recursive descent parser.</p>
<pre class="code">
Program = Line { Line }
Line = line-number Statement { separator Statement }
Statement = data-declaration | remark | Command | EmptyStatement
Command = identifier /*...*/ | reserved /*...*/
Program = Line { Line }
Line = line-number Statement { separator Statement }
Statement = data-declaration | remark | Command | EmptyStatement
Command = identifier /*...*/ | reserved /*...*/
</pre>
<p>Statements ("commands" in the above grammar) are parsed with distinct cases for each statement type.
@ -541,17 +541,17 @@ with a standard recursive descent parser. The parser generates JavaScript expres
which are used as arguments for the library calls.</p>
<pre class="code">
Expression = OrExpression
OrExpression = AndExpression { 'OR' AndExpression }
AndExpression = RelationalExpression { 'AND' RelationalExpression }
RelationalExpression = AdditiveExpression { RelOp AdditiveExpression }
RelOp = '=' | '&lt;' | '&gt;' | '&lt;=' | '=&lt;' | '&gt;=' | '=&gt;' | '&lt;&gt;' | '&gt;&lt;'
AdditiveExpression = MultiplicativeExpression { ( '+' | '-' ) MultiplicativeExpression }
MultiplicativeExpression = PowerExpression { ( '*' | '/' ) PowerExpression }
PowerExpression = UnaryExpression [ '^' UnaryExpression ]
UnaryExpression = ( '+' | '-' | 'NOT' ) UnaryExpression
Expression = OrExpression
OrExpression = AndExpression { 'OR' AndExpression }
AndExpression = RelationalExpression { 'AND' RelationalExpression }
RelationalExpression = AdditiveExpression { RelOp AdditiveExpression }
RelOp = '=' | '&lt;' | '&gt;' | '&lt;=' | '=&lt;' | '&gt;=' | '=&gt;' | '&lt;&gt;' | '&gt;&lt;'
AdditiveExpression = MultiplicativeExpression { ( '+' | '-' ) MultiplicativeExpression }
MultiplicativeExpression = PowerExpression { ( '*' | '/' ) PowerExpression }
PowerExpression = UnaryExpression [ '^' UnaryExpression ]
UnaryExpression = ( '+' | '-' | 'NOT' ) UnaryExpression
| FinalExpression
FinalExpression = number-literal
FinalExpression = number-literal
| string-literal
| 'FN' user_function_name '(' Expression ')'
| reserved '(' Expression { ',' Expression } ')'
@ -559,70 +559,59 @@ which are used as arguments for the library calls.</p>
| '(' Expression ')'
</pre>
<p>Since Applesoft supports re-entrant error handling and synchronous input,
the output of the compiler is an array of statement-functions plus a driver
function which implements the logic for walking over the array.<p>
</section>
<section id="Extensions">
<section id="extensions">
<!-- ================================================== -->
<h2>Extensions beyond Standard Applesoft</h2>
<!-- ================================================== -->
<ul style="list-style: none;">
<li id="Extension_StringFuncs">
<li id="def_fn_string">
[1] <code>DEF FN</code> supports string and integer functions
e.g. <code>DEF FN IN$(X$) = " " + X$</code>
(but return type must still match argument type)
<li id="Extension_DoubleEquals">
<li id="eqeq">
[2] <code>==</code> is supported for equality comparisons, in addition to <code>=</code>
<li id="Extension_CHR">
<li id="chr_extras">
[3] When printing characters, <code>CHR$()</code> values greater than 255 generate glyphs that might be useful for certain maze games.
<li id="Extension_HSCRN">
<li id="hscrn">
[4] <code>HSCRN(<var>x</var>,<var>y</var>)</code> is added to allow reading the
hires screen. On a real Apple this required a machine-language routine (or a shape table and <code>XDRAW</code>).
</ul>
</section>
<script type="text/javascript" src="../polyfill/polyfill.js"></script>
<script>
(function (el) {
(function buildTOC(el) {
var html = [];
el.innerHTML = "";
var level = 1, newLevel, unique = 10000, key, c
for (c = document.body.firstChild; c; c = c.nextSibling) {
if( c.nodeName === "H2" || c.nodeName === "H3" ) {
newLevel = parseInt(c.nodeName.charAt(1), 10);
var level = 1, unique = 10000;
[].forEach.call(document.querySelectorAll('h2, h3'), function(c) {
var newLevel = parseInt(c.nodeName.charAt(1), 10);
if (newLevel > level) {
html.push( "<ol>" );
}
else if (level > newLevel) {
html.push( "<"+"/ol>" );
html.push('<ol>');
} else if (level > newLevel) {
html.push('</ol>');
}
level = newLevel;
key = "key_" + unique++;
var key = 'key_' + unique++;
html.push( "<li>",
"<a href='#"+key+"'>",
c.textContent !== undefined ? c.textContent : c.innerText,
"<"+"/a>" ,
"<"+"/li>" );
html.push('<li><a href="#' + key + '">' + c.innerHTML + '</a>');
c.setAttribute('id', key);
level = newLevel;
}
}
});
while( level > 1 ) {
html.push( "<"+"/ol>" );
html.push( '</ol>' );
--level;
}
el.innerHTML = html.join("");
}(document.getElementById("toc")));
el.innerHTML = html.join('');
}(document.getElementById('toc')));
</script>

4
tty.js
View File

@ -789,7 +789,9 @@ function TTY(screenElement, keyboardElement, bell) {
break;
// Used as paddle buttons (0=Open Apple, 1=Solid Apple)
case 'AltLeft':
case 'Home': buttonState[0] = 255; handled = true; break;
case 'AltRight':
case 'End': buttonState[1] = 255; handled = true; break;
case 'PageUp': buttonState[2] = 255; handled = true; break;
case 'Shift':
@ -835,7 +837,9 @@ function TTY(screenElement, keyboardElement, bell) {
break;
// Used as paddle buttons (0=Open Apple, 1=Solid Apple)
case 'AltLeft':
case 'Home': buttonState[0] = 0; handled = true; break;
case 'AltRight':
case 'End': buttonState[1] = 0; handled = true; break;
case 'PageUp': buttonState[2] = 0; handled = true; break;
case 'Shift': buttonState[2] = 0; handled = true; break;