Saturday, April 30, 2016

8051 Program – move block of data with overlap

; move block of data bytes
; with overlap
ORG 0H
START:
MOV R1,#10H ;starting addr of src
MOV R2,#20H ;ending addr of src
MOV R0,#15H ;starting addr of desti
CLR C
MOV A,R2
SUBB A,R1
MOV R2,A ;determination of sizeAnd stored in R2
MOV A,R1
ADD A,R2
MOV R1,A ;end addr of src
MOV A,R0
ADD A,R2
MOV R0,A ;end addr of desti
INC R2
LOOP: MOV A,@R1
MOV @R0,A ;copy data byte
DEC R1
DEC R0
DJNZ R2,LOOP
SJMP $
END



Related topics:
8051 Program - move block of data without overlap   |   8051 Program - move block of data external memory   |   8051 Program - exchange content of two ram locations   |   8051 Program - exchange block of data external memory   |   8051 Program - memory compare   |   8051 Program - swap nibbles   |   8051 Program - memory subroutines   |   8051 Program - math subroutines   |   8051 Program - conversion subroutines

List of topics: 8051

2 comments:

  1. Don't you think the code has been made complex unnecessarily. You could make it more simple, like you have taken address first, then calculated the count, then again you have calculated the address... It's simply time consuming.

    ReplyDelete