尊敬的 微信汇率:1円 ≈ 0.046166 元 支付宝汇率:1円 ≈ 0.046257元 [退出登录]
SlideShare a Scribd company logo
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

[ASM]Lab7
[ASM]Lab7[ASM]Lab7
[ASM]Lab7
Nora Youssef
 
[ASM]Lab4
[ASM]Lab4[ASM]Lab4
[ASM]Lab4
Nora Youssef
 
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-processor
Ria Desoza
 
Branching
BranchingBranching
Flow control instructions
Flow control instructionsFlow control instructions
Flow control instructions
Prodip Ghosh
 
[ASM]Lab6
[ASM]Lab6[ASM]Lab6
[ASM]Lab6
Nora Youssef
 
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 instructions
warda 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 KR
Krishna Raj
 
Unit 3 – assembly language programming
Unit 3 – assembly language programmingUnit 3 – assembly language programming
Unit 3 – assembly language programming
Kartik Sharma
 
1344 Alp Of 8086
1344 Alp Of 80861344 Alp Of 8086
1344 Alp Of 8086
techbed
 
[ASM] Lab1
[ASM] Lab1[ASM] Lab1
[ASM] Lab1
Nora Youssef
 
Computer design
Computer designComputer design
Computer design
Pradeep Kumar TS
 
[ASM]Lab8
[ASM]Lab8[ASM]Lab8
[ASM]Lab8
Nora Youssef
 
Pl sql programme
Pl sql programmePl sql programme
Pl sql programme
Dhilip Prakash
 
Chapt 06
Chapt 06Chapt 06
Chapt 06
guest2bb25
 

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 languages
Jahurul Islam
 
Context free languages
Context free languagesContext free languages
Context free languages
Jahurul 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 Disease
rightcare
 
Diabetes atlas key headlines 2012
Diabetes atlas   key headlines 2012Diabetes atlas   key headlines 2012
Diabetes atlas key headlines 2012
rightcare
 
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
rightcare
 
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
rightcare
 
Admission system development
Admission system developmentAdmission system development
Admission system development
Jahurul 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
 
Hospital management system
Hospital management systemHospital management system
Hospital management system
Mohammad Safiullah
 

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

assembly flag resister
assembly flag resisterassembly flag resister
assembly flag resister
safayet hossain
 
Intel 8086
Intel 8086Intel 8086
Intel 8086
BELLALHOSSAIN31
 
Flags
FlagsFlags
Flags
CME
 
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
ishitasabrincse
 
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
ssuser2b759d
 
Flag Registers (Assembly Language)
Flag Registers (Assembly Language)Flag Registers (Assembly Language)
Flag Registers (Assembly Language)
Anwar Hasan Shuvo
 
Al2ed chapter7
Al2ed chapter7Al2ed chapter7
Al2ed chapter7
Abdullelah Al-Fahad
 
Assembly language 8086
Assembly language 8086Assembly language 8086
Assembly language 8086
John Cutajar
 
Assembly language 8086 intermediate
Assembly language 8086 intermediateAssembly language 8086 intermediate
Assembly language 8086 intermediate
John 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 progam
Dr. Girish GS
 
Hemanth143
Hemanth143 Hemanth143
Hemanth143
vijaydeepakg
 
Arithmetic and logical instructions set
Arithmetic and logical instructions setArithmetic and logical instructions set
Arithmetic and logical instructions set
Robert Almazan
 
Chapt 06
Chapt 06Chapt 06
Chapt 06
guest2bb25
 
Lecture #3 Flag Register.pptx
Lecture #3 Flag Register.pptxLecture #3 Flag Register.pptx
Lecture #3 Flag Register.pptx
ImranBhatti58
 
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.pptx
NishatNishu5
 
Instruction 8.pptx
Instruction 8.pptxInstruction 8.pptx
Instruction 8.pptx
HebaEng
 
Assembly language-lab9
Assembly language-lab9Assembly language-lab9
Assembly language-lab9
AjEcuacion
 
Al2ed chapter8
Al2ed chapter8Al2ed chapter8
Al2ed chapter8
Abdullelah Al-Fahad
 

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

Decolonizing Universal Design for Learning
Decolonizing Universal Design for LearningDecolonizing Universal Design for Learning
Decolonizing Universal Design for Learning
Frederic Fovet
 
220711130083 SUBHASHREE RAKSHIT Internet resources for social science
220711130083 SUBHASHREE RAKSHIT  Internet resources for social science220711130083 SUBHASHREE RAKSHIT  Internet resources for social science
220711130083 SUBHASHREE RAKSHIT Internet resources for social science
Kalna College
 
Post init hook in the odoo 17 ERP Module
Post init hook in the  odoo 17 ERP ModulePost init hook in the  odoo 17 ERP Module
Post init hook in the odoo 17 ERP Module
Celine George
 
INTRODUCTION TO HOSPITALS & AND ITS ORGANIZATION
INTRODUCTION TO HOSPITALS & AND ITS ORGANIZATION INTRODUCTION TO HOSPITALS & AND ITS ORGANIZATION
INTRODUCTION TO HOSPITALS & AND ITS ORGANIZATION
ShwetaGawande8
 
The Science of Learning: implications for modern teaching
The Science of Learning: implications for modern teachingThe Science of Learning: implications for modern teaching
The Science of Learning: implications for modern teaching
Derek Wenmoth
 
78 Microsoft-Publisher - Sirin Sultana Bora.pptx
78 Microsoft-Publisher - Sirin Sultana Bora.pptx78 Microsoft-Publisher - Sirin Sultana Bora.pptx
78 Microsoft-Publisher - Sirin Sultana Bora.pptx
Kalna College
 
8+8+8 Rule Of Time Management For Better Productivity
8+8+8 Rule Of Time Management For Better Productivity8+8+8 Rule Of Time Management For Better Productivity
8+8+8 Rule Of Time Management For Better Productivity
RuchiRathor2
 
Opportunity scholarships and the schools that receive them
Opportunity scholarships and the schools that receive themOpportunity scholarships and the schools that receive them
Opportunity scholarships and the schools that receive them
EducationNC
 
How to Create User Notification in Odoo 17
How to Create User Notification in Odoo 17How to Create User Notification in Odoo 17
How to Create User Notification in Odoo 17
Celine George
 
Interprofessional Education Platform Introduction.pdf
Interprofessional Education Platform Introduction.pdfInterprofessional Education Platform Introduction.pdf
Interprofessional Education Platform Introduction.pdf
Ben Aldrich
 
managing Behaviour in early childhood education.pptx
managing Behaviour in early childhood education.pptxmanaging Behaviour in early childhood education.pptx
managing Behaviour in early childhood education.pptx
nabaegha
 
Library news letter Kitengesa Uganda June 2024
Library news letter Kitengesa Uganda June 2024Library news letter Kitengesa Uganda June 2024
Library news letter Kitengesa Uganda June 2024
Friends of African Village Libraries
 
(T.L.E.) Agriculture: "Ornamental Plants"
(T.L.E.) Agriculture: "Ornamental Plants"(T.L.E.) Agriculture: "Ornamental Plants"
(T.L.E.) Agriculture: "Ornamental Plants"
MJDuyan
 
Talking Tech through Compelling Visual Aids
Talking Tech through Compelling Visual AidsTalking Tech through Compelling Visual Aids
Talking Tech through Compelling Visual Aids
MattVassar1
 
pol sci Election and Representation Class 11 Notes.pdf
pol sci Election and Representation Class 11 Notes.pdfpol sci Election and Representation Class 11 Notes.pdf
pol sci Election and Representation Class 11 Notes.pdf
BiplabHalder13
 
Non-Verbal Communication for Tech Professionals
Non-Verbal Communication for Tech ProfessionalsNon-Verbal Communication for Tech Professionals
Non-Verbal Communication for Tech Professionals
MattVassar1
 
How to stay relevant as a cyber professional: Skills, trends and career paths...
How to stay relevant as a cyber professional: Skills, trends and career paths...How to stay relevant as a cyber professional: Skills, trends and career paths...
How to stay relevant as a cyber professional: Skills, trends and career paths...
Infosec
 
Accounting for Restricted Grants When and How To Record Properly
Accounting for Restricted Grants  When and How To Record ProperlyAccounting for Restricted Grants  When and How To Record Properly
Accounting for Restricted Grants When and How To Record Properly
TechSoup
 
The basics of sentences session 8pptx.pptx
The basics of sentences session 8pptx.pptxThe basics of sentences session 8pptx.pptx
The basics of sentences session 8pptx.pptx
heathfieldcps1
 
Creating Images and Videos through AI.pptx
Creating Images and Videos through AI.pptxCreating Images and Videos through AI.pptx
Creating Images and Videos through AI.pptx
Forum of Blended Learning
 

Recently uploaded (20)

Decolonizing Universal Design for Learning
Decolonizing Universal Design for LearningDecolonizing Universal Design for Learning
Decolonizing Universal Design for Learning
 
220711130083 SUBHASHREE RAKSHIT Internet resources for social science
220711130083 SUBHASHREE RAKSHIT  Internet resources for social science220711130083 SUBHASHREE RAKSHIT  Internet resources for social science
220711130083 SUBHASHREE RAKSHIT Internet resources for social science
 
Post init hook in the odoo 17 ERP Module
Post init hook in the  odoo 17 ERP ModulePost init hook in the  odoo 17 ERP Module
Post init hook in the odoo 17 ERP Module
 
INTRODUCTION TO HOSPITALS & AND ITS ORGANIZATION
INTRODUCTION TO HOSPITALS & AND ITS ORGANIZATION INTRODUCTION TO HOSPITALS & AND ITS ORGANIZATION
INTRODUCTION TO HOSPITALS & AND ITS ORGANIZATION
 
The Science of Learning: implications for modern teaching
The Science of Learning: implications for modern teachingThe Science of Learning: implications for modern teaching
The Science of Learning: implications for modern teaching
 
78 Microsoft-Publisher - Sirin Sultana Bora.pptx
78 Microsoft-Publisher - Sirin Sultana Bora.pptx78 Microsoft-Publisher - Sirin Sultana Bora.pptx
78 Microsoft-Publisher - Sirin Sultana Bora.pptx
 
8+8+8 Rule Of Time Management For Better Productivity
8+8+8 Rule Of Time Management For Better Productivity8+8+8 Rule Of Time Management For Better Productivity
8+8+8 Rule Of Time Management For Better Productivity
 
Opportunity scholarships and the schools that receive them
Opportunity scholarships and the schools that receive themOpportunity scholarships and the schools that receive them
Opportunity scholarships and the schools that receive them
 
How to Create User Notification in Odoo 17
How to Create User Notification in Odoo 17How to Create User Notification in Odoo 17
How to Create User Notification in Odoo 17
 
Interprofessional Education Platform Introduction.pdf
Interprofessional Education Platform Introduction.pdfInterprofessional Education Platform Introduction.pdf
Interprofessional Education Platform Introduction.pdf
 
managing Behaviour in early childhood education.pptx
managing Behaviour in early childhood education.pptxmanaging Behaviour in early childhood education.pptx
managing Behaviour in early childhood education.pptx
 
Library news letter Kitengesa Uganda June 2024
Library news letter Kitengesa Uganda June 2024Library news letter Kitengesa Uganda June 2024
Library news letter Kitengesa Uganda June 2024
 
(T.L.E.) Agriculture: "Ornamental Plants"
(T.L.E.) Agriculture: "Ornamental Plants"(T.L.E.) Agriculture: "Ornamental Plants"
(T.L.E.) Agriculture: "Ornamental Plants"
 
Talking Tech through Compelling Visual Aids
Talking Tech through Compelling Visual AidsTalking Tech through Compelling Visual Aids
Talking Tech through Compelling Visual Aids
 
pol sci Election and Representation Class 11 Notes.pdf
pol sci Election and Representation Class 11 Notes.pdfpol sci Election and Representation Class 11 Notes.pdf
pol sci Election and Representation Class 11 Notes.pdf
 
Non-Verbal Communication for Tech Professionals
Non-Verbal Communication for Tech ProfessionalsNon-Verbal Communication for Tech Professionals
Non-Verbal Communication for Tech Professionals
 
How to stay relevant as a cyber professional: Skills, trends and career paths...
How to stay relevant as a cyber professional: Skills, trends and career paths...How to stay relevant as a cyber professional: Skills, trends and career paths...
How to stay relevant as a cyber professional: Skills, trends and career paths...
 
Accounting for Restricted Grants When and How To Record Properly
Accounting for Restricted Grants  When and How To Record ProperlyAccounting for Restricted Grants  When and How To Record Properly
Accounting for Restricted Grants When and How To Record Properly
 
The basics of sentences session 8pptx.pptx
The basics of sentences session 8pptx.pptxThe basics of sentences session 8pptx.pptx
The basics of sentences session 8pptx.pptx
 
Creating Images and Videos through AI.pptx
Creating Images and Videos through AI.pptxCreating Images and Videos through AI.pptx
Creating Images and Videos through AI.pptx
 

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:
  翻译: