JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
x86 Assembly Language Reference Manual     Oracle Solaris 11.1 Information Library
search filter icon
search icon

Document Information

Preface

1.  Overview of the Oracle Solaris x86 Assembler

2.  Oracle Solaris x86 Assembly Language Syntax

Lexical Conventions

Statements

Comments

Labels

Symbolic Labels

Numeric Labels

Tokens

Identifiers

Keywords

Numerical Constants

Integer Constants

Floating Point Constants

String Constants

Operators

Instructions, Operands, and Addressing

Instructions

Operands

Assembler Directives

3.  Instruction Set Mapping

A.  Using the Assembler Command Line

Index

Lexical Conventions

This section discusses the lexical conventions of the Oracle Solaris x86 assembly language.

Statements

An x86 assembly language program consists of one or more files containing statements. A statement consists of tokens separated by whitespace and terminated by either a newline character (ASCII 0x0A) or a semicolon (;) (ASCII 0x3B). Whitespace consists of spaces (ASCII 0x20), tabs (ASCII 0x09), and formfeeds (ASCII 0x0B) that are not contained in a string or comment. More than one statement can be placed on a single input line provided that each statement is terminated by a semicolon. A statement can consist of a comment. Empty statements, consisting only of whitespace, are allowed.

Comments

A comment can be appended to a statement. The comment consists of the slash character (/) (ASCII 0x2F) followed by the text of the comment. The comment is terminated by the newline that terminates the statement.

Labels

A label can be placed at the beginning of a statement. During assembly, the label is assigned the current value of the active location counter and serves as an instruction operand. There are two types of lables: symbolic and numeric.

Symbolic Labels

A symbolic label consists of an identifier (or symbol) followed by a colon (:) (ASCII 0x3A). Symbolic labels must be defined only once. Symbolic labels have global scope and appear in the object file's symbol table.

Symbolic labels with identifiers beginning with a period (.) (ASCII 0x2E) are considered to have local scope and are not included in the object file's symbol table.

Numeric Labels

A numeric label consists of a unsigned decimal int32 value followed by a colon (:). Numeric labels are used only for local reference and are not included in the object file's symbol table. Numeric labels have limited scope and can be redefined repeatedly.

When a numeric label is used as a reference (as an instruction operand, for example), the suffixes b (“backward”) or f (“forward”) should be added to the numeric label. For numeric label N, the reference Nb refers to the nearest label N defined before the reference, and the reference Nf refers to the nearest label N defined after the reference. The following example illustrates the use of numeric labels:

1:          / define numeric label "1"
one:        / define symbolic label "one"

/ ... assembler code ...

jmp   1f    / jump to first numeric label "1" defined
            / after this instruction
            / (this reference is equivalent to label "two")

jmp   1b    / jump to last numeric label "1" defined
            / before this instruction
            / (this reference is equivalent to label "one")

1:          / redefine label "1"
two:        / define symbolic label "two"

jmp   1b    / jump to last numeric label "1" defined
            / before this instruction
            / (this reference is equivalent to label "two")

Tokens

There are five classes of tokens:

Identifiers

An identifier is an arbitrarily-long sequence of letters and digits. The first character must be a letter; the underscore (_) (ASCII 0x5F) and the period (.) (ASCII 0x2E) are considered to be letters. Case is significant: uppercase and lowercase letters are different.

Keywords

Keywords such as x86 instruction mnemonics (“opcodes”) and assembler directives are reserved for the assembler and should not be used as identifiers. See Chapter 3, Instruction Set Mapping for a list of the Oracle Solaris x86 mnemonics. See Assembler Directives for the list of as assembler directives.

Numerical Constants

Numbers in the x86 architecture can be integers or floating point. Integers can be signed or unsigned, with signed integers represented in two's complement representation. Floating-point numbers can be: single-precision floating-point; double-precision floating-point; and double-extended precision floating-point.

Integer Constants

Integers can be expressed in several bases:

Floating Point Constants

Floating point constants have the following format:

A valid floating point constant must have either an integer part or a fractional part.

String Constants

A string constant consists of a sequence of characters enclosed in double quotes ( ") (ASCII 0x22). To include a double-quote character ("), single-quote character ('), or backslash character (\) within a string, precede the character with a backslash (\) (ASCII 0x5C). A character can be expressed in a string as its ASCII value in octal preceded by a backslash (for example, the letter “J” could be expressed as “\112”). The assembler accepts the following escape sequences in strings:

Escape Sequence
Character Name
ASCII Value (hex)
\n
newline
0A
\r
carriage return
0D
\b
backspace
08
\t
horizontal tab
09
\f
form feed
0C
\v
vertical tab
0B

Operators

The assembler supports the following operators for use in expressions. Operators have no assigned precedence. Expressions can be grouped in square brackets ([]) to establish precedence.

+

Addition

-

Subtraction

\*

Multiplication

\/

Division

&

Bitwise logical AND

|

Bitwise logical OR

>>

Shift right

<<

Shift left

\%

Remainder

!

Bitwise logical AND NOT

^

Bitwise logical XOR


Note - The asterisk (*), slash (/), and percent sign (%) characters are overloaded. When used as operators in an expression, these characters must be preceded by the backslash character (\).