ASM2 - Documentation
  • 📚ASM2 - Documentation
  • Registers
  • Address Registers
  • Instructions
    • DISP
    • END
    • MOV
    • RET
  • Operators
    • ADD
    • SUB
    • MUL
    • DIV
  • Functions
  • Subroutines
  • Jump
    • Conditional Jump
      • Jump Equal (JE)
      • Jump Not Equal (JNE)
      • Jump Greater (JG)
      • Jump Greater or Equal (JGE)
      • Jump Less (JL)
      • Jump Less or Equal (JLE)
    • Unconditional Jump
Powered by GitBook
On this page
  • Name of the operator
  • Syntax
  • Where :
  • Usage
  1. Operators

SUB

SUB (Subtraction) operator:

Name of the operator

The "SUB" (Subtraction) operator is used in programming languages to subtract two register or to subtract a value to a specified destination.

Syntax

SUB RX, Y

Where :

  • RX: Represents the destination register where the difference of RX - Y will be moved.

  • Y: Represents the source register or immediate value that will be subtracted to the destination register.

Usage

  • Addition of Register Values:

    SUB R1, R2
    • Detail: This example demonstrates the subtraction of the values in registers R1 and R2.

      The result is stored in register R1.

  • Addition of Immediate Value:

    SUB R3, #10
    • Detail: This code subtracts the immediate value 10 to the contents of register R3. The result is stored back in register R3.

PreviousADDNextMUL

Last updated 1 year ago