next up previous contents index search.gif
Next: 8. Using functions and Up: 7. Statements Previous: 7.2 Structured statements

7.3 Assembler statements

An assembler statement allows you to insert assembler code right in your pascal code.

Assembler statements

\begin{syntdiag}\setlength {\sdmidskip}{.5em}\sffamily\sloppy \synt{asm\ stateme...
...lit{end}
\begin{displaymath}
\synt{registerlist}
\end{displaymath}\end{syntdiag}

\begin{syntdiag}\setlength {\sdmidskip}{.5em}\sffamily\sloppy \synt{registerlist}
\lit*[
\<[b] \synt{string constant} \\ \lit*, \>
\lit*]\end{syntdiag}
More information about assembler blocks can be found in the Programmers' guide. The register list is used to indicate the registers that are modified by an assembler statement in your code. The compiler stores certain results in the registers. If you modify the registers in an assembler statement, the compiler should, sometimes, be told about it. The registers are denoted with their Intel names for the I386 processor, i.e., 'EAX', 'ESI' etc... As an example, consider the following assembler code:

asm
  Movl $1,%ebx
  Movl $0,%eax
  addl %eax,%ebx
end; ['EAX','EBX'];
This will tell the compiler that it should save and restore the contents of the EAX and EBX registers when it encounters this asm statement.

root
1999-06-10