Re: A86: LDDR?


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

Re: A86: LDDR?




>Can someone explain to me exactly what LDDR does and how to use it?  I know
>it can be used to copy large blocks of memory, but how, and what type of
>thing would you use it for?
>thanx.
>pcflyer1@hotmail.com

ok this is easy:  LDDR stands for LoaD Decrement and Repeat  to use it
you            put the source (where copying from)    into HL
               put the destinatiun (where copy to)    into DE
               put the number of times to repete this into BC
               then                                        LDDR


ok this will take one byte from HL and copy it to the addreess at DE
then HL and DE are inc(remented) and BC is dec(remented)automatically and if 
BC is greater than 0 then it repeats its self getting the next byte from HL 
and putting it into DE's address.

heres an exaplme (whoops spelling!):

ld hl,the_end_of_a_picture   ;copying the pic to vid_mem
ld de,$FFFF                  ;$FFFF is end of vid_mem because you're         
                       ;ld'ing and decrementing (going                       
         ;backwards)
ld bc,1024                   ;its 1024 bytes for screen size (on             
                       ;TI-86 anyway)
lddr                         ;copy from hl to de untill bc reaches 0

ret                          ;return from this pogram

pic:
;1024 byte picture here

.end



this is just an example for using it to show a picture but it can be used 
for coping varibles to a desired location or getting program data from an 
external varible or other stuff too.

The other command similar to this is LDIR or LoaD Increment and Repete.  It 
is exactly like LDDR excep that instead of automatincally decrementing HL 
and DE it INCrements them!  (BC is still decremented though)

hehe have fun!

Ricky Cobb
arcadesdude@hotmail.com
icq# 41440378

______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com