Jump to content

  • Log In with Google      Sign In   
  • Create Account


DirectX, Home made Bltters, Assembly


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 Sphet   Members   -  Reputation: 631

Like
Likes
Like

Posted 24 January 2000 - 12:17 PM

Hey.. I''m trying to implement some special blts for my project and have realized that it should be done in assembly. I don''t have much experience with it, and was wondering if anyone could point me to a good tutorial on pentium-era assembly coding. I''m using Visual C++ 6.0, and have, of course, access to the inline assembly using __asm {}. I''ve done some tests with it an the blitting speed isn''t too slow, except I am having some problems. My function is like this: ERROR_Type BLT_BltTestOne(Sprite *sprite) { __asm { MOV EAX, sprite->data } } I get errors, no double because the assembler can''t understand the -> pointer. How do I use pointers in inline assembly? Also, what are the speed advantages to calling out to a pure assembly OBJ instead of an inline call? Any help or samples would be appreciated. I would rather keep to directX blitters, but I need to do some specialized transparencies and such..

Sponsor:

#2 SiCrane   Moderators   -  Reputation: 9338

Like
Likes
Like

Posted 24 January 2000 - 03:16 PM

You should stick the indirection into a temporary variable, and reference the variable from the inline assembly. Otherwise you have to dereference your sprite in assembly. yeech.

Compiling into a asm obj files has the hit of needing to cross the function call boundary. i.e. you need to do the stack stuff, not to mention a propable cache miss for non-local code jump. inline for that reason is faster if used properly.

#3 fredo   Members   -  Reputation: 122

Like
Likes
Like

Posted 28 January 2000 - 07:07 AM

Ok. Lets say your Sprite struct looks like this:

typedef struct
{
DWORD Sprite_Width,Sprite_Height;
DWORD Xpos,Ypos;
DWORD *Data;
} Sprite;

Now, in this example, I''m assuming your sprite data is
32-bits.

Then in inline-asm:

========================================== SNIP ============

ERROR_Type BLT_BltTestOne(Sprite *sprite)
{
__asm
{
// point esi to your sprite
MOV esi,sprite

// to get the xpos, you add 8 to the ESI pointer
// because each member of the struct is a DWORD which
// is 4 bytes.
MOV eax,[esi+8]

// to access the sprite data, you would do this
MOV edi,[esi+32]
}
}

=== SNIP ===================================================

That should do it and VC will not complain.




~-------------------------------------------------------~
Fred Di Sano
System Programmer - Artech Studios (Ottawa.CA)
~-------------------------------------------------------~




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS