#Microcontrollers 8051 Assembly Programs for Arithmatic Operations

 //Addition:

ORG 0000h
MOV R0, #03H     // move the value 3 to the register R0//
MOV A, #05H     // move the value 5 to accumulator A//
MOV B, R0

Add A, B         // addA value with R0  value and stores the result inA//
END

// Multiplication:

ORG 0000h
MOV R0, #03H     // move the value 3 to the register R0//
MOV A, #05H     // move the value 5 to accumulator A//

MOV B, R0
MUL AB         // Multiplied result is  stored in the Accumulator A //
END

// Subtraction:

ORG 0000h
MOV R0, #03H     // move the value 3 to register R0//
MOV A, #05H     // move the value 5 to accumulator A//
SUBB A, 03H     // Result value is stored in the Accumulator A //
END

// Division:

ORG 0000h
MOV R0, #03H     // move the value 3 to register R0//
MOV A, #15H     // move the value 5 to accumulator A//

MOV B, R0
DIV AB    // final value is stored in the Accumulator A //
END

Comments