Register Operations in a Computer Program

A register machine is an electronically readable place on a personal computer that can be accessed by a particular computer program. Usually, registers consist of some special hardware components, and are either read/write-protected or read/read-only, and can only be used for specific purposes. In general, these computers have general input/output devices, a series of stored instructions, and a storage space for keeping application software and system files. Sometimes, however, a register is combined with a memory unit, making it an even more powerful computer than its single counterpart.


A register contains only the names and the addresses of the currently stored instructions, so that the program does not need to search the register for the next instruction before executing the given one. Register operations are executed from the current instruction down to the next instruction. An instruction will be executed if and only if the corresponding instructions are already stored in the register. Instructions are executed in the order in which they are listed, with the exception of unconditional branches.

A register has two states: a dynamic or a static state. A dynamic register can change anytime, while a static register can only be altered when the program is halted or stopped by a signal interrupting execution. As long as the programmer uses the register for storing only instructions that should never change, the processor registers will never become out-of-bounds. Static register operations are only executed every time a specific instruction is accessed. For example, a processor register that contains an instruction to multiply a number and a constant are both stored in a static register, so that when the multiplication is executed, the result will always be the constant value.

In assembler or dynamic language compilation, each instruction that is entered is compared against the target processor’s internal registers. If the instruction is found to be valid, then the program is compiled and run. Instruction sequences are stored in registers to allow the CPU to jump to a specific portion of code whenever necessary. The register assignments that are performed during compiled execution are referred to as register assignments. The size of the register assignments is controlled by the instruction pointer that is passed to the CPU.

Stack pointer and heap pointer, on the other hand, refer to the locations on the system that a register or a pair of registers will eventually point to after the CPU has finished executing a instruction. The stack pointer points to the address that the CPU will use as the current location where execution of instructions will continue after a call. The heap pointer points to the location of the memory that will be used after a function has been finished.

Whenever a new instruction is entered, a new stack pointer and a new heap pointer are created. The current contents of the registers are also saved into the register records. Finally, the target processor starts up and executes the program counter, which is the first instruction that is executed whenever the computer is started. The instructions contained in this register are then carried out by the microprocessor.

This entry was posted in Uncategorized. Bookmark the permalink.