English
Language : 

45111 Datasheet, PDF (70/184 Pages) List of Unclassifed Manufacturers – 14-DAY MONEY BACK GUARANTEE
7 The SASM Assembler
label. A macro label is the name of a macro block (see the MACRO directive in Section 7.3.15 – The
Macro Directive) and is unique.
Depending on the option you have selected in the Configuration window, local labels must begin in text
column 1, or may be indented.
No macro label can exist with the same name as another macro or global label. Actually, when a
program contains a macro definition, and you use the macro name as a global label by mistake, the
assembler would not report an error, but insert the macro code at the location of the “global label”. The
following code demonstrates global and local labels.
main
mov
:loop
mov
djnz
continue move
:loop
djnz
jmp
loop_count, #15
$09, #100
loop_count, :loop
loop_count, #50
loop_count, :loop
main ;start over
; initialize loop_count
; set some other register
; decrement loop_count,
; jump to :loop if not zero
; set loop_count to 50
; decrement loop_count,
; jump to :loop if not zero
The example above contains two global labels, main and continue, and two local labels, both named :loop.
The area between the main and continue global labels is where a local label can exist. Since the djnz in-
struction in line 3 references the :loop label, and line 3 is between the global labels main and continue, it
will only jump to the :loop label at line 2 and not the :loop label at line 6.
You may also jump to a local label from “outside”. For example, the instruction
jmp
continue:loop
elsewhere in the above program example would cause the program execution to be continued with the
djnz
loop_count, :loop
instruction.
Local and global labels are also allowed within a macro. It is suggested that global labels not be used
within a macro, however, as that would prevent the macro from being called more than once.
7.7 Expressions
Expressions may be used within the arguments of instructions and directives to calculate values at
assemble time. The use of expressions helps build more maintainable, easier to understand code. For
example, if a program uses values that are all related to the same base number, it makes sense to
include an expression crafted from that relationship. If a symbol N is defined as being equal to the base
number 2, then N*2+1 and N*3 can be used to derive values related to it; 5 and 6 in this case. At a later
time, it might become necessary to adjust the base value to 3 and since expressions were used to derive
the related values, only the symbol N needs to be modified.
Page 70 • SX-Key/Blitz Development System Manual 2.0 • Parallax, Inc.