Tuesday, March 22, 2016

8051 Multiplication Unsigned 8-bit

Multiply – MUL AB

MUL AB multiplies the unsigned 8-bit integers in the Accumulator and register B. The low-order byte of the 16-bit product is left in the Accumulator, and the high-order byte in B. If the product is greater than 255 (0FFH), the overflow flag is set; otherwise it is cleared. The carry flag is always cleared.


Originally the Accumulator holds the value 80 (50H). Register B holds the value 160 (0A0H). The instruction,


will give the product 12,800 (3200H), so B is changed to 32H (00110010B) and the Accumulator is cleared. The overflow flag is set, carry is cleared.

The 8051 supports byte-by-byte multiplication only. The bytes are assumed to be unsigned data.

MUL AB ; A * B, place the 16-bit result in B and A

In byte-by-byte multiplication, one of the operands must be in register A, and the second operand must be in register B. After multiplication, the result is in the A and B registers; the lower byte is in A, and the upper byte is in B.

MOV A, #25H
MOV B, #65H
MUL AB ; B = 0EH, A= 99H
END; end of asm source file

Related topics:
8051 Addition of Unsigned Numbers   |   8051 Addition of 16-bit Numbers   |   8051 Subtraction of Unsigned Numbers   |   8051 Subtraction of 16-bit Numbers   |   8051 Division Unsigned 8-bit   |   8051 MUL Instruction

List of topics: 8051

No comments:

Post a Comment