Saturday, April 30, 2016

8051 Program – memory compare


; memory compare
; find out how many equal bytes between
; two memory blocks 10h to 20h and 20h to 30h
ORG 0H
MOV R0, #10H ; mem1 start address
MOV R1, #20H ; mem2 start address
MOV R2, #0AH ; no of locations to compare
MOV R7, #00H ; no of locations with same content
NEXT: MOV A, @R0
MOV B, A
MOV A, @R1
CJNE A, B, NOMATCH
INC R7
NOMATCH:INC R0
INC R1
DJNZ R2, NEXT
END



Related topics:
8051 Program - move block of data without overlap   |   8051 Program - move block of data with overlap   |   8051 Program - move block of data external memory   |   8051 Program - exchange content of two ram locations   |   8051 Program - exchange block of data external memory   |   8051 Program - swap nibbles   |   8051 Program - memory subroutines   |   8051 Program - math subroutines   |   8051 Program - conversion subroutines

List of topics: 8051

No comments:

Post a Comment