SCASM 2.88

FAQ - frequently asked questions

  

index:
 
back to main index
 
What can I do, when I get an Linebuffer overflow error?
What to do when getting an destination out of range error

This is the beginning of an FAQ


What can I do, when I get an Linebuffer overflow error?
 

First of all some words about some buffers in SCASM.

LINBUF
This is the source code line input buffer. It has to hold a complete instruction. Normally this is not a problem but many new objects uses very long point lists which are longer than the 20kb standard buffer size.
BUF
This is the working buffer. It has to hold the binary code for one complete Area.
AREAMX
This value is not longer important for FS2000 and later. Simply set it to the same size as "BUF".
A typical error message looks like:
Error in line 20433
  -> EndA
  ->  -> Linebuffer (20478) overflow, line 157/536 truncated !

  -> fatal error, code: 32767
Scasm compilation status: aborted

To solve this problem use the Set( ) command to increase the buffer size. Place the Set() commands at the beginning of your source text. SCASM needs to see them before processing the first Area() command.
Set( LINBUF 1024 )
Set( BUF 600 )
Set( AREAMX 600 )
Header( 1  44:53:32   44:52:57  -63:30:52  -63:30:52  )
LatRange(  44:52:43   44:53:33 )

Area( C   44:53:14.3906  -63:30:51.6003 100 )
    IfVarRange( :L020 346 2 32767 )
    PerspectiveCall( :L026 )
    ...

TOP 

What to do when getting an destination out of range error
 
"Destination out of range" means that SCASM has to insert a jump distance into a BGL instruction that does not fit that size. Many BGL instructions can only handle a 16 bit jump distance (+/-32767). This is a typical error message:
Error in line 20436
  -> EndA
  -> destination ":End" out of range (603470), source line 14

The error is detected at the EndA command because this command causes SCASM to calculate the jump distances. So you have to look at the command at "source line 14". Maybe you will see the following lines there:
    ...
Area( C  44:53:14.3906  -63:30:51.6003 100 )
    IfVarRange( :near_e 346 2 32767 )
    PerspectiveCall( :obj )
    ShadowCall( :obj )
:near_e
    Jump( :End )  ; <== this is the trouble making line 14

:obj
    RefPoint( rel :L050 0.5  44:53:14.3906  -63:30:51.6003 ... )
    ...

The jump distance is simply too far away for the "Jump( :End )" instruction and so we have to replace the Jump by a Jump32( ) instruction:
Area( C  44:53:14.3906  -63:30:51.6003 100 )
    IfVarRange( :near_e 346 2 32767 )  ; <== see example below
    PerspectiveCall( :obj )
    ShadowCall( :obj )
:near_e
    Jump32( :End )  ; <==================

:obj
    RefPoint( rel :L050 0.5  44:53:14.3906  -63:30:51.6003 ... )
    ...

Unfortunately not all jumps and calls have a 32-bit version. So the following example will also cause an out of range error if the distance to :End is more than 32767 bytes away. The solution of this problem is to insert another jump for an intermediate landing or to jump to an nearby already existing jump32 as shown in the above code example.
Area( C  44:53:14.3906  -63:30:51.6003 100 )
    IfVarRange( :End 346 2 32767 )  ; <== may also cause trouble
    PerspectiveCall( :obj )
    ShadowCall( :obj )
    Jump32( :End )

:obj
    RefPoint( rel :L050 0.5  44:53:14.3906  -63:30:51.6003 ... )
    ...

TOP 

 

    
TOP © Manfred Moldenhauer