Reference: Registers

Registers

The Main CPU is a standard MIPS CPU which uses 32 Registers (32-bit) to hold data while performing operations on it. So the standard process is:

  1. Read from Memory to Register
  2. Perform Calculation
  3. Write Register result to Memory

What does a register mean to a programmer?

Registers are the fastest possible memory, to keep it fast there is a limited amount. The MIPS processor has 32 registers of 32 bits, doesn't sound like much except by comparison. An Intel Pentium Pro (High end in 1995) had the following registers: 8 general purpose @ 32-bits, 6 @ 16 bits, and 2 special purpose @ 32 bits.

How do we use them?

There aren't any instructions to move data directly from memory to memory so everything has to pass through a register, except for DMA which will be discussed in a later lesson. As an assembly language programmer think about their names. The table below is what we are going to use. If a value beyond these is used, it will be described then.

If we respect these rules, we will be pretty safe even doing some fancy stuff later.

Now that we have declared that these registers are variables the first thought is what type of data can we put in them? The answer is anything. Some instructions determine how a register will be "interpreted" (ex. signed/unsigned). Registers will also commonly have memory addresses in them which makes them a "pointer" data type. Character or string types can be either ASCII data or a pointer to a string in memory. Note the choice of "ASCII" characters is optional, we don't have any libraries that assume anything about a string.