home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 5 / DATAFILE_PDCD5.iso / utilities / s1 / strongbs / !StrongBS / Documents / Manual < prev    next >
Encoding:
Text File  |  1997-06-28  |  70.2 KB  |  1,903 lines

  1.  
  2.  
  3.  
  4.                       This manual is not complete yet !!
  5.                    If you could check it out and maybe grammer
  6.                    check it and send it back to me that would
  7.                    be very much appreciated. :-)
  8.  
  9.  
  10.  
  11.                _____ _                         ____   _____ 
  12.               / ____| |                       |  _ \ / ____|
  13.              | (___ | |_ _ __ ___  _ __   __ _| |_) | (___  
  14.               \___ \| __| '__/ _ \| '_ \ / _` |  _ < \___ \ 
  15.               ____) | |_| | | (_) | | | | (_| | |_) |____) |
  16.              |_____/ \__|_|  \___/|_| |_|\__, |____/|_____/ 
  17.                                           __/ |             
  18.                                          |___/              
  19.  
  20.  
  21.  
  22.  
  23.                            
  24.                  ••••••••••••••••••••••••••••••••••••••••••••
  25.                  •                                          •
  26.                  •           v1.69 (28th June 1997)         •
  27.                  •                                          •
  28.                  •        Program and documentation by      •
  29.                  •                                          •
  30.                  •        © Mohsen Alshayef 1993-1997       •
  31.                  •                                          •
  32.                  •         email: mohsen@qatar.net.qa       •
  33.                  •                                          •
  34.                  ••••••••••••••••••••••••••••••••••••••••••••
  35.  
  36.  
  37.  
  38.  
  39.                                    Freeware
  40.                             ••••••••••••••••••••••
  41.  
  42.  
  43.  
  44.  
  45.  
  46. ••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••• StrongBS •••••••
  47.  
  48.  Manual Content
  49.  ==============
  50.   
  51.   -  Copyright Notice
  52.   -  Welcome
  53.   1. StrongBS Main Features.
  54.   2. What You Need To Run StrongBS.
  55.   3. Setting Up and Installing StrongBS.
  56.   4. Running StrongBS
  57.   5. Upgrading StrongBS.
  58.   6. StrongBS Basics.
  59.   7. The Squash Options
  60.   8. Squeezing BASIC programs into Applications
  61.   9. Special files and Locking variables.
  62.  10. Adding Squash Options.
  63.  11. Speeding BASIC programs.
  64.  12. Troubleshooting.
  65.  13. Frequently Asked Questions.
  66.  14. Feedback to The Author
  67.  15. Obtaining Future Versions of StrongBS
  68.  16. Credits
  69.  
  70. ••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••• StrongBS •••••••
  71.  
  72.                               Copyright Notice
  73.                              ------------------
  74.  
  75.                          This application is Freeware
  76.  
  77.    The application 'StrongBS' is copyright Mohsen Alshayef 1997. I offer no
  78.    guarantees as to the reliability/stability of this application or any of
  79.                               its functions.
  80.  
  81.    You may copy the application freely provided that the whole application
  82.                             remains unaltered.
  83.  
  84. You may not sell the application without my written permission. However, Public
  85.   Domain libraries may distribute the program provided they charge at most 3
  86.   pounds sterling per disc. If anyone else would like to distribute StrongBS
  87.                  then contact me first to get my permission.
  88.  
  89.  
  90.  
  91.  
  92.  
  93.                               •••••••••••••••
  94.                                   Warning
  95.                               •••••••••••••••
  96.                               
  97.       If you do not program in the BBC BASIC language, you should not use
  98.                                 StrongBS.
  99.          
  100.       If you have access to BASIC program listings that were produced by
  101.      others, you should not try to compress them as you would be altering
  102.     other people programs. Use StrongBS to compress your own programs only.
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109. ••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••• StrongBS •••••••
  110.  
  111.                                  Welcome
  112.  
  113.  
  114.  Welcome to StrongBS, a utility that tries to compact and speed up your
  115.  BASIC programs. StrongBS is very easy to learn and use.
  116.  
  117.  StrongBS is intended for any programmer writing code in the BBC BASIC
  118.  language. The aim is to compact the code to the minimum size possible.
  119.  Your compacted BASIC code will have the following advantages:
  120.  
  121.  • Small code size - smaller memory space requirement.
  122.                    - faster loading from disc.
  123.  • Faster execution speed.
  124.  • Difficult to read and understand.
  125.  • Difficult to hack and modify.
  126.  • Keeps your programming style and methods confidential :-)
  127.  
  128.  
  129.  
  130.  
  131.  
  132. ••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••• StrongBS •••••••
  133.  
  134.  1. StrongBS main features
  135.     ======================
  136.  
  137.        ⇨   Produces the most compact BASIC program ever.     
  138.        ⇨   All compression options are under user control including the
  139.            removal of REMarks and spaces.
  140.        ⇨   Over 65 compression options to reduce the size of your program
  141.            to the minimum possible.
  142.        ⇨   Modular design. You can add you own code and routines through a
  143.            very simple interface, they will automatically appear as part
  144.            of StrongBS
  145.        ⇨   User defined compression modes. Select the options you like and
  146.            define your mode so that by one click you can configure all squash
  147.            options you frequently use.
  148.        ⇨   Handles assembler listings very well and produces a very tight
  149.            code that the BASIC interpreter can assemble.
  150.        ⇨   Contains many options and methods never used in other BASIC
  151.            compressor programs before.
  152.            
  153.            In addition to the common methods used by other BASIC compressor
  154.            utilities, the following are new feature unique to StrongBS:
  155.                                                     ------------------
  156.             1. Evaluation of expressions.
  157.             2. Removal of unused variables.
  158.             3. Removal of the Not-Equal sign.
  159.             4. Removal of SYS statements.
  160.             5. Removal of brackets.
  161.             6. Removal of WHEN and OTHERWISE statements.
  162.             7. Removal the STEP token.
  163.             8. Removal the ALIGN directive.
  164.             9. Removal of user defined debug code.
  165.            10. True removal of garbage lines.
  166.            11. True removal of colons.
  167.            12. Conversion of the CHR$ token.
  168.            13. Conversion of spaces.
  169.            14. Conversion strings.
  170.            15. Conversion of memory operators.
  171.            16. Conversion of the TRUE token.
  172.            17. Concatenation of strings.
  173.            18. Concatenation of multi-line IF structure.
  174.            19. Concatenation of DATA lines.
  175.            20. Concatenation of READ statements.
  176.            21. Concatenation of DIM statements and lines.
  177.            22. Concatenation of LOCAL statements and lines.
  178.            23. Concatenation of VDU statements.
  179.            24. Concatenation of assembler directives.
  180.            25. Removal and conversion of assembler mnemonics.
  181.          * 26. Removal of nil variables.
  182.          * 27. Removal and conversion of empty routines.
  183.          * 28. Conversion of common numbers to variables.
  184.            29. Auto generation of Application code using additional compression.
  185.            30. Conversion of assembler instructions into coded form.
  186.  
  187.        Other main features are:
  188.              
  189.        ⇨   Handles line number references, as many GOTO's as you like!
  190.        ⇨   Copes with badly written and badly structured programs. Does not
  191.            complain and doesnt ask you to change your habit of programming.
  192.            As long as it works, do it the way you like. StrongBS will try
  193.            its best to compress it.
  194.        ⇨   Handles LIBRARY files automatically.
  195.        ⇨   Handles the EVAL function through use of defined locked variables
  196.            either by building in your program or through a special file.
  197.        ⇨   Options to keep first REM line or all start REM line in your
  198.            program.
  199.        ⇨   Option to attach (insert) your pre-defined REMs automatically at
  200.            the start of the compressed output file.
  201.        ⇨   Removes all garbage and junk lines between procedures and anywhere
  202.            else in the program. Knows what a true BASIC line from a dummy one.
  203.        ⇨   8 type of concatenations that drastically squeeze your code to the
  204.            limit.
  205.        ⇨   Automatically removes all those unused codes, procedures and
  206.            functions.
  207.        ⇨   Automatically removes that debugging code that you don't want to
  208.            appear in the output file.
  209.        ⇨   Evaluates number expression to give you shorter numbers.
  210.        ⇨   Removes brackets and knows when those brackets you used are not
  211.            needed.
  212.        ⇨   Simple user interface, no fiddling with script files.
  213.        ⇨   Progress display while compressing.
  214.        ⇨   True compression percentage of your result code!
  215.        ⇨   Written in assembler for fast execution. Respectable speed.
  216.        ⇨   Easy fix of any bugs and improvements.
  217.        ⇨   Automatic line numbering.
  218.        ⇨   Future planned cross-referencing outputs.
  219.        ⇨   Through user configured modes, the application can be used for
  220.            any purpose, not only a compressor.
  221.              
  222.                  ••••••••• Hope you enjoy using StrongBS •••••••••
  223.          
  224.        If you have any idea for improvement, please let me know.
  225.          
  226.        If you want StrongBS to do any specific task not already included or
  227.        do it in a different way, let me know so that I can make a tailored
  228.        version that suits your requirements.
  229.  
  230.  
  231. ••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••• StrongBS •••••••
  232.  
  233.  2. What You Need to Run StrongBS
  234.     =============================
  235.  
  236.     StrongBS requires and Acorn machine with the following specifications:
  237.  
  238.     • RISC OS 3.10 or later.
  239.     • A minimum of 1 Mb of ram free.
  240.     • Floppy or hard disc space (minimum 200 Kbytes).
  241.  
  242.     To date StrongBS has been fully tested on the following machines:
  243.  
  244.     1. A5000 with 4Mb ram - RISC OS 3.10
  245.     2. RiscPC 700 36Mb ram - RISC OS 3.60
  246.     3. RiscPC StrongARM 64Mb ram - RISC OS 3.70
  247.  
  248.  
  249.     Compressed BASIC programs generated by StrongBS has been tested and will
  250.     work with the following versions of BBC BASIC:
  251.  
  252.     1. BASIC V version 1.05
  253.     2. BASIC V version 1.06
  254.     3. 
  255.  
  256.  
  257.     It is expected that the compressed BASIC program generated by StrongBS
  258.     will work with future versions of the BBC BASIC language.
  259.  
  260.     If you used StrongBS with different machine specifications or later versions
  261.     of BBC BASIC, please notify the Author (see email address above), so that
  262.     the tested configurations and BASIC versions can be added to the above list.
  263.  
  264.  
  265. ••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••• StrongBS •••••••
  266.  
  267.  3. Setting Up and Installing StrongBS
  268.     ==================================
  269.  
  270.     StrongBS comes supplied in an archived form. You will need to de-archive
  271.     it first. The method of archiving used may vary depending on the version
  272.     supplied, in any case you will need the application SparkFS or SparkPlug
  273.     to de-archive it.
  274.  
  275.     If you have obtained StrongBS from a PD library or downloaded it from
  276.     an FTP server then you will need to obtain SparkPlug or SparkFS from
  277.     the provider.
  278.  
  279.     All copies supplied by the Author either to individuals or PD libraries
  280.     are archived using SparkFS Zip format.
  281.  
  282.     It is recommended that StrongBS is installed on a Hard disc for faster
  283.     access, however StrongBS will happily work from a floppy disc
  284.  
  285.  
  286. ••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••• StrongBS •••••••
  287.  
  288.  4. Running StrongBS
  289.     ================
  290.  
  291.     Once installed, StrongBS can be started by double clicking on its icon
  292.     in the directory viewer. The StrongBS icon will appear on the icon bar
  293.     and from now on you are ready to start.
  294.     Click the mouse menu-button over the application icon to view the main
  295.     program menu.
  296.     
  297.     StrongBS has two windows; the main window which can be opened by clicking
  298.     the mouse select-button on the icon-bar icon, and the Choices window
  299.     opened by selecting the "Choices.." option from the main menu.
  300.     
  301.     StrongBS has only one main menu which can be called by pressing the
  302.     menu button on any part of StrongBS application windows or its icon
  303.     bar icon.
  304.  
  305.  
  306.  
  307. ••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••• StrongBS •••••••
  308.  
  309.  5. Upgrading StrongBS
  310.     ==================
  311.  
  312.     If you are upgrading to a new version of StrongBS, then you may want
  313.     to maintain your previous defined modes, Library files and Remark files.
  314.     To do this, just drag the new StrongBS directory onto the old StrongBS
  315.     directory, this will cause all old similar files to be updated with
  316.     new ones and new files added.
  317.      
  318.  
  319. ••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••• StrongBS •••••••
  320.  
  321.  6. StrongBS Basics
  322.     ===============
  323.  
  324.  As you work with StrongBS, there are few basic terms you need to become
  325.  familiar with.
  326.  
  327.  •  3rd Party Directory
  328.  
  329.    A directory that contains the code of all additional "Squash Options"
  330.    written either by you or someone else. Any code added will appear under
  331.    the 3rd Party menu.
  332.    
  333.  • 3rd Party Option
  334.  
  335.    A Squash Option that is added by the user or a 3rd party. See adding
  336.    squash options for more details. 3rd Party Option codes reside in the
  337.    "3rd Party Directory".
  338.  
  339.  • Assembly
  340.  
  341.    Means an assembler BASIC listing within the main or "Library File". An
  342.    assembly listing is one that starts with the open square bracket "[" and
  343.    ends with a close square bracket "]".
  344.    
  345.  • Concatenation
  346.  
  347.    A compression method used by StrongBS to join (concatenate) things together
  348.    in order to produce a shorter equivalent.
  349.  
  350.  • Convert
  351.  
  352.    The process used by StrongBS to convert something into another shorter
  353.    equivalent. There are many conversion options to select from.
  354.  
  355.  • Debug code
  356.  
  357.    Part of your BASIC program that contains a code you are using during
  358.    the testing and debugging of your program. If you want this code to be
  359.    completely removed, then StrongBS will do so if you tell it the whereabouts
  360.    of this debug code.
  361.  
  362.  • Label
  363.  
  364.    Means an assembler label that starts with a dot ".".
  365.  
  366.  • Library Directory
  367.  
  368.    A directory that contains "Library-Files".  StrongBS will only lookup the
  369.    first 64 valid "Library-Files" in the directory. Valid files means BASIC
  370.    program files. The "Library Directory" is normally located within StrongBS
  371.    application. StrongBS comes with a directory called "Library" that contains
  372.    example library files. If your preferred library files are located
  373.    elsewhere on the disc, then simply change the <StrongBS$Library> variable
  374.    in the !Run file to point at that directory.
  375.       
  376.  • Library-File
  377.  
  378.    Is a BASIC File that is located in a Library Directory and is displayed by
  379.    StrongBS in the "Library files" sub-menu. Any selected library file will
  380.    be automatically appended to the end of the core BASIC program
  381.    before at the time StrongBS loads your main BASIC program. The library file
  382.    gets compressed along with the main program, so that options set to the main
  383.    program also apply to the Library File. The result compressed file contains
  384.    both your main program and any library files. StrongBS will only display
  385.    the first 64 files found in the Library directory.
  386.    You can select more than one Library file from the "Library files" menu.
  387.  
  388.  • Log file
  389.  
  390.    Is a file that contains all statistical and other details about your
  391.    BASIC program, before and after compression. The content of the log
  392.    file is user defined.
  393.  
  394.  • Modes Directory
  395.  
  396.    A directory that holds user defined "Squash Modes". Up to 32 user modes
  397.    may be defined.
  398.  
  399.  • New Size
  400.  
  401.    The result of the compressed "Output File" size. "New Size" is displayed
  402.    and updated after each compression option is performed.
  403.    
  404.  • Output File
  405.  
  406.    Means the result compressed output file including any appended library
  407.    files.
  408.  
  409.  • Percentage
  410.  
  411.    The percentage ratio and size reduction of the "Output File" compared to
  412.    the "Source File". Percentage is updated after each compression and
  413.    displays the percentage in one hundredth of a unit. Looking at the
  414.    percentage you can immediately tell if any savings have been made.
  415.  
  416.  • Progress Bar
  417.  
  418.    A progress indicator bar that gives the indication of how many options
  419.    are still to be applied and how much have been already performed.
  420.  
  421.  • REMarks-Directory
  422.  
  423.    A directory which contains "REMark-Files". StrongBS will only display the
  424.    first 32 valid "REMark-Files" in the directory. The path of the "REMarks
  425.    Directory" is pointed to by the variable <StrongBS$InsertREM> found in
  426.    the !Run file, you may change this to point at any other directory you
  427.    prefer.
  428.       
  429.  • REMark-File
  430.  
  431.    An "REMark-File" is a file that will be automatically inserted at the
  432.    start of the compressed output result file. A REMark-File can be added to
  433.    the "REMarks-Directory". Only one "REMark-File" can be selected from
  434.    the REMark-File menu. You may have up to 32 REMark-Files.
  435.    
  436.  • Remove
  437.  
  438.    The process used by StrongBS to remove something from your BASIC program
  439.    that is not necessary, redundant or not required. There are several
  440.    removal options to select from.
  441.  
  442.  • Routines
  443.  
  444.    Routines are BASIC functions or procedures defined using DEF FN or
  445.    DEF PROC.
  446.  
  447.  • Size
  448.  
  449.    The original size of the main "Source File" program including the size of
  450.    all loaded "Append" files.
  451.      
  452.  • Source File
  453.  
  454.    The "Source File" is your main BASIC program that is loaded for compression
  455.    including any appended library files.
  456.  
  457.  • Special file
  458.  
  459.    A file that contains information that StrongBS uses and applies to the
  460.    methods used for compressing the current program. A "Special File" is
  461.    a text file that you write to tell StrongBS what to do with the current
  462.    BASIC program in question. You can use it to define variables and/or
  463.    procedure/function names that should not be renamed.
  464.    StrongBS can automatically load Special files for each particular
  465.    BASIC program you load for compression.
  466.    
  467.    Note: the "Special-File" is an option, it is not a  must have or use.
  468.  
  469.  • Squash Option
  470.  
  471.    A "Squash Option" is an option that is selectable from the Squash Options
  472.    menu. StrongBS comes with over 60 different options to select from.
  473.                      
  474.  • Squash Mode
  475.  
  476.    A Squash Mode, is a collection of "Squash Options" that is pre-defined.
  477.    StrongBS comes with three built-in Squash Modes. You can add your own
  478.    Squash Modes.
  479.    
  480.  • User Mode
  481.  
  482.    Is a user defined "Squash Mode" that can be created by the user and gets
  483.    added automatically to the "Squash Mode" menu. "User Modes" are stored
  484.    in the "Modes Directory".
  485.    
  486.  • Variable
  487.  
  488.    A variable means any real, integer, string, real array, integer array
  489.    or string array, as defined by BASIC rules.
  490.  
  491.  
  492. ••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••• StrongBS •••••••
  493.  
  494.  7. The Squash Options
  495.     ==================
  496.  
  497.  7.1 General and introduction
  498.      ------------------------
  499.      
  500.      StrongBS provides a large number of options that can be used to reduce
  501.      the size of a BASIC program. Some 60+ options are avialable.
  502.      The purpose of this Chapter is to biefly explain what each option does.
  503.      
  504.      Squash Options are divided into 10 categories:
  505.      
  506.       1. Assembler
  507.       2. Routines.
  508.       3. Variables.
  509.       4. Convertion.
  510.       5. Concatenation.
  511.       6. Removal.
  512.       7. Remarks.
  513.       8. Constructs.
  514.       9. Miscellaneous.
  515.      10. Make faster.
  516.      
  517.      Although, in the following description, use is made of the words remove,
  518.      convert, etc., StrongBS will only perform an operation such as removal
  519.      of a code or conversion of a token, etc., if the test conditions which
  520.      apply to the particular operation are met. For example when removing
  521.      brackets, StrongBS will test the mathematical operator priority of each
  522.      operator inside and outside the brackets. StrongBS also makes allowance
  523.      for bugs in the current versions of the BASIC interpreter (or as Acorn
  524.      prefer to call them "features") and will ensure that the result BASIC
  525.      file runs correctly.
  526.      
  527.      The following description does not explain HOW StrongBS does it, it
  528.      only gives a brief description of what each option means and what are
  529.      the expected results. It is assumed that you are familiar with BASIC
  530.      and the BASIC assembler.
  531.      
  532.      
  533.  7.2 Assembler Squash Options
  534.      ------------------------
  535.      
  536.      This category provides 11 squashing options. These options will only work
  537.      on assembler listings inside a BASIC program.
  538.      Although BASIC programs are very rarely distributed with an assembler
  539.      source code, if you decide to distribute the source code because the
  540.      program needs to generate the code at run time then StrongBS will
  541.      aid in compressing the assembler listing.
  542.      
  543.      7.2.1  Remove assembler remarks
  544.             ------------------------
  545.             
  546.             This option will remove all remarks inside an assembler listing.
  547.             Remarks in the main program (outside and assembler) will not
  548.             be removed.
  549.             
  550.      7.2.2  Remove zero shifts
  551.             ------------------
  552.             
  553.             This will remove LSL #0, LSR #0 and ASR #0 in the assembler
  554.             listing.
  555.             
  556.      7.2.3  Remove ALIGN directives
  557.             -----------------------
  558.             
  559.             Unnecessary ALIGN directives found in the assembler listing will
  560.             be removed. An ALIGN directive is not required, if it is followed
  561.             by an instruction.
  562.             
  563.      7.2.4  Convert register names
  564.             ----------------------
  565.             
  566.             All register names in the form of R0, R1, PC etc will converted
  567.             into a register number form, i.e. 0, 1, 15 etc..
  568.             
  569.             Note: This option is automatically selected if you select
  570.                   the "Variables Renaming" option, as register name are
  571.                   considered by StrongBS another form of variables!
  572.                   
  573.                   
  574.      7.2.5  Convert SWI name
  575.             ----------------
  576.             
  577.             All SWI names in an assembler listing will be converted into their
  578.             SWI number equivalents.
  579.             
  580.             SWI names that can not be converted will be left as is. Therefore,
  581.             if a SWI name is only existant in a module that is not currently
  582.             loaded, all SWI names for the that module will not be changed.
  583.             You will have to load the module before compressing the BASIC
  584.             program. StrongBS will not complain about the non-existance of
  585.             the module.
  586.             
  587.       7.2.6  Convert directives
  588.              ------------------
  589.              
  590.              This option allows all assembler directives in the form EQUD,
  591.              EQUB and EQUW to be converted into DCD, DCB, DCW respectively.
  592.              
  593.       7.2.7  Convert zero offset
  594.              ------------------
  595.              
  596.              This will convert all occurrences of zero offsets in load
  597.              and store instructions into the shortest form.
  598.              
  599.              LDR R0,[R1,#0]    ----->    LDR R0,[R1]
  600.              LDR R0,[R1],#0    ----->    LDR R0,[R1]
  601.              
  602.              Note: Due to what seems to be a bug in the BASIC assembler,
  603.                    the LDRT Rd,[Rn],#0 or STRT Rd,[Rn],#0 will not be
  604.                    converted as the BASIC assembler will treat the
  605.                    shorter instructions differently.
  606.                    
  607.       
  608.       
  609.       7.2.8  Convert register list
  610.              ---------------------
  611.              
  612.              This option is not yet enabled in this version of StrongBS.
  613.              
  614.              Once enabled, the option will allow converting a register
  615.              list in the STM and LDM instructions into the shortest
  616.              form.
  617.              
  618.              LDMFD  R13!,{R0,R1,R2,PC} ------>  LDMFD R13!,{R0-R2,PC}
  619.              
  620.       
  621.       7.2.9  Convert to shortest directives
  622.              ------------------------------
  623.              
  624.              This will convert all EQUD, EQUB, EQUW, EQUS, DCD, DCB and DCW
  625.              into the shortest form using the "&" and "=" directives.
  626.              
  627.              EQUS               ------>  =
  628.              EQUD or DCD        ------>  &
  629.              EQUB or DCB        ------>  =
  630.              EQUW or DCW        ------>  =
  631.              
  632.       
  633.       7.2.10 Concatenate directives
  634.              ----------------------
  635.              
  636.              This option will reconstruct all those directives by assembling
  637.              the directives and de-assembling them back into a the shortest
  638.              possible form. It can cope with all type of directives and the
  639.              CHR$ keyword.
  640.              With long directive listings, this can produce a very short
  641.              and compact BASIC programs.
  642.              
  643.       
  644.       7.2.11 Assemble into Code
  645.              ------------------
  646.              
  647.              This option will convert (assemble) all ARM instructions
  648.              into the equivalent 32-bit value and use the & directive
  649.              in place with the instruction. For example:
  650.              
  651.              MOV    R0,R1,LSL #2         becomes  &&E1A00101
  652.              LDMFD  R13!,{R0-R12,PC}     becomes  &&E8FD9FFF
  653.              ORREQ  R10,R10,R11,LSL #8   becomes  &&018AA40B
  654.              
  655.  7.3 Routines Squash Options
  656.      ------------------------
  657.      
  658.      Five options are provided that work on procedures and function.
  659.      
  660.      7.3.1  Rename functions
  661.             ----------------
  662.             
  663.             This will rename functions using the shortest possible string.
  664.             One or two character names are used, with shorter names allocated
  665.             to the most frequently used functions.
  666.  
  667.             
  668.      7.3.2  Rename procedures
  669.             ------------------
  670.             
  671.             This will rename procedures using the shortest possible string.
  672.             One or two character names are used, with shorter names allocated
  673.             to the most frequently used procedures.
  674.             
  675.             
  676.      7.3.3  Remove unused functions
  677.             -----------------------
  678.             
  679.             A function definition that is not called in the main program or
  680.             any Library file will cause the complete function to be removed.
  681.             
  682.             
  683.      7.3.4  Remove unused procedures
  684.             ------------------------
  685.             
  686.             A procedure definition that is not called in the main program or
  687.             any Library file will cause the complete procedure to be removed.
  688.     
  689.             
  690.      7.3.5  Remove empty procedure
  691.             ----------------------
  692.             
  693.             This option will remove empty procedure.
  694.             
  695.             
  696.  7.4 Variables Squash Options
  697.      ------------------------
  698.      
  699.      Nine options are provided that work on all type of variables.
  700.      
  701.      7.4.1  Rename Integer variables
  702.             ------------------------
  703.             
  704.             Integer variables are renamed using one or two character variable
  705.             names.
  706.             
  707.      7.4.2  Rename Real variables
  708.             ---------------------
  709.             
  710.             Real variables are renamed using one or two character variable
  711.             names.
  712.             
  713.      7.4.3  Rename String variables
  714.             -----------------------
  715.             
  716.             String variables are renamed using one or two character variable
  717.             names.
  718.             
  719.      7.4.4  Rename Integer arrays
  720.             ---------------------
  721.             
  722.             Integer array variables are renamed using one or two character
  723.             names.
  724.             
  725.      7.4.5  Rename Real arrays
  726.             ------------------
  727.             
  728.             Real array variables are renamed using one or two character variable
  729.             names.
  730.             
  731.      7.4.6  Rename String arrays
  732.             --------------------
  733.             
  734.             String array variables are renamed using one or two character
  735.             variable names.
  736.             
  737.      7.4.7  Rename vars in DATA lines
  738.             -------------------------
  739.             
  740.             This option renames variables found inside DATA lines. 99% of the
  741.             time this OK. However, it is possible that DATA lines contain
  742.             data which although not being a variable is identical to a
  743.             variable name in the program.
  744.             For this purpose and only in this rare situation you can disable
  745.             this option.
  746.             
  747.      7.4.8  Remove unused variables
  748.             -----------------------
  749.             
  750.             Unused variables are those that are only encountered once in the
  751.             program, ie defined but not used. There are exceptions where
  752.             some variables which fall into this discription will not be
  753.             removed as they will be required for proper program execution.
  754.             
  755.             StrongBS will, depending on the unused variable location, either
  756.             remove the variable only or remove the whole statement or the
  757.             complete line.
  758.             
  759.             
  760.      7.4.9  Remove nil variables
  761.             --------------------
  762.             
  763.             This option is not yet enabled in this version of StrongBS.
  764.      
  765.  
  766.  7.5 Conversion Squash Options
  767.      -------------------------
  768.      
  769.      Ten options are currently provided in this category. Another 2 options
  770.      will be enabled in the next releases of StrongBS.
  771.      
  772.      7.5.1  SYS names to numbers
  773.             --------------------
  774.             
  775.             All SWI names in an a SYS statement will be converted into their
  776.             SWI number equivalents.
  777.             
  778.             SWI names that can not be converted will be left as is. Therefore,
  779.             if a SWI name is only existant in a module that is not currently
  780.             loaded, all SWI names for the that module will not be changed.
  781.             You will have to load the module before compressing the BASIC
  782.             program. StrongBS will not complain about the non-existance of
  783.             the module.
  784.             
  785.             
  786.      7.5.2  CHR$ to string
  787.             --------------
  788.             
  789.             This will convert a CHR$<no> into a string provided the result
  790.             string can be joined to the end or the start of an existing string.
  791.             
  792.             
  793.      7.5.3  ASC" " to number
  794.             ----------------
  795.             
  796.             This will convert an ASC<string> into the equivalent ASCII code.
  797.             
  798.             
  799.      7.5.4  NEXT <var> to NEXT or NEXT,,
  800.             ----------------------------
  801.             
  802.             This option all cause any optional variable after the NEXT keyword
  803.             to be removed. Also repeated NEXT statements on the same line or
  804.             multi-lines will be concatenated.
  805.             
  806.             
  807.      7.5.5  -1 to TRUE
  808.             ----------
  809.             
  810.             The integer -1 is replaced with the BASIC token TRUE whenever
  811.             possible.
  812.             
  813.             
  814.      7.5.6  Numbers to shortest form
  815.             ------------------------
  816.             
  817.             This option will convert numbers into the shortest representation.
  818.             It can cope with decimal, hexadecimal, binary and shifted numbers.
  819.             The shortest form of the 4 possible representation will be used.
  820.             
  821.             
  822.      7.5.7  Memory operators to shortest
  823.             ----------------------------
  824.             
  825.             Memory indirection operators such as ? and ! will be converted
  826.             into the shortest possible form.
  827.             
  828.             Examples:
  829.             
  830.             pointer%?0=A%                  ?pointer%=A%
  831.             pointer%!0=A%                  !pointer%=A%
  832.             ?(pointer%+3)=A%               pointer%?3=A%
  833.             !(pointer%+4)=A%               pointer%!4=A%
  834.             
  835.      7.5.8  Repeated spaces to SPC
  836.             ----------------------
  837.             
  838.             Repeated spaces in a string will be converted into SPC.
  839.             
  840.             
  841.      7.5.9  Repeated chars to STRING$
  842.             -------------------------
  843.             
  844.             Repeated characters in a string will be converted into STRING$.
  845.             
  846.      
  847.      7.5.10 *FX to SYS "OS_Byte"
  848.             ====================
  849.             
  850.             This option will convert *FX calls into their equivalent
  851.             SYS call using SYS "OS_Byte" or SYS 6.
  852.             
  853.        
  854.      7.5.11 var=var+|-x to var+|-=x
  855.             -----------------------
  856.             
  857.             This option is not yet enabled in this version of StrongBS.
  858.             
  859.             
  860.      7.5.12 Common numbers to variables
  861.             ---------------------------
  862.             
  863.             This option is not yet enabled in this version of StrongBS.
  864.             
  865.             
  866.  7.6 Concatenation Squash Options
  867.      ----------------------------
  868.      
  869.      Nine options are currently provided in this category.
  870.      
  871.      7.6.1  Concatenate Lines
  872.             -----------------
  873.  
  874.             This option will join all lines and statements to produce multi
  875.             statements per line.
  876.             
  877.      7.6.2  Concatenate LOCAL lines
  878.             -----------------------
  879.             
  880.             This option joins together all LOCAL statements and LOCAL lines.
  881.             
  882.  
  883.      7.6.3  Concatenate DIM lines
  884.             ---------------------
  885.             
  886.             This option joins together all DIM statements and DIM lines.
  887.             
  888.             
  889.      7.6.4  Concatenate DATA lines
  890.             ----------------------
  891.             
  892.             This option joins together all DATA statements and DATA lines.
  893.             
  894.             
  895.             
  896.      7.6.5  Concatenate IF...ENDIF lines
  897.             ----------------------------
  898.             
  899.             This option will convert multi-line IF...THEN...ELSE...ENDIF into
  900.             a single  IF..THEN..ELSE statements.
  901.             
  902.             
  903.      7.6.6  Concatenate strings
  904.             -------------------
  905.             
  906.             This option concatenates strings in the form <string1>+<string2>
  907.             into one string.
  908.             
  909.             
  910.      7.6.7  Concatenate READ statements
  911.             ---------------------------
  912.             
  913.             This option joins together all READ statements and READ lines.
  914.             
  915.             
  916.      7.6.8  Concatenate VDU statements
  917.             --------------------------
  918.             
  919.             This option joins together all VDU statements and VDU lines.
  920.  
  921.  
  922.      7.6.9  Concatenate PRINT statements
  923.             ----------------------------
  924.             
  925.             This will convert multi PRINT statements into the shortest form.
  926.  
  927.  
  928.  7.7 Removal Squash Options
  929.      ======================
  930.      
  931.      Fifteen options are currently provided.
  932.      
  933.      7.7.1  Removal of remarks
  934.             ------------------
  935.             
  936.             This will remove all REMark lines in the main program and in
  937.             any attached libraries. It will also cope with *Command remarks.
  938.      
  939.      
  940.      7.7.2  Removal of garbage lines
  941.             ------------------------
  942.             
  943.             Garbage lines are those between procedures and at other locations
  944.             that will never be reached by the program code. These are removed.
  945.             StrongBS will also remove garbage lines in between BASIC program
  946.             code which are normally skipped by the program either by use
  947.             of GOTO's or other constructs.
  948.             
  949.             A line is not removed if it is referenced by another part of the
  950.             program.
  951.      
  952.      7.7.3  Removal of blank lines
  953.             ----------------------
  954.             
  955.             Blank (empty) lines are removed.
  956.             
  957.             A line is not removed if it is referenced by another part of the
  958.             program.
  959.             
  960.             
  961.      7.7.4  Removal of spaces
  962.             -----------------
  963.             
  964.             Unuecessary spaces are removed.
  965.             
  966.             
  967.      7.7.5  Removal of brackets
  968.             -------------------
  969.             
  970.             Unnecessary brackets are removed.
  971.             
  972.             
  973.      7.7.6  Removal of colons
  974.             -----------------
  975.             
  976.             Unnecessary colons between statements and between lines are
  977.             removed.
  978.      
  979.      7.7.7  Removal of fractions
  980.             --------------------
  981.             
  982.             Unnecessary fractional parts in floating point (real) number
  983.             are removed. Example:
  984.             
  985.             X=0.0        becomes X=0
  986.             X=0.1200     becomes X=.12
  987.             
  988.      
  989.      7.7.8  Removal of "not equal" sign
  990.             ---------------------------
  991.             
  992.             The unnecessary "<>0" sign is removed if found in IF, WHILE
  993.             and UNTIL statements. Examples:
  994.             
  995.             IF var<>0 THEN         becomes IF var THEN
  996.             WHILE var<>0 ....      becomes WHILE var ....
  997.             UNTIL var<>0           becomes UNTIL var
  998.             
  999.           
  1000.      7.7.9  Removal of THEN
  1001.             ---------------
  1002.             
  1003.             The "THEN" in a single line IF..THEN..ELSE is optional and will be
  1004.             removed if found.
  1005.             
  1006.      
  1007.      7.7.10 Removal of LEN
  1008.             --------------
  1009.             
  1010.             This option is not yet enabled in this version of StrongBS.
  1011.             
  1012.      
  1013.      7.7.11 Removal of LET
  1014.             --------------
  1015.             
  1016.             The redundant LET is removed if found.
  1017.             
  1018.      
  1019.      7.7.12 Removal of STEP
  1020.             ---------------
  1021.             
  1022.             This option removes "STEP 1" in FOR...NEXT loops.
  1023.      
  1024.      7.7.13 Removal of SYS
  1025.             --------------
  1026.             
  1027.             This option removes unnecessary 0's in SYS calls. For example:
  1028.             
  1029.             SYS "OS_xxx",0           becomes  SYS "OS_xxx"
  1030.             SYS "OS_xxx",A%,0        becomes  SYS "OS_xxx",A%
  1031.             SYS "OS_xxx",0,A%        becomes  SYS "OS_xxx",,A%
  1032.             etc...
  1033.             
  1034.      
  1035.      7.7.14 Removal of debug code
  1036.             ---------------------
  1037.             
  1038.             Any lines bracketed between the identifiers "REM --[" and
  1039.             "REM ]--" will be removed.
  1040.             
  1041.             
  1042.      7.7.15 Removal of +/- assignments
  1043.             --------------------------
  1044.             
  1045.             This will remove unnecessary +0 or -0 in assignments. Examples:
  1046.             
  1047.             X%=Y%+0           becomes  X%=Y%
  1048.             Y=Z-0             becomes  Y=Z
  1049.             etc...
  1050.             
  1051.             
  1052.  7.8 Remarks Squash Options
  1053.      ======================
  1054.      
  1055.      7.8.1  Keep first REM line
  1056.             -------------------
  1057.             
  1058.             This option will only only the First REMark line to be preserved.
  1059.             All other REMark lines will be removed, is the "Remove REMarks"
  1060.             option has been selected.
  1061.             
  1062.             
  1063.      7.8.2  Keep initial REM lines
  1064.             ----------------------
  1065.             
  1066.             This option allows ALL REMark lines appearing at the start of a
  1067.             BASIC program to be preserved, and will appear in the final
  1068.             output file.
  1069.      
  1070.      7.8.3  Keep REM starting with
  1071.             ----------------------
  1072.             
  1073.             This option allows REMark lines starting with a sequence of text
  1074.             or characters to be preserved everywhere in the program, and
  1075.             hence will not be removed.
  1076.             
  1077.      
  1078.      7.8.4  Insert REMarks file
  1079.             -------------------
  1080.             
  1081.             This allows a BASIC program file to be inserted at the start of
  1082.             the compressed output file. These will normally be BASIC files
  1083.             containing remark lines, but can be any BASIC file. The file is
  1084.             selectable from a list of files contained in the REMInsert
  1085.             directory. Only one file can be selected.
  1086.             
  1087.      
  1088.  7.9 Constructs Squash Options
  1089.      =========================
  1090.      
  1091.      7.9.1  Remove empty IF constucts
  1092.             -------------------------
  1093.             
  1094.             Empty IF..THEN..ENDIF constructs are removed.
  1095.             
  1096.      
  1097.      7.9.2  Remove empty CASE construct
  1098.             ---------------------------
  1099.             
  1100.             Empty CASE...ENDCASE constructs are removed.
  1101.             
  1102.             
  1103.      7.9.3  Remove duplicate WHEN statements
  1104.             --------------------------------
  1105.             
  1106.             This option is not yet enabled in this version of StrongBS.
  1107.             
  1108.             
  1109.      7.9.4  Remove empty WHEN statements
  1110.             ----------------------------
  1111.             
  1112.             Empty WHEN statements in CASE...ENDCASE constructs are removed.
  1113.             
  1114.      
  1115.      7.9.5  Remove empty OTHERWISE statements
  1116.             ---------------------------------
  1117.             
  1118.              Empty OTHERWISE statements in CASE...ENDCASE constructs are
  1119.              removed.
  1120.      
  1121.      
  1122.      7.9.6  Convert CASE to IF construct
  1123.             ----------------------------
  1124.             
  1125.             Converts a CASE...ENDCASE construct into the equivalent IF..ENDIF
  1126.             construct which is faster to execute..!!
  1127.             
  1128.      
  1129.      7.9.7  Concatenate WHEN statements
  1130.  
  1131.             This option is not yet enabled in this version of StrongBS.
  1132.             
  1133.      
  1134.  7.10 Miscellaneous Squah Ooptions
  1135.       ============================
  1136.       
  1137.       7.10.1  Evaluate expressions
  1138.               --------------------
  1139.               
  1140.               This option allows mathematical expressions to evaluated
  1141.               to produce a shorter equivalent. Currently, only simple
  1142.               expressions are parsed and evaluated, future versions of
  1143.               StrongBS will improve on this.
  1144.       
  1145.       7.10.2  Line numbering
  1146.               --------------
  1147.               
  1148.               This option will re-number the program with increments of 10 or
  1149.               which ever is suitable for the particular size and number of
  1150.               lines in the program.
  1151.        
  1152.       
  1153.       7.10.3  Insert Squash info
  1154.               ------------------
  1155.               
  1156.               This will insert the line:
  1157.               
  1158.               REM Squashed by StrongBS v.vv on dd mmm yyyy
  1159.               
  1160.               at the start of the output file.
  1161.       
  1162.       
  1163.  7.11 Make Faster
  1164.       ===========
  1165.       
  1166.       7.11.1  Convert 0 to FALSE
  1167.       
  1168.               This will convert any 0 into the FALSE token. 0's inside assembler
  1169.               listings and *Commands will not be converted.
  1170.               
  1171.       
  1172.       7.11.2  Convert DIV to >>>
  1173.       
  1174.               This option is not yet enabled in this version of StrongBS.
  1175.       
  1176.       7.11.3  Convert AND to IF
  1177.       
  1178.               This option is not yet enabled in this version of StrongBS.
  1179.               
  1180.       
  1181.       7.11.4  Convert real vars to integers
  1182.       
  1183.               This option is not yet enabled in this version of StrongBS.
  1184.               
  1185.               
  1186.       
  1187. ••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••• StrongBS •••••••
  1188.  
  1189.  8. Squeezing BASIC programs into Applications
  1190.     ==========================================
  1191.      
  1192.     StrongBS allows you to further squeeze a BASIC program into a file of the
  1193.     type Absolute (&FF8), which can be run just like the original program.
  1194.     The converted program has the advantage of smaller size and is safer
  1195.     against unwanted copying and modifying, because it isn't easily recognizable
  1196.     as a Basic program.
  1197.  
  1198.     StrongBS will try to squeeze the BASIC program using its own method which
  1199.     is similar to that of an LZW method. If the squeezing fails, then the
  1200.     program will not be converted into an Absolute type.
  1201.  
  1202.     There is one important thing you should always remember:
  1203.  
  1204.     If the original BASIC program reads the command line parameters, then
  1205.     the command line parameters would not be passed to your program.
  1206.     You should use an alternative method of using system variables in
  1207.     the !Run file.
  1208.  
  1209.  
  1210.  
  1211.  
  1212. ••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••• StrongBS •••••••
  1213.  
  1214.  9. Special files and Locking Variables
  1215.     ====================================
  1216.     
  1217.     The purpose of the Special files is to inform StrongBS what variables
  1218.     should not be renamed. A special file is a text file with a list of
  1219.     variable names.
  1220.     
  1221.     Variables may be locked against renaming using one of two methods:
  1222.     
  1223.     1. Using REM lines in the BASIC program:
  1224.     
  1225.        You can use a REMark line like this:
  1226.        
  1227.        10 REM LOCK var1, var2, var3, .....
  1228.        
  1229.        The variable names after REM LOCK will not be renamed.
  1230.        Variables may be seperated by colons or may be entered on more REM LOCK
  1231.        lines.
  1232.        StrongBS searches the complete program for REM LOCK lines, so REM LOCK
  1233.        lines can be anywhere in the program.
  1234.        
  1235.     2. Using a Special file:
  1236.     
  1237.        The "Special File" is a text file that lists all variables and
  1238.        routine names that you don't want StrongBS to rename.
  1239.       
  1240.        The first word of the file should be the word "LOCK:" on a separate
  1241.        line. Following this, you list your variables. Please note that
  1242.        this is the word "LOCK" immediately followed by a colon.
  1243.       
  1244.        When listing your variables, you can either list each variable on a
  1245.        separate line or separate them by commas.
  1246.       
  1247.        You can use comments if you like using any of the following
  1248.        reserved characters # or \ or | anywhere in the Special file.
  1249.       
  1250.        Here is an example:
  1251.       
  1252.        LOCK:
  1253.       
  1254.        \The following are the variables that are not to be renamed:
  1255.       
  1256.        menu_pointer%(
  1257.        menu_string$(
  1258.        menu_icon%
  1259.        icon%,icon_flag%,icon_size%
  1260.       
  1261.        \The following are the routines that are not to be renamed
  1262.       
  1263.        PROCcreate_menu
  1264.        FNmenu_width
  1265.  
  1266.  
  1267.        Note: The Special file must always end with a blank line.
  1268.        
  1269.        Note: An array variable should be entered until the first
  1270.              opening bracket only. i.e. for pointer%() use pointer%(
  1271.                       
  1272.        You can use "REM LOCK", any where in your program.
  1273.        You can separate variable names with a comma.
  1274.        You can have as many "REM LOCK" lines as you want.
  1275.  
  1276.  
  1277.     Automatic loading of Special files:
  1278.     ===================================
  1279.     
  1280.     This feature allows you to customise a special file for each one of
  1281.     your BASIC programs. StrongBS will automatically search the
  1282.     current directory (from where the loaded BASIC program comes) for
  1283.     the Special file called "SBSLock" if it finds one, it will
  1284.     automatically load it in.
  1285.     
  1286.     This feature can be enabled or disabled in the Choices window.
  1287.     
  1288.     You can tell that a Special file is loaded by observing the "Special
  1289.     file" indicator on StrongBS main window (next to the Squash button)
  1290.     which will show one of the following messages:
  1291.     - "Loaded"       : a Special file is loaded and will be used.
  1292.     - "Not required" : a Special file is not required for this loaded
  1293.                        BASIC program because it has no EVAL functions.
  1294.     - "Required"     : Some EVAL functions found but no Special file
  1295.                        has been loaded.
  1296.                        
  1297. ••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••• StrongBS •••••••
  1298.  
  1299. 10. Adding Squash Options
  1300.     =====================
  1301.  
  1302.     StrongBS allows you add more "Squash Options" to the existing ones.
  1303.    
  1304.     Options added will automatically appear under the "3rd Party Options" menu.
  1305.    
  1306.     Note: Any type of option can be added. The option does not necessarily have
  1307.           to be a compression or squashing type.
  1308.          
  1309.     A maximum of 32 new Squash Options may be added to the 3rd Party Options
  1310.     menu.
  1311.  
  1312.     If you write any additional options then send me a copy so that it can
  1313.     be included with future versions of StrongBS. The code you write becomes
  1314.     Freeware and the conditions that apply to StrongBS will automatically
  1315.     apply to your code.
  1316.    
  1317.     • How to write your own code?
  1318.       ---------------------------
  1319.      
  1320.      1. You will need to write your code in assembler.
  1321.      
  1322.      2. You don't have to worry about where to store or load the main BASIC
  1323.         program, or your code. StrongBS will take care of that.
  1324.         
  1325.      3. Write your code and test it separately.
  1326.      
  1327.      4. When satisfied that it does what it should, then you can add your code
  1328.         to the "3rdParty" directory, and append some details about your code
  1329.         in the "CodeList" file.
  1330.         
  1331.         A simple example code is given in the 3rdParty directory, have a look
  1332.         at it and also at the "CodeList" text file to get some idea.
  1333.         
  1334.      5. Here is the most important bit your code should do:
  1335.   
  1336.         (a) The first 4 bytes (one word) at the start of your code should
  1337.             be &00000  (i.e. zero).
  1338.             
  1339.         (b) StrongBS calls your code at (code start address)+4
  1340.         
  1341.         (c) The first 4 bytes are reserved so that in future it will be used to
  1342.             pass info (request something) from StrongBS before it executes
  1343.             your code.
  1344.             
  1345.         (d) Your code will be called after all other compression options have
  1346.             been performed. This is important to keep in mind, the program
  1347.             passed to your code is a highly compressed BASIC program!!
  1348.             
  1349.         (e) StrongBS will pass the following information to your code to tell
  1350.             you where the source program is and where it expects you to store
  1351.             the result.
  1352.          
  1353.             Note: Use is made of memory, no disc access required.
  1354.  
  1355.       -----------------------------------------------------------------------
  1356.       |   On entry: StrongBS will pass the following to your code:          |
  1357.       |   ---------                                                         |
  1358.       |             R0 - Memory start address of "Source Program" in memory |
  1359.       |             R1 - Memory start address to store "Output Program"     |
  1360.       |---------------------------------------------------------------------|
  1361.       |   On exit:  Your code should return the following to StrongBS:      |
  1362.       |   --------                                                          |
  1363.       |             R0 - End address of "Output Program". (i.e. end of      |
  1364.       |                  new result program).                               |
  1365.       |             If an error occurred then set bit 31 of R0 and          |
  1366.       |             bit 0-7 to the error number. Bits 8 to 30 will          |
  1367.       |             be the line no. of the program where error occurred.    |
  1368.       |                                                                     |
  1369.       -----------------------------------------------------------------------
  1370.      
  1371.         It is very important that you pass back the end address of the result
  1372.         "Output Program" in R0. StrongBS uses this to calculate the new size
  1373.         of "Output Program" you have generated. "Output File size" = R0 - R1 on
  1374.         entry.
  1375.         
  1376.         Your code gets called by StrongBS front end program which is a BASIC
  1377.         program. So your code is called like this (assuming that your
  1378.         code is loaded by StrongBS in buffer memory code%):
  1379.         
  1380.         A% = Source_Prog_Start%
  1381.         B% = Result_Prog_Start%
  1382.         Result_Prog_End% = USR (code% + 4)
  1383.         
  1384.         You should preserve registers that are important to basic like R13
  1385.         and R14. Any others are free for your code except that you should
  1386.         return result back in R0.
  1387.         
  1388.         StrongBS does not offer you any supporing routines, therefore your
  1389.         code should work on the whole program from start to end.
  1390.         
  1391.         Your code does not have to perform compression! it could do
  1392.         anything to the BASIC program. The result file could be larger than the
  1393.         original! You don't have to worry about size allocated to the result
  1394.         file in memory. In fact you could perform de-compression of the file,
  1395.         although this is not suggested as it is against the purpose of
  1396.         StrongBS.
  1397.         
  1398.    • Important Notes About Your Code
  1399.      -------------------------------
  1400.      
  1401.      1. You must remember that the "Source File" BASIC program passed to
  1402.         your code can be very tightly compressed. Your code should be
  1403.         able to handle this. Therefore, at the testing stage of your
  1404.         code, you should ensure that it does cope with compressed BASIC
  1405.         program listings!!
  1406.         
  1407.      2. The status of the "Source File" BASIC program passed to your code
  1408.         depends on what options have been selected by the user.
  1409.         
  1410.      3. You should not assume that REMarks or spaces have already been
  1411.         removed. The user may not have selected these options. Therefore, your
  1412.         code should make allowance for REMarks and spaces and ignore
  1413.         them.
  1414.         
  1415.      4. Your code should come up with something new, a new option or replace an
  1416.         existing option code.
  1417.         
  1418.         If you think an existing option does not produce the results you want,
  1419.         I suggest you contact me rather than coding your own code.
  1420.         StrongBS is built around some 72 separate codes, these can be very
  1421.         easily changed and customized with very little modification.
  1422.         
  1423.         If you have a new idea for an option that you want to test and
  1424.         experiment with or you are developing another application and
  1425.         think that some of the code used in StrongBS may be applicable or
  1426.         may help speed-up the development stage of your application, let me
  1427.         know so that I could send you some of the source code of the routines
  1428.         and sub-routines I use in StrongBS.
  1429.  
  1430.  
  1431.    The current version of StrongBS assumes that your code can be executed from
  1432.    memory and it will load your code into memory and then call it. StrongBS
  1433.    doesn't allow (yet) 3rd party options to be written as a stand alone
  1434.    application that can be run using the command line nor does it allow
  1435.    the BASIC program to be passed to your code as a file. This may however
  1436.    change in future versions.
  1437.  
  1438.  
  1439. ••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••• StrongBS •••••••
  1440.  
  1441. 11. Speeding BASIC Programs
  1442.     =======================
  1443.  
  1444.  The speed of execution of any program is not just determined by the power
  1445.  of the microprocessor, but also by how the program is written.
  1446.  
  1447.  One way of speeding up BASIC programs is to use integer variables instead
  1448.  of floating point variables, this also reduces the memory space required
  1449.  for storage of the variables.
  1450.  
  1451.  Another aspect is the structure of the program and the way you choose your
  1452.  BASIC keywords. This might have a significant effect on the speed.
  1453.  Of course StrongBS can't do anything about your programming style and will
  1454.  not be able to re-structure a an interpreted BASIC program.
  1455.  
  1456.  Once a program has been debugged, the final version can be doctored to
  1457.  work much faster. This is where StrongBS comes in. The many options in
  1458.  StrongBS all work towards speeding up your program and reducing its
  1459.  size. StrongBS can improve your program speed by 20% to 30% and reduce
  1460.  it size to 30% - 60% of the original size. A smaller BASIC program
  1461.  allows your program to be very responsive in the desktop environment.
  1462.  
  1463.  Hints for speeding-up your BASIC programs:
  1464.  ------------------------------------------
  1465.  
  1466.   1. Use integer variables instead of floating point variables.
  1467.   2. Use a FOR...NEXT loop instead of a REPEAT...UNTIL or WHILE...ENDWHILE.
  1468.      The FOR...NEXT loop is much faster.
  1469.   3. When comparing more than 2 variables avoid using AND. Use IF instead.
  1470.      For example:
  1471.      
  1472.      IF D%=15 AND M%=12 AND Y%=1997 THEN PRINT "something"
  1473.      
  1474.      can be replaced with the faster equivalent:
  1475.      
  1476.      IF D%=15 IF M%=12 IF Y%=1997 THEN PRINT "something"
  1477.      
  1478.   4. In a comparison structure like in IF structure or CASE structure, place
  1479.      the most common condition first. This will speed execution.
  1480.      
  1481.      For example:
  1482.      
  1483.      CASE condition% OF
  1484.      
  1485.      WHEN 32: PROCspaces
  1486.      WHEN 13: PROCcr
  1487.      WHEN 10: PROClf
  1488.      
  1489.      ENDCASE
  1490.      
  1491.      In the above example the WHEN 32 is placed first because it is
  1492.      expected to occur more often than the rest of the conditions.
  1493.  
  1494.    5. Avoid use of calculations inside a loop structure, if at all
  1495.       possible.
  1496.           
  1497.    6. Finally, use StrongBS to produce shortcuts and compress your program.
  1498.       •••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
  1499.    
  1500.  
  1501.  
  1502.  
  1503. ••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••• StrongBS •••••••
  1504.  
  1505. 12. Troubleshooting
  1506.     ===============
  1507.  
  1508.  
  1509.   1. When I run the compressed output program, the error "Unkown or
  1510.      missing variable" is generated.
  1511.       
  1512.      It is most likely that your program contains an EVAL keyword.
  1513.      Ensure that any variables that are passed to the EVAL function
  1514.      as strings, are not renamed by telling StrongBS not to rename
  1515.      these variables (LOCKed variables). See 9 above.
  1516.  
  1517.  
  1518.      
  1519.   2. When I changed some lines in the compressed BASIC program that
  1520.      was created by StrongBS using my favourite editor, the program
  1521.      failed to run and produces errors. It was OK before loading into
  1522.      the editor. What is happening?
  1523.  
  1524.      All editors that handle BASIC programs use either their own code or
  1525.      the built-in BASIC code for tokenising the BASIC line. Secondly some
  1526.      editors work on your BASIC program in text (Ascii) mode not in a
  1527.      tokenised mode, this will even give more errors.
  1528.      
  1529.      The problem is due to the fact that the compressed program has all
  1530.      spaces removed. When tokenising a BASIC line, BASIC and other applications
  1531.      need a space between a BASIC keyword and a variable, else they get
  1532.      confused and they will not tokenise the BASIC keyword, thinking that
  1533.      it is a variable.
  1534.      If the BASIC keyword is not tokenised, this will result in the length
  1535.      of the BASIC line being changed becoming larger than the original.
  1536.      If the line length is already close to the maximum allowed limit of 251
  1537.      bytes per line, it is possible that this limit is exceeded and your
  1538.      editor will give an error that "Line too long". If the line length
  1539.      wasn't exceeded then your editor will happily tokenise the line but
  1540.      using the character equivalent of the BASIC keyword not it's token.
  1541.      When you come to run the program, BASIC will complain that it does
  1542.      not know the particular keyword. If you use the BASIC "LIST" keyword
  1543.      to list the line, you will not be able tell what the problem is, nor
  1544.      if you use an editor that does not show BASIC keywords in a different
  1545.      color.
  1546.      
  1547.      I personally recommend that, if you edit BASIC programs, use an editor
  1548.      that allows you to distinguish BASIC keyword from the rest of the program
  1549.      and most importantly, avoid editing a compressed program.
  1550.  
  1551.  
  1552.      
  1553.   3. My compressed output file failed to run!!!
  1554.   
  1555.      1. Ensure that your BASIC program does not contain the BASIC keyword
  1556.         "EVAL". If it does, then ensure that if "EVAL" is used to evaluate
  1557.         variables or procedure names, these should not be renamed.
  1558.         You will need to lock these variables from being renamed by StrongBS.
  1559.         See FAQ blow on how to do that and 9 above.
  1560.         
  1561.      2. If all EVAL variables are locked, as indicated above, and your
  1562.         compressed program still fails to run then disable all variable
  1563.         renaming and try again. If it did work, then you have discovered
  1564.         a bug in StrongBS, for which I appreciate that you inform me so
  1565.         that I can correct it.
  1566.         
  1567.         You can try compressing with some options disabled to see which
  1568.         option causes the problem.
  1569.         
  1570.         Please see the Section "Feedback to the Author".
  1571.  
  1572.  
  1573.       
  1574.   4. When double clicking on the StrongBS icon, to start it, nothing happens!
  1575.   
  1576.      You copy of StrongBS has become corrupt, try to install StrongBS again.
  1577.  
  1578.  
  1579.  
  1580. ••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••• StrongBS •••••••
  1581.  
  1582. 13. Frequently Asked Questions
  1583.     ==========================
  1584.  
  1585.  
  1586.    1. I am not interested in the many Squashing Options that StrongBS
  1587.       has, I just want to load my program and its accompanying libraries
  1588.       and produce an output that contains my main program plus the procedures
  1589.       and functions in the LIBRARY files that the main program needs. I don't
  1590.       want to remove anything else or compress anything. Can StrongBS do
  1591.       that for me?
  1592.       
  1593.       Just tell StrongBS what you want, and it will do it.
  1594.       To answer your requirement, do the following:
  1595.  
  1596.       1. Copy you LIBRARY programs to the "Library" directory.
  1597.       2. Startup StrongBS.     
  1598.       3. Clear all Squash Modes by clicking on the "Clear All" entry
  1599.          in the "Squash Options" menu. This action clears all selected
  1600.          options.
  1601.       4. Select "Remove unused functions" and "Remove unused procedures"
  1602.          from the "Squash Options Routines" sub-menu.
  1603.       5. Select your LIBRARY files from the "Append-File" menu and load
  1604.          your main program.
  1605.       6. Now you can press the "Squash" button to generate the result file.
  1606.       
  1607.       In the above example we have created a new mode that only removes
  1608.       unused functions and unused procedures. If you want you can add it
  1609.       to the "Squash Modes", so next time you do not have to repeat the
  1610.       above process. StrongBS comes with a Squash mode called "Library"
  1611.       that just removes unused procedures and functions, this can be
  1612.       selected from the Squash options menu list.
  1613.       
  1614.  
  1615.       
  1616.   2. I want StrongBS, on startup, to automatically select my favourite Squash
  1617.      Mode. How can I do that?
  1618.      
  1619.      Load the "Messages" file located in the "Resources" directory into your
  1620.      text editor. Locate the token "SquashMode:". The number after the token
  1621.      is the default startup Squash Mode, change it to the mode you like.
  1622.      The numbers mean:
  1623.      
  1624.      -1  Custom Mode (this is StrongBS default mode).
  1625.      -2  Full including 3rd Party.
  1626.      -3  Full mode
  1627.       0  First user defined mode.
  1628.       1  2nd user defined mode.
  1629.       2  3rd user defined mode, and so on....
  1630.       
  1631.       Note: StrongBS defaults to "Custom Mode" if the mode number is invalid.
  1632.  
  1633.  
  1634.  
  1635.   3. I want to change the color of the progress bar. How can I do it?
  1636.   
  1637.      Load the "Messages" file located in the "Resources" directory into your
  1638.      text editor. Locate the token "BarColor:". The number after the token
  1639.      is the default color, change it to a color number between 0 to 15.
  1640.  
  1641.  
  1642.      
  1643.   4. I have a LIBRARY file that I want StrongBS to compress along with
  1644.      my program, how can I tell it to?
  1645.      
  1646.      You can copy your LIBRARY file to the "Library" directory, then start
  1647.      StrongBS. On startup StrongBS will list your LIBRARY file under the
  1648.      "Library Files" menu. Tick your LIBRARY file in the "Library Files" menu
  1649.      list and from now on it will be compressed along with your main program.
  1650.      
  1651.      You should remember that any library file will only be loaded at the
  1652.      time StrongBS loads the main program, so if you had already loaded
  1653.      your main program and then selected the libraries you will need to
  1654.      load the program again so that the libraries get loaded with it.
  1655.  
  1656.  
  1657.    5. What is "Debug code removal"? how can I use it? I have lots of code
  1658.       of this sort in my program, and I just don't want it to be
  1659.       compressed, I want it to be removed. How can I do that?
  1660.       
  1661.       Any code that you want to be removed completely, and not appear in
  1662.       your output compressed BASIC program can be bracketed between two
  1663.       identifiers, so that StrongBS knows about it. The start identifier
  1664.       is "REM --[" and the end identifier is "REM ]--". Anything between
  1665.       these two identifiers will be completely removed.
  1666.       Here is an example:
  1667.       
  1668.       
  1669.         10 .......
  1670.         20 REM --[
  1671.         30 debug%=TRUE
  1672.         40 REM ]--
  1673.         50 .......
  1674.         .....
  1675.       1030 .......
  1676.       1040 REM --[
  1677.       1050 IF debug% THEN PROCdebug_msg
  1678.       1060 REM ]--
  1679.       1070 .......
  1680.       .......
  1681.       4000 REM --[
  1682.       4010 DEF PROCdebug_msg
  1683.       4020 .....some more debugging code ...
  1684.       4030 ............
  1685.       4040 ENDPROC
  1686.       4050 REM ]--
  1687.       4060 ....
  1688.       ........
  1689.       
  1690.       In the above example program, all code that would only be used during
  1691.       the development stage for debugging is bracketed between the two
  1692.       identifiers. If the option "Remove Debug" is selected, then StrongBS
  1693.       will automatically remove lines 20 through 40, lines 1040 through 1060
  1694.       and lines 4000 through 4050.
  1695.       
  1696.  
  1697.       
  1698.    6. I want to create my own "Squash Modes". How can I do that?
  1699.    
  1700.       First, setup the squash options you need by selecting those you
  1701.       need and de-selecting those you don't.
  1702.       Now go to the "Create New Mode" sub-menu in the "Squash Modes" menu.
  1703.       Enter the "Mode Title", this is the title of the mode that will
  1704.       appear in the Modes Menu, and enter the "Mode File", this is the filename
  1705.       under which your mode definitions will be saved into the Modes
  1706.       Directory. Press "SAVE" when ready.
  1707.       If you now, go to the "Modes Menu" you will see the "Squash Mode" you
  1708.       have created listed and selected as the current Squash-Mode.
  1709.       
  1710.  
  1711.       
  1712.    7. How can I remove a "Squash Mode" that I have created from the "Squash
  1713.       Modes" menu?
  1714.       
  1715.       In the "Modes Directory", locate the filename that contains the mode
  1716.       definition and delete it. Now re-start StrongBS, it will be gone.
  1717.  
  1718.  
  1719.       
  1720.    8. I only have two variables that I don't want StrongBS to change. I don't
  1721.       want to use a "Special File", is there a shortcut?
  1722.       
  1723.       You can use a REM line in your program. Follow the REM keyword with the
  1724.       word "LOCK" and then your variable name.
  1725.       
  1726.       Here is an example:
  1727.       
  1728.       If you want the variables memory_area% and pointer%() not to be
  1729.       renamed, then you should have the following line in your program:
  1730.       
  1731.       1000 REM LOCK memory_area%,pointer%(
  1732.       
  1733.       Important Note: An array variable should be entered until the first
  1734.                       opening bracket only. i.e. for pointer%() use pointer%(.
  1735.                       
  1736.       You can use "REM LOCK", any where in your program.
  1737.       You can separate variable names with a comma.
  1738.       You can have as many "REM LOCK" lines as you want.
  1739.  
  1740.  
  1741.       
  1742.    9. Can I re-compress the result program again to gain further savings?
  1743.    
  1744.       Yes, you can do that by clicking the "Squashed" button again as
  1745.       many times as you like.
  1746.       
  1747.       StrongBS will try its best to produce the best compression from the
  1748.       first pass. Some routines have been optimised to do that already,
  1749.       however, some routines still don't achieve all they could from the
  1750.       first pass, and a second compression pass may squash the program
  1751.       further saving on few bytes!
  1752.       
  1753.       
  1754.             
  1755.   10. How can I tell StrongBS about my "Special File" which contains
  1756.       my locked variables?
  1757.       
  1758.       Just drop your "Special File" into StrongBS. StrongBS will then use
  1759.       it for the current BASIC program already loaded into memory.
  1760.       
  1761.       You should load your BASIC program BEFORE loading the Special File.
  1762.       
  1763.       When loading a BASIC program, StrongBS ignores any previously loaded
  1764.       Special files.
  1765.  
  1766.       StrongBS can automatically load a special file for each BASIC program
  1767.       that you load. See Chapter 9 above.
  1768.       
  1769.       
  1770.       
  1771.   11. I have a program that has locked variables defined after the "REM LOCK"
  1772.       keyword, can I add more locked variables using a "Special File"?
  1773.       
  1774.       Yes. Any locked variables in a "Special File" are added to those
  1775.       already defined in your program after the "REM LOCK" keyword if
  1776.       any.
  1777.  
  1778.  
  1779.      
  1780.   12. In what format should I write the "Special File"?
  1781.   
  1782.       The "Special File" is a text file that lists all variables and
  1783.       routine names that you don't want StrongBS to rename.
  1784.       
  1785.       The first word of the file should be the word "LOCK:" on a separate
  1786.       line. Following this, you list your variables. Please note that
  1787.       this is the word "LOCK" immediately followed by a colon.
  1788.       
  1789.       When listing your variables, you can either list each variable on a
  1790.       separate line or separated them by commas.
  1791.       
  1792.       You can use comments if you like using any of the following
  1793.       reserved characters # or \ or | anywhere in the Special file.
  1794.       
  1795.       Here is an example:
  1796.       
  1797.       LOCK:
  1798.       
  1799.       \The following are the variables that are not to be renamed:
  1800.       
  1801.       menu_pointer%(
  1802.       menu_string$(
  1803.       menu_icon%
  1804.       icon%,icon_flag%,icon_size%
  1805.       
  1806.       \The following are the routines that are not to be renamed
  1807.       
  1808.       PROCcreate_menu
  1809.       FNmenu_width
  1810.  
  1811.  
  1812.       Note: The Special file must always end with a blank line.
  1813.  
  1814.  
  1815. ••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••• StrongBS •••••••
  1816.  
  1817. 14. Feedback to the Author
  1818.     ======================
  1819.                           
  1820.     The Author encourages any one using this application to report any
  1821.     bugs and/or errors that are discovered in StrongBS itself or in
  1822.     the result compressed program.
  1823.   
  1824.     The Author also welcomes any suggestions and ideas for improvement.
  1825.   
  1826.     Bug reporting:
  1827.     --------------
  1828.   
  1829.     If you find a bug then please give me as many details as possible as to
  1830.     the circumstances that cause it, try and get it repeatable.
  1831.   
  1832.     Try to isolate it to an individual Squash Option by compressing your program
  1833.     using one or group of options at a time.
  1834.   
  1835.     You may send me your original un-compressed BASIC file that produces
  1836.     the error. If you do that please ensure that the program you send is
  1837.     a stand alone program, i.e. does not need other resources to run, like
  1838.     Template files, !Run files, Sprite file, etc.. A bug in StrongBS may
  1839.     not cause an error message to be generated when your compressed program
  1840.     is run, it may cause it to behave differently!!
  1841.   
  1842.     You can also give detailed useful info by comparing the line of the
  1843.     compressed BASIC program that gives the error with the original line
  1844.     of the un-compressed program, to do that de-select the "Line Numbering"
  1845.     option, to speed line number comparison.
  1846.   
  1847.     Suggestions for improvement:
  1848.     ----------------------------
  1849.   
  1850.     If you have any suggestions and/or ideas for improvement that you want to
  1851.     see in StrongBS, please let me know, so that every one can benefit.
  1852.   
  1853.   
  1854.     Contacting me:
  1855.     --------------
  1856.   
  1857.     You can contact me by email: mohsen@qatar.net.qa
  1858.   
  1859.     If you want to send any program you could send them as attachments to
  1860.     the email message using any encoding/attachment you prefer.
  1861.  
  1862.  
  1863. ••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••• StrongBS •••••••
  1864.  
  1865. 15. Obtaining future versions of StrongBS
  1866.     =====================================
  1867.  
  1868.  
  1869.     I will be sending any future versions of StrongBS to:
  1870.  
  1871.     1) Hensa: e-mail: archive-server@micros.hensa.ac.uk
  1872.               ftp   : micros.hensa.ac.uk (IP 148.88.8.84)
  1873.  
  1874.     2) The Archimedes Public Domain Library (run by David Holden):
  1875.        39 Knighton Park Road
  1876.        Sydenham
  1877.        London
  1878.        SE26 5RN  
  1879.  
  1880.     3) http://www.geocities.com/SiliconValley/Heights/7423
  1881.  
  1882. ••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••• StrongBS •••••••
  1883.  
  1884. 16. Credits
  1885.     =======
  1886.  
  1887.  
  1888.     See the "Credits" file.
  1889.  
  1890.  
  1891. ••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••• StrongBS •••••••
  1892.  
  1893.  
  1894.                 ••••••••• Hope you find StrongBS useful •••••••••
  1895.  
  1896.  
  1897.  
  1898.   © Mohsen Alshayef
  1899.   
  1900.  email: mohsen@qatar.net.qa
  1901.   
  1902.     28th June 1997
  1903.