The text between ASM and END is direct written
to the generated assembler file. Local
variables and parameters of functions are sustituted by there address on
the stack, relativ to EBP.
ASM and ends with
END . After the END it's possible
to specifie the registers which are modified by the assembler block.
The compiler assumes, that if there are no registers specified
all registers are modified.
Examples:
procedure example;
begin
asm
movw $3,%ax
{ the DOS extender crashes in some cases EBP }
pushl %ebp
int $0x10;
popl %ebp
end ['EAX']; { EAX is modified }
end;
Comments are allowed like in Pascal with {...}. Secondly it's possible to use C+ comments with /* ... */ and // as line comments. Third, it's allowed to use ; as begin of a line comment like in the Intel's asm.
For questions about the syntax, look at the FAQs of the WEB server.
__SELF gives you access to the actuell class pointer.
__RESULT gives you access to the result of a function.
__OLDEBP gives you access to the frame pointer of the
calling function in nested functions
Example:
function example(x,y : longint) : longint;
begin
asm
movl X,%eax
movl Y,%ebx
imul %ebx
movl %eax,__RESULT
end;
end;
fnklaemp@cip.ft.uni-erlangen.de
Copyright (c) 1996 by Florian Klaempfl