A VS Code devcontainer setup for BBC Basic and 6502 assembly programming on Apple Silicon Macs.
- π³ Docker-based development environment optimized for Apple Silicon
- π VS Code integration with syntax highlighting for BBC Basic and assembly files
- π§ Pre-configured build tasks for running BBC Basic programs
- βοΈ BeebAsm assembler for 6502 assembly development
- π Example programs demonstrating core concepts in both BASIC and assembly
- π₯οΈ Matrix Brandy interpreter for BBC Basic compatibility
- Docker Desktop for Mac (with Apple Silicon support)
- VS Code with the Dev Containers extension
- Open this project in VS Code
- When prompted, click "Reopen in Container" or run "Dev Containers: Reopen in Container" from the command palette
- Wait for the container to build and start
- Open any
.basfile in theexamples/directory - Press
Ctrl+Shift+Pand run "Tasks: Run Task" β "Run BBC Basic Program"
.
βββ .devcontainer/
β βββ devcontainer.json # Dev container configuration
β βββ Dockerfile # Container image definition
βββ .vscode/
β βββ settings.json # VS Code settings for BBC Basic
β βββ tasks.json # Build tasks for running programs
βββ examples/
β βββ hello.bas # Hello World BASIC example
β βββ calculator.bas # Simple calculator
β βββ loops.bas # Loop demonstrations
β βββ graphics.bas # Graphics and drawing examples
β βββ demo.6502 # Assembly: Advanced 3D spinning star globe demo
βββ README.md
- Open a
.basfile - Press
Ctrl+Shift+Pβ "Tasks: Run Task" β "Run BBC Basic Program"
# Run a BASIC program
brandy examples/hello.bas
# Check syntax only
brandy -check examples/calculator.bas# Assemble a 6502 program
beebasm -i examples/demo.6502 -do demo.ssd -boot Code -v
# Alternative with verbose output
asm examples/demo.6502 # Using the 'asm' aliasThe -do flag creates a DFS disk image that can be used with BBC Micro emulators.
PRINT- Output text or variablesINPUT- Get user inputCLS- Clear screenEND- End program
- Numeric:
A = 10 - String:
NAME$ = "Hello" - Arrays:
DIM numbers(10)
REM Conditional
IF condition THEN statement ELSE statement
REM For loops
FOR I = 1 TO 10 STEP 2
PRINT I
NEXT I
REM While loops
WHILE condition
statements
ENDWHILE
REM Repeat loops
REPEAT
statements
UNTIL conditionMODE n- Set graphics modeMOVE x, y- Move graphics cursorDRAW x, y- Draw line to coordinatesCIRCLE x, y, radius- Draw circleGCOL mode, color- Set graphics color
The examples/ directory contains demonstration programs for both BBC Basic and 6502 assembly:
- hello.bas - Basic output and program structure
- calculator.bas - Input, variables, and arithmetic
- loops.bas - FOR, WHILE, and REPEAT loop examples
- graphics.bas - Drawing shapes and using colors
Advanced 3D spinning star globe demonstration
This is a sophisticated BeebAsm demo that showcases advanced assembly programming techniques:
Features:
- Real-time 3D spinning star globe with 160 dots
- Interactive controls: Z/X keys to change rotation speed, Esc to quit
- Advanced graphics in MODE 2 (high resolution)
- Optimized raster-chasing techniques for smooth animation
- Custom multiplication tables for fast 8-bit math
- Sine wave calculations for 3D projection
- Sophisticated interrupt handling with VSync synchronization
- Debug raster visualization (enable with debugrasters = TRUE)
- BBC Basic files use
.basextension - Line numbers are optional but traditional
- Use
REMfor comments - Variables ending with
$are strings - Graphics coordinates start from bottom-left (0,0)
- Assembly files use
.6502extension (or.asm,.s) - Use BeebAsm syntax (similar to BBC BASIC's built-in assembler)
- Start with
ORGdirective to set assembly address - Use
.labelfor local labels,labelfor global labels - End with
SAVEdirective to specify output file and address range - Comments start with
;
- Ensure Docker Desktop is running
- Try rebuilding the container: "Dev Containers: Rebuild Container"
- Check syntax with the "Check BBC Basic Syntax" task
- Ensure file encoding is UTF-8
- Line endings should be Unix-style (LF)
- BeebAsm Documentation
- 6502 Assembly Guide
- BBC Micro Hardware Reference
- Stardot Forums - BBC Micro community and resources