08 SUB

Updated 4 Oct 2026

SUB

  • The SUB (Subtract) instruction is used to subtract the value in one General Purpose Register (Rr) from the value in another General Purpose Register (Rd) and store the result in Rd.

Instruction Syntax

SUB Rd, Rr
  • Rd: The destination register where the result of the subtraction will be stored.
    • Must be one of the 32 general-purpose registers: R0–R31.
  • Rr: The source register containing the value to be subtracted from Rd.
    • Must be one of the 32 general-purpose registers: R0–R31.

Example

Valid Instruction:
SUB R10, R20
  • R10: R10 is valid since it is within the register range R0–R31.
  • R20: R20 is valid since it is within the register range R0–R31.
  • Effect: Subtract the value in R20 from the value in R10, and store the result in R10.