Assembler Syntax

For a complete reference of ColdFire opcodes and addressing modes consult ColdFire Family Programmer's Reference Manual (CFRM).

Instruction Opcodes

Assembler supports instruction set architecture A, B, and C. Use program options to select desired ISA.

Registers

Registers recognized by assembler:

Addressing Modes

For a complete list of supported addressing modes refer to CFRM. Here possible alternative forms and changes to the syntax described in CFRM are listed.

Numbers

Assembler interprets integer numbers only in one of the following systems: decimal, hexadecimal, and binary. Decimal numbers consists of combination of digits 0 to 9. Hexadecimal numbers must start with dollar sign '$' followed by hexadecimal digits. Binary numbers start with '@' sign followed by 0s or 1s. All numbers must be less than 2^32.

Character enclosed in single prime symbols, e.g. 'x', evaluates to a number with ASCII value of an enclosed character; that is it is not a string.

Strings

Strings form a type distinct form numbers. String literals are constructed by enclosing characters in quote marks '"' (double prime symbol). No special string combinations are supported, so "\n" for instance is not a new line character, but two separate characters.

Strings can be passed to macro definitions or used in DC.B directive. Note that character enclosed in prime symbols, such as 'A', is a number, not a string.

Example:

message   DC.B "Message", 10, 0  ; 10 is a new line char
in_quotes DC.B '"', "Message", '"', 10, 0

Labels

Label identifiers may consist of letters, digits, underscore characters, and leading dot or question mark. They cannot start with a digit. Note that directive names and instruction mnemonics are reserved and cannot be used as labels.

Labels are declared by placing them in the first position in line. Labels have global range unless they start with dot '.'. Labels starting with '.' have local scope. Each global label declaration opens new local scope.

To assign particular value to a label follow it by an equal '=' sign and expression.

Example:

MAX = 1000
.loop
	SUBQ.L #1, d0
	BEQ .loop
	RTS
text: dc.b "Hello World", 0

Register Lists

Register lists are formed by specifying '/' separated data and/or address registers. Ranges of registers can be formed too using minus sign '-'. Register list is expected by MOVEM instruction, but it can also be assigned to a label or passed to a macro.

Example:

list = D2-D5/A2/A5
	MOVEM.L D3/A3, (SP)

Operators

Assembler supports arithmetical and logical operators. They are listed below ordered by priority, with highest priority operators at the top.

  1. [ ]

    Grouping expressions. Square brackets are used to avoid confusion with parentheses which form different addressing modes. Use them to change order of calculations.

  2. - ~ ! < >

    Unary operators: - arithmetical negation, ! logical not, ~ bitwise not, < low word, > high word.

  3. * / %

    Multiplication, division, and modulo operations, respectively.

  4. << >>

    Arithmetical bit shift left and right.

  5. + -

    Addition and subtraction.

  6. & | ^

    Bitwise and, or, exclusive or, respectively.

  7. > < >= <= == !=

    Comparison operators.

  8. &&

    Boolean and.

  9. ||

    Boolean or.

Expressions

Numbers can be combined using operators to form expressions. All instructions expecting numbers also accept expressions evaluating to numbers.

Predefined Functions

Examples:

       IF !PASSDEF(errno)  ; 'errno' not defined yet?
errno: DC.L 0              ; conditional definition is not going to cause
       ENDIF               ; phase error thanks to PASSDEF() function

       IF REF(msg) && !PASSDEF(msg)  ; if 'msg' was referenced, but not defined
msg:   DC.B "Message...", 0          ; then define 'msg' now
       ENDIF

Predefined Labels