Unfortunately, each type of CPU (processor) has different names for its registers
Example:
CPU Name of some of the registers ------------------- ------------------------------- Intel processor rax, rbx, rcx, rdx, ... ARM processor r0, r1, r2, r3, ... |
When you write an assembler program, you will need to use the registers in the CPU inside your assembler program
Because the registers' names are different for different processor type, the assembler programs written for one type of processor cannot be compiled and run on another type of processor
Fortunately:
|
The ARM processor has 12 general purpose registers with the following register names:
|
The ARM processor has the following special purpose registers with the following register names:
|
ARM register Commonly used register name in assembler programming --------------- ------------------------------------------------------ R0 r0 or R0 R1 r1 or R1 R2 r2 or R2 R3 r3 or R3 R4 r4 or R4 R5 r5 or R5 R6 r6 or R6 R7 r7 or R7 R8 r8 or R8 R9 r9 or R9 R10 r10 or R10 R11 fp (frame pointer) R12 ip (intra procedure) R13 sp (stack pointer) R14 lr (link register) R15 pc (program counter) |
Assembler programs will not use the CPSR register directly and will therefore not refer to the CPSR register by a register name.
Part of the "experience" is showing all the information that you need to see the assembler programming executing inside the (ARM) computer.
The values in the ARM registers are part of these information
If you look at the EGTAPI window:
The values in the (general and special purpose) registers are shown in the left panel:
|
Because the ALU (Arithmetic and Logic Unit) is the computation circuit of the CPU and the ALU takes inputs from the general purpose registers, a rule of thumb in assembler programming is:
|
byte (8 bites) short (16 bits) int (32 bits) float (32 bits) |
Since a high level programming language has different data types (and data type can have different operand sizes), the ARM processor must support operations on different data types with its registers
Part of this support is storing the values of the different types in its registers (for computation).
Because of the different type sizes, some part of a register must not be used.
Here is how the ARM processor store the values depending on the size of the data type: