Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
05/06/03 07:12
Read: times


 
#44874 - Cryptic code from ReadsC Compiler
I recently downloaded Rigel Corp.'s ReadsC IDE and complier etc...

My intention was to get a feel of C for the 8051. So i wrote a code that goes as below:

#include "sfr51.h" // the html eats the "<"
#include "csio51.h"

void display(int n)
{
#asm
;;the asm stuff went here (this stuff works!!) since i have tested it before
#endasm
}

void main(void)
{
int i=0,j=0;
P2 = 0x00;
while(1)
{
for(i=0;i<99;i++)
{
display(i);
for(j=0;j<30000;j++); //delay for some time
}
}
}


This code is supposed to put the count "i" to a multiplexed display unit using port2. (This was just for checking the use of functions). The code as most of youi would have suspected by now didn't work. So i started checking the asm file generated.

This is what i found at the location of entry to the function

_display: pop b
pop acc
lcall __enter
;
;
;the remaining code follows till
;
;
lcall __return

the pop acc is executed and when the lcall __enter is executed the device restarts the main funtion.

Then i commented the lcall __enter and the lcall __return statements and the program worked fine.

Obviously what i have done should not be done, who knows what is happening in the __enter and __return subroutines??

Could anybody enlighten me about these enigmatic subtroutines which have been hidden away in an obj file?? Is there something fundamentally wrong with my code??

List of 3 messages in thread
TopicAuthorDate
Cryptic code from ReadsC Compiler            01/01/70 00:00      
   RE: Cryptic code from ReadsC Compiler            01/01/70 00:00      
   RE: Cryptic code from ReadsC Compiler            01/01/70 00:00      

Back to Subject List