Data Movement: These instructions handle the transfer of information between memory and registers. For example, retrieves a value from a memory address into the , while performs the inverse by saving the contents to a specific memory
Register Operations: The instruction is used to copy data between registers or between a register and memory, while specifically resets a register (usually the ) to zero to prepare for new calculations.
Input and Output (I/O): These instructions facilitate communication with external devices. captures data from an input source and places it in the , whereas sends the current value in the to an output device like a monitor.
Data Declaration: The directive is used to define constants or reserve space for variables within the program's memory, ensuring that specific values are available for processing during execution.
Arithmetic Operations: These instructions perform mathematical calculations on data. and typically combine the value in the with a value from memory, storing the result back in the .
Unary Operations: Instructions like (increment) and (decrement) modify the by a fixed value of 1, which is highly efficient for loop counters and simple indexing.
Comparison & Testing: The instruction compares the with a memory value to set status flags (like Zero or Carry) without changing the data itself. Similarly, performs a logical AND to check specific bits, which is essential for decision-making logic.
Unconditional Jumps: The instruction forces the program to move to a different section of code (identified by a label) regardless of any conditions, allowing for the creation of infinite loops or jumping to subroutines.
Conditional Jumps: These instructions only trigger a jump if specific criteria are met, usually based on flags set by a previous or arithmetic operation. Examples include (Jump if Zero), (Jump if Not Zero), and (Jump if Carry).
Program Termination: The (Halt) instruction is a critical control command that signals the CPU to stop executing instructions, effectively ending the program's run.
Understanding the difference between data-altering and flow-altering instructions is vital for logic design.
| Category | Primary Purpose | Examples |
|---|---|---|
| Data Movement | Transferring values between locations | , , |
| Arithmetic | Modifying numerical values | , , |
| Control Flow | Changing the execution sequence | , , |
| Comparison | Setting flags for decision making | , |
LOAD vs. STORE: brings data into the processor's workspace (), while pushes data out to permanent memory storage.
Conditional vs. Unconditional: Unconditional jumps always happen, whereas conditional jumps act as 'if-statements' that depend on the current state of the CPU flags.
Trace the Accumulator: In exam questions involving code snippets, always maintain a 'trace table' for the . Most arithmetic and I/O instructions modify this register, and forgetting its current state is a common source of errors.
Identify the Trigger: When you see a conditional jump like , look at the instruction immediately preceding it. Usually, a , , or instruction was used to set the Zero flag that the jump depends on.
Verify Memory vs. Value: Pay close attention to whether an instruction uses a direct memory address or a literal value. Using a memory address as a raw number (or vice versa) will lead to incorrect results in tracing exercises.
Check for HALT: Ensure every logic path in your assembly program eventually reaches a instruction; otherwise, the program may enter an undefined state or execute unintended data as code.