PUSH
16-Bit Load Group
Expansion:
PUSH
Usage:
push {rr}
The PUSH instruction in Z80 assembly language is used to push the contents of a register pair onto the stack. This is useful for temporarily storing data or preserving the state of registers before calling a subroutine.
| Instruction | Description | Opcode |
|---|---|---|
| PUSH AF | Push register pair AF to the stack | F5 |
| PUSH BC | Push register pair BC to the stack | C5 |
| PUSH DE | Push register pair DE to the stack | D5 |
| PUSH HL | Push register pair HL to the stack | E5 |
| PUSH IX | Push register pair IX to the stack | DDE5 |
| PUSH IY | Push register pair IY to the stack | FDE5 |
Example
; Example
ld bc, $1234 ; load the value $1234 into register pair BC
ld de, $5678 ; load the value $5678 into register pair DE
push bc ; push the contents of BC onto the stack
push de ; push the contents of DE onto the stack
; at this point, BC and DE are saved on the stack
; other operations can be performed here
pop de ; pop the contents from the stack back into DE
pop bc ; pop the contents from the stack back into BC
; now BC and DE have their original values restored