The LOCAL directive defines symbols available only in the defined macro.
The dummy-name is a temporary name that is replaced by an unique name
when the macro is expanded. The HASM creates a new actual name for
dummy-name each time the macro is expanded. The actual name has the
form ??digit, where digit is a hexadecimal number within the range from
0000 to FFFF. A label should be be added to the LOCAL directive when
labels are used within the MACRO/ENDM block. Otherwise, the HASM
will issue an error if this MACRO is referred to more than once in the source
file.
In the following example, tmp1 and tmp2 are both dummy parameters, and
are replaced by actual parameters when calling this macro. label1 and
label2 are both declared LOCAL, and are replaced by ??0000 and ??0001
respectively at the first reference, if no other macro is referred. If no LOCAL
declaration takes place, label1 and label2 will be referred to labels, similar
to the declaration in the source program. At the second reference of this
macro, a multiple define error message is displayed.
Delay
MACRO
tmp1, tmp2
LOCAL
label1, label2
mov
a, 70h
mov
tmp1, a
label1:
mov
tmp2, a
label2:
clr
wdt1
clr
wdt2
sdz
tmp2
jmp
label2
sdz
tmp1
jmp
label1
ENDM
The following source program refers to the macro Delay ...
; T.ASM --
;
Sample program for MACRO.
.ListMacro
Delay
MACRO
tmp1, tmp2
LOCAL
label1, label2
mov
a, 70h
mov
tmp1, a
label1:
mov
tmp2, a
label2
clr
wdt1
clr
wdt2
sdz
tmp2
jmp
label2
sdz
tmp1
HT-IDE User’s Guide
126
Summary of Contents for HT-IDE
Page 11: ...P a r t I Integrated Development Environment Part I Integrated Development Environment 1 ...
Page 12: ...HT IDE User s Guide 2 ...
Page 20: ...Fig 1 6 Fig 1 7 HT IDE User s Guide 10 ...
Page 24: ...HT IDE User s Guide 14 ...
Page 70: ...HT IDE User s Guide 60 ...
Page 76: ...HT IDE User s Guide 66 ...
Page 92: ...HT IDE User s Guide 82 ...
Page 93: ...P a r t I I Development Language and Tools Part II Development Language and Tools 83 ...
Page 94: ...HT IDE User s Guide 84 ...
Page 148: ...HT IDE User s Guide 138 ...
Page 150: ...Fig 12 1 Fig 12 2 HT IDE User s Guide 140 ...
Page 154: ...HT IDE User s Guide 144 ...
Page 192: ...HT IDE User s Guide 182 ...
Page 194: ...HT IDE User s Guide 184 ...
Page 218: ...HT IDE User s Guide 208 ...
Page 235: ...P a r t V Appendix Part V Appendix 225 ...
Page 236: ...HT IDE User s Guide 226 ...
Page 250: ...HT IDE User s Guide 240 ...