Skip to content

About

Applesoft BASIC in JavaScript w/ Modern Web IDE

Resources

Stars

0 stars

Watchers

0 watching

Forks

 
 

Repository files navigation

jsbasic - Applesoft BASIC in JavaScript

Try It Out!

https://midihax.github.io/jsbasic-xl/

About This Fork

This is a fork of inexorabletash/jsbasic, a JavaScript implementation of Applesoft BASIC. This fork focuses on modernizing the web UI and simplifying the app into a self-contained editor and interpreter, with no bundled sample content or server-side dependencies.

Improvements over the original:

  • Modern tabbed interface (Code / Output / Text Output / File Manager / LoRes Editor / Info) replacing the original single scrolling page.
  • Automatic light/dark mode, following the browser's own preference.
  • A File Manager tab to browse the virtual file system, and per-file Run, Edit, Download, and Delete actions, plus "Download Package" / "Upload Package" buttons to transfer every file as a single ZIP.
  • A LoRes Editor tab: a 40-column pixel grid (40 rows in Mixed mode, 48 in Full) for drawing Apple II lo-res graphics with the real 16-color palette, mouse or arrow-key/Space cell selection and painting, row/column-numbered borders, Download/Upload of the image as plain color,x,y text, and a "Create Program" button that generates a ready-to-run Applesoft program (GR + a DATA/READ/PLOT loop) from the drawing.
  • Save / Save As buttons to write the current program directly to the virtual file system, with filename validation (.BAS extension enforced, 15-character limit, letters/numbers/periods only, overwrite protection).
  • Keyboard shortcuts: Ctrl/Cmd+R to Run, Ctrl/Cmd+S to Save, active only when the corresponding button is available.
  • The virtual file system is entirely browser-local (localStorage) - DOS 3.3 file I/O (OPEN/READ/WRITE/etc.) no longer makes any network requests.
  • A dedicated Text Output tab with a persistent, copyable plain-text transcript of program output.
  • A redesigned icon set and a code editor that fill the tab and match the active theme.
  • Removed the bundled sample programs and seed VFS files, and the mailto-based "Share" feature, so the app ships as a bare editor and interpreter.

External Dependencies

There's no build step or package install - index.html loads everything it needs straight from public CDNs at runtime:

  • CodeMirror 5.61.1 (via cdnjs) - the syntax-highlighting code editor on the Code tab.
  • JSZip 3.10.1 (via cdnjs) - builds and reads the .zip archives behind File Manager's "Download Package" / "Upload Package" buttons.
  • inexorabletash/polyfill v0.1.29 (via jsDelivr) - polyfill.min.js and keyboard.js, small compatibility shims for older/nonstandard browser behavior.

Notes & Known Issues

  • The BASIC program is compiled to JavaScript before execution. Syntax errors are therefore detected at compile-time rather than at run-time as on a traditional interpreter. For example, the following program would run without errors on an Apple since the erroneous second statement is never reached. 10 END : CHR$(PRINT)
  • Handling of BASIC 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 FOR I = S TO P doesn't collapse into FOR I = STOP.
  • Limitations:
    • Floating point overflow is only detected on variable assignment.
    • Only a subset of DOS 3.3 and ProDOS useful for basic file I/O are implemented.
    • Only a small number of common PEEK, POKE and CALL locations are supported.
    • Commands that refer to assembly routines (&, USR() etc.), shape tables, and tape I/O are not implemented.
  • Commands that operate on the program itself (LIST, RUN, DEL, etc.) are not implemented.
  • A handful of extensions are made beyond Applesoft BASIC:
    • To improve readability, lines may start with : and continue the previously numbered line.
    • DEF FN can define string functions
    • == can be used as =
    • CHR$() values > 255 do interesting things
    • HSCRN(x, y) allows probing the hi-res screen
    • hexadecimal literals e.g. $C010 can be used as numbers

About

Applesoft BASIC in JavaScript w/ Modern Web IDE

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages