Counters
When programming a loop that is to be cycled a specified number of times, the most direct
way of accomplishing this is to use one register as a counter, which initially has an index
stored in it. This index is reduced by 1 each time the loop is cycled. When the count reaches 0
we may exit the loop. Two examples are shown below:
Counter to nit on the kth cycle
Assume k is initially in register C
Counter to exit on the (k + 1)th cycle
Assume k is initially in register C
- 50 -