VOR Placement Example

This topic includes an example of how to build a BGL database that includes a VOR. In this example, only one VOR is set up, at frequency 110.60 MHz, which corresponds to channel 52. Because this is the first and last channel in this database, the minimum and maximum channel number at offset 22 and 24 are set to channel 52.

;Tutorial Example, Database 3
;A VOR placed at O'Hare airport in Chicago
include asm.inc ;include this in all .asm files!
include dumper.inc; we're dumping data from this file
.data
dumper_dataDUMPERDATA{the_data, the_data_size, 'test.bin'}
the_dataequ$

;DATABASE HEADER*************************************************************
dw0001;00 world set number (not saved to file list)
; 0=off 1=fs5 default world
dd000490000h;02 N bound meter units
dd0003f0000h;06 S bound
dd0cf000000h;10 E bound 32-bit pseudodegrees
dd0bf000000h;14 W bound
ddVOR_DATA - the_data;18 VOR_DATA
dw52;22 lowest vor freq (channel 0–199)
dw52;24 highest vor freq (108.00–117.95)
dd0;26 seeds level 8
dd0;30 seeds level 9
dd0;34 seeds level 10
dd0;38 seeds level 11
dd0;42 seeds level 12
dd0;46 seeds level 13
dd0;50 seeds level 14
dd0;54 seeds level 15
dd0;58 OBJECT_DATA
dd0;62 LIBRARY_DATA
dd0;66 FACILITIES_DATA
dd0;70 ANCHOR POINT DATA
dd0;74 COM RADIO DATA
dd0;78 ADF DATA
dd0;82 DYNAMIC OBJECT PATHS
dd0,0;86 Library id min
dd0,0;94 Library id max
dd0;102 MISC_DATA (ground alt db)
dd0;106 TITLE AND DESCRIPTION DATA
dd0;110
dd0;114 EXCEPTION LIST PTR
dd0;118
dd0;122 (not saved to file list)
dw0;126 (not saved to file list)
;128

;UNIVERSAL ENTITY OPCODES ***********************************************
EOLmacro
db0
endm

LATBAND_RELmacrolatmin,latmax,band_addr
db21
dwlatmin;;lat min (inclusive) 512M units
dwlatmax;;lat max (exclusive)
dd(offset band_addr) - (offset rel_base);;32-bit rel_base relative ptr
endm

BAND_SET_DEFINEmacrobandset_addr
db1
ddbandset_addr-rel_base
endm

BAND_SET_NULLmacrobandset_addr
db1
dd0
endm

VOR_ENTITY macro lathi,latlo,lonhi,lonlo,alt,code,ident5,name24
db4
db80;;VOR ENTITY
;;range = in 2048M units (approx 2 KM)
dw0123;;magvar
dbcode;;code
;;bit0 = DME
;;bit1 = TACAN (note: if TACAN handles DME too, set DME bit also)
;;bit2 = Voice Available
;;bit3 = Nav Signal Unavailable (DME only)
;;bit4 = spare
;;bit5 = spare
;;bit6 = 0 =Glideslope Available
;;bit7 = 0 = VOR  1=Localizer (always 0)
dwlatlo;;N 41.85611511 (2M units)
dblathi
dwlonlo;;W 87.71153846(24-bit pseudo)
dblonhi
dwalt;;altit M
dw0;;localizer direction (16-bit pseudo)
dbident5;;5-character identifier (ascii)
dbname24;;24-byte name of navaid (ascii)
endm

;VOR DATABASE****************************************************************
VOR_DATAlabelword
rel_base=VOR_DATA
BAND_SET_DEFINEVOR_11060;vor for freq 110.60 channel 52
VOR_11060labelword
LATBAND_REL9113-200,9113+200,v1060_1;O'Hare latitude +-200
EOL

v1060_1labelword
VOR_ENTITY 23h,098afh,0c1h,06000h,204,0001h,'OHAR1','ohare test vor'
EOL

the_data_sizeequ$ - the_data
end

The following sections mirror the sections of the preceding database, offering a step-by-step explanation of each section.

Header

The header contains the geographic bounds of the area of VOR coverage. The pointer at offset 18 points at VOR_DATA, where the VOR information begins.

Universal Entity Opcodes Section

No BGL macro files are included in this example, and only a few opcodes are used. These opcodes are all defined in this section. Notice the field descriptions on the VOR_ENTITY opcode; these values will be filled in with the O’Hare VOR information in the vor_data section.

VOR Database Section

This section begins with a VOR_DATA label that the header points to, and then it sets the rel_base for this section. The BAND_SET_DEFINE acts as a pointer to the list of VORs for the lowest VOR channel, specified in the header. In this example, VOR_11060 is the list of VORs on channel 52. The list continues with more BAND_SET_DEFINE commands for subsequent channels (53, 54, and so on) until the last channel is reached. If there are channels included that don't have VORs assigned to them in a database, a BAND_SET_NULL command (see universal entity opcodes, defined earlier) should be used to pad the empty VOR slot. In this example, there's only one VOR, so only one VOR list is defined. Notice that there isn't an EOL at the end of this list; the end of the list is determined by the last channel number.

The VOR_11060 list is a LATBAND_REL definition list that specifies the latitude band range of the VORs in the list. There can be one or more bands, and the list must terminate with an EOL. In this example, a convenient notation is used to specify 200 latitude units (2kM per unit) variation north and south from center: The center latitude is 9113, so you can specify 9113+200 and 9113-200. The LATBAND_REL for the O’Hare VOR points to the v1060_1 VOR entity list.

The VOR_ENTITY list contains VOR definitions, followed by an EOL at the end of the list. Notice the 5-digit ASCII identifier (OHAR1) and name (ohare test vor). These fields must be space-padded to be exactly 5 and 24 characters, respectively.

Testing the VOR

To test this VOR, assemble and dump this database, and then put it in the Scenery directory. Start Flight Simulator and tune the NAV1 radio to 110.60. You may have to slew up to 2000 feet or so to pick up the VOR in its service volume. Using the OBS, OBI, and DME you should see that the VOR is at a heading of approximately 290 degrees and 15.5 NM from the Meigs runway location. Also, open the Aircraft Navigation dialog box and check the VOR’s identifier and name as specified in the VOR_ENTITY instruction.