Hi C0dehunter,
In the zeroth place, "//" is not a comment character in Nasm, ";" is, so this won't even assemble!
In the first place, "array of integers" would imply dwords (in 32-bit code). You've got your array declared "db". You want "dd".
In the second place, "[array + 4]" would address the second integer - the first one would be "[array + 0]" (or just "[array]", but I'd use the "+ 0" for clarity). "mov eax, [anything]" is going to move 4 bytes, so with your array declared "db", you're picking up several numbers... some of 'em past the end of the array!
Comes to 174 million and change - not even close!
If you make those changes one at a time, you'll see what I mean.
Now... you could address your array as [array + 0], [array + 4], [array + 8], etc. Not too bad for five elements, but if the array got larger, it'd be pretty tedious! I'd think of "[array + ebx]", with ebx taking the values 0, 4, 8, 12, 16. Better yet, "[array + ebx * 4]", with ebx taking values 0, 1, 2, 3, 4.
However... your assignment specifically tells you to use lodsb, stosb, etc. I'm confused! lodsb, stosb would load and store bytes - lodsd, stosd would work with dwords. Maybe your "integers" are supposed to be bytes, after all! Better ask your instructor for guidence on this issue. It matters! I think I'll ASSume "integers" means dwords, and you're supposed to use lodsd/stosd.
The assignment specifies that your function should receive a pointer to the array and its size as parameters - presumably on the stack. Do you know how to do that part? I think you mentioned that you had to do it in that "recursive" example you posted earlier. There should be examples around...
Now my first thought would be to set esi at the beginning of the array, and edi to the last element in the array - not the end of the array, but the last element(!). Then do something like...
lodsd
std
stosd
cld
; until done
But that isn't going to work! I'm going to be overwriting elements that haven't been moved yet! My bad! Although the assignment implies that the array is to be reversed "in place", I think we're going to need a temporary array! "On the stack" would be handy. In fact, if we just push the array elements on the stack, we can pop 'em off "reversed" (Last In, First Out). That's probably the way I'd do it, but it doesn't involve lodsb/lodsd, stosb/stosd, std, cld at all.
Come to think of it, I don't have the slightest idea how you're "supposed" to do this assignment, as stated. Lemme fool with it, and see if I can figure something out. You see if you can get some clarity on the assignment - are we using an array of bytes, or does "integers" mean dwords? Do you really have to use "std"?
Later,
Frank