Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Need help in assembly x86. Write a subroutine named ShiftMultiplication that multiplies any unsigned 32-bit integer by EAX: Use only shifts and addition instructions. Pass

image text in transcribed
Need help in assembly x86.
Write a subroutine named ShiftMultiplication that multiplies any unsigned 32-bit integer by EAX: Use only shifts and addition instructions. Pass the integer to the subroutine in the EBX register, and return the product in the EAX register. Assume that the product is never larger than 32 bits. You are only to use a loop (do-while) to shift the multiplier to the right, keeping track of the number of shifts that occur. The resulting shift count can then be applied to the SHL instruction, using the multiplicand as the destination operand. Then, the same process must be repeated until you find the last 1 bit in the multiplier. You are not allowed to use the loop instruction and are not allowed to use the factoring method. Run your program using the debugger to verify your answers. The main program that calls the subroutine and displays the product is given to you as shown below: Submit the following: Lastname3.asm INCLUDE Irvine.32inc .data p1 BYTE "Enter the multiplicand: ", 0 p2 BYTE "Enter the multiplier: ".0 p3 BYTE "The product is ", 0 .code main PROC call Clrscr:Input the multiplicand mov edx.OFFSET p1 call WriteString call ReadDec:ReadDec stores the first input (multiplicand) in eax mov ebx, eax:save eax in ebx so the next ReadDec will not overwrite it:Input the multiplier mov edx.OFFSET p2 call Writestring call ReadDec:ReadDec stores the second input (multiplier) in eax call Crlf multiply EBX by EAX, producing EAX call Multiply:Display the product in EAX mov edx.OFFSET p3 call WriteString call WriteDec call Crlf exit main ENDP

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_step_2

Step: 3

blur-text-image_step3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Visual Basic6 Database Programming

Authors: John W. Fronckowiak, David J. Helda

1st Edition

ISBN: 0764532545, 978-0764532542

More Books

Students also viewed these Databases questions

Question

What is strategic leadership?

Answered: 1 week ago