Vault 7: Projects
This publication series is about specific projects related to the Vault 7 main publication.
PIC24F Family Reference Manual
DS39703A-page 2-8 Advance Information © 2006 Microchip Technology Inc.
2.3.1 Software Stack Examples
The software stack is manipulated using the PUSH and POP instructions. The PUSH and POP
instructions are the equivalent of a MOV instruction with W15 used as the destination pointer. For
example, the contents of W0 can be pushed onto the stack by:
PUSH W0
This syntax is equivalent to:
MOV W0, [W15++]
The contents of the Top-of-Stack (TOS) can be returned to W0 by:
POP W0
This syntax is equivalent to:
MOV [--W15], W0
Figure 2-4 through Figure 2-7 show examples of how the software stack is used. Figure 2-4
shows the software stack at device initialization. W15 is initialized to 0x0800. Furthermore, this
example assumes that the values 0x5A5A and 0x3636 are written to W0 and W1, respectively.
The stack is pushed for the first time in Figure 2-5 and the value contained in W0 is copied to the
stack. W15 is automatically updated to point to the next available stack location (0x0802). In
Figure 2-6, the contents of W1 are pushed onto the stack. In Figure 2-7, the stack is popped and
the Top-of-Stack value (previously pushed from W1) is written to W3.
Figure 2-4: Stack Pointer at Device Reset
Figure 2-5: Stack Pointer After the First PUSH Instruction
Figure 2-6: Stack Pointer After the Second PUSH Instruction
0x0000
0xFFFE
0x0800
W15
W15 = 0x0800
W0 = 0x5A5A
W1 = 0x3636
0x0000
0xFFFE
0x5A5A
W15 = 0x0802
W0 = 0x5A5A
W1 = 0x3636
0x0800
PUSH W0
0x0802
W15
0x0000
0xFFFE
0x5A5A
0x3636
W15 = 0x0804
W0 = 0x5A5A
W1 = 0x3636
0x0800
PUSH W1
0x0802
0x0804
W15
Protego_Release_01_05-Related-OEM-Documentation-PIC24FJ32MC10X-Reference_Manual-Section2-CPU.pdf