{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

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

Info icon This 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
Image of page 1

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

View Full Document Right 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?
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 useful for bypassing a loop if CX = 0 6
Image of page 3

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

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

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern