i m trying to do an arithmetic series which is able to read in floating numbers. Yet i entered a problem with the looping.
Initially, i tried with inc instruction to increase my value in register cx by one b4 entering the second loop. Yet the value of cx will multiply itself with 1000, As result the loop can't run properly.
Then, i tried with another way. I declare a variable COUNTER and initiate COUNTER as 0. I move value one into the counter b4 entering the second loop.
mov eax, counter
add eax,one ; i had declare one dd 1 at .data
mov counter, eax
Yet the same problem still occur.
Finally, i tried with for loop. Tot to loop the function with nth time. Yet , the loop looped infinitely when i try to run it. I realize that the value of the counter eax will take the value of my calculation when i try to debug my code.
Below is my code with the 3rd contidion. (i only show the the loop code.)
firstly, i had prompt the user to key in the a, n, d value.
mov ecx,n ; <--- n is the nth terms of the arithmetc series
mov n, eax ; <--- i tried to debug. The value of n shown is WIERD!
;cmp cx,n ; <--- this is the code for 1st 2 condition
mov eax,a1 ; <--- display the 1st term and nth terms for next
fild a1 ; <--- calculation for the next nth terms
mov eax,a1 ; <--- debug to show the value of next term
;inc cx ; <--- 1st conditon code
mov ax,cx ; <--- after exe, the value of cx counter take the
value of a1, WIERD!
;jmp whileCalculation ; <--- the 1st 2 condition code
;loop whileCalculation ; <--- code for 3rd condition, i ; it to
avoid infinite loop
THANKS FOR ADVISE!!!!