Vault 7: Projects

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

16-bit MCU and DSC Programmer’s Reference Manual
DS70157F-page 268 © 2005-2011 Microchip Technology Inc.
LNK
Allocate Stack Frame
Implemented in: PIC24F PIC24H PIC24E dsPIC30F dsPIC33F dsPIC33E
X X
Syntax: {label:} LNK #lit14
Operands: lit14 [0 ... 16382]
Operation: (W14) (TOS)
(W15) + 2 W15
(W15) W14
1 SFA bit
(W15) + lit14 W15
Status Affected: SFA
Encoding:
1111 1010 00kk kkkk kkkk kkk0
Description: This instruction allocates a Stack Frame of size lit14 bytes for a
subroutine calling sequence. The Stack Frame is allocated by PUSHing
the contents of the Frame Pointer (W14) onto the stack, storing the
updated Stack Pointer (W15) to the Frame Pointer and then incrementing
the Stack Pointer by the unsigned 14-bit literal operand. This instruction
supports a maximum Stack Frame of 16382 bytes.
The ‘k’ bits specify the size of the Stack Frame.
Note: Since the Stack Pointer can only reside on a word boundary,
lit14 must be even.
Words: 1
Cycles: 1
Example 1:
LNK #0xA0 ; Allocate a stack frame of 160 bytes
Before
Instruction
After
Instruction
W14 2000 W14 2002
W15 2000 W15 20A2
Data 2000 0000 Data 2000 2000
SR 0000 SR 0000
CORCON 0000 CORCON 0004

e-Highlighter

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

Un-highlight all Un-highlight selectionu Highlight selectionh