Basic Label Compiler for Windows

These files might not work on the most current version of the Commander X16, or these may be held over from the previous forum. To find previous versions of the emulator, so you can test old programs, please visit Our GitHub Page
Post Reply
Johan Kårlin
Posts: 292
Joined: Wed Jun 03, 2020 11:33 am
Location: Kalmar, Sweden

Basic Label Compiler for Windows

Post 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.


Attachments
Basic Label Compiler for Windows
Basic Label Compiler for Windows
dest_code.png (205.48 KiB) Viewed 446 times
Basic Label Compiler for Windows
Basic Label Compiler for Windows
source_code.png (95.08 KiB) Viewed 446 times
guess_the_number.txt
Basic Label Compiler for Windows
(1.21 KiB) Downloaded 91 times

[The extension exe has been deactivated and can no longer be displayed.]

Post Reply