A compact BASIC interpreter for CP/M systems, originally designed for 8080/Z80 microprocessors. This is a restored and debugged version with comprehensive test coverage.
SCELBAL is a small BASIC interpreter that fits in less than 9KB of code. It provides essential BASIC functionality including:
- Integer and floating-point arithmetic
- Variables and arrays
- Built-in functions (INT, ABS, SGN, SQR, RND, TAB, CHR)
- Control structures (FOR/NEXT, IF/THEN, GOTO, GOSUB/RETURN)
- Input/Output (PRINT, INPUT)
- Program management (LIST, RUN, SAVE, LOAD)
Current Status: 38/39 tests passing (97% functional)
um80- MACRO-80 compatible assemblerul80- MACRO-80 compatible linker- 8080/Z80 emulator or CP/M system for testing
cd src
um80 scelbal.mac # Assembles to scelbal.rel
ul80 scelbal.rel # Links to scelbal.comThe output is a CP/M .COM file that can run on any CP/M-compatible system or emulator.
On a CP/M system or emulator:
A> scelbal
SCELBAL 1.0
READY
> 10 PRINT "HELLO WORLD"
> 20 END
> RUN
HELLO WORLD
READY
>
Comprehensive test suite with 39 tests covering all language features:
cd src
bash quick_test.sh # Run quick test suite
bash run_test_suite.sh # Run full test suite with detailed outputTest categories:
- Basic arithmetic
- Parentheses and operator precedence
- Negative numbers
- Decimal numbers
- Built-in functions
- Comparison operators
- Complex expressions
- Language Manual - Complete SCELBAL language reference
- Bug Fixes - History of bugs found and fixed
- Test Documentation - Test suite documentation
This version includes significant bug fixes:
- SQR Function Fix - Fixed stack corruption in square root calculation
- FA Stack Fix - Corrected function/array stack pointer management
- Decimal Arithmetic - Fixed floating-point parsing and arithmetic
- Parentheses Precedence - Fixed operator precedence in parenthesized expressions (11 tests fixed)
See BUGS_FOUND.md for complete fix history.
PRINT((5))without space returns empty (workaround: usePRINT ((5))with space)
This is a minor tokenization edge case that can be avoided with standard BASIC spacing.
scelbal/
├── src/
│ ├── scelbal.mac # Main assembly source
│ ├── scelbal.com # Compiled CP/M binary
│ ├── quick_test.sh # Quick test runner
│ ├── run_test_suite.sh # Full test suite
│ └── trace_scelbal.cc # C++ emulator for debugging
├── docs/
│ └── scelbal_language_manual.md
└── README.md
SCELBAL was originally written for the Intel 8080 microprocessor and published in the late 1970s. This version has been restored from the original source and debugged using modern emulation and automated testing.
Original public domain software, restored and improved.
Bug reports and fixes welcome! Please include:
- Minimal BASIC program that demonstrates the issue
- Expected vs actual output
- Test case that can be added to the test suite
- 80un - Unpacker for CP/M compression and archive formats (LBR, ARC, squeeze, crunch, CrLZH)
- cpmdroid - Z80/CP/M emulator for Android with RomWBW HBIOS compatibility and VT100 terminal
- cpmemu - CP/M 2.2 emulator with Z80/8080 CPU emulation and BDOS/BIOS translation to Unix filesystem
- ioscpm - Z80/CP/M emulator for iOS and macOS with RomWBW HBIOS compatibility
- learn-ada-z80 - Ada programming examples for the uada80 compiler targeting Z80/CP/M
- mbasic - Modern MBASIC 5.21 Interpreter & Compilers
- mbasic2025 - MBASIC 5.21 source code reconstruction - byte-for-byte match with original binary
- mbasicc - C++ implementation of MBASIC 5.21
- mbasicc_web - WebAssembly MBASIC 5.21
- mpm2 - MP/M II multi-user CP/M emulator with SSH terminal access and SFTP file transfer
- romwbw_emu - Hardware-level Z80 emulator for RomWBW with 512KB ROM + 512KB RAM banking and HBIOS support
- uada80 - Ada compiler targeting Z80 processor and CP/M 2.2 operating system
- ucow - Unix/Linux Cowgol to Z80 compiler
- um80_and_friends - Microsoft MACRO-80 compatible toolchain for Linux: assembler, linker, librarian, disassembler
- upeepz80 - Universal peephole optimizer for Z80 compilers
- uplm80 - PL/M-80 compiler targeting Intel 8080 and Zilog Z80 assembly language
- z80cpmw - Z80 CP/M emulator for Windows (RomWBW)