PDA

View Full Version : C and Assembler



Fernando
01-15-2002, 02:48 AM
Hi there people, I'm a new OpenGL User, and I would like to know what are the benefices using C + Assembly...

I have a few experience in Assembler for the old MS-DOS (16-bits assembly).

At that time, I used to use Assembly to make video access higher.

But, I don't know why we use Assembly nowadays...

I think it's not to access the video-card, because today, we have a lot of different video-cards, and It would be boring to write the code for all them (to be compatible).

So, Why we use Assembly nowadays?

Thank you very mutch guys!!! :-)

mikael_aronsson
01-15-2002, 06:29 AM
Hi !

I don't think there are that much assembler code in todays OpenGL applications, even though you could use it to make some things faster, vector and matrix math could be speeded up some, you could also use MMX or some other form of SIMD in assembler to improve things.

But as I said, I don't think there is that much assembler in most applications today.

One reason is that a lot of applications (including games) must be able to run on different platforms and we get new CPU's all the time, and assembler code must be optimized for a specific CPU to make any bif difference.

Mikael

01-15-2002, 02:53 PM
Hi there

I use Assemble and OpenGL togheter ,and its working. What i want to say is that Assemble gives me more possibilites to write own routins to use, for example own .dll files that i think is more fast and safer than other (already programed fils does). But its not easy, Beacuse you have to start from scratch.
But to integrate OpenGL ,Win32 and Assemble is easy (sometimes more easy than it is with C/C++).

hope you find a way ,good luck

rIO
01-15-2002, 10:18 PM
Assembly IT'S used a lot in nowadays apps (I'm talking about competitive apps).

just do a test, in VC++ write :

int a = (int)1.5f;

and see what machine code generates the compiler.
Of course if you don't want all that garbage in your code is better to write your own ceil and floor routines.
Also my math classes (vectors, matrices,intersections) had a speed up of 50% after rewriting them using MMX.

Believe me it's quite usefull to write code in assembly (if you can how to write it), the compiler usually does a good job, but it always need to be generic, so not optimized for a certain situation.

just my 2 cents.

rIO.sK http://www.spinningkids.org

mikael_aronsson
01-15-2002, 10:48 PM
Hi !

Not sure how you could optimize it more:

The code int a = (int) 1.5; is compiled as "push 1", is there a faster way maybe...

Mikael

mikael_aronsson
01-16-2002, 02:23 AM
Sorry, there should have been a smiley in the message above, it was lost somewhere on the way, just wanted to point that out.

Mikael

DarkWIng
01-16-2002, 08:44 AM
using ASM in C(++) to speed-up your code depends ALOT on your compiler. There's no problem speeding up some code compiled with hm... borland visula C++ 2.0 but trying to beat MS VisualStudia.NET is almost useles

Fernando
01-16-2002, 10:20 AM
Thank You very mutch guys!!! You helped me a lot!!!

:-)

After this, I think I'll try to make some codes in Assembler...

Hehe, but I don't know how to start. Can you recommend me some sites or tutors?

I have few experience with 16-bit Assembly, Anything you can give will help-me !!!

Thanks again! :-)

zed
01-16-2002, 11:43 AM
perhaps romka's site try (romka opengl) in google