The
built-in assembler is accessed through asm statements, which have the
form
asm statementList end
where statementList is a sequence of
assembler statements separated by semicolons, end-of-line characters, or Object
Pascal comments.
Comments
in an asm statement must be in Object Pascal style. A semicolon does not
indicate that the rest of the line is a comment.
The reserved word inline and the directive assembler are maintained for backward compatibility only. They have no effect on the compiler.
In general, the rules of register use in an asm statement are the same as those of an external procedure or function. An asm statement must preserve the EDI, ESI, ESP, EBP, and EBX registers, but can freely modify the EAX, ECX, and EDX registers. On entry to an asm statement, BP points to the current stack frame, SP points to the top of the stack, SS contains the segment address of the stack segment, and DS contains the segment address of the data segment. Except for ESP and EBP, an asm statement can assume nothing about register contents on entry to the statement.
Inline assembler code: Overview
内建的汇编程序编译器通过asm语句被访问,asm语句具有如下形式:
asm statementList end
这里的statementList是一个汇编语句序列,它们之间以分号、行结束符或Object Pascal注释隔开。
asm语句中的注释必须是Object Pascal风格的。分号不表示行的剩余部分是注释(在传统的汇编语言中,分号表示该行分号之后的部分是注释)。
保留字inline和指示字assembler仅用于维持向后的兼容性。它们对编译器没有影响。
通常,寄存器在asm语句中的使用与那些外部的(external)过程或函数相同。asm语句必须保持EDI、ESI、ESP、EBP和EBX等寄存器,但可以自由修改EAX、ECX和EDX寄存器。在asm语句的入口,BP指向当前栈的帧,SP指向栈顶,SS包含了栈段的段地址,DS包含了数据段段地址。除了ESP和EBP之外,asm语句可以假定在语句入口点没有包含任何寄存器信息。