Re: A82: Copying HL -- DE skipping bytes


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

Re: A82: Copying HL -- DE skipping bytes




Then you want to use your code:

>   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
>  

but don't increment hl!

~Adamman

In a message dated 1/19/99 4:19:43 PM Eastern Standard Time,
evil_sam@hotmail.com writes:

> >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
>  >
>  
>  I don't know why but my code(the first one) does this:
>  
>  input:
>     hl->1,2,3,4,5,6
>  output:
>     de->1,x,1,x,1,x,1  (x=blank)
>  
>     It will copy the first byte of HL to every other byte of de.
>   Sam