
34 Assembly Language Programming for the 68000 Family
line, you must use an asterisk in column 1. You can see the comments in
Figure 6.
On Choosing Symbols
When you need to select a new symbol for use as a constant, variable,
or label for an instruction, you are free to create arbitrary symbols as
long as you adhere to the rules for creating an identifier. However, some
assemblers do not allow you to create symbols that are the same as the
instruction mnemonics or assembler directives. These reserved symbols
are known as the keywords of the assembler. Although it may seem clear
when a symbol is used as an instruction rather than a variable, some
assemblers are not that smart. Even if your assembler can make this
distinction, it is a good practice to avoid using keywords. Consult your
assembler manual. You can usually find a table of all the keywords that
the assembler recognizes.
It is good programming practice to choose symbols that have a mean
ing related to their use in the program. For example, if you use a vari
able to keep track of a count, why not name it COUNT? Short symbols
like I, J, or N can be used, but don’t tell us much. Labels for instruc
tions can indicate the function of a particular portion of the program.
The label RE ADD AT A clearly indicates the reading of some data. The
label L23 does not convey any meaning. Although many assemblers al
low’ extremely long identifiers, keeping them to eight characters or less
is standard practice. Most programmers line up the source line fields on
tab stops set at every eight columns, and long identifiers make lining up
the fields difficult unless a lot of extra space is used to accommodate the
longest symbols.
Constants
A constant is a value that doesn’t change during program assembly
or execution. Two types of constants can be used: integers and character
strings.
Integer constants are numeric quantities that can be represented by
32 bits or less. You will remember from Chapter 1 that numbers can be
represented in various number bases. If a constant is specified without
indicating this base or radix, it is assumed to be in the decimal number
base. To indicate that a constant is written in a number base other than
10, we can prefix the number with a radix indicator. The radix indicators
Kommentare zu diesen Handbüchern