Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

(5 points) Write a subroutine named ShiftMultiplication that multiplies any unsigned 32-bit integer by EAX: Use only shifts and addition instructions Pass the integer to

image text in transcribedimage text in transcribed

(5 points) 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 allowed 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: o Submit the following: Lastname asm INCLUDE Irvine32.inc data pl 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 pl call WriteString ,ReadDec stores the first input (multiplicand in eax call ReadDec ,save eax in ebx so the next ReadDec will not overwrite it mov ebx,eax Input the multiplier mov edx,OFFSET p2 call WriteString call Read Dec ReadDec stores the second input (multiplier) in eax call Crlf

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_2

Step: 3

blur-text-image_3

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

Automating Access Databases With Macros

Authors: Fish Davis

1st Edition

1797816349, 978-1797816340

More Books

Students also viewed these Databases questions