Hi all, In Keil C51 compiler, is there any way to declare a function that doesn't automatically save registers (acc, b, dptr, r0-r7...) when called? I want to do it manually. In SDCC, I can use the attribute "_naked" or use #pragma callee_saves". Thanks,
The code you reference is in the middle of the printf library routine. It is not in C code that the compiler has compiled.
Jon
Because it really does in some case. One example: open CSAMPLE project in Examples folder, build it, start debug session, open disassembly window, go to line: C:0x02DF you will see:
PUSH ACC (0xE0) LCALL C:003E .... POP ACC (0xE0)
"is there any way to declare a function that doesn't automatically save registers (acc, b, dptr, r0-r7...)"
What makes you think that C51 does save these - or any other - registers??
http://www.keil.com/support/man/docs/c51/c51_ap_regusage.htm