Labels

Specifying addresses in assembler program is time consuming, error-prone and requires extensive changes if inctructions are inserted.

Assemblers allow symbolic names to be attached to addresses.

Any use of these names in instructions is replaced by the actual address.

The assembler will do the necessary calculation for relative addresses.

For example:

; sum in R16
; i in R17
; R18,R19 used for temporary values
    LDI  R16, 0
    LDI  R17, 1
loop:
    LDI R18, 5
    SUB R18, R17
    BRBS 1, end
    ADD R16, R17
    LDI R19, 1
    ADD R17, R19
    JMP loop
end:
    SLEEP

Index