Applesoft BASIC Interpreter in Javascript
By Joshua Bell
| Applesoft BASIC Quick Reference
| Notes
| Known Issues
| To Do
| Links
| History
Welcome Slashdot! Be sure to check out my other Apple II retrocomputing project: vnIIc
Enter code below
Select a file...
DEMOS
TRADER
SIMPLE.PONG
HACKER LOGO (markwstock)
RANDOM LORES (John Melesky)
RANDOM HIRES (John Melesky)
PRIME SIEVE (Kevin Miller)
SIERPINSKI TRIANGLES (Kevin Miller)
STRING ART (Chris Heric)
Show Input Devices
It can be run from the command line on Windows. Download basic.js and run as: cscript basic.js myprogram.txt
Handling of source code that does not match the canonical LIST output format may not behave as on an Apple
Keyword parsing differs from Applesoft command line. For example COLOR =
is not parsed as the COLOR=
keyword; FOR I = S TO P
doesn't collapse into FOR I = STOP
The interpreter doesn't actually care about line numbers for statement ordering (just for GOTO/GOSUB targets and IF statements). So 20 PRINT "A", 10 PRINT "B"
will just print A, then B
Text display is 80 columns. Lores display is 40 columns (single-lores, not double-lores as found on the //c+)
Commands that refer to assembly routines (CALL, USR etc.), shape tables, or tape I/O are not implemented.
Commands that operate on the program itself (LIST, RUN, DEL, etc.) are not yet implemented.
Only primary graphics pages are supported (no HGR2)
Pri 1: Treat correctly handele line numbers
2008-05-01:
Fixed NEXT I,J,...
to terminate multiple loops - thanks to Scott Alfter for pointing this out
Bowing to popular demand, it now supports ?
as an alias for PRINT
2008-03-15:
Implemented ONERR GOTO line
and RESUME
, including POKE 216,0
Added demo for ONERR, added ONERR support to sequential file access demo
Fix hires graphics on Safari - not sure when it broke
2008-03-14:
Code cleanup c/o jslint.com
Bug fix: INPUT A,B,C
no longer worked. Probably mis-re-factored at some point.
2007-12-08:
Implement file writing (to client-side VFS only), including APPEND
operations
Added DOS DELETE
command
GR
does implicit HTAB 1 : VTAB 24
PEEK(49168)
has the same effect as POKE 49168,N
As a convenience, PEEK
and POKE
at 49200/-16336 (speaker toggle) now accepted, but a no-op
As a convenience, spaces now accepted before =
forCOLOR=
and HCOLOR=
2007-11-22:
Added button to submit your sample (via email) for inclusion
Added SIMPLE.PONG sample c/o USENET post by mad.scientist.jr
Improved comment handling (doesn't tokenize)
2007-10-22:
Make GET
support keyboard flag, so IF PEEK(-16384) > 127 THEN GET A$
works
2007-10-20:
Bug fix: User could type after hitting Stop. Now TTY state is reset.
Added missing statement: ON expr GOSUB ...
RND(0)
returns last, negative reseeds
2007-10-14:
Fixed location of paddle button 3 (C060)
2007-09-22:
Implemented scaling in ExplorerCanvas (source ); hires now scaled somewhat correctly in IE
Bug fixes: HOME would force full-screen text; HPLOT can now plot a single pixel
2007-09-20:
Added hires support via canvas tag
Display switches (POKE 49232...49239, not counting page 2) supported.
Added text window support: POKE 32,left : POKE 33,width : POKE 34,top : POKE 35,bottom
2007-09-16:
Added full screen lores support via POKE 29234,0
Fixed keyboard input on Safari - hacky, but logical
2007-09-15:
Added Mandelbrot set demo to DEMOS
Added PEEK and POKE shims
Added paddle buttons: Home = 0 = Open Apple, End = 1 = Solid Apple, Page Up = 2, Page Down = 3
Added Caps Lock (defaults to on; real Caps Lock key toggles it; this means it usually ends up in an inverted state)
Round numerical results to 8 decimal places (hacky)
2007-09-10:
Added demo file links, cleaned up UI a bit.
Added hacky PR#0/PR#3 support (to set 40 columns)
2007-09-09:
Execute multiple steps before yielding. Increases perceived performance by about 10x.
Adjust lores colors per Linards Ticmanis on comp.sys.apple2.
Added Joystick, reorganized web pages
2007-09-04:
Added MON/NOMON support.
Fixed bugs with: READ into arrays, two argument MID$, e-format number parsing, DOS null command
2007-09-03:
Bugfixes: SPC() and TAB() followed by ; in PRINT statements. DOS parameter lists can include spaces.
2007-09-02:
Oops - FRE is a function not a statement. Fixed!
2007-09-01:
Implemented DATA/READ/RESTORE
2007-08-31:
Implemented DEF FN
2007-08-30:
Implemented DIM. File reads complete.
2007-08-27:
Added preliminary DOS implementation . Sequential access read only; there's a file called "JABBERWOCKY" to try.
2007-08-24:
Fixed bugs with string variables, key presses in IE, and HTML tweaks for better layout and lo-res sizing
2007-06-05:
Added paddle support (PDL)
2007-06-03:
Added lores graphics support (GR, PLOT, HLIN, VLIN, COLOR=, SCRN)
2007-05-01:
Extracted step mechanism from interpreter, so web page can introduce delays; no longer case-sensitive to keywords
2007-04-29:
Fixed command-line mode again
2007-04-27:
Added screen emulation (e.g. HOME, HTAB, VTAB) and input (e.g. GET)
2007-04-24:
Integrated into browser (display and event model)
2007-04-21:
Project started; interpreter functional via WSH on Windows