Jump to content

Recommended Posts

Posted
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.

  • 1 month later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...