Monday, May 30, 2016

8051 Program - copy rom to xram

; Description:
; Copy Bytes From Code Memory To External Memory
;
; Entry Requirements:
; DPTR Points To Destination In External Memory
; R6/7 Points To Source In Code Memory
; R0/1 Contains The Length
;
; On Exit:
; DPTR = Points To End Of Destination + 1
; R6/7 = Points To End Of Source + 1
; R0/1 = 0
;
; Affected:
; PSW.Z, PSW.P, Acc, DPTR, R0, R1, R6, R7
;
; Stack:
; 2 Bytes, Not Including Space Used By Called Routines
;
; Comments:
; None
;
UTIL_COPYCTODL:
call UTIL_DPTRR01 ; DPTR=Len, R01=Src
call UTIL_DPTR2C ; 2's Complement
call UTIL_DPTRR01 ; DPTR=Src, R01=Len
;
loop1:call UTIL_DPTRR67 ; DPTR=Src, R67=Dest
clr a ; Clear For MOVC
movc a,@a+dptr ; Get Character
inc dptr ; Next Source Location
call UTIL_DPTRR67 ; DPTR=Dest, R67=Src
movx @dptr,a ; Store It
inc dptr ; Next Destination Location
call UTIL_DPTRR01 ; DPTR=Len, R01=Dest
inc dptr ; Increment Length
mov a,dph ; Get High
orl a,dpl ; OR In Low
call UTIL_DPTRR01 ; DPTR=Dest, R01=Len
jnz loop1 ; Repeat Until 0
ret ; Return To Caller


Source: Assorted Utilities, John C. Wren 11/23/96



Related topics:
8051 Program - copy xram to iram   |   8051 Program - copy iram to xram   |   8051 Program - copy rom to xram string   |   8051 Program - copy xram to xram   |   8051 Program - copy xram to xram string   |   8051 Program - memory subroutines   |   8051 Program - math subroutines   |   8051 Program - conversion subroutines

List of topics: 8051

No comments:

Post a Comment