User Tools

Site Tools


Using the built-in program cruncher

by Jon Ripley, April 2007

The BBC BASIC for Windows compiler provides four functions to rewrite programs before compilation, these options are:

  • Discard spaces
  • Concatenate lines
  • Remove REMarks
  • Abbreviate names

The only way to apply these options to your code is to compile the program, however once the program is compiled there is no simple way to load the crunched program from the executable back into the editor.

Using the following technique it is possible to use the compiler to crunch your programs and save them in a way that they can be loaded back into the editor. This is achieved by making the compiled program save a copy of itself. Note that certain crunch options and combinations thereof can render programs uneditable. Always keep a backup of your original source code.

To crunch a program the copy and paste the following two lines at the start of your program:

        OSCLI"Save """+FNVif93Ux+""" "+STR$~(PAGE+?PAGE+?(PAGE+?PAGE))+" "+STR$~TOP:QUIT
        DEF FNVif93Ux=@dir$+""

Once these lines have been added at the very start of the program choose the compile option from the tool bar or the Utilities menu of the BBC BASIC for Windows editor. Set the crunch options you want to be applied to your code and compile the program.

Now run the compiled executable to recover the crunched version of the program.

By default the crunched program will be saved as in the same directory as the compiled executable. To change the name or location of the saved file change @dir$+“” in the second line to point to where you want the file to be saved. If you change the file name be careful not to overwrite your original program.

This website uses cookies for visitor traffic analysis. By using the website, you agree with storing the cookies on your computer.More information
using_20the_20built-in_20program_20cruncher.txt · Last modified: 2018/04/15 19:35 by tbest3112