loops - test if hexadecimal number is in range of 16 bits register -


addint:         clc         mov ax, cx         add ax, bx             jnc convert 

how able test if sum in range of 16 bits, since if add using 16 bits register result not show carry on value if sum greater 16 bits, of not work either since never become overflow due use of 16 bits registers. how should continue code make jump convert loop. example if have ffff + fffe, sum 1fffd, eax register show fffd, without carry on 1 thank in advance helping

you should able tell after add instruction if resultant value larger 16-bits.

the add instruction performs integer addition. evaluates result both signed , unsigned integer operands , sets of , cf flags indicate carry (overflow) in signed or unsigned result, respectively. sf flag indicates sign of signed result.

since appear dealing unsigned 16-bit values, should @ cf, carry flag after addition:

addint:     clc     mov ax, cx     add ax, bx                ; sets cf if result larger 16-bits     jc .larger_than_16_bits 

Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -