60
EPSON
S5U1C62000A MANUAL
(S1C60/62 FAMILY ASSEMBLER PACKAGE)
CHAPTER 5: ASSEMBLER
Precautions
• Minus numbers -1 to -32768 are handled as 0xffff to 0x8000.
• The assembler handles expressions as 16-bit data. Pay attention to the data size when using it as 4-bit
immediate data, especially when it has a minus value.
Example:
ld a,-2+1
... NG. It will be expanded as "ld a,0xffff".
ld a,(-2+1)&0xf
... OK. It will be expanded as "ld a,0xf".
• Expressions are calculated with a sign (like a signed short in C language).
Pay attention to the calculation results of the >>, / and % operators using hexadecimal numbers.
Example:
#define NUM1 0xfffe/2
... -2/2 = -1 (0xffff)
The / and % operators can only be used within the range of +32767 to -32768.
#define NUM2 0xfffe>>1
... -2>>1 = -1 (0xffff)
Mask as (0xfffe>>1)&0x7fff.
• Do not insert a space or a tab between an operator and a term.
5.5.10 Location Counter Symbol "$"
The address of each instruction code is set in the 13-bit location counter when a statement is assembled. It
can be referred using a symbol "$" as well as labels. "$" indicates the current location, thus it can be used
for relative branch operation. The operators can be used with this symbol similar to labels.
Example:
jp $
... Jumps to this address (means endless loop).
jp $+2
... Jumps to two words after this address.
jp $-10
... Jumps to 10 words before this address.
jp $+16+(16*(BLK>16))
... Operators and defined symbols can be used.
Precaution
When the address referred to relatively with "$" is in another section, it should be noted if the in-
tended section resides at the addressed place, because if the section is relocatable, the absolute
address is not fixed until the linking is completed.
Summary of Contents for S5U1C62000A
Page 4: ......
Page 233: ...S1C62 Family Assembler Package Quick Reference ...