Saturday, April 30, 2016

8051 Program – ram to ram

; copy data from one location to another
ORG 0H
SRC_ADDR EQU 40H
DEST_ADDR EQU 60H
BYTE_COUNT EQU 10
MAIN :
MOV R0,#SRC_ADDR
MOV R7,#BYTE_COUNT
MOV A, #0
memfill:MOV @R0,A
INC A
INC R0
DJNZ R7,memfill
MOV R0,#SRC_ADDR
MOV R1,#DEST_ADDR
MOV R7,#BYTE_COUNT
LCALL COPY
SJMP MAIN
COPY:
MOV A, #0
loop: MOV A, @R0
MOV @R1, A
INC R0
INC R1
DJNZ R7, loop
RET
END



Related topics:
8051 Program - clear register banks   |   8051 Program - clear bit memory   |   8051 Program - clear stack memory   |   8051 Program - rom to ram   |   8051 Program - external ram to internal ram   |   8051 Program - internal ram to external ram   |   8051 Program - memory subroutines   |   8051 Program - math subroutines   |   8051 Program - conversion subroutines

List of topics: 8051

No comments:

Post a Comment