Difference between revisions of "Z80 Routines:Memory:ldHLind"

From WikiTI
Jump to: navigation, search
m (Z80 Routines:Other:ldhlind moved to Z80 Routines:Memory:ldhlind: it is a memory routine)
m
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
[[Category:Z80 Routines:Memory|ldhlind]]
+
[[Category:Z80 Routines:Memory|LdHLind]][[Category:Z80 Routines|LdHLind]]
[[Category:Z80 Routines|ldhlind]]
+
  
 
This a substitute to the useful bcall(_ldHLind).
 
This a substitute to the useful bcall(_ldHLind).
Line 8: Line 7:
 
;ouput: hl = (hl)
 
;ouput: hl = (hl)
 
;destroy a only
 
;destroy a only
LdHLInd:
+
ldHLind:
 
  ld a,(hl)
 
  ld a,(hl)
 
  inc hl
 
  inc hl
Line 17: Line 16:
 
;same as above but
 
;same as above but
 
;destroy de
 
;destroy de
LdHLInd2:
+
ldHLind2:
 
  ld e,(hl)
 
  ld e,(hl)
 
  inc hl
 
  inc hl
Line 25: Line 24:
  
 
== Comments ==
 
== Comments ==
Use depends on situation. The first is more general because doesn't use a important pair register de.
+
Use depends on situation. The first is more general because doesn't use an important pair register de.
 
But the second has great use when you still need hl preserved.
 
But the second has great use when you still need hl preserved.

Latest revision as of 01:28, 1 November 2009


This a substitute to the useful bcall(_ldHLind).

;input: hl = pointer to memory
;ouput: hl = (hl)
;destroy a only
ldHLind:
 ld a,(hl)
 inc hl
 ld h,(hl)
 ld l,a
 ret

;same as above but
;destroy de
ldHLind2:
 ld e,(hl)
 inc hl
 ld d,(hl)
 ex de,hl
 ret

Comments

Use depends on situation. The first is more general because doesn't use an important pair register de. But the second has great use when you still need hl preserved.