Page 176 - DCAP210_INTRODUCTION__TO_MICROPROCESSORS
P. 176
Introduction to Microprocessors
Notes LIFO
The order of PUSHs and POPs must be opposite of each other in order to retrieve information
back into its original location.
PUSH B
PUSH D
...
POP D
POP B
Reversing the order of the POP instructions will result in the exchange of the contents of BC and
DE.
The top of the stack is also known as peek.
12.4 The PSW Register Pair
The 8085 recognizes one additional register pair called the PSW (Program Status Word). This
register pair is made up of the Accumulator and the Flag registers. It is possible to push the PSW
onto the stack, do whatever operations are needed, then POP it off of the stack. The result is that
the contents of the Accumulator and the status of the Flags are returned to what they were before
the operations were executed.
12.4.1 PUSH PSW (1 Byte Instruction)
• Decrement SP
• Copy the contents of register A to the memory location pointed to by SP
• Decrement SP
• Copy the contents of Flag register to the memory location pointed to by SP
12.4.2 POP PSW Register Pair
POP PSW (1 Byte Instruction)
• Copy the contents of the memory location pointed to by the SP to Flag register
• Increment SP
• Copy the contents of the memory location pointed to by the SP to register A
• Increment SP
170 LOVELY PROFESSIONAL UNIVERSITY