Multiplication of Two 8 Bit Number

Sunny Bhaskar

11/6/20241 min read

Algorithm
  1. Load the first number (04H) into register B.

  2. Load the second number (02H) into register C (to use as a count).

  3. Initialize the accumulator with 00H to store the result.

  4. Perform the following in a loop until the count in C becomes zero:

    • Add the value in B to the accumulator.

    • Decrement C by 1.

  5. Store the result in a specified memory location (e.g., 2052H).

  6. Halt the program.

Program

MVI B, 04H ; Load 04H into register B (first number)

MVI C, 02H ; Load 02H into register C (second number, used as a count)

MVI A, 00H ; Clear accumulator A to store the result (initialize to 0)

MULT_LOOP:

ADD B ; Add B to A

DCR C ; Decrement C (counter)

JNZ MULT_LOOP ; Repeat if C is not zero

STA 2052H ; Store the result (08H) at memory location 2052H

HLT ; Halt the program

Address

Prayagraj Phaphamau

Contacts

7518998334
sunnygamingyt298@gmail.com

Subscribe to our newsletter