Can you show me the screen shot of the output consoleof the following assembly code
Can you show me the screen shot of the output consoleof the following assembly code please
INCLUDE Irvine32.inc
.data
multiplicand1 DWORD 65531
multiplier1 DWORD 1029
multiplicand2 DWORD 699050
multiplier2 DWORD 5461
multiplicand3 DWORD 21
multiplier3 DWORD 178956970
.code
BitwiseMultiply PROC
xor edx, edx ; Clear edx
mov ecx, eax ; Save multiplier in ecx
mov eax, ebx ; Move multiplicand to eax
mov ebx, 0 ; Clear ebx
loop_start:
test cl, 1 ; Check if the lowest bit of the multiplier is set
jz shift_left ; If not, skip to shift_left
add ebx, eax ; Add multiplicand to product
shift_left:
shl eax, 1 ; Shift multiplicand left by 1 bit
rcl edx, 1 ; Rotate the carry flag into edx
shr cl, 1 ; Shift the multiplier right by 1 bit
jnz loop_start ; Loop until the multiplier is zero
mov eax, ebx ; Move the result back to eax
ret
BitwiseMultiply ENDP
main PROC
; Test case 1
mov ebx, multiplicand1
mov eax, multiplier1
call BitwiseMultiply
; Display the result
mov ecx, eax
call display_result
call crlf
; Test case 2
mov ebx, multiplicand2
mov eax, multiplier2
call BitwiseMultiply
; Display the result
mov ecx, eax
call display_result
call crlf
; Test case 3
mov ebx, multiplicand3
mov eax, multiplier3
call BitwiseMultiply
; Display the result
mov ecx, eax
call display_result
call crlf
exit
main ENDP
display_result PROC
; Convert the result to a string and display it
push ecx
mov ecx, 10
xor edx, edx
div ecx
push edx
test eax, eax
jz print_digit
print_next_digit:
div ecx
push edx
test eax, eax
jnz print_next_digit
print_digit:
pop edx
add dl, '0'
mov [result], dl
mov edx, OFFSET result
call WriteString
pop ecx
ret
display_result ENDP
.data
result BYTE ?
END main
Step by step
Solved in 5 steps with 5 images