Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Assembly Language MASM32 Can someone help me by telling me what I'm doing wrong with this code, it complies but doesn't give me the right

Assembly Language MASM32

Can someone help me by telling me what I'm doing wrong with this code, it complies but doesn't give me the right answer. It's in MASM 32bit using Irvine32; assembly language. The question instructions for this problem is located right under this sentence.

TITLE:

; Write a procedure named BitWiseMultiply that multiplies any unsigned 32-bit

;integer by EAX, using only shifting and addition. Pass the integer to the procedure in the EBX ;register, and return the product in the EAX register. Write a short test program that calls the ;procedure and displays the product.

INCLUDE Irvine32.inc

.data

str1 BYTE "Results", 0dh,0ah,0dh,0ah,0

Multi DWORD 200

MultiBy DWORD 5

Result DWORD 32 DUP (?)

ResultSize DWORD ?

.code

main PROC

call Clrscr

mov ebx, Multi

mov eax, MultiBy

call BitwiseMultiply

call Display

exit

main ENDP

BitwiseMultiply PROC uses ecx edx esi

mov ecx, 32

mov edx, eax

mov esi, 0

L1:

clc

L2:

inc esi

add eax, Result[esi]

Loop L3

ret

L3:

jc L4

shl edx,1

jmp L2

L4:

mov Result[esi], ebx

inc esi

loop L1

mov ResultSize, esi

mov eax, Result[esi]

mov ecx, ResultSize-1

BitwiseMultiply ENDP

Display PROC

mov edx, OFFSET str1

call WriteString

call WriteDec

call Crlf

call Crlf

ret

Display ENDP

END main

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

Databases Illuminated

Authors: Catherine Ricardo

2nd Edition

1449606008, 978-1449606008

More Books

Students also viewed these Databases questions

Question

How do Excel Pivot Tables handle data from non OLAP databases?

Answered: 1 week ago