Build the pinned termtris branch (be5b323) with this compiler, assemble and link it with the TI 1987 GSPA/GSPLNK and RTS.LIB, and run the proven play_keys board/move/panels/quit paths in MAME with the M4 loader. Add the contiguous-stack varargs MAME probe and the switch-to-lookup driver regression check. The termtris build found the i8/i16 argument, i1/ anyext load, nested-data, MULHS and late-GEP gaps fixed in the compiler.
36 lines
991 B
C
36 lines
991 B
C
/*
|
|
* varargs.c -- the contiguous-stack varargs ABI probe.
|
|
*
|
|
* M4 supports only the TI ABI's stack layout: a variadic callee takes the
|
|
* address of its last fixed argument and walks down one 32-bit slot per extra
|
|
* argument. There is no va_start/va_arg/va_list. The termtris compat.c
|
|
* sprintf uses exactly this pattern; this probe proves the values arrive.
|
|
*
|
|
* Markers (0x20 bits apart, written by the test):
|
|
* 018A8000 sumvar(1,2,3,4,5) == 15
|
|
* 018A8020 sumvar(10,20,30,40,50) == 150
|
|
* 018A8040 sumvar(100,200,300,400,500) == 1500
|
|
*/
|
|
#define MARK(n) (*(volatile int *)(0x018A8000UL + (n) * 0x20UL))
|
|
|
|
static int sumvar(int a, int b, ...)
|
|
{
|
|
int *p = &b;
|
|
int s = a + b;
|
|
|
|
p--;
|
|
s += *p; /* first variadic argument */
|
|
p--;
|
|
s += *p; /* second */
|
|
p--;
|
|
s += *p; /* third */
|
|
return s;
|
|
}
|
|
|
|
void varargs_test(void)
|
|
{
|
|
MARK(0) = sumvar(1, 2, 3, 4, 5);
|
|
MARK(1) = sumvar(10, 20, 30, 40, 50);
|
|
MARK(2) = sumvar(100, 200, 300, 400, 500);
|
|
}
|