PIC18FXX20
POP
Pop Top of Return Stack
PUSH
Push Top of Return Stack
Syntax:
[ label ] POP
None
(TOS) → bit bucket
None
Syntax:
[ label ] PUSH
None
(PC+2) → TOS
None
Operands:
Operation:
Status Affected:
Encoding:
Operands:
Operation:
Status Affected:
Encoding:
0000
0000
0000
0110
0000
0000
0000
0101
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.
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 implement-
ing a software stack by modifying
TOS, and then pushing it onto the
return stack.
Words:
Cycles:
1
1
Words:
Cycles:
1
1
Q Cycle Activity:
Q1
Q2
PUSH PC+2
onto return
stack
Q3
Q4
Q Cycle Activity:
Q1
Decode
No
No
Q2
Q3
Q4
operation
operation
Decode
No
POP TOS
No
operation
value
operation
PUSH
Example:
POP
Example:
Before Instruction
GOTO
NEW
TOS
PC
=
=
00345Ah
000124h
Before Instruction
TOS
Stack (1 level down)
=
=
0031A2h
After Instruction
014332h
PC
=
=
=
000126h
000126h
00345Ah
TOS
After Instruction
Stack (1 level down)
TOS
PC
=
=
014332h
NEW
DS39609A-page 288
Advance Information
2003 Microchip Technology Inc.