Program to interchange two blocks of data
11. Program to interchange two blocks of data :
mov dptr,#9000h ;Load 9000h into dptr registermov r0,#04h ;Move immediate data 04 to r0
mov r1,#90h ;move immediate data 90h to r1
mov r2,#91h ;move immediate data 91h to r2
back:movx a,@dptr ;move data from external memory location to a
mov r3,a ;move data from a to r3
mov dph,r2 ;move data from r2 to dph
movx a,@dptr ;move data from external memory location to a
mov dph,r1 ;move data from r1 to dph
movx @dptr,a ;move data from external memory location to a
mov a,r3 ;move data from r3 to a
mov dph,r2 ;move data from r2 to dph
movx @dptr,a ;move data from a to external memory location
inc dptr ;increment dptr
mov dph,r1 ;move data from r1 to dph
djnz r0,back ;decrement r0, if not equal to 0, jump to label back
here:sjmp here
end