BGL Variables Overview

The concept of using variables in commands in the BGL language can be traced back to Flight Simulator’s first graphics language, LOGOL. LOGOL included many of the same variable-oriented commands as BGL and could perform conditional branching, as the language was interpreted based on the variables.

Two basic types of variables were defined, ROOTVAR and GLOBAL. ROOTVAR variables are root variables. ROOTVAR variables are commonly used in scenery design to define elements such as time of day (tod) radar view flags (radflg), and aircraft location. A file named Rootvar.asm equates the ROOTVAR variables to their proper offsets and is included in any scenery files. Rootvar.asm is also included in Flight Simulator’s code assemblies and provides a common data area where code within Flight Simulator can communicate with scenery code in scenery files.

The ROOTVAR type of variables only went up to 03dch; this is where the GLOBAL type of variables comes in. Flight Simulator’s GLOBAL variable area begins at 03deh. Because LOGOL commands that used variables accessed them using simple address offsets (16-bit, range 0000 to 0ffffh), variables outside of ROOTVAR could also be accessed. This meant that LOGOL could examine and use all Flight Simulator variables in the global variable space (found in Global.asm). The ROOTVAR variable area was available to Flight Simulator scenery and code and its variable locations was frozen; this meant that Flight Simulator scenery could be written with the guarantee that variable addresses of future versions weren't going to shift and make the scenery obsolete.

Some LOGOL code was used within earlier versions of Flight Simulator. For example, LOGOL code was often found in internal systems that used the graphics system such as weather, CFPD flight path display, aircraft models, and so on. Because these systems were always built using Flight Simulator's code, and because these small databases weren't intended to be ported to later versions of Flight Simulator, many of the databases pushed the limits and included Global.asm in their assemblies; this enabled LOGOL code to access many variables outside the ROOTVAR area.

With the advent of Aircraft and Scenery Designer, the "rules" were broken and aircraft databases were transportable between versions of Flight Simulator. Flight Simulator development anticipated this change, and had "frozen" the Global.asm variable area and set the precedent that, for each new version, new variables would be added in new "frozen sections" at the end of the global area.

Because of the differences in memory handling using virtual memory and flat model, the release of the Windows 95 version of Flight Simulator , meant that it no longer made any sense to refer to variables by their absolute offsets; the old offsets became identifiers or labels that are now indexed into an internal table where the current variables are located.