Re: [cc65] ca65 for stand-alone asm projects

From: Oliver Schmidt <ol.sc1web.de>
Date: 2010-11-09 10:33:49
Hi,

> ... what about using the INIT feature for the startup code? This
> code would be execute only once (clearing BSS and what not). So we put it
> into a segment in the RAM area, after that an init to its start and then put
> the rest of the code into another RAM area and put it after the init part.

Just as a remark, here's what the Apple II code does (without any OS support):

- The INIT segment is placed at the end of the binary. It gets loaded
at the address range intended for the BSS.
- The STARTUP code moves the INIT segment right after the BSS (where
later the heap/stack will go).
- The INIT segment content is called (having full access to the BSS to
inititalize it).
- Later the INIT segment gets overwritten by the heap/stack.

This makes all programs somewhat larger (because of the move
operation) but saves at actual runtime the whole INIT segment :-)

Regards,
Oliver
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Tue Nov 9 10:33:56 2010

This archive was generated by hypermail 2.1.8 : 2010-11-09 10:33:59 CET