>I assumed that he only wants some small special part of his code to
execute from RAM. In that case he could use C memcpy() to copy, but
would have to place the special code in a different segment.



Yes I think he has some self-modifying code that needs to be in a data section 
so that it is copied into RAM at startup.


I hate to advertise on another list but it’s probably not so bad since we’re 
trying hard to get sdcc to play well with z88dk and it’s pretty much done now.



If you're willing to use sdcc through z88dk you can do what you want.  There is 
a self-modifying code section defined so that the crt will copy your code into 
RAM automatically at startup.


This is how it is done for sdcc in z88dk:


;; FILE:  myasm.asm


SECTION smc_user   ;; assign to self modifying code section


PUBLIC _myfunction  ;; export function name


_myfunction:


   ; do stuff


  ret




In your C code you can generate a reference to your function:


extern int myfunction(void);



The compile line simply adds both files:


zcc .... main.c myasm.asm




All the funnies that Alan spoke about are removed, ROM and RAM models are 
accommodated and you can compress your data section if stored in ROM.  The best 
part is the C lib is more complete and it’s all written in assembler.  If you’d 
like to give it a try let me know.
------------------------------------------------------------------------------
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user
------------------------------------------------------------------------------
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to