what's the function of "AREGS"and "NOAREGS"

what's the function of "AREGS"and "NOAREGS", can you provide me some sample, so that I could understand them clear. Are them still useful in current updated versions.
In the manual it is said that with "NOAREGS" the function could be called by another functions using different register bank.

#pragma NOAREGS
char add(char i)
{
    return i+10;
}

void main(void) using 1
{
    ch = add(3);
}

whether I enable or disable #pragma NOAREGS
I always get the right result. If with "NOAREGS" the function could be called by another functions using different register bank, then does it also mean that with "AREGS" the function could not be called by another functions using different register bank. I am very confused with "AREGS"and "NOAREGS".

Parents
  • Hi,Thomas
    I tried the following codes,but I could never get right result soever I use NOARGS or not.

    #pragma NOAREGS
    
    char add(char i) using 2
    {
        return(i+10);
    }
    
    void main(void) using 1
    {
    	char ch;
        ch = add(3);
    
    	while (1);
    }
    
    
    If "using 2" for add() is removed,the result will be always right.
    I think the reason may be that the arguments of the functions are transmited with register,but now they are not in the same bank.
    howerver,I can't understant what is,on earth,the function of NOAREGS.
    expecting more discussion.

Reply
  • Hi,Thomas
    I tried the following codes,but I could never get right result soever I use NOARGS or not.

    #pragma NOAREGS
    
    char add(char i) using 2
    {
        return(i+10);
    }
    
    void main(void) using 1
    {
    	char ch;
        ch = add(3);
    
    	while (1);
    }
    
    
    If "using 2" for add() is removed,the result will be always right.
    I think the reason may be that the arguments of the functions are transmited with register,but now they are not in the same bank.
    howerver,I can't understant what is,on earth,the function of NOAREGS.
    expecting more discussion.

Children
More questions in this forum