A program is a set of instructions that is performed or executed by a Central Processing Unit (CPU) of a computer, it must be written in machine code which is the binary encoding of the set of instructions that the processor understands. All computer programs follow this structure. Most programs are developed using a high level language compiler like C++ or Java and then compiled down into a lower level, more basic set of instructions like machine code. Some languages compile down to a basic set of pseudo-code, code for an imaginary processor that needs to be either further compiled into machine code or interpreted by another program written in machine code.
Assembler Mnemonics are textual representation of a machine code instructions. Machine code is the binary encoding of instructions that the processor can perform. Assembler is a low level language in that there is normally a one to one mapping with an assembler code instruction and a machine code instruction. The Mnemonics are converted into machine code so that it can be executed or run by the process of assemmbling and linking. Many high level languages like C++ have instructions or statements that may be compiled into multiple machine code instructions. The higher the level of the language the more the instructions are abstracted from the actual processor's machine code. The compiler for the language converts the statement into instructions for the particular processor it is targeting. Two compilers may generate different instructions based upon the processor they are targeting. So C++ code can be compiled on many different machines and operating systems and the compiler handles the specifics of that machine and operating system. C++ code is therefore mostly transportable between platforms. Assembler code is linked directly to the processor, they are generally specific to the family of processors. However, the instruction sets of most processors are similar in the sense that they provide a common set of operations like add, subtract etc. The assembler Mnemonics may differ as well as the architecture of the machine. Assemmbler programs are not easy to transport between different machines.
Computers generally provide two locations to store information, in memory and on permanent long term storage like disk drives. The processor or CPU can usually directly access memory but long term storage access is usually indirect via an external (to the CPU) controller. Direct access to memory is provided by the system bus and the speed is determined by the system bus speed. This is usually slower than the CPU speed. The CPU also has temporary storage areas;
Registers provide high speed access to data without going through the system bus. The are modified directly by processor instructions where as what is stored in cache is maintained separately by processor itself, based upon its internal architecture. Generally the cahce is invisible to the programmer although there are a couple of instructions for the cache.
In the early processors Registers were often used for specific purposes, like arithmetic operations. Most modern processors allow most registers to be used for most operations.
The Intel compatible architecture provides 7 general use registers
Processors also have a set of flags that are used to indicate additional information about the result of an instruction. They are stored in a special register in the processor. The flags can be tested and modified directly by certain instructions. Common flags include:
Some flags are used to indicate the system state