Instruction Set
4-183
PUSH
PUSH
This example procedure 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 PUSH, use MOV to copy the stack segment to SS and the stack offset to SP.
You must push a component onto the stack before you can pop one from 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 a component from the stack
POP
Push the 16-bit general registers onto the stack
PUSHA
Push the Processor Status Flags register onto the stack
PUSHF
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_PIO3
ENDP
Содержание Am186 Series
Страница 1: ...Am186 and Am188 Family Instruction Set Manual February 1997...
Страница 10: ...Table of Contents x...
Страница 18: ...Programming 1 8...
Страница 40: ...Instruction Set Listing 3 14...