Table 4: Returning results

This table gives an overview of how to return results from your assembler routines in Delphi 32-bit applications. The first column lists the different types. The second column shows where such a type is returned. The third column indicates the nature of the returned result.

Delphi variable typeReturned where?What?
ShortIntal8-bit signed value
SmallInt(1)ax16-bit signed value
LongInt(2)eax32-bit signed value
Byteal8-bit unsigned value
Wordax16-bit unsigned value
LongWord(3)eax32-bit unsigned value
Int64edx:eax64-bit signed value
BooleanalTrue or False
ByteBoolal8-bit value, non-zero is true
WordBoolax16-bit value, non-zero is true
LongBooleax32-bit value, non-zero is true
SingleST(0)(4)80-bit floating point value
DoubleST(0)(4)80-bit floating point value
ExtendedST(0)(4)80-bit floating point value
Real48ST(0)(4)80-bit floating point value
CompST(0)(4) (5)80-bit floating point value
CurrencyST(0)(4)80-bit floating point value(6)
AnsiCharal8-bit character
WideCharax16-bit Unicode character
AnsiStringExtra var parameter(7)Pointer to Ansistring pointer
(tbc)

(1) The SHORT type is the same as SmallInt
(2) The Integer generic type is currently mapped to LongInt
(3) The DWORD and UINT types are the same as Longword. Also, the generic type Cardinal is on the 32-bit platform mapped to a Longword
(4) The FPU registers are all 80-bits. All real results are returned in ST(0). It's only the storage or manipulation afterwards that will define them as single, double, etc.
(5) Even though Comp represents a 64-bit integer, it is a type that is manipulated in the FPU, as opposed to the other integer types, which are manipulated using the CPU. As such, Comp follows the rules for real numbers in terms of manipulation and passing around.
(6) Whole number scaled by 10,000
(7) See Chapter 4 for a detailed explanation.


Source: www.guidogybels.net.