xjas wrote:but it'd be pointless as you'd essentially be writing the program the same way as you would in a high-level language.
I'm confused by this statement? Quite the opposite o.0 if I'm reading that right...
But yes you can. All a native x86 compiler does is translate/convert your higher-level syntax into x86 byte code (in a very intelligent way, applying optimisations and organising in a way that the higher level language allowed you to assume when you wrote it). It's fine for assembly to call higher level libraries (through C interfaces), you just need to have a better understanding of stuff like calling conventions, opcodes, registers and not get so offended by magic values plastered all over the place 😀.
This abstraction is what allows source code to be cross platform, essentially anything that runs on your x86 box.... could potentially be written in x86 assembly 😉.
Assembly is pretty much as raw as it gets, as a result you can get fastest possible performance, but it requires a lot of syntax and it needs to be solid!
Given the complexity of assembly language over higher-level ones coupled with performance gains. It's only really advantageous to use assembly in critical areas which suffer speed/efficiency problems. One notable area is SIMD, which is very platform (CPU) dependant, and is not directly exposed by most (if any) languages. To use it you need to communicate directly with the CPU, in a non higher-level way, which is where assembly comes in. In assembly you can directly copy the contents of your data into the specific SSE registers/instructions that allow SIMD. Compiler may not know to do this for you (it needs to understand that the data and operations you want to work on is SIMD compatible), so when it creates code, would be using the standard x86 registers/instructions.
Also note. Assembly is a language itself, it still needs to go through an 'compiler' (called an assembler [EDIT:] Ignore use of phrase compiler here, its an assembler 😊 ) to produce the byte code. Java and llvm do not produce x86, they produce byte-code, which run on 'virtual machines'.
Nehe has OpenGL tutorials, and quite a few of the earlier lessons have code examples in asm/masm.
OpenGL spinny cubey thing, with texturing and alpha blending written in assembly:
http://nehe.gamedev.net/data/lessons/masm/lesson08.zip