Re: LZ: A new programming question


Re: LZ: A new programming question

Nathan Adams wrote:
> I have question about memory.  Say I have the letters a through e stored in
> memory locations $80DF through $80E3 and I want to delete the b stored in
> $80E0 and then shift the contents of the rest of the memory that I have used
> to take up the slack so it would look something like this:
> (This isn't assembly language, just a table of values)
> Before:         After:
> $80DF = a       $80DF = a
> $80E0 = b       $80E0 = c
> $80E1 = c       $80E1 = d
> $80E2 = d       $80E2 = e
> $80E3 = e       $80E3 = nothing
> Is there a short and fast way of doing this?

Yup, you should use LDIR:

 ld hl,$80E1  ; Copy from $80E1
 ld de,$80E0  ; To $80E0
 ld bc,$0003  ; 3 bytes
 ldir         ; Do the copy!
 xor a        ; Clear A for storage,
 ld (de),a    ; if you really want to put a 0 at $80E3

Jimmy Mårdell                "To tell you the truth I'm so damned tired         A life-long leave is what I require    Rules, regulations try to form us
IRC: Yarin                    But not me, I'm gonna be enormous" /CRD