How to calculate bit-by-bit ?

Quote:

> Hi all,

> Do you know how to handle bit-by-bit calculation in assembly ?

> i.e.

> NUM1 DW 11111111111111111111111b

> NUM2 DW 00000100101010101010101b

> adding NUM1 and NUM2 what can I do ?

That depends mostly on what you're trying to do!

a) Result = NUM1 + NUM2

mov ax,[num1]

add ax,[num2]

b) Result = Binary (bit-by-bit) addition

mov ax,[num1]

xor ax,[num2]

At this point AX has 1 bits where either NUM1 or NUM2 (but not both) has

a 1 bit.

Terje

--

Using self-discipline, see http://www.eiffel.com/discipline

"almost all programming can be viewed as an exercise in caching"