+ All Categories
Home > Documents > Assembly Language Programming

Assembly Language Programming

Date post: 03-Feb-2016
Category:
Upload: johnda
View: 52 times
Download: 11 times
Share this document with a friend
Description:
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 - PowerPoint PPT Presentation
10
Transcript
Page 1: Assembly  Language Programming
Page 2: Assembly  Language Programming

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.

Page 3: Assembly  Language Programming

jz ;jump if zero [ZF=1] Jnz ;jump if not zero [ZF=0]

Examplecmp ax, bx

jz label1

Page 4: Assembly  Language Programming

je ;jump if equal [same as jz]

Jne ;jump if not equal [same as jnz]

Page 5: Assembly  Language Programming

jc ;jump if carry [CF=1] Jnc ;jump if not carry [CF=0]

Exampleadd ax, bx

jc label1 sub ax, bx jnc label1

Page 6: Assembly  Language Programming

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

Page 7: Assembly  Language Programming

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

Page 8: Assembly  Language Programming

JNBE JAJNB JAEJNAE JBJNA JBEJZ JEJNLE JGJNL JGEJNGE JLJNG JLEJNZ JNEJPO JNPJPE JP

Page 9: Assembly  Language Programming

jcxz;jump if the cx register is zero [cx=0]

Page 10: Assembly  Language Programming

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.


Recommended