2017-05-19 11:20:04 +00:00
|
|
|
/*
|
|
|
|
!!DESCRIPTION!! wrapped-call pragma w/ many params
|
|
|
|
!!ORIGIN!! cc65 regression tests
|
|
|
|
!!LICENCE!! Public Domain
|
|
|
|
!!AUTHOR!! Lauri Kasanen
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdarg.h>
|
|
|
|
|
|
|
|
static unsigned char flag;
|
|
|
|
|
2019-07-16 17:16:02 +00:00
|
|
|
static void trampoline_set(void) {
|
2019-02-12 21:50:49 +00:00
|
|
|
asm("ldy tmp4");
|
|
|
|
asm("sty %v", flag);
|
|
|
|
asm("jsr callptr4");
|
2017-05-19 11:20:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#pragma wrapped-call(push, trampoline_set, 4)
|
|
|
|
long adder(long in);
|
|
|
|
#pragma wrapped-call(pop)
|
|
|
|
|
|
|
|
long adder(long in) {
|
|
|
|
|
2019-02-12 21:50:49 +00:00
|
|
|
return in + 7;
|
2017-05-19 11:20:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
int main() {
|
|
|
|
|
2019-02-12 21:50:49 +00:00
|
|
|
flag = 0;
|
2017-05-19 11:20:04 +00:00
|
|
|
|
2019-02-12 21:50:49 +00:00
|
|
|
return adder(70436) == 70436 + 7 && flag == 4 ? 0 : 1;
|
2017-05-19 11:20:04 +00:00
|
|
|
}
|