Question: IN ASSEMBLY LANGUAGE Write a procedure that performs SHLD by shifting an array of doublewords to the left by n bits ( passing the number

IN ASSEMBLY LANGUAGE Write a procedure that performs SHLD by shifting an array of doublewords to the left by n bits (passing the number of bits in the BLregister) by using the next element as the source operand. (The last element will use SHL instead of SHLD). The driver program will use the following doublewords array to test the procedure by get the user's input to shift n-bit in the array element. Print out the elements of the array after shifting by calling the DumpMem procedure: array DWORD 4BC94530h,2CBA9429h,4FB54386h,69FC0544h,5F5BE7ACh.
Output will look like this:
Enter the number of bits to shift the array to the left using SHLD: 8
Dump of offset 005A6000
-------------------------------
C945302C BA94294F B5438669 FC05445F 5BE7AC00
This is what I did so far but it does not seem to be correct:
INCLUDE Irvine32.inc
.data
array DWORD 4BC94530h,2CBA9429h,4FB54386h,69FC0544h,5F5BE7ACh
prompt db "Enter the number of bits to shift the array to the left using SHLD: ",0
.code
main PROC
mov edx, OFFSET prompt
call WriteString
call ReadDec
mov bl, al
lea esi, [array]
mov ecx, LENGTHOF array
call SHLDArrayLeft
mov esi, OFFSET array
mov ecx, LENGTHOF array
mov ebx, TYPE array
call DumpMem
exit
main ENDP
SHLDArrayLeft PROC
pushad
mov ecx, LENGTHOF array
dec ecx
mov esi, OFFSET array
.while ecx >1
mov edx, [esi + TYPE array]
shld DWORD PTR [esi], edx, cl
add esi, TYPE array
dec ecx
.endw
shl DWORD PTR [esi], cl
popad
ret
SHLDArrayLeft ENDP
END main
If you can help me finishing this, I will upvote. Thanks!

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!