The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: mrburkett on July 14, 2005, 06:01:10 PM

Title: cvttsd2si
Post by: mrburkett on July 14, 2005, 06:01:10 PM
What is wrong with this code?

code:

.686
.xmm
.data

Record_Save Struct
     epoch_m   dq   0
Record_Save EndS

.code

cvttsd2si  eax,Record_Save.epoch_m

I am using ml V7.10.2179

Thanks,
Jim
Title: Re: cvttsd2si
Post by: mrburkett on July 14, 2005, 07:58:49 PM
I put this in a test file by itself and I get the same results.  What I do not understand is, according to Intel's Manuels, cvttsd2si is defined as:

cvttsd2si r32, xmm/m64

The member of the structure is 64 bits going into a 32-bit register.
I get this error: invalid instruction operands

Where am I going wrong?

Jim


Code:

.686
.model flat, stdcall
Option Casemap:NONE
.xmm
.data
Record_Save STRUCT
epoch_m dq 0
Record_Save EndS

.code
Start:
cvttsd2si eax, Record_Save.epoch_m

End Start


Jim, I just added the code tags so it was easier to read.
Title: Re: cvttsd2si
Post by: hutch-- on July 15, 2005, 01:06:41 AM
Jim,

The format of the value loaded in the structure QWORD may be incorrect. I would try it with a floating point format number loaded at the memory location.
Title: Re: cvttsd2si
Post by: mrburkett on July 15, 2005, 02:48:48 AM
Yes, that led me to see that I was not initializing the Floating Point variables correctly.

Now, the cvttsd2si STILLl did not like the structure member.  It worked perfectly from a normal real8 variable.

This leads me to believe that I should stay away from structures as I will be doing extensive work with real8 variables.  The sturcture just makes it easier to be organized.

Thanks, Hutch,
Jim
Title: Re: cvttsd2si
Post by: mrburkett on July 15, 2005, 03:12:35 AM
Problem solved with structure members using cvttsd2si or possibly other xmm directives as well.

In my code:

cvttsd2si    eax,Record_Save.epoch_m

Correct this to read:

cvttsd2si   eax,cs:Record_Save.epoch_m


and it assembles without error.   :clap: :clap: :clap:  as with the math processor.

Jim