| EXECUTE_IN_GHOST_SPACE

Previous | Advanced Options of TIGCC | Next

Sometimes, on hardware version 2, it is necessary to execute a program in the so-called "ghost space", which is the area of addresses above 0x40000. If you need to know more about this, read the launcher FAQ entry. If you put

    #define EXECUTE_IN_GHOST_SPACE

at the beginning of your program, on hardware version 2 (and 1, for backwards compatibility reasons), the program will automatically be executed in the ghost space. This causes an overhead of about 200 bytes. More precisely, it will relocate itself in the ghost space (by applying EX_patch to itself with the start address increased by 0x40000) before entering the ghost space. Everything will be performed before anything else. Therefore, there are no limitations introduced by this directive on hardware versions 1 and 2, whereas the older enter_ghost_space function was very limited and hard to use.
`EXECUTE_IN_GHOST_SPACE` allows the user to simply call one program from another, without worrying about the AMS protections which usually prevent this.
Unfortunately, on hardware version 3 (TI-89 Titanium), it is not possible anymore to bypass the execution protection this way. EXECUTE_IN_GHOST_SPACE detects hardware version 3 and requires a FlashROM patch to be present, refusing the execution otherwise. The name might be changed in future versions of TIGCC to reflect this. Therefore, you need to know that you should not blindly add 0x40000 to an address, because this does not work at all on the TI-89 Titanium. Instead, use `HW_VERSION==2?0x40000:0` or `HW_VERSION<=2?0x40000:0` as appropriate.