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 nbit in the array element. Print out the elements of the array after shifting by calling the DumpMem procedure: array DWORD BChCBAhFBhFChFBEACh.
Output will look like this:
Enter the number of bits to shift the array to the left using SHLD:
Dump of offset A
CC BAF B FCF BEAC
This is what I did so far but it does not seem to be correct:
INCLUDE Irvineinc
data
array DWORD BChCBAhFBhFChFBEACh
prompt db "Enter the number of bits to shift the array to the left using SHLD:
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
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
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
