Multiply two 8-bit numbers


Multiply two 8-bit numbers

Statement: Multiply two 8-bit numbers stored in memory locations 2200H and 2201H by repetitive addition and store the result in memory locations 2300H and 2301H.
Sample problem 1:
(2200H) = 03H
(2201H) = B2H
Result = B2H + B2H + B2H = 216H
               = 216H
(2300H) = 16H
(2301H) = 02H
Source program :
  • LDA 2200H
  • MOV E, A
  • MVI D, 00 : Get the first number in DE register pair
  • LDA 2201H
  • MOV C, A : Initialize counter
  • LX I H, 0000 H : Result = 0
  • BACK: DAD D : Result = result + first number
  • DCR C : Decrement count
  • JNZ BACK : If count   0 repeat
  • SHLD 2300H : Store result
  • HLT : Terminate program execution

Post a Comment

0 Comments

Close Menu