CLI Interface¶
The command-line interface (CLI) provides a traditional BASIC REPL experience.
Starting the CLI¶
Or run a program directly:
Command Mode¶
When you start MBASIC, you see the Ok prompt:
You can type:
- Direct commands - Execute immediately (e.g., PRINT 2+2)
- Program lines - Start with a line number (e.g., 10 PRINT "Hello")
- System commands - LIST, RUN, NEW, etc.
Direct Mode¶
Execute statements immediately without line numbers:
Program Mode¶
Enter program lines with line numbers:
Common Commands¶
| Command | Description |
|---|---|
| RUN | Run the current program |
| LIST | Display program lines |
| NEW | Clear the program from memory |
| SAVE "file" | Save program to disk |
| LOAD "file" | Load program from disk |
| RENUM | Renumber program lines |
| AUTO | Start automatic line numbering |
| SYSTEM | Exit MBASIC |
Line Editing¶
The CLI includes a line editor accessed with the EDIT command:
See: EDIT Command
Automatic Line Numbering¶
Use AUTO to enter lines without typing numbers:
Press {{kbd:stop:cli}} to stop AUTO mode.
See: AUTO Command
File Operations¶
Save your work:
Load a program:
Merge programs:
Error Messages¶
When an error occurs, MBASIC shows the error and line number:
Use EDIT to fix line 20.
Keyboard Shortcuts¶
| Key | Action |
|---|---|
| {{kbd:stop:cli}} | Interrupt running program |
| Ctrl+D | Exit MBASIC (Unix/Linux) |
| Ctrl+Z | Exit MBASIC (Windows) |
| Up/Down | Command history (if available) |
Tips¶
- Save often - Use SAVE after making changes
- Use AUTO - Faster than typing line numbers
- LIST before RUN - Check your program first
- RENUM regularly - Keep line numbers clean