Jump to content


   (0 reviews)
Sign in to follow this  

About This File

BASIC PREPROCESSOR allows one to create Commodore BASIC programs with a normal text editor without line numbers. Features:

  1. Much as strings begin and end with a quotation mark ("), macro constructs begin and end with a commercial at sign (@). This means that you cannot include @ in a macro, but otherwise any character may be used.
  2. A label can be defined on a line by itself as @+LABEL@.
  3. A label can be referenced after a GOTO or GOSUB as @-LABEL@ (including ON statements).
  4. A long variable name can be used as @!NAME@.
  5. A preprocessed comment can be used as @' whatever text you want @. These comments are not written to the PRG file.
  6. Any leading whitespace on a line is removed before writing the code to the PRG file.
  7. The preprocessor (probably) requires an emulator built from the master github branch.

The program is written almost completely in BASIC. The one exception has to do with tokenization. Normally as you enter lines of BASIC the computer will translate them into a compressed tokenized form, and this is necessary for the programs to be usable. In order for BPP.PRG to create tokenized BASIC programs, it has a small machine language routine in golden RAM that converts from plain text to tokenized form. The tokenized form is written to the output PRG file.

Here is a super simple example called SIMPLE.BPP.





  @!COUNT-VAR@ = @!COUNT-VAR@ + 1

An animated GIF demonstrates the process of using the program.


What's New in Version 0.4   See changelog



  1. BPP.BPP is the preprocessor itself as a text file. It can be modified and processed by BPP.PRG, making it easier to maintain in the future and serving as the single best example of use of the program the time of writing, as it includes labels, variables, and comments.
  2. TEST.BPP is a simple example with a couple of labels.
  3. ON.BPP is a simple example with an ON expr GOSUB @-label@ ... statement.
  4. ARM.BPP shows a list of Armstrong numbers between 1 and 999 inclusive.

Changes to 0.4:

  1. BASIC PREPROCESSOR was originally written in line number BASIC. Now that it is flexible enough, it has been rewritten in itself, serving as an example of how to use the various macros.
  2. Added preprocessor comments that are removed from the final BASIC program file. Use @'WHATEVER TEXT@ (except you cannot include an at sign in the comment.
  3. Note that names and labels are not limited to alphanumeric text. Any character other than at at sign can be included, such as hyphens, to make names and variables more readable than they might otherwise be.

Changes to 0.3:

  1. Defined the variable name array so that more than 10 variables could be defined.
  2. Added code to strip leading spaces from lines before writing them to the output file.

Changes to 0.2:

  1. Added support for long variable names. Use @!NAME@ to use a long variable name. It will be mapped to a unique two character short name, where the first character is a letter and the second is a number to avoid conflict with any two letter tokens or predefined variables such as ST. The name can include a % or $ after the name (such as @!NAME%@ or @!NAME$@ to indicate it is an integer or string. It can also be used with DEF FN and DIM arrays.

Initial release (0.1):

  1. Supports writing Commodore BASIC programs without line numbers.
  2. Labels serve as GOTO and GOSUB destinations. Use @+LABEL@ to define a label and @-LABEL@ to expand a label.




  • Thanks 1

User Feedback

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

  • Create New...

Important Information

Please review our Terms of Use