[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
inline Signals the Start of Inline Machine Language [TP]
inline ( <element>/<element>/.../<element>);
The INLINE construct lets you insert machine-level instructions
directly into your Turbo Pascal program.
<element> an expression consisting of one or more <data> items
added or subtracted together; it takes the form
<data><op><data><op>...<op><data>
with <data> and <op> defined as below. The resulting
value is embedded as direct machine code.
<data> an integer constant, a variable name, a subprogram
name, or a location counter reference (*).
<op> either a plus (+) or a minus (-) sign.
Each <element> will generate either 1 or 2 bytes (1 word). If
<element> consists of integer constants only and produces a value in
the range 0..255, then 1 byte is generated. If, however, <element>
refers to a variable, subprogram, or a location counter reference (*),
then 1 word will be generated (low-order byte first).
There is a way to override the rules for code size generation as
described above. If <element> starts with the character '<', then only
the low-order byte will be coded, even if <element> produces a word.
If <element> starts with the character '>', then a word will be
generated, even if only a byte value is generated (the high-order byte
will be set to 0).
Use DEBUG to determine the machine-level codes to use.
Inline statements may occur anywhere in the program body; however,
make sure that the registers BP, SP, DS, and SS are the same upon exit
as they where when entering the Inline statement.
The address of a variable used in an Inline statement is an offset
from the beginning of that variable's base segment. Global variables
use the data segment as a base segment, hence DS will have the segment
value. Subprograms and typed constants use the code segment as a base
segment, hence CS will have the segment value. Local variables use the
stack segment as a base segment, but the actual variable address
offset is relative to the BP register, which will automatically use
the SS register.
-------------------------------- Example ---------------------------------
{ The following will push registers AX,BX,CX,DX,SI,DI,DS }
{ and ES. }
inline
($50/$53/$51/$52/ { Push all the registers }
$56/$57/$1E/$06);
See Also:
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson