Hello,
I've been asked to create a simple loop in assembly language but I am having trouble as the loop doesn't end when it should, it continues in an infinite loop.
I need to give the ECX a variable which is taken by input, but in my code below even when I specify the counter directly is still falls into an infinite loop.
My code is here (UPDATED):
The code may contain errors other than the actual loop.
//Edited for explanation of the programs requirements...
The program needs to take an input "n" which will be used as the counter for the loop. I then take input "n" more numbers, when a number is positive I need to add that to the variable postot, when negative I need to add that to the variable negatot. After "n" numbers have been entered I print the results for each variable and the program exits.
Edit 2:
Fixed the loop problem by clearing the Stack correctly so I added:
add esp,8
and:
next: push ecx
...
pop ecx
loop next
Which fixed the loop problem.