![]() |
![]() |
| |||||||||||||||||||||||||
Chapter 2Assembler SyntaxThe SunOS 5.x SPARC assembler takes assembly language programs, as specified in this document, and produces relocatable object files for processing by the SunOS 5.x SPARC link editor. The assembly language described in this document corresponds to the SPARC instruction set defined in the SPARC Architecture Manual (Version 8 and Version 9) and is intended for use on machines that use the SPARC architecture. This chapter is organized into the following sections: 2.1 Syntax NotationIn the descriptions of assembly language syntax in this chapter:
2.2 Assembler File SyntaxThe syntax of assembly language files is:
2.2.1 Lines SyntaxThe syntax of assembly language lines is:
2.2.2 Statement SyntaxThe syntax of an assembly language statement is:
where:
label
instruction
2.3 Lexical FeaturesThis section describes the lexical features of the assembler syntax. 2.3.1 Case DistinctionUppercase and lowercase letters are distinct everywhere except in the names of special symbols. Special symbol names have no case distinction. 2.3.2 CommentsA comment is preceded by an exclamation mark character (!); the exclamation mark character and all following characters up to the end of the line are ignored. C language-style comments (``/*...*/'') are also permitted and may span multiple lines. 2.3.3 LabelsA label is either a symbol or a single decimal digit n (0...9). A label is immediately followed by a colon ( : ). Numeric labels may be defined repeatedly in an assembly file; normal symbolic labels may be defined only once. A numeric label n is referenced after its definition (backward reference) as nb, and before its definition (forward reference) as nf. 2.3.4 NumbersDecimal, hexadecimal, and octal numeric constants are recognized and are written as in the C language. However, integer suffixes (such as L) are not recognized. For floating-point pseudo-operations, floating-point constants are written with 0r or 0R (where r or R means REAL) followed by a string acceptable to atof(3); that is, an optional sign followed by a non-empty string of digits with optional decimal point and optional exponent. The special names 0rnan and 0rinf represent the special floating-point values Not-A-Number (NaN) and INFinity. Negative Not-A-Number and Negative INFinity are specified as 0r-nan and 0r-inf. Note - The names of these floating-point constants begin with the digit zero, not the letter "O." 2.3.5 StringsA string is a sequence of characters quoted with either double-quote mark (") or single-quote mark (') characters. The sequence must not include a newline character. When used in an expression, the numeric value of a string is the numeric value of the ASCII representation of its first character. The suggested style is to use single quote mark characters for the ASCII value of a single character, and double quote mark characters for quoted-string operands such as used by pseudo-ops. An example of assembly code in the suggested style is:
The escape codes described in Table 2-1, derived from ANSI C, are recognized in strings. Table 2-1
2.3.6 Symbol NamesThe syntax for a symbol name is:
In the above syntax:
| |||||||||||||||||||||||||
| |||||||||||||||||||||||||