MBASIC-2025 Documentation¶
Welcome to the complete documentation for MBASIC-2025, a Python implementation of MBASIC-80 for CP/M.
What is MBASIC-2025?¶
MBASIC 5.21 is a classic BASIC dialect from the CP/M era (late 1970s - early 1980s). MBASIC-2025 provides 100% compatibility with MBASIC 5.21 programs while offering modern user interfaces and cross-platform support.
Quick Links¶
-
Getting Started
Install MBASIC and write your first program in minutes
-
Language Reference
Complete BASIC-80 language documentation with all 63 statements and 40 functions
-
User Interfaces
Choose your interface: Curses (terminal), CLI (command-line), Tkinter (GUI), or Web (browser)
-
Implementation Details
Learn about the interpreter architecture, features, and compatibility
-
Compilers
Compile BASIC to CP/M executables OR JavaScript - TWO backends, 100% feature complete!
-
Games Library
Browse 113 classic BASIC games from the CP/M era - ready to run!
-
Source Code
View the source, report issues, and contribute on GitHub
Key Features¶
- ✅ THREE Complete Implementations - Interactive interpreter AND two compiler backends (Z80/8080 + JavaScript)
- ✅ 100% MBASIC 5.21 Compatibility - Run authentic MBASIC programs unchanged
- ✅ Generates CP/M Executables - Compile to native .COM files for 8080 or Z80 processors
- ✅ Generates JavaScript - Compile to standalone JavaScript for browsers and Node.js
- ✅ Multiple User Interfaces - CLI, Curses terminal, Tkinter GUI, or Web browser
- ✅ Cross-Platform - Linux, macOS, Windows
- ✅ Zero Dependencies - Pure Python, no external libraries required for interpreter
- ✅ Hardware Access - Full PEEK/POKE/INP/OUT support in Z80/8080 compiled code
- ✅ Complete Documentation - Comprehensive help for every feature
Documentation Structure¶
This documentation is organized into four tiers:
1. User Interfaces (📘)¶
Interface-specific documentation for each UI:
- Curses UI - Full-screen terminal interface
- CLI - Classic command-line REPL
- Tkinter GUI - Graphical interface
- Web IDE - Browser-based interface
2. MBASIC Interpreter (📗)¶
Implementation-specific documentation:
- Getting Started - Installation and first steps
- Features - What's implemented
- Compatibility - Differences from CP/M MBASIC
- Architecture - How it works
3. MBASIC Compilers (🔧)¶
Compiler documentation for both backends:
- Compiler Guide - Getting started with Z80/8080 and JavaScript compilers
- Z80/8080 Setup - Installing z88dk for CP/M targets
- Feature Status - 100% complete feature list
- CP/M Emulator - Testing Z80/8080 compiled programs
4. BASIC-80 Language (📕)¶
Complete language reference:
- Statements - All 63 BASIC-80 statements
- Functions - All 40 built-in functions
- Operators - Arithmetic, logical, relational
- Appendices - Error codes, ASCII table
Quick Start¶
Installation¶
# Clone the repository
git clone https://github.com/avwohl/mbasic.git
cd mbasic
# Create virtual environment (recommended)
python3 -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
# Install optional dependencies
pip install -r requirements.txt
Your First Program¶
Start the Curses UI:
Type your program:
Press Ctrl+R to run!
Example Programs¶
Classic "Hello, World!"¶
FOR Loop¶
User Input¶
File I/O¶
10 OPEN "O", #1, "output.txt"
20 PRINT #1, "This is a test"
30 CLOSE #1
40 PRINT "File written!"
50 END
Platform Support¶
- Linux - Ubuntu, Debian, Fedora, Arch
- macOS - 10.14+
- Windows - 10, 11, WSL
- Python - 3.8+ (3.10+ recommended)
Contributing¶
MBASIC is open source! Contributions are welcome:
- Report issues on GitHub
- Submit pull requests
- Improve documentation
- Share example programs
License¶
See the project repository for license information.
Ready to get started? Head to the Installation Guide or browse the Language Reference!