R3000 instruction set
- 1 Intro
- 2 Instructions
- 2.1 nop
- 2.2 Arithmetic
- 2.3 Memory
- 2.4 Comparison
- 2.5 Binary
- 2.6 Control
Note: This section is meant to be linked to, and used to generate tooltips (title text) for code pages.
The first paragraph of an instruction's description should be a short one-liner. It will be used as the tooltip. Think "reminder", rather than "explanation".
These are stolen from Wikipedia. Whoops.
Used to cause delays between instructions, because some instructions step on each other's toes.
These instructions act on registers as 32-bit two's-complement integers.
This operation is used to add both signed and unsigned integers (and is in fact the default used by C compilers). The "unsigned" part is misleading: it means that, if the sign changes, don't set the "overflow" error flag, which can cause an exception handler to trigger.
Add immediate unsigned
Multiply $s and $t.
Unlike most instructions, this instruction doesn't say where to store the result. The product of two 32-bit integers is at most 64 bits long, so the top and bottom parts of the result are stored separately. To access them, use the #mflo (move from low) and #mfhi (move from high) instructions.
This instruction is slow, so the compiler might instead use a combination of shifts and additions for multiplications by constants.
This instruction is sometimes used to multiply by positive decimals less than 1. For example, to multiply by 0.14, the compiler can multiply by an integer close to 0.14 * 2^32, and then only take the high part of the result.
mult r2,r3 Multiply mflo r4 r4 = the lower part of the product mfhi r5 r5 = the upper part of the product (r5 * 2^32) + r4 == r2 * r3 (mathematically)
div $s, $t
divu $s, $t
Getting data from/to the RAM.
Load halfword unsigned
Load byte unsigned
Load upper immediate
Move from high
Move from low
Set $d to 1 if true, 0 if false.
Set on less than
Set on less than immediate
These instructions act on registers as sequences of 0's and 1's.
Shift left logical immediate
Shift right logical immediate
Shift right arithmetic immediate
Shift left logical
Shift right logical
Shift right arithmetic
These instructions may or will cause a jump to a different part of the program.
The instruction right after one of these will always be executed, even if there's a jump.
Branch on equal
Branch on not equal
Jump and link