EXP 1 MA PRACTICAL


ALP to Copy data from register R0 to R1
ORG 0000H                                       ;start
SJMP MAIN
ORG 0045H
MAIN:MOV R0,#12H                      ;move 12h in R0
MOV A,R0                                         ; ;move data from R0 to accumulator     
MOV R1,A                                        ;move data from accumulator to R1    
END





ALP to copy immediate data to memory location 40H,41H
ORG 0000H
SJMP MAIN
ORG 0045H
MAIN:MOV 40H,#0AH  ; move 0A to memory location 40H
MOV 41H,#1FH              ; move 1F to memory location 41H
END






ALP to copy data 80H from 5 locations starting from 50H
ORG 0000H
SJMP MAIN
ORG 0045H
MAIN:MOV R2,#05H
MOV R0,#50H
MOV A,#80H
BACK:MOV @R0,A      ; move data from location pointed by R0 to accumulator
INC R0                           ; increment data in R0 by 1
DJNZ R2,BACK              ; decrement data in R2 by 1
END



ALP to copy 10 bytes data from 50H to 80H
ORG 0000H
SJMP MAIN
ORG 0045H
MAIN:MOV R2,#0AH
MOV R0,#50H
MOV R1,#80H
BACK:MOV A,@R0            ;take data from memory location given by R0 and copy to accumulator
MOV @R1,A                      ;copy data from accumulator to memory location pointed by R1
INC R0
INC R1
DJNZ R2,BACK                 ;decrement till R2 becomes zero
END



ALP to copy 10 bytes data from 65H to external memory location 2000H
ORG 0000H
SJMP MAIN
ORG 0045H
MAIN:MOV R2,#0AH
MOV R0,#65H
MOV DPTR,#2000H         ;save 2000H in external memory pointer DPTR
BACK:MOV A,@R0          ; take data from memory location given by R0 and copy to accumulator
MOVX @DPTR,A            ; copy data from accumulator to external memory location pointed by DPTR
INC R0
INC DPTR
DJNZ R2,BACK
END


Previous Post Next Post