Assembly code is simply a human- readable version of the computers fundamental instructions.
For example, a single instruction is 16 bits, organized like this ( I’m making this up, it does not match any real cpu):
Operation 4 bits (0000 = get, 0001 = put, 0010 = add, sub, compare, …)
Source register 2 bits (registers 00, 01, 10, 11)
Destination register 2 bits
Memory address 8 bits (any 8 bit number)
So a possible instruction word might be
0010 01 10 00001110
In assembly, this would be written
ADD R1 R2 0E
and what it does is add the number in R1 to the number in R2 and store the result in memory location 0E (hex, which is 14 decimal).
An “Assembler” is a program that can input that ADD instruction (and thousands more in your program) and turn it into the corresponding binary. You end up with a long list of binary instructions, which is basically what your “foo.exe” program is, and the computer can execute those directly.
Latest Answers