Hi,
I have been enjoying working on the LOGO parser and it inspired me to look at an AppleSoft Basic interpreter that I started over a year ago without too much success. The attached files include a fairly well-along AppleSoft Basic interpreter and a file of test programs that all work. Most of the explanation of what is going on is in the stack script header.
Once I have the rest of the text-based commands working I will start work on implementing Apple IIe graphic modes (I also want to include SHR modes like on the IIGS and what I think a IIGS+ with a 65832 processor may have been capable...why not?)
It is far enough along I thought it might be of interest.
-Mike
[ 12/5: Updated version v2.7.0 posted below, see stack script header for version history. ]
AppleSoft Basic Interpreter Project
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
AppleSoft Basic Interpreter Project
- Attachments
-
- AppleSoft Basic Interpreter v2.7.0_ Build 120525.livecode.zip
- (25.5 KiB) Downloaded 5 times
-
- 2. Working Demo Programs.zip
- (2.89 KiB) Downloaded 196 times
-
- 1. Test Programs.zip
- (30.88 KiB) Downloaded 223 times
Last edited by Hutchboy on Sat Dec 06, 2025 3:34 am, edited 2 times in total.
Re: AppleSoft Basic Interpreter Project
Mike.
Hard for me to understand what this rather hefty stack does. Can you give a short tutorial?
Craig
Hard for me to understand what this rather hefty stack does. Can you give a short tutorial?
Craig
Re: AppleSoft Basic Interpreter Project
Mike:
Another supreme effort! I enjoyed the test programs.
The answer to Test #3, however, does not seem correct.
It should go to Line 50 but, instead, it goes to Line 30 and prints FAIL.
Otherwise, the test programs were all sucessful.
What a project!
Bob
Another supreme effort! I enjoyed the test programs.
The answer to Test #3, however, does not seem correct.
It should go to Line 50 but, instead, it goes to Line 30 and prints FAIL.
Otherwise, the test programs were all sucessful.
What a project!
Bob
Re: AppleSoft Basic Interpreter Project
Craig,
The stack is an AppleSoft Basic Interpreter. It will eventually be able to run most AppleSoft Basic programs. When I am to the point where I can run interesting demos I will add those as a kind of tutorial. In the meantime Google "online AppleSoft Basic" and you will see examples of really good interpreters.
Bob,
Thanks. In the test programs I think I need to remove any semi-colon comments at the top line and just run the actual line numbers. Right now I am much farther along and am working onv2.3. Here is my roadmap:
v2.3 — Control-flow enrichments
ON GOTO / ON GOSUB
STOP / CONT scaffolding
v2.4 — INPUT upgrades
Multiple targets: INPUT "Prompt"; A, B$, C(I) with comma parsing & coercion, quoted strings respected.
Array targets allowed; graceful handling of too few/many inputs in one line.
Smoke tests: mixed numeric/string/array, empty input → default, whitespace/quotes, extra commas.
v2.5 — Core functions (minimal but useful)
Numeric: INT, ABS, SGN, SQR, RND (with RND(0), RND(1), RND(n) semantics).
String: LEN, LEFT$, RIGHT$, MID$, ASC, CHR$, VAL, STR$.
v2.6 — PRINT utilities
v2.7 — Polishing & Demo Time
v2.8+ — Graphic Modes, PEEKS & POKES, Kitchen Sink Demos
-Mike
The stack is an AppleSoft Basic Interpreter. It will eventually be able to run most AppleSoft Basic programs. When I am to the point where I can run interesting demos I will add those as a kind of tutorial. In the meantime Google "online AppleSoft Basic" and you will see examples of really good interpreters.
Bob,
Thanks. In the test programs I think I need to remove any semi-colon comments at the top line and just run the actual line numbers. Right now I am much farther along and am working onv2.3. Here is my roadmap:
v2.3 — Control-flow enrichments
ON GOTO / ON GOSUB
STOP / CONT scaffolding
v2.4 — INPUT upgrades
Multiple targets: INPUT "Prompt"; A, B$, C(I) with comma parsing & coercion, quoted strings respected.
Array targets allowed; graceful handling of too few/many inputs in one line.
Smoke tests: mixed numeric/string/array, empty input → default, whitespace/quotes, extra commas.
v2.5 — Core functions (minimal but useful)
Numeric: INT, ABS, SGN, SQR, RND (with RND(0), RND(1), RND(n) semantics).
String: LEN, LEFT$, RIGHT$, MID$, ASC, CHR$, VAL, STR$.
v2.6 — PRINT utilities
v2.7 — Polishing & Demo Time
v2.8+ — Graphic Modes, PEEKS & POKES, Kitchen Sink Demos
-Mike
Re: AppleSoft Basic Interpreter Project
Hi,
Just a short note that I posted an update to the AppleSoft BASIC interpreter in the first entry in this subject. This is v2.4 and I am currently well into v2.5 on my roadmap.
Also, I want to note that, for you tinkers, you can paste a copy of the stack script into a brand new stack, then type "preOpenStack" in the message box, and it will generate a duplicate of the v2.4 stack except the user interface layout will be slightly different ( I haven't incorporated my latest UI tweaks into the "createUI" handler section yet). You can easily change to a different color scheme or revise the layout as long as you don't break the naming conventions.
- Mike
Just a short note that I posted an update to the AppleSoft BASIC interpreter in the first entry in this subject. This is v2.4 and I am currently well into v2.5 on my roadmap.
Also, I want to note that, for you tinkers, you can paste a copy of the stack script into a brand new stack, then type "preOpenStack" in the message box, and it will generate a duplicate of the v2.4 stack except the user interface layout will be slightly different ( I haven't incorporated my latest UI tweaks into the "createUI" handler section yet). You can easily change to a different color scheme or revise the layout as long as you don't break the naming conventions.
- Mike
Re: AppleSoft Basic Interpreter Project
Hi,
I just uploaded v2.7.0 of my AppleSoft Basic Interpreter project in the first message in this topic. It has taken awhile getting here because I was pretty stumped trying to interpret Basic 2 dimensional arrays. The details of what is new in this and previous versions as well as what is planned is in the stack script header. This particular version implements throwing normal AppleSoft Basic error codes when an error is encountered.
I'm eager to get to implementing graphics but am proceeding methodically with lots of testing.
I've also updated my Github at https://github.com/mdroberts2017
-Mike
I just uploaded v2.7.0 of my AppleSoft Basic Interpreter project in the first message in this topic. It has taken awhile getting here because I was pretty stumped trying to interpret Basic 2 dimensional arrays. The details of what is new in this and previous versions as well as what is planned is in the stack script header. This particular version implements throwing normal AppleSoft Basic error codes when an error is encountered.
I'm eager to get to implementing graphics but am proceeding methodically with lots of testing.
I've also updated my Github at https://github.com/mdroberts2017
-Mike
