Presented By Dr. Shazzad Hosain Asst. Prof. EECS, NSU

Slides:



Advertisements
Similar presentations
Registers of the 8086/ /2002 JNM.
Advertisements

The Microprocessor and its Architecture
Princess Sumaya Univ. Computer Engineering Dept. د. بســام كحـالــه Dr. Bassam Kahhaleh.
80x86 Instruction Set Dr. Qiang Lin.
Lecture 2 Presented By Dr. Shazzad Hosain Asst. Prof. EECS, NSU.
Princess Sumaya University
1 ICS 51 Introductory Computer Organization Fall 2006 updated: Oct. 2, 2006.
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.
An Introduction to 8086 Microprocessor.
Lecture 8 Presented By Dr. Shazzad Hosain Asst. Prof. EECS, NSU.
Ch. 7 Logic, Shift and Rotate instr.
Lecture 3 Presented By Dr. Shazzad Hosain Asst. Prof. EECS, NSU.
1 Fundamental of Computer Suthida Chaichomchuen : SCC
Types of Registers (8086 Microprocessor Based)
LAB Flag Bits and Register
Lecture 4 ( Assembly Language).
Microprocessors Monday, Apr. 13 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.
Lecture 5 Presented By Dr. Shazzad Hosain Asst. Prof. EECS, NSU.
5. Assembly Language. Basics of AL Program data Pseudo-ops Array Program structures Data, stack, code segments.
Arithmetic Flags and Instructions
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.
Introduction to Computer Organization and Assembly Language
Microprocessor & Assembly Language Arithmetic and logical Instructions.
Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 251 Introduction to Computer Organization.
Lecture 9 Design of the Computer Instruction Set and the CPU Presented By Dr. Shazzad Hosain Asst. Prof. EECS, NSU.
Internal Programming Architecture or Model
Lecture 6 Presented By Dr. Shazzad Hosain Asst. Prof. EECS, NSU.
1 x86 Programming Model Microprocessor Computer Architectures Lab Components of any Computer System Control – logic that controls fetching/execution of.
Intel 8086 MICROPROCESSOR ARCHITECTURE
I NTEL 8086 M icroprocessor بسم الله الرحمن الرحيم 1.
ΜComputer Structure μProcessor Memory Bus System I/O Ports.
Chapter 12 Processor Structure and Function. Central Processing Unit CPU architecture, Register organization, Instruction formats and addressing modes(Intel.
Format of Assembly language
An Introduction to 8086 Microprocessor.
Difference between Microprocessor and Microcontroller
UNIT Architecture M.Brindha AP/EIE
Introduction to 8086 Microprocessor
Assembly Language Programming Part 3
8086 Microprocessor.
Lecture on Microcomputer
ICS312 SET 7 Flags.
Chapter 2 The Microprocessor and its Architecture
The FLAGS Register An x bit means an unidentified value 9/12/2018
Microprocessor and Assembly Language
Basic Microprocessor Architecture
Intel 8088 (8086) Microprocessor Structure
Symbolic Instruction and Addressing
X86’s instruction sets.
Introduction to Assembly Language
Lecture 4 ( Assembly Language).
Flags Register & Jump Instruction
Microprocessor & Assembly Language
Intel 8088 (8086) Microprocessor Structure
CS-401 Computer Architecture & Assembly Language Programming
Morgan Kaufmann Publishers Computer Organization and Assembly Language
Symbolic Instruction and Addressing
CS 301 Fall 2002 Computer Organization
University of Gujrat Department of Computer Science
The Microprocessor & Its Architecture
Symbolic Instruction and Addressing
University of Gujrat Department of Computer Science
Computer Architecture CST 250
Chapter 6 –Symbolic Instruction and Addressing
Assembly Language for Intel 8086 Jump Condition
Chapter 8: Instruction Set 8086 CPU Architecture
Part I Data Representation and 8086 Microprocessors
Ch. 5 – Intel 8086 – study details from Yu & Marut
Part IV The FLAGS Register
Presentation transcript:

Presented By Dr. Shazzad Hosain Asst. Prof. EECS, NSU CSE 331/ETE 332/EEE 332 Microprocessor and Assembly Language Programming Presented By Dr. Shazzad Hosain Asst. Prof. EECS, NSU

Books Fundamentals of Digital Logic and Microcomputer Design – M. Rafiaquzzaman The Intel Microprocessors 8086/8088 … , and Pentium Pro Processors – Barry B. Brey Assembly Language Programming and Organization of the IBM PC – Ytha Yu, Charles Marut

Mark Distribution Best 3 out of 5 Items Percentage Attendance 5% Quizzes 25% Mid Term Lab 10% Final 35% Total 100% Best 3 out of 5 There will be no makeup for quizzes or exams. For details please visit http://www.northsouth.edu/php/faculty/shazzad/teaching.html and follow the corresponding link.

Assembly Language Programming

What is Microcomputer?

The Microprocessor and Its Architecture ALU (Arithmetic and Logic Unit) The Control Unit Registers HDD RAM Cache Memory Microprocessor R1 R3

The Programming Model Program visible registers We can access via programs Program invisible registers We can not access via programs

Registers 16 bit Segment registers

Example Data If AX = 20A2H then AH = 20H, AL = A2H In other words, if AH = 1CH and AL = A2H then AX = 1CA2H 0010 0000 1010 0010 AH AL AX

The FLAGS register FLAGS indicate the condition of the MP Also control the operations FLAGS are upward compatible from 8086/8088 to Pentium/Pentium Pro Figure 2.2: The EFLAG and FLAG registers

The FLAGs Carry Flag – C C = 1 if there is a carry out from the msb on addition Or, there is a borrow into the msb on subtraction Otherwise C = 0 C flag is also affected by shift and rotate instructions 10101010 11101010 111010100 C = 1, in this case

The FLAGs Parity Flag – P P = 1 for even parity, if number contains even number of ones P = 0 for odd parity, if odd number of ones 10101010 10101011 Even number of ones Odd number of ones P = 0 P = 1 Definition changes from microprocessor to microprocessor

The FLAGs Zero Flag – Z Sign Flag – S Z = 1 for zero result Z = 0 for non-zero result Sign Flag – S S = 1 if msb of a result is 1, means negative number S = 0 if msb of a result is 0, means positive number

The FLAGs Trap Flag – T Direction Flag – D Enables trapping through an on-chip debugging feature T = 1 MP interrupts the flow of a program, i.e. debug mode is enabled T = 0 debug mode is disabled Direction Flag – D Selects increment/decrement mode of SI and/or DI registers during string instructions D = 1, decrement mode, STD (set direction) instruction used D = 0, increment mode, CLD (clear direction) instruction used

The FLAGs Overflow Flag – O O = 1 if signed overflow occurred O = 0 otherwise Overflow is associated with the fact of range of numbers represented in a computer 8 bit unsigned number range (0 to 255) 8 bit signed number range (-128 to 127) 16 bit unsigned number range (0 to 65535) 16 bit signed number range (-32768 to 32767)

Signed vs. Unsigned Overflow Let, AX = FFFFh, BX = 0001h and execute ADD AX, BX 1111 1111 1111 1111 + 0000 0000 0000 0001 1 0000 0000 0000 0000 AX BX Unsigned interpretation Correct answer is 10000h = 65536 But this is out of range. 1 is carried out of msb, AX = 0000h, which is wrong Unsigned overflow occured Signed interpretation FFFFh = -1, 0001h = 1, summation is -1+1 = 0 Singned overflow did not occur

How instructions affect the flags? Every time the processor executes a instruction, the flags are altered to reflect the result Let us take the following flags and instructions Sign Flag – S Parity Flag – P Zero Flag – Z Carry Flag – C MOV/XCHG ADD/SUB INC/DEC NEG None All All except C All (C = 1 unless result is 0)

Example 1 Let AX = FFFFh, BX = FFFFh and execute ADD AX, BX S P Z C 1 FFFEh The result stored in AX is FFFEh = 1111 1111 1111 1110 S P Z C = 1 because the msb is 1 = 0 because the are 15 of 1 bits, odd parity = 0 because the result is non-zero = 1 because there is a carry out of the msb on addition

Example 2 Let AX = 8000h, BX = 0001h and execute SUB AX, BX S P Z C 7FFFh The result stored in AX is 7FFFh = 0111 1111 1111 1111 S P Z C = 0 because the msb is 0 = 0 because the are 15 of 1 bits, odd parity = 0 because the result is non-zero = 0 because there is no carry

Registers 16 bit Segment registers

Segment Registers Segment n * SS A000h Segment 2 DS 8000h Segment 1 16 bit Segment registers 0000h CS

An Assembly Program #include <stdio.h> void main () { int I, j ; ********* // comment ********* } Example 3-5 of Barry B. Brey’s book

An Assembly Program Cont. AH AL 00h 10h AX BH BL AAh AAh BX What is the content of BX? 10h 00h AAh DATA1 DATA2 DATA3 DATA4

Assembly Language Structure

An Assembly Program SMALL model allows one data segment and one code segment TINY model directs the assembler to assemble the program into a single segment DB for Define Byte (one single byte) DW for Define Word (two consecutive bytes) 10h 00h AAh DATA1 DATA2 DATA3 DATA4

Another Example

References Ch 6, Digital Logic and Microcomputer Design – by M. Rafiquzzaman Ch 2, Intel Microprocessors – by Brey Ch 5, Assembly Language Programming – by Charls Marut