Sinclair BASIC for Visual Studio Code
A comprehensive VS Code extension for developing Sinclair ZX Spectrum BASIC applications, supporting both Standard Sinclair BASIC ( Universal Extension: Fully compatible with both VS Code Desktop and VS Code for the Web (vscode.dev & github.dev) with 0 installation requirements. Features1. Dual Language Support
2. Autocompletion & IntelliSense (
|
| Command | Identifier | Shortcut | Description |
|---|---|---|---|
| Compile JBAS to TAP | sinclairBasic.compileJBas |
Ctrl+Shift+B |
Generates .bas versions in dist/ (including <name>.sinclair.bas translating bas2tap wildcards to standard CHR$) and builds .tap from the optimal 1x1 version. |
| Transpile JBAS to BAS | sinclairBasic.transpileJBas |
Ctrl+Shift+T |
Generates 4 versions in dist/ (<name>.bas 1x1, <name>-step10.bas, <name>-comments.bas, and <name>.sinclair.bas with standard CHR$) and opens step10 in editor. |
| Compile BAS to TAP | sinclairBasic.compileBas / buildTap |
Ctrl+Shift+B |
Compiles .bas directly to .tap and generates dist/<name>.sinclair.bas translating bas2tap wildcards to standard CHR$. |
| Share on Turbo80.com | sinclairBasic.shareTurbo80 |
— | Compiles/locates .tap, uploads it, and copies a ready-to-play https://turbo80.com/?load=... link to clipboard. |
| Format Keywords to Uppercase | sinclairBasic.formatKeywords |
Shift+Alt+F |
Formats document or selection converting all Sinclair BASIC keywords to uppercase (preserving strings and comments). |
| Renumber BAS Lines (.bas) | sinclairBasic.renumber / renumberBas |
Ctrl+Alt+R |
Renumbers lines in .bas (10 by 10) and updates all jump references (GOTO, GOSUB, RESTORE, etc.). |
| Run in Emulator | sinclairBasic.runEmulator |
Ctrl+F5 |
Compiles to TAP and launches the configured emulator (built-in Turbo80 Webview or external Fuse). |
| Run in Web Emulator (Turbo80) | sinclairBasic.runTurbo80 |
— | Forces execution in the built-in Turbo80 web emulator tab. |
| Run in External Emulator | sinclairBasic.runExternalEmulator |
— | Forces execution in the configured external desktop emulator. |
Configuration Settings
You can customize the extension via VS Code Settings (settings.json):
{
"sinclairBasic.emulatorType": "turbo80",
"sinclairBasic.turbo80Model": "48k",
"sinclairBasic.turbo80Crt": true,
"sinclairBasic.emulatorPath": "C:\\Program Files (x86)\\Fuse\\fuse.exe",
"sinclairBasic.emulatorArgs": [],
"sinclairBasic.outputDirectory": "dist",
"sinclairBasic.autoStartLine": 0,
"sinclairBasic.renumberStart": 10,
"sinclairBasic.renumberStep": 10,
"sinclairBasic.optimizePrintAttributes": true
}
sinclairBasic.optimizePrintAttributes: Enabled by default (true). Automatically folds constantPRINTattributes (AT,PAPER,INK,FLASH,BRIGHT, etc.) into compact control code strings for peak ZX Spectrum execution speed while letting developers write standard, natural Sinclair BASIC in.jbas.sinclairBasic.emulatorType: Set to"turbo80"(default, opens embedded web emulator) or"external"(launches Fuse or desktop emulator).sinclairBasic.turbo80Model: Emulated ZX Spectrum machine (48k,128k,plus2,plus2a,plus3,16k).sinclairBasic.turbo80Crt: Enables/disables authentic CRT television shader filter.sinclairBasic.autoStartLine: When set to0, the extension automatically detects the first line number in the BASIC file.
Acknowledgements & Credits
- Turbo80: The built-in web emulator is powered by Turbo80 created by José Enrique García (Incinerator). We are deeply grateful for this wonderful web-based ZX Spectrum emulator.
Development & Debugging
- Clone and open this repository in Visual Studio Code:
git clone https://github.com/rtorralba/vscode-sinclair-basic.git cd vscode-sinclair-basic code . - Press
F5(or go to Run and Debug -> Run Sinclair BASIC Extension). - A new Extension Development Host window will open.
- Open any
.basor.jbasfile (such as in your game project) and test syntax highlighting, commands, and shortcuts!
Running Automated Tests
Run the standalone Node test runner (zero external dependencies required):
npm test
License & Copyright
GNU Affero General Public License v3.0 (AGPL-3.0).
Copyright (C) 2026 Raül Torralba.
Renuncia de garantía / Disclaimer (AS IS): El software se proporciona "tal cual" (AS IS), sin garantía de ningún tipo, expresa o implícita. En ningún caso el autor será responsable de ningún reclamo, daño u otra responsabilidad derivada del uso de este software.
See the full LICENSE file for complete details.
Acknowledgements & Special Attribution / Mención Especial
- Turbo80: Built-in ZX Spectrum web emulation and instant game sharing powered by Turbo80, created by José Enrique García (Incinerator). Special thanks and attribution for his outstanding contribution to the retrocomputing community.