tags:

views:

363

answers:

4

Hello all, I have a question about variable initialization in MASM's assembly.

How can I initialize 2^32 to a variable and to what kind of variable should I initialize? DWORD or REAL4?

I try to do it like:

val DWORD 2.0E+32

When I assign var to a register(e.g. mov eax,val) and try to write the value, I see something that is not 2^32. I also tried it with REAL4 type. Result is still same.

So What I am doing wrong here?

Thanks in advance...

A: 

Isn't this just 0xFFFFFFFF ?

Paul Betts
That's (2^32) - 1.
Michael Burr
+2  A: 

2^32 = 4294967296 = 0x100000000 (that's 8 zeroes).

2.0E+32 is 2 * 10^32 = 200000000000000000000000000000000, a completely different number. It's also a floating-point number, whereas 0x100000000 is an integer.

Artelius
+2  A: 

2^32 is one bit bigger number than what dword supports, let me throw in some ranges:

0 <= dword < 2^32
0 <= qword < 2^64
-2^31 <= sdword < 2^31
-2^63 <= sqword < 2^63

if REAL4 is a 4-byte floating point then it has a completely different structure than what integer has. If you use x86 then the format floating points are represented in is probably the IEEE 754. That supports 2^32 -number but you may run into precision problems.

Cheery
A: 

I got my fault about exponential. But I still need the information about how to initialize this value in assembly language...

israkir