ch6-loop

ch6-loop - Loop instructions EE 3750 LOOP Specialized...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
Loop instructions EE 3750 2 LOOP Specialized version of conditional jump Uses CX as counter Can jump in range -128 to +127 bytes LOOP label decrements CX by 1 transfers control to target label if CX ! 0 otherwise (CX = 0), instruction following LOOP is executed
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
3 More on LOOP MOV CX, N SHOUT: . . . DEC CX JNZ SHOUT MOV CX, N SHOUT: . . . LOOP SHOUT LOOP is equivalent to decrement then conditional jump Assembly code below at left and right are equivalent 4 More on LOOP If I want to execute a loop n times, then what value should go into CX? Suppose CX = 2, then for how many iterations does the loop execute? What happens if CX = 0 before entering the loop?
Background image of page 2
5 Related looping instructions LOOPE label (also LOOPZ label ) loop while equal (zero) transfers control if CX ! 0 and ZF set to 1 LOOPNE label (also LOOPNZ label ) loop while not equal (not zero) transfers control if CX ! 0 and ZF clear to 0 JCXZ label jump if CX = 0
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 01/25/2012 for the course EE 3750 taught by Professor Desouza during the Fall '08 term at LSU.

Page1 / 5

ch6-loop - Loop instructions EE 3750 LOOP Specialized...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online