Load and Exchange Instructions

http://www.asm86.cwc.net/

by Ciaran McCreesh
Created: 14th November 1999
Last Modified: 14th November 1999

8 Bit Loads

Mnemonic Bytes T-States Description
ld r,r2 1 4 Copies contents of r2 to r
ld r,n 2 7 Loads r with n
ld r,(hl) 1 7 Loads r with (hl)
ld (hl),r 1 7 Loads (hl) with r
ld (hl),n 2 10 Loads (hl) with n
ld a,(bc) 1 7 Loads (bc) with a
ld a,(de) 1 7 Loads (de) with a
ld a,(nn) 3 13 Loads a with nn
ld (bc),a 1 7 Loads (bc) with a
ld (de),a 1 7 Loads (de) with a
ld (nn),a 3 17 Loads (nn) with a
ld a,i 2 9 Loads a with the value of the interrupt vector register
ld i,a 2 9 Loads the interrupt vector register with the value of a
ld a,r 2 9 Loads a with the value of the dynamic refresh register
ld r,a 2 9 Loads the dynamic refresh register with a

16 Bit Loads

Mnemonic Bytes T-States Description
ld dd,nn 3 10 Loads dd with nn
ld hl,(nn) 3 16 Loads hl with (nn)
Note: (nn + 1) -> h; (nn) -> l
ld dd,(nn) 3 16 Loads dd with (nn)
Note: (nn + 1) -> ddH; (nn) -> ddL
ld (nn),hl 3 16 Loads (nn) with hl
Note: h -> (nn + 1); l -> (nn)
ld (nn),dd 4 20 Loads (nn) with dd
Note: ddH -> (nn + 1); ddL -> (nn)
ld sp,hl 1 6 Loads the stack pointer with the value of hl

Index Register Loads

Mnemonic Bytes T-States Description
ld r,(ii + d) 3 19 Loads r with (ii + d)
ld (ii + d),r 3 19 Loads (ii + d) with r
ld (ii + d),n 4 19 Loads (ii + d) with n
ld ii,nn 4 14 Loads ii with nn
ld ii,(nn) 4 20 Loads ii with (nn)
Note: (nn + 1) -> iiH; (nn) -> iiL
ld (nn),ii 4 20 Loads (nn) with ii
Note: iiH -> (nn + 1); iiL -> (nn)
ld sp,ii 2 10 Loads the stack pointer with the value of ii

Exchange Instructions

Mnemonic Bytes T-States Description
ex de,hl 1 4 Exchanges the contents of de and hl
ex af,af' 1 4 Exchanges the accumulator and flag register with the shadow accumulator and flag register
exx 1 4 Exchanges bc, de and hl with bc', de' and hl'
ex (sp),hl 1 19 Exchanges the value on the top of the stack with the value in hl
ex (sp),ii 2 23 Exchanges the value on the top of the stack with the value in ii