Hewco BASIC for VS Code
Write games in Hewco BASIC, run and debug them with F5, and package them for
Windows, Linux, the Mac, the web and itch.io. (On a Mac, which is supported on a
best-efforts basis, install Apple's tools first: xcode-select --install.)
Beta software. Hewco BASIC is still under development. Commands and features
may change between versions, and you may find bugs.
Getting started
- Run Hewco: Set Up Tools from the Command Palette (Ctrl+Shift+P) once. It downloads
Zig and raylib into a
.hewco folder in your home folder and builds the runtime.
- Run Hewco: New Project from the Command Palette. In the folder window, pick
the folder to put the project in (such as Documents) and click Create
Project Here. Then type the project's name in the box at the top and press
Enter. Hewco makes a folder with that name and opens its
main.bas.
- Press F5 in
main.bas to run the game. Shift+F5 stops it.
The Get Started with Hewco BASIC walkthrough, on VS Code's Welcome page (Help >
Welcome), goes through these steps with buttons for each.
Examples and manuals
- Hewco: Extract Examples copies the examples and games into a
Hewco-BASIC-Examples
folder where you choose: a small program for each part of Hewco BASIC, and complete games
to play, read and change. Open an example's main.bas and press F5 to run it. Run it
again to get fresh copies; it asks before it replaces anything.
- Hewco: Open Manual opens a manual as a PDF: Getting Started, which makes two small
games with you step by step, The Manual, the Reference Card, the 2D Station
Manual and the Applications Manual.
If Hewco BASIC came to you as a zip, the examples, games and PDF manuals are in the zip
instead, beside hewco-basic.vsix.
Features
Colour coding for keywords, types, built-in commands and constants, numbers
($FF, %1010, &HFF), strings and comments.
Errors underlined as you type, and listed in the Problems panel. Runtime errors
("Division by zero", "List index 5 is out of range"...) jump to the line.
Completion for keywords, built-in commands, constants, your own Subs, Functions,
Types and variables, and the fields and methods after a ..
Hover for the signature and help of any command or your own code. Comment lines
written just above a Sub, Function or Type become its help.
Signature help while typing arguments, including the Rect 10, 20, 30, 40 style.
Go to Definition (F12) and the Outline view.
Format Document (Ctrl+Alt+F or Shift+Alt+F) and Format Selection: indents, and the proper
capitals for keywords, commands, constants and your own names, and () after a call of a
Sub that takes nothing (VblWait becomes VblWait(); the Hewco › Format: Empty Parens
setting turns it off). Capitals, indents and the brackets are also fixed as you type (the
Editor: Format On Type setting). Only capitals, those brackets and the space at the start
and end of a line change.
A debugger: breakpoints with conditions and hit counts, Step Over/Into/Out, Pause, the
call stack, local and global variables (Types, Lists and arrays open up) that can be
changed, hover and Watch values with sums in them, and a stop on the line of a runtime
error. Windows, Linux, the Mac and, with Hewco: Debug in Browser, the web.
F1 on any command or keyword opens its page in the help panel. Hewco: Open Help
opens the reference with a search box. The help starts in the secondary side bar,
beside the chat, and can be dragged to any side bar or the bottom panel.
Snippets: game, if, for, foreach, while, select, sub, function,
type, enum, module, bullets...
Editors for sound effects (.sfx) and music (.mus).
A 3D model editor (.3d): build from shapes, edit corners, edges and faces, extrude,
bevel, cut loops and knife lines, combine with booleans, set materials and textures,
and animate parts on a timeline. It imports glTF, OBJ, STL, PLY, FBX, 3DS and Collada,
and exports glTF, OBJ and STL.
A voxel model editor (.voxel): paint voxels with a brush, lines, boxes and fills,
mirror as you go, paint layer by layer in a slice view, give colours a glow, build a
model of parts with joints, and animate them on the same timeline. It imports and
exports MagicaVoxel .vox, and exports .3d, glTF, OBJ and STL. Convert to Voxel
Model makes one from a .3d model, keeping its parts and animations.
A preview for Imagery sprites and fonts (.spr, .fnt). Double-click one in the
Explorer to open it in Imagery.
@retro programs (VIC-20, C64, PET, Amstrad CPC, ZX Spectrum and Spectrum Next, ZX81,
Game Boy and Game Boy Color, MS-DOS PCs): the Run button names the
machine it runs on (Run on VIC-20), and the Run on... menu beside it lists the
machines on the program's @retro line, the modern build too: pick one to run on it, and
it is used from then on. The status bar shows the machine Run, Build and the error checks
use; click it to choose another. Asm blocks are coloured as 6502, Z80 or C, and the
formatter leaves them and @ lines as they are.
Run builds the program and starts it in the machine's emulator, Viccy (VIC-20), C64Emu
(C64), PetEmu (PET), AmsEmu (CPC), ZXEmu (Spectrum and Next), ZX81Emu (ZX81), GBEmu (Game
Boy) or PCEmu (PC), in a panel beside the editor (click the emulator once to start
the sound); Run again loads the new build. The picture fills the panel, keeping its shape.
The panel's title names the machine (Viccy - VIC-20 (8K)), and its buttons are:
- Full Screen (or F11, or the emulator's own full-screen button): the panel fills the
screen. Exit Full Screen, F11 or Esc twice puts VS Code back as it was.
- Open in Its Own Window: a window to size, move to another screen or make full screen
(its own Full Screen button, or F11). Back to the Main Window puts it back.
- Play in Browser: the program in the system's browser, where the emulator's own full
screen works. VS Code serves it from this computer (
http://127.0.0.1:6502/) until a
minute after the last page is closed.
F5 runs a @retro program in the emulator with the debugger: breakpoints with
conditions and hit counts, stepping, the call stack and variables. The modern build of a
@retro program has no debugger yet, so F5 runs it.
The first time a @retro program runs, VS Code asks where the emulator is: Choose
Folder (the folder of your emulator copy, or the web folder inside it), Get It
(its GitHub page) or Use Another Emulator. The emulators are:
Each folder is kept in a setting (Ctrl+,, then type the emulator's name, such as
pcemu), where it can be changed later.
On each page, Code > Download ZIP, then unzip it. Viccy, C64Emu and PetEmu don't
come with the Commodore ROMs and won't start without them: copy them into the emulator's
web/roms folder, as its page explains under ROMs. AmsEmu, ZXEmu and ZX81Emu include
theirs, and GBEmu and PCEmu need none. If any are missing, Run says which and stops, with
Show ROMs Folder and How to Add Them.
Use Another Emulator runs the program in its own window: VICE for the VIC-20 (xvic),
the C64 (x64sc) and the PET (xpet), Caprice32 or CPCSyntaxError for the CPC, Fuse or
ZEsarUX for the Spectrum, CSpect or ZEsarUX for the Next, EightyOne for the ZX81, SameBoy or mGBA for
the Game Boy.
These must be able to load a program straight into memory (injection), or load a tape in
a moment, as Run starts them that way: VICE 3 with -autostartprgmode 1 (and -memory
on the VIC-20, where a program with parts outside its one file runs from its .d64),
Caprice32 (a release from 13 October 2026 or later, which starts it with the ROMs off) and
CPCSyntaxError with -i, -o and -O system.model, Fuse with --machine,
--auto-load and the program's .tap, and ZEsarUX for the Spectrum with --machine,
--fastautoload and the .tap. EightyOne
(sourceforge.net/projects/eightyone-sinclair-emulator,
Windows) is given the ZX81's .p, which it loads and runs; switch on its Chroma 81 and
ZON X sound once in Options > Hardware for a program with colour or sound. For the PC, DOSBox-X (hewco.retro.dosEmulator
set to dosboxx, hewco.retro.dosboxxPath to where it is) runs the .exe itself, with
the program's video card, and its processor at about its speed as fixed cycles; the
debugger (F5) still uses PCEmu. Run again closes the one started before.
A build that exports graphics with 8bit Pixel Lab asks where it is when it isn't found:
Choose pixel-lab.exe or Get It
(hewco.itch.io/8bit-pixel-lab), then builds again.
Imagery is asked for the same way when a sprite is opened in it
(hewco.itch.io/imagery).
Package for a @retro program asks which files to make (Disk, Tape or All:
.d64 / .tap for the VIC-20, the C64 and the PET, .dsk / .cdt for the CPC, .tzx /
.tap for the Spectrum, a .wav tape for the ZX81) and, for a program for more than one machine, which machine or All
machines. It remembers the choice for each program, writes them to build/<machine>/
and offers Show in Folder. The modern build of a @retro program can't be packaged
yet.
Commands
| Command |
Key |
| Hewco: Debug (run with the debugger) |
F5 |
| Hewco: Debug in Browser |
|
| Hewco: Run (without the debugger) |
Ctrl+F5 |
| Hewco: Stop |
Shift+F5 |
Hewco: Direct Mode (a > prompt to try commands; also Direct on the status bar) |
|
| Hewco: Send to Direct Mode (the selection, or the line the cursor is on) |
Ctrl+Enter (Mac: Cmd+Enter) |
Hewco: Build (release build for this computer; a @retro program: its .prg or .bin) |
Ctrl+Shift+B (Mac: Cmd+Shift+B) |
| Hewco: Choose Machine for @retro Program (also the machine on the status bar) |
|
| Hewco: Run on... (also beside the Run button: Run on VIC-20 / Run on C64 / Run on PET 4032 / Run on PET 8032 / Run on Amstrad CPC / Run on ZX Spectrum / Run on ZX Spectrum Next / Run on ZX81 / Run on Game Boy / Run on Game Boy Color / Run on PC (VGA) ... / Run the Modern Build) |
|
Hewco: Play in Browser (a @retro program, in its machine's emulator in the browser) |
|
| Hewco: Full Screen (Emulator) / Exit Full Screen (Emulator) |
F11, Esc Esc |
| Hewco: Open in Its Own Window / Back to the Main Window (the emulator panel) |
|
Hewco: Package for Windows / Linux / Mac / Web / All (Mac only on a Mac; a @retro program: disk and tape) |
|
| Hewco: Package Source (a zip of the source and assets, to share) |
|
| Hewco: Clean Build Files (removes what building made, after asking) |
|
| Hewco: Upload to itch.io |
|
| Hewco: New Project |
|
| Hewco: New Sound Effect / New Song / New 3D Model / New Voxel Model (also on the Explorer's right-click menu for a folder) |
|
| Hewco: Export 3D Model / Export Voxel Model (also on the Explorer's right-click menu, for files or a folder) |
|
Hewco: Convert to Voxel Model (also on the Explorer's right-click menu for a .3d, and in the 3D model editor) |
|
| Hewco: Set Up Tools |
|
| Hewco: Show Version (also at the top of the help panel) |
|
| Hewco: Open Help |
|
| Hewco: Open Manual (a PDF manual: Getting Started, the Manual, the Reference Card, the 2D Station and Applications manuals) |
|
| Hewco: Extract Examples (copies the examples and games into a folder you choose) |
|
| Hewco: Help for Word at Cursor |
F1 |
| Hewco: Open in Imagery (also on the Explorer's right-click menu) |
|
Web packages need Emscripten and itch.io uploads need butler; see Setting up in the
Hewco BASIC manual.
Settings
hewco.liveErrors - check for errors as you type (default on).
hewco.saveBeforeRun - save all files before Run, Build and Package (default on).
hewco.profiler - show the profiler over games run from VS Code: off, small or full
(default off).
hewco.imageryPath - where Imagery is, if it isn't found by itself.
hewco.openImageryOnDoubleClick - open .spr and .fnt files in Imagery on a
double-click in the Explorer (default on).
hewco.pixelLabPath - where 8bit Pixel Lab is (pixel-lab.exe), for @retro programs
that export graphics with it. Empty means the HEWCO_PIXELLAB environment variable,
"pixelLab" in hewco.json or the PATH, else a build that needs it asks.
hewco.viccyPath / hewco.c64emuPath / hewco.petemuPath / hewco.amsemuPath /
hewco.zxemuPath / hewco.zx81emuPath / hewco.gbemuPath / hewco.pcemuPath - the
folder of your Viccy (VIC-20), C64Emu (C64), PetEmu (PET), AmsEmu (CPC), ZXEmu (Spectrum
and Next), ZX81Emu (ZX81), GBEmu (Game Boy) or PCEmu (PC) copy, or the web folder inside
it. Empty means the HEWCO_VICCY / HEWCO_C64EMU / HEWCO_PETEMU / HEWCO_AMSEMU /
HEWCO_ZXEMU / HEWCO_ZX81EMU / HEWCO_GBEMU / HEWCO_PCEMU environment variable, else
Run asks where it is the first time.
hewco.retro.vic20Emulator - viccy (the panel, the default) or vice;
hewco.retro.vicePath - where xvic.exe is.
hewco.retro.cpcEmulator - amsemu (the panel, the default), caprice32 or
cpcsyntaxerror; hewco.retro.caprice32Path / hewco.retro.cpcSyntaxErrorPath - where
cap32.exe / cpcse.exe is.
hewco.retro.c64Emulator - c64emu (the panel, the default) or vice64;
hewco.retro.vice64Path - where x64sc.exe is.
hewco.retro.spectrumEmulator - zxemu (the panel, the default), fuse or zesarux;
hewco.retro.fusePath - where fuse.exe is (ZEsarUX uses hewco.retro.zesaruxPath, as
for the Next).
hewco.retro.nextEmulator - zxemu (the default), cspect or zesarux;
hewco.retro.cspectPath / hewco.retro.zesaruxPath.
hewco.retro.petEmulator - petemu (the default) or xpet; hewco.retro.xpetPath.
hewco.retro.zx81Emulator - zx81emu (the panel, the default) or eightyone;
hewco.retro.eightyonePath - where EightyOne.exe is.
hewco.retro.gameboyEmulator - gbemu (the default), sameboy or mgba;
hewco.retro.sameboyPath / hewco.retro.mgbaPath.
hewco.retro.dosEmulator - pcemu (the default) or dosboxx; hewco.retro.dosboxxPath.
Hewco BASIC is a personal project. Copyright (c) 2026 Andy Hewitt / Hewco.uk. What you
make with it is yours: it claims no ownership of your code, programs or games. The
terms are in the LICENSE file that comes with this extension.
Third-party software
Games you build include third-party software. Its notices are in
THIRD-PARTY-NOTICES.txt. Please include this file in whatever you distribute. For
convenience, Hewco BASIC adds it to new projects. See Acknowledgements and licences
in the Hewco BASIC manual.
The 3D model editor in this extension uses three.js and fflate, under the MIT licence:
three.js: Copyright (c) 2010-2024 three.js authors
fflate: Copyright (c) 2026 Arjun Barrett
Permission is hereby granted, free of charge, to any person obtaining a copy of this
software and associated documentation files (the "Software"), to deal in the Software
without restriction, including without limitation the rights to use, copy, modify,
merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be included in all copies
or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
| |