•  Back 
  •  Main 
  •  Index 
  •  Tree View 
  •  Cross references 
  •  Help 
  •  Show info about hypertext 
  •  View a new file 
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 $*& option influences the multiplication of two integer variables, of which
at least one is a four-byte variable. Normally in such cases a subroutine to
multiply two four-byte variables is called. If the $*& option is enabled,
however, the Motorola 68000 processor's muls instruction is used instead.

This has two consequences:

1. Program execution is speeded up.

2. The muls instruction multiplies two two-byte values and produces a four-byte
   value as the result. Therefore, if the four-byte variables to be multiplied
   contain values in excess of the range of a two-byte variable, the use of
   only two bytes will generate a different result from when option $*& is not
   enabled.

Example: The lines

    $*&
    b%=40000
    c%=10
    a%=b%*c%
    PRINT a%

will produce the expected result of 400000 in the interpreter. The compiled
program, however, outputs -255360 because only two bytes of b% have been used,
and these two bytes cannot represent as large a value as 40000.

The difference is once again illustrated by the code generated from the line
a%=b%*c% with and without option $*&:

    with $*&                 with $*%, without $*&
    move.l  -$7ff8(a5),d0    move.l  -$7ff8(a5),d0
    move.l  -$7ffc(a5),d1    move.l  -$7ffc(a5),d1
    muls    d1,d0            bsr     LMUL
    move.l  d0,-$8000(a5)    move.l  d0,-$8000(a5)

The default setting is option *% which leads to LMUL being used.

Memo: $*% is the default.