Is it possible to get multiple return values from a function in a different way than in fixed memory? I often need to get more return values than 1 from a function, for example 2 integers (16bit) and 1 byte, or something similar. In assembly, the easiest way to do that is to pass them through registers. But if the calling function, or both calling and called, are written in C, there is a problem that I can't reach to the registers. So I must pass them in global variables (useless ehausting of memory) or define a structure. But the structure is passed through fixed memory, too, and it is accessed with a pointer, what is too slow. I have tried several tricks, but I have not succeeded. So I have these questions: Is there any "standard" way to pass multiple return values in registers IN A C FUNCTION? or Is it possible to easily reach registers in C? or Is it possible to acces local variables defined in a C function from an inline assembly? Thanks a lot. If it isn't possible, I will have to use global variables, but this would be a better and faster way. Wormik
in a function, which returns 3 integers" The whole point of the concept of a "function" in all structured programming languages is that it returns a single value. "I can't use global variables, because the called function is in different module" Eh??? The whole point of Global variables is that they are, well, Global - ie, accessible to the whole system!! "I don't want to use structure because it is too slowly (accesing via pointer...)." Have you actually checked? If you use a memory-specific pointer, and locate the structure in DATA space, even pointer-access could be quicker than "direct" access to variables in XDATA! "unsigned char data R0 _at_ 0x00; a warning of "memory overlapping" comes" Of course it does - you are forcing a 'C' variable into the same memory location already occupied by R0 in Bank 0! Your 'C' variable overlaps R0 Bank 0! But what you're doing here is effectively creating a Global variable - which you said you can't do! "but it works" Only by extreme good luck! You have absolutely no guarantee whatsoever that the Compiler won't also be using R0 directly for its own internal purposes. That's precisely why you get the warning about the overlap! Do Not Do This!