1 / 10

Assembly Language Programming

Assembly Language Programming. CMP. Subtracts the source (src) from destination (dest) Does not change contents of src or dest. Affects AF,CF,OF,PF,SF and ZF. The relation is of destination to source. Conditional Jumps. jz ;jump if zero [ZF=1] Jnz ;jump if not zero [ZF=0] Example

johnda
Télécharger la présentation

Assembly Language Programming

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Assembly Language Programming

  2. CMP • Subtracts the source (src) from destination (dest) • Does not change contents of src or dest. • Affects AF,CF,OF,PF,SF and ZF. • The relation is of destination to source.

  3. Conditional Jumps • jz ;jump if zero [ZF=1] • Jnz ;jump if not zero [ZF=0] Example cmp ax, bx jz label1

  4. Conditional Jumps • je ;jump if equal [same as jz] • Jne ;jump if not equal [same as jnz]

  5. Conditional Jumps • jc ;jump if carry [CF=1] • Jnc ;jump if not carry [CF=0] Example add ax, bx jc label1 sub ax, bx jnc label1

  6. Conditional Jumps • ja ;jump if above [ZF = 0 and CF=0] • jb ;jump if below [CF=1] unsigned integers • jl ;jump if less [SF <> OF=0] • jg ;jump if greater [ZF = 0 and SF=OF] signed integers

  7. Conditional Jumps • jae ;jump if above or equal • jbe ;jump if below or equal • jge ;jump if greater or equal • jle ;jump if less or equal • jno ;Jump if not overflow • jns ; Jump if not sign

  8. Renamed Conditional Jumps JNBE  JA JNB  JAE JNAE  JB JNA  JBE JZ  JE JNLE  JG JNL  JGE JNGE  JL JNG  JLE JNZ  JNE JPO  JNP JPE  JP

  9. Conditional Jumps • jcxz ;jump if the cx register is zero [cx=0]

  10. UNCONDITIONAL JUMP • We introduce a new instruction called JMP. It is the unconditional jump that executes regardless of the state of all flags. • So we write an unconditional jump as the very first instruction of our program and jump to the next instruction that follows our data declarations.

More Related