GENERAL PURPOSE & FLAG REGISTERS
Made by Asmita
Dept MCS
27/12/2017
REGISTERS
REGISTERS IN COMPUTERS
To speed up the processor operations,
the processor includes some internal memory
storage locations, called registers.
Registers
Processing element
Main Memory
Address bus
Data bus
Control bus
WHY REGISTERS????
TYPES OF REGISTERS::
GGGU • S
General Purpose
Used for more than one
purpose.
1.AX Accumlator
2.BX Base
3.CX Count
4.DX Destination
X=SIZE
AH AL
Special Purpose
Used for only one purpose for which
they are made.
1.IP/(PC)= instruction pointer.
2.IR=instuction registers.
3.BP=base pointer.
4.SP=stack pointer.
5.SI=source index registers.
6.DI=destination registers.
7.CS= code segment registers.
8.DS=data segment registers
9.ES=extra segment registers
10.SS=stack segment registers.
AX
CPU word size/ CPU width
 Its mean how many NO. of bits that can be
processed by processor.
0 1 2 3 4 5
A
Base Registers = Starting Address
For(int i=0; i<10; i++)
Cout<<“welcome”;
Num1*Num2 = 38 bits answer
General purpose also uses
in
 Takes input.
 Display output.
 Stores intermediate results.
Flags  A flag is a piece of
fabric (most often
rectangular or
quadrilateral) with
a distinctive
design that is used
as a symbol, as a
signaling device,
or as decoration.
Flag registers of 8086
Carry flag
1
1100 1000 ax
+
1101 0010 bx
_________________
11101 1010
If there comes a carry then the value of carry flag
becomes 1
Otherwise 0
Parity flag
 Used for error detection and correction.
 To ensure that the received data is exactly as
it is as send data.
Regiters RAM
1 1 0 1 0 1 1 01 1 0 000
Due to voltage
Send data Lost /corrupt
P
0
Flag registerEVEN parity
If 1’s is even=0
If 1’s is odd=1
Auxilary flag
1 1
0100 1100
+
1100 1110
________________________
10001 1110
Z
0
A
1
C
1
Flag registers
Zero flag
2
_
2
________
0
(here the value of zero register will be 1)
When the ans=0
Then the zero flag become 1
Otherwise 0.
Sign registers
2
+
-6
_________
4
6
+
2
_______
8
S
0
For positive value it
becomes=0
Otherwise=1
Trap flag
 Used to facilitate debugger.
 Executes each line of code, values in
variables.
 When trap flag =1,
 It Goes in single step execution mode.
 And tells which value is in variables, in
registers and all information.
_________________________
________________________
________________________
Interrupt flag
 A signal generated by h/w or s/w for getting CPU attention.
 If the value of interrupt register =1
 Than the CPU leave its work and works on interrupt.
 But if the value =0, then CPU Continue its own work and
ignores interrupt.
 Flag register
 Interrupt
I
1
CPU
Programmable Interupt Controller
PIC CPU
I
0
INTERRUPT
FLAG Register
Direction flag
 Tells us In which direction the processing of
string will happen?
 If the value of direction flag=0, then the string
processing starts from left to right.
 But if the value=1 , then its display the string
from high index to low index means from right to
left.
 “IloveAssembly”
 “ylbmessAevolI”
Overflow flags
 n1* n2= answer more than 16 bits.
 n1+n2= 17 bits.
 A register can store maximum 16 bits of data.
 So when the answer comes more than the 16 bit,
the execding data will be waste,
 So this register tells us that your data will be
waste and the value of overflow register
becomes =1
 Otherwise =0.
Flag registers (assembly language) with types and examples

Flag registers (assembly language) with types and examples

  • 1.
    GENERAL PURPOSE &FLAG REGISTERS Made by Asmita Dept MCS 27/12/2017
  • 2.
  • 3.
    REGISTERS IN COMPUTERS Tospeed up the processor operations, the processor includes some internal memory storage locations, called registers.
  • 4.
    Registers Processing element Main Memory Addressbus Data bus Control bus WHY REGISTERS????
  • 5.
    TYPES OF REGISTERS:: GGGU• S General Purpose Used for more than one purpose. 1.AX Accumlator 2.BX Base 3.CX Count 4.DX Destination X=SIZE AH AL Special Purpose Used for only one purpose for which they are made. 1.IP/(PC)= instruction pointer. 2.IR=instuction registers. 3.BP=base pointer. 4.SP=stack pointer. 5.SI=source index registers. 6.DI=destination registers. 7.CS= code segment registers. 8.DS=data segment registers 9.ES=extra segment registers 10.SS=stack segment registers. AX
  • 6.
    CPU word size/CPU width  Its mean how many NO. of bits that can be processed by processor.
  • 7.
    0 1 23 4 5 A Base Registers = Starting Address
  • 8.
    For(int i=0; i<10;i++) Cout<<“welcome”; Num1*Num2 = 38 bits answer
  • 9.
    General purpose alsouses in  Takes input.  Display output.  Stores intermediate results.
  • 10.
    Flags  Aflag is a piece of fabric (most often rectangular or quadrilateral) with a distinctive design that is used as a symbol, as a signaling device, or as decoration.
  • 11.
  • 12.
    Carry flag 1 1100 1000ax + 1101 0010 bx _________________ 11101 1010 If there comes a carry then the value of carry flag becomes 1 Otherwise 0
  • 13.
    Parity flag  Usedfor error detection and correction.  To ensure that the received data is exactly as it is as send data.
  • 14.
    Regiters RAM 1 10 1 0 1 1 01 1 0 000 Due to voltage Send data Lost /corrupt P 0 Flag registerEVEN parity If 1’s is even=0 If 1’s is odd=1
  • 15.
    Auxilary flag 1 1 01001100 + 1100 1110 ________________________ 10001 1110
  • 16.
  • 17.
    Zero flag 2 _ 2 ________ 0 (here thevalue of zero register will be 1) When the ans=0 Then the zero flag become 1 Otherwise 0.
  • 18.
  • 19.
    Trap flag  Usedto facilitate debugger.  Executes each line of code, values in variables.  When trap flag =1,  It Goes in single step execution mode.  And tells which value is in variables, in registers and all information. _________________________ ________________________ ________________________
  • 20.
    Interrupt flag  Asignal generated by h/w or s/w for getting CPU attention.  If the value of interrupt register =1  Than the CPU leave its work and works on interrupt.  But if the value =0, then CPU Continue its own work and ignores interrupt.  Flag register  Interrupt I 1 CPU
  • 21.
    Programmable Interupt Controller PICCPU I 0 INTERRUPT FLAG Register
  • 22.
    Direction flag  Tellsus In which direction the processing of string will happen?  If the value of direction flag=0, then the string processing starts from left to right.  But if the value=1 , then its display the string from high index to low index means from right to left.  “IloveAssembly”  “ylbmessAevolI”
  • 23.
    Overflow flags  n1*n2= answer more than 16 bits.  n1+n2= 17 bits.  A register can store maximum 16 bits of data.  So when the answer comes more than the 16 bit, the execding data will be waste,  So this register tells us that your data will be waste and the value of overflow register becomes =1  Otherwise =0.