http://www.calormen.com/Applesoft/Applesoft BASIC in Javascript - Change Log2011-12-06T23:00:00ZJoshua Bellinexorabletash@hotmail.comhttp://www.calormen.com/2011-12-06http://www.calormen.com/Applesoft/201112062011-12-06T23:00:00Z
<p>
Added <code>PEEK</code> and <code>POKE</code> shim for 230 (Hi-Res plotting page), to
enable drawing on the back buffer for animations.
2011-04-20http://www.calormen.com/Applesoft/201104202011-04-20T21:00:00Z
<p>
Re-added support for running under
<a href="http://en.wikipedia.org/wiki/Windows_Script_Host">Windows Scripting Host</a> and added
<a href="http://www.mozilla.org/rhino/">Mozilla Rhino</a> support too.
2011-04-16http://www.calormen.com/Applesoft/201104162011-04-16T23:00:00Z
<p>
Total internal revamp: Now a compiler rather than interpreter. Source errors are reported
by BASIC line number as well as source line/column.
<p>
Display defaults to 40 columns, emulates 80-column firmware more accurately. Character output
(<code>CHR$()</code>, <code>INVERSE</code>, etc) tweaked to match Apple
behavior.
<p>
Files written via DOS now persist in your browser via <a href="http://dev.w3.org/html5/webstorage/">Web Storage</a>.
<p>
Floating point and integer overflows are caught rather than propagating infinities and NaNs.
<p>
<code>DATA</code> statements and <code>INPUT</code> entries parse
more accurately as comma delimited, optionally-quoted strings. <code>RE-ENTER?</code>
is shown on invalid <code>INPUT</code> (and can be trapped via <code>ONERR</code>)
<p>
Added <code>HGR2</code> and page-flipping <code>POKE</code> shims, plus a few <code>CALL</code> shims
for graphics. Hires graphics are now to a 280x192 bitmap, rather than trying to be sneaky with a 140x192 bitmap.
<p>
Error codes can be distinguished in <code>ONERR</code> via <code>PEEK(222)</code>.
Out-of-memory and stack-overflow conditions reported where possible (this is
<a href="http://cautionsingularityahead.blogspot.com/2011/03/stack-overflow-and-out-of-memory-in.html">
non-standard across browsers</a>).
<p>
Tweaked samples that were dependent on language/environment quirks.
<p>
Updated code editor to (the much improved) <a href="http://codemirror.net/">CodeMirror 2.0</a>. On parse errors,
the cursor is moved to the offending line/character.
2011-01-29http://www.calormen.com/Applesoft/201101292011-01-29T23:30:00Z
<p>
Fixed error handling issues, e.g. DOS errors w/ <code>ONERR</code> and syntax
errors e.g. <code>10 INPUT PRINT</code>
</p>
<p>
Added <code>HSCRN(x,y)</code> extension function.
</p>
<p>
Fix mouse-as-joystick to hit full range of 0...255.
</p>
2011-01-26http://www.calormen.com/Applesoft/201101262011-01-26T23:00:00Z
<p>
No longer show paddles/joysticks automatically; rely on mouse-as-joystick primarily.
</p>
<p>
Use <a href="http://flashcanvas.net/">FlashCanvas</a> for older IE versions, instead of
<a href="http://excanvas.sourceforge.net/">excanvas</a>, and switch to plotting hires
pixels/lines directly rather than relying on canvas scaling and line drawing.
</p>
<p>
Added Gaussian Distribution 2D plot sample, by John Russ
</p>
2011-01-25http://www.calormen.com/Applesoft/201101252011-01-25T21:00:00Z
<p>
Added compatibility shims for <code>PEEK(78)</code> and <code>PEEK(79)</code>
for seeding the random number generator. On a real Apple these are incremented during the input
polling loop and are a good source of entropy for seeding a random number generator. In this
interpreter, they are simply generated by the JavaScript <code>Math.random()</code> function.
</p>
2010-11-21http://www.calormen.com/Applesoft/201011212010-11-21T19:00:00Z
<p>
Added lexical highlighting in code editor via <a href="http://codemirror.net">CodeMirror</a>. Note that this only highlights tokens, it does not check statement or expression syntax. It will highlight invalid tokens and unsupported statements.
<p>
Mousing over the screen now updates paddle position - try the lo-res painting demo for an example.
</p>
<p>
Lots of internal code cleanup with hopefully no behavior changes.
</p>
2010-11-18http://www.calormen.com/Applesoft/201011182010-11-18T19:00:00Z
<p>
Fix <code>RETURN</code> and <code>POP</code>
from inside a <code>FOR ... NEXT</code> loop.
</p>
<p>
Fix <code>TRACE</code> and <code>NOTRACE</code>
</p>
2010-11-13http://www.calormen.com/Applesoft/201011132010-11-13T19:00:00Z
<p>
Added <code>SPEED=</code> shim (does nothing)
</p>
<p>
Fixed <code>SPC()</code> and <code>TAB()</code>
</p>
<p>
Work around
<a href="http://code.google.com/p/chromium/issues/detail?id=58144">Chrome bug</a>
to show full error alert text.
</p>
2010-08-29http://www.calormen.com/Applesoft/201008292010-08-29T11:22:00Z
<p>
Added "Echo to Printer" option to allow copy/paste of output
</p>
<p>
Big refactor of internals. Statement parsing and execution now separated. A library of statement functions are
used for execution. Hopefully nothing broke - all unit tests still pass.
</p>
2010-05-04http://www.calormen.com/Applesoft/201005042010-05-04T20:28:00-08:00
<p>
When run under <code>cscript.exe</code>, the program still blocks until the user
presses Enter when a <code>GET</code> statement executes, but the entered
characters are returned by subsequent <code>GET</code> statements.
</p>
<p>
Added Hello World Sine Wave sample by Jamie Beu.
</p>
2009-11-01http://www.calormen.com/Applesoft/200911012009-11-01T14:22:00-08:00
<p>
Changes are now recorded in an <a href="feed.xml">Atom Feed</a>.
</p>
2009-10-24http://www.calormen.com/Applesoft/200910242009-10-24T12:00:00-08:00
<p>
Now licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache 2.0 license</a>
</p>
2009-10-15http://www.calormen.com/Applesoft/200910152009-10-15T12:00:00-08:00
<p>
Fixed bug with <code>POKE</code> and negative addresses (introduced 2009-05-15, bleah)
</p>
2009-06-10http://www.calormen.com/Applesoft/200906102009-06-10T12:00:00-08:00
<p>
Added <a href="http://en.wikipedia.org/wiki/Boy%27s_surface">Boy's Surface</a> sample by Lukas Innig
</p>
2009-05-08http://www.calormen.com/Applesoft/20090508b2009-05-08T13:00:00-08:00
<p>
Fixed running with <code>cscript</code>
</p>
<p>Slight performance tweaks for IE c/o explicit sizing</p>
2009-05-08http://www.calormen.com/Applesoft/200905082009-05-08T12:00:00-08:00
<p>
Tracked down source of IE perf issues when drawing with paddles; when the thumb/stick moves,
IE does a relayout/repaint of any content above the paddle in the HTML flow. If I delete the
page header it's silky-smooth. Unfortunately, any text above the screen seems to make it fall
off the deep end - so no fix yet without gutting the page.
</p>
<p>
Undid "Line breaks from <code>PRINT</code> now clear to the right edge" - doesn't repro on Apple. <em>What was I thinking?</em>
</p>
2009-05-06http://www.calormen.com/Applesoft/200905062009-05-06T12:00:00-08:00
<p>
A bunch of performance tweaks based on IE8's JavaScript profiler. While they look good on paper,
they mean diddly-squat to perceived performance. Don't precalc default variable values, avoid DOM
changes that are no-ops, and (sigh) don't scan the whole screen looking for <code>FLASH</code>-styled
cells - maintain a list instead so perf isn't impacted if there are none.
</p>
2009-05-01http://www.calormen.com/Applesoft/200905012009-05-01T12:00:00-08:00
<p>
Expressions are now just-in-time compiled to JavaScript. Screen updates are the real bottleneck, though,
so this isn't a big performance boost. Performance comparison (on my 1.73GHz machine) of the lores Mandelbrot set demo:
<ul>
<li>Google Chrome (V8 JavaScript compiler): 25% faster (21s vs. 27s)</li>
<li>Firefox 3: 14% faster (64s vs. 73s)</li>
<li>Internet Explorer 8: <1% faster (249s vs. 251s)</li>
</ul>
So not a huge win except on faster execution engines. But this is just the first step...
</p>
<p>
Fixed <code>POKE 216,x</code> shim to disable <code>ONERR</code> handler
</p>
2009-04-30http://www.calormen.com/Applesoft/200904302009-04-30T12:00:00-08:00
<p>
Rejiggered internal value storage/passing system to use fundamental JavaScript types instead of <code>{number: value}</code> or
<code>{string: value}</code>. I didn't trust JavaScript's type system when I first wrote this code.
</p>
2009-04-26http://www.calormen.com/Applesoft/200904262009-04-26T12:00:00-08:00
<p>
Performance - made <code>GOTO</code>/<code>GOSUB</code> not do a linear scan to find the line (d'oh). Significant perf boost for IE.
</p>
<p>Added Unit Tests sample. Coverage is not complete but it's getting there.</p>
<p>
<code>RND()</code> with negative now consistently reseeds (added custom pseudoranom number generator)
</p>
<p>
<code>FOR I = 10 TO 1 : PRINT I : NEXT</code> now correctly prints <samp>10</samp> then finishes (was previously incorrectly inferring <code>STEP -1</code>)
</p>
2009-04-25http://www.calormen.com/Applesoft/200904252009-04-25T12:00:00-08:00
<p>
Line breaks from <code>PRINT</code> now clear to the right edge of the text window
</p>
<p>
Automatically show input devices if <code>PDL()</code> called
</p>
<p>Added Zhodani Relay Station Placement example (run after generating a sector with Traveller Sector Generator)</p>
2009-04-24http://www.calormen.com/Applesoft/200904242009-04-24T12:00:00-08:00
<p>
Fixed a bug where changing text mode (e.g. <code>PR#3</code>) after calling <code>HGR</code> would break split-screen mode.
</p>
2009-04-14http://www.calormen.com/Applesoft/200904142009-04-14T12:00:00-08:00
<p>
Updated to an <a href="http://explorercanvas.blogspot.com/2009/03/new-explorer-canvas-release.html">IE8-compatible</a> version of <a href="http://code.google.com/p/explorercanvas/">excanvas</a>.
Updated <a href="excanvas.patch">my excanvas patch to support scaling</a>.
</p>
2009-04-05http://www.calormen.com/Applesoft/200904052009-04-05T12:00:00-08:00
<p>
Allow <code>DEF FN</code> to be invalid (errors occur in <code>FN</code>, per Applesoft)
</p>
<p>
Fixed <code>PR#0</code> in Safari
</p>
<p>
Added <code>
RENAME <var>old</var>,<var>new</var>
</code>to DOS
</p>
<p>
Fixed <code>LIST</code> for assignment statements with no <code>LET</code>
</p>
<p>
Fixed operator spacing for <code>LIST</code>
</p>
<p>
Fixed parsing of empty <code>REM</code> statements
</p>
<p>Program would execute after a tokenization error was encountered - fixed.</p>
<p>Added Traveller Sector Generator sample</p>
2009-03-07http://www.calormen.com/Applesoft/200903072009-03-07T12:00:00-08:00
<p>Fixed cursor blinking</p>
<p>Added Connections, Puzzler, and Squiggle by Gregg Buntin</p>
2009-03-06http://www.calormen.com/Applesoft/200903062009-03-06T12:00:00-08:00
<p>
Addressed IE performance issues: sped up Text and LoRes screen initialization, don't use classes for characters (<em>sigh</em>).
</p>
<p>
Fixed <code>PRINT SPC()</code>
</p>
2009-03-05http://www.calormen.com/Applesoft/200903052009-03-05T12:00:00-08:00
<p>
<code>PRINT CHR$(7)</code> now rings a <code>BELL</code> (if your browser has an audio/wav WAV handler configured)
</p>
<p>Reimplemented the text display (TTY) using bitmap font, to mimic the look of 40/80 column text (no more copy/paste, alas)</p>
<p>
Added MouseText support. <code>INVERSE:PRINT CHR$(27);"XY";CHR$(24):NORMAL</code>
</p>
<p>
The ASCII Pac-Man sample was really <em>Unicode</em> Pac-Man, which the bitmap font doesn't support, so it broke. So I cheated.
</p>
2009-03-01http://www.calormen.com/Applesoft/200903012009-03-01T12:00:00-08:00
<p>Added Scribble sample, by William Simms</p>
2009-02-12http://www.calormen.com/Applesoft/200902122009-02-12T12:00:00-08:00
<p>Added February Surprise sample by Antti Pirskanen</p>
2008-11-08http://www.calormen.com/Applesoft/200811082008-11-08T12:00:00-08:00
<p>Ignore whitespace-only lines, as a convenience</p>
<p>Added ASCII PAC-MAN(ish) sample by Michael Kemp</p>
2008-10-19http://www.calormen.com/Applesoft/200810192008-10-19T12:00:00-08:00
<p>Added TEXT ADVENTURE sample by Floyd McWilliams.</p>
<p>Allow string literals to be terminated by end-of-line (suggested by Mike Kienenberger for compatibility)</p>
2008-09-18http://www.calormen.com/Applesoft/200809182008-09-18T12:00:00-08:00
<p>Fixed a case where syntax errors were ignored</p>
2008-09-17http://www.calormen.com/Applesoft/200809172008-09-17T12:00:00-08:00
<p>Fixed input focus to work in Google Chrome</p>
<p>
Fixed <code>READ</code> to support multiple variables, e.g. <code>READ I,J,S$</code>
</p>
2008-08-23http://www.calormen.com/Applesoft/200808232008-08-23T12:00:00-08:00
<p>Added Save/Load buttons that let you save your work to a cookie</p>
<p>Added DRAWING PROGRAM sample by Brian Broker</p>
<p>Fixed power operator (^) which wasn't being parsed correctly</p>
<p>Fixed subtle bug with string comparisons (result was double-typed as number and string)</p>
2008-05-01http://www.calormen.com/Applesoft/200805012008-05-01T12:00:00-08:00
<p>
Fixed <code>NEXT I,J,...</code> to terminate multiple loops - thanks to Scott Alfter for pointing this out
</p>
<p>
Bowing to popular demand, it now supports <code>?</code> as an alias for <code>PRINT</code>
</p>
2008-03-15http://www.calormen.com/Applesoft/200803152008-03-15T12:00:00-08:00
<p>
Implemented <code>ONERR GOTO line</code> and <code>RESUME</code>, including <code>POKE 216,0</code>
</p>
<p>Added demo for ONERR, added ONERR support to sequential file access demo</p>
<p>Fix hires graphics on Safari - not sure when it broke</p>
2008-03-14http://www.calormen.com/Applesoft/200803142008-03-14T12:00:00-08:00
<p>
Code cleanup c/o <a href="http://www.jslint.com">jslint.com</a>
</p>
<p>
Bug fix: <code>INPUT A,B,C</code> no longer worked. Probably mis-re-factored at some point.
</p>
2007-12-08http://www.calormen.com/Applesoft/200712082007-12-08T12:00:00-08:00
<p>
Implement file writing (to client-side VFS only), including <code>APPEND</code> operations
</p>
<p>
Added DOS <code>DELETE</code> command
</p>
<p>
<code>GR</code> does implicit <code>HTAB 1 : VTAB 24</code>
</p>
<p>
<code>PEEK(49168)</code> has the same effect as <code>POKE 49168,N</code>
</p>
<p>
As a convenience, <code>PEEK</code> and <code>POKE</code> at 49200/-16336 (speaker toggle) now accepted, but a no-op
</p>
<p>
As a convenience, spaces now accepted before <code>=</code> for<code>COLOR=</code> and <code>HCOLOR=</code>
</p>
2007-11-22http://www.calormen.com/Applesoft/200711222007-11-22T12:00:00-08:00
<p>Added button to submit your sample (via email) for inclusion</p>
<p>Added SIMPLE.PONG sample c/o USENET post by mad.scientist.jr</p>
<p>Improved comment handling (doesn't tokenize)</p>
2007-10-22http://www.calormen.com/Applesoft/200710222007-10-22T12:00:00-08:00
<p>
Make <code>GET</code> support keyboard flag, so <code>IF PEEK(-16384) > 127 THEN GET A$</code> works
</p>
2007-10-20http://www.calormen.com/Applesoft/200710202007-10-20T12:00:00-08:00
<p>Bug fix: User could type after hitting Stop. Now TTY state is reset.</p>
<p>
Added missing statement: <code>ON expr GOSUB ...</code>
</p>
<p>
<code>RND(0)</code> returns last, negative reseeds
</p>
2007-10-14http://www.calormen.com/Applesoft/200710142007-10-14T12:00:00-08:00
<p>Fixed location of paddle button 3 (C060)</p>
2007-09-22http://www.calormen.com/Applesoft/200709222007-09-22T12:00:00-08:00
<p>
Implemented scaling in <a target="_blank" href="http://excanvas.sourceforge.net/">
ExplorerCanvas</a> (<a target="_blank" href="excanvas.js">source</a>); hires now scaled somewhat correctly in IE
</p>
<p>Bug fixes: HOME would force full-screen text; HPLOT can now plot a single pixel</p>
2007-09-20http://www.calormen.com/Applesoft/200709202007-09-20T12:00:00-08:00
<p>
Added hires support via <a target="_blank" href="http://www.whatwg.org/specs/web-apps/current-work/#canvas">canvas</a> tag
</p>
<p>Display switches (POKE 49232...49239, not counting page 2) supported.</p>
<p>Added text window support: POKE 32,left : POKE 33,width : POKE 34,top : POKE 35,bottom</p>
2007-09-16http://www.calormen.com/Applesoft/200709162007-09-16T12:00:00-08:00
<p>
Added full screen lores support via <a target="_blank" href="reference.htm#Poke">POKE</a> 29234,0
</p>
<p>Fixed keyboard input on Safari - hacky, but logical</p>
2007-09-15http://www.calormen.com/Applesoft/200709152007-09-15T12:00:00-08:00
<p>Added Mandelbrot set demo to DEMOS</p>
<p>
Added <a target="_blank" href="reference.htm#Peek">PEEK</a> and <a target="_blank" href="reference.htm#Poke">POKE</a> shims
</p>
<p>Added paddle buttons: Home = 0 = Open Apple, End = 1 = Solid Apple, Page Up = 2, Page Down = 3</p>
<p>Added Caps Lock (defaults to on; real Caps Lock key toggles it; this means it usually ends up in an inverted state)</p>
<p>Round numerical results to 8 decimal places (hacky)</p>
2007-09-10http://www.calormen.com/Applesoft/200709102007-09-10T12:00:00-08:00
<p>Added demo file links, cleaned up UI a bit.</p>
<p>Added hacky PR#0/PR#3 support (to set 40 columns)</p>
2007-09-09http://www.calormen.com/Applesoft/200709092007-09-09T12:00:00-08:00
<p>Execute multiple steps before yielding. Increases perceived performance by about 10x.</p>
<p>Adjust lores colors per Linards Ticmanis on comp.sys.apple2.</p>
<p>Added Joystick, reorganized web pages</p>
2007-09-04http://www.calormen.com/Applesoft/200709042007-09-04T12:00:00-08:00
<p>Added MON/NOMON support.</p>
<p>Fixed bugs with: READ into arrays, two argument MID$, e-format number parsing, DOS null command</p>
2007-09-03http://www.calormen.com/Applesoft/200709032007-09-03T12:00:00-08:00
<p>Bugfixes: SPC() and TAB() followed by ; in PRINT statements. DOS parameter lists can include spaces.</p>
2007-09-02http://www.calormen.com/Applesoft/200709022007-09-02T12:00:00-08:00
<p>Oops - FRE is a function not a statement. Fixed!</p>
2007-09-01http://www.calormen.com/Applesoft/200709012007-09-01T12:00:00-08:00
<p>Implemented DATA/READ/RESTORE</p>
2007-08-31http://www.calormen.com/Applesoft/200708312007-08-31T12:00:00-08:00
<p>Implemented DEF FN</p>
2007-08-30http://www.calormen.com/Applesoft/200708302007-08-30T12:00:00-08:00
<p>Implemented DIM. File reads complete.</p>
2007-08-27http://www.calormen.com/Applesoft/200708272007-08-27T12:00:00-08:00
<p>
Added preliminary <a target="_blank" href="reference.htm#DOSQuickReference">DOS implementation</a>. Sequential access read only; there's a file called "JABBERWOCKY" to try.
</p>
2007-08-24http://www.calormen.com/Applesoft/200708242007-08-24T12:00:00-08:00
<p>Fixed bugs with string variables, key presses in IE, and HTML tweaks for better layout and lo-res sizing</p>
2007-06-05http://www.calormen.com/Applesoft/200706052007-06-05T12:00:00-08:00
<p>Added paddle support (PDL)</p>
2007-06-03http://www.calormen.com/Applesoft/200706032007-06-03T12:00:00-08:00
<p>Added lores graphics support (GR, PLOT, HLIN, VLIN, COLOR=, SCRN)</p>
2007-05-01http://www.calormen.com/Applesoft/200705012007-05-01T12:00:00-08:00
<p>Extracted step mechanism from interpreter, so web page can introduce delays; no longer case-sensitive to keywords</p>
2007-04-29http://www.calormen.com/Applesoft/200704292007-04-29T12:00:00-08:00
<p>Fixed command-line mode again</p>
2007-04-27http://www.calormen.com/Applesoft/200704272007-04-27T12:00:00-08:00
<p>Added screen emulation (e.g. HOME, HTAB, VTAB) and input (e.g. GET)</p>
2007-04-24http://www.calormen.com/Applesoft/200704242007-04-24T12:00:00-08:00
<p>Integrated into browser (display and event model)</p>
2007-04-21http://www.calormen.com/Applesoft/200704212007-04-21T12:00:00-08:00
<p>Project started; interpreter functional via WSH on Windows</p>