To my knowledge, the only way that 'large' implementations would differ is in the use of some 'far' instruction variants (e.g. callf, retf) and different stack pointer offsets for function args. At least, those are the only differences I see when comparing the code of routines common to both.

Now I have been looking at more of the code, I find it's not quite as simple as just adding 1 to all "(<num>, sp)" instances, as there are several routines that grow/shrink the stack for temp local data. Given this, I think any modifications to stack pointer offsets would need to follow these rules:

1. If there has been a "sub sp, #N" at the beginning of the routine, all instructions with "(M, sp)" where M <= N should remain unmodified.
2. Otherwise, instructions with "(M, sp)" are modified to "(M+1, sp)".

Does this sound correct? Any other 'gotchas'?

I am thinking I will try to copy and convert the code for use in the 'large' STM8 library and create a patch. If I do so, how can I test that my changes are working correctly? Can the regression tests do this? If so, how do I run them?

Regards,
Basil Hussain


_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to