Project Home
Project Home
Trackers
Trackers
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - Access to function local variables in asm statement: (2 Items)
   
Access to function local variables in asm statement  
I'm wondering how could I get an access to function local variables and arguments in assembler statements. It was very 
easy under Windows but QCC inline assembler seems supports only access to global variables. Have someone a solution for 
such a problem?

For example sorce code below cases 
   undefined reference to 'nBin' 
   undefined reference to 'tBcd'
messages

/*!
***********************************************************
*  \brief CIO_GPS_EXPRESS reloadable settings
**********************************************************/
struct TBCD
{
    long nLo;
    long nMd;
    long nHi;
};

TBCD tBcd;
long nBin;

/**
 ***********************************************************
 *  \brief
 *  Converts positive integer to BCD value
 *  using ASM x86 FPU code
 *
 *  \param nInt
 *  Input value
 *
 *  \return
 *  BCD value, limited to 99,999,999
 *
***********************************************************/
long BinToBCD(long nBin)
{
 TBCD tBcd;

    asm(".intel_syntax noprefix");
    asm("fwait");
    asm("fild      nBin");
    asm("fbstp  tBcd");
    asm("fwait");

    return tBcd.nLo;
}
Re: Access to function local variables in asm statement  
Sorry in my post I forgot to delete global variables declaration nBin and tBcd.