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 data types. The second column shows where such a type is returned. The third column indicates the nature of the returned result.
Returned where? | What? | |
ShortInt | al | 8-bit signed value |
SmallInt(1) | ax | 16-bit signed value |
LongInt(2) | eax | 32-bit signed value |
Byte | al | 8-bit unsigned value |
Word | ax | 16-bit unsigned value |
LongWord(3) | eax | 32-bit unsigned value |
Int64 | edx:eax | 64-bit signed value |
Boolean | al | True or False |
ByteBool | al | 8-bit value, non-zero is true |
WordBool | ax | 16-bit value, non-zero is true |
LongBool | eax | 32-bit value, non-zero is true |
Single | ST(0)(4) | 80-bit floating point value |
Double | ST(0)(4) | 80-bit floating point value |
Extended | ST(0)(4) | 80-bit floating point value |
Real48 | ST(0)(4) | 80-bit floating point value |
Comp | ST(0)(4) (5) | 80-bit floating point value |
Currency | ST(0)(4) | 80-bit floating point value(6) |
AnsiChar | al | 8-bit character |
WideChar | ax | 16-bit Unicode character |
Byte | al | 8-bit unsigned value |
AnsiString | extra var parameter(7) |
Pointer to pointer to Ansistring |
(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 80-bits. All results are returned in ST(0)
. It's only the storage or manipulation 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.