Jump to content

MIOS_HLP_Dec2BCD


 Share

Recommended Posts

Could you explain why the address to the high byte is moved from FSR0 to FSR2, and the FSR2 pointer incremented before reading?

Taking the information from the SDCC manual, I know the data should go into FSR2+2...So why the move from FSR0L? Perhaps that information in the manual is outdated? I was also wondering why you didn't just do PREINC0?

I started the wrapper at a time where this documentation was not available... so the approach was very easy: I compiled a dummy function with the same parameter list, and had a look into the resulting .asm file. I copied the generated code 1:1 to ensure that I don't oversee any side effects.

I think that the compiler uses FSR2 as a temporary pointer to ensure, that a function never returns with an unbalanced stack pointer in FSR0. However, for the C wrapper we have some potential for optimizations here - with the disadvantage, that there will also be a lot of additional debugging effort ;-)

Best Regards, Thorsten.

Link to comment
Share on other sites

  • 1 month later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...