Assembler Directives
BASE — Set Number Base
MCUez HC12 Assembler User’s Manual
MOTOROLA Assembler Directives 167
8.5 BASE — Set Number Base
Syntax: BASE <n>
Description: This directive sets the default number base for constants to
<n>. The operand <n> may be prefixed to indicate its number
base; otherwise, the operand is considered to be in the current
default base. Validvalues of <n> are 2, 8, 10, and 16. Unless a
default base is specified using the BASE directive, the default
number base is decimal.
Example:
4 4 base 10 ; default base is decimal
5 5 000000 64 dc.b 100
6 6 base 16 ; default base is hex
7 7 000001 0A dc.b 0a
8 8 base 2 ; default base is binary
9 9 000002 04 dc.b 100
10 10 000003 04 dc.b %100
11 11 base @12 ; default base is decimal
12 12 000004 64 dc.b 100
13 13 base $a ; default base is decimal
14 14 000005 64 dc.b 100
15 15
16 16 base 8 ; default base is octal
17 17 000006 40 dc.b 100
NOTE:
Even if the base value is set to 16, hexadecimal constants terminated by a D
must be prefixed by the $ (dollar sign) character; otherwise, they are
interpreted as decimal constants in old style format. For example, constant 45D
is interpreted as decimal constant 45, not as hexadecimal constant $45D.