SlideShare a Scribd company logo
Introduction to Registers 
A register is a very small amount of very fast memory that is built into the CPU (central 
processing unit) in order to speed up its operations by providing quick access to commonly used 
values. Registers are the top of the memory hierarchy and are the fastest way for the system to 
manipulate data. Registers are normally measured by the number of bits they can hold, for 
example, an 8-bit register means it can store 8 bits of data or a 32-bit register means it can 
store 32 bit of data. 
Registers are used to store data temporarily during the execution of a program. Some of the 
registers are accessible to the user through instructions. 
Registers are divided in 5 major categories: 
1. General Purpose Registers 
2. Pointer Registers 
3. Index Registers 
4. Segment Registers 
5. Flag Registers 
General Purpose Registers: 
There are four General Purpose Registers named as follows: 
1. AX (Accumulator Register): commonly used for arithmetic & logic data transfer. 
2. BX (Base Address Register): used to save the address of memory location. 
3. CX (Count Register): keeps record of iterations while a LOOP instruction is running. 
4. DX (Data Register): holds data of the instruction currently being executed. 
Pointer Registers: 
There are three pointer registers that are used to point toward some memory address. 
1. BP (Base Pointer): points to the base element of the stack. 
2. SP (Stack Pointer): always points to the top element of the stack. 
3. IP (Instruction Pointer): stores the address of the next instruction to be executed.
Index Registers: 
Index registers are used for indexed addressing and sometimes also used in addition and 
subtraction. There are two sets of index registers: 
1. SI (Source Index): used as source index for string operations. 
2. DI (Destination Index): used as destination index for string operations. 
Segment Registers: 
Segments are specific areas defined in a program for containing data, code and stack. There are 
three main segments: 
1. Code Segment: it contains all the instructions to be executed. 
2. Data Segment: it contains data, constants and work areas. 
3. Stack Segment: it contains data and return addresses of procedures or subroutines. It is 
implemented as a 'stack' data structure. 
Flag Registers: 
These registers are programmable. It can be used to store and transfer the data from the 
registers by using instruction. 
The common flag bits are: 
 Overflow Flag (OF): indicates the overflow of a high-order bit (leftmost bit) of data after 
a signed arithmetic operation. 
 Direction Flag (DF): determines left or right direction for moving or comparing string 
data. When the DF value is 0, the string operation takes left-to-right direction and when 
the value is set to 1, the string operation takes right-to-left direction. 
 Interrupt Flag (IF): determines whether the external interrupts like keyboard entry, etc., 
are to be ignored or processed. It disables the external interrupt when the value is 0 and 
enables interrupts when set to 1. 
 Trap Flag (TF): allows setting the operation of the processor in single-step mode. The 
DEBUG program we used sets the trap flag, so we could step through the execution one 
instruction at a time. 
 Sign Flag (SF): shows the sign of the result of an arithmetic operation. This flag is set 
according to the sign of a data item following the arithmetic operation. The sign is
indicated by the high-order of leftmost bit. A positive result clears the value of SF to 0 
and negative result sets it to 1. 
 Zero Flag (ZF): indicates the result of an arithmetic or comparison operation. A nonzero 
result clears the zero flag to 0, and a zero result sets it to 1. 
 Auxiliary Carry Flag (AF): contains the carry from bit 3 to bit 4 following an arithmetic 
operation; used for specialized arithmetic. The AF is set when a 1-byte arithmetic 
operation causes a carry from bit 3 into bit 4. 
 Parity Flag (PF): indicates the total number of 1-bits in the result obtained from an 
arithmetic operation. An even number of 1-bits clears the parity flag to 0 and an odd 
number of 1-bits sets the parity flag to 1. 
 Carry Flag (CF): contains the carry of 0 or 1 from a high-order bit (leftmost) after an 
arithmetic operation. It also stores the contents of last bit of a shift or rotate operation.

More Related Content

What's hot

INTERRUPTS OF 8086 MICROPROCESSOR
INTERRUPTS OF 8086 MICROPROCESSORINTERRUPTS OF 8086 MICROPROCESSOR
INTERRUPTS OF 8086 MICROPROCESSOR
Gurudev joshi
 
Stack and its usage in assembly language
Stack and its usage in assembly language Stack and its usage in assembly language
Stack and its usage in assembly language
Usman Bin Saad
 
8085 DATA TRANSFER INSTRUCTIONS
8085 DATA TRANSFER INSTRUCTIONS8085 DATA TRANSFER INSTRUCTIONS
8085 DATA TRANSFER INSTRUCTIONS
RamaPrabha24
 
Compiler Design Basics
Compiler Design BasicsCompiler Design Basics
Compiler Design Basics
Akhil Kaushik
 
Cpu registers
Cpu registersCpu registers
Cpu registers
Puneet Rajput
 
Register Transfer Language,Bus and Memory Transfer
Register Transfer Language,Bus and Memory TransferRegister Transfer Language,Bus and Memory Transfer
Register Transfer Language,Bus and Memory Transfer
lavanya marichamy
 
Unit 4-booth algorithm
Unit 4-booth algorithmUnit 4-booth algorithm
Unit 4-booth algorithm
vishal choudhary
 
Acid properties
Acid propertiesAcid properties
Acid properties
NomitaKumawat
 
Memory Reference Instructions
Memory Reference InstructionsMemory Reference Instructions
Memory Reference Instructions
Rabin BK
 
Computer Organization and Architecture.
Computer Organization and Architecture.Computer Organization and Architecture.
Computer Organization and Architecture.
CS_GDRCST
 
Internal architecture-of-8086
Internal architecture-of-8086Internal architecture-of-8086
Internal architecture-of-8086
Estiak Khan
 
Memory reference instruction
Memory reference instructionMemory reference instruction
Memory reference instruction
Sanjeev Patel
 
Processor Organization and Architecture
Processor Organization and ArchitectureProcessor Organization and Architecture
Processor Organization and Architecture
Vinit Raut
 
Compilers
CompilersCompilers
Compilers
Bense Tony
 
Register introduction
Register introductionRegister introduction
Register introduction
maamir farooq
 
Registers
RegistersRegisters
Registers
Sanjeev Patel
 
Computer architecture instruction formats
Computer architecture instruction formatsComputer architecture instruction formats
Computer architecture instruction formats
Mazin Alwaaly
 
Memory organization
Memory organizationMemory organization
Memory organization
Dhaval Bagal
 
Linker and Loader
Linker and Loader Linker and Loader
Linker and Loader
sonalikharade3
 

What's hot (20)

INTERRUPTS OF 8086 MICROPROCESSOR
INTERRUPTS OF 8086 MICROPROCESSORINTERRUPTS OF 8086 MICROPROCESSOR
INTERRUPTS OF 8086 MICROPROCESSOR
 
Stack and its usage in assembly language
Stack and its usage in assembly language Stack and its usage in assembly language
Stack and its usage in assembly language
 
8085 DATA TRANSFER INSTRUCTIONS
8085 DATA TRANSFER INSTRUCTIONS8085 DATA TRANSFER INSTRUCTIONS
8085 DATA TRANSFER INSTRUCTIONS
 
Compiler Design Basics
Compiler Design BasicsCompiler Design Basics
Compiler Design Basics
 
Cpu registers
Cpu registersCpu registers
Cpu registers
 
Register Transfer Language,Bus and Memory Transfer
Register Transfer Language,Bus and Memory TransferRegister Transfer Language,Bus and Memory Transfer
Register Transfer Language,Bus and Memory Transfer
 
Unit 4-booth algorithm
Unit 4-booth algorithmUnit 4-booth algorithm
Unit 4-booth algorithm
 
Acid properties
Acid propertiesAcid properties
Acid properties
 
Memory Reference Instructions
Memory Reference InstructionsMemory Reference Instructions
Memory Reference Instructions
 
Computer Organization and Architecture.
Computer Organization and Architecture.Computer Organization and Architecture.
Computer Organization and Architecture.
 
Internal architecture-of-8086
Internal architecture-of-8086Internal architecture-of-8086
Internal architecture-of-8086
 
Memory reference instruction
Memory reference instructionMemory reference instruction
Memory reference instruction
 
Processor Organization and Architecture
Processor Organization and ArchitectureProcessor Organization and Architecture
Processor Organization and Architecture
 
Compilers
CompilersCompilers
Compilers
 
Register introduction
Register introductionRegister introduction
Register introduction
 
Registers
RegistersRegisters
Registers
 
Computer architecture instruction formats
Computer architecture instruction formatsComputer architecture instruction formats
Computer architecture instruction formats
 
Ascii codes
Ascii codesAscii codes
Ascii codes
 
Memory organization
Memory organizationMemory organization
Memory organization
 
Linker and Loader
Linker and Loader Linker and Loader
Linker and Loader
 

Similar to Introduction to CPU registers

N_Asm Assembly registers (sol)
N_Asm Assembly registers (sol)N_Asm Assembly registers (sol)
N_Asm Assembly registers (sol)
Selomon birhane
 
SAQIB ALI.pptx
SAQIB ALI.pptxSAQIB ALI.pptx
SAQIB ALI.pptx
astik11
 
intel 8086 introduction
intel 8086 introductionintel 8086 introduction
intel 8086 introduction
Homoud Alsohaibi
 
Advanced micro -processor
Advanced micro -processorAdvanced micro -processor
Advanced micro -processor
Hinal Lunagariya
 
Computer Organization and 8085 microprocessor notes
Computer Organization and 8085 microprocessor notesComputer Organization and 8085 microprocessor notes
Computer Organization and 8085 microprocessor notes
Lakshmi Sarvani Videla
 
Assembly language (Example with mapping from C++ to Assembly)
Assembly language (Example with mapping from C++ to Assembly)Assembly language (Example with mapping from C++ to Assembly)
Assembly language (Example with mapping from C++ to Assembly)
Tish997
 
Amp
AmpAmp
Chapter 2
Chapter 2Chapter 2
microprocessor
 microprocessor microprocessor
microprocessor
ATTO RATHORE
 
Unit 3 assembler and processor
Unit 3   assembler and processorUnit 3   assembler and processor
Unit 3 assembler and processorAbha Damani
 
microprocessor_part_3_compressed_1588259301.pdf
microprocessor_part_3_compressed_1588259301.pdfmicroprocessor_part_3_compressed_1588259301.pdf
microprocessor_part_3_compressed_1588259301.pdf
ssuserd21262
 
Registers
RegistersRegisters
Registers
waqar bashir
 
the-cpu-design-central-processing-unit-design-1
the-cpu-design-central-processing-unit-design-1the-cpu-design-central-processing-unit-design-1
the-cpu-design-central-processing-unit-design-1
Basel Mansour
 
Register & flags
Register & flagsRegister & flags
Register & flags
fazli khaliq
 
Microprocessors
MicroprocessorsMicroprocessors
Microprocessors
chaitanyaambati3
 
Malware Analysis - x86 Disassembly
Malware Analysis - x86 DisassemblyMalware Analysis - x86 Disassembly
Malware Analysis - x86 Disassembly
Natraj G
 
Introduction to Operating Systems
 Introduction to Operating Systems Introduction to Operating Systems
Introduction to Operating Systems
Jérôme Kehrli
 
Assembly language programming intro
Assembly language programming introAssembly language programming intro
Assembly language programming intro
United International University
 
Intel Microprocessors 8086 Documentation
Intel Microprocessors 8086 DocumentationIntel Microprocessors 8086 Documentation
Intel Microprocessors 8086 Documentation
Adeel Rasheed
 
digital communication,micro processor,pulse and digital circuits
digital communication,micro processor,pulse and digital circuitsdigital communication,micro processor,pulse and digital circuits
digital communication,micro processor,pulse and digital circuitsManasa Mona
 

Similar to Introduction to CPU registers (20)

N_Asm Assembly registers (sol)
N_Asm Assembly registers (sol)N_Asm Assembly registers (sol)
N_Asm Assembly registers (sol)
 
SAQIB ALI.pptx
SAQIB ALI.pptxSAQIB ALI.pptx
SAQIB ALI.pptx
 
intel 8086 introduction
intel 8086 introductionintel 8086 introduction
intel 8086 introduction
 
Advanced micro -processor
Advanced micro -processorAdvanced micro -processor
Advanced micro -processor
 
Computer Organization and 8085 microprocessor notes
Computer Organization and 8085 microprocessor notesComputer Organization and 8085 microprocessor notes
Computer Organization and 8085 microprocessor notes
 
Assembly language (Example with mapping from C++ to Assembly)
Assembly language (Example with mapping from C++ to Assembly)Assembly language (Example with mapping from C++ to Assembly)
Assembly language (Example with mapping from C++ to Assembly)
 
Amp
AmpAmp
Amp
 
Chapter 2
Chapter 2Chapter 2
Chapter 2
 
microprocessor
 microprocessor microprocessor
microprocessor
 
Unit 3 assembler and processor
Unit 3   assembler and processorUnit 3   assembler and processor
Unit 3 assembler and processor
 
microprocessor_part_3_compressed_1588259301.pdf
microprocessor_part_3_compressed_1588259301.pdfmicroprocessor_part_3_compressed_1588259301.pdf
microprocessor_part_3_compressed_1588259301.pdf
 
Registers
RegistersRegisters
Registers
 
the-cpu-design-central-processing-unit-design-1
the-cpu-design-central-processing-unit-design-1the-cpu-design-central-processing-unit-design-1
the-cpu-design-central-processing-unit-design-1
 
Register & flags
Register & flagsRegister & flags
Register & flags
 
Microprocessors
MicroprocessorsMicroprocessors
Microprocessors
 
Malware Analysis - x86 Disassembly
Malware Analysis - x86 DisassemblyMalware Analysis - x86 Disassembly
Malware Analysis - x86 Disassembly
 
Introduction to Operating Systems
 Introduction to Operating Systems Introduction to Operating Systems
Introduction to Operating Systems
 
Assembly language programming intro
Assembly language programming introAssembly language programming intro
Assembly language programming intro
 
Intel Microprocessors 8086 Documentation
Intel Microprocessors 8086 DocumentationIntel Microprocessors 8086 Documentation
Intel Microprocessors 8086 Documentation
 
digital communication,micro processor,pulse and digital circuits
digital communication,micro processor,pulse and digital circuitsdigital communication,micro processor,pulse and digital circuits
digital communication,micro processor,pulse and digital circuits
 

More from Muhammad Waqas

Image processing (Signal Processing)
Image processing (Signal Processing)Image processing (Signal Processing)
Image processing (Signal Processing)
Muhammad Waqas
 
Windows 98 vs Windows 200
Windows 98 vs Windows 200Windows 98 vs Windows 200
Windows 98 vs Windows 200
Muhammad Waqas
 
Six exercises to relieve back pain at your workplace
Six exercises to relieve back pain at your workplaceSix exercises to relieve back pain at your workplace
Six exercises to relieve back pain at your workplace
Muhammad Waqas
 
Object Oriented Programming Using C++
Object Oriented Programming Using C++Object Oriented Programming Using C++
Object Oriented Programming Using C++
Muhammad Waqas
 
Engineering Numerical Analysis Lecture-1
Engineering Numerical Analysis Lecture-1Engineering Numerical Analysis Lecture-1
Engineering Numerical Analysis Lecture-1
Muhammad Waqas
 
Chapter7 Computer Networks
Chapter7 Computer NetworksChapter7 Computer Networks
Chapter7 Computer Networks
Muhammad Waqas
 
Chapter5 Storage
Chapter5 StorageChapter5 Storage
Chapter5 Storage
Muhammad Waqas
 
Chapter4 Data Processing
Chapter4 Data ProcessingChapter4 Data Processing
Chapter4 Data Processing
Muhammad Waqas
 
Chapter1 introduction to computer systems
Chapter1 introduction to computer systemsChapter1 introduction to computer systems
Chapter1 introduction to computer systems
Muhammad Waqas
 

More from Muhammad Waqas (9)

Image processing (Signal Processing)
Image processing (Signal Processing)Image processing (Signal Processing)
Image processing (Signal Processing)
 
Windows 98 vs Windows 200
Windows 98 vs Windows 200Windows 98 vs Windows 200
Windows 98 vs Windows 200
 
Six exercises to relieve back pain at your workplace
Six exercises to relieve back pain at your workplaceSix exercises to relieve back pain at your workplace
Six exercises to relieve back pain at your workplace
 
Object Oriented Programming Using C++
Object Oriented Programming Using C++Object Oriented Programming Using C++
Object Oriented Programming Using C++
 
Engineering Numerical Analysis Lecture-1
Engineering Numerical Analysis Lecture-1Engineering Numerical Analysis Lecture-1
Engineering Numerical Analysis Lecture-1
 
Chapter7 Computer Networks
Chapter7 Computer NetworksChapter7 Computer Networks
Chapter7 Computer Networks
 
Chapter5 Storage
Chapter5 StorageChapter5 Storage
Chapter5 Storage
 
Chapter4 Data Processing
Chapter4 Data ProcessingChapter4 Data Processing
Chapter4 Data Processing
 
Chapter1 introduction to computer systems
Chapter1 introduction to computer systemsChapter1 introduction to computer systems
Chapter1 introduction to computer systems
 

Recently uploaded

LORRAINE ANDREI_LEQUIGAN_GOOGLE CALENDAR
LORRAINE ANDREI_LEQUIGAN_GOOGLE CALENDARLORRAINE ANDREI_LEQUIGAN_GOOGLE CALENDAR
LORRAINE ANDREI_LEQUIGAN_GOOGLE CALENDAR
lorraineandreiamcidl
 
欧洲杯冠军-欧洲杯冠军网站-欧洲杯冠军|【​网址​🎉ac123.net🎉​】领先全球的买球投注平台
欧洲杯冠军-欧洲杯冠军网站-欧洲杯冠军|【​网址​🎉ac123.net🎉​】领先全球的买球投注平台欧洲杯冠军-欧洲杯冠军网站-欧洲杯冠军|【​网址​🎉ac123.net🎉​】领先全球的买球投注平台
欧洲杯冠军-欧洲杯冠军网站-欧洲杯冠军|【​网址​🎉ac123.net🎉​】领先全球的买球投注平台
andreassenrolf537
 
Building a Raspberry Pi Robot with Dot NET 8, Blazor and SignalR - Slides Onl...
Building a Raspberry Pi Robot with Dot NET 8, Blazor and SignalR - Slides Onl...Building a Raspberry Pi Robot with Dot NET 8, Blazor and SignalR - Slides Onl...
Building a Raspberry Pi Robot with Dot NET 8, Blazor and SignalR - Slides Onl...
Peter Gallagher
 
Schematic Diagram MSI MS-7309 - REV 1.0 PDF .pdf
Schematic Diagram MSI MS-7309 - REV 1.0 PDF .pdfSchematic Diagram MSI MS-7309 - REV 1.0 PDF .pdf
Schematic Diagram MSI MS-7309 - REV 1.0 PDF .pdf
nikoloco007
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证如何办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证如何办理一比一原版(IIT毕业证)伊利诺伊理工大学毕业证如何办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证如何办理
aozcue
 
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证如何办理
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证如何办理一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证如何办理
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证如何办理
peuce
 
一比一原版(UCSB毕业证)圣塔芭芭拉社区大学毕业证如何办理
一比一原版(UCSB毕业证)圣塔芭芭拉社区大学毕业证如何办理一比一原版(UCSB毕业证)圣塔芭芭拉社区大学毕业证如何办理
一比一原版(UCSB毕业证)圣塔芭芭拉社区大学毕业证如何办理
aozcue
 
天博体育下载-可靠的网络天博体育下载-网络天博体育下载|【​网址​🎉ac123.net🎉​】
天博体育下载-可靠的网络天博体育下载-网络天博体育下载|【​网址​🎉ac123.net🎉​】天博体育下载-可靠的网络天博体育下载-网络天博体育下载|【​网址​🎉ac123.net🎉​】
天博体育下载-可靠的网络天博体育下载-网络天博体育下载|【​网址​🎉ac123.net🎉​】
arcosarturo900
 

Recently uploaded (8)

LORRAINE ANDREI_LEQUIGAN_GOOGLE CALENDAR
LORRAINE ANDREI_LEQUIGAN_GOOGLE CALENDARLORRAINE ANDREI_LEQUIGAN_GOOGLE CALENDAR
LORRAINE ANDREI_LEQUIGAN_GOOGLE CALENDAR
 
欧洲杯冠军-欧洲杯冠军网站-欧洲杯冠军|【​网址​🎉ac123.net🎉​】领先全球的买球投注平台
欧洲杯冠军-欧洲杯冠军网站-欧洲杯冠军|【​网址​🎉ac123.net🎉​】领先全球的买球投注平台欧洲杯冠军-欧洲杯冠军网站-欧洲杯冠军|【​网址​🎉ac123.net🎉​】领先全球的买球投注平台
欧洲杯冠军-欧洲杯冠军网站-欧洲杯冠军|【​网址​🎉ac123.net🎉​】领先全球的买球投注平台
 
Building a Raspberry Pi Robot with Dot NET 8, Blazor and SignalR - Slides Onl...
Building a Raspberry Pi Robot with Dot NET 8, Blazor and SignalR - Slides Onl...Building a Raspberry Pi Robot with Dot NET 8, Blazor and SignalR - Slides Onl...
Building a Raspberry Pi Robot with Dot NET 8, Blazor and SignalR - Slides Onl...
 
Schematic Diagram MSI MS-7309 - REV 1.0 PDF .pdf
Schematic Diagram MSI MS-7309 - REV 1.0 PDF .pdfSchematic Diagram MSI MS-7309 - REV 1.0 PDF .pdf
Schematic Diagram MSI MS-7309 - REV 1.0 PDF .pdf
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证如何办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证如何办理一比一原版(IIT毕业证)伊利诺伊理工大学毕业证如何办理
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证如何办理
 
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证如何办理
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证如何办理一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证如何办理
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证如何办理
 
一比一原版(UCSB毕业证)圣塔芭芭拉社区大学毕业证如何办理
一比一原版(UCSB毕业证)圣塔芭芭拉社区大学毕业证如何办理一比一原版(UCSB毕业证)圣塔芭芭拉社区大学毕业证如何办理
一比一原版(UCSB毕业证)圣塔芭芭拉社区大学毕业证如何办理
 
天博体育下载-可靠的网络天博体育下载-网络天博体育下载|【​网址​🎉ac123.net🎉​】
天博体育下载-可靠的网络天博体育下载-网络天博体育下载|【​网址​🎉ac123.net🎉​】天博体育下载-可靠的网络天博体育下载-网络天博体育下载|【​网址​🎉ac123.net🎉​】
天博体育下载-可靠的网络天博体育下载-网络天博体育下载|【​网址​🎉ac123.net🎉​】
 

Introduction to CPU registers

  • 1. Introduction to Registers A register is a very small amount of very fast memory that is built into the CPU (central processing unit) in order to speed up its operations by providing quick access to commonly used values. Registers are the top of the memory hierarchy and are the fastest way for the system to manipulate data. Registers are normally measured by the number of bits they can hold, for example, an 8-bit register means it can store 8 bits of data or a 32-bit register means it can store 32 bit of data. Registers are used to store data temporarily during the execution of a program. Some of the registers are accessible to the user through instructions. Registers are divided in 5 major categories: 1. General Purpose Registers 2. Pointer Registers 3. Index Registers 4. Segment Registers 5. Flag Registers General Purpose Registers: There are four General Purpose Registers named as follows: 1. AX (Accumulator Register): commonly used for arithmetic & logic data transfer. 2. BX (Base Address Register): used to save the address of memory location. 3. CX (Count Register): keeps record of iterations while a LOOP instruction is running. 4. DX (Data Register): holds data of the instruction currently being executed. Pointer Registers: There are three pointer registers that are used to point toward some memory address. 1. BP (Base Pointer): points to the base element of the stack. 2. SP (Stack Pointer): always points to the top element of the stack. 3. IP (Instruction Pointer): stores the address of the next instruction to be executed.
  • 2. Index Registers: Index registers are used for indexed addressing and sometimes also used in addition and subtraction. There are two sets of index registers: 1. SI (Source Index): used as source index for string operations. 2. DI (Destination Index): used as destination index for string operations. Segment Registers: Segments are specific areas defined in a program for containing data, code and stack. There are three main segments: 1. Code Segment: it contains all the instructions to be executed. 2. Data Segment: it contains data, constants and work areas. 3. Stack Segment: it contains data and return addresses of procedures or subroutines. It is implemented as a 'stack' data structure. Flag Registers: These registers are programmable. It can be used to store and transfer the data from the registers by using instruction. The common flag bits are:  Overflow Flag (OF): indicates the overflow of a high-order bit (leftmost bit) of data after a signed arithmetic operation.  Direction Flag (DF): determines left or right direction for moving or comparing string data. When the DF value is 0, the string operation takes left-to-right direction and when the value is set to 1, the string operation takes right-to-left direction.  Interrupt Flag (IF): determines whether the external interrupts like keyboard entry, etc., are to be ignored or processed. It disables the external interrupt when the value is 0 and enables interrupts when set to 1.  Trap Flag (TF): allows setting the operation of the processor in single-step mode. The DEBUG program we used sets the trap flag, so we could step through the execution one instruction at a time.  Sign Flag (SF): shows the sign of the result of an arithmetic operation. This flag is set according to the sign of a data item following the arithmetic operation. The sign is
  • 3. indicated by the high-order of leftmost bit. A positive result clears the value of SF to 0 and negative result sets it to 1.  Zero Flag (ZF): indicates the result of an arithmetic or comparison operation. A nonzero result clears the zero flag to 0, and a zero result sets it to 1.  Auxiliary Carry Flag (AF): contains the carry from bit 3 to bit 4 following an arithmetic operation; used for specialized arithmetic. The AF is set when a 1-byte arithmetic operation causes a carry from bit 3 into bit 4.  Parity Flag (PF): indicates the total number of 1-bits in the result obtained from an arithmetic operation. An even number of 1-bits clears the parity flag to 0 and an odd number of 1-bits sets the parity flag to 1.  Carry Flag (CF): contains the carry of 0 or 1 from a high-order bit (leftmost) after an arithmetic operation. It also stores the contents of last bit of a shift or rotate operation.