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

From WikiTI
Jump to: navigation, search
(New page: ldhlind ldhlind This a substitute to the useful bcall(_ldHLind). <nowiki> ;input: hl = pointer to memory ;ouput: hl = (hl) ;de...)
 
m (Z80 Routines:Other:ldhlind moved to Z80 Routines:Memory:ldhlind: it is a memory routine)
(No difference)

Revision as of 12:32, 25 October 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 a important pair register de. But the second has great use when you still need hl preserved.