Relocation Table

Amstrad CPC and NC systems
Post Reply
zhulien
New member
Posts: 1
Joined: Tue Jan 30, 2024 7:26 pm

Relocation Table

Post by zhulien »

Hi,

I am Julian and new here. I wanted to reply to

https://www.z88dk.org/forum/viewtopic.php?t=9116

but got the message I am not able to reply in this forum, so... a new thread.

Does anyone know whether it is now possible to append such a relocation table to the end of the executable so code can be relocated upon load 'by the OS'?

Thanks
pjshumphreys
Member
Posts: 83
Joined: Sat Feb 06, 2021 2:32 pm

Re: Relocation Table

Post by pjshumphreys »

According to https://github.com/z88dk/z88dk/wiki/Too ... mmand-line the z80asm assembler has an -R option to generate relocatable code.

You should be able to pass through this parameter to z80asm from the zcc compiler frontend using -Ca[option] (https://github.com/z88dk/z88dk/wiki/Tool---zcc)

If you were going to do that, I'd be looking into compiling for a raw z80 binary with the embedded platform (https://github.com/z88dk/z88dk/wiki/New ... --Embedded)

From there, you may be able to combine it with some amstrad specific loader to get the binary you generate into ram. For CP/M I've used code similar to this:

Code: Select all

#pragma output protect8080
#pragma output nofileio
#include <compress/zx7.h>
extern unsigned char chooseCLib[];

void main(void) {
  /* decompress c lib chooser code from the embedded array into address 0x4000 */
  dzx7_turbo(((unsigned int *)chooseCLib), ((unsigned char *)16384));

  /* jp to the code */
  __asm
    jp 16384
  __endasm;
}
Can you be more specific about what you want to do?
Post Reply