Squash Options are divided into 10 categories:
Although, in the following description, use is made of the words remove, convert, etc., StrongBS will only perform an operation such as removal of a code or conversion of a token, etc., if the test conditions which apply to the particular operation are met. For example when removing brackets, StrongBS will test the mathematical operator priority of each operator inside and outside the brackets. StrongBS also makes allowance for bugs in the current versions of the BASIC interpreter (or as Acorn prefer to call them "features") and will ensure that the result BASIC file runs correctly.
The following description does not explain HOW StrongBS does it, it only gives a brief description of what each option means and what are the expected results. It is assumed that you are familiar with BASIC and the BASIC assembler.
This category provides 11 squashing options. These options will only work on assembler listings inside a BASIC program. Although BASIC programs are very rarely distributed with an assembler source code, if you decide to distribute the source code because the program needs to generate the code at run time then StrongBS will aid in compressing the assembler listing.
Note: This option is automatically selected if you select the "Variables Renaming" option, as register name are considered by StrongBS another form of variables!
SWI names that can not be converted will be left as is. Therefore, if a SWI name is only existent in a module that is not currently loaded, all SWI names for the that module will not be changed. You will have to load the module before compressing the BASIC program. StrongBS will not complain about the non-existence of the module.
LDR R0,[R1,#0] -----> LDR R0,[R1]
LDR R0,[R1],#0 -----> LDR R0,[R1]
Note: Due to what seems to be a bug in the BASIC assembler, the LDRT Rd,[Rn],#0 or STRT Rd,[Rn],#0 will not be converted as the BASIC assembler will treat the shorter instructions differently.
Once enabled, the option will allow converting a register list in the STM and LDM instructions into the shortest form.
LDMFD R13!,{R0,R1,R2,PC} ------> LDMFD R13!,{R0-R2,PC}
EQUS ------> =
EQUD or DCD ------> &
EQUB or DCB ------> =
EQUW or DCW ------> =
MOV R0,R1,LSL #2 becomes &&E1A00101
LDMFD R13!,{R0-R12,PC} becomes &&E8FD9FFF
ORREQ R10,R10,R11,LSL #8 becomes &&018AA40B
One example application that I have come across is the Acorn !Maestro application. If you want to squash the !RunImage file of this application then this Option should be selected off.
StrongBS will, depending on the unused variable location, either remove the variable only or remove the whole statement or the complete line.
Example:
10 top%=1
20 val%=3
30 result%=top%+val%
becomes
30 result%=1+3
The variables top% and val% and lines 10 and 30 are removed.
Example:
10 start=100
20 end =300
30 final=start+end
becomes
30 final=100+300
The variables 'start' and 'end' and lines 10 and 30 are removed.
SWI names that can not be converted will be left as is. Therefore, if a SWI name is only existent in a module that is not currently loaded, all SWI names for the that module will not be changed. You will have to load the module before compressing the BASIC program. StrongBS will not complain about the non-existence of the module.
Examples:
pointer%?0=A% ----> ?pointer%=A%
pointer%!0=A% ----> !pointer%=A%
?(pointer%+3)=A% ----> pointer%?3=A%
!(pointer%+4)=A% ----> pointer%!4=A%
A line is not removed if it is referenced by another part of the program.
A line is not removed if it is referenced by another part of the program.
Examples:
Z%=Y%+(1+2*3) ----> Z%=Y%+1+2*3
X%=(Y%+1)>>1 ----> X%=Y%+1>>1
X%=-(A%+B%*4-5+10) ----> X%=-A%-B%*4+5-10
X%=Y%-(A%+B%-(Z%+C%-(C%+2*-6)+4)+A%*X%)
becomes:
X%=Y%-A%-B%+(Z%+C%-C%+2*-6+4)-A%*X%
X=0.0 becomes X=0
X=0.1200 becomes X=.12
The exception is that if ELSE is followed by a *Command
Example:
10 FOR loop%=0 TO 1000 STEP 1
becomes:
10 FOR loop%=0 TO 1000
SYS "OS_xxx",0 becomes SYS "OS_xxx"
SYS "OS_xxx",A%,0 becomes SYS "OS_xxx",A%
SYS "OS_xxx",0,A% becomes SYS "OS_xxx",,A%
etc...
X%=Y%+0 becomes X%=Y%
Y=Z-0 becomes Y=Z
etc...
Examples:
X=-4<<6 ----> X=-256
Y=Y OR -32+4 ----> Y=Y OR -28
M%=A%*100/2 ----> M%=A%*50
X%=P%+2*1024+25 ----> X%=P%+2073
Examples:
10 SYS "OS_SWINumberFromString",,"OS_Write0" ¸ Write0
20 SYS "OS_SWINumberFromString",,"OS_WriteC" ¸ WriteC
30 SYS "OS_SWINumberFromString",,"OS_ReadMonotonicTime" , time
become:
10 Write0=2
20 WriteC=0
30 time=66
REM Squashed by StrongBS v.vv on dd mmm yyyy
at the start of the output file.