Epson S5U1C63000A User Manual page 69

Cmos 4-bit single chip microcomputer manual
Table of Contents

Advertisement

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:
:
LABEL:
:
File in which a global symbol is referenced to (file2)
.global
call
:
LABEL:
:
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.
Acquires the upper 8 bits of an absolute address.
@h or @H
@rl or @RL
Acquires the lower 8 bits of a relative address.
Acquires the upper 8 bits of a relative address.
@rh or @RH
@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
ldb
%ext,NUM@h
add
%x,NUM@l
ldb
%ext,LABEL@rh
calr
LABEL@rl
ldb
%ext,DATA@xh
cmp
%x,DATA@l
.set
IO_ADDR
ldb
%ext,IO_ADDR@l
ld
%a,[%y]
S5U1C63000A MANUAL
(S1C63 FAMILY ASSEMBLER PACKAGE)
... Global declaration of a symbol which is to be defined in this file.
SYMBOL
... Local symbol
(Can be referenced to only in this file)
... Global declaration of a symbol defined in other source file.
SYMBOL
... Symbol externally referenced to.
SYMBOL
... Local symbol
(Treated as a different symbol from LABEL of file1)
... Functions as "ld %x, ADDR (16-bit)"
... Functions as "add %x, NUM (16-bit)"
... Functions as "calr LABEL (16-bit)"
... Functions as "cmp %x, DATA (16-bit)"
0xff12
... Functions as "ld %a, [IO_ADDR]"
EPSON
CHAPTER 4: ASSEMBLER
55

Advertisement

Table of Contents
loading

Table of Contents