SlideShare a Scribd company logo
1 of 31
Name          ID

DULAL CHANDRA BARMAN   00805010

MD.JAHURUL ISLAM       00805034

MD.EMDADUL HUQ         00805038

MD.FARUQ AHMED         00805047

ASHOK KUMAR SARKER     00805049
FLAG REGISTER
FLAGS Register:

   Individual bits control the action or represent the status of the
    processor

Control flags (TF, IF, DF):

   Determine how the processor responds to certain situations

Status flags (CF, PF, AF, ZF, SF, OF):

   Set to represent the result of certain operations

   Used to control conditional jump instructions
FLAG Register Bits:
Status Flags:                        Control Flags:

Bit         Name             Symb
                                ol   Bit   Name             Symb
                                                               ol
0         Carry flag          CF
                                     8     Trap flag        TF
2         Parity flag         PF
4     Auxiliary carry flag    AF     9     Interrupt flag   IF

6          Zero flag          ZF     10    Direction flag   DF
7          Sign flag          SF
11      Overflow flag         OF
Status Flags:

The Carry Flag (CF):
 CF = 1 if there is a carry out from the msb (most
  significant bit) on addition, or there is a borrow into the
  msb on subtraction
 CF = 0 otherwise
 CF is also affected by shift and rotate instructions


The Parity Flag (PF):
 PF = 1 if the low byte of a result has an even number
  of one bits (even parity)
 PF = 0 otherwise (odd parity)
The Auxiliary Carry Flag (AF):
 AF = 1 if there is a carry out from bit 3 on addition, or there is
  a borrow into the bit 3 on subtraction
 AF = 0 otherwise
 AF is used in binary-coded decimal (BCD) operations


The Zero Flag (ZF):
 ZF = 1 for a zero result
 ZF = 0 for a non-zero result


The Sign Flag (SF):
 SF = 1 if the msb of a result is 1; it means the result is
  negative if you are giving a signed interpretation
 SF = 0 if the msb is 0
The Overflow Flag (OF):
   OF = 1 if signed overflow occurred
   OF = 0 otherwise

Example 1. ADD AX,BX , where AX contains FFFFh , BX contains
  FFFFh.
Solution:        FFFFh
               + FFFFh
               1FFFEh
The result stored in AX is FFFEh=1111 1111 1111 1110
SF = 1 because the msb is 1
PF = 0 because there are 7(odd number) of 1 bits in the low byte of
  the result .
ZF = 0 because the result is nonzero.
CF = 1 because there is a carry out of the msb on addition.
OF = 0 because the sign of the stored result is the same as that of
  the numbers being added (as a binary addition, there is a carry
  into the msb and a carry out).
   Example 2. ADD AX, BX, where AX contains 7132h ,
    BX contains 7000h
   Solution:          7132h
                    + 7000h
                      E132h
   The result stored in AX is E132h=1110 0001 0011 0010
   SF = 1 because the msb is 1
   PF = 0 because there are 3(odd number) of 1 bits in the
    low byte of the result .
   ZF = 0 because the result is nonzero.
   CF = 0 because there is no a carry out of the msb on
    addition.
   OF = 1
   Example-3: SUB AX, BX , where AX contains 8000h and BX
    contains 0001h.
   Solution:        8000h
                   -0001h
                    7FFFh
   The result stored in AX is FFFEh=0111 1111 1111 1111
   SF = 0 because the msb is 0
   PF = 1 because there are 8(even number) of 1 bits in the low byte
    of the result .
   ZF = 0 because the result is nonzero.
   CF = 0 because a smaller unsigned number is being subtracted
    from a larger one.

   Now for OF. In a signal sense, we are subtracting a positive number
    from a negative one, which is like adding two negatives. Because
    the result is positive (the wrong sign), OF = 1.
OVERFLOW

 The overflow flag is set when the Most Significant
  Bit (MSB) is set or cleared.
 For example, take the addition of 127 and 127.
  The 8 bit signed binary number of 127 is
  represented as 0111 1111.
 The MSB (the bit to the far left) is 0. When these
  two 8 bit numbers are added the result is 254, or
  1111 1110. Notice now that the MSB is now 1 and
  not 0.
 Therefore, the overflow flag has been set. Here,
  1111 1110 would be interpreted as a negative
  number.
   The addition test shows whether the overflow
    flag has been set.
    If two positive operands generate a negative
    sum. For example, 0101 1100 and 0100 1010 is
    1010 0110, or -90.
   The MSB changed from 0 to 1.
   And the two negative operands generate a
    positive sum.
   For example 1100 0010 and 1000 0100 is
    01101000 or 104.
   The MSB changed from 1 to 0, so the overflow
    flag is being set.
    Overflow never occurs when the sign of two
    addition operands are different.
(Signed) Overflow
   Can only occur when adding numbers of the same sign (subtracting
    with different signs)

   Detected when carry into MSB is not equal to carry out of MSB

   Easily detected because this implies the result has a different sign
    than the sign of the operands

   Programs can ignore the Flags
   Example 4. ADD AX,BX , where AX and BX both contains 7FFFh .

Solution:
                 Hex                    Binary
                7FFFh            0111 1111 1111 1111
                7FFFh            0111 1111 1111 1111
                FFFEh            1111 1111 1111 1110
    The signed and unsigned interpretation of 7FFFh is 32767. Thus for
    both signed and unsigned
    addition,7FFFh+7FFFh=32767+32767=65534.This is out of range
    for signed numbers, the signed interpretation of the stored answer
    FFFEh is -2,so signed overflow occurred .However the unsigned
    interpretation of FFFEh is 65534,which is the right answer, so there
    is no unsigned overflow.
Unsigned overflow:
   On addition, unsigned overflow occurs when there is a carry out of
    the msb.
   On subtraction unsigned overflow occurs when there is a borrow
    into the msb.

  Example 5. ADD AX, BX, where AX contains FF12h, BX contains
   1ACBh.
Solution:
             FF12h
          + 1ACBh
          119DDh
The result is stored in AX is 19DDh=0001 11 111 1101
FF12h=-1 and 1ACBh=1, and FF12h+1ACBh=-1+1=0, so sign overflow
   did
not occur. Here a 1 is carried out of the msb, so unsigned overflow
   occurred.
The importance of flag registers:

Flag register has it's importance by following resion.
1. Sign flag: use to store the sign of any number under processing i.e
when arithmetical logic has negative sign it is in set condition. and
rest in reset.
2. Zero flag: when ALU operation is zero it is in reset condition.
3. Auxiliary carry flag: it hold the carry during internal processing of
addition ,sub , mul and div.
4. Parity flag: hold 1 for even parity,0 for odd parity.
5. Carry flag: hold carry after end of processing of operation.
FLAGS Register & Flow
  control Instruction

           Flags Register
  Individual bits control the action or
represent the status of the processor
Control flags (TF, IF, DF): Determine how
          the processor responds
            to certain situations
    Status flags (CF, PF, AF, ZF, SF, OF):
•     Set to represent the result of certain
                 operations
  •     Used to control conditional jump
                instructions
Flow Control Instructions:

In this assignment we will practice how to
control the flow of an assembly language
program using the compare instruction, the
different jump instructions and the loop
instructions.
Objectives:
1- Jump Instructions.
2- Compare Instruction.
3- Loop Instructions.
Jump Instructions:

The jump instructions are used to transfer
the flow of the program to the indicated
Operator.
Here we discus about various categories.
Conditional Jumps:
There are Three categories of Conditional
Jumps:
 a)Singed Jumps
 b)Unsigned Jumps:
 c) Single-Flag Jumps:
The Unconditional Jump:

  The unconditional jump may be
used to make infinite loops. Though
 the use of such instructions is not
    recommended in high level
languages, due to the availability of
   program control structures, in
assembly however, most of the time
  one must use the unconditional
               jump.
The JMP Instructions

The JMP instruction causes an
   unconditional transfer of
 control(unconditional jump).
        The syntax is
IF-THEN:

• The IF-THEN structure may be expressed
  in pseudocode as follow

IF (condition is true)
   THEN
Execute true-branch statements
END_IF
IF-THEN-ELSE
IF condition is true
     THEN
Execute true-branch statements

ELSE
  Execute false-branch statements

END-IF
Loop
Loops represent the final basic control structure
(sequences, decisions, and loops) which make
up a typical program. Program loops consist of
three components: an optional initialization
component, a loop termination test, and the
body of the loop.
FOR LOOP
 FOR LOOP_COUNT      Initialize
                       count
    times DO
    Statements    Statement

END_FOR
                  Count=count-1


                                  false
                    count=
                    o



                                  true
EXAMPLE
 Write a count-controlled loop to display A to Z 26
 character
The code is
         MOV     CX, 26
         MOV     AH, 2
         MOV     DL, ’A’
     TOP:
          INT    21H
          LOOP   TOP
While Loops
 WHILE condition
Do
   Statements
 END_WHILE
Example
   I = 0;                    mov I, 0
 WHILE (I<100)   WhileLp:   cmp I, 100
   I = I + 1;               jge   WhileDone
                                  inc I
                 jmp   WhileLp
REPEAT LOOP

REAPET             Statement

  Statements
UNTLIE condition


                      count=
                               false
                      o

                               true
Example
    MOV AH,1
LOOP1:
    INT 21H
CMP al, '.'
    JE EndLoop
    JNE LOOP1
EndLoop:
Assignment on alp

More Related Content

What's hot

Binary and hex input/output (in 8086 assembuly langyage)
Binary and hex input/output (in 8086 assembuly langyage)Binary and hex input/output (in 8086 assembuly langyage)
Binary and hex input/output (in 8086 assembuly langyage)Bilal Amjad
 
8087 numeric co-processor
8087 numeric co-processor8087 numeric co-processor
8087 numeric co-processorRia Desoza
 
Flow control instructions
Flow control instructionsFlow control instructions
Flow control instructionsProdip Ghosh
 
Logical instructions (and, or, xor, not, test)
Logical instructions (and, or, xor, not, test)Logical instructions (and, or, xor, not, test)
Logical instructions (and, or, xor, not, test)Irfan Anjum
 
N_Asm Assembly arithmetic instructions (sol)
N_Asm Assembly arithmetic instructions (sol)N_Asm Assembly arithmetic instructions (sol)
N_Asm Assembly arithmetic instructions (sol)Selomon birhane
 
Jumps in Assembly Language.
Jumps in Assembly Language.Jumps in Assembly Language.
Jumps in Assembly Language.NA000000
 
chapter 7 Logic, shift and rotate instructions
chapter 7 Logic, shift and rotate instructionschapter 7 Logic, shift and rotate instructions
chapter 7 Logic, shift and rotate instructionswarda aziz
 
Loops IN COMPUTER SCIENCE STANDARD 11 BY KR
Loops IN COMPUTER SCIENCE STANDARD 11 BY KRLoops IN COMPUTER SCIENCE STANDARD 11 BY KR
Loops IN COMPUTER SCIENCE STANDARD 11 BY KRKrishna Raj
 
Unit 3 – assembly language programming
Unit 3 – assembly language programmingUnit 3 – assembly language programming
Unit 3 – assembly language programmingKartik Sharma
 
1344 Alp Of 8086
1344 Alp Of 80861344 Alp Of 8086
1344 Alp Of 8086techbed
 

What's hot (19)

[ASM]Lab7
[ASM]Lab7[ASM]Lab7
[ASM]Lab7
 
[ASM]Lab4
[ASM]Lab4[ASM]Lab4
[ASM]Lab4
 
Binary and hex input/output (in 8086 assembuly langyage)
Binary and hex input/output (in 8086 assembuly langyage)Binary and hex input/output (in 8086 assembuly langyage)
Binary and hex input/output (in 8086 assembuly langyage)
 
8087 numeric co-processor
8087 numeric co-processor8087 numeric co-processor
8087 numeric co-processor
 
Branching
BranchingBranching
Branching
 
Flow control instructions
Flow control instructionsFlow control instructions
Flow control instructions
 
[ASM]Lab6
[ASM]Lab6[ASM]Lab6
[ASM]Lab6
 
Logical instructions (and, or, xor, not, test)
Logical instructions (and, or, xor, not, test)Logical instructions (and, or, xor, not, test)
Logical instructions (and, or, xor, not, test)
 
N_Asm Assembly arithmetic instructions (sol)
N_Asm Assembly arithmetic instructions (sol)N_Asm Assembly arithmetic instructions (sol)
N_Asm Assembly arithmetic instructions (sol)
 
Jumps in Assembly Language.
Jumps in Assembly Language.Jumps in Assembly Language.
Jumps in Assembly Language.
 
chapter 7 Logic, shift and rotate instructions
chapter 7 Logic, shift and rotate instructionschapter 7 Logic, shift and rotate instructions
chapter 7 Logic, shift and rotate instructions
 
Loops IN COMPUTER SCIENCE STANDARD 11 BY KR
Loops IN COMPUTER SCIENCE STANDARD 11 BY KRLoops IN COMPUTER SCIENCE STANDARD 11 BY KR
Loops IN COMPUTER SCIENCE STANDARD 11 BY KR
 
Unit 3 – assembly language programming
Unit 3 – assembly language programmingUnit 3 – assembly language programming
Unit 3 – assembly language programming
 
1344 Alp Of 8086
1344 Alp Of 80861344 Alp Of 8086
1344 Alp Of 8086
 
[ASM] Lab1
[ASM] Lab1[ASM] Lab1
[ASM] Lab1
 
Computer design
Computer designComputer design
Computer design
 
[ASM]Lab8
[ASM]Lab8[ASM]Lab8
[ASM]Lab8
 
Pl sql programme
Pl sql programmePl sql programme
Pl sql programme
 
Chapt 06
Chapt 06Chapt 06
Chapt 06
 

Viewers also liked

Context free languages
Context free languagesContext free languages
Context free languagesJahurul Islam
 
Context free languages
Context free languagesContext free languages
Context free languagesJahurul Islam
 
NHS Atlas of Variation in Healthcare for People with Liver Disease
NHS Atlas of Variation in Healthcare for People with Liver DiseaseNHS Atlas of Variation in Healthcare for People with Liver Disease
NHS Atlas of Variation in Healthcare for People with Liver Diseaserightcare
 
Diabetes atlas key headlines 2012
Diabetes atlas   key headlines 2012Diabetes atlas   key headlines 2012
Diabetes atlas key headlines 2012rightcare
 
Professor Sue Hill OBE, Chief Scientific Officer for England
Professor Sue Hill OBE, Chief Scientific Officer for EnglandProfessor Sue Hill OBE, Chief Scientific Officer for England
Professor Sue Hill OBE, Chief Scientific Officer for Englandrightcare
 
NHS Atlas of Variation for People with Respiratory Disease
NHS Atlas of Variation for People with Respiratory DiseaseNHS Atlas of Variation for People with Respiratory Disease
NHS Atlas of Variation for People with Respiratory Diseaserightcare
 
Admission system development
Admission system developmentAdmission system development
Admission system developmentJahurul Islam
 
A new tool for Clinical Commissioners, HWBs and everyone concerned with commi...
A new tool for Clinical Commissioners, HWBs and everyone concerned with commi...A new tool for Clinical Commissioners, HWBs and everyone concerned with commi...
A new tool for Clinical Commissioners, HWBs and everyone concerned with commi...rightcare
 
Hospital management system(database)
Hospital management system(database)Hospital management system(database)
Hospital management system(database)Iftikhar Ahmad
 

Viewers also liked (10)

Context free languages
Context free languagesContext free languages
Context free languages
 
Context free languages
Context free languagesContext free languages
Context free languages
 
NHS Atlas of Variation in Healthcare for People with Liver Disease
NHS Atlas of Variation in Healthcare for People with Liver DiseaseNHS Atlas of Variation in Healthcare for People with Liver Disease
NHS Atlas of Variation in Healthcare for People with Liver Disease
 
Diabetes atlas key headlines 2012
Diabetes atlas   key headlines 2012Diabetes atlas   key headlines 2012
Diabetes atlas key headlines 2012
 
Professor Sue Hill OBE, Chief Scientific Officer for England
Professor Sue Hill OBE, Chief Scientific Officer for EnglandProfessor Sue Hill OBE, Chief Scientific Officer for England
Professor Sue Hill OBE, Chief Scientific Officer for England
 
NHS Atlas of Variation for People with Respiratory Disease
NHS Atlas of Variation for People with Respiratory DiseaseNHS Atlas of Variation for People with Respiratory Disease
NHS Atlas of Variation for People with Respiratory Disease
 
Admission system development
Admission system developmentAdmission system development
Admission system development
 
A new tool for Clinical Commissioners, HWBs and everyone concerned with commi...
A new tool for Clinical Commissioners, HWBs and everyone concerned with commi...A new tool for Clinical Commissioners, HWBs and everyone concerned with commi...
A new tool for Clinical Commissioners, HWBs and everyone concerned with commi...
 
Hospital management system(database)
Hospital management system(database)Hospital management system(database)
Hospital management system(database)
 
Hospital management system
Hospital management systemHospital management system
Hospital management system
 

Similar to Assignment on alp

Flags
FlagsFlags
FlagsCME
 
Assembly Lab Sheet 5 About Status of Flag Register.pptx
Assembly Lab Sheet 5 About Status of Flag Register.pptxAssembly Lab Sheet 5 About Status of Flag Register.pptx
Assembly Lab Sheet 5 About Status of Flag Register.pptxishitasabrincse
 
instruction-set-of-8086-mr-binu-joy3.ppt
instruction-set-of-8086-mr-binu-joy3.pptinstruction-set-of-8086-mr-binu-joy3.ppt
instruction-set-of-8086-mr-binu-joy3.pptssuser2b759d
 
Flag Registers (Assembly Language)
Flag Registers (Assembly Language)Flag Registers (Assembly Language)
Flag Registers (Assembly Language)Anwar Hasan Shuvo
 
Assembly language 8086
Assembly language 8086Assembly language 8086
Assembly language 8086John Cutajar
 
Assembly language 8086 intermediate
Assembly language 8086 intermediateAssembly language 8086 intermediate
Assembly language 8086 intermediateJohn Cutajar
 
Loop instruction, controlling the flow of progam
Loop instruction, controlling the flow of progamLoop instruction, controlling the flow of progam
Loop instruction, controlling the flow of progamDr. Girish GS
 
Arithmetic and logical instructions set
Arithmetic and logical instructions setArithmetic and logical instructions set
Arithmetic and logical instructions setRobert Almazan
 
Lecture #3 Flag Register.pptx
Lecture #3 Flag Register.pptxLecture #3 Flag Register.pptx
Lecture #3 Flag Register.pptxImranBhatti58
 
Assembly language (addition and subtraction)
Assembly language (addition and subtraction)Assembly language (addition and subtraction)
Assembly language (addition and subtraction)Muhammad Umar Farooq
 
assembly language programming organization of IBM PC chapter 9 part-1(MULTIPL...
assembly language programming organization of IBM PC chapter 9 part-1(MULTIPL...assembly language programming organization of IBM PC chapter 9 part-1(MULTIPL...
assembly language programming organization of IBM PC chapter 9 part-1(MULTIPL...Bilal Amjad
 
Microprocessor.pptx
Microprocessor.pptxMicroprocessor.pptx
Microprocessor.pptxNishatNishu5
 
Instruction 8.pptx
Instruction 8.pptxInstruction 8.pptx
Instruction 8.pptxHebaEng
 
Assembly language-lab9
Assembly language-lab9Assembly language-lab9
Assembly language-lab9AjEcuacion
 

Similar to Assignment on alp (20)

assembly flag resister
assembly flag resisterassembly flag resister
assembly flag resister
 
Intel 8086
Intel 8086Intel 8086
Intel 8086
 
Flags
FlagsFlags
Flags
 
Assembly Lab Sheet 5 About Status of Flag Register.pptx
Assembly Lab Sheet 5 About Status of Flag Register.pptxAssembly Lab Sheet 5 About Status of Flag Register.pptx
Assembly Lab Sheet 5 About Status of Flag Register.pptx
 
instruction-set-of-8086-mr-binu-joy3.ppt
instruction-set-of-8086-mr-binu-joy3.pptinstruction-set-of-8086-mr-binu-joy3.ppt
instruction-set-of-8086-mr-binu-joy3.ppt
 
Flag Registers (Assembly Language)
Flag Registers (Assembly Language)Flag Registers (Assembly Language)
Flag Registers (Assembly Language)
 
Al2ed chapter7
Al2ed chapter7Al2ed chapter7
Al2ed chapter7
 
Assembly language 8086
Assembly language 8086Assembly language 8086
Assembly language 8086
 
Assembly language 8086 intermediate
Assembly language 8086 intermediateAssembly language 8086 intermediate
Assembly language 8086 intermediate
 
Loop instruction, controlling the flow of progam
Loop instruction, controlling the flow of progamLoop instruction, controlling the flow of progam
Loop instruction, controlling the flow of progam
 
Hemanth143
Hemanth143 Hemanth143
Hemanth143
 
Arithmetic and logical instructions set
Arithmetic and logical instructions setArithmetic and logical instructions set
Arithmetic and logical instructions set
 
Chapt 06
Chapt 06Chapt 06
Chapt 06
 
Lecture #3 Flag Register.pptx
Lecture #3 Flag Register.pptxLecture #3 Flag Register.pptx
Lecture #3 Flag Register.pptx
 
Assembly language (addition and subtraction)
Assembly language (addition and subtraction)Assembly language (addition and subtraction)
Assembly language (addition and subtraction)
 
assembly language programming organization of IBM PC chapter 9 part-1(MULTIPL...
assembly language programming organization of IBM PC chapter 9 part-1(MULTIPL...assembly language programming organization of IBM PC chapter 9 part-1(MULTIPL...
assembly language programming organization of IBM PC chapter 9 part-1(MULTIPL...
 
Microprocessor.pptx
Microprocessor.pptxMicroprocessor.pptx
Microprocessor.pptx
 
Instruction 8.pptx
Instruction 8.pptxInstruction 8.pptx
Instruction 8.pptx
 
Assembly language-lab9
Assembly language-lab9Assembly language-lab9
Assembly language-lab9
 
Al2ed chapter8
Al2ed chapter8Al2ed chapter8
Al2ed chapter8
 

Recently uploaded

Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxRaymartEstabillo3
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfMahmoud M. Sallam
 
Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...jaredbarbolino94
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,Virag Sontakke
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxEyham Joco
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaVirag Sontakke
 

Recently uploaded (20)

Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdf
 
Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptx
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of India
 

Assignment on alp

  • 1.
  • 2. Name ID DULAL CHANDRA BARMAN 00805010 MD.JAHURUL ISLAM 00805034 MD.EMDADUL HUQ 00805038 MD.FARUQ AHMED 00805047 ASHOK KUMAR SARKER 00805049
  • 3. FLAG REGISTER FLAGS Register:  Individual bits control the action or represent the status of the processor Control flags (TF, IF, DF):  Determine how the processor responds to certain situations Status flags (CF, PF, AF, ZF, SF, OF):  Set to represent the result of certain operations  Used to control conditional jump instructions
  • 4. FLAG Register Bits: Status Flags: Control Flags: Bit Name Symb ol Bit Name Symb ol 0 Carry flag CF 8 Trap flag TF 2 Parity flag PF 4 Auxiliary carry flag AF 9 Interrupt flag IF 6 Zero flag ZF 10 Direction flag DF 7 Sign flag SF 11 Overflow flag OF
  • 5. Status Flags: The Carry Flag (CF):  CF = 1 if there is a carry out from the msb (most significant bit) on addition, or there is a borrow into the msb on subtraction  CF = 0 otherwise  CF is also affected by shift and rotate instructions The Parity Flag (PF):  PF = 1 if the low byte of a result has an even number of one bits (even parity)  PF = 0 otherwise (odd parity)
  • 6. The Auxiliary Carry Flag (AF):  AF = 1 if there is a carry out from bit 3 on addition, or there is a borrow into the bit 3 on subtraction  AF = 0 otherwise  AF is used in binary-coded decimal (BCD) operations The Zero Flag (ZF):  ZF = 1 for a zero result  ZF = 0 for a non-zero result The Sign Flag (SF):  SF = 1 if the msb of a result is 1; it means the result is negative if you are giving a signed interpretation  SF = 0 if the msb is 0
  • 7. The Overflow Flag (OF):  OF = 1 if signed overflow occurred  OF = 0 otherwise Example 1. ADD AX,BX , where AX contains FFFFh , BX contains FFFFh. Solution: FFFFh + FFFFh 1FFFEh The result stored in AX is FFFEh=1111 1111 1111 1110 SF = 1 because the msb is 1 PF = 0 because there are 7(odd number) of 1 bits in the low byte of the result . ZF = 0 because the result is nonzero. CF = 1 because there is a carry out of the msb on addition. OF = 0 because the sign of the stored result is the same as that of the numbers being added (as a binary addition, there is a carry into the msb and a carry out).
  • 8. Example 2. ADD AX, BX, where AX contains 7132h , BX contains 7000h  Solution: 7132h  + 7000h  E132h  The result stored in AX is E132h=1110 0001 0011 0010  SF = 1 because the msb is 1  PF = 0 because there are 3(odd number) of 1 bits in the low byte of the result .  ZF = 0 because the result is nonzero.  CF = 0 because there is no a carry out of the msb on addition.  OF = 1
  • 9. Example-3: SUB AX, BX , where AX contains 8000h and BX contains 0001h.  Solution: 8000h  -0001h  7FFFh  The result stored in AX is FFFEh=0111 1111 1111 1111  SF = 0 because the msb is 0  PF = 1 because there are 8(even number) of 1 bits in the low byte of the result .  ZF = 0 because the result is nonzero.  CF = 0 because a smaller unsigned number is being subtracted from a larger one.  Now for OF. In a signal sense, we are subtracting a positive number from a negative one, which is like adding two negatives. Because the result is positive (the wrong sign), OF = 1.
  • 10. OVERFLOW  The overflow flag is set when the Most Significant Bit (MSB) is set or cleared.  For example, take the addition of 127 and 127. The 8 bit signed binary number of 127 is represented as 0111 1111.  The MSB (the bit to the far left) is 0. When these two 8 bit numbers are added the result is 254, or 1111 1110. Notice now that the MSB is now 1 and not 0.  Therefore, the overflow flag has been set. Here, 1111 1110 would be interpreted as a negative number.
  • 11. The addition test shows whether the overflow flag has been set.  If two positive operands generate a negative sum. For example, 0101 1100 and 0100 1010 is 1010 0110, or -90.  The MSB changed from 0 to 1.  And the two negative operands generate a positive sum.  For example 1100 0010 and 1000 0100 is 01101000 or 104.  The MSB changed from 1 to 0, so the overflow flag is being set.  Overflow never occurs when the sign of two addition operands are different.
  • 12. (Signed) Overflow  Can only occur when adding numbers of the same sign (subtracting with different signs)  Detected when carry into MSB is not equal to carry out of MSB  Easily detected because this implies the result has a different sign than the sign of the operands  Programs can ignore the Flags
  • 13. Example 4. ADD AX,BX , where AX and BX both contains 7FFFh . Solution: Hex Binary 7FFFh 0111 1111 1111 1111 7FFFh 0111 1111 1111 1111 FFFEh 1111 1111 1111 1110 The signed and unsigned interpretation of 7FFFh is 32767. Thus for both signed and unsigned addition,7FFFh+7FFFh=32767+32767=65534.This is out of range for signed numbers, the signed interpretation of the stored answer FFFEh is -2,so signed overflow occurred .However the unsigned interpretation of FFFEh is 65534,which is the right answer, so there is no unsigned overflow.
  • 14. Unsigned overflow:  On addition, unsigned overflow occurs when there is a carry out of the msb.  On subtraction unsigned overflow occurs when there is a borrow into the msb.  Example 5. ADD AX, BX, where AX contains FF12h, BX contains 1ACBh. Solution: FF12h + 1ACBh 119DDh The result is stored in AX is 19DDh=0001 11 111 1101 FF12h=-1 and 1ACBh=1, and FF12h+1ACBh=-1+1=0, so sign overflow did not occur. Here a 1 is carried out of the msb, so unsigned overflow occurred.
  • 15. The importance of flag registers: Flag register has it's importance by following resion. 1. Sign flag: use to store the sign of any number under processing i.e when arithmetical logic has negative sign it is in set condition. and rest in reset. 2. Zero flag: when ALU operation is zero it is in reset condition. 3. Auxiliary carry flag: it hold the carry during internal processing of addition ,sub , mul and div. 4. Parity flag: hold 1 for even parity,0 for odd parity. 5. Carry flag: hold carry after end of processing of operation.
  • 16. FLAGS Register & Flow control Instruction Flags Register Individual bits control the action or represent the status of the processor
  • 17. Control flags (TF, IF, DF): Determine how the processor responds to certain situations Status flags (CF, PF, AF, ZF, SF, OF): • Set to represent the result of certain operations • Used to control conditional jump instructions
  • 18. Flow Control Instructions: In this assignment we will practice how to control the flow of an assembly language program using the compare instruction, the different jump instructions and the loop instructions. Objectives: 1- Jump Instructions. 2- Compare Instruction. 3- Loop Instructions.
  • 19. Jump Instructions: The jump instructions are used to transfer the flow of the program to the indicated Operator. Here we discus about various categories. Conditional Jumps: There are Three categories of Conditional Jumps: a)Singed Jumps b)Unsigned Jumps: c) Single-Flag Jumps:
  • 20. The Unconditional Jump: The unconditional jump may be used to make infinite loops. Though the use of such instructions is not recommended in high level languages, due to the availability of program control structures, in assembly however, most of the time one must use the unconditional jump.
  • 21. The JMP Instructions The JMP instruction causes an unconditional transfer of control(unconditional jump). The syntax is
  • 22. IF-THEN: • The IF-THEN structure may be expressed in pseudocode as follow IF (condition is true) THEN Execute true-branch statements END_IF
  • 23. IF-THEN-ELSE IF condition is true THEN Execute true-branch statements ELSE Execute false-branch statements END-IF
  • 24. Loop Loops represent the final basic control structure (sequences, decisions, and loops) which make up a typical program. Program loops consist of three components: an optional initialization component, a loop termination test, and the body of the loop.
  • 25. FOR LOOP FOR LOOP_COUNT Initialize count times DO Statements Statement END_FOR Count=count-1 false count= o true
  • 26. EXAMPLE Write a count-controlled loop to display A to Z 26 character The code is MOV CX, 26 MOV AH, 2 MOV DL, ’A’ TOP: INT 21H LOOP TOP
  • 27. While Loops WHILE condition Do Statements END_WHILE
  • 28. Example I = 0; mov I, 0 WHILE (I<100) WhileLp: cmp I, 100 I = I + 1; jge WhileDone inc I jmp WhileLp
  • 29. REPEAT LOOP REAPET Statement Statements UNTLIE condition count= false o true
  • 30. Example MOV AH,1 LOOP1: INT 21H CMP al, '.' JE EndLoop JNE LOOP1 EndLoop: