Quick start manual
Inline assembly code
13-7
Assembler statement syntax
procedure CallVirtualMethod(e: TExample);
asm
// Instance pointer needs to be in EAX
MOV EAX, e
// Retrieve VMT table entry
MOV EDX, [EAX]
// Now call the method at offset VMTOFFSET
CALL DWORD PTR [EDX + VMTOFFSET TExample.VirtualMethod]
end;
var
e: TExample;
begin
e := TExample.Create;
try
CallDynamicMethod(e);
CallVirtualMethod(e);
finally
e.Free;
end;
end.
Operands
Inline assembler operands are expressions that consist of constants, registers,
symbols, and operators.
Within operands, the following reserved words have predefined meanings:
Table 13.1 Built-in assembler reserved words
AH CL DX ESP mm4 SHL WORD
AL CS EAX FS mm5 SHR xmm0
AND CX EBP GS mm6 SI xmm1
AX DH EBX HIGH mm7 SMALL xmm2
BH DI ECX LARGE MOD SP xmm3
BL DL EDI LOW NOT SS xmm4
BP CL EDX mm0 OFFSET ST xmm5
BX DMTINDEX EIP mm1 OR TBYTE xmm6
BYTE DS ES mm2 PTR TYPE xmm7
CH DWORD ESI mm3 QWORD VMTOFFSET XOR