Assembly Language Syntax Programs written in assembly language consist of a sequence of source statements.
Example of label in assembly language. Mnemonic represents the operation to be performed ADD SUB etc. The following are examples of an. In LC-3bassembly language a label consists of from one to 20 alphanumeric characters ie a capital or lower case letter of the alpha-bet or a decimal digit starting with a letter of the alphabet.
The address can be PC-relative register-relative or absolute. The address given by a label is calculated during assembly. Assembly language statements are entered one statement per line.
Count DWORD 100 The assembler assigns a numeric address to each label. Each statement follows the following format label mnemonic operands comment The fields in the square brackets are optional. First each label name must be unique.
The use of labels often makes a programme easier to understand and to modify. A label is a symbol that represents the memory address of an instruction or data. The directive EQU stands for equals.
In assembly language labels can be used anywhere an address can for example as the operand of a JMP or MOV instruction. The names used for labels in assembly language programming consist of alphabetic letters in both uppercase and lowercase number 0 through 9 and special characters such as question mark period at the rate underscore _ and dollar. Each label name must be unique.
Example 1 adds 25 10 times in itself whereas example 2 takes complement of Register A 700 times. For numeric label N the reference Nb refers to the nearest label N defined before the reference and the reference Nf refers to the nearest label N defined after the reference. The assembler would translate START as 10 and load the code at 10 as before.