Computer Science, asked by hemantchouhan5050, 1 year ago

Write assembly language program to multiply 16 bit number

Answers

Answered by Janmejoy
0
Hey


It seems as though you need to shift part of the multiplicand into another register after add bx, bx. This is because each time you shift bx without shifting the carry, the top bit becomes truncated. So your original code just stores the sum of carries from adding bx to ax, rather than the upper part of the multiplication solution, in dx.

Try this after the label AddToResult:

@AddToResult: add bx,bx ; add instead of shift? adc di,di ; shift part of multiplicand. or cx,cx ; fast zero check jnz @lp

I also chose di for the upper 16 bits of the multiplicand because it's already being used to add the carry to the solution.

Similar questions