Language:
Русский
English
Built-in Assembler Expression Symbols
The built-in assembler provides access to almost all Pascal symbols in assembler expressions, including labels, constants, types, variables, procedures, and functions.
The built-in assembler also provides several predefined type symbols.
Symbol Value Class Type
Label Address of label Memory Short
Constant Value of constant Immediate 0
Type 0 Memory Size of type
Field Offset of field Memory Size of type
Variable Address of variable Memory Size of type
Procedure Address of procedure Memory Near or Far
Function Address of function Memory Near or Far
Unit 0 Immediate 0
@Code Code segment address Memory 0FFF0H
@Data Data segment address Memory 0FFF0H
@Result Result var offset Memory Size of type
Symbols that can not be used in Built-in Assembler Expressions
The following symbols can not be used in built-in assembler expressions:
- Standard procedures and functions (for example, WriteLn, Chr)
- The special arrays Mem, MemW, MemL, Port and PortW
- String, floating-point, and set constants
- Procedures and functions declared with the inline directive
- Labels that are not declared in the current block
- The @Result symbol outside a function.
Local Variables
Local variables (variables declared in procedures and functions) are always allocated on the stack and accessed relative to SS:BP.
The value of a local-variable symbol is its signed offset from SS:BP.
The built-in assembler automatically adds [BP] in references to local variables.
Var Parameter
The built-in assembler always treats a var parameter as a 32-bit pointer, and the size of a var parameter is always 4 (the size of a 32-bit pointer).
To access the contents of a var parameter, you must first load the 32-bit pointer and then access the location it points to.
Scope
A scope is provided by type, field, and variable symbols of a record or object type.
In addition, a unit identifier opens the scope of a particular unit, just like a fully-qualified identifier in Pascal.
Operator
Some symbols, such as record types and variables, have a scope that can be accessed using the structure member selector (.) operator.
Type Identifier
You can use a type identifier to construct variables as you write your program.
Each of these instructions generates the same machine code, which loads the contents of ES:[DI+4] into AX:
asm
MOV AX,(Rect PTR ES:[DI]).B.X
MOV AX,Rect(ES:[DI]).B.X
MOV AX,ES:Rect[DI].B.X
MOV AX,Rect[ES:DI].B.X
MOV AX,ES:[DI].Rect.B.X
end;