Datasheet

PIC18F2220/2320/4220/4320
DS39599G-page 286 © 2007 Microchip Technology Inc.
POP Pop Top of Return Stack
Syntax: [ label ] POP
Operands: None
Operation: (TOS) bit bucket
Status Affected: None
Encoding:
0000 0000 0000 0110
Description: The TOS value is pulled off the
return stack and is discarded. The
TOS value then becomes the previ-
ous value that was pushed onto the
return stack.
This instruction is provided to
enable the user to properly manage
the return stack to incorporate a
software stack.
Words: 1
Cycles: 1
Q Cycle Activity:
Q1 Q2 Q3 Q4
Decode No
operation
POP TOS
value
No
operation
Example:
POP
GOTO NEW
Before Instruction
TOS = 0x0031A2
Stack (1 level down) = 0x014332
After Instruction
TOS = 0x014332
PC = NEW
PUSH Push Top of Return Stack
Syntax: [ label ] PUSH
Operands: None
Operation: (PC + 2) TOS
Status Affected: None
Encoding:
0000 0000 0000 0101
Description: The PC + 2 is pushed onto the top
of the return stack. The previous
TOS value is pushed down on the
stack.
This instruction allows to implement
a software stack by modifying TOS,
and then push it onto the return
stack.
Words: 1
Cycles: 1
Q Cycle Activity:
Q1 Q2 Q3 Q4
Decode PUSH PC+2
onto return
stack
No
operation
No
operation
Example:
PUSH
Before Instruction
TOS = 0x00345A
PC = 0x000124
After Instruction
PC = 0x000126
TOS = 0x000126
Stack (1 level down) = 0x00345A