I have a reentrant function as shown below...
void Move(char X, char Sen, char Flag_Case) reentrant { while(1) { if(Flag_Case == 1) { switch(X) { ....
void main() { TMOD = 0X01; IE = 0X82; while(1) { Move(4,5,6); }
Solution found. I had to modify the STARTUP.A51 to initialise the stack pointer for the reentrant function Move(). so id did the following changes in the STARTUP.A51 file, which i copied to my project directory and included it in my project...
; Stack Space for reentrant functions in the SMALL model. IBPSTACK EQU 1 ; set to 1 if small reentrant is used. IBPSTACKTOP EQU 40H+1 ; set top of stack to highest location+1. ;
how do i initialise the stack pointer for those reentrant functions???? You should not need to. The functions using a particular memory model share the appropriate simulated stack - e.g. all SMALL memory model functions share the simulated stack in idata.
Ok, now i get it. Thanks Franck.