BGL Opcode Usage Guide

Graphics elements can be defined in many ways, including display lists, bitmaps, and graphics languages (graphics commands that are mixed in with a well-known computer language).

Since its inception, Flight Simulator has used the graphics language approach to create scenery. A graphics design created using a graphics language is much like a program that is executed sequentially, from the beginning. The following code sample is an example of a small graphics design consisting of two points and a line, as defined by a graphics language.

Point234, 124, 593
Line002, 592, 345to 394, 235, 432
Point495, 211, -234
End

The preceding example includes an opcode followed by arguments; the first instruction specifies that a point be drawn at location x, y, z = 234, 124, 593 (where x,y,z are the 3-D coordinates in the 16-bit 3-D design space). The POINT command is the opcode, and the x, y , z coordinates are the arguments. The concept of graphics programs that consist of graphics opcodes is echoed throughout the Flight Simulator scenery system.

In Flight Simulator, assembly language syntax is used to define graphics command. Using assembly language syntax is effective in that it tells you exactly what bits and bytes are being generated. The POINT command in the preceding example can be expressed in assembly language syntax as follows.

;OPERATION:Render a point (dot).
;BYTES:8
;FORMAT:wordopcode = 0037h
;wordX
;wordY
;wordZ
PNTmacrox,y,z
dw037h
dwx,y,z
endm

;The following command defines a point at x,y,z = 234,124,593

PNT234, 124, 593

In the preceding example, notice that a macro was used to define the POINT command. The macro set the opcode to be a word with the value 0037h.

Typically, the scenery designer sets up a library of macros defining all the graphics commands and uses an include directive to insert the library at the beginning of a file. The graphics program itself consists of a list of graphics commands or entities.

BGL uses a lot of integer data types because operations are usually performed at greater speeds using integers (as opposed to floating-point). Intel 80xx series microprocessors and Pentium processors treat multibyte integers in a least-significant byte first manner; that is, in memory, the byte at the lower address is least significant. This is illustrated in the following example.

addressvalue
0000dw1234h
0002
is equivalent to
addressvalue
0000db34h
0001db12h
0002

The byte-reversed concept is extended to larger integer types as well. The following example shows how a 32-byte value is represented.

addressvalue
0000dd12345678h
0004
is equivalent to
addressvalue
0000dw5678h
0002dw1234h
is equivalent to
addressvalue
0000db78h
0001db56h
0002db34h
0003db12h

Following this natural flow of universal byte-reversing makes many operations easier. Retrieving the middle significant word out of the 32-bit number shown in the preceding example is as simple as reading a word from address 01 and 02—the word ends up in the processor’s register with the least significant byte in the least-significant byte part of the register.

The use of C and C data types changes some type definitions so that they do not follow the flow of universal byte-reversing; this reduces efficiency in many Flight Simulator computations, but allows the use of C in scenery design.

The following table describe the BGL opcodes and their usage.

Opcode BGL Words Description and format
0000 EOF 1 End of database; same as BGL_RETURN. Format is word/opcode. Macro is as follows:
EOFmacro
dw00h
endm
0001 LOGOL 1 Switches context to interpret LOGOL. Format is word/opcode. Macro is as follows:
LOGOLmacro
dw01h
endm
0002 NOOP 1 No action; skip this instruction. Format is word/opcode. Macro is as follows:
NOOPmacro
dw02h
endm
0003 CASE Macro is as follows:
CASEmacrovar_addr,case_fall,c0,c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16,c17,c18,c19,c20,c21,c22,c23,c24
locallbl
lbldw003h
dw[(lb3-lb2)/2]
dwvar_addr

dwcase_fall-lbl
lb2label word
ifnb<c0>
dwc0-lbl
endif
ifnb<c1>
dwc1-lbl
endif
ifnb<c2>
dwc2-lbl
endif
ifnb<c3>
dwc3-lbl
endif
.........................
ifnb<c24>
dwc24-lbl
endif
lb3label word
endm

0004 DEBUG 1 Break out to an INT 2, from which debugging can be done. Format is byte/opcode. Macro is as follows:
DEBUGmacro
dw04h
endm
BGL_DEBUGmacro
dw04h
endm
0005 SURFACE 1 Defines the beginning of a convex non-light source, shaded surface (unless overridden by a CONCAVE command).
Note: This command is not normally used.
Format is byte/opcode. Macro is as follows:
SURFACEmacro
dw05h
endm
0006 SPNT 4 Starts surface or line definition. Only use this command for line drawing, not surface definition. Format is word/opcode, as follows:
word  x-coord byte swapped
word  y-coord byte swapped
word  z-coord byte swapped
Macro is as follows:
SPNTmacroxx,yy,zz
dw06h
dwxx
dwyy
dwzz
endm
0007 CPNT 4 Continues surface definition or renders line. Format is word/opcode, as follows:
word x-coord byte swapped
word y-coord byte swapped
word z-coord byte swapped
Macro is as follows:
CPNTmacroxx,yy,zz
dw07h
dwxx
dwyy
dwzz
endm
0008 CLOSURE 1 Renders the polygon. Format is as follows:
word    opcode=0008h
Macro is as follows:
CLOSUREmacro
dw08h
endm
0009 GSURF 1 Starts a gouraud convex, non-light source shaded surface.
Note: This command is not normally used.
Format is as follows:
word    opcode=0009h
Macro is as follows:
GSURFmacro
dw09h
endm
000A GSPNT 5 Starts surface definition.
Note: This command is not normally used.
Format is as follows:
word    opcode=000Ah
wordcolor i.f
wordX
wordY
wordZ
Macro is as follows:
GSPNTmacroii,xx,yy,zz
dw0ah
dwii
dwxx
dwyy
dwzz
endm
000B GCPNT 5 Continues surface definition.
Note: This command is not normally used.
Format is as follows:
word    opcode=000Bh
wordcolor i.f
wordX
wordY
wordZ
Macro is as follows:
GCPNTmacroii,xx,yy,zz
dw0bh
dwii
dwxx
dwyy
dwzz
endm
000C GCLOSURE 1 Renders a gouraud shaded convex polygon.
Note: This command is not normally used.
Format is as follows:
word    opcode=000Ch
Macro is as follows:
GCLOSUREmacro
dw0ch
endm
000D JUMP 2 Unconditionally continues processing at new address. Format is as follows:
word    opcode=000Dh
word   relative jump address
Macro is as follows:

JUMPmacrodest
localstart
start:
dw0dh
dw(offset dest)-(offset start)
endm

000E DEFRES 5 Defines a reserve point vertex.
Note: This command is not normally used.
Format is as follows:
word    opcode=000Eh
wordreserve point number
wordX
wordY
wordZ
Macro is as follows:
DEFRESmacron,x,y,z
dw0eh,n,x,y,z
endm
000F STRRES 2 Starts polygon or line definition at specified vertex index.
Note: Use this command for line drawing only, not surface definition.
Format is as follows:
word    opcode=000Fh
wordvertex number
Macro is as follows:
STRRESmacron
dw0fh,n
endm
0010 CNTRES 2 Continues polygon definition at specified vertex index or renders line.
Note: Use this command for line drawing only, not surface definition.
Format is as follows:
word    opcode=00010h
wordvertex number
Macro is as follows:
CNTRESmacron
dw10h,n
endm
0011 GDEFRES 6 Defines a gouraud shaded reserve point vertex.
Note: This command is not normally used.
Format is as follows:
word    opcode=0011h
wordreserve point number
wordvertex color i.f
wordX
wordY
wordZ
Macro is as follows:
GDEFRESmacron,i,x,y,z
dw11h,n,i,x,y,z
endm
0012 GSTRRES 2 Starts gouraud polygon definition at specified vertex.
Note: This command is not normally used.
Format is as follows:
word    opcode=0012h
wordvertex number
Macro is as follows:
GSTRRESmacron
dw12h,n
endm
0013 GCNTRES 2 Continues gouraud polygon definition at specified vertex.
Note: This command is not normally used.
Format is as follows:
word    opcode=0013h
wordvertex number
Macro is as follows:
GCNTRESmacron
dw13h,n

endm

0014 SCOLOR
Macro is as follows:
SETCOLORmacrocolor
dw14h
dwcolor
endm
0015 ELEVATION MAP N Renders a texture-mapped elevation map.
Format is as follows:
word    opcode=0015h
wordX grid size
wordZ grid size
wordX patch size
wordZ patch size
wordX displacement
wordZ displacement
wordY min
wordY max
byteX,Z,altlsb,altmsb;point 0 x,z,alt
byteX,Z,altlsb,altmsb;point 1 x,z,alt
.
.
.
Macro is as follows:
ELEVATION_MAP macrog_x, g_y, p_x, p_y, d_x, d_y, minalt, maxalt
dw15h

dwg_x, g_y, p_x, p_y, d_x, d_y, minalt, maxalt
endm

ELEVATION_POINT macro x, z, alt
dbx, z
dwalt
endm

0016
0017
0018 TEXTURED SURFACE 12 Defines texture-mapped surface. Specifies and loads texture, and the SURFACE command is executed. Format is as follows:
%ibp= opcode
%ibp+2= internal ID number
%ibp+4= X instance value
%ibp+6= Y instance value
%ibp+8= Z instance value
%ibp+10= 14 character ASCIIZ filename for texture
Macro is as follows:
TEXTUREmacron,ix,iy,iz,name
dw18h
dwn,ix,iy,iz
dbname,0,0

endm

Details: System attempts a texture load if the texture isn't already available in a texture slot (as indicated by the TEXTURE command's internal ID number) and sets its variables (bounds, inverse matrix, texture_quality, and so on). The entry in the texture slots for this texture is made and/or updated. If texture loading and setup is successful, texture_flag and texture_avail flags are set to 1. If not, they are set to 0. Factors that can cause an unsuccessful load (and thus non-textured polygon override) are as follows:

  • shadow_flag=1.

  • A water or lake texture request if water_texture is turned off.

  • Texture not loaded due to lack of memory.

A SURFACE command is executed, resetting the edge list pointer and setting the vertex count to -1.

0019 SET PALETTE 8 Sets top 64 colors (texture map palette) to palette specified in the 14-character file in command. The format is as follows:
wordopcode = 0019h
bytes14-byte ASCIIZ character file name
Macro is as follows:
PALETTEmacroname
dw19h

dbname,0,0
endm

001A RESLIST 3+(3*n) Defines a reserve point vertex list. Format is as follows:
wordopcode = 001Ah
wordstarting index
wordvertex count
wordX1
wordY1
wordZ1
wordX2
wordY2
wordZ2
.
.
.
Macro is as follows:

RESLISTmacrostart,number
dw1ah
dwstart,number
endm

001B
001C
001D FACEN 9+n Renders a light-source shaded polygon face.
Note: This command is useful for self-modifying code; generally, use the FACET command instead.
Bytes: 18+2*n
Format is as follows:
wordopcode=001Dh
wordstart index
wordnumber of vertices
wordNx
wordNy
wordNz
wordPx
wordPy
wordPz
wordp1
wordp2
.
.
.
Macro is as follows:
FACE3macropx,py,pz,nx,ny,nz,p1,p2,p3
dw1dh,3
dwpx,py,pz,nx,ny,nz
dwp1,p2,p3
endm

FACE4macropx,py,pz,nx,ny,nz,p1,p2,p3,p4

dw1dh,4

dwpx,py,pz,nx,ny,nz

dwp1,p2,p3,p4
endm
FACE5macropx,py,pz,nx,ny,nz,p1,p2,p3,p4,p5

dw1dh,5

dwpx,py,pz,nx,ny,nz

dwp1,p2,p3,p4,p5
endm
FACE6macropx,py,pz,nx,ny,nz,p1,p2,p3,p4,p5,p6

dw1dh,6

dwpx,py,pz,nx,ny,nz

dwp1,p2,p3,p4,p5,p6
endm
FACE7macropx,py,pz,nx,ny,nz,p1,p2,p3,p4,p5,p6,p7
dw1dh,7
dwpx,py,pz,nx,ny,nz
dwp1,p2,p3,p4,p5,p6,p7
endm
FACE8macropx,py,pz,nx,ny,nz,p1,p2,p3,p4,p5,p6,p7,p8
dw1dh,8
dwpx,py,pz,nx,ny,nz
dwp1,p2,p3,p4,p5,p6,p7,p8
endm
FACEmacropx,py,pz,nx,ny,nz,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20,p21,p22,p23,p24,p25,p26,p27,p28,p29,p30,p31,p32
locallb1,lb2
dw01Dh
dw[(lb2-lb1)/2]
dwpx,py,pz,nx,ny,nz
lb1dwp1,p2,p3
ifnb<p4>
dwp4
endif
ifnb<p5>
dwp5
endif
.....................
ifnb<p32>
dwp32
endif
lb2label word
endm

001E HAZE 2 Sets haze_factor to user's value. Has the following effect on polygon generation, depending on the submitted "n" value:

n=0—copy all pixels from source texture to screen.
n=1—perform distance hazing on source texture pixels. (The source texture is assumed to be along a predefined palette color run [green to gray].)
n=2–255—copy only pixels of higher color value than n as "from" texture source to screen.
Note: This command is used by sky/ground system.
Format is as follows:
wordopcode = 001Eh
wordvalue

Macro is as follows:
HAZEmacroval
dw1eh,val
endm

001F HORIZON 2 Turns ground plotting on/off.
Note: This command is used by sky/ground system.
Format is as follows:
wordopcode = 001Fh

wordvalue
Macro is as follows:
HORIZONmacroval
dw1fh,val
endm

0020 FACET MAP Renders a bilinear texture-mapped polygon.
Note: You can precede this command with a PERSPECTIVE command in the case of FACET3_TMAP and FACET4_TMAP, as a perspective specifier.
Format is as follows:
wordopcode=0020h
wordnumber of points
wordA
wordB
wordC
dwordD
wordp1
wordp1X
wordp1Y
wordp2
wordp2X
wordp2Y
.
.
.
Macro is as follows:
FACET3_TMAPmacroa,b,c,d,p1,t1x,t1z,p2,t2x,t2z,p3,t3x,t3z
dw20h,3
dwa,b,c
ddd
dwp1,t1x,t1z
dwp2,t2x,t2z
dwp3,t3x,t3z
endm
FACET4_TMAPmacroa,b,c,d,p1,t1x,t1z,p2,t2x,t2z,p3,t3x,t3z,p4,t4x,t4z
dw20h,4
dwa,b,c
ddd
dwp1,t1x,t1z
dwp2,t2x,t2z
dwp3,t3x,t3z
dwp4,t4x,t4z
endm
0021 SUPER MESH Depth sorts rectangular mesh. You can nest this command.
Bytes: 14+2*x*z
Format is as follows:
wordopcode = 0021h
wordX grid size
wordZ grid size
wordX patch size
wordZ patch size
wordX view
wordZ view
wordpointer to submesh command
.
.
.
Macro is as follows:
SUPERMESHmacrox_grid,z_grid,x_patch,z_patch,x_disp,z_disp,x_view,z_view
localstart
dw21h,x_grid,z_grid,x_patch,z_patch,x_disp,z_disp,x_view,z_view
start:

supermeshloc=offset start
endm

0022 BGL REENTER RETURN 1 Returns from subroutine.
Format is as follows:
wordopcode=0022h
Macro is as follows:
BGL_RETURNmacro
dw22h
endm
0023 BGL CALL 2 Calls a subroutine. Format is as follows:
wordopcode=0023h
wordrelative address of subroutine
Macro is as follows:
BGL_CALLmacroroutine
localstart
start:
dw23h
dw(offset routine)-(offset start)
endm
0024 IF IN ID 5 Compares variable with bounds; takes branch if outside bounds. Format is as follows:
wordopcode=0024h
wordvariable offset
wordlow value
wordhigh value
wordrelative branch address
Macro is as follows:
IFIN1macro
dest,v,low,high
localstart
start:
dw24h
dw(offset dest)-(offset start)
dwv,low,high
endm
IFIN2macro
dest,v1,low1,high1,v2,low2,high2
IFIN1dest,v1,low1,high1
IFIN1dest,v2,low2,high2
endm
IFIN3macro
dest,v1,low1,high1,v2,low2,high2,v3,low3,high3
IFIN1dest,v1,low1,high1
IFIN1dest,v2,low2,high2
IFIN1dest,v3,low3,high3
endm
IFGTmacrodest,var,num
IFIN1dest,var,num,32767
endm
IFLTmacrodest,var,num
IFIN1dest,var,-32768,num
endm
IFEQmacrodest,var,num
IFIN1dest,var,num,num
endm
0025 SEPARATION PLANE 8 Tests surface for visibility; takes branch if invisible. Format is as follows:
wordopcode=0025h
wordrelative branch address
wordA
wordB
wordC
dwordD
Macro is as follows:
SEPARATION_PLANEmacrodest,a,b,c,d
localstart
start:

dw25h
dw(offset dest)-(offset start)
dwa,b,c
ddd
endm
SIDEmacroxv,low,high,r1,r2
localjump1
IFIN1xv,low,high,jump1
BGL_CALL r1
BGL_CALL r2
BGL_RETURN
jump1:
BGL_CALL r2
BGL_CALL r1
BGL_RETURN
endm
IFSIDEmacroa,b,c,d,r1,r2
localjump1
SEPARATION_PLANE jump1,a,b,c,d
BGL_CALL r1
BGL_CALL r2
BGL_RETURN
jump1:
BGL_CALL r2
BGL_CALL r1
BGL_RETURN
endm

0026 SETWORD 3 Sets variable to value. Format is as follows:
wordopcode=0026h
wordvariable address
wordvalue
Macro is as follows:
SETWRDmacrov,n
dw26h,v,n
endm
0027 TEXTURED FACET 7+n Renders an arbitrary texture-mapped polygon. Format is as follows:
wordopcode = 0027h
wordnumber of points
wordA
wordB
wordC
dwordD
wordp1
wordp2
wordp3
.
.
.
Macro is as follows:
BGL_TEXTURED_FACET3 macro a,b,c,d,p1,p2,p3
dw27h,3
dwa,b,c
ddd
dwp1,p2,p3
endm
BGL_TEXTURED_FACET4 macro a,b,c,d,p1,p2,p3,p4
dw27h,4
dwa,b,c
ddd
dwp1,p2,p3,p4
endm
0028 BALL Macro is as follows:
BALLmacrosize,x,y,z
dw028h
dwsize
dwx,y,z
endm
0029 GOURAUD RESLIST 3+(6*n) Defines vertex list with surface normals for gouraud shading. Format is as follows:
wordopcode=0029h
wordstarting index
wordvertex count
wordX
wordY
wordZ
wordNX
wordNY
wordNZ
.
.
.
Macro is as follows:
GRESLISTmacrostart,number
dw29h
dwstart,number
endm
GVERTEXmacrox,y,z,nx,ny,nz
dwx,y,z,nx,ny,nz
endm
002A GOURAUD SHADED ABCD FACET Renders a light-source, gouraud shaded surface.
Bytes, 14+2*n. Format is as follows:
wordopcode = 002Ah
wordA
wordB
wordC
dwordD
wordnumber of vertices
wordvertex 1
wordvertex 2
.
.
.
Macro is as follows:
GFACET3macro
a,b,c,d,p1,p2,p3
dw2ah,3
dwa,b,c
ddd
dwp1,p2,p3
endm
GFACET4macro
a,b,c,d,p1,p2,p3,p4
dw2ah,4
dwa,b,c
ddd
dwp1,p2,p3,p4
endm
GFACET5macro
a,b,c,d,p1,p2,p3,p4,p5
dw2ah,5
dwa,b,c
ddd
dwp1,p2,p3,p4,p5
endm
GFACET6macro
a,b,c,d,p1,p2,p3,p4,p5,p6
dw2ah,6
dwa,b,c
ddd
dwp1,p2,p3,p4,p5,p6
endm
GFACET7macro
a,b,c,d,p1,p2,p3,p4,p5,p6,p7
dw2ah,7
dwa,b,c
ddd
dwp1,p2,p3,p4,p5,p6,p7
endm
GFACET8macro
a,b,c,d,p1,p2,p3,p4,p5,p6,p7,p8
dw2ah,8
dwa,b,c
ddd
dwp1,p2,p3,p4,p5,p6,p7,p8
endm
GFACETmacro
a,b,c,d,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20,p21,p22,p23,p24,p25,p26,p27,p28,p29,p30,p31,p32
locallb1,lb2
dw02Ah
dw[(lb2-lb1)/2]
dwa,b,c
ddd
lb1dw
p1,p2,p3
ifnb<p4>
dwp4
endif
ifnb<p5>
dwp5
endif
..............
ifnb<p32>
dwp32
endif
lb2label word
endm
002B
002C SPHERICAL REJECTION Takes branch if sphere is invisible. Bytes, 12. Format is as follows:
wordopcode = 002Ch
wordrelative branch address
wordX
wordY
wordZ
wordRadius
Macro is as follows:
REJECTmacro
dest,x,y,z,radius
localstart
start:
dw2ch
dw(offset dest)-(offset start)
dwx,y,z,radius
endm
002D SCOLOR Sets 24-bit color of rendered surface.
Note: It's recommended that you use the SCOLOR command, instead.
Bytes, 6. Format is as follows:
wordopcode=002Dh
byteRed
byteGreen
byteBlue
byte0
Macro is as follows:
SCOLOR24macro
r,g,b
dw2dh
dbr,g,b,0
endm
002E LCOLOR Sets 24-bit color of lines.
Note: It's recommended that you use the LCOLOR command, instead.
Format is as follows:
wordopcode=002Eh

byteRed

byteGreen

byteBlue

byte0

Macro is as follows:
LCOLOR24macro
r,g,b
dw2eh
dbr,g,b,0
endm

002F SCALE Sets design scale and location. Branches if out of viewing range. Bytes, 32.
Macro is as follows:
SCALE skip,signal,size,scale,lat,lon,alt(radsortable)
[word]opcode=02Fh
[word]skip address (relative) for overflow & out-of-range
[word]to see from radius (in meters, 0=ignored)
[word]object size radius (in scale units, 0=ignored)
for off screen rejection
[word]radsort ptr
[dword]scale factor (if negative, no biases present)
[3word]latitude 48-bit
[3word]longitude 48-bit
[3word]altitude 48-bit
SCALEmacro
dest,signal,size,scale,lat,latf,lon,lonf,alt,altf
localstart
start:
dw02fh
dw(offset dest)-(offset start)
dwsignal
dwsize
dw0
;radsort ptr
ddscale
dwlatf
ddlat
dwlonf
ddlon
dwaltf
ddalt
endm
0030 SET BRIGHTNESS Sets brightness level of non-light source shaded entity used for line drawing. Bytes, 4. Format is as follows:
wordopcode=0030h
wordbrightness level .ff
Macro is as follows:
SET_BRIGHTNESS
macrovalue
dw030h
dwvalue
endm
0031
Macro is as follows:
RESROWmacro
start,number,xs,ys,zs,xe,ye,ze
dw031h
dwstart,number
dwxs,ys,zs
dwxe,ye,ze
endm
0032 ADDOBJ Adds object routine to radsort list. Bytes, 4. Format is as follows:
wordopcode=0032h
wordrelative address
Macro is as follows:
ADDOBJmacrodest
localstart
start:
dw32h
dw(offset dest)-(offset start)
endm
0033 INSTANCE_CALL Changes the reference frame around the current scale point for a subroutine call. You can nest this command. Bytes, 10. Format is as follows:
wordopcode=0033h
wordrelative address
wordpitch
wordbank
wordheading
Macro is as follows:
INSTANCE_CALL
macro dest,p,b,hh
localstart
start:
dw033h
dw(offset dest)-(offset start)
dwp
dwb
dwhh
endm
0034 SUPER_SCALE Scales selection for gouraud shaded models, down to 1/65536 of a meter. Use POSITION or VPOSITION to position the scale point. Models drawn in this scale must use the full dynamic range of the scale. This command has built-in radius checking. If the radius is exceeded, a jump occurs. As a result, you can vector off to a more appropriate scale if overflow occurs because the specified radius is exceeded. Bytes, 4. Format is as follows:
wordopcode=0034h
worddesign scale
Macro is as follows:
SUPER_SCALEmacro
dest,signal,size,scale
localstart

start:dw34h
dw(offset dest)-(offset start)
dwsignal
dwsize
dwscale
endm

0035 PNTROW Renders a row of points. Bytes, 16. Format is as follows:
wordopcode = 0035h
wordstart point X
wordstart point Y
wordstart point Z
wordend point X
wordend point Y
wordend point Z
wordnumber of reserve points
Macro is as follows:
PNTROWmacro
x1,y1,z1,x2,y2,z2,n
dw35h
dwx1,y1,z1,x2,y2,z2,n
endm
0036 PNTROWM Renders a masked row of points. Bytes:
8+2*(int(n/16)+1)
Format is as follows:
wordopcode=0036h
wordstart point X
wordstart point Y
wordstart point Z
wordend point X
wordend point Y
wordend point Z
wordnumber of reserve points
wordmask words
.
.
.
0037 PNT Renders a point (dot). Bytes, 8. Format is as follows:
wordopcode=0037h
wordX
wordY
wordZ
Macro is as follows:
PNTmacrox,y,z
dw037h
dwx,y,z
endm
0038 CONCAVE Concave override, for following a FACE/FACET definition. Bytes, 2. Format is as follows:
wordopcode = 0038h
Macro is as follows:
CONCAVE macro
;override the next polygon to be CONCAVE
dw038h
endm
0039 BGL IFMASK If (variable & bitmask)==0 goto address.
Format is as follows:
wordopcode=0039h
wordrelative address
wordvariable offset
wordbitmask
Macro is as follows:
IFMSKmacro
dest,var,mask
localstart
start:

dw039h

dw(offset dest)-(offset start)
dwoffset var
dwmask
endm

003A BGL VPOSITION Position of scale point for SUPER_SCALE. Bytes, 4. Format is as follows:
wordopcode=003Ah
wordvariable address
Macro is as follows:
VPOSITIONmacro
dest,signal,size,adrs
localstart
start:
dw3Ah
dw(offset dest)-(offset start)
dwsignal
dwsize
dw0
;radsort ptr

dwadrs
endm

003B VINSTANCE_CALL Changes reference frame for subroutine call. Bytes, 6. Format is as follows
wordopcode=003Bh
wordroutine address
wordvariable address
Macro is as follows:
VINSTANCE_CALL
macrodest,var
localstart
start:
dw03Bh
dw(offset dest)-(offset start)
dwoffset var
endm
003C POSITION Position of scale point for SUPER_SCALE command. Bytes, 20. Format is as follows:
wordopcode=003Ch
3wordlatitude
3wordlongitude
3wordaltitude
Macro is as follows:
POSITIONmacro
dest,signal,size,lat,latf,lon,lonf,alt,altf
localstart
start:
dw03Ch
dw(offset dest)-(offset start)
dwsignal
dwsize
dw0
;radsort ptr
dwlatf
ddlat
dwlonf
ddlon
dwaltf
ddalt
endm
003D SEED 12 Renders a scenery-synthesis object. Format is as follows:
wordopcode=003Dh
dw3dh;opcode
ddtype;class and type
ddxsize;iiii M
ddzsize;iiii M
ddrealalt;ii.ff M
dwlatgrid;lat seed grid coord south edge
dwlongrid;lon seed grid coord west edge

dwnumber;random number
Macro is as follows:
SEEDmacro
type,xsize,zsize,realalt,latgrid,longrid,number
dw3dh
ddtype
ddxsize
ddzsize
ddrealalt
dwlatgrid
dwlongrid
dwnumber
endm

003E FACETN Renders a light-source shaded polygon.
Bytes: 14+2*n
Format is as follows:
wordopcode=003Eh
wordvertex count
wordA
wordB
wordC

dwordD
wordp1
wordp2
.
.
.
Macro is as follows:
FACET3macro
a,b,c,d,p1,p2,p3
dw3eh,3
dwa,b,c
ddd
dwp1,p2,p3
endm
FACET4macro
a,b,c,d,p1,p2,p3,p4
dw3eh,4
dwa,b,c
ddd
dwp1,p2,p3,p4
endm
FACET5macro
a,b,c,d,p1,p2,p3,p4,p5
dw3eh,5
dwa,b,c
ddd
dwp1,p2,p3,p4,p5
endm
FACET6macro
a,b,c,d,p1,p2,p3,p4,p5,p6
dw3eh,6
dwa,b,c
ddd
dwp1,p2,p3,p4,p5,p6
endm
FACET7macro
a,b,c,d,p1,p2,p3,p4,p5,p6,p7
dw3eh,7
dwa,b,c
ddd
dwp1,p2,p3,p4,p5,p6,p7
endm
FACET8macro
a,b,c,d,p1,p2,p3,p4,p5,p6,p7,p8
dw3eh,8
dwa,b,c
ddd
dwp1,p2,p3,p4,p5,p6,p7,p8
endm
FACET12macro
a,b,c,d,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12
dw3eh,12
dwa,b,c
ddd
dwp1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12
endm
FACET16macro
a,b,c,d,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16
dw3eh,16
dwa,b,c
ddd
dwp1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16
endm
FACETmacro
a,b,c,d,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20,p21,p22,p23,p24,p25,p26,p27,p28,p29,p30,p31,p32,p33,p34,p35
locallb1,lb2
dw03Eh
dw[(lb2-lb1)/2]
dwa,b,c
ddd
lb1dwp1,p2,p3
ifnb<p4>
dwp4
endif
...................
ifnb<p34>
dwp34
endif
ifnb<p35>
dwp35
endif
lb2label word
endm

003F SHADOW CALL Calls subroutine and projects points on the ground as the object's shadow. Bytes, 4. Format is as follows:
wordopcode=003Fh
wordrelative address
Macro is as follows:
SHADOW_CALLmacro
routine
localstart
start:
dw3Fh
dw(offset routine)-(offset start)
endm
0040 SHADOW VPOSITION Positions shadow for object not on ground. This position is used by the SHADOW_VICALL command to position the aircraft's shadow. Bytes, 4. Format is as follows:
wordopcode=0040h

wordpointer to lat/lon/alt block
Macro is as follows:
SHADOW_VPOSITION
macroadrs
dw40h
dwadrs
endm

0041 SHADOW VINSTANCE CALL Calls subroutine and projects instanced shadow of aircraft on the ground from the SHADOW_VPOSITION. The shadow is only projected if Aircraft Shadow=On and shadow_density=nz. This command is for aircraft projection use only. Bytes, 6. Format is as follows:
wordopcode=0041h
wordrelative address
wordpointer to pbh 32-bit block
Macro is as follows:
SHADOW_VICALL macro
dest,var
localstart
start:
dw041h
dw(offset dest)-(offset start)
dwoffset var
endm
0042 POLYGON_RUNWAY Starts definition of runway. Bytes, 2. Format is as follows:
wordopcode=0042h
0043 - Ends definition of runway. Bytes, 2. Format is as follows:
wordopcode=0043h
0044 Renders a runway. Format is as follows:
wordopcode=0044h
Macro is as follows:
TEXTURE_RUNWAY macro
lat,latf,lon,lonf,alt,altf,length,width,heading,flags,ident,surface
dw044h
dwlatf
ddlat
dwlonf
ddlon
dwaltf
ddalt
dwheading
dwlength
dwwidth
dbflags
dbident
db0,0
dbsurface
db0
;rw_threshold_flags
dw0
;rw_threshold_south1
dw0; rw_threshold_south2

dw0; rw_threshold_north1

dw0
;rw_threshold_north2

db0
;rw_s_light_flags
db0
;rw_s_light_system
db0
;rw_s_light_strobes
db0
;rw_s_light_vasi_type
dw0
;rw_s_light_vasi_angle
dw0
;rw_s_light_vasi_x
dw0
;rw_s_light_vasi_z
dw0
;rw_s_light_vasi_space
db0
;rw_n_light_flags
db0
;rw_n_light_system
db0

;rw_n_light_strobes
db0
;rw_n_light_vasi_type
dw0
;rw_n_light_vasi_angle
dw0
;rw_n_light_vasi_x
dw0
;rw_n_light_vasi_z
dw0
;rw_n_light_vasi_space
endm
RUNWAY_MAIN macro
lat,latf,lon,lonf,alt,altf,length,width,heading,flags,ident,lights,surface
dw044h

dwlatf
; \ runway center latitude (48-bit meters*65536)
ddlat
; /
dwlonf
; \ runway center longitude (48-bit pseudodegrees)
ddlon
; /
dwaltf
; \ runway altitude (feet MSL) (48-bit meters*65536)
ddalt
; /
dwheading
;runway true heading (16-bit pseudodegrees)
dwlength
;runway length (feet)
dwwidth
;runway width (feet)
dbflags
;
dbident
;
dblights
;edge lights, center lights
db0
;reserved for expansion
dbsurface
;
endm
RUNWAY_THRESHOLD macro
flags,s_thr_ofs,s_blast_pad,n_thr_ofs,n_blast_pad
dbflags
;threshold_flags
dw
s_thr_ofs
;south threshold offset (feet)
dw
s_blast_pad
;south blast pad size (feet)
dw
n_thr_ofs
;north threshold offset (feet)
dw
n_blast_pad
;north blast pas size (feet)
endm
RUNWAY_LIGHTS macro
flags,approach_type,strobes,vasi_type,vasi_angle,vasi_x,vasi_z,vasi_space
dbflags
;light flags
db
approach_type
;approach system type
dbstrobes
;number of strobes
db
vasi_type
;VASI type
dw
vasi_angle
;VASI angle (16-bit pseudodegrees)
dwvasi_x
;VASI X offset (feet)
dwvasi_z
;VASI Z offset (feet)
dw
vasi_space
;VASI spacing between bars (feet)
endm
POLYGON_RUNWAY macro
lat,latf,lon,lonf,alt,altf,length,width,heading,flags,ident,surface
dw044h
dwlatf
ddlat
dwlonf
ddlon
dwaltf
ddalt
dwheading
dwlength
dwwidth
dbflags
dbident
db0,0
dbsurface

db0
;rw_threshold_flags
dw0
;rw_threshold_south1
dw0
;rw_threshold_south2
dw0
;rw_threshold_north1
dw0
;rw_threshold_north2
db0
;rw_s_light_flags
db0
;rw_s_light_system
db0
;rw_s_light_strobes
db0
;rw_s_light_vasi_type
dw0
;rw_s_light_vasi_angle
dw0
;rw_s_light_vasi_x
dw0
;rw_s_light_vasi_z
dw0
;rw_s_light_vasi_space
db0
;rw_n_light_flags
db0
;rw_n_light_system
db0
;rw_n_light_strobes
db0

;rw_n_light_vasi_type
dw0
;rw_n_light_vasi_angle
dw0
;rw_n_light_vasi_x
dw0
;rw_n_light_vasi_z
dw0
;rw_n_light_vasi_space
endm

0045 STROBEROW Renders a flashing row of dots. Bytes, 16. Format is as follows:
wordopcode=0045h

wordstart point X
wordstart point Y
wordstart point Z
wordend point X
wordend point Y
wordend point Z
wordnumber of reserve points

0046 POINT VICALL Changes reference frame around a given point in the design. Bytes, 20. Format is as follows:
wordopcode=0046h
wordX
wordY
wordZ
wordfixed pitch addition
wordpointer to pitch variable or (0) if none
wordfixed bank addition
wordpointer to bank variable or (0) if none
wordfixed heading addition
wordpointer to heading variable or (0) if none
Macro is as follows:
POINT_VICALLmacro
dest,xx,yy,zz,pp,pv,bb,bv,hh,hv
localstart
start:
dw046h
dw(offset dest)-(offset start)
dw
xx,yy,zz
dw
pp,pv,bb,bv,hh,hv
endm
0047 MAP SCALE Sets scale from 24–31 for rendering large objects (for example, the earth). Scale point is around the POSITION OR VPOSITION. Bytes, 4. Format is as follows:
wordopcode = 0047h
wordscale
Macro is as follows:
MAP_SCALEmacro
scale
dw47h
dwscale
endm
0048 VAR_SEG Sets new variable segment for commands that use variables. Bytes, 4. Format is as follows:
wordopcode=0048h
wordsegment address, or 0 for default
Macro is as follows:
VAR_SEGmacro
tseg
dw48h
dwtseg
endm
0049 BUILDING Draws a building from BGL internal library. Bytes, 10. Format is as follows:
wordopcode=0049h
wordbuilding type
wordnumber of stories
wordX size in meters
wordZ size in meters
Macro is as follows:
BLDINGmacro
n,c,dx,dy,dz,s,x,z
dw49h
dw
n,c,dx,dy,dz,s,x,z
endm
004A LANDING LIGHTS Macro is as follows:
LANDING_LIGHTS_VICALL macro
dest,var,lx,ly,lz
localstart
start:

dw04ah
dw(offset dest)-(offset start)
dwoffset var
dwlx
dwly
dwlz
endm

004B OVERLAY_CALL Macro is as follows:
BGL_OVERLAYmacro
id,c0,c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14,c15,c16,c17,c18,c19,c20,c21,c22,c23,c24
local
lbl,lbl2
lbldw4Bh
dw(lbl2-lbl)
dwid
ifnb<c0>
dwc0
endif
ifnb<c1>
dwc1
endif
ifnb<c2>
dwc2
endif
......................
ifnb<c24>
dwc24
endif
lbl2label word
endm
004C VSCALE Scales a command from a variable. Bytes, 6. Format is as follows:
[word]opcode=4ch
[word]skip addrress (relative)
[word]to see from radius (in meters, 0 = ignored)
[word]object size radius (in scale units, 0 = ignored)
[word]radsort entry ptr
[dword]scale factor (if negative, no biases present)
[word]ptr to LATLONALT
Macro is as follows:
VSCALEmacro
dest,signal,size,scale,var
localstart
start:
dw04ch
dw(offset dest)-(offset start)
dwsignal
dwsize
dw0
;radsort ptr
ddscale
dwvar
endm
004D VAR2LOW64K Transfers a variable from var_seg to low64k_seg. Bytes, 6. Format is as follows:
wordopcode=4dh
wordsource
wordtarget
Macro is as follows:
VAR2LOW64Kmacro
d,s
dw04dh
dwd,s
endm
004E LOW64K2VAR Transfers a variable from low64k_seg to var_seg. Bytes, 6. Format is as follows:
wordopcode=4eh
wordsource
wordtarget
Macro is as follows:
LOW64K2VARmacro
d,s
dw04eh
dwd,s
endm
004F MOVWRD Transfers a variable from var_seg to var_seg. Bytes, 6. Format is as follows:
wordopcode=4fh
wordsource
wordtarget
Macro is as follows:
MOVWRDmacro
d,s
dw04fh
dwd,s
endm
0050 GCOLOR Sets gouraud light-source shaded surface color. Bytes, 4. Format is as follows:
wordopcode=50h
wordcolor code
Macro is as follows:
GCOLORmacrocolor
dw50h
dwcolor
endm
0051 LCOLOR Sets line color. Bytes, 4. Format is as follows:
wordopcode=51h
wordcolor code
Macro is as follows:
LCOLORmacrocolor
dw51h
dwcolor
endm
0052 SCOLOR Sets light-source shaded surface color. Bytes, 4. Format is as follows:
wordopcode=52h
wordcolor code
Macro is as follows:
SCOLORmacrocolor
dw52h
dwcolor
endm
0053 GCOLOR_ABS Sets gouraud-shaded light source shaded surface color. Use GCOLOR command when specifying existing color ranges. Use this command for special custom colors only. Bytes, 6. Format is as follows:
wordopcode=53h
wordstarting color i.f
wordending color i.f
Macro is as follows:
GCOLOR_ABSmacro
color
dw53h
dwcolor
endm
0054 AMSCALL Calls an assembly language subroutine. Use only in internal Flight Simulator databases; for example, use for internal seed generation routines. Bytes, 6. Format is as follows:
wordopcode;opcode=54h
wordrelative offset
wordsegment
;0=low64k seg
;1=current BGL seg
;>1=set seg to this
; (absolute seg)
Note: This instruction does add the BGL seg's IBP to the offset value; for example, even if you want to call a routine at low64k:1000h, if the ASMCALL is at bglseg:200h, set relative offset to 0e00h (1000h–200h) and segment to 0. Also, the assembly language subroutine must end with a far return.
Macro is as follows:
ASMCALLmacro
asm_offset,asm_segment
localstart
start:
dw054h
dw(offset asm_offset)-(offset start)
dw
asm_segment
endm
0055 SET SURFACE TYPE Sets scale to any valid unit of measurement. Bytes, 10. Format is as follows:
wordopcode=55h
wordskip address
wordsize of radius in scale units for spherical rejection
dwordii.ff units per meter
Macro is as follows:
SET_SURFACE_TYPE
macro
t,x,z,alt
dw055h
dw
t,x,z,alt
endm
0056 SET_WEATHER Macro is as follows:
SET_WEATHERmacro
skip
localstart
start:
dw056h
dw(offset skip)-(offset start)
endm
0057 WEATHER Macro is as follows:
WEATHERmacro
type,angle,factor,extra
dw057h
dw
04ch+type*256
dwangle
dwfactor
dwextra
endm
0058 TEXTURE BOUNDS Macro is as follows:
TEXTURE_BOUNDS macro
lx,lz,ux,uz
dw058h
dd
lx,lz,ux,uz
endm
0059 VAR_SEG_ID Macro is as follows:
VAR_SEG_IDmacro
dw059h
endm
005A SEED ADDOBJ COMMAND Points to BGL code (SCALE, SEED, BGL_RETURN, and so on) that is then executed. (The code may or may not draw items on the screen at this time.) When BGL code is finished running, the radsort_me flag is tested. If the BGL code set this flag, the BGL code pointed to by this command is inserted into the radsort list (usually occurs when mountains or buildings generated by the seed need to be generated at radsort time).
Note: The SEED command looks at the radsort_flag to determine what action to take. For example, the CITY SEED command only sets the radsort_me flag if radsort_flag=0, and generates buildings if radsort_flag=1.
The macro is as follows:
SEED_ADDOBJmacro
dest
localstart
start:
dw5Ah
dw(offset dest)-(offset start)
endm
005B INDIRECT CALL Executes the BGL database pointed to by the specified variable. Format is as follows:
dw5bh
dwvariable;in BGL's segment assumed
Note: Variable contains a single word that is the absolute address in the BGL segment where this BGL database exists. The database must end with a BGL_RETURN.
Macro is as follows:
INDIRECT_CALL
macrovar
dw5bh
dwvar
endm
005C BGL_FAR_CALL Macro is as follows:
BGL_FAR_CALLmacro
routine,segment
dw05Ch
dwroutine
dwsegment
endm
005D TEXTURE_REPEAT Macro is as follows:
TEXTURE_REPEAT macro
ix,iy,iz
dw05Dh
dw
ix,iy,iz
endm
005E TEXTURE_ROTATE Macro is as follows:
TEXTURE_ROTATE macro
pitch,bank,heading
dw05Eh
dw
[(pitch/90)*256] + [(bank/90)*16] + [heading/90]
endm
005F IF APPARENT SIZE Macro is as follows:
IFSIZEV macro
dest,radius,pixels
localstart
start:
dw5Fh
dw(offset dest)-(offset start)
dw
radius,pixels
endm
0060 FACE TMAP Macro is as follows:
FACE3_TMAPmacro
px,py,pz,nx,ny,nz,p1,t1x,t1z,p2,t2x,t2z,p3,t3x,t3z
dw60h,3
dw
px,py,pz,nx,ny,nz
dw
p1,t1x,t1z
dw
p2,t2x,t2z
dw
p3,t3x,t3z
endm
FACE4_TMAPmacro
px,py,pz,nx,ny,nz,p1,t1x,t1z,p2,t2x,t2z,p3,t3x,t3z,p4,t4x,t4z
dw60h,4
dw
px,py,pz,nx,ny,nz
dw
p1,t1x,t1z
dw
p2,t2x,t2z
dw
p3,t3x,t3z
dw
p4,t4x,t4z
endm
FACE7_TMAPmacro
px,py,pz,nx,ny,nz,p1,t1x,t1z,p2,t2x,t2z,p3,t3x,t3z,p4,t4x,t4z,p5,t5x,t5z,p6,t6x,t6z,p7,t7x,t7z
dw60h,7
dw
px,py,pz,nx,ny,nz
dw
p1,t1x,t1z
dw
p2,t2x,t2z
dw
p3,t3x,t3z
dw
p4,t4x,t4z
dw
p5,t5x,t5z
dw
p6,t6x,t6z
dw
p7,t7x,t7z
endm
0061 RESLIST SCALE Obsolete, don't use.
0062 IFVIS Macro is as follows:
IFVIS4macro
dest,p1,p2,p3,p4
localstart
start:
dw62h
dw(offset dest)-(offset start)
dw4
dw
p1,p2,p3,p4
endm
IFVIS8macro
dest,p1,p2,p3,p4,p5,p6,p7,p8
localstart
start:
dw62h
dw(offset dest)-(offset start)
dw8
dw
p1,p2,p3,p4,p5,p6,p7,p8
endm
0063 BGL_LIBRARY Macro is as follows:
BGL_LIBRARYmacro
a,b,c,d
dw063h
dwd,c,b,a
endm
0064 SYNTH BUILDINGS Don't use.
0065 VSCOLOR Macro is as follows:
VSCOLORmacro
var
dw65h
dwvar
endm
0066 VGCOLOR Macro is as follows:
VGCOLORmacro
var
dw66h
dwvar
endm
0067 VLCOLOR Macro is as follows:
VLCOLORmacro
var
dw67h
dwvar
endm
0068 TMAP LIGHT SOURCE SHADE Macro is as follows:
TMAP_LIGHT_SHADE
macro
nx,ny,nz
dw
68h,nx,ny,nz
endm
0069 ROAD start Macro is as follows:
ROAD_STARTmacro
width,x,y,z
dw69h
dwwidth
dwx,y,z
endm
006A ROAD continue Macro is as follows:
ROAD_CONTmacro
x,y,z
dw6ah
dwx,y,z
endm
006B RIVER start Macro is as follows:
RIVER_STARTmacro
width,x,y,z
dw6bh
dwwidth
dwx,y,z
endm
006C RIVER continue Macro is as follows:
RIVER_CONTmacro
x,y,z
dw6ch
dwx,y,z
endm
006D IF APPARENT SIZE Macro is as follows:
IFSIZEHmacro
dest,radius,pixels
localstart
start:
dw6Dh
dw(offset dest)-(offset start)
dw
radius,pixels
endm
006E TAXIWAY START Macro is as follows:
TAXIWAY_START macro
width,x,y,z
dw6eh
dwwidth
dwx,y,z
endm
006F TAXIWAY END Macro is as follows:
TAXIWAY_CONT macro
x,y,z
dw6fh
dwx,y,z
endm
0070 AREA SENSE Macro is as follows:
AREA_SENSE4macro
dest,x1,z1,x2,z2,x3,z3,x4,z4
localstart
start:
dw70h
dw(offset dest)-(offset start)
dw
4,x1,z1,x2,z2,x3,z3,x4,z4
endm
AREA_SENSE5macro
dest,x1,z1,x2,z2,x3,z3,x4,z4,x5,z5
localstart
start:
dw70h
dw(offset dest)-(offset start)
dw
5,x1,z1,x2,z2,x3,z3,x4,z4,x5,z5
endm
AREA_SENSE6macro
dest,x1,z1,x2,z2,x3,z3,x4,z4,x5,z5,x6,z6
localstart
start:
dw70h
dw(offset dest)-(offset start)
dw
6,x1,z1,x2,z2,x3,z3,x4,z4,x5,z5,x6,z6
endm
0071 ALTITUDE SET Macro is as follows:
ALTITUDE_SETmacro
alt
dw71h
dwalt
endm
0072 APPROACH Macro is as follows:
APPROACH_LIGHTS
macro
delta_z,width,heading,flags,system,strobes,vasi,vasi_angle,vasi_dx,vasi_dz,vasi_space
dw072h
dwheading
dwwidth
dwdelta_z
dbflags
dbsystem
dbstrobes
dbvasi

dw
vasi_angle
dwvasi_dx
dwvasi_dz
dw
vasi_space
endm

0073 IF PLANE IN BOX Using this command, the plane's x, y ,z location in scale 16 (1m/unit) is computed as 16-bit pxv, pyv, pzv. The 16-bit pxv,pyv,pzv is compared against the box defined by lowx-highx, lowy-highy, lowz-highz. If it isn't in the box, the branch is taken.
Note: These ranges are not design units, but rather scale 16. If a building's center is at 0, 0, 0 in the current scale factor and the building is 20m wide, the lowx - highx should be -10, +10, regardless of scale factor.
This command interprets nested rotations, but doesn't interpret translational offsets within a rotation. It uses a rotational heading value that is all the headings of all the instance levels added together. This works as long as all the nesting has been flat (rotations only around the y axis). The x,y,z offset within a VICALL are ignored.
The macro is as follows:
IFINBOXPmacro
dest,lowx,highx,lowy,highy,lowz,highz
localstart
start:
dw73h
dw(offset dest)-(offset start)
dw
lowx,highx
dw
lowy,highy
dw
lowz,highz
endm
0074 ADD CATEGORY 3 Adds the BGL fragement that is pointed to, to the categories list to be executed at category execute time (after pre-radsort and object projection, but before elements are executed and radsort). You must specify the category number (cat=0–63); this number controls the sequence of projection. Lower categories are executed first (BGL fragments added to category 4 are executed before fragments in category 5). BGL fragments within a single category are executed in the order in which they are submitted by the ADDCAT command (first submitted, first executed).
The ADDCAT command saves the bgl_page and file_number when it is executed. As a result, this command must only be executed during object16 projection time (not while in a radsorted object or within other categories).
Format is as follows:
dw74h
;ADDCAT op
dwbgl_frag_ptr
;relative, in this seg
dwcat
;category # 0–63
Macro is as follows:
ADDCATmacro
dest,cat
localstart
start:
dw74h
dw(offset dest)-(offset start)
dwcat
endm
0075 ADD MOUNTAIN Adds item that is pointed to, to the mountain radsort list. Much the same as the ADDOBJ command, but specific to the mountain radsort list.
Macro is as follows:

ADDMTNmacrodest
localstart
start:
dw75h
dw(offset dest)-(offset start)
endm

0076 BGL OP Switches to BGL execution (if in LOGOL). If no BGL, performs NOOP and triggers the warning "BGL command in middle of BGL" using a TRAP_INT3 if in debug mode.
Macro is as follows:
BGLmacro
dw76h
endm
BGL_EVENmacro
db76h
EVEN
endm
0077 SCALE AGL Command includes radius and skip vector. Current ground altitude (seed_ground_alt, 48-bits) is copied into the SCALE command and a bgl_scale command is executed.
Note: This command is self-modifying. You can submit 0s as alt, altf and they will be overridden by seed_ground_alt when this command is executed.
Macro is as follows:
SCALE_AGLmacro
dest,signal,size,scale,lat,latf,lon,lonf,alt,altf
localstart
start:
dw077h
dw(offset dest)-(offset start)
dwsignal
dwsize
dw0
;radsort ptr
ddscale
dwlatf
ddlat
dwlonf
ddlon
dwaltf
;dummy altitude to be filled in by
ddalt
;command itself
endm
0078 ROAD CONTW Macro is as follows:
ROAD_CONTWmacro
w,x,y,z
dw78h
dww,x,y,z
endm
0079 RIVER CONTW Macro is as follows:
RIVER_CONTWmacro
w,x,y,z
dw79h
dww,x,y,z
endm
007A GSHADE TMAP FACET Macro is as follows:
GFACET3_TMAPmacro
a,b,c,d,p1,t1x,t1z,p2,t2x,t2z,p3,t3x,t3z
dw7ah,3
dwa,b,c
ddd
dw
p1,t1x,t1z
dw
p2,t2x,t2z
dw
p3,t3x,t3z
endm
GFACET4_TMAPmacro
a,b,c,d,p1,t1x,t1z,p2,t2x,t2z,p3,t3x,t3z,p4,t4x,t4z
dw7ah,4
dwa,b,c
ddd
dw
p1,t1x,t1z
dw
p2,t2x,t2z
dw
p3,t3x,t3z
dw
p4,t4x,t4z
endm
GFACET5_TMAPmacro
a,b,c,d,p1,t1x,t1z,p2,t2x,t2z,p3,t3x,t3z,p4,t4x,t4z,p5,t5x,t5z
dw7ah,5
dwa,b,c
ddd
dw
p1,t1x,t1z
dw
p2,t2x,t2z
dw
p3,t3x,t3z
dw
p4,t4x,t4z
dw
p5,t5x,t5z
endm
GFACET6_TMAPmacro
a,b,c,d,p1,t1x,t1z,p2,t2x,t2z,p3,t3x,t3z,p4,t4x,t4z,p5,t5x,t5z,p6,t6x,t6z
dw7ah,6
dwa,b,c
ddd
dw
p1,t1x,t1z
dw
p2,t2x,t2z
dw
p3,t3x,t3z
dw
p4,t4x,t4z
dw
p5,t5x,t5z
dw
p6,t6x,t6z
endm
GFACET8_TMAPmacro
a,b,c,d,p1,t1x,t1z,p2,t2x,t2z,p3,t3x,t3z,p4,t4x,t4z,p5,t5x,t5z,p6,t6x,t6z,p7,t7x,t7z,p8,t8x,t8z
dw7ah,8
dwa,b,c
ddd
dw
p1,t1x,t1z
dw
p2,t2x,t2z
dw
p3,t3x,t3z
dw
p4,t4x,t4z
dw
p5,t5x,t5z
dw
p6,t6x,t6z
dw
p7,t7x,t7z
dw
p8,t8x,t8z
endm
007B GSHADE TMAP FACE Macro is as follows:
GFACE4_TMAPmacro
px,py,pz,nx,ny,nz,p1,t1x,t1z,p2,t2x,t2z,p3,t3x,t3z,p4,t4x,t4z
dw7bh,4
dw
px,py,pz,nx,ny,nz
dw
p1,t1x,t1z
dw
p2,t2x,t2z
dw
p3,t3x,t3z
dw
p4,t4x,t4z
endm
007C POLY LINE FACET Macro is as follows:
POLYLINE_FACET macro
a,b,c,d,p1,p2,p3,p4,p5,p6,p7,p8,p9,p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,p20,p21,p22,p23,p24,p25,p26,p27,p28,p29,p30,p31,p32
locallb1,lb2
dw07ch
dw[(lb2-lb1)/2]
dwa,b,c
ddd
lb1dw
p1,p2,p3
ifnb<p4>
dwp4
endif
.........................
ifnb<p32>
dwp32
endif
lb2label word
endm
007D PERSPECTIVE OVERRIDE Sets perspective override for next facet_tmap. Sets perspective_flag=1; this causes the next facet_tmap (bilinear interpolated texture map with backside elimination) to be handled by a special processor if it is a 3- or 4-vertex case.
Macro is as follows:
PERSPECTIVEmacro
dw07dh
endm
007E SETWORD LOW64K VAR Macro is as follows:
SETWRD_LOW64K
macrov,n
dw7eh,v,n
endm
007F CITY Macro is as follows:
CITYmacro
dw07fh
endm
0080 RESERVE PNT DRAW Macro is as follows:
RESPNTmacron
dw080h,n
endm
0081 ANTI-ALIAS ON/OFF Sets the anti-alias value (0 or 1) that is combined with image_smoothing to form anti_alias (a rootvar variable). Anti-aliasing color dithering is performed by the polygon generators and texture mappers when anti_alias is on. One or more BGL commands can be bracketed with an ANTI_ALIAS 1 and ANTI_ALIAS 0 command to indicate that these items should be dithered if image smoothing is set to 1. Macro is as follows:
ANTI_ALIASmacro
parm
dw
081h,parm
endm
0082 SHADOW POSITION Macro is as follows:
SHADOW_POSITION macro
lat,latf,lon,lonf,alt,altf
dw082h
dwlatf
ddlat
dwlonf
ddlon
dwaltf
ddalt
endm
0083 RESCALE Using its scale point, rescales from a previous scale command. Macro is as follows:
RESCALEmacro
dest,signal,size,factor
localstart
start:
dw083h
dw(offset dest)-(offset start)
dwsignal
dwsize
ddfactor
endm
0084 SURFACE NORMAL Macro is as follows:
SURFACE_NORMAL macro
nx,ny,nz
dw084h
dw
nx,ny,nz
endm
0085 ASD NAME
0086 PAGE FAULT
0087 FIXED COLORS Time adjusts only the first "n" colors of the texture map palette; fixes the rest to the original palette value. Macro is as follows:
NIGHT_COLOR_RANGE
macron
dw087h,n
endm
0088 FILE NUMBER MARKER Macro is as follows:
FILE_MARKERmacro
fileno
dw
088h,fileno
endm