Detailed explanation of Jump and loop commands

Source: Internet
Author: User

Jump command 

The jxx command does not affect the flag, but uses the flag (the following table ). Depending on the flag used, 17 commands are divided into four situations:

 
(1) identify the status of a single flag
(2) Comparison of unsigned numbers
(3) Compare the signed quantity size
(4) determine that the counter CX is 0

A greater (less) must combine the of and SF signs and use the ZF sign to determine equal)
The two numbers are divided into four relationships:
(1) less than (not greater than or equal to): JL (jnge)
(2) Not less than (greater than or equal to): JNL (jge)
(3) less than or equal to (not greater than): jle (jng)
(4) Not less than or equal to (greater than): jnle (JG)

CMP ax, BX; compare ax and BX
JNL next; if Ax is ≥bx, transfer
Xchg ax, BX; If AX <BX, switch
Next :...

Jcxz label
; Cx = 0, transfer: IP subnet IP + 8-bit displacement
; Cx = 0, sequential execution
This is a special command.
CX registers are usually used as counters in programs.
The jcxz command is used to determine whether the count is 0.

Cyclic commands

Loop (CX! = 0)
Loopz/loope (ZF = 1 & CX! = 0)
Loopnz/loopne (ZF = 0 & CX! = 0)

The usage of the loop is as follows:
1. Cx = cx-1
2. Test conditions

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.