![]() I'd recommend looking at assembly and how CPU's work, if you are more interested. However, you do not want to write a program in binary. When you edit these values, suppose you know what you are doing, you can change the behavior of the software. So when you open an executable in a hex editor, all these values comprises of instructions like above, static data, libraries and such. Four 0's and 1's compress into a digit, and we get: 00 22 19 20 ![]() The thing is quite long, so we usually write it not in binary, but in hex. Which basically says, add the values stored in register 1 and 2, and put the result in register 3. Then the machine instruction is further translated into 0's and 1's.įor example, add in MIPS CPU architecture looks like: 0000 0000 0010 0010 0001 1000 0010 0000 This is supposed to be humanly readable machine instructions (the previously mentioned add, load, etc). During this stage, your code is translated into an intermediate language based on your specific CPU, the assembly. It needs to be translated to the machine code, in what is called compiling process. ![]() So how does this translation work? Well suppose you've written a simple hello world program in C. Your CPU actually executes very simple instructions, coded by 0's and 1's, like add, logical or, load a number from memory address into register (so we can add or manipulate the value), etc. Most programming languages we use are on a high level, in the sense that they are translated several times before machines can actually recognize it.
0 Comments
Leave a Reply. |