User Tools

Site Tools


using_20the_20built-in_20program_20cruncher

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$+"Crunched.bbc"

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 Crunched.bbc in the same directory as the compiled executable. To change the name or location of the saved file change @dir$+“Crunched.bbc” 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. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies
using_20the_20built-in_20program_20cruncher.txt · Last modified: 2024/01/05 00:21 by 127.0.0.1