An assembly program consists of zero or more statements, one statement per line. A statement may optionally be followed by a comment, which is introduced by a semicolon (;) and terminated by the end of the input line.
Lines starting with a dollar character ($) in the first column are control lines. They are interpreted independently from the rest of the input. The syntax of these lines is described separately in the chapter Assembler Controls.
A line with a # character in the first position is a line generated by a macro preprocessor to inform the assembler of the original source file name and line number. The format of the remaining lines is given below. A statement can be defined as:
[label:] [instruction | directive] [;comment]
where,
label is an identifier. The occurrence of label: defines the symbol denoted by label and assigns the current value of the location counter to it.
LAB1: ;This is a label
instruction is any valid 8051 assembly language instruction consisting of a mnemonic and one, two, three or no operands. Operands are described in the chapter Operands and Expressions. The instructions are described separately in the chapter 8051 Family Instruction Set.
RETI ; No operand INC @R0 ; One operand AND A, @R0 ; Two operands CJNE @R1,#01,LAB1 ; Three operands
directive any one of the assembler directives; described separately in the chapter Assembler Directives.
A statement may be empty.