Mnemonics

LDIR

Exchange, Block Transfer and Search Group
Expansion:
LoaD Increment Repeated
Usage:
dec {r}

To do

Example

; Example ld b, 5 ; move the value 5 to reg A loop: sla a ; shifts the value in A 1 bit to the left filling in the; lowest bit with 0 dec v ; decrement b (b--) jp nz, loop ; jump condition if A (n)on-(z)ero then jump to loop label ret ; return ret ;dd

Second

ENTRY_POINT equ $8000 ; start of the empty memory org ENTRY_POINT ; start ; ... code here ret ; return to the system end ENTRY_POINT ; end of file marker

Additional description area

  • Point 1
  • If decrementing allows the BC to go to 0 or if A equals the value at the memory location pointed to by HL (A = (HL)), the instruction is terminated2. If BC is not 0 and A ≠ (HL), the program counter is decremented by two and the instruction is repeated2.
  • Point 3

See also