Hello Newsgroup,
how can I store a 64 bit value in a EAX register for
686 or below x86 32bit amd pc architectures?
..8087
..386
..model flat
..code
; value = 4614253070214989087 // <-- this is it
Entry:
mov eax, <value>
fld tbyte ptr [ebx]
ret
end Entry
; EOF
thanks for helping
Jens
|
|
0
|
|
|
|
Reply
|
Jens
|
6/14/2008 4:09:01 PM |
|
"Jens Kallup" <spamtrap@crayne.org> writes:
> how can I store a 64 bit value in a EAX register for
> 686 or below x86 32bit amd pc architectures?
Hi.
You should read some documentation. EAX is a 32-bit register. you
can't use it to store a 64-bit value. Only the lower/upper part of it.
If you tell us what you want to do, maybe we can help you better :-)
--
- Filipe Cabecinhas
(defvar real-email
(apply #'concatenate 'string
'("filcab" "@" "gmail" "." "com"))
"My real email address.")
|
|
0
|
|
|
|
Reply
|
Filipe
|
6/14/2008 7:25:03 PM
|
|
On Jun 14, 9:09 am, "Jens Kallup" <spamt...@crayne.org> wrote:
> Hello Newsgroup,
>
> how can I store a 64 bit value in a EAX register for
> 686 or below x86 32bit amd pc architectures?
>
> .8087
> .386
> .model flat
> .code
>
> ; value = 4614253070214989087 // <-- this is it
>
> Entry:
> mov eax, <value>
> fld tbyte ptr [ebx]
> ret
>
> end Entry
> ; EOF
>
> thanks for helping
> Jens
There's no magic, you can't fit an arbitrary 64-bit number into 32
bits of a register. You can store the halves of a 64-bit number in 2
32-bit registers, however.
Alex
|
|
0
|
|
|
|
Reply
|
Alexei
|
6/14/2008 8:27:37 PM
|
|
"Jens Kallup" <spamtrap@crayne.org> writes:
> Hello Newsgroup,
>
> how can I store a 64 bit value in a EAX register for
> 686 or below x86 32bit amd pc architectures?
You can't. You can't fit 16-bit values in an 8-bit
register or 32-bit values in a 16-bit register, so
why did you think you could fit a 64-bit value into
a 32-bit register?
> .8087
> .386
> .model flat
> .code
>
> ; value = 4614253070214989087 // <-- this is it
>
> Entry:
> mov eax, <value>
> fld tbyte ptr [ebx]
Why do you include that in your example? Are you trying
to load a 64-bit (signed) integer value into a FP register
instead? In which case, there is an *integer load* instruction
in the FPU instruction set for that purpose.
Phil
--
Dear aunt, let's set so double the killer delete select all.
-- Microsoft voice recognition live demonstration
|
|
0
|
|
|
|
Reply
|
Phil
|
6/14/2008 8:30:47 PM
|
|
On Sat, 14 Jun 2008 18:09:01 +0200
"Jens Kallup" <spamtrap@crayne.org> wrote:
> how can I store a 64 bit value in a EAX register
It is not physically possible to store a 64 bit value in a 32 bit
register.
--
Chuck
http://www.pacificsites.com/~ccrayne/charles.html
|
|
0
|
|
|
|
Reply
|
Charles
|
6/14/2008 9:04:25 PM
|
|
Jens Kallup wrote:
> Hello Newsgroup,
>
> how can I store a 64 bit value in a EAX register for
> 686 or below x86 32bit amd pc architectures?
Shoehorn! :)
> .8087
> .386
> .model flat
> .code
>
> ; value = 4614253070214989087 // <-- this is it
>
> Entry:
> mov eax, <value>
> fld tbyte ptr [ebx]
> ret
>
> end Entry
> ; EOF
What you *can* do is store a pointer to a 64 bit number (a 32-bit
pointer, of course!) in eax. Did you mean to use both eax and ebx above?
mov eax, offset value
fld qword ptr [eax]
Maybe? (tword is 80 bits, though - maybe this isn't what you want)
Or you could...
mov eax, dword ptr value
mov edx, dword ptr value + 4
and have the 64-bit value in edx:eax.
But 64 into 32 don't go.
Best,
Frank
|
|
0
|
|
|
|
Reply
|
Frank
|
6/14/2008 11:25:45 PM
|
|
Frank Kotler <spamtrap@crayne.org> writes:
> Jens Kallup wrote:
>> Hello Newsgroup,
>>
>> how can I store a 64 bit value in a EAX register for
>> 686 or below x86 32bit amd pc architectures?
>
> Shoehorn! :)
>
>> .8087
>> .386
>> .model flat
>> .code
>>
>> ; value = 4614253070214989087 // <-- this is it
>>
>> Entry:
>> mov eax, <value>
>> fld tbyte ptr [ebx]
>> ret
>>
>> end Entry
>> ; EOF
>
> What you *can* do is store a pointer to a 64 bit number (a 32-bit
> pointer, of course!) in eax. Did you mean to use both eax and ebx
> above?
>
> mov eax, offset value
> fld qword ptr [eax]
fld or fild - depending on value.
Phil
--
Dear aunt, let's set so double the killer delete select all.
-- Microsoft voice recognition live demonstration
|
|
0
|
|
|
|
Reply
|
Phil
|
6/15/2008 12:30:17 AM
|
|
Hello to all,
Frank's posting was great:
mov eax, dword ptr value
mov edx, dword ptr value + 4
and have the 64-bit value in edx:eax.
Thanks to all!
Jens
|
|
0
|
|
|
|
Reply
|
Jens
|
6/15/2008 7:27:14 AM
|
|
Phil Carmody wrote:
> Frank Kotler <spamtrap@crayne.org> writes:
>> Jens Kallup wrote:
>>> Hello Newsgroup,
>>>
>>> how can I store a 64 bit value in a EAX register for
>>> 686 or below x86 32bit amd pc architectures?
>> Shoehorn! :)
>>
>>> .8087
>>> .386
>>> .model flat
>>> .code
>>>
>>> ; value = 4614253070214989087 // <-- this is it
>>>
>>> Entry:
>>> mov eax, <value>
>>> fld tbyte ptr [ebx]
>>> ret
>>>
>>> end Entry
>>> ; EOF
>> What you *can* do is store a pointer to a 64 bit number (a 32-bit
>> pointer, of course!) in eax. Did you mean to use both eax and ebx
>> above?
>>
>> mov eax, offset value
>> fld qword ptr [eax]
>
> fld or fild - depending on value.
Good point. "fild" is probably correct... if we're even close to the
"desired" answer.
Best,
Frank
|
|
0
|
|
|
|
Reply
|
Frank
|
6/15/2008 12:59:39 PM
|
|
Jens Kallup wrote:
> Hello Newsgroup,
>
> how can I store a 64 bit value in a EAX register for
> 686 or below x86 32bit amd pc architectures?
>
> .8087
> .386
> .model flat
> .code
>
> ; value = 4614253070214989087 // <-- this is it
>
> Entry:
> mov eax, <value>
> fld tbyte ptr [ebx]
> ret
>
> end Entry
> ; EOF
>
> thanks for helping
> Jens
>
To store:
mov eax,valuelow32
xor eax,valuehigh32
Now eax contains both the low and high 32 bit halves.
I see you have doubts. Consider:
xor eax,valuelow32
Now eax contains the high 32 bit value.
xor eax,valuehigh32
Now eax contains the low 32 bit value.
Wiley Coyote,
genius programmer
|
|
0
|
|
|
|
Reply
|
Scott
|
6/16/2008 6:33:33 PM
|
|
On Jun 17, 4:33 am, Scott Moore <spamt...@crayne.org> wrote:
> Jens Kallup wrote:
> > Hello Newsgroup,
>
> > how can I store a 64 bit value in a EAX register for
> > 686 or below x86 32bit amd pc architectures?
<SNIP>
> > thanks for helping
> > Jens
....
> To store:
>
> mov eax,valuelow32
> xor eax,valuehigh32
>
> Now eax contains both the low and high 32 bit halves.
>
> I see you have doubts. Consider:
>
> xor eax,valuelow32
>
> Now eax contains the high 32 bit value.
>
> xor eax,valuehigh32
>
> Now eax contains the low 32 bit value.
Problem is although this operation is reversible, you will need 32
bits to hold either valuelow32 or valuehigh32 somewhere else to so as
you can retrieve the whole 64 bit value which ultimately leads to the
same no of bits of information (64) required.
I am not aware of a nice quick algorithm that will compress and store
a 64 bit immediate into a 32 bit reg (that will work in a generalised
way, all the time) for this purpose.
Using 2 registers is a lot less hassle even if such an algorithm is
possible, imho.
Unless there is some point here that I'm completely missing.
( Do enlighten me if there is indeed a use for this. )
> Wiley Coyote,
> genius programmer
Ah... maybe not ;)
Robert Spykerman
|
|
0
|
|
|
|
Reply
|
Robert
|
6/17/2008 12:01:55 AM
|
|
Robert Spykerman enswered Scott Moore,
.... how to move 64 bits into eax ...
a joke is usually considered as not good if it needs explanation.
But I think Scott posted a 'good one' :)
__
wolfgang
|
|
0
|
|
|
|
Reply
|
Wolfgang
|
6/17/2008 9:25:55 AM
|
|
|
11 Replies
224 Views
(page loaded in 0.128 seconds)
Similiar Articles: how to use __cpuid intrinsic - comp.lang.asm.x86Here is the inline assembly mov eax, 0x80000000 CPUID mov value, eax. i am using ... app. on AMD64 for which I need to remove inline assembly(not supported on 64-bit ... NASM - Official Recursive Macro Support! - comp.lang.asm.x86 ...howto: MOV EAX, 64bit value> ? - comp.lang.asm.x86 If you tell us what you want to do, maybe we can help ... EBX JNE L1 MOV EAX, 0 JMP L2 L1: MOV ... operator/macro ... icc inline assembly - comp.lang.asm.x86howto: MOV EAX, 64bit value> ? - comp.lang.asm.x86 icc inline assembly - comp.lang.asm.x86... why this happens?: __asm { mov eax ... error: operand size mismatch -- __asm ... assembly for 64 bit processors - comp.lang.asm.x86Hello, could you help me starting to write assembly for 64-bit processors, using 32-bit processors, and , of course, using 32-bit software? is there... How to encode an unconditional jump in 64-bit mode? - comp.lang ...a) Use a register: mov eax,0x1122334455667788 jmp eax b) Use the stack ... ret In 64-bit mode you can only push and pop 64-bit and 16-bit values because the default ... far jump in 64-bit mode - comp.lang.asm.x86howto: MOV EAX, 64bit value> ? - comp.lang.asm.x86... value in edx:eax, and here's what I have so far ... jnc whileNotADelimiter; // Return 64-bit result ... Using MUL & SHRD instead of DIV - comp.lang.asm.x86howto: MOV EAX, 64bit value> ? - comp.lang.asm.x86 Using MUL & SHRD instead of DIV - comp.lang.asm.x86... value by 174592167 and then add the same value to EDX: mov eax ... help: gcc asm-> vc++ asm - comp.lang.asm.x86howto: MOV EAX, 64bit value> ? - comp.lang.asm.x86 help: gcc asm-> vc++ asm - comp.lang.asm.x86... anaylitics (for both Linux and Windows on 32 and 64 bit). ... 64 bit integer - comp.lang.c++.moderated----- So, if the value 9999999999999999999 cannot be represented as a long int, then the ... Stranger yet: if I'm on a machine with 64 bit longs (but 32 bit int's -- as I am, in ... 64 bit assembly m.s.bit and l.s.bit - comp.lang.asm.x86For the 64 bit instruction set, what is the most efficient way to get and clear the most significant bit and the least significant bit in an unsigned... HLA for AMD64 (X86-64)? - comp.lang.asm.x86howto: MOV EAX, 64bit value> ? - comp.lang.asm.x86 [amd64] Mutex code - comp.lang.asm.x86... edx = me */ /* Test the lock ... ) question? - comp.lang.asm.x86... save/restore fp stack register - comp.lang.asm.x86howto: MOV EAX, 64bit value> ? - comp.lang.asm.x86... to load a 64-bit (signed) integer value into a FP register ... eax lock ... have a reason to pass it over the stack ... Writing Assembly Code in x64 - comp.lang.asm.x86howto: MOV EAX, 64bit value> ? - comp.lang.asm.x86 Hello Newsgroup, how can I store a 64 bit value in a EAX register for 686 ... Writing Assembly Code in x64 - comp.lang ... x86 Instruction set - CMP - comp.lang.asm.x86I know that the Pentium chip will process comparing 32/16/8 bit immediate values ... the group: ADD/ADC/SUB/SBB/AND/OR/XOR/CMP works on all ... one can encode mov eax ... CPUID and number of cores - comp.lang.asm.x86... ebx xor ecx, ecx xor edx, edx cpuid mov edi, a mov [edi], eax mov edi ... comp.databases.mysql... comp.compilers Except for structures passed by-value and 64-bit ... Re: howto: MOV EAX, <64bit value> ? - Der Keiler CodingFrank Kotler <spamtrap@xxxxxxxxxx> writes: Jens Kallup wrote: Hello Newsgroup, how can I store a 64 bit value in a EAX register for 686 or below x86 32bit amd pc ... 64-bit atomic reads and writes on x86 | niallryan.comIf we had attempted to read the 64 bit value and as a floating point type directly ... mov eax,[esi]; mov edx,4[esi]; mov ebx,[edi]; mov ecx,4[edi]; 7/27/2012 10:11:02 AM
|