943,648 Members | Top Members by Rank

Ad:
  • Assembly Discussion Thread
  • Unsolved
  • Views: 2618
  • Assembly RSS
Feb 14th, 2008
0

Two loops

Expand Post »
I have a problem, and it's starts with doing two loops. I do not know how to do it. Could anyone just show me how to use 2 loops. Could you show me how to use a nested loop that will add numbers.


Title COLOR MATRIX

include Irvine32.inc

.code
main PROC

mov eax, 0
mov ecx,3

              OUTER:
                   
               inc eax
               call Writeint
                  
				  INNER:

				  inc eax
                  call Writeint
				  loop INNER
               loop OUTER;
exit
main ENDP
END main
Similar Threads
Reputation Points: 12
Solved Threads: 0
Light Poster
torbecire is offline Offline
46 posts
since Feb 2007
Feb 14th, 2008
0

Re: Two loops

asm Syntax (Toggle Plain Text)
  1. Outer: inc eax
  2. call Writeint
  3. push ecx
  4. mov ecx, 3
  5. Inner: inc eax
  6. call Writeint
  7. loop Inner
  8. pop ecx
  9. loop Outer
Your not very specific with iterators, so I assume you want to loop 3 times inner for every outer. If not, you just have to change the value of ECX before entering inner loop
Reputation Points: 47
Solved Threads: 17
Posting Whiz in Training
Tight_Coder_Ex is offline Offline
215 posts
since Feb 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Assembly Forum Timeline: Question about Proper Code
Next Thread in Assembly Forum Timeline: NAND functions





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC