; arithmetic operation of 8bit numbers
; addition, subtraction, multiplication and division
; regsters
ORG 0H
MOV R1,#20H ;First no
MOV R2,#10H ;Second no
MOV A,R1
ADD A,R2
MOV R0,A ;ADDITIONR0=R1+R2
CLR C
MOV A,R1
SUBB A,R2
MOV R3,A ;SUBTRACTIONR3=R1-R2
MOV A,R1
MOV B,R2
MUL AB
MOV R4,A ;MULTIPLICATIONR4=R1xR2
MOV A,R1
MOV B,R2
DIV AB
MOV R5,A ;DivisionR5=R1/R2
SJMP $
END
Related topics:
8051 Program - addition 8bit | 8051 Program - subtraction 8bit | 8051 Program - multiplication 8bit | 8051 Program - division 8bit | 8051 Program - addition 16bit | 8051 Program - subtraction 16bit | 8051 Program - multiplication 16bit | 8051 Program - division 16bit | 8051 Program - addition multibyte | 8051 Program - multiplication 16bit by 8bit | 8051 Program - addition 8bit 2digit bcd | 8051 Program - memory subroutines | 8051 Program - math subroutines | 8051 Program - conversion subroutines
List of topics: 8051
No comments:
Post a Comment