0% found this document useful (0 votes)
396 views

Looping, Counting and Indexing Looping

Looping is a programming technique that uses jump instructions to repeat tasks. There are two types of loops: continuous loops that repeat tasks indefinitely until reset, and conditional loops that check flags and repeat tasks if conditions are satisfied. Conditional loops are commonly used for counting and indexing. Counting uses a counter register that is incremented or decremented over the loop, and indexing points to memory locations using sequential numbers. An example uses these techniques to add 10 bytes of data from sequential memory locations, storing the partial sums and using a flag to indicate completion.

Uploaded by

frank ansari
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
396 views

Looping, Counting and Indexing Looping

Looping is a programming technique that uses jump instructions to repeat tasks. There are two types of loops: continuous loops that repeat tasks indefinitely until reset, and conditional loops that check flags and repeat tasks if conditions are satisfied. Conditional loops are commonly used for counting and indexing. Counting uses a counter register that is incremented or decremented over the loop, and indexing points to memory locations using sequential numbers. An example uses these techniques to add 10 bytes of data from sequential memory locations, storing the partial sums and using a flag to indicate completion.

Uploaded by

frank ansari
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

LOOPING, COUNTING AND INDEXING

LOOPING:

The programming technique used to instruct the microprocessor to repeat tasks is called
looping.
 This task is accomplished by using jump instructions.

CLASSIFICATION OF LOOPS:
1.continuous loop
2.Unconditional loop

CONTINUOUS LOOP:

repeats a task continuously.


 A continuous loop is set up by using the unconditional jump instruction
 A program with a continuous loop does not stop repeating the tasks until the system is reset.

CONDITIONAL LOOP:

A conditional loop is set up by a conditional jump instructions.


 These instructions check flags(Z,CY,P,S) and repeat the tasks if the conditions are satisfied.
 These loops include counting and indexing.

CONDITIONAL LOOP AND COUNTER:

 A counter is a typical application of the conditional loop.


 A microprocessor needs a counter,flag to accomplish the looping task.
 Counter is set up by loading an appropriate count in a register.
 Counting is performed by either increment or decrement the counter.
 Loop is set up by a conditional jump instruction.
 End of counting is indicated by a flag.

CONDITIONAL LOOP,COUNTER AND INDEXING:

 Another type of loop which includes counter and indexing .

INDEXING:

 pointing of referencing objects with sequential numbers.


 Data bytes are stored in memory locations and those data bytes are referred to by their
memory locations.

Example:

 Steps to add ten bytes of data stored in memory locations starting ata given location and
display the sum.
 The microprocessor needs

1. a counter to count 10 data bytes.


2. an index or a memory pointer to locate where data bytes are stored.
3. to transfer data from a memory location to the microprocessor(ALU)
4. to perform addition
5. registers for temporary storage of partial answers
6. a flag to indicate the completion of the stack
7. to store or output the result.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy