Re: A82: Copying HL -> DE skipping bytes


[Prev][Next][Index][Thread]

Re: A82: Copying HL -> DE skipping bytes




Firstly, I'm pretty sure what you actually want to do is copy a bunch of
memory pointed to by hl to the address stored in de, not store h in d as
your statement implies. Secondly, if you're trying to do something like
this:
hl-> 1,2,3,4,5
de-> 1,x,2,x,3,x,4,x,5
then your code (both versions, since they do the same thing... the second
is better, though can be further optimized, slightly) works fine.

Jeremy Wazny

On Mon, 18 Jan 1999, Evil Sam wrote:

> 
>   I want to copy HL to DE skipping every other byte of DE. I tried 
> something like this:
>  ld hl,TEXT_MEM
>  ld de,APD_BUF
>  ld a,44
> loop:
>  ld bc,1
>  ldir
>  inc de
>  dec a
>  jr nz,loop
>  
>   That didn't work. So I tried something like this:
>  ld hl,TEXT_MEM
>  ld de,APD_BUF
>  ld b,44
> loop:
>  ld a,(hl)
>  ld (de),a
>  inc hl
>  inc de
>  inc de
>  djnz loop
> 
>   Also didn't work. What am I doing wrong?
> 
> ______________________________________________________
> Get Your Private, Free Email at http://www.hotmail.com
> 



References: