Computer Organization - Basic Computer Instructions
Last Updated :
31 Jan, 2025
Computer organization refers to the way in which the components of a computer system are organized and interconnected to perform specific tasks. One of the most fundamental aspects of computer organization is the set of basic computer instructions that the system can execute.
Basic Computer Instructions
Basic computer instructions are commands given to a computer to perform specific tasks. These instructions are typically divided into three categories:
- Data Transfer Instructions: Move data between memory and registers (e.g., Load, Store).
- Arithmetic and Logic Instructions: Perform math or logic operations (e.g., Add, Subtract, AND, OR).
- Control Instructions: Guide the flow of the program (e.g., Jump, Branch, Call).
Data Transfer Instructions
These instructions deal with moving data from one location to another within the computer. Think of it as copying or transferring information between various components like memory, registers, or storage.
Common Data Transfer Instructions:
- Load: Copies data from memory to a register (temporary storage inside the CPU).
- Store: Transfers data from a register to memory.
- Move: Transfers data from one register to another.
Arithmetic and Logic Instructions
These instructions are used to perform mathematical and logical operations. They enable computers to handle calculations and make decisions based on certain conditions.
Arithmetic Instructions:
- Add: Adds two numbers.
- Subtract: Subtracts one number from another.
- Multiply: Multiplies two numbers.
- Divide: Divides one number by another.
Logic Instructions:
- AND: Compares two bits and returns 1 if both are 1; otherwise, returns 0.
- OR: Compares two bits and returns 1 if at least one is 1.
- NOT: Inverts a bit (1 becomes 0, and 0 becomes 1).
- XOR (Exclusive OR): Returns 1 if the bits are different, 0 if they are the same.
Control Instructions
Control instructions determine the flow of execution in a program. They guide the computer on which instruction to execute next, allowing flexibility in decision-making and repeated actions.
Common Control Instructions:
- Jump (JMP): Directs the program to execute a specific instruction elsewhere in the code.
- Conditional Branch: Jumps to another instruction only if a specific condition is true. Example: Branch if zero (BZ) or branch if not zero (BNZ).
- Call: Transfers control to a subroutine (a set of instructions performing a specific task) and returns afterward.
- Return: Brings back control to the main program after a subroutine is executed.
Instruction Set of a Basic Computer
The basic computer has 16-bit instruction register (IR) which can denote either memory reference or register reference or input-output instruction.
Memory Reference Instructions
These instructions refer to memory address as an operand. The other operand is always accumulator. Specifies 12-bit address, 3-bit opcode (other than 111) and 1-bit addressing mode for direct and indirect addressing. 
Register Reference Instructions
These instructions perform operations on registers rather than memory addresses. The IR(14 - 12) is 111 (differentiates it from memory reference) and IR(15) is 0 (differentiates it from input/output instructions). The rest 12 bits specify register operation. 
These instructions are for communication between computer and outside environment. The IR(14 - 12) is 111 (differentiates it from memory reference) and IR(15) is 1 (differentiates it from register reference instructions). The rest 12 bits specify I/O operation. 
Essential Instructions in a Basic Computer
Program Counter (PC) is a key part of a computer, and its instructions are the basic tasks a computer performs. These instructions are handled by the computer's CPU (Central Processing Unit) and form the foundation for more complex operations. Some examples of basic PC instructions include:
Symbol | Hexadecimal Code | Description |
---|
AND | 0xxx, 8xxx | AND memory word to AC |
ADD | 1xxx, 9xxx | Add memory word to AC |
LDA | 2xxx, Axxx | Load memory word to AC |
STA | 3xxx, Bxxx | Store AC content in memory |
BUN | 4xxx, Cxxx | Branch Unconditionally |
BSA | 5xxx, Dxxx | Branch and Save Return Address |
ISZ | 6xxx, Exxx | Increment and skip if 0 |
CLA | 7800 | Clear AC |
CLE | 7400 | Clear E(overflow bit) |
CMA | 7200 | Complement AC |
CME | 7100 | Complement E |
CIR | 7080 | Circulate right AC and E |
CIL | 7040 | Circulate left AC and E |
INC | 7020 | Increment AC |
SPA | 7010 | Skip next instruction if AC > 0 |
SNA | 7008 | Skip next instruction if AC < 0 |
SZA | 7004 | Skip next instruction if AC = 0 |
SZE | 7002 | Skip next instruction if E = 0 |
HLT | 7001 | Halt computer |
INP | F800 | Input character to AC |
OUT | F400 | Output character from AC |
SKI | F200 | Skip on input flag |
SKO | F100 | Skip on output flag |
ION | F080 | Interrupt On |
IOF | F040 | Interrupt Off |
Note: In the given table,
- AC (Accumulator): A register that temporarily stores data during arithmetic or logic operations.
- E (Carry/Overflow Bit): A single-bit register used for carry operations or overflow detection in arithmetic calculations.
Example of Instruction Execution
- ADD Instruction:
Suppose the memory address 0001
contains the value 5
, and the AC currently holds 10
. The ADD
instruction fetches the value from memory, adds it to the AC, and stores the result in the AC.
AC ← AC + M[0001]
Result: AC = 10 + 5 = 15
Uses of Basic Computer Instructions
- Data manipulation: Basic computer instructions are used to handle data in the computer system, including moving data between memory and the CPU.
- Control flow: Basic instructions guide the flow of a program by branching to different parts based on conditions.
- Input/output operations: Instructions are used to transfer data between the computer and external devices like keyboards, printers, or monitors.
- Program execution: They load programs into memory and control their execution by moving data in and out of the program.
- System maintenance: These instructions handle tasks like memory allocation, interrupt management, error detection and correction.
Issues of Basic Computer Instructions
- Complexity: Instructions can be hard to understand, especially for beginners, making programming challenging.
- Limited functionality: Basic instructions can handle only simple tasks. Programmers require to write extra code for complex operations.
- Compatibility: Instructions may vary across different computer systems This can require programmers to write separate code for each system, which can be time-consuming and inefficient.
- Security: Basic computer instructions can be vulnerable to security threats, such as buffer overflows and code injection attacks.
- Maintenance: Basic computer instructions can be difficult to maintain, particularly as systems become more complex and code becomes more extensive. This can require significant resources, time and effort.
Related Articles
Similar Reads
Computer Organization - Von Neumann architecture Computer Organization is like understanding the "blueprint" of how a computer works internally. One of the most important models in this field is the Von Neumann architecture, which is the foundation of most modern computers. Named after John von Neumann, this architecture introduced the concept of
6 min read
Computer Organization - Basic Computer Instructions Computer organization refers to the way in which the components of a computer system are organized and interconnected to perform specific tasks. One of the most fundamental aspects of computer organization is the set of basic computer instructions that the system can execute.Basic Computer Instructi
6 min read
Computer Organization | Instruction Formats (Zero, One, Two and Three Address Instruction) Instruction formats refer to the way instructions are encoded and represented in machine language. There are several types of instruction formats, including zero, one, two, and three-address instructions. Each type of instruction format has its own advantages and disadvantages in terms of code size,
11 min read
Stack based CPU Organization Based on the number of address fields, CPU organization is of three types: Single Accumulator organization, register based organization and stack based CPU organization.Stack-Based CPU OrganizationThe computers which use Stack-based CPU Organization are based on a data structure called a stack. The
4 min read
Introduction of General Register based CPU Organization When we are using multiple general-purpose registers, instead of a single accumulator register, in the CPU Organization then this type of organization is known as General register-based CPU Organization. In this type of organization, the computer uses two or three address fields in their instruction
3 min read
Introduction of Single Accumulator based CPU organization The computers, present in the early days of computer history, had accumulator-based CPUs. In this type of CPU organization, the accumulator register is used implicitly for processing all instructions of a program and storing the results into the accumulator. The instruction format that is used by th
2 min read
Computer Organization | Problem Solving on Instruction Format Prerequisite - Basic Computer Instructions, Instruction Formats Problem statement: Consider a computer architecture where instructions are 16 bits long. The first 6 bits of the instruction are reserved for the opcode, and the remaining 10 bits are used for the operands. There are three addressing mo
7 min read
Addressing Modes Addressing modes are the techniques used by the CPU to identify where the data needed for an operation is stored. They provide rules for interpreting or modifying the address field in an instruction before accessing the operand.Addressing modes for 8086 instructions are divided into two categories:
7 min read
Machine Instructions Machine Instructions are commands or programs written in the machine code of a machine (computer) that it can recognize and execute. A machine instruction consists of several bytes in memory that tell the processor to perform one machine operation. The processor looks at machine instructions in main
5 min read
Difference between CALL and JUMP instructions In assembly language as well as in low level programming CALL and JUMP are the two major control transfer instructions. Both instructions enable a program to go to different other parts of the code but both are different. CALL is mostly used to direct calls to subroutine or a function and regresses
5 min read