Saturday, April 30, 2016

8051 Program – rom to ram

; copy data from rom to ram
ORG 0H
ROM_ADDR EQU 300H
RAM_ADDR EQU 40H
BYTE_COUNT EQU 10
MAIN :
MOV DPTR,#ROM_ADDR
MOV R0, #RAM_ADDR
MOV R1, #BYTE_COUNT
LCALL COPY
SJMP MAIN
COPY:
MOV R2, #0 ;clear counter
MOV A, #0
loop: MOVC A, @A+DPTR
MOV @R0, A
INC R0
INC R2
MOV A, R2
DJNZ R1,loop
RET
ORG 300H
DB 01H,02H,03H,04H,05H,06H,07H,08H,09H,0AH
END



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

List of topics: 8051

No comments:

Post a Comment