<45>
© 2000 Scenix Semiconductor, Inc. All rights reserved.
43
SX Users Manual Rev. 3.1
www.scenix.com
Chapter 2 Architecture
2.6.4
Call
The CALL addr8 instruction calls a subroutine. It works just like a JMP addr9 instruction, with
the following differences:
The call instruction saves the full program counter value, incremented by one, on the program
stack. This allows the program to later return from the subroutine and continue execution with
the instruction immediately following the call.
The call instruction only specifies the lower eight bits (rather than the lower nine bits) of the
jump address. The ninth bit (bit 8) of the jump address is always 0. Therefore, the subroutine must
start in the bottom half of a 512-word page in the program memory (000h to 0FFh, 200h to 2FFh,
etc.).
Figures 2-3 and 2-4 show how the program counter is loaded for a jmp instruction and for call
instruction, respectively. In either case, the PA2:PA0 bits must contain the desired 512-word page of
the program memory before the jmp or call instruction is executed. These bits can be easily
changed with the page instruction.
Figure 2-3 Program Counter Loading for Jump Instruction
Figure 2-4 Program Counter Loading for Call Instruction
PA2
PA1
PA0
TO
PD
Z
DC
C
STATUS REGISTER
9-BIT VALUE IN
JMP INSTRUCTION
PROGRAM COUNTER
PC (7:0)
BITS 11:8 OF
PROGRAM COUNTER
PA2
PA1
PA0
TO
PD
Z
DC
C
STATUS REGISTER
8-BIT VALUE IN
CALL INSTRUCTION
PROGRAM COUNTER
PC (7:0)
BITS 11:8 OF
PROGRAM COUNTER
ZERO