;;------10--------20--------30--------40--------50--------60--------70-|
;  Object code skeleton - view/edit with MS WordPad (tab aligned)
;
; Two triggering conditions are analyzed - when both are true at the
;  same time, the optional part of the object becomes visible
;  and so remains untill the BGL will be unloaded.
;  
; This source compiles "as-is" with BGLC -
;  replace 2 setup equates as indicated if you use BGLC_9
;  Of course it dosn't work "as-is" in FS!!
;
; GianP - Jan. 11,06 
;;-------|---------|---------|---------|---------|---------|---------|-|

;--- BGL header + Object placement to be included here (FS8 format)

  BGL_BEGIN			00800h	; version = 8.00
	BGL_CALL		@Text_section ; (use BGL_CALL_32 for >16K code)
	BGL_CALL		@Mate_section
	BGL_CALL		@Vert_section
	BGL_CALL		@BGL__section
Calls_End:
    BGL_END
  JUMP			@Obj_End	  ; (use JUMP_32 for >16K object code)

;--- TEXT/MATE/VERT sections - data to be included
@Text_section:
 BGL_RETURN
@Mate_section:
 BGL_RETURN
@Vert_section:
 BGL_RETURN

;--- If RIFF/MDL9 (FS9 format) discard all the lines above
;--- RIFF/MDL9 headers + other sections to be included here (FS9 format)

;--- BGL ------------------------------
;------- perform some BGLC setup
;  This setup activates the optional part when flying between 800 & 850m msl with
;    the transponder set between 1300 and 1350 (min max values included) 
   _Cond1		equ	altmsl	; Triggering condition #1 symbolic name (BGLC)
;;   _Cond1		equ	00280h	;  for BGLC_9: uncomment & delete the prev.one
   $C1min		equ	800		; Min value for cond1
   $C1max		equ	850		; Max value for cond1
   _Cond2		equ	trans_freq	; Triggering condition #2 symbolic name (BGLC)
;;   _Cond2		equ	007c4h	;  for BGLC_9: uncomment & delete the prev.one
   $C2min		equ	1300		; Min value for cond2
   $C2max		equ	1350		; Max value for cond2
   _LocV1		equ	00000h	; Displacement of local var1 into work area
   $TMsk		equ	00001h	; Mask bit (opt. obj part has been triggered)


  byte	"BGL "					; FS9 RIFF section id.
    dword	@Draw_end - $-4				;   calc. sect. data size (MDL9 usage only)
@BGL__section:						; FS8 only entry point!

  VAR_BASE_32	@Work_area - $+2			; From now on work with local data (vars)
  IFMSK		@Not_trigd,  _LocV1, $TMsk	; AND Bit(s) n - jump if false (never triggered)
;;; The code to display the optional object part follows .... 
;  MATERIAL	...........		
;    DRAW_TRI_BEGIN	..........	
;	DRAW_TRI		........
;      .......
;     DRAW_TRI_END
  JUMP 		@Always_draw			; Go to draw the other object part


@Not_trigd:
;;; Here we come to analyze our triggering cond's
  VAR_BASE_OVERRIDE	VAR_BASE_GLOBAL		; Use global vars for next command
  IFIN2 	@Always_draw,  _Cond1, $C1min, $C1max,  _Cond2, $C2min, $C2max
;;; Take the branch above if at least one cond is false - 
;;;   or continue hereafter to set our "triggered bit" ....
  SETWRD		_LocV1,  $TMsk	; .. from next bgl cycle the opt part will show 


@Always_draw:
;;; The code to display the "always visible" object part follows .... 
;  MATERIAL	...........		
;    DRAW_TRI_BEGIN	..........	
;	DRAW_TRI		........
;      .......
;     DRAW_TRI_END

@Done:
  VAR_BASE_32	VAR_BASE_GLOBAL		; Better to be safe on exit! 
 BGL_RETURN

;--- Here is our data area, it is initialized to 0's and the first word
;	will be set to 00001h to indicate that the triggering event 
;	heppened at least once.
@Work_area:
	word		00000h	; Here is the 2 bytes local variable (_LocV1)
	word		00000h	; Another local variable (unused here)

@Obj_End:
  EOF

@Draw_end:
	byte		0		; end filler

;;;-----10---- that's all, folks -----40--------50--------60--------70-|
