SPRING TERM BM 310E MICROPROCESSORS LABORATORY PRELIMINARY STUDY

Similar documents
Code segment Stack segment

EXPERIMENT WRITE UP. LEARNING OBJECTIVES: 1. Get hands on experience with Assembly Language Programming 2. Write and debug programs in TASM/MASM

8086 INTERNAL ARCHITECTURE

Intel 8086 MICROPROCESSOR ARCHITECTURE

Intel 8086 MICROPROCESSOR. By Y V S Murthy

9/25/ Software & Hardware Architecture

MICROPROCESSOR PROGRAMMING AND SYSTEM DESIGN

Ex: Write a piece of code that transfers a block of 256 bytes stored at locations starting at 34000H to locations starting at 36000H. Ans.

icroprocessor istory of Microprocessor ntel 8086:

BAHAR DÖNEMİ MİKROİŞLEMCİLER LAB4 FÖYÜ

Intel 8086: Instruction Set

Lecture 5:8086 Outline: 1. introduction 2. execution unit 3. bus interface unit

Signed number Arithmetic. Negative number is represented as

UNIT-I. 1.Draw and explain the Architecture of a 8085 Microprocessor?

INSTRUCTOR: ABDULMUTTALIB A. H. ALDOURI

ADVANCE MICROPROCESSOR & INTERFACING

Marking Scheme. Examination Paper Department of CE. Module: Microprocessors (630313)

UNIT 2 PROCESSORS ORGANIZATION CONT.

Marking Scheme. Examination Paper. Module: Microprocessors (630313)

Summer 2003 Lecture 4 06/14/03

Microprocessor and Assembly Language Week-5. System Programming, BCS 6th, IBMS (2017)

Chapter Four Instructions Set

US06CCSC04: Introduction to Microprocessors and Assembly Language UNIT 1: Assembly Language Terms & Directives

8086 INSTRUCTION SET

Module 3 Instruction Set Architecture (ISA)

Introduction to IA-32. Jo, Heeseung

INTRODUCTION TO IA-32. Jo, Heeseung

Internal architecture of 8086

VARDHAMAN COLLEGE OF ENGINEERING (AUTONOMOUS) Shamshabad, Hyderabad

PESIT Bangalore South Campus

CS401 Assembly Language Solved MCQS From Midterm Papers

Complex Instruction Set Computer (CISC)

Arithmetic Instructions

Lecture 5: Computer Organization Instruction Execution. Computer Organization Block Diagram. Components. General Purpose Registers.

EC 333 Microprocessor and Interfacing Techniques (3+1)

Basic Execution Environment

SPRING TERM BM 310E MICROPROCESSORS LABORATORY PRELIMINARY STUDY

Ex : Write an ALP to evaluate x(y + z) where x = 10H, y = 20H and z = 30H and store the result in a memory location 54000H.

Introduction to Microprocessor

A Presentation created By Ramesh.K Press Ctrl+l for full screen view

8086 Programming. Multiplication Instructions. Multiplication can be performed on signed and unsigned numbers.

X86 Addressing Modes Chapter 3" Review: Instructions to Recognize"

CC411: Introduction To Microprocessors

SRI VENKATESWARA COLLEGE OF ENGINEERING AND TECHNOLOGY DEPARTMENT OF ECE EC6504 MICROPROCESSOR AND MICROCONTROLLER (REGULATION 2013)

Lecture 15 Intel Manual, Vol. 1, Chapter 3. Fri, Mar 6, Hampden-Sydney College. The x86 Architecture. Robb T. Koether. Overview of the x86

1. Introduction to Assembly Language

Section 001. Read this before starting!

Program controlled semiconductor device (IC) which fetches (from memory), decodes and executes instructions.

Assembler Programming. Lecture 2

Basic Assembly SYSC-3006

Assembly Language. Dr. Esam Al_Qaralleh CE Department Princess Sumaya University for Technology. Overview of Assembly Language

EC-333 Microprocessor and Interfacing Techniques

Arithmetic and Logic Instructions And Programs

Faculty of Engineering Computer Engineering Department Islamic University of Gaza Assembly Language Lab # 2 Assembly Language Fundamentals

Microprocessor. By Mrs. R.P.Chaudhari Mrs.P.S.Patil

CS401 Assembly Language Solved Subjective MAY 03,2012 From Midterm Papers. MC

complement) Multiply Unsigned: MUL (all operands are nonnegative) AX = BH * AL IMUL BH IMUL CX (DX,AX) = CX * AX Arithmetic MUL DWORD PTR [0x10]

Q1: Multiple choice / 20 Q2: Protected mode memory accesses

The x86 Architecture

The Microprocessor and its Architecture

An 8-Bit Scientific Calculator Based Intel 8086 Virtual Machine Emulator

IFE: Course in Low Level Programing. Lecture 6

MPID MICROPROCESSOR AND ITS INTERFACING DEVICES EEE III II SEMESTER OBJECTIVE QUESTIONS

if 2 16bit operands multiplied the result will be

db "Please enter up to 256 characters (press Enter Key to finish): ",0dh,0ah,'$'

CSC 2400: Computer Systems. Towards the Hardware: Machine-Level Representation of Programs

Logic Instructions. Basic Logic Instructions (AND, OR, XOR, TEST, NOT, NEG) Shift and Rotate instructions (SHL, SAL, SHR, SAR) Segment 4A

Basic characteristics & features of 8086 Microprocessor Dr. M. Hebaishy


Read this before starting!

We will first study the basic instructions for doing multiplications and divisions

Program controlled semiconductor device (IC) which fetches (from memory), decodes and executes instructions.

Chapter 2 COMPUTER SYSTEM HARDWARE

Section 002. Read this before starting!

CSC 8400: Computer Systems. Machine-Level Representation of Programs

x86 Assembly Tutorial COS 318: Fall 2017

EXPERIMENT WRITE UP. LEARNING OBJECTIVES: 1. Get hands on experience with Assembly Language Programming 2. Write and debug programs in TASM/MASM

Addressing Modes on the x86

Machine-level Representation of Programs. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

BAHAR DÖNEMİ MİKROİŞLEMCİLER LAB3 FÖYÜ

Unit I Introduction. Department of Electronics and Communication Engineering VARDHAMAN COLLEGE OF ENGINEERING Shamshabad, Hyderabad , India.

Lecture (08) x86 programming 7

EEM336 Microprocessors I. Arithmetic and Logic Instructions

8086 Micro-Processors and Assembly Programming Forth Stage المعالجات الميكروية والبرمجة بلغة التجميع استاذة الماده: م.د ستار حبيب منعثر الخفاجي

Come and join us at WebLyceum

8088/8086 Programming Integer Instructions and Computations

Kingdom of Saudi Arabia Ministry of Higher Education. Taif University. Faculty of Computers & Information Systems

Section 001 & 002. Read this before starting!

SYSC3601 Microprocessor Systems. Unit 2: The Intel 8086 Architecture and Programming Model

SHEET-2 ANSWERS. [1] Rewrite Program 2-3 to transfer one word at a time instead of one byte.

Assignment no:4 on chapter no :3 : Instruction set of 8086

EEM336 Microprocessors I. Data Movement Instructions

16-Bit Intel Processor Architecture

Jones & Bartlett Learning, LLC NOT FOR SALE OR DISTRIBUTION 80x86 Instructions

US06CCSC04: Introduction to Microprocessors and Assembly Language UNIT 3: Assembly Language Instructions II

Chapter Three Addressing Mode MOV AX, BX

Assembly Language: IA-32 Instructions

We can study computer architectures by starting with the basic building blocks. Adders, decoders, multiplexors, flip-flops, registers,...

SOEN228, Winter Revision 1.2 Date: October 25,

UNIT III MICROPROCESSORS AND MICROCONTROLLERS MATERIAL OVERVIEW: Addressing Modes of Assembler Directives. Procedures and Macros

Transcription:

BACKGROUND 8086 CPU has 8 general purpose registers listed below: AX - the accumulator register (divided into AH / AL): 1. Generates shortest machine code 2. Arithmetic, logic and data transfer 3. One number must be in AL or AX 4. Multiplication & Division 5. Input & Output BX - the base address register (divided into BH / BL). CX - the count register (divided into CH / CL): 1. Iterative code segments using the LOOP instruction 2. Repetitive operations on strings with the REP command 3. Count (in CL) of bits to shift and rotate DX - the data register (divided into DH / DL): 1. DX:AX concatenated into 32-bit register for some MUL and DIV operations 2. Specifying ports in some IN and OUT operations

SI - source index register: 2016-2017 SPRING TERM 1. Can be used for pointer addressing of data 2. Used as source in some string processing instructions 3. Offset address relative to DS DI - destination index register: 1. Can be used for pointer addressing of data 2. Used as destination in some string processing instructions 3. Offset address relative to ES BP - base pointer: 1. Primarily used to access parameters passed via the stack 2. Offset address relative to SS SP - stack pointer: 1. Always points to top item on the stack 2. Offset address relative to SS 3. Always points to word (byte at even address) 4. An empty stack will have SP = FFFEh Flags Register determines the current state of the processor. They are modified automatically by CPU after mathematical operations, this allows to determine the type of the result, and to determine conditions to transfer control to other parts of the program. Generally, you cannot access these registers directly. Carry Flag (CF) - this flag is set to 1 when there is an unsigned overflow. For example, when you add bytes 255 + 1 (result is not in range 0...255). When there is no overflow this flag is set to 0. Parity Flag (PF) - this flag is set to 1 when there is even number of one bits in result, and to 0 when there is odd number of one bits.

Auxiliary Flag (AF) - set to 1 when there is an unsigned overflow for low nibble (4 bits). Zero Flag (ZF) - set to 1 when result is zero. For non-zero result this flag is set to 0. Sign Flag (SF) - set to 1 when result is negative. When result is positive it is set to0. (This flag takes the value of the most significant bit.) Trap Flag (TF) - Used for on-chip debugging. Interrupt enable Flag (IF) - when this flag is set to 1 CPU reacts to interrupts from external devices. Direction Flag (DF) - this flag is used by some instructions to process data chains, when this flag is set to 0 - the processing is done forward, when this flag is set to 1the processing is done backward. Overflow Flag (OF) - set to 1 when there is a signed overflow. For example, when you add bytes 100 + 50 (result is not in range -128...127). Instruction Operand(s) Description ADD SUB MUL DIV,,,,immediate,immediate,,,,immediate,immediate operand1 = operand1 + operand2 r r r r r r operand1 = operand1 - operand2 r r r r r r when operand is a byte: AX = AL * operand when operand is a word: (DX AX) = AX * operand CF=OF=0 when high section of the result is zero r?? r?? when operand is a byte: AL = AX / operand AH = remainder (modulus) when operand is a word: AX = (DX AX) / operand DX = remainder (modulus)??????

POP PUSH LOOP JMP CMP JNE JNZ S S immediate 4-byte address,,,, immediate, immediate Get 16 bit value from the stack operand = SS:[SP] (top of the stack) SP = SP + 2 Store 16 bit value in the stack SP = SP 2 SS:[SP] (top of the stack) = operand Decrease CX, jump to if CX not zero CX = CX 1 if CX!= 0 then jump else no jump, continue Unconditional Jump. Transfers control to another part of the program. result is not stored anywhere, flags are set (OF, SF, ZF, AF, PF, CF) according to result. r r r r r r Short Jump if first operand is Not Equal to second operand (as set by CMP instruction). Signed/Unsigned. if ZF = 0 then jump Short Jump if Not Zero (not equal). Set by CMP, SUB, ADD, TEST, AND, OR, XOR instructions. if ZF = 0 then jump JE Signed/Unsigned. if ZF = 1 then jump

LABORATORY PREPERATION QUESTION Q1: Write a program (in assembly language) which finds the sum of natural numbers that are less than 100 and divisible into 3 and 2. Result should be stored in data register. ; write your assembly code below ;insert comment to each line ORG 100H RET

Q2: Convert the following expression from infix to postfix. Evaluate 1 the postfix form by using stack data structure. Draw stack and SP in each step. Infix: 4 7 16/2 4 + 8 15/3 Postfix: Evaluation: (step by step) 1 This link may help you understand infix and postfix expressions: http://www.interactivepython.org/courselib/static/pythonds/basicds/infixprefixandpostfixexpressions.html