_asm - what is it?

This is a discussion on _asm - what is it? within the Windows Programming forums, part of the Platform Specific Boards category; I have no idea what _asm does.
I found no good explanations from google and MSDN explanation didn't make anything ...

_asm - what is it?

I have no idea what _asm does.
I found no good explanations from google and MSDN explanation didn't make anything clearer. I just understood that it's some kind of assembler which has it's own commands.

Also, I would like somebody to explain to me what this function exactly does (a function from Vice City Multiplayer 0.1c source code):

ecx,eax and edx are x86 registers, the 'mov' instruction means 'move', 'jz' means 'jump if zero flag set'(the zero flag is set, unsurprisingly, if, among other conditions, a previous operation - like 'and' or 'sub' - results in zero) to the label that follows(the various ret_*), 'sub' is 'subtract' and 'and' is a logical 'and'. The _asm keyword instructs the compiler that what follows is a command in assembly; in this context the use of assembly language is inline.

Assembly language has a one to one mnemonic command to cpu instruction relationship, whereas higher level languages, such as c have a one-to-many i.e., one command in c will translate to many cpu instructions.

For a complete list of cpu instructions visit intel's website and download the instruction set manual for your processor.

Just to point out that when you say eax=edx+204, thats incorrect. [edx+204] is basically a pointer to a memory address. So mov eax, [edx+204] copies that memory contents into eax. The [] refer to the item at the said address. edx+204 referes to the physical memory address.

Also subtracting 10000h does not subtact 10000, the h denotes that its hex, which is 65536 decimal.

I'm left scratching my head as to why someone would write such a simple function in assembly... to kill portability, and to obfuscate code? (Though you could comment assembly all the same.)

To me: A well written C/C++ program will generally not need assembly. When it does need it, you'll know why. (Code does processor specific fun, code needs extreme speed, etc.) Other than that, mixing assembly with C (when not needed) should be avoided.
With this code, aside from different representations in compilers breaking it, there's always issues of how structures/classes are packed. If m_pVehicle is a pointer to a structure (I'm assuming given the 'p' and the large offsets) then future changes to the structure could break the offsets in the assembly...

AND does a bitwise and on the two operands. (EAX and 0x0F0000) The result is in EAX.

And executable file consists of machine code. (And some other stuff.) It's what assembly source code is translated to. For the most part, 1 line in assembly = 1 machine code - it's almost a straightforward translation. C/C++ ends up as machine code, and some compilers will output assembly code if you ask them to.

Assembly is a lot lower than C, but you can get a lot of power and speed out of it, as you have control over every instruction the processor executes. Of course, it takes more code, and it generally considered harder to write.

The assembly makes no sense to me now. That first dereference seems to point to the middle of the structure. Does: