Function return values can be returned in various ways - if you wrote the function. For instance. you normally find the single value returned by built-in functions to appear in the AX or EAX register. depending upon if it is an integer or a long. Paramters passed into functions or subs are placed on the stack and accessed from there from within the procedure, and stripped off the stack automatically when the procedure is exited.
The mechanism for calling the procedure and causing the return are part of the compiler operations. You could technically test to see if the values in the various registers can be passed sucessfully into a procedure, either function or sub, and if values can be returned in like manner. If so, you potentially could have several registers available to return values with - AX, BX, CX, DX, SI, DI, EAX, EBX, ECX, and EDX are the most obvious possibilities. However, these are not capabilities of a compiler by direct means. You have to resort to assembler to make use of such techniques.
For most people, it just seems to make more sence to try to pass values in ways that work at the compiler level. This protects your code from potential changes in the mechanisms that are uaed as part of the compiler. This means you can pass values in arrays or tables, pack them into extended strings, and pass them as elements in a dimentioned TYPE structure. Or use Globals, as already mentioned.
|