Examples of DirectX/OpenGL in assembler?
#1
Posted 22 November 2005 - 10:03 PM
#2
Posted 22 November 2005 - 10:22 PM
Here is a good starter that gets you through making a window:
http://www.acm.uiuc....s/winasmtut.pdf
http://webster.cs.ucr.edu/
If you are that far, then you can figure out how to call the OpenGL C API from assembly. Just follow any C/C++ language tutorials. I'm sure calling DirectX is an even bigger mess.
#4
Posted 23 November 2005 - 10:58 AM
And, do you have an ICQ number? I want to talk with you.
#5
Posted 23 November 2005 - 01:25 PM
http://www.google.co...bly-programming
I didn't search for DirectX examples.
I don't use ICQ, but you can private message me on this forum.
#6
Posted 23 November 2005 - 05:11 PM
#8
Posted 23 November 2005 - 09:41 PM
#9
Posted 25 November 2005 - 04:10 AM
#10
Posted 25 November 2005 - 04:34 AM
Unknown said:
Can't really believe this!
..but I guess its a better reason than the usual "I get better performance by writing in asm"-type of comments ;)
#11
Posted 25 November 2005 - 12:54 PM
Unknown said:
Knowing assembly is very useful in game development, but actually writing whole modules in it is pointless. I highly recommend you to learn an object-oriented language like C++. It allows to better structure your software, write readable complex algorithms, and it helps you greatly to write correct code.
#12
Posted 25 November 2005 - 02:11 PM
Nick said:
sorry, but i dont agree. it would be very good for performance if some of critical application sections be written in assembly (sorting for example).
writing in asm gives direct access to registers, thus while sorting single registers could be used as pointers and resource usage could be totally minimized.
im myself consider to create few modules in asm for my app and then call its functions from c code (modules in termns of .dll, .lib)
However, i agree with rest of your post Nick. some time ago I also moved fom asm to c and it was very easy :)
#13
Posted 25 November 2005 - 03:55 PM
ikk said:
writing in asm gives direct access to registers, thus while sorting single registers could be used as pointers and resource usage could be totally minimized.
im myself consider to create few modules in asm for my app and then call its functions from c code (modules in termns of .dll, .lib)
However, i agree with rest of your post Nick. some time ago I also moved fom asm to c and it was very easy :)
At the risk of starting a flame war, I disagree with you and agree with nick. If you know assembly and C++ you should be able to write C++ to produce the desired instructions. The only time I'd ever write assembly stuff is if I was doing bytecode level stuff or OS boot-strapping/device interface.
Access to the low level details is a bad thing IMO. The hardware is quite different to the x86 architecture, an opitmising compiler can do it better than you in 90% of the cases. Do you know how the CPU will resequence instructions to achieve parallelism? There are far more than 8 registers in a p4.
Appart from the trivial case of I write code to work on my machine, architectures can vary and asm reduces portability and compatability.
Back to the original subject
If you can do asm, surely its just a simple matter of calling the DX/OpenGL functions? :wacko:
#14
Posted 25 November 2005 - 05:06 PM
ikk said:
Other functions can be worth writing in assembly as well, if they are performance critical and can make use of MMX or SSE (all multimedia applications in general). But that's again just a couple functions and it can be inlined in C++ (no need for a .asm file). Hardly worth calling a module.
I hope that clarified my point of view. :happy:
#15
Posted 25 November 2005 - 05:36 PM
dave_ said:
Quote
Furthermore, a bit of knowledge on CPU architectures helps a lot to write faster code than a compiler, even for plain 32-bit integer code. It's true that the Pentium 4 has more than 8 registers, but it's the C++ compiler that is much more limited in using them to the fullest than most experienced assembly programmers. Almost no compiler uses MMX or SSE, and if they do, they are very bad at it.
Quote
Anyway, writing logic modules in assembly, that's a waste of time. Every language, from 1st generation to 5th generation, has its purpose. Just use them wisely.
#16
Posted 25 November 2005 - 07:04 PM
i dont always believe that something what is said to be optimized, is optimized good enough for some special case. sure, it can be optimized for hundred cases simultaneously and for mine too, but its not optimized enough when i need only two 32-bit registers and 1KB of memory.
#17
Posted 26 November 2005 - 12:31 AM
I agree with what you're saying. I just wasnt quite consise enough with my post, I didnt make exceptions for architecture extensions, SIMD, etc. Although personally I'm happy to use instrinsics in my code (as long as I can see the code generated).
I'm just trying to say that you really only need to use assembler in less than 1%* of your code. And for those less than expert**, writing code better than well written C++ and the compiler (excluding architecture extensions) is nearly impossible.
*number plucked from my posterior
**looking at your work, you might just be one of that type
#18
Posted 26 November 2005 - 10:37 AM
Anyway people are different and therefore they like different things. We can't judge them for their choice, as long as they're happy with it!
#19
Posted 26 November 2005 - 05:19 PM
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











