Saturday 15 August 2015

assembly - Conditional Jump (jg) after comparison (cmp) -



assembly - Conditional Jump (jg) after comparison (cmp) -

here snippet of code book provided. question asks whether execution bx,1 or ax,10 executed. looking @ code want ax,10 executed, reply online says bx,1 executed, , emulator says both executed. help me understand going on here?

mov cx,5 not cx mov dx,10 cmp cx,dx jg jump1 mov bx,1 jump1: mov ax,10

let's trace. before cmp line value of cx -6 (the result of not on 5). jg command performs signed comparing - doesn't treat negative numbers big positive ones (ja , jb do).

so cx (-6) not greater dx (10), , conditional jump not taken. both lines execute.

assembly

No comments:

Post a Comment