
Instruction Set
4-177
POP
POP
This example procedure for the SD186EM demonstration board turns an LED on or off by
toggling the signal level of programmable I/O (PIO) pin 3 in the PIO Data 0 (PDATA0)
register.
Tips
Before you use POP, use MOV to copy the stack segment to SS and the stack offset to SP.
Before you can pop a component from the stack, you must push one onto the stack.
To copy one segment register to another, use PUSH to place the contents of the first
segment register on the stack, and then use POP to load the other segment register.
Use the stack to pass parameters from one procedure to another. In the calling procedure,
use PUSH to push the parameters onto the stack, use CALL to call another procedure, and
then use POP to pop the parameters from the stack.
Use PUSH to temporarily save the intermediate results of a multistep calculation.
Use PUSH to save the value of a register you want to temporarily use for another purpose.
Use POP to restore the saved register value when you are done.
Related Instructions
If you want to
See
Pop components from the stack into the 16-bit general registers
POPA
Pop a component from the stack into the Processor Status Flags register
POPF
Push a component onto the stack
PUSH
PIO3_MASK
EQU
0008h
; PDATA0 bit 3
; toggle PDATA0 bit 3
TOGGLE_PIO3
PROC
NEAR
; save registers
PUSH
AX
PUSH
DX
MOV
DX,PIO_DATA0_ADDR
; address of PDATA0 register
IN
AX,DX
; read PDATA0 into AX
XOR
AX,PIO3_MASK
; toggle bit 3
OUT
DX,AX
; write AX to PDATA0
; restore saved registers
POP
DX
POP
AX
RET
TOGGLE_PIO3ENDP
Summary of Contents for Am186 Series
Page 1: ...Am186 and Am188 Family Instruction Set Manual February 1997...
Page 10: ...Table of Contents x...
Page 18: ...Programming 1 8...
Page 40: ...Instruction Set Listing 3 14...