Vault 7: Projects

This publication series is about specific projects related to the Vault 7 main publication.

© 2005-2011 Microchip Technology Inc. DS70157F-page 349
Section 5. Instruction Descriptions
Instruction
Descriptions
5
RCALL
Relative Call
Implemented in: PIC24F PIC24H PIC24E dsPIC30F dsPIC33F dsPIC33E
X X
Syntax: {label:} RCALL Expr
Operands: Expr may be an absolute address, label or expression.
Expr is resolved by the linker to a Slit16, where Slit16 [-32768 ... 32767].
Operation: (PC) + 2 PC
(PC<15:1>) TOS<15:1>, SFA bit TOS<0>
(W15) + 2 W15
(PC<22:16>) (TOS)
(W15) + 2 W15
0 SFA bit
(PC) + (2 * Slit16) PC
NOP Instruction Register
Status Affected: SFA
Encoding: 0000 0111 nnnn nnnn nnnn nnnn
Description: Relative subroutine call with a range of 32K program words forward or back
from the current PC. Before the call is made, the return address (PC + 2) is
PUSHed onto the stack. After the return address is stacked, the
sign-extended 17-bit value (2 * Slit16) is added to the contents of the PC
and the result is stored in the PC.
The ‘n’ bits are a signed literal that specifies the size of the relative call (in
program words) from (PC + 2).
Note: When possible, this instruction should be used instead of CALL,
since it only consumes one word of program memory.
Words: 1
Cycles: 4
Example 1:
012004 RCALL _Task1
012006 ADD W0, W1, W2
. ...
. ...
012458 _Task1: SUB W0, W2, W3
01245A ...
; Call _Task1
; _Task1 subroutine
Before
Instruction
After
Instruction
PC 01 2004 PC 01 2458
W15 0810 W15 0814
Data 0810 FFFF Data 0810 2006
Data 0812 FFFF Data 0812 0001
SR 0000 SR 0000

e-Highlighter

Click to send permalink to address bar, or right-click to copy permalink.

Un-highlight all Un-highlight selectionu Highlight selectionh