BGLC variable during compilation

arno

Administrator
Staff member
FSDevConf team
Resource contributor
#1
Hi all,

Is there someone who is a bit more familiar with BGLC (or asembler code in general)? I am looking for a way to have a variable defined in my source code that I can use during compilation (so not in the final BGL code). A bit like the UVar variable in SCASM.

Second question (but I guess the answer is no here), does anyone know if BGLC also has some math functions coded in? I am looking for sine and cosine functions mainly.
 

rhumbaflappy

Moderator
Staff member
Resource contributor
#2
Hi Arno.

BGLC is basically MASM:

http://webster.cs.ucr.edu/Page_TechDocs/MASMDoc/

So anything possible with assembly code should be possible with BGLC.

BGLC has this:

Code:
ASMCALL_32  macro asm_offset

      dw    08Ch

      dd    offset asm_offset

      endm

which appears to be able to use an assembly code routine.

I don't believe there is any higher math functions in BGLC... but you should be able to add them via macros if you can create the ASM coding.

Dick
 
Last edited:

arno

Administrator
Staff member
FSDevConf team
Resource contributor
#3
Thanks Dick. Yes I was aware that in principle it is just asembler code, but I could not find something useful when I searched the internet yesterday. I will bookmark this one now :).

I don't think that ASMCALL_32 command really helps, as it still writes data to the BGL file. That is not what I need. But I am sure that that reference guide will help me in solving it.

For the mathematical functions I already thought that was the answer. I can also do the calculations offline of course and just enter the answer :).
 

arno

Administrator
Staff member
FSDevConf team
Resource contributor
#4
Hi Dick,

It was even easier than I thought. The include files of BGLC already show how to do it (a lot of variables are defined there as well, so we can use easier names like tod (time of day) etc).

This is the code I used in the end:

Code:
SAFEGATE_HEADING_SIN EQU 23169
SAFEGATE_HEADING_COS EQU 23169
 
Top