Page 1 of 1

Basic Label Compiler for Windows

Posted: Mon Nov 08, 2021 9:27 pm
by Johan Kårlin


Writing BASIC programs longer than 10 rows on the X16 is a tedious experience. The text editor is very limited, much is about struggling with row numbers. This is an extremely simple compiler (sort of at least) for Windows that lets you write your BASIC programs in your favourite text editor with labels. The compiler outputs a new text file with the extension ".bas". It adds row numbers and fills in the right row number after the commands "GOTO", "GOSUB" and "THEN".




No installation is needed, just copy the only file to the directory of your choice. 




Usage: x16LabelCompiler <filename> [first row number] [step between row numbers]





  • Labels must end with a colon (":").


  • Labels must not be reserved keywords in BASIC.


  • Labels are preserved in the generated code by inserting "REM" before them.


  • Empty rows are removed.


  • All letters are converted to uppercase.




A sample program called "guess_the_number.txt" is included.

To compile the program:  x16LabelCompiler guess_the_number.txt

To start the emulator, load the generated file and run it immediately: x16emu -bas guess_the_number.bas -run



Corrected a bug that had to do with the special case where a label is declared but the name is a reserved keyword in BASIC. The code will be left as it is and the user will get a warning.