Assembler source

The Assembler works on source files containing instruction mnemonics, labels and directives. The instruction mnemonics and the directives often take operands.

Code lines should be limited to 120 characters.

Every input line can be preceded by a label, which is an alphanumeric string terminated by a colon. Labels are used as targets for jump and branch instructions and as variable names in Program memory and RAM.

An input line may take one of the four following forms:

[label:] directive [operands] [Comment]
[label:] instruction [operands] [Comment]


Empty line
A comment has the following form:
; [Text]
Items placed in braces are optional. The text between the comment-delimiter (;) and the end of line (EOL) is ignored by the Assembler. Labels, instructions and directives are described in more detail later.
If you use AVR Assembler 2 (AVRASM2) you should also read AVR Assembler 2 Syntax.


label:   .EQU var1=100 ; Set var1 to 100 (Directive)
         .EQU var2=200 ; Set var2 to 200            
test:    rjmp test     ; Infinite loop (Instruction)
                       ; Pure comment line          
                       ; Another comment line       
Note that there are no restrictions with respect to column placement of labels, directives, comments or instructions.