This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

CALLING C LIBRARY FUNCTION FROM ASSEMBLY

Hi:

I wish to call function "pow" (which is standard function in library) from my assembly code. How can I do it? Thanks!

Parents
  • Hi,

    Now, I finally found the solution. I save all data in internal ram(128 bytes),PSW and SP to external ram before I call C code. And copy back the data from extern ram to internal ram after finish C call, the code works very well. Not sure what the problem it is. Stack or something is changed in internal ram after calling C code?
    But, this code only works if I located it to space from 0x0000 to 0x7fff(32k). If I relocated this code to space from 0x8000 to 0xffff, it will "reboot" everytime I call C code. Does C code need space between 0x0000 to 0x8000? Thank you! Any comments will be appreciated!

Reply
  • Hi,

    Now, I finally found the solution. I save all data in internal ram(128 bytes),PSW and SP to external ram before I call C code. And copy back the data from extern ram to internal ram after finish C call, the code works very well. Not sure what the problem it is. Stack or something is changed in internal ram after calling C code?
    But, this code only works if I located it to space from 0x0000 to 0x7fff(32k). If I relocated this code to space from 0x8000 to 0xffff, it will "reboot" everytime I call C code. Does C code need space between 0x0000 to 0x8000? Thank you! Any comments will be appreciated!

Children