Hardware Reference
In-Depth Information
The following instructions contain invalid labels:
here is
adda
#5
; a space is included in the label
loop
deca
; label begins at column 2
2.2.2 The Operation Field
This field specifies an assembler instruction, a directive, or a macro call. Assembler in-
structions or directives are case insensitive. The operation field must not start in column
one. If a label is present, the opcode or directive must be separated from the label field by at
least one space. If there is no label, the operation field must be at least one space from the left
margin.
Example 2.2 Examples of Operation Fields
adda
#$02
; adda is the instruction mnemonic
true
equ
1
; the equ directive occupies the operation field
2.2.3 The Operand Field
If an operand field is present, it follows the operation field and is separated from the opera-
tion field by at least one space. The operand field is composed of one or more operands separated
by commas, followed by optional space or tab characters. The operand field is used to supply
arguments to the assembler instruction, directive, or macro that has been used in the operation
field. The following instructions include the operand field:
TCNT
equ
$0084
; the value $0084 is the operand field
TC0
equ
$0090
; the value $0090 is the operand field
2.2.4 The Comment Field
The comment field is optional and is added mainly for documentation purposes. The com-
ment field is ignored by the assembler. Here are the rules for comments.
Any line beginning with an * is a comment.
Any line beginning with a semicolon (;) is a comment. In this topic, we use a “;” to
start a comment.
You must have a “;” prefixing any comment on a line with mnemonics.
Examples of comments are shown in the following instructions:
; this program computes the square root of N 8-bit integers.
org $1000 ; set the location counter to $1000
dec lp_cnt ; decrement the loop count
In this chapter, we use the Freescale Freeware cross assembler as12 as the standard to ex-
plain every aspect of assembly programming. The as12 assembler contained in the MiniIDE
from Mgtek is compatible with the as12 freeware from Freescale.
 
Search WWH ::




Custom Search