How Instruction Affect the Flags

Slides:



Advertisements
Similar presentations
Block Diagram of Intel 8086 Engr.M.Zakir Shaikh
Advertisements

Registers of the 8086/ /2002 JNM.
Presented By Dr. Shazzad Hosain Asst. Prof. EECS, NSU
Introduction to 8086 Microprocessor
Princess Sumaya Univ. Computer Engineering Dept. د. بســام كحـالــه Dr. Bassam Kahhaleh.
Microprocessor Systems Design I Instructor: Dr. Michael Geiger Fall 2013 Lecture 14 Compare instructions; conditional execution.
Computer Organization & Assembly Language
Assembly Language :CSC 225 (Lec#4: Flag Register and Conditional Statements) By Dr. Syed Noman.
Princess Sumaya University
Microprocessor Systems Design I Instructor: Dr. Michael Geiger Fall 2012 Lecture 10: Flag control instructions Conditional execution.
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.
Gursharan Singh Tatla Block Diagram of Intel 8086 Gursharan Singh Tatla 19-Apr-17.
Unit-1 PREPARED BY: PROF. HARISH I RATHOD COMPUTER ENGINEERING DEPARTMENT GUJARAT POWER ENGINEERING & RESEARCH INSTITUTE Advance Processor.
The 8086 Microprocessor The 8086, announced in 1978, was the first 16-bit microprocessor introduced by Intel Corporation 8086 is 16-bit MPU. Externally.
An Introduction to 8086 Microprocessor.
Ch. 7 Logic, Shift and Rotate instr.
Khaled A. Al-Utaibi  Introduction  Arithmetic Instructions  Basic Logical Instructions  Shift Instructions  Rotate Instructions.
Electrical Engineering Department Engineering College Prince Sattam bin Abdul Aziz University Text Book: - Triebel and Singh, "The 8088 and 8086 Microprocessors",
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.
Types of Registers (8086 Microprocessor Based)
LAB Flag Bits and Register
Faculty of Engineering, Electrical Department,
Lecture 4 ( Assembly Language).
Boolean and Comparison Instructions Operation Description ANDAND Destination, Source OROR Destination, Source XORXOR Destination, Source NOTNOT Destination.
CEN 226: Computer Organization & Assembly Language :CSC 225 (Lec#5) By Dr. Syed Noman.
Debuggers A program needed when writing any type of code Displays the contents of memory Lets you view registers and variables and see how they change.
Arithmetic Flags and Instructions
Logic Conditional Processing. Status flags - review The Zero flag is set when the result of an operation equals zero. The Carry flag is set when an instruction.
Computers organization & Assembly Language Chapter 1 THE 80x86 MICROPROCESSOR.
LEA instruction The LEA instruction can be used to get the offset address of a variable Example ORG 100h MOV AL, VAR1 ; check value of VAR1 by moving it.
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.
6-4 CPU-Registers, effective address General registers vs Segment registers Computer Studies (AL)
Introduction to Microprocessors Chapter 3. Programming Model (8086)  Shows the various internal registers that are accessible to the programmer.
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.
Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 251 Introduction to Computer Organization.
Intel 8086 MICROPROCESSOR ARCHITECTURE
Intel MP Organization. Registers - storage locations found inside the processor for temporary storage of data 1- Data Registers (16-bit) AX, BX, CX, DX.
Microprocessor Systems Design I
Introduction to 8086 Microprocessor
Assembly Language Programming Part 3
8086 Microprocessor.
Instruction Execution Cycle
ICS312 SET 7 Flags.
The FLAGS Register An x bit means an unidentified value 9/12/2018
Morgan Kaufmann Publishers Computer Organization and Assembly Language
Microprocessor and Assembly Language
Basic Microprocessor Architecture
Assembly IA-32.
More on logical instruction and
16.317: Microprocessor System Design I
Intel 8088 (8086) Microprocessor Structure
INSTRUCTION SET OF 8086 PAWAN KUMAR SINGH.
Introduction to Assembly Language
Memory Organisation Source: under
Lecture 4 ( Assembly Language).
Flags Register & Jump Instruction
Intel 8088 (8086) Microprocessor Structure
CS-401 Computer Architecture & Assembly Language Programming
اصول اساسی برنامه نویسی به زبان اسمبلی
CS 301 Fall 2002 Computer Organization
תכנות בסיסי בשפת סף פרק 5 מצגת 3.
University of Gujrat Department of Computer Science
Computer Architecture CST 250
Computer Architecture and System Programming Laboratory
Chapter 8: Instruction Set 8086 CPU Architecture
Ch. 5 – Intel 8086 – study details from Yu & Marut
Part IV The FLAGS Register
Presentation transcript:

How Instruction Affect the Flags

Processor executes instruction Flags are affected Some instructions do not affect while some do Instruction Affect Flags MOV/XCHG none ADD/SUB all INC/DEC all except CF NEG all

Example: Show how the flags register affected by the addition of 38H and 2FH Sol: MOV BH,38H ;BH=38H ADD BH,2FH ;add 2F to BH, now BH=67H CF = 0 since there is no carry beyond d7 PF = 0 since there is an odd number of 1s in the result AF = 1 since there is a carry from d3 to d4 ZF = 0 since the result is not zero SF = 0 since d7 of the result is zero 0011 1000 + 0010 1111 0110 0111

Example Show how the flags register affected by MOV AL,9CH MOV DH,64H ADD AL,DH

Sol 1001 1100 + 0110 0100 0000 0000 CF = 1 since there is a carry beyond d7 PF = 1 since there is an even number of 1s in the result AF = 1 since there is a carry from d3 to d4 ZF = 1 since the result is zero SF = 0 since d7 of the result is zero

Example Show how the flags register affected by MOV AX,34F5H ADD AX,95EBH MOV BX,AAAAH ADD BX,5556H (You need to solve both as an assignment)

DEBUG Flag symbol Status Flags Set (1) Symbol Clear (0) Symbol CF CY (carry) NC (no carry) PF PE (even parity) PO (odd parity) AF AC (auxiliary carry) NA (no auxiliary carry) ZF ZR (zero) NZ (nonzero) SF NG (negative) PL (plus) OF OV (overflow) NV (no overflow) Control Flags DF DN (down) UP (up) IF EI (enable interrupt) DI (disable interrupt)