Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > C# and C > C++ and Visual C++ > C++ Programming
Password Reminder
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
C++ Programming General discussions for the C++ language. For questions specific to Microsoft's Visual C++ variant, see the Visual C++ forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C++ Programming section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old January 24th, 2007, 10:58 AM
Registered User
Join Date: Jan 2007
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default inline assembly on VS2005 c++ PROBLEM


I am just beginning my adventure with inline assembler and I encountered a problem. I tried to find some solution through google, but after a long time with no success I decided to write here. My problem is as follows: I am writing an application to blur images with box-blur; I have to load a bitmap and do some operation with it. I thought I would use SSE2 as it would speed-up my progam. I have two structs
__declspec(align(0x4)) struct ARGB{
//__m128 m;
char r;
char g;
char b;
char a;

__declspec(align(0x10)) struct pixel4{
ARGB p[4];
and I store the data in an array:
input = (pixel4*) _aligned_malloc(sizeof(pixel4)*length, 0x10);
Now I would like to load the first 128 bits ( in C++ input[0] ) into an xmm register:

MOV esi, input;

but it won't work. I get an access violation error at line MOVAPS... .

I did watch the esi register in debug mode. Its value is 44 (0x0000002c)
and I get this error msg:

Unhandled exception at 0x0043deec in testBMP.exe: 0xC0000005: Access violation reading location 0xffffffff.

Shouldn't it be access violation at 0x0000002c ? (Maybe I'm wrong, but I'm no expert - just a beginner, so excuse me :) )

Another thing I noticed is that the esi register contains the value 0x0000002c which is NOT dividable by 16 :/ it's also weird to me, because I used _aligned_malloc with 0x10 (16) to allocate 'input'; so after
MOV esi, input
esi should store the address to input which should be divisible by 16 (should have a zero at the end of its address in hex) and it it not :(

I also tried the following code:

MOV esi, [input];

and I tried MOVUPS the same way as well - it still wouldn't work.
What did compile was:
MOV esi, [input];
MOVAPS xmm0, esi;
but I don't think it gives the result I want to get...

If anyone could help I would be grateful!

Kind Regards,

Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
VS2003 to VS2005 conversion problem mrleokarthik1 Visual Studio 2005 2 August 25th, 2010 07:58 AM
VS2005 Team Edition Problem - Text does not appear asmodeos Visual Studio 2005 0 August 19th, 2007 02:51 PM
problem in assembly salnavddin BOOK: ASP.NET Website Programming Problem-Design-Solution 0 July 8th, 2007 05:27 AM
problem in installing vs2005 prashant_telkar General .NET 0 June 19th, 2007 04:02 AM
Problem with Inline Excel Output Filename Sir Guso ASP.NET 1.0 and 1.1 Professional 2 May 31st, 2007 08:26 PM

All times are GMT -4. The time now is 04:35 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.