We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi everyone, in my projects j often use the philips 87LPC764 (8051 derivative low pin count). The micro is good but it has only 4K of code memory, so j'm always searching methods to compact my code as much as possible. In one project j use some modules written in assembler, and since the total amout of code of that modules is less than 2K j tried to use AJMP and ACALL to save memory. Unfortunately the linker locates somewhere in memory the modules so j must use JMP and CALL to correct the situation. J used a little trick to correct it, in the project j loaded first the assembler modules and after the other. The linker seems to link modules in order and this trick functions good, but my answer is : How to get the modules located in low 2K of memory using a more elegant and/or fast method??? Thanks in advance. Sorry for the long post!!!!!
"this istructions work only in a 2K code block, so j searched a way to force the relocator to put the 2 modules in the lower 2K of code memory." They work within any 2K block - there is no need to restrict it to the bottom 2K! Did you make sure to use both ROM(COMPACT) for the 'C' code and INBLOCK for the assembler?
"They work within any 2K block - there is no need to restrict it to the bottom 2K!" Yes, you are right! But the problem is to have BOTH modules in same block, because some functions in module N° 2 call functions in module 1. "Did you make sure to use both ROM(COMPACT) for the 'C' code and INBLOCK for the assembler?" Yes j did it. For ROM(COMPACT) there was no problem, but when j use INBLOCK j get a "improper fixup" error from the linker. J think the problem is that modules are relocated in a 2K block, but NOT the SAME block. My solution it's a simple trick but it works (j tested it)!