Here's the program:
The C++ part:
extern "C" void doit();
And the assembly part:
.model flat, c
myNumbers dword 7,3,8,2,2,9,8,5,7,4,8,3,8,1,8,7,4,8
So get all that typed in and I'll explain how it works.
This is how it works,just like the program from the last post we xor eax by eax,and ecx by ecx,and also we move myNumbers into ebx,except we only do that once because of the again. Then as always we add 4 to eax so that we can access the next number of myNumbers,except not because we want to place the next number of myNumbers in ebx,we want to place it in ecx,and here's why.
We take the next number of myNumbers and compare it to the number currently in ebx and if it is smaller than the number currently in ebx then we jump to switcheroo. In switcheroo we move the number currently in ecx into ebx so that we always have the smallest number we've seen so far in ebx. Then we jump to back compare eax to 68 and if it is less than or equal to 68 we jump back to again.
WELL TTFN TA TA FOR NOW!!!!
Post a Comment