ICS312 SET 7 Flags.

Slides:



Advertisements
Similar presentations
How Instruction Affect the Flags
Advertisements

Presented By Dr. Shazzad Hosain Asst. Prof. EECS, NSU
Department of Computer Science and Software Engineering
Computer Organization & Assembly Language
Web siteWeb site ExamplesExamples Irvine, Kip R. Assembly Language for Intel-Based Computers, MUL Instruction The MUL (unsigned multiply) instruction.
Irvine: Assembly Language for Intel-Based Computers (1999) Symbolic Constants Equal-sign Directive EQU Directive TEXTEQU Directive.
Flow Control Instructions
9-1 ECE 424 Design of Microprocessor-Based Systems Haibo Wang ECE Department Southern Illinois University Carbondale, IL x86 Instructions Part.
CS2422 Assembly Language & System Programming September 28, 2006.
ICS312 Set 3 Pentium Registers. Intel 8086 Family of Microprocessors All of the Intel chips from the 8086 to the latest pentium, have similar architectures.
Ch. 5 from Yu & Marut. Registers 14(16-bit) registers: 1.Data reg. – to hold data for an op. 2.Address reg – to hold addr of an instruction or data.
Khaled A. Al-Utaibi  Introduction  Arithmetic Instructions  Basic Logical Instructions  Shift Instructions  Rotate Instructions.
Flag Control instructions CLC clear carry flag CF = 0 STC set carry flag CF= 1 CMC complement carry flag [CF] CF.
Sahar Mosleh California State University San MarcosPage 1 CPU Flags and Boolean Instructions.
LAB Flag Bits and Register
ICS312 Set 9 Logic & Shift Instructions. Logic & Shift Instructions Logic and Shift Instructions can be used to change the bit values in an operand. The.
Lecture 4 ( Assembly Language).
Microprocessors Monday, Apr. 13 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.
Copyright 2000ELEC 242 Arithmetic Instructions1 Arithmetic Instructions Arithmetic and logical instructions modify the contents of the Flag (Status) register.
Arithmetic Flags and Instructions
Computer Architecture and Operating Systems CS 3230 :Assembly Section Lecture 4 Department of Computer Science and Software Engineering University of Wisconsin-Platteville.
ECE291 Computer Engineering II Lecture 4 Josh Potts University of Illinois at Urbana- Champaign.
1 Logic, Shift, and Rotate Instructions Read Sections 6.2, 7.2 and 7.3 of textbook.
EEL 3801 Part V Conditional Processing. This section explains how to implement conditional processing in Assembly Language for the 8086/8088 processors.
3.4 Addressing modes Specify the operand to be used. To generate an address, a segment register is used also. Immediate addressing: the operand is a number.
Microprocessor MA Rahim Khan Computer Engineering and Networks Department.
Introduction to Computer Organization and Assembly Language
The Assemble, Unassemble commands of the debugger: U Command for converting machine code language source Equivalent machine code instructions Equivalent.
Microprocessor & Assembly Language Arithmetic and logical Instructions.
ECE291 Computer Engineering II Lecture 4 Josh Potts University of Illinois at Urbana- Champaign.
Comparison Instructions Test instruction –Performs an implied AND operation between each of the bits in 2 operands. Neither operand is modified. (Flags.
Microprocessor & Assembly Language
Computer and Information Sciences College / Computer Science Department CS 206 D Computer Organization and Assembly Language.
Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 251 Introduction to Computer Organization.
Multiplication and Division instructions Dr.Hadi AL Saadi.
CS2422 Assembly Language and System Programming 0 Week 9 Data Transfers, Addressing, and Arithmetic.
Assembly Language Programming Part 3
Microprocessor Systems Design I
The FLAGS Register An x bit means an unidentified value 9/12/2018
Assembly Language for Intel-Based Computers, 5th Edition
EE3541 Introduction to Microprocessors
Multiplication and Division Instructions
Microprocessor and Assembly Language
More on logical instruction and
Assembly Language Programming Part 2
4.2 Arithmetic Instructions
CS-401 Assembly Language Programming
Arithmetic and Logic Chapter 5
Arithmetic Instructions
Introduction to Assembly Language
Chapter 4: Instructions
Lecture 4 ( Assembly Language).
Flags Register & Jump Instruction
Morgan Kaufmann Publishers Computer Organization and Assembly Language
Data Transfers, Addressing, and Arithmetic
Chapter 11 © 2011, The McGraw-Hill Companies, Inc.
CS 301 Fall 2002 Computer Organization
Shift & Rotate Instructions)
University of Gujrat Department of Computer Science
Shift & Rotate Instructions)
University of Gujrat Department of Computer Science
Computer Architecture CST 250
Chapter 5 Arithmetic and Logic Instructions
Computer Architecture and System Programming Laboratory
Multiplication and Division Instructions
Multiplication and Division Instructions
Chapter 8: Instruction Set 8086 CPU Architecture
Computer Architecture and Assembly Language
Ch. 5 – Intel 8086 – study details from Yu & Marut
Part IV The FLAGS Register
Presentation transcript:

ICS312 SET 7 Flags

Flags Register Individual bits in the FLAGS register give information about the status of the processor. Status flags - reflect the results of computations (add, subtract, multiply, divided) executed by the processor.

Zero Flag and Sign Flag Zero flag (ZF) - the zero flag is set(1) when the result of an arithmetic operation is zero. Sign flag (SF) - the sign flag is set(1) when the result of an arithmetic operation has a 1 in the most significant bit (msb).

Overflow Flag (OF) (not used in this course) Overflow means there has been an unexpected sign change in the result of an arithmetic operation involving signed numbers.  This can happen when two signed numbers with the same sign are added or two numbers of opposite sign are subtracted and the result ends up with the wrong sign. Note this cannot happen when numbers of opposite sign are added, or when numbers of the same sign are subtracted. Overflow is indicated by setting the Overflow Flag.

Effect of Instructions on Flags MOV No effect on flags. INC and DEC Sets all flags, except the CF. (i.e., CF is not affected by INC or DEC.) ADD and SUB Sets all flags. NEG Affects all flags OF is set to 1 if the operand is 8000h or 80h.

Examples (1) Given AL = 80h, BL = 81h. Determine the status of the carry and overflow flags the following cases: a. ADD AL, BL b. SUB AL, BL c. SUB BL, AL d. NEG AL

Examples (2) Given AL = 7Fh, BL = 01h. Determine the status of all flags in the following cases: a. ADD AL, BL b. SUB AL, BL c. SUB BL, AL

Examples (3) Given AX = 0FFFFh, BX = 0001h. Determine the status of all flags in the following cases: a. NEG AX b. ADD AX, BX c. SUB BX, AX d. SUB AX, BX e. INC AX

Table of Flag Symbols used in Debugger (which we will cover later): Status Flags Flag Set (1) Flag Clear (0) CF CY NC ZF ZR NZ SF NG PL OF OV NV

Textbook Reading (Jones): Section  5.1