Complete MMBasic language support for Visual Studio Code, including syntax highlighting and serial port communication for Micromite, PicoMite and other MMBasic devices.
Updated for PicoMite V6.02.00 - Syntax highlighting and autocomplete based on the official PicoMite User Manual.
- Full syntax highlighting for MMBasic keywords, functions, and commands
- Support for comments (
'andREM) - Number formats: decimal, hexadecimal (&H), binary (&B), octal (&O)
- Hardware and graphics command highlighting
- Code folding for blocks
- Smart code completion for keywords, functions, and commands
- Parameter hints with snippets
- Hover documentation with syntax examples
- Context-aware suggestions
- Browse files directly on your PicoMite device
- Upload/download files between computer and device
- Delete files remotely
- View A: (flash) and B: (SD card) drives
- Tree view in MMBasic sidebar
- Start debugging with F5
- Step through code with F10
- Inspect variable values during execution
- Evaluate expressions on the fly
- Debug output channel
- Variable inspection view
- Connect directly to MMBasic devices via serial port
- Send programs from VSCode to your device
- Execute code line-by-line or selections
- Interactive terminal output
- Run and stop programs remotely
- List files on the device
-
Clone or download this repository
-
Install dependencies
cd vscode-mmbasic npm install -
Compile the TypeScript code
npm run compile
-
Open in VSCode and test
- Press
F5to launch Extension Development Host - Open a
.basor.mmbfile
- Press
npm install -g @vscode/vsce
vsce packageThen install the .vsix file via Extensions β Install from VSIX...
- Connect your MMBasic device via USB
- Open the Command Palette (
Ctrl+Shift+PorCmd+Shift+P) - Run:
MMBasic: Connect to Device - Select your serial port from the list
Open VSCode settings and search for "MMBasic":
- Serial Port: Default port (e.g.,
COM3,/dev/ttyUSB0,/dev/tty.usbserial) - Baud Rate: Communication speed (default: 38400)
- Options: 9600, 19200, 38400, 57600, 115200
- Auto Connect: Automatically connect on startup
- Line Ending: Line termination for serial communication
Example settings.json:
{
"mmbasic.serialPort": "/dev/ttyUSB0",
"mmbasic.baudRate": 38400,
"mmbasic.autoConnect": false,
"mmbasic.lineEnding": "\\r\\n"
}All commands are available via Command Palette (Ctrl+Shift+P):
| Command | Keyboard Shortcut | Description |
|---|---|---|
MMBasic: Connect to Device |
- | Connect to serial port |
MMBasic: Disconnect from Device |
- | Disconnect from device |
MMBasic: Send Current File to Device |
Ctrl+Shift+U |
Upload entire file |
MMBasic: Send Selection to Device |
Ctrl+Enter |
Send selected code or current line |
MMBasic: Run Program on Device |
Ctrl+Shift+R |
Execute the program |
MMBasic: Stop Program |
- | Stop running program (Ctrl+C) |
MMBasic: List Files on Device |
- | Show files stored on device |
MMBasic: Clear Terminal |
- | Clear output window |
| Command | Description |
|---|---|
MMBasic: Refresh Files |
Reload file list from device |
MMBasic: Upload File to Device |
Upload local file |
MMBasic: Download File |
Download file from device |
MMBasic: Delete File |
Delete file from device |
| Command | Keyboard Shortcut | Description |
|---|---|---|
MMBasic: Start Debugging |
F5 |
Start debugging current file |
MMBasic: Stop Debugging |
Shift+F5 |
Stop debugging |
MMBasic: Step Over |
F10 |
Execute next line |
MMBasic: Continue |
F5 (in debug) |
Continue execution |
MMBasic: Inspect Variable |
- | View variable value |
MMBasic: Evaluate Expression |
- | Evaluate expression |
The status bar shows connection status:
- π MMBasic: Disconnected - Click to connect
- β MMBasic: Connected - Click to disconnect
The extension provides intelligent code completion as you type:
-
Start typing a keyword
- Type
forβ Get full FOR loop snippet - Type
ifβ Get IF...THEN...END IF structure - Type
subβ Get SUB...END SUB template
- Type
-
Function completion
- Type
printβ See PRINT with parameter hints - Type
sinβ Get SIN function with parameter placeholder - Type
lenβ Get LEN function ready to use
- Type
-
Hardware commands
- Type
setpinβ Get SETPIN with mode options (DIN, DOUT, etc.) - Type
pwmβ Get PWM with parameter placeholders - Type
i2cβ See I2C commands (OPEN, WRITE, READ, CLOSE)
- Type
-
Hover for help
- Hover over any keyword to see documentation
- Examples and syntax shown in tooltip
- Quick reference without leaving your code
- Write your MMBasic code:
' Blink LED example
SETPIN 13, DOUT
FOR i = 1 TO 10
PIN(13) = 1
PAUSE 500
PIN(13) = 0
PAUSE 500
NEXT i
PRINT "Done!"- Press
Ctrl+Shift+Uto send the file to the device - Press
Ctrl+Shift+Rto run the program
- Connect to your device
- Select a line or code block
- Press
Ctrl+Enterto execute it immediately - Watch the output in the MMBasic Serial terminal
Write some test code:
PRINT "Hello from MMBasic!"
x = 42
PRINT "The answer is "; xPlace cursor on any line and press Ctrl+Enter to execute just that line.
All serial communication appears in the MMBasic Serial output panel:
- Sent commands are prefixed with
> - Device responses appear in real-time
- Use
MMBasic: Clear Terminalto clear the output
Windows:
- Install USB-to-Serial drivers for your device
- Check Device Manager for COM port
macOS:
- Port appears as
/dev/tty.usbserial-*or/dev/tty.SLAB_USBtoUART - May need to install CH340 or FTDI drivers
Linux:
- Add user to
dialoutgroup:sudo usermod -a -G dialout $USER - Log out and back in
- Check
ls /dev/ttyUSB*orls /dev/ttyACM*
# Linux
sudo chmod 666 /dev/ttyUSB0
# Or add to dialout group (permanent)
sudo usermod -a -G dialout $USER- Verify correct baud rate (38400 is standard for MMBasic)
- Try different line endings in settings
- Close other applications using the serial port
- Power cycle your device
Make sure you have the correct Node.js version:
node --version # Should be v16 or higher
npm install
npm run compile.bas- BASIC files.mmb- MMBasic files
vscode-mmbasic/
βββ src/
β βββ extension.ts # Main extension entry point
β βββ serialPortManager.ts # Serial port handling
βββ syntaxes/
β βββ mmbasic.tmLanguage.json # Syntax highlighting
βββ package.json # Extension manifest
βββ tsconfig.json # TypeScript config
npm install
npm run compile
npm run watch # Auto-compile on changesPress F5 in VSCode to launch Extension Development Host.
Contributions welcome! To add features:
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
- Serial port selection doesn't auto-detect all device types
- No file download from device yet (planned feature)
- Line-by-line execution may have small delays
- Download programs from device
- Auto-detection of MMBasic devices
- Code snippets and IntelliSense
- Integrated debugger support
- File manager for device storage
- Terminal with command history
GPL v2 License
- MMBasic language by Geoff Graham
- Extension development for the MMBasic community
For issues or questions:
- Check the troubleshooting section
- Open an issue on GitHub
- Visit the MMBasic community forums
Happy coding with MMBasic! π