This is an old revision of the document!
Table of Contents
SD-8516 Stellar Basic V1.0
Dennis Allison’s 1975 article in Dr. Dobb’s Journal was a key moment in the history of Computer Science. It contained a formal specification of Tiny BASIC, a BASIC that could be implemented in less than 4 KB.
Stellar BASIC is very much in the same vein as Tiny BASIC, and is intended to evolve over time.
Core features
- Line-numbered programs
LET(often optional)PRINTINPUTIF-THENGOTOGOSUBandRETURNFOR-NEXT- Usually only access to integer variables and integer based math
- Single letter variables (ex.
A,B,Z)
- No floating-point math
- Very limited strings
- No arrays
- No file I/O
- Minimal error messages
- Very limited editing commands
Some versions stored programs as text, some as tokenized program code to save space.
Example BASIC program
10 LET A = 1 20 PRINT A 30 A = A + 1 40 IF A <= 10 THEN GOTO 20 50 END
Stellar BASIC will allow this even shorter form:
10 A=1 20 ?A 30 A=A+1 40 IF A<=10 GOTO 20
(? is shorthand for PRINT.)
More Information
Notable Tiny BASIC implementations
- Palo Alto Tiny BASIC (Dennis Allison)
- Li-Chen Wang’s Tiny BASIC
- 6800 Tiny BASIC
- NASCOM Tiny BASIC
- Apple I BASIC (inspired by Tiny BASIC ideas)
- Micro-Soft 8080 BASIC (larger, but influenced by Tiny BASIC work)
Appendix I: Pao Alto Tiny Basic
Stellar Basic is based on Pao Alto Tiny Basic, written by Dennis Allison in 1975. I implemented it in this order:
- Phase 1: Variable management (3 functions: get, set, clear_all)
- Expression stack (4 functions: push, pop, peek, clear)
- I/O & String Helpers (ex. IO_GETNUM)
- String comparison, number parsing (ex. STR_SKIP_SPACE)
- Phase 2: Stack Operations
- GOSUB/RETURN stack (3 functions)
- FOR/NEXT stack (4 functions)
- Phase 3: Program Line Management
- Find line by number
- Insert/delete lines
- Navigate through program (first line, next line)
- Program storage with line markers (opcode 251)
- Phase 4: IL Interpreter Core;
- Design IL bytecode table (~30-40 IL opcodes)
- IL fetch/decode/execute loop
- Expression evaluation using the stack
- Control flow (GOTO, GOSUB, IF/THEN, FOR/NEXT)
- Phase 5: BASIC Commands (~15-20%)
- PRINT, INPUT, LET
- RUN, LIST, NEW, CLEAR
- Integrate with term.ts to highlight a “Boot-to-basic” experience.
- Phase 6: Testing & Polish (~5%)
- End-to-end BASIC program tests
- Error handling and status messages
- Bug fixes
- Performance tuning
Stack-based design
Everything in PATB is stack-based. This is a core design principle. There are three stacks:
- Expression Stack - Arithmetic evaluation
- “5 + 3 * 2” is “push 5”, “push 3”, “push 2”, “multiply” (pop 2 values, push result), “add” (pop 2 values, push result).
- GOSUB Stack - Subroutine calls
- “GOSUB 1000” – push current line number, jump to 1000
- “RETURN” – pop line number, jump back
- FOR Stack - Loop context
- “FOR I=1 TO 10” – push (I, 10, 1)
- “NEXT I” – peek stack, increment I, check if done, pop if finished
