EX_patch Function (ROM Call 0x15A)

system.h

void EX_patch (void *base_addr, void *tag_ptr);

Relocates an assembly program.

EX_patch relocates relocatable items in the assembly program (.89z or .9xz file), where tag_ptr points to the "PROGRAM" signature (tag) byte (byte 0xF3), and base_addr is the address from where the assembly program will be started. So, if handle is a handle of an .89z (or .9xz) file, you can execute it using

len = *(unsigned short*)(base_ptr = HLock (handle));
EX_patch (base_ptr + 2, base_ptr + len + 1);
ASM_call (base_ptr + 2);
HeapUnlock (handle);
In practice, some protection devices in HW2 calculators make the whole thing much more complicated (see the launcher FAQ entry for more info).

Note that the relocation table ends just below the tag byte.

Note: If base_addr is in the ghost space, tag_ptr has to be in the ghost space, too!


Used by: LoadDLL, push_user_func


See also: enter_ghost_space, EXECUTE_IN_GHOST_SPACE