SCASM 2.88

pseudo commands


command index:
back to main index
Set( )
Include( )
Macro( )
Mif( ), Melse, MifEnd
Grp( )
CopyRight( )
Uvar( )
Map( )
Error( )
VTrace( )
Internal section bits

Pseudo commands are commands that do not produce any code. They are used to send aditional instructions or information to the assembler itself.

Set( flag value )

This is a SCASM configuration command to set some internal flags and variables.

table of flag/variable names:
RAW  If set to 1 the RAW output is enabled. The -RAW command line switch is not longer needed.
LOGFILE  1 enables error output to "SCAERROR.LOG" Same as "-l" command line switch
MAPFILE  1 enables the mapfile (.MPF) output -> -m
OBJID  This flag controls the object ID generator when object libraries are compiled (2.36+). 1 (default) ID0 value is incremented.
0 ID3 value is incremented. Only needed for backward compatibility with FS98 style library format.
BUF  Wanted buffer size in KB. This option is only needed for compiling large RAW BGL sections for MDL files of more than 100kB size or for very large numbers of synth tiles or navaids.(v 2.43)
Note, the buffer size has nothing to do with the maximum code size of an Area() command. This size is limited by the binary format of the BGL command(s).
Use this option before increasing the AREAMX threshold.
areamx  Maximum allowed size of an Area() block in KB. Default = 16, maximum 64.
area15mx  Maximum allowed size of an Area15() block in KB. Default = 16, maximum 64.
LABELS  Sets the size of the internal symbol table. The default size is 1500. You only need to increase this number if you are working on very large MDL or library files. (version 2.45 and later)
PATCHES  As all one-pass assemblers SCASM needs a patch table. The size of this table should be about 1.3 to 1.5 times of the maximum label number. Default value is 2000. (SCASM 2.45 and later)
LINBUF  This option sets the size of the internal line buffer. You will only need to increase the default size of 20 KB if you get an "Line buffer overflow" error during compile time. This sometimes happens with point lists of very large objects.
This option is mainly the same as the -LB command line switch.
The only difference is that the wanted size must be entered in KB.
MAXENTRY  Sets the maximum size of the object entry index table. The default size is 3500. A larger size is only needed for a large number of objects which needs to be sorted, such as navaids or classic Synth Tiles.
MAXPTLST  Sets the maximum number of points in the point list buffer [Points(), VecPoints()]. Default size is 1000. For it's automatic vector calculation feature, SCASM needs to have ALL point coordinates for all point numbers available all the time.
interr  Same as -i switch,
1 = ignore integer errors. Default = 0
fmtcast  Same as -f switch,
0 = format casting disabled. Default = 1
ppperr  Number of points per polygon to trigger the error message. Default = 100.
0x500  FS5.0
0x510  FS5.1
0x600  FS95
0x610  FS98
0x650  CFS1
0x700  FS2000
0x732  CFS2
0x800  FS2002
This command is now used by SCASM 2.88 to select the correct instruction format of the BGL instruction. In FS2002 it is important to set it to 800 if you want to use the new instructions in AFD files.

A change of some of these values may probably result in display problems in older FS versions. Set commands should be placed at the beginning of the source code file.


Include( filname.ext )
Includes this text file. The file is simply copied into the current source file. In SCASM 2.10 and later an include file can contain other Include()'s or Macro()'s.
Any correct path/filename is accepted (up to 260 characters).
This makes it possible to make a main source file like:
  Header( ... )
LatRange( ... )
Include( ... )
Include( ... )
with all the other commands in the Include() files. Note, Include()'s are handled now as Macro()'s without parameters. You cannot use them to increate the nesting level.


Macro( filename.scm p1 ... pn )

Similar to include files the text of an macro file is simply copied into your source file. But the advantage of an macro is that parameters can be passed to it. These parameters are inserted into the text during compile time. This makes it very easy to recycle scenery objects. If you want to design a house, it is usually a good idea to do this as a macro file and use the strings %1 and %2 for the latitude and longitude values of its position. Now you can put this house into your scenery simply by puting its actual Lat/Lon position as parameters one and two into the Macro() instruction. SCASM allows up to 30 parameters and each can have 32 characters.
Macros are allowed in visual scenery (section 9), dynamic scenery (section 15) and section 16. In SCASM 2.10 and later macros are allowed to contain other macros. This nesting is limited to 8 levels, and Include()'s are handled now as macros without parameters.
If a macro (file) name or a macro parameter contain spaces you have to use " to mark the begin and end of it (SCASM 2.15 and later).

macro call:  macro( example.scm N54:10 E10:05 )
macro file:  Area( 5 %1 %2 20 )
-> %1 is replaced by N54:10
-> %2 is replaced by E10:05

Note: In most cases macros will contain a whole Area() block. But if you are using the macro feature to generate some code within an area (for example 'hand made' aproach lights in an runway area), and if you are using the same macro more than once in the same area, and if the macro contains label definitions you will get an "duplicated label" error.
To avoid this you can include the special @ character in the label name. This character causes SCASM to insert the internal macro counter in the Label name. Since the internal macro counter is a 3 digit code the name is then limited to 12 characters.
:Label@ is expanded to :Label095 during the expansion of the 95th macro.


Mif( <expression> )
These pseudo commands are used to enable and control conditional compilations. In earlier SCASM versions they are only used in macros for visual scenery. That's why they have the "M" in the name. Now they can be used anywhere in the source text and they even can be nested (up to 8 levels).
<expression> can be a mathematical formula or a single number.
mif( %1 )
The macro parameter 1 is tested.
If it's value is NOT 0 (that is TRUE) the following commands are compiled. Only a zerotest is done.
mif( [%2 == 3] )  The expression "[%2 == 3]" is evaluated and then tested.
melse  Optional. If the "mif( ... )" condition is FALSE this section is compiled by the assembler.
mifend  Marks the end of the conditional compilation.

If an error is detected and the compiling condition is FALSE, then the error messages will have the line number of the Mifend command.


GRP( <Lat> <Lon> )

This command writes the given position to a SCASM internal General Reference Point memory so it can be used later to calculate new positions.

There are two levels of stored positions, one defined outside of an Area() - EndA block and another defined inside. Every time an Area() command is compiled with direct Lat/Lon values, the position is stored into a temporary memory. This position is valid until the EndA command is executed. But the new Lat/Lon position is not stored if it is a calculated one, using the "d" or "r" option. This means that all calculations are done with the position defined outside the area block.
If you want a new base for calculations you have to use direct Lat/Long values in the Area() command or insert a new GRP() command following directly the Area() and use the same calculations. This new GRP will be deleted at the end of the area giving you back the old position defined outside the area block. You can use the stored position to calculate a new referencepoint position in every command that requires a Lat/Lon pair input.

There are two options to calculate a new position:
d <delta_Lat/north-south> <delta_Lon/east-west>
r <heading> <distance>

If your new position is 150 meters east and 60 meters south of the stored position you can enter:
RefPoint( abs :Label 1.0 d -60 150 )
and SCASM will calculate the new reference point.
If your new position (i.e. for LandMe) is 400 meters away in heading 273.4 degrees you can enter:
LandMe ( r 273.4 400 0 90 r 93.4 400 0 27 )
Do not use this feature for long distances.


CopyRight( any text with up to 80 characters )

Traditionaly many 3rd party scenery tools insert a text signature in the output file. Typically this is the name and version of the tool which generated this file. SCASM does the same. This instruction lets you add your own text to this signature.

This text has no effect to FS. This command should be used only once per source/BGL file. If this command is found more than once, only the last one is used (no error message). For this reason it is not a good idea to use it in a macro file.

No underscores '_' are needed for SPACE characters in the text.


Uvar( $name value )

This is an internal command to create and initialise an SCASM internal user variable. The names are case sensitive. This command has no effect to the BGL code. User variables can be used by experts for more flexible parameter calculations.

$name  the name of the variable
value  any legal expression in SCASM syntax

Note: variables which are defined within an Area() are only valid in this Area() and are deleted when the EndA statement is compiled. Other variables are always valid and are even visible from macros and includes.

SCASM can handle up to 200 user variables.

Besides user variables there are some other internal values which might be of interest:

$IC  internal instruction counter, only valid in Area()'s
$PI  The number PI = 3.414 (SCASM 2.02+)
$Section  This is SCASM internal section bitmask.
There is only one bit set for the currently scanned section (i.e. 0x001 for section 0 = nav or 0x200 for section 9 = visible scenery).(SCASM 2.03+)
$Version  The SCASM version number * 100


Map( stat )

This is another internal command which can be used to enable or suppress the map file generation for some parts of the source code file.
See also the "-m" command line option.

stat  1 = on
0 = off

For more information please see the documentation which comes with the BGLTST.EXE program which uses this information to display the source code line(s) related to an detected error.


Error( any error message )

This pseudo command produces an error message and stops the compilation.

This instruction can be used as a reminder for changes you want to do later or to ensure that a specific source file (macro) is compiled with the correct SCASM version.

For example, if internal functions (version 2.02 and later) are used for the parameter calculations, you can use this instruction to notify the user that he needs an compiler update:

 mif( [$Version < 202] )
   ( You need at least SCASM 2.02 to compile this code )
 Points( 0 -15  0  int[ %6 / 2 ]

In this example the macro receives a parameter from the caller. If the %6 macro parameter has the value 15 the result would be 7.5. Since FS does not accept fractional numbers in point coordinates, an error message is normally generated. The int[ ] or the round[ ] function can now be used to convert the number format but these are not available in earlier versions.


VTrace( mask "any text" <expression> )

This is an SCASM internal test command for debugging. It does not produce any code. You can use this command if you want to know the result of of some SCASM calculations.
The output is done to the standard error device, which is the console (DOS) window or the "SCAERROR.LOG" file.

mask  This is a bitmask in HEX format to indicate the section when this command shal be executed. If you are unsure about this value set it to -1 (or 200 for section 9, visual scenery).
"any text"  Any text you want to see on the output device. (max 120 chraracters)
<expression>  Any valid expression in SCASM syntax.


Some important BGL section numbers and their hex bitmask values internally used by SCASM. Used in section mask's in Mif() and SCLINK. You can omit leading 0's.
sect.  bits   
00001  Nav frequencies (ILS, VOR)
00002  Synth tiles (Seed) size 1 to 6
00002  Synth tiles size 6 (smallest, high priority / all tiles are internally handled with the same mask by SCASM)
---  n/a
00100  FS2002 terrain data ...
00200  visual scenery
10  00400  object library (not handled by SCLINK)
11  00800  Airport menu (FS6 and before)
13  02000  ATIS
14  04000  NDB
15  08000  dynamic scenery
16  10000  Markers, LandMe, TimeZone, elevated surface
19  80000  exclusion and exception data
20  100000  AFD data (not handled by SCLINK)

TOP © Manfred Moldenhauer