Log in

View Full Version : Minor rant


TBone
March 22nd, 2004, 18:53
So I'm back from vacation and reading through lots of old tomes, tutorials, guides, etc., on assembly. I basically have to learn it all over again after giving up on the hobby several years ago.

And I know I'm being pretty nit-picky but I have to get something off my chest...

assembly != machine code
assembly != machine code
assembly != machine code

Ahhhhh. I feel better now.

I have a lot of gratitude to anyone who goes through the trouble of writing FAQs, how-tos, guides, etc. for other people to read, but that one thing has been bugging me. It seems like a lot of guides don't accurately make that distinction, and a few of the writers themselves don't seem to be aware that there is a difference.

Assemblers do a lot more than just translating mnemonics like MOV AX, CX into binary opcodes and operands, even if it doesn't do any optimizations, and you restrict yourself to primitive assemblers that don't handle variables. Even if you aren't talking about the actual assembly process, but rather just about the language itself, it's not really true to assert that assembly statements directly correspond to opcodes and operands as if it were just a 1-to-1 mapping. For example, in the IA-32 assembly language, even something as elementary as the MOV statement represents 14 different processor opcodes depending on the size and type of of the operands. Modern assemblers aren't just a matter of mnemonics anymore.

Anyway like I said, I know I'm being kind of petty perhaps, but I feel like sometimes we do a bit of a disservice when we say - If you want to learn how to reverse:
1) Learn assembly

When we really should say something more like:
1) Learn how processors work
2) Learn how programming languages evolved
3) Learn how assemblers work
4) Learn assembly

So there's my minor rant

The Svin
March 23rd, 2004, 09:39
Well, even with the same operands and instruction you can encode it often in different ways.
For example mov eax,ecx you can encode 2 different ways, inverting bit D and swapping codr and memr fields in modrm byte.
While mov eax,[ecx] you can encode into binary 7 different ways