I have been messing around with this code forever.. I know im missing something but I am completely lost at this point.
The code is suppose to print the array, then shift all the values to the right with SHRD, then reprint the array. Please help! Thank you!
INCLUDE Irvine32.inc
.data
intArray DWORD 20d,40d,80d,100d,200d
msgA BYTE "OLD - ",0
msgB BYTE "NEW - ",0
.code
main PROC
mov edx,OFFSET msgA ; load old array msg
mov esi,0 ; last element
call WriteString ; display old array
call display ; calls display proc - prints out array values
call shift
call display
; display proc - takes integer array and outputs the values
display PROC ; counter
mov ecx,0 ; counter
.WHILE ecx < 5
mov eax,intArray[esi] ; load first element
call WriteInt ; display element
add esi,4 ; move up one element
add ecx,1 ; inc counter
.ENDW
ret ; go back
display ENDP
; shift proc - shifts all values of elements in the array to the right
sub esi,4 ; re-align esi
shift PROC ; counter
.WHILE ecx < 10
mov eax,intArray[esi] ; load value
sub esi,4 ; move down an element
mov ebx,intArray[esi] ; load value
shrd eax,ebx,4 ; shift to the right 4 bits
.ENDW
ret ; go back
shift ENDP
call Crlf ; new line
exit
main ENDP
END main