Skip to main content

Instructions & I/O Subsystems


Q.1. What is an Instruction?

Ans.: An instruction is a command given to the computer to perform a specified operation on given data. Each instruction consists of 2 parts: an opcode and an operand. The first part of an instruction, which specifies the operation, to be performed is known as opcode. The second part of an instruction called operand is the data on which computer perform the specified operation.
As a computer understands instructions only in the form of 0 & 1, instruction and data are fed into the computer is a binary form. They are written in binary codes known as machine codes. For the convenience of this user the codes can be written in hexical form.
Instructions are classified into the following three types according to their word length :
(i) Single Byte Instruction
(ii) Two Byte Instruction
(iii) Three Byte Instruction



Q.2. Explain about the I/O Subsystem.

Ans.: The Input-Output devices and secondary units of a computer are called peripherals. The term peripheral is used in a under sense includes interfacing devices such as I/P port, programmable peripheral interface, DMA controller, communication interface, counter / internal timers etc.(i) I/P Devices : Data & instruction are entered into a computer through I/P devices. An I/P device converts I/P data & instruction into suitable binary form which can be accepted by the computer. Examples of I/P devices are:
(a) keyboards
(b) Mouse
(c) Joystick
(d) Trackball
(e) Touch screen etc.
(ii) O/P Devices : The O/P devices receive information from the computer & provide them to the users. The computer sends information to the O/P devices in binary coded forms. The O/P devices count them into a form which can be used by users such as printed form or display on a screen.


Q.3. Explain CPU Organization.

Ans.: The CPU is the brain of the computer. Its main function is to execute programs. It has three main sections :
(i) Arithmetic & Logical Units (ALU)
(ii) Control Unit
(iii) Accumulator & General & Special Purpose Registers
(i) ALU : The function of an ALU is to perform basic arithmetic & logical operation take
(a) Addition
(b) Subtraction etc.
It cannot perform exponential, logarithmic, trigonometric operations.

(ii) Control Unit : The control units of a CPU controls the entire operation of the computer. It also controls all other devices such as memory input & output devices. It fetcher instruction from the memory, decodes the instruction, interprets the instruction to know what tasks are to be performed & sends suitable control signals to the other components toperform further operation. It maintains the order & directs the operation of the entire system. It controls the data flow between CPU & peripherals.
Under the control of the CU the instructions are fetched from the memory one after another for execution until all the instructions are executed.

(iii) Register : A CPU contains a number of register to store data temporarily during the execution of a program. The number of registers differs from processor to processor. Register are classified as follows :

(a) General Purpose Registers : There registers store data & intermediate results during execution of a program. They are accessible to users through instructions if the users are working in assembly language.

(b) Accumulator : Its the most important GPR having multiple functions. It‟s most efficient in data movement, arithmetic and logical operation. It has some special features that the other GPR do not have. After the execution of arithmetic and logical instruction the result is placed in the accumulator.

(iii) Special Purpose Register : A CPU contains a number of special purpose register for different purposes. There are :

(a) Program Counter (PC)
(b) Stack Pointer (SP)
(c) Instruction Register (IR)
(d) Index Register
(e) Memory Address Register (MAR)
(f) Memory Buffer Register (MBR)

(a) PC : The PC keeps track of the address of the instruction which is to be executed next. So it holds the address of this memory location, which contains the rent instruction to be fetched from the memory.

(b) Stack Pointer (SP) : The stack is a sequence of memory location defined by the user. It‟s used to save the contents of a register if it‟s required during the execution of a program. The SP holds the address of the last occupied memory location of the stack.(c) Status Register (Flag Register) : A flag register contains a number of flags either to indicate certain conditions arising after ALU operation or to control certain operations. The flags which indicate a condition are called control flags. The flags which are used to control certain operation are called control flags.



A single micro processor contains the following condition flags :
(1) Carry Flag : Indicates whether there is a carry not.
(2) Zero Flag : Indicates whether the result is zero or non zero.
(3) Sign Flag : Indicates whether the result is positive or negative.
(4) Parity Flag : Indicates whether the result contains odd number of 1‟s or even number of 1‟s.

(d) Instruction Register : It holds the instruction to be decoded.

(e) Index Register : They are used for addressing. One or more registers are designated as index register. The address of an operand is the sum of the contents of the index registers and a constant. Instruction involving index register contain constants. This constant is added to the contents of index register to form the effective address.

(f) Memory Address Register (MAR) : It holds the address of the instruction or data to be fetched from the memory. The CPU transfers the address of the next instruction from the PC to MAR. From MAR it‟s sent to be memory through the address bus.

(g) Memory Buffer Register (MBR) : It holds the instruction code or data received from on sent to the memory. It‟s connected to data bus. The data, which are written into the memory are held in this register until the next operation is completed.


Q.4. What is System Bus and what are its different architecture and standards?

Ans.: Memory & peripheral devices are connected to the processor through a group of lines called a Bus. Three types of buses namely : Address Bus, Data Bus & Control Bus have already been discussed. Important bus standards are :
(i) ISA Bus (ii) PCI Bus
(iii) AGP (iv) EISA


Popular posts from this blog

C++ Program to find the sum, difference, product and quotient of two integers

#include <iostream.h> #include <conio.h> void main() {   clrscr();   int x = 10;   int y = 2;   int sum, difference, product, quotient;   sum = x + y;   difference = x - y;   product = x * y;   quotient = x / y;   cout << "The sum of " << x << " & " << y << " is " << sum << "." << endl;   cout << "The difference of " << x << " & " << "y <<  is " << difference << "." << endl;   cout << "The product of " << x << " & " << y << " is " << product << "." << endl;   cout << "The quotient of " << x << " & " << y << " is " << quotient << "." << endl;   getch(); }

Program of virtual piano

//////////////Tested And Created By C++/////////////////////////////// #include<stdio.h> #include<dos.h> #include<conio.h> #include<stdlib.h> #define SHOW 1 #define HIDE 2 union REGS input,output; class piano {  public:int BIGKEY,MIDKEY,back,border;     piano()//init constructor     {         BIGKEY=15;         MIDKEY=1;         back=7;         border=15;     } }color; void drawpiano(int x,int y); int check_xy(int x,int y); void BOX(int c,int r,int c1,int r1,int col); int initmouse(); void setupscreen(); void pointer(int on); void restrictmouse(int x1,int y1,int x2,int y2); void check_keys(int x,int y); void getmouse(int *button,int *x,int *y); float freq[7] = {130.81, 146.83, 164.81, 174.61,196, 220, 246.94 } ; int n=0,a=4,backcolor=2,exitcode=1; void showbar(int t) {  if(t>65) t=65;  if(t<1) t=1;  textcolor(15);  for(int q=0;q<=t;t++)  {     gotoxy(3+q,4);     cprintf("Û");  } } void main() {  int

Putimage function in c

putimage function outputs a bit image onto the screen. Declaration:- void putimage(int left, int top, void *ptr, int op); putimage puts the bit image previously saved with getimage back onto the screen, with the upper left corner of the image placed at (left, top). ptr points to the area in memory where the source image is stored. The op argument specifies a operator that controls how the color for each destination pixel on screen is computed, based on pixel already on screen and the corresponding source pixel in memory. c smiling face animation This animation using c draws a smiling face which appears at random position on screen. See output below the code, it will help you in understanding the code easily. C programming code #include<graphics.h> #include<conio.h> #include<stdlib.h>   main() { int gd = DETECT, gm, area, temp1, temp2, left = 25, top = 75; void *p;   initgraph(&gd,&gm,"C:\\TC\\BGI");   setcolor(YELLOW);