Re: A82: Ldir command


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

Re: A82: Ldir command




When using LDIR, HL points to the source and DE to the destination. BC 
contains the number of bytes to copy, but you probably already knew that.

In the examples you gave, TEXT_MEM2 is copied to GRAPH_MEM-192 so 
you'll need to switch those if you want to copy GRAPH_MEM-192 to 
TEXT_MEM2

          ld       hl,GRAPH_MEM-192    
          ld       de,TEXT_MEM2      
          ld       bc,128          
          ldir                         
 
 
          ld       hl,GRAPH_MEM-64
          ld       de,TEXT_MEM+64  
          ld       bc,64           
          ldir      

Wouter

>    Suppose I want to copy 192 bytes before GRAPH_MEM to TEXT_MEM2 
> and
> TEXT_MEM. It would look something like this:
>          ld       de,GRAPH_MEM-192    
>          ld       hl,TEXT_MEM2      
>          ld       bc,128          
>          ldir                         
> 
> 
>          ld       de,GRAPH_MEM-64
>          ld       hl,TEXT_MEM+64  
>          ld       bc,64           
>          ldir      
> 
>    Is DE the location of the information needing to be copied or the place
> where the information is being copied to? In BoulderDash 82, I have it
> written as stated above. If I'm wrong and DE is the address of the place
> to which the information is being copied, then BoulderDash will cause some
> wierd effect like inability to ZOOM.
>   Sam


Wouter Demuynck
 knurft@unicall.be
Joc De Schuur Online!
 http://altern.org/bjokske
Knurft's Home
 http://come.to/knurft


References: