Topic : The GFA-Basic Compendium Author : GFA Systemtechnik GmbH Version : GFABasic.HYP v2.98 (12/31/2023) Subject : Documentation/Programming Nodes : 899 Index Size : 28056 HCP-Version : 3 Compiled on : Atari @charset : atarist @lang : @default : Document not found @help : Help @options : +g -i -s +z @width : 75 @hostname : STRNGSRV @hostname : CAB @hostname : HIGHWIRE @hostname : THING View Ref-FileThe $S> and $S< options determine the optimizing criterion for the SELECT-CASE instructions. $S> leads to optimization by execution time, $S< according to program length. You have seen in the last section how, at the end of the program blocks after the CASE and the DEFAULT instructions, bra.s branches into the line following ENDSELECT. However, if the program blocks are longer than in the last section, where they only contained an addq, bra must be used instead of bra.s. The space required for the specification of the jump distance is larger with bra than with bra.s. The $S< option can be used to save this space. It results in the bra instruction at the end of a CASE block to be directed to the bra instruction of the next block (after the next CASE or DEFAULT), as long as the jump distance is small enough. This could result in a chain of short branch jumps which finally ends behind ENDSELECT. This chain of jumps from bra.s to bra.s may again be altered by the compiler at a later stage of optimization. This not altogether straight forward problem is clarified by the following listing: move.l -$8000(a5),d0 bra L1 _CASE_1: addq.l #$1,-$8000(a5) bra.s L0 _CASE_2: addq.l #$1,-$8000(a5) L0: bra L2 _DEFAULT: addq.l #$1,-$8000(a5) ... Many instructions ... L2: bra.s _ENDSEL L1: cmpi.w #$1,d0 ;CASE evaluation beq _CASE_1 cmpi.w #$2,d0 beq _CASE_2 bra _DEFAULT _ENDSEL addq.l #$1,-$8000(a5) The crucial point here is the line bra.s L0. This branch should really go to behind ENDSELECT. But the distance would be too far for a bra.s because of the many instructions in the DEFAULT block. Hence the branch is to the bra command in the next CASE program block. While this method is executed more slowly, it requires less space than the code generated with $S>, which does without such jumps. Memo: $S> is the default.