# Vault 7: Projects

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

### Protego

# PIC24FJ64GA004 - Programmers Reference Manual

- 1
- 2
…
- 69
- 70
- 71
- 72
- 73
…
- 501
- 502

© 2005-2011 Microchip Technology Inc. DS70157F-page 71
Section 4. Instruction Set Details
Instruction Set
Details
4
4.7.1.1 STACK POINTER EXAMPLE
Figure 4-5 through Figure 4-8 show how the software stack is modified for the code snippet
shown in Example 4-13. Figure 4-5 shows the software stack before the first PUSH has executed.
Note that the SP has the initialized value of 0x0800. Furthermore, the example loads 0x5A5A
and 0x3636 to W0 and W1, respectively. The stack is PUSHed for the first time in
Figure 4-6 and
the value contained in W0 is copied to TOS. W15 is automatically updated to point to the next
available stack location, and the new TOS is 0x0802. In Figure 4-7, the contents of W1 are
PUSHed onto the stack, and the new TOS becomes 0x0804. In Figure 4-8, the stack is POPped,
which copies the last PUSHed value (W1) to W3. The SP is decremented during the POP
operation, and at the end of the example, the final TOS is 0x0802.
Example 4-13: Stack Pointer Usage
Figure 4-5: Stack Pointer Before The First PUSH
Figure 4-6: Stack Pointer After “PUSH W0” Instruction
MOV #0x5A5A, W0 ; Load W0 with 0x5A5A
MOV #0x3636, W1 ; Load W1 with 0x3636
PUSH W0 ; Push W0 to TOS (see Figure 4-5)
PUSH W1 ; Push W1 to TOS (see Figure 4-7)
POP W3 ; Pop TOS to W3 (see Figure 4-8)
0x0000
0xFFFE
0x0800
W15 (SP)
W15 = 0x0800
W0 = 0x5A5A
W1 = 0x3636
<TOS>
0x0000
0xFFFE
0x0800
W15 (SP)
W15 = 0x0802
W0 = 0x5A5A
W1 = 0x3636
5A5A
<TOS>
0x0802

- 1
- 2
…
- 69
- 70
- 71
- 72
- 73
…
- 501
- 502