This web page describes how to program loops in assembly language. You won't be able to get far with programming if you are not able to create loops in your code.

There are multiple ways of creating loops. This page will describe the simplest way, which resembles a simple for loop that might be used in a higher level language.

Firstly, you need to specify how many times your code is going to loop. This is done by loading the loop count into the ECX register. Next, you start your code block with a label. This label indicates the point that your loop will return to after it has finished each iteration of the loop. Then comes the main code which you want to execute in your loop. Finally you finish your code with the LOOP instruction, giving the label name that you specified, as a parameter.

   ;Main code block goes here.
LOOP mylabel