News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Jwasm constant question

Started by rags, February 26, 2012, 03:19:32 PM

Previous topic - Next topic

rags

I'm playing around with jwasm v2.07pre, Nov  2 2011 in 64 bit mode and keep getting an error.
The error I'm getting is:
mytest.asm(37) : Error A2235: Constant value too large: 6E6972747320796Dh

the offending code is:

.data
count       dq      0
.code
......
lea rax, count
mov qword ptr[rax], 06E6972747320796Dh

I can move the constant directly into the register with no problem, but when I try to mov
it into memory by reference it errors.
Am I missing something simple, or can someone using jwasm check it for me to see if its
a bug in jwasm?
God made Man, but the monkey applied the glue -DEVO

qWord

In  x64, immediate values are also limit to 32 Bit. The only exception is MOV, which allows to move 64 Bit values to registers:
mov rdx,06E6972747320796Dh
mov [rax],rdx
FPU in a trice: SmplMath
It's that simple!

rags

God made Man, but the monkey applied the glue -DEVO

MichaelW

Can't you also do it this way (works with the 32-bit versions of MASM)?

count dq 06E6972747320796Dh

eschew obfuscation

rags

Yes Michael that also works.
I was working on a compile time macro that would store different 64bit values
to a memory location by reference, depending on what values were passed to the macro.
One of the parameters was the address of the location to store the value.
I was unaware of the limitations to immediate values involved, and couldn't figure out what was causing that error,
So I was using that code I posted to try and see what was going wrong.
The line in the code that was causing me headaches was:

mymacro macro param1:req, param2:req
         ; param1 is an address of a buffer
         ; param2 is text
         ; StrIn is the converted text
         ; ??i is the character count
         ; -------------
         local StrIn, ??i
         ; do something with param2 to convert it into a 64 bit values
         mov qword ptr StrVar[(??i and -8)], StrIn      ;<----------This was the problem line
         ; do some more work
endm

Since StrIn was a 64 bit value, and the destination address was a 64 bit location, I was having a
hard time understanding why it wouldnt work, until it was pointed out by qword about the size limitations
of immediate values.
One would think that if working in the 64 bit mode, 64 bit sized immediate values would be allowed.
God made Man, but the monkey applied the glue -DEVO