orion3184 0 Newbie Poster

Hello,

I'm new to assembly and am finding myself porting someone's MASM old code to C++ for portable smartphone architectures. There's a syntax on the memory addressing I'm having trouble interpreting. Can anyone help me understand what's going on?

It's probably an easy question for everyone familiar with the syntax, but it is a bit different from the examples I've found around the web and I want to move forward on this project. Apologies if I've missed a glaringly obvious source. I figure I know just enough about all of it to be dangerous.

In C++ is the structure declaration:

DStruct 
{
float BigArray[64];
float Var2;
int Var3;
.... many more
} TheData;

In the embedded assembly, the memory is being addressed as the following:

movaps   [RBX+6*16]TheData.BigArray, xmm3

Is this standard syntax? Everything I could find used ES: in front of it when RBX was involved.

I'm guessing that RBX is the memory location offset into the array? So is this command moving the byte at the RBX+6th position in the array? Is there a quick way to tell if the floats in the array are all aligned every 16 bytes? Are there any pitfalls or subtleties to RBX handling I should be aware of?

My experiments with this syntax in MSVC have caused the compiler to complain so I have been unable to verify. Since Intel is little endian, would this be moving upwards in the array count? Like if RBX points to array position 5, then the code above would act on position 11?

Along a similar note, with the packed SSE instructions, are any adjacent bytes in this array being moved around implicitly, or is it solely the byte referenced? I know those registers can hold 128 bits. (Does it have to be typed as a qword to gain the efficiency?)

Finally (to satisfy my curiosity), if I had an array of the structure above, how would I access members to that in MASM using this syntax? (For example, to get at TheData[12].BigArray[43]...)

Thank you for any input,

Ori

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.