Assembly code vs Machine code vs Object code?

Machine code is binary (1’s and 0’s) code that can be executed directly by the CPU. If you open a machine code file in a text editor you would see garbage, including unprintable characters (no, not those unprintable characters 😉 ). Object code is a portion of machine code not yet linked into a complete program. It’s the machine … Read more

Understanding cmp instruction

cmp arg2, arg1 performs the same operation as sub arg2, arg1 except that none of the operands are modified. The difference is not stored anywhere. However, the flags register is updated and can be used in a conditional jump, like jump-if-equal (JE), most often as the next instruction after the cmp. The advantage over other … Read more

Is it possible to “decompile” a Windows .exe? Or at least view the Assembly?

With a debugger you can step through the program assembly interactively.With a disassembler, you can view the program assembly in more detail.With a decompiler, you can turn a program back into partial source code, assuming you know what it was written in (which you can find out with free tools such as PEiD – if … Read more

What’s the purpose of the LEA instruction?

As others have pointed out, LEA (load effective address) is often used as a “trick” to do certain computations, but that’s not its primary purpose. The x86 instruction set was designed to support high-level languages like Pascal and C, where arrays—especially arrays of ints or small structs—are common. Consider, for example, a struct representing (x, … Read more