Skip to content
geeksforgeeks
  • Tutorials
    • Python
    • Java
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
    • Practice Coding Problems
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • DSA
  • Practice Problems
  • C
  • C++
  • Java
  • Python
  • JavaScript
  • Data Science
  • Machine Learning
  • Courses
  • Linux
  • DevOps
  • SQL
  • Web Development
  • System Design
  • Aptitude
  • GfG Premium
Open In App
Next Article:
Computer Organization | Instruction Formats (Zero, One, Two and Three Address Instruction)
Next article icon

Computer Organization - Basic Computer Instructions

Last Updated : 31 Jan, 2025
Comments
Improve
Suggest changes
Like Article
Like
Report

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:

  1. Data Transfer Instructions: Move data between memory and registers (e.g., Load, Store).
  1. Arithmetic and Logic Instructions: Perform math or logic operations (e.g., Add, Subtract, AND, OR).
  1. 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. memory reference instruction

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. register reference instruction

Input/Output Instructions

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. i/o instruction

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:

SymbolHexadecimal CodeDescription
AND0xxx, 8xxxAND memory word to AC
ADD1xxx, 9xxxAdd memory word to AC
LDA2xxx, AxxxLoad memory word to AC
STA3xxx, BxxxStore AC content in memory
BUN4xxx, CxxxBranch Unconditionally
BSA5xxx, DxxxBranch and Save Return Address
ISZ 6xxx, ExxxIncrement and skip if 0
CLA7800Clear AC
CLE7400Clear E(overflow bit)
CMA7200Complement AC
CME7100Complement E
CIR7080Circulate right AC and E
CIL7040Circulate left AC and E
INC7020Increment AC
SPA7010Skip next instruction if AC > 0
SNA7008Skip next instruction if AC < 0
SZA7004Skip next instruction if AC = 0
SZE7002Skip next instruction if E = 0
HLT7001Halt computer
INPF800Input character to AC
OUTF400Output character from AC
SKIF200Skip on input flag
SKOF100Skip on output flag
IONF080Interrupt On
IOFF040Interrupt Off

Note: In the given table,

  1. AC (Accumulator): A register that temporarily stores data during arithmetic or logic operations.
  2. 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

  • Computer Organization - Instruction Formats
  • Computer Organization and Architecture Tutorials
  • Computer Organization - Addressing Mode

Next Article
Computer Organization | Instruction Formats (Zero, One, Two and Three Address Instruction)

A

aastha98
Improve
Article Tags :
  • Computer Organization & Architecture

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
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences