Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
12/19/06 10:55
Read: times


 
#129729 - Indexing
Responding to: ???'s previous message

if I write to dph/dpl then the dptr moves automatically so that I don't need to then do a mov dptr, #blahblahblah?


dpl and dph ARE the dptr, so there's no moving involved. As an ASIDE, mov dptr,#1234h might equally be written as
	mov	dpl,#34h
	mov	dph,#12h

No difference.


when you do:

add a, dpl

and that operation producs a carry, the carry bit is set until you clear it or another operation clears it?


To be precise: add is one of the instructions from the instruction set which uses the carry flag to signify a (partial) result. After add the carry flag will show if a carry occurred during the add or not. The subtle difference being that add will ALWAYS touch the carry flag: it will not only set it if there was: it will also CLEAR IT IF THERE WASN'T. So if the carry bit was 1 before the add, and executing the add didn't produce a carry, after the add the carry flag will be 0. It is not like the add will leave carry flag unchanged if there wasn't a carry, as your statement might be interpreted.
After the add, the carry flag will maintain the state to which the add set it until another instruction is executed which inherently (eg. cjne, subb or clr c) or deliberately (eg. mov psw,#0: mov doesn't inherently touch the carry flag, but if you move something to psw deliberately of course it will) touches it. In the mean time you can ignore it, test it, or execute any number of intructions which don't touch the carry flag.


The addc a, dph operation (just to be sure) will add the contents of dph and the current value of the carry bit to the accumulator?


Yes.


List of 22 messages in thread
TopicAuthorDate
newbie: offsetting the dptr            01/01/70 00:00      
   additional info            01/01/70 00:00      
   do you have external data memory at all?            01/01/70 00:00      
      Exteranal or Internal RAM            01/01/70 00:00      
   In response to Jan and Neil            01/01/70 00:00      
      MOVX @DPTR,A            01/01/70 00:00      
         In response to Jon            01/01/70 00:00      
            Indexing            01/01/70 00:00      
               In response to Hans            01/01/70 00:00      
                  Indexing            01/01/70 00:00      
   In response to Hans            01/01/70 00:00      
      the reason is            01/01/70 00:00      
         In response to Russell            01/01/70 00:00      
            Be careful who you listen to!            01/01/70 00:00      
            movx a,@dptr            01/01/70 00:00      
               In response to Neil            01/01/70 00:00      
                  It Adds            01/01/70 00:00      
               ??????            01/01/70 00:00      
                  oopps no            01/01/70 00:00      
               error            01/01/70 00:00      
               error            01/01/70 00:00      
                  movx/movc            01/01/70 00:00      

Back to Subject List