Category:MIPS Assembly: Difference between revisions

Content added Content deleted
m (→‎BEQ: typo fix)
Line 77: Line 77:
* Stands for: '''B'''ranch if '''Eq'''ual
* Stands for: '''B'''ranch if '''Eq'''ual
* Usage: <code>beq $operand1,$operand2,label</code>
* Usage: <code>beq $operand1,$operand2,label</code>
* Example: <code>beq $t0,$t1,T0NotEqualtoT1</code>
* Example: <code>beq $t0,$t1,T0_equals_T1</code>
* Effect: Compares the register operands, and if they're equal, adds (signed) the specified offset to <code>PC</code>. (usually a labeled line of code that the assembler translates to a calculated offset.) Otherwise, execution falls through to the ''instruction after the instruction after'' the <code>beq</code>. This is not a typo, that's how MIPS works.
* Effect: Compares the register operands, and if they're equal, adds (signed) the specified offset to <code>PC</code>. (usually a labeled line of code that the assembler translates to a calculated offset.) Otherwise, execution falls through to the ''instruction after the instruction after'' the <code>beq</code>. This is not a typo, that's how MIPS works.

===BEQZ===
===BEQZ===
* Stands for: '''B'''ranch if '''Eq'''ual to '''Z'''ero
* Stands for: '''B'''ranch if '''Eq'''ual to '''Z'''ero