CHAPTER 4: ASSEMBLER
S5U1C63000A MANUAL
EPSON
55
(S1C63 FAMILY ASSEMBLER PACKAGE)
Scope
The scope is a reference range of a symbol (label). It is called local if the symbol is to be referenced
within the same file, and it is called global if the symbol is to be referenced from other files.
Any defined symbol's scope is local in default. To make a symbol's scope global, use the .global
pseudo-instruction both in the file in which the symbol is defined and in the file that references the
symbol.
A double definition of local symbols will be an error at the assembly stage, while a double definition
of global symbols will be an error at the link stage.
Example:
File in which global symbol is defined (file1)
.global
SYMBOL
... Global declaration of a symbol which is to be defined in this file.
SYMBOL:
:
LABEL:
... Local symbol
:
(Can be referenced to only in this file)
File in which a global symbol is referenced to (file2)
.global
SYMBOL
... Global declaration of a symbol defined in other source file.
call
SYMBOL
... Symbol externally referenced to.
:
LABEL:
... Local symbol
:
(Treated as a different symbol from LABEL of file1)
The assembler regards those symbols as those of undefined addresses in the assembling, and includes
that information in the object file it delivers. Those addresses are finally determined by the processing
of the linker.
∗
When a symbol is defined by the .comm pseudo-instruction, that symbol will be a global symbol.
Therefore, in a defined file, no global declaration needs to be made using the .global pseudo-instruc-
tion. On the contrary, in a file to be referenced, the global declaration is necessary prior to the refer-
ence.
Symbol masks
Symbol masks are designed to acquire the upper 8-bit address and the lower 8-bit address from a
symbol representing a 16-bit address.
The following 5 types of symbol masks can be used:
@l or @L
Acquires the lower 8 bits of an absolute address.
@h or @H
Acquires the upper 8 bits of an absolute address.
@rl or @RL
Acquires the lower 8 bits of a relative address.
@rh or @RH
Acquires the upper 8 bits of a relative address.
@xh or @XH
Acquires the upper 8 bits of an absolute address by inverting them (Used exclu-
sively for the "ldb" instruction combined with the "cmp" instruction).
Sample uses:
ldb
%ext,ADDR@h
ldb
%xl,ADDR@l
... Functions as "ld %x, ADDR (16-bit)"
ldb
%ext,NUM@h
add
%x,NUM@l
... Functions as "add %x, NUM (16-bit)"
ldb
%ext,LABEL@rh
calr
LABEL@rl
... Functions as "calr LABEL (16-bit)"
ldb
%ext,DATA@xh
cmp
%x,DATA@l
... Functions as "cmp %x, DATA (16-bit)"
.set
IO_ADDR 0xff12
ldb
%ext,IO_ADDR@l
ld
%a,[%y]
... Functions as "ld %a, [IO_ADDR]"
Summary of Contents for S5U1C63000A
Page 4: ......
Page 14: ......
Page 304: ......
Page 305: ...S1C63 Family Assembler Package Quick Reference ...