Two loops

Please support our Assembly advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Feb 2007
Posts: 46
Reputation: torbecire is an unknown quantity at this point 
Solved Threads: 0
torbecire torbecire is offline Offline
Light Poster

Two loops

 
0
  #1
Feb 14th, 2008
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
Reply With Quote Quick reply to this message  
Join Date: Feb 2005
Posts: 199
Reputation: Tight_Coder_Ex is an unknown quantity at this point 
Solved Threads: 14
Tight_Coder_Ex's Avatar
Tight_Coder_Ex Tight_Coder_Ex is offline Offline
Junior Poster

Re: Two loops

 
0
  #2
Feb 14th, 2008
  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
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC