BASIC-to-Assembly Code Translator, Line Number Stripper & .PRG Binary Tokenizer
Convert Commodore BASIC V2, Sinclair BASIC & Locomotive/BBC BASIC into label-based code, MOS 6502/6510 or Z80 assembly templates, POKE/PEEK opcodes, and downloadable .PRG files
BASIC-to-Assembly Code Translator, Line Number Stripper & .PRG Binary Tokenizer
Transform legacy 8-bit BASIC programs from Commodore BASIC V2 (C64 / VIC-20), Sinclair BASIC (ZX Spectrum), and Locomotive / BBC BASIC into clean label-based source code, commented MOS 6502/6510 or Zilog Z80 assembly templates, hardware POKE/PEEK opcode tables, and downloadable Commodore .PRG binaries ready to boot in our Multi-System Retro Emulator Hub →
Every POKE, PEEK, GOTO, GOSUB, and hardware I/O statement in your BASIC program is decoded below into its exact 16-bit hexadecimal address, hardware chip register, and assembly opcode sequence. Click any address to inspect its memory bank in the Cross-Architecture Visual Memory Mapper:
| BASIC Line | Source Statement | Target Address / Label | Hardware Chip / Register Function | Generated Assembly Opcodes |
|---|
How 8-Bit BASIC-to-Assembly Translation & .PRG Tokenization Work
- Line Number Stripping & Control-Flow Graph Relabeling: Classic 8-bit interpreters (Commodore BASIC V2, Sinclair BASIC, and Locomotive BASIC) require line numbers on every line, making refactoring slow and obscuring true branch entry points. Our parser scans all
GOTO,GOSUB,THEN <line>,ON..GOTO/GOSUB, andRESTOREtargets first, strips unreferenced line numbers, and emits clean symbolic labels (e.g.line_100:) mapped toJMP line_100/JSR line_500on MOS 6502/6510 orJP line_100/CALL line_500on Zilog Z80A. - Hardware
POKE&PEEKto Native Opcode Translation: On 8-bit home computers, graphics, sprites, and sound are driven by memory-mapped registers. Statements likePOKE 53280, 0andPEEK(53281)are automatically matched against our hardware register database (VIC-II$D000–$D02E, SID 6581/8580$D400–$D41C, 2114 Color SRAM$D800, 6526 CIA$DC00/$DD00, VIC 6560$9000–$900F, and ZX Spectrum ULA$4000/$5800) and converted into immediate/absolute load-store pairs (LDA #$00 : STA $D020/LDA $D021) with deep-links to the Visual Memory Mapper & Address Decoder. - Authentic Commodore Binary
.PRGSerialization: A native Commodore.PRGfile begins with a 2-byte Little-Endian load address ($01 $08for$0801on the C64, or$01 $10for$1001on an unexpanded VIC-20). Each BASIC line is serialized as a 2-byte pointer to the next line's RAM address, a 2-byte unsigned 16-bit line number, single-byte keyword tokens ($80ENDthrough$CBGO, while leaving characters inside quotes and afterREM/DATAuntouched as PETSCII), and a$00line terminator, followed by two final$00 $00null bytes marking the end of the program.
Comments (0)
No comments yet. Be the first to share your thoughts on this tool!
Leave a Comment