📄 asmlnk.doc
字号:
is followed by a comment. For example, in the following statement: label: lda abcd,x ;Comment field THE ASSEMBLER PAGE 1-6 SOURCE PROGRAM FORMAT the tab between lda and abcd terminates the operator field and defines the beginning of the operand field; a comma separates the operands abcd and x; and a semicolon terminates the operand field and defines the beginning of the comment field. When no comment field follows, the operand field is terminated by the end of the source line. 1.2.1.4 Comment Field - The comment field begins with a semicolon and extends through the end of the line. This field is optional and may contain any 7-bit ascii character except null. Comments do not affect assembly processing or program execu- tion. 1.3 SYMBOLS AND EXPRESSIONS This section describes the generic components of the ASxxxx assemblers: the character set, the conventions observed in con- structing symbols, and the use of numbers, operators, and ex- pressions. 1.3.1 Character Set The following characters are legal in ASxxxx source programs: 1. The letters A through Z. Both upper- and lower-case letters are acceptable. The assemblers are case sensi- tive, i.e. ABCD and abcd are different symbols. (The assemblers can be made case insensitive by recompiling with the appropriate switches.) 2. The digits 0 through 9 3. The characters . (period), $ (dollar sign), and _ (un- derscore). 4. The special characters listed in Tables 1 through 6. Tables 1 through 6 describe the various ASxxxx label and field terminators, assignment operators, operand separators, as- sembly, unary, binary, and radix operators. THE ASSEMBLER PAGE 1-7 SYMBOLS AND EXPRESSIONS Table 1 Label Terminators and Assignment Operators ---------------------------------------------------------------- : Colon Label terminator. :: Double colon Label Terminator; defines the label as a global label. = Equal sign Direct assignment operator. == Double equal Direct assignment operator; sign defines the symbol as a global symbol. ---------------------------------------------------------------- Table 2 Field Terminators and Operand Separators ---------------------------------------------------------------- Tab Item or field terminator. Space Item or field terminator. , Comma Operand field separator. ; Semicolon Comment field indicator. ---------------------------------------------------------------- Table 3 Assembler Operators ---------------------------------------------------------------- # Number sign Immediate expression indicator. . Period Current location counter. ( Left parenthesis Expression delimiter. ) Right parenthesis Expression delimeter. ---------------------------------------------------------------- THE ASSEMBLER PAGE 1-8 SYMBOLS AND EXPRESSIONS Table 4 Unary Operators ---------------------------------------------------------------- < Left bracket <FEDC Produces the lower byte value of the expression. (DC) > Right bracket >FEDC Produces the upper byte value of the expression. (FE) + Plus sign +A Positive value of A - Minus sign -A Produces the negative (2's complement) of A. ~ Tilde ~A Produces the 1's comple- ment of A. ' Single quote 'D Produces the value of the character D. " Double quote "AB Produces the double byte value for AB. \ Backslash '\n Unix style characters \b, \f, \n, \r, \t or '\001 or octal byte values. ---------------------------------------------------------------- THE ASSEMBLER PAGE 1-9 SYMBOLS AND EXPRESSIONS Table 5 Binary Operators ---------------------------------------------------------------- << Double 0800 << 4 Produces the 4 bit Left bracket left-shifted value of 0800. (8000) >> Double 0800 >> 4 Produces the 4 bit Right bracket right-shifted value of 0800. (0080) + Plus sign A + B Arithmetic Addition operator. - Minus sign A - B Arithmetic Subtraction operator. * Asterisk A * B Arithmetic Multiplica- tion operator. (signed 16-bit) / Slash A / B Arithmetic Division operator. (signed 16-bit quotient) & Ampersand A & B Logical AND operator. | Bar A | B Logical OR operator. % Percent sign A % B Modulus operator. (16-bit value) ^ Up arrow or A ^ B EXCLUSIVE OR operator. circumflex ---------------------------------------------------------------- THE ASSEMBLER PAGE 1-10 SYMBOLS AND EXPRESSIONS Table 6 Temporary Radix Operators ---------------------------------------------------------------- $%, 0b, 0B Binary radix operator. $&, 0o, 0O, 0q, 0Q Octal radix operator. $#, 0d, 0D Decimal radix operator. $$, 0h, 0H, 0x, 0X Hexidecimal radix operator. Potential ambiguities arising from the use of 0b and 0d as temporary radix operators may be circumvented by pre- ceding all non-prefixed hexidecimal numbers with 00. Leading 0's are required in any case where the first hexidecimal digit is abcdef as the assembler will treat the letter sequence as a label. ---------------------------------------------------------------- 1.3.2 User-Defined Symbols User-defined symbols are those symbols that are equated to a specific value through a direct assignment statement or appear as labels. These symbols are added to the User Symbol Table as they are encountered during assembly. The following rules govern the creation of user-defined symbols: 1. Symbols can be composed of alphanumeric characters, dollar signs ($), periods (.), and underscores (_) only. 2. The first character of a symbol must not be a number (except in the case of local symbols). 3. The first eight characters of a symbol must be unique. A symbol can be written with more than eight legal characters, but the ninth and subsequent characters are ignored. 4. Spaces and Tabs must not be embedded within a symbol. THE ASSEMBLER PAGE 1-11 SYMBOLS AND EXPRESSIONS 1.3.3 Local Symbols Local symbols are specially formatted symbols used as labels within a block of coding that has been delimited as a local sym- bol block. Local symbols are of the form n$, where n is a decimal integer from 0 to 255, inclusive. Examples of local symbols are: 1$ 27$ 138$ 244$ The range of a local symbol block consists of those state- ments between two normally constructed symbolic labels. Note that a statement of the form: ALPHA = EXPRESSION is a direct assignment statement but does not create a label and thus does not delimit the range of a local symbol block. Note that the range of a local symbol block may extend across program areas. Local symbols provide a convenient means of generating labels for branch instructions and other such references within local symbol blocks. Using local symbols reduces the possibility of symbols with multiple definitions appearing within a user pro- gram. In addition, the use of local symbols differentiates entry-point labels from local labels, since local labels cannot be referenced from outside their respective local symbol blocks. Thus, local symbols of the same name can appear in other local symbol blocks without conflict. Local symbols require less sym- bol table space than normal symbols. Their use is recommended. The use of the same local symbol within a local symbol block will generate one or both of the m or p errors. THE ASSEMBLER PAGE 1-12 SYMBOLS AND EXPRESSIONS Example of local symbols: a: ldx #atable ;get table address lda #0d48 ;table length 1$: clr ,x+ ;clear deca bne 1$
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -