Assembly Language Instruction Operations

Instruction Operations in Assembly Language

Loading Data into Registers

  • Instruction: Loading Data
    • Action: Load a value from a specific memory address into a register.
    • Example Instruction: LOAD FROM ADDRESS 80 TO REGISTER x1
    • Effect: Loads a value, such as -11, from memory address 80 into register x1.

Performing Arithmetic Operations

  • Instruction: Addition
    • Action: Add the contents of the specified registers.
    • Example Instruction: ADD x1, x2
    • Effect: Adds the value in register x1 (which might be -11) to another register (for instance, x1 added with another value stored in x2).
    • Result is stored in a designated register, such as x2, which now contains the result 9.

Storing Data from Registers to Memory

  • Instruction: Storing Data
    • Action: Transfer the value from a register back to a specified memory address.
    • Example Instruction: STORE TO ADDRESS 200 FROM REGISTER x2
    • Effect: The content of register x2 (which is 9) is stored in memory address 200.

Total Instruction Count

  • Total Instructions
    • To complete loading, adding, and storing, the total instruction count includes:
      • Loading data into registers (from memory to registers).
      • Performing computations (e.g., addition).
      • Storing results back to memory (from registers to memory).

Example of a Series of Instructions

  1. Loading Data:
    • Load from memory address 18 to register x1:
    • Example Instruction: LOAD FROM ADDRESS 18 TO REGISTER x1
      • This loads a specific number into register x1.
  2. Performing Computation:
    • Add result and write back computation result to a register:
    • Example Instruction: WRITE BACK RESULT TO REGISTER x2
      • This stores the result from computation to register x2.
  3. Storing Final Result:
    • Store the final result from register back to memory:
    • Example Instruction: STORE TO ADDRESS 200 FROM x2
      • Transfers the result from register x2 into memory address 200.