If a have this variable:
test dd 0
and I do this on my program:
add test,xxxxx
if test goest > FFFFFFFFh it will cause an exception? or it will go to 00000000h ?
test dd 0
and I do this on my program:
add test,xxxxx
if test goest > FFFFFFFFh it will cause an exception? or it will go to 00000000h ?
if test goest > FFFFFFFFh it will cause an exception? or it will go to 00000000h ?
Assuming MASM-like syntax, I would imagine that it should wrap the value and set the carry flag.
Yeah, no exceptions here. It's just basic 2's complement arithmetic.
Starting with "test" (the name of an instruction... and a Unix utility... so not a great name for a variable) at zero, what value of "xxxx" would cause it to wrap and set the carry flag? :)
Anyway, no exception. What *will* cause an exception is dividing by zero, or attempting a "div" in which the result will not fit in the destination register. This last one is a little subtle, and often bites newbies. :)
Best,
Frank
Anyway, no exception. What *will* cause an exception is dividing by zero, or attempting a "div" in which the result will not fit in the destination register. This last one is a little subtle, and often bites newbies. :)
Best,
Frank
Starting with "test" (...) at zero, what value of "xxxx" would cause it to wrap and set the carry flag? :)
I surmise his question was hypothetical and what he meant was "what happens if I overflow a variable" ^^
Indeed, can't overflow from zero using any number of the same bitlength as the counter.