Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a subroutine named Shift Multiplication that multiplies any unsigned 32-bit integer by EAX: - Use only shifts and addition instructions. - Pass the integer

image text in transcribed

Write a subroutine named Shift Multiplication 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 pro duct 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 all owed 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 Irvine32.inc .data p1 BYTE "Enter the multiplicand: ", 0 p2 BYTE "Enter the multiplier: ", 0 p3 BYTE "The product is ", 0 .code mainPROC callClrscr; Input the multiplicand mov edc, 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;Re adD ec store s the second input (multiplier) in e ax callCrlf; multiply EBX by EAX, producing EAX call Multiply; Display the product in EAX mov edc, OFFSET p3 call WriteString call WriteDec callCrlf exit main ENDP Write a subroutine named Shift Multiplication 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 pro duct 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 all owed 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 Irvine32.inc .data p1 BYTE "Enter the multiplicand: ", 0 p2 BYTE "Enter the multiplier: ", 0 p3 BYTE "The product is ", 0 .code mainPROC callClrscr; Input the multiplicand mov edc, 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;Re adD ec store s the second input (multiplier) in e ax callCrlf; multiply EBX by EAX, producing EAX call Multiply; Display the product in EAX mov edc, OFFSET p3 call WriteString call WriteDec callCrlf 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: 3

blur-text-image

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

Contemporary Issues In Database Design And Information Systems Development

Authors: Keng Siau

1st Edition

1599042894, 978-1599042893

More Books

Students also viewed these Databases questions