6blitz
Blitz! compiler and decompiler for Commodore 64 BASIC 2.0, for Linux and Windows. Takes a tokenized .prg and produces a ready-to-run Blitz! program. Takes a compiled Blitz! or Austro-Speed program and gives back BASIC.
The compiler is a C# port of BC64 by MVR, and its output is byte-identical to BC64 on valid input.
| Linux x64 | 6blitz-2026.11.06-linux-x64.tar.gz | 28 MB |
| Windows x64 | 6blitz-2026.11.06-win-x64.zip | 28 MB |
Unpack and put 6blitz on your PATH. The Windows binaries are unsigned, so SmartScreen may warn. Input is a tokenized .prg, as saved by a C64, or from 6basic or petcat.
Compile
Source (sieve.bas):
' sieve.bas: primes below 2000, timed with TI
10 T=TI:N=2000:DIM F%(N):C=0
20 FOR I=2 TO N
30 IF F%(I) THEN 70
40 C=C+1
50 IF I*I>N THEN 70
60 FOR J=I*I TO N STEP I:F%(J)=1:NEXT J
70 NEXT I
80 PRINT C;"primes"
90 PRINT (TI-T)/60;"seconds"
100 GOTO 100
$ 6basic sieve.bas
Wrote sieve.prg
$ 6blitz compile sieve.prg
Wrote sieve.cp (6181 bytes), sieve.lst, 0 warnings
$ wc -c sieve.prg sieve.cp
183 sieve.prg
6181 sieve.cp
6364 total
The output is a normal .prg, whatever its extension. The runtime adds about 6 KB, so very small programs get much bigger.


Options
6blitz compile input.prg [-o out] [-l list] [-G]
-o out |
output file; default <input>.cp |
-l list |
listing file; default <input>.lst |
-G |
move the program to $4000, leaving $2000-$3FFF free for graphics in VIC bank 0 |
6blitz --help lists all this, and 6blitz --version gives the build date.
Integer loops
BC64 adds forced integers, a feature of the C128 Blitz!, so a FOR variable can be an integer. BASIC itself won't accept FOR I%, so name the variables in a REM before their first use:
10 REM **FI I,J
Errors
Errors go in the listing, with line and position. No program is written when compilation fails, and the exit status is non-zero.
$ cat bad.bas
10 PRINT "A"
20 GOTO 99
$ 6basic bad.bas
Wrote bad.prg
$ 6blitz compile bad.prg
6blitz: bad.prg: 1 error, 0 warnings; see bad.lst
$ grep error bad.lst
Undef'd statement error in line 20 pos 4 *******
Decompile
6blitz decompile input [-o out] [-f bas|prg|dis]
-o out |
output file; default <input>.<format> |
-f bas |
BASIC text (default) |
-f prg |
tokenized BASIC, which you can recompile |
-f dis |
p-code disassembly, for when decompiling fails |
Blitz! and Austro-Speed are detected from the file. Other compilers, such as PetSpeed, are not supported.
$ 6blitz decompile sieve.cp -o back.bas
Wrote back.bas (from Blitz!)
$ cat back.bas
10 T=TI:N=2000:DIM F%(N):C=0:FOR I=2 TO N:IF F%(I) THEN 20:C=C+1:IF (I*I)>N THEN 20:FOR J=I*I TO N STEP I:F%(J)=1:NEXT J
20 NEXT I:PRINT C;"primes":PRINT (TI-T)/60;"seconds"
30 GOTO 30
$ 6basic bas2prg -f back.bas back.prg
Wrote back.prg
$ 6blitz compile back.prg
Wrote back.cp (6181 bytes), back.lst, 0 warnings
$ cmp sieve.cp back.cp && echo identical
identical
Variable names survive. Comments don't, and line numbers survive only where something jumps to them, so statements merge into longer lines. As the transcript shows, the text goes back through 6basic and compiles to the same bytes.
The text is 6basic source. Control codes come out as {red}, {clear} or {$0b}, and letters inside quotes are in the swapped case 6basic reads.
Two things stop text compiling back:
SPC(. 6basic keeps the bracket after theSPCtoken, and the compiler stops withExpected. 6basic source usingSPC(won't compile either. Use-f prg.- A long
IFline. Everything afterTHENhas to stay on the line, and text adds spaces, which can take it past the 255-byte limit. The compiler saysline 10 is longer than 255 bytes. Use-f prg, unless the brackets the decompiler adds around sub-expressions take that past the limit too.
Accuracy
The port matched native BC64 on a 26-program corpus, including error listings. BC64 and the original Blitz! can differ by a byte in some float constants; 6blitz follows BC64. Lines may be up to 255 bytes when tokenized; native BC64 crashes past 80.
Some valid BASIC compiles differently from how it runs:
- A signed exponent in tokenized source reads as arithmetic:
A=1E+20compiles asA=1+20, with no error. Write1E20and.00001. - A quoted
DATAitem loses its spaces, a comma in it splits it, and a colon ends the statement.