A downloadable tool for Windows

Download NowName your own price

BASIC TO 6502

Type C64 BASIC. Watch it turn into 6502 machine code, line by line, as you type.

Basic To 6502 is a Commodore 64 BASIC V2 screen with a live window into the machine code behind it. Put the cursor on any line and the panel shows the 6502 that line compiles to: every instruction, its bytes, its address and its cycles. Type COMPILE and the whole program becomes a real machine code .prg that runs in VICE. Type RUN and the real BASIC ROM runs it instead, so you can compare.

If you grew up on BASIC and always meant to learn assembly, this is the bridge: the BASIC you already know, and the 6502 it would be.

WHAT'S IN IT?

- A faithful C64 screen editor: the real character set, logical lines, quote mode, insert mode, cursor keys, colours, LIST / NEW / RUN / SAVE / LOAD. Even the tokeniser behaves like the real ROM.

- LEARN: 26 type-along lessons in the panel, from your first PRINT to a two-layer sprite editor (hi-res and multicolour, moving past X=255 with the MSB). Type each line on the C64 screen and the lesson moves on when it's right; every lesson also shows what the compiler makes of it.

- Typing help: start a keyword and the rest appears in green (NE...XT), Tab completes it. POKE works straight from the READY prompt, so POKE 53280,0 changes the border right away.


- The live 6502 panel: the line under the cursor as assembly with bytes and cycles, or the whole program, with plain-English notes ("var A hi", "GOSUB 100", "if <> 0").

- A real compiler: COMPILE builds a machine code program and runs it in the bundled VICE emulator. Strings, floating point, INPUT and GET included, and the output matches what BASIC prints, character for character.

- Routine variants: PRINT through the KERNAL (CHROUT, exactly like BASIC) or a custom direct-to-screen routine, side by side with bytes and estimated cycles, chosen per line. The custom one is about 4.7x faster per character, and the panel tells you what it can't do.

- A hardware reference: SID, VIC-II, CIA, KERNAL routines, memory map and colours, every address in $hex and decimal.

- Memory meter: BASIC bytes, 6502 bytes, free bytes.

- Example programs: 26 of them including JOTTO, FIND THE NUMBER and SPRITE MAKER. RUN them in BASIC or COMPILE them to machine code (LOAD "$" to see the disk).

- Pixel-perfect or CRT display, a session that's there when you come back, and Final Cartridge style listing scrolling.

WHAT THE COMPILER UNDERSTANDS (v1.0)

Numbers: floating point exactly like BASIC (the compiled program calls the C64's own BASIC ROM maths), with plain variables kept as fast 16-bit integers while they only ever hold whole numbers. + - * / ^ AND OR NOT and comparisons, INT, ABS, SGN, SQR, RND, SIN, COS, TAN, ATN, LOG, EXP, PEEK, FRE, POS, TI, ST and pi.

Strings: string variables and arrays, + to join, LEFT$, RIGHT$, MID$, CHR$, STR$, VAL, ASC, LEN, and a garbage collector for string space.

Statements: PRINT (with ; , TAB and SPC), INPUT (prompts, ?REDO FROM START, ?EXTRA IGNORED, just like BASIC), GET, IF..THEN, FOR..NEXT with STEP, GOTO, GOSUB, RETURN, ON..GOTO / ON..GOSUB, DATA / READ / RESTORE (numbers and strings), DIM, POKE, SYS, END, STOP and REM. BASIC errors stop the program with BASIC's own message and line number.

Also DEF FN and TI$. If a whole-number variable keeps adding to itself (S=S+I) the panel warns that 16 bits can wrap, and REM !FLOAT S makes it a float.

Not yet: file and disk commands (OPEN, PRINT#...), WAIT and USR. Any line the compiler can't do yet is marked, and RUN still runs the whole program in BASIC.


REQUIREMENTS

Windows 10 or 11 (64-bit). VICE 3.9 is included.

PAY WHAT YOU WANT


Basic To 6502 is free to download. If it helps you learn or brings back some good memories, a donation keeps it growing (DEF FN, disk commands and more routine variants are next).

CREDITS

Made by Robert Ramsay, Polytricity Ltd.

Includes VICE 3.9, the Versatile Commodore Emulator, (C) The VICE Team, under the GNU General Public License v2: https://vice-emu.sourceforge.io/

Commodore and Commodore 64 are trademarks of their respective owners. Basic To 6502 is not affiliated with or endorsed by them.

(C) 2026 Polytricity Ltd. Version 1.0.

Updated 16 days ago
Published 20 days ago
StatusIn development
CategoryTool
PlatformsWindows
Authorpolytricity
Tags6502, assembly, basic, code, Commodore 64, learn, learning, machine, tool

Download

Download NowName your own price

Click download now to get access to the following files:

BasicTo6502_1.1.3_Windows.zip 29 MB

Development log

Comments

Log in with itch.io to leave a comment.

(+1)

will there be a macOS version released?

Yeah, it is planned just been busy with things and letting the windows users have a good go it it first.

100 PRINT CHR$(5):POKE 53280,6:N=5
110 DIM DP(2*5-2),DS(2*5),C(5),X(5):K=1:S=1
120 FOR W=1 TO N:A$=A$+CHR$(108):B$=B$+CHR$(164):NEXT
130 J=J+1:IF J<N+1 THEN IF C(J)+DS(J+K)+DP(J-K+N-1) THEN 130
140 IF J>N THEN K=K-1:GOTO 210
150 X(K)=J:C(J)=1:DS(J+K)=1:DP(J-K+N-1)=1:IF K<N THEN K=K+1:J=0:GOTO130
160 PRINT S;"> ";:FOR T=1 TO N: PRINT X(T);:NEXT:PRINT:S=S+1
170 PRINT B$
180 FOR T=1 TO N
190 PRINT LEFT$(A$,X(T)-1);CHR$(113);LEFT$(A$,N-X(T));CHR$(165)
195 NEXT T
200 PRINT"-------------------------------":PRINT
210 IF K THEN J=X(K):C(J)=0:DS(J+K)=0:DP(J-K+N-1)=0:GOTO 130

This little basic program to solve 5-queens problem doesn't compile properly, in the sense that compiled version gives graphical weird results compared to the basic one.

(1 edit)

Hi, it's a little design flaw in the compiler related to nested IFs. Fixing it now and will update soon. Thanks for the report, keep them coming as not all things are tested yet.

New version on the way.

Thank you very much! Another small issue: if you replace line 190 with the following - which is perfectly legitimate and equivalent -
190 PRINT LEFT$(A$,X(T)-1)+CHR$(113)+LEFT$(A$,N-X(T))+CHR$(165)
the compiler gives "formula too complex". Maybe it mistakes the "+" concatenation operator with a sum operator...

Right yeah, makes sense. Going to sort that now.

Please try the new update. V1.1.2 and let me know what else comes up.

Thank you very much! Now the program compiles perfectly. However, it doesn't seem to terminate properly, as, after the execution, it terminates with a strange "unction/ver" string, instead of "ready". 

Ok, will fix that next. Ta

(+1)

Very cool!

It's what I would have wanted a while back!

(+1)

If dreams come true ;)