Reputation: 1
Can labels for address location be placed in middle of assembly language program? Like
ORG 100
100 LDA SUB
101 CMA
102 SUB, DEC -23
103 INC
104 ADD MIN
105 MIN, DEC 83
106 STA DIF
107 DIF, HEX 0
108 HLT
END
Upvotes: 0
Views: 1001
Reputation:
I suppose this depends on your assembler, but using nasm, fasm, yasm, masm and gnu as, yes you can and you typically use labels for jmp targets etc.
Specifically, a normal label is similar in use to static
functions in C.
In NASM, those you mark with global labelname
are exported from the object and can be referenced from other compilation units and linked up by a linker.
The syntax for nasm would be:
global myfunc
myfunc:
<stuff>
myotherlabel:
<stuff>
jne myotherlabel
<stuff>
Upvotes: 1