Absolute call instruction (calz), Pc relative call instructions (calr), Fig. 2.2.3.1 operation of jump instructions – Epson S1C63000 User Manual
Page 20
14
EPSON
S1C63000 CORE CPU MANUAL
CHAPTER 2: ARCHITECTURE
PC relative jump instructions
Program memory
0000H
FFFFH
xxxxH
xxxxH-127
JR sign8
xxxxH+128
0000H
FFFFH
xxxxH-1
xxxxH
xxxxH-32767
LDB %EXT,imm8
JR sign8
xxxxH+32768
0000H
FFFFH
xxxxH JR %A
xxxxH+16
A=0
→
xxxxH+1
:
A=15
→
xxxxH+16
0000H
FFFFH
xxxxH JR %BA
xxxxH+256
BA=0
→
xxxxH+1
:
BA=255
→
xxxxH+256
0000H
FFFFH
JP %Y
Y
→
Branch destination
absolute address
0000H
FFFFH
xxxxH JR [addr6]
xxxxH+16
[addr6]=0
→
xxxxH+1
:
[addr6]=15
→
xxxxH+16
Indirect jump instruction
0000H
FFFFH
003FH
addr6
Program memory
Program memory
Program memory
Program memory
Data memory
Program memory
∗
∗
∗
In the extended addressing mode,
this instruction can branch the
entire 64K program memory.
Fig. 2.2.3.1 Operation of jump instructions
• Absolute call instruction (CALZ)
The absolute call instruction "CALZ imm8" calls a subroutine within addresses 0000H to 00FFH. A
subroutine start address (absolute address) should be specified to imm8. When the call instruction is
executed, the PC value (address of the next instruction) is saved into the stack for return, then it
branches to the specified address.
Generally common subroutines that are called from two or more modules are placed in this area when
the program is developed as multiple modules.
Example:
CALZ 0x50
...Calls the subroutine located at the address 0050H
See Section 2.3.3, "Stack and stack pointer" for stack.
• PC relative call instructions (CALR)
The PC relative call instruction adds the relative address specified in the operand to the PC that has
indicated the next address, and calls a subroutine started from that address. It permits relocatable
programming.
The relative address to be specified in the operand is same as the PC related jump instruction.
The PC value (address of the next instruction) is saved into the stack before branching.
(1) Instructions with a signed 8-bit immediate data sign8 that specifies a relative address
CALR sign8
This instruction branches the program sequence with the sign8 specified in the operand as a
signed 8-bit relative address. The range that can be branched is from the next instruction address -
128 to +127. A value within the range from -128 to +127 should be used if specifying a value for
calling in the assembler. Generally branch destination labels such as "CALR LABEL" are used, and
they are expanded into the actual address by the assembler.