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

Back to Subject List

Thread Closed: Issue successfully resolved

???
09/01/04 13:19
Read: times


 
#76752 - Here you go:
Responding to: ???'s previous message
I have used the following routine a lot:

memcpy:
mov dph,r0
mov dpl,r1
movx a,@dptr ; <--- this loads byte from source
mov dph,r2
mov dpl,r3
movx @dptr,a ; <--- this sets it at the dest
inc r1
cjne r1,#0x00,r1_not_0
inc r0
r1_not_0:
inc r3
cjne r3,#0x00,r3_not_0
inc r2
r3_not_0:
djnz r4,#memcpy
ret

I shall leave it to you to figure out how to preload:
R0 with the high byte of the source string
R1 with the low byte of the source string
R2 with the high byte of the destination memory
R3 with the low byte ofthe destination memory
R4 with the number of bytes to copy

then call the memcpy routine. If you'd like, you can push onto the stack ACC and R0-R4 before you set them to call the routine. Then after you return, pop them off the stack, in reverse order. Try to at least understand what the above code does, before just blindly using it.

Hope this helps,
-KEF

List of 18 messages in thread
TopicAuthorDate
*Student Question*            01/01/70 00:00      
   RE: *Student Question*            01/01/70 00:00      
   RE: *Student Question*            01/01/70 00:00      
      Getting Started            01/01/70 00:00      
      Here is the key            01/01/70 00:00      
         RE: Here is the key            01/01/70 00:00      
            Jumping the gun            01/01/70 00:00      
               RE: Jumping the gun            01/01/70 00:00      
                  RE: Jumping the gun            01/01/70 00:00      
                     RE: Still Jumping the gun            01/01/70 00:00      
   Stop            01/01/70 00:00      
      RE: Stop ;-))))            01/01/70 00:00      
   Here you go:            01/01/70 00:00      
   Student Question II            01/01/70 00:00      
      RE: Student Question II            01/01/70 00:00      
      RE: Student Question II            01/01/70 00:00      
         RE: Student Question II            01/01/70 00:00      
   RE: *Student Question*            01/01/70 00:00      

Back to Subject List