AMODE-switching support

Within a Metal C application, AMODE 31 and AMODE 64 programs can call each other.

To take advantage of the Metal C AMODE-switching support, be aware of the following information:

Example of an AMODE31 program that calls an AMODE64 program

In Figure 1, AMODE 31 program "main" in a31.c makes calls to AMODE 64 programs a64a1 and a64a2 in a64a.c. For the commands that compile and link a31.c and a64a.c, see Commands that compile and link applications that switch addressing modes.

Figure 1. AMODE31 program that calls an AMODE64 program
a31.c

long a64a1 (long j, int k, short s) __attribute__((amode64));  
int a64a2 (long j, int k, short s) __attribute__((amode64));   
int main () {                                                  
  int a = 40;
  return a64a1(99LL, a, 4) + a64a2(-120LL, -60, -18);          
}

a64a.c                                                         

long a64a1 (long a, int b, short c) {                          
  return -(a+b+c);
}

int a64a2 (long a, int b, short c) {                           
  return -(a+b+c);
}