SDCC Z80: Avoid addresses

180 views Asked by At

Can I exclude certain addresses inside the code segment in SDCC? For example if my code segment spans from addr. 0x0000 to 0x4000, can I somehow tell the linker/compiler to avoid addr. from 0x2000 to 0x2100 and not place any code there?

The two practical case for this are:

  1. Replacing a ROM with a new (drastically different!) version and wanting to maintain binary compatibility with the old ROM. Certain absolute addresses in the old ROM are called by existing software and I want to provide "compatibility mode", assuring that at least most common jump will still work.
  2. The memory mapped hardware does nasty things to the ROM (such as disabling it!) if I "touch" certain addresses. So I want to make sure no code is ever placed there.

I could create multiple segments and manually allocate functions to them until "full", but I wonder if I can get any help from the compiler / linker? Because the code frequently changes and I don't want to adjust what goes into which segment for every bugfix that increases the size of a function for a few bytes...

0

There are 0 answers