Instruction Classification and Addressing Mode 计算机学院 李征 Tel : 13882153765 : OICQ: 1340915.

Slides:



Advertisements
Similar presentations
Intel 8086.
Advertisements

8086 Ahad.
Memory Management 计算机学院 李征 Tel : : OICQ:
Programming 8086 – Part IV Stacks, Macros
Register In computer architecture, a processor register is a small amount of storage available on the CPU whose contents can be accessed more quickly than.
Registers of the 8086/ /2002 JNM.
There are two types of addressing schemes:
Computer Architecture and Operating Systems CS 3230 :Assembly Section Lecture 2 Department of Computer Science and Software Engineering University of Wisconsin-Platteville.
MICROPROCESSORS TWO TYPES OF MODELS ARE USED :  PROGRAMMER’S MODEL :- THIS MODEL SHOWS FEATURES, SUCH AS INTERNAL REGISTERS, ADDRESS,DATA & CONTROL BUSES.
Introduction to 8086 Microprocessor
CEN 226: Computer Organization & Assembly Language :CSC 225 (Lec#3) By Dr. Syed Noman.
6-1 ECE 424 Design of Microprocessor-Based Systems Haibo Wang ECE Department Southern Illinois University Carbondale, IL Intel 8088 Addressing modes.
Lect 3: Instruction Set and Addressing Modes. 386 Instruction Set (3.4) –Basic Instruction Set : 8086/8088 instruction set –Extended Instruction Set :
Azir ALIU 1 What is an assembly language?. Azir ALIU 2 Inside the CPU.
Stack Memory H H FFFFF H FFFFE H SS 0105 SP 0008 TOS BOS BOS = FFFF = 1104F H H 1104F H.
Addressing modes – 1 The way in which an operand is specified is called the Address Mode.
The 8086 Assembly Programming Data Allocation & Addressing Modes
Target Processor Directives , When using.386, the program can only run on 386 and above processors.
3-1 ECE 424 Design of Microprocessor-Based Systems Haibo Wang ECE Department Southern Illinois University Carbondale, IL Intel 8088 (8086) Microprocessor.
Unit-1 PREPARED BY: PROF. HARISH I RATHOD COMPUTER ENGINEERING DEPARTMENT GUJARAT POWER ENGINEERING & RESEARCH INSTITUTE Advance Processor.
Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 251 Introduction to Computer Organization.
The 8086 Microprocessor The 8086, announced in 1978, was the first 16-bit microprocessor introduced by Intel Corporation 8086 is 16-bit MPU. Externally.
Lect 4: Instruction Set and Addressing Modes. 386 Instruction Set (3.4)  Basic Instruction Set : 8086/8088 instruction set  Extended Instruction Set.
An Introduction to 8086 Microprocessor.
1/2002JNM1 Positional Notation (Hex Digits). 1/2002JNM2 Problem The 8086 has a 20-bit address bus. Therefore, it can access 1,048,576 bytes of memory.
MOHD. YAMANI IDRIS/ NOORZAILY MOHAMED NOOR1 Addressing Mode.
Types of Registers (8086 Microprocessor Based)
INSTRUCTION SET AND ASSEMBLY LANGUAGE PROGRAMMING
Microprocessor Microprocessor (cont..) It is a 16 bit μp has a 20 bit address bus can access upto 220 memory locations ( 1 MB). It can support.
(-133)*33+44* *33+44*14 Input device memory calculator Output device controller Control bus data bus memory.
Intel 8086 (8088) Microprocessor Structure
University of Tehran 1 Microprocessor System Design Omid Fatemi Machine Language Programming
University of Sargodha, Lahore Campus Prepared by Ali Saeed.
MODULE 5 INTEL TODAY WE ARE GOING TO DISCUSS ABOUT, FEATURES OF 8086 LOGICAL PIN DIAGRAM INTERNAL ARCHITECTURE REGISTERS AND FLAGS OPERATING MODES.
Microprocessor Fundamentals Week 2 Mount Druitt College of TAFE Dept. Electrical Engineering 2008.
Assembly Language Data Movement Instructions. MOV Instruction Move source operand to destination mov destination, source The source and destination are.
Internal Programming Architecture or Model
Computer Organization & Assembly Language University of Sargodha, Lahore Campus Prepared by Ali Saeed.
I NTEL 8086 M icroprocessor بسم الله الرحمن الرحيم 1.
Microprocessors CSE- 341 Dr. Jia Uddin Assistant Professor, CSE, BRAC University Dr. Jia Uddin, CSE, BRAC University.
Instruction set Architecture
Introduction to 8086 Microprocessor
8086 Microprocessor.
Computer Organization & Assembly Language Chapter 3
COURSE OUTCOMES OF MICROPROCESSOR AND PROGRAMMING
ADDRESSING MODES.
Microprocessor Systems Design I
ADDRESSING MODES.
University of Gujrat Department of Computer Science
Intel 8088 (8086) Microprocessor Structure
Assembly Lang. – Intel 8086 Addressing modes – 1
Morgan Kaufmann Publishers Computer Organization and Assembly Language
Symbolic Instruction and Addressing
Introduction to Assembly Language
Data Addressing Modes • MOV AX,BX; This instruction transfers the word contents of the source-register(BX) into the destination register(AX). • The source.
University of Gujrat Department of Computer Science
Intel 8088 (8086) Microprocessor Structure
8086 Registers Module M14.2 Sections 9.2, 10.1.
CS-401 Computer Architecture & Assembly Language Programming
Morgan Kaufmann Publishers Computer Organization and Assembly Language
Symbolic Instruction and Addressing
(Array and Addressing Modes)
CS 301 Fall 2002 Computer Organization
Symbolic Instruction and Addressing
(Array and Addressing Modes)
CNET 315 Microprocessor & Assembly Language
Lecture 06 Programming language.
Unit-I 80386DX Architecture
Chapter 6 –Symbolic Instruction and Addressing
(Array and Addressing Modes)
Presentation transcript:

Instruction Classification and Addressing Mode 计算机学院 李征 Tel : : OICQ:

Assembler and Machine Instruction In principle, assembler instruction correspond with machine instruction one by one. However, there are few exceptions. Because it is easy to remember, programmer only learn assembler instructions.

Assembler and Machine Instruction The syntax restriction in assembler instructions are introduced from corresponding machine instructions. These syntax restrictions is decided by CPU architecture.

Instruction Composition OPR DEST, SRC OPR: Operation Code to present instruction function SRC: Source data for operation DEST: Destination address for operation result, maybe provide source data too

Instruction Classification (1) 1) Instruction with two operation data OPR DEST, SRC DEST can be register, memory cell SRC can be register, memory cell, immediate data ( 立即数 )

1) Instruction with two operation data DEST and SRC can be 8-bit or 16-bit. The length of DEST and SRC must be consistent. Only one memory cell can appear at DEST or SRC.

1) Instruction with two operation data Example: MOV AX, BX ;1 SRC, 1 DEST MOV VAR1, BL MOV AL, 08H ADD AL, BL ;2 SRC, 1 DEST Error Usage: MOV 32H, AL MOV AL, 9A4BH MOV VAR1, VAR2

Instruction Classification (1) 2) Instruction with one operation data OPR DEST Actually, one or two data are both possible. DEST can be register or memory cell, 8-bit or 16-bit Note: Immediate data can not used in instructions with one data.

2) Instruction with one operation data Examples: NEG AX ; 1 SRC, 1 DEST PUSH AX ; 1 SRC, 1 implied DEST Error Usage: PUSH 2A45H

Instruction Classification (1) 3) Instruction with no operation data OPR Actually, one or two data are possible too.

3) Instruction with no operation data Example: NOP ; No SRC and DEST CLC ; 1 implied DEST POPF ; 1 implied SRC, 1 implied DEST

Instruction Classification (2) 1) Transfer instruction 2) Arithmetic instruction 3) Bit Manipulation instruction 4) String instruction 5) Program transfer instruction 6) Processor control instruction

Addressing Mode Addressing mode means how CPU obtain the operation data in instructions. (1) Register Addressing (2) Immediate Addressing (3) Memory Addressing (4) String Addressing (5) I/O Port Addressing

Addressing Mode Addressing Mode is a concept for operation data, not for instruction. If there are two operation data in an instruction, there may be two different addressing modes. Example: MOV AX, VAR1 DEST: Register Addressing SRC: Memory Addressing

(1) Register Addressing If operation data is in CPU register, the addressing mode is register addressing. Example: mov al, bl DEST: Register addressing SRC: Register addressing

(1) Register Addressing Because no bus operation needed in register addressing, it is the fastest addressing mode of CPU.

(2) Immediate Addressing If the operation data is immediate data in instructions, the addressing mode is immediate addressing. Example: mov al, 02h DEST: Register Addressing SRC: Immediate Addressing

(2) Immediate Addressing Because immediate data is part of instruction, it will be loaded to instruction queue in instruction reading cycle (not execution cycle). Bus operation is needed for reading data. However, because EU and BIU can work synchronously, the time consumed in immediate data reading can be ignored in some situations.

Memory Addressing When operation data is in memory, the addressing mode is memory addressing. Bus operation is needed in this addressing mode, and memory Addressing must be executed in execution cycle of instruction. Then, memory addressing is less effective than register or immediate addressing.

Memory Addressing Memory logic address is composed of segment base value and offset (effective address). There are five different memory addressing modes, and they have different offset (EA) composing.

Components of EA There are three different components which can be combined to EA. DISP (Disparity, 位移量 ): EA components provided by machine instruction Base Component ( 基址分量 ): Provided by BX or BP register Index Component ( 变址分量 ): Provided by SI or DI register

Memory Addressing Different combination mode of these three components forms different memory addressing. 1) Direct Addressing ( 直接寻址 ) 2) Register Indirect Addressing ( 寄存器间接寻址 ) 3) Based Addressing ( 基址寻址 ) 4) Indexed Addressing ( 变址寻址 ) 5) Based Indexed Addressing ( 基址变址寻址 )

1) Direct Addressing If EA is composed of DISP only, it is direct addressing. EA = DISP DISP may be data form or symbol form in assembler language.

1) Direct Addressing Example: MOV BX, [1000H] ; implied DS for segment information MOV BX, DS:[1000H] MOV BX, ES:[0100H]

1) Direct Addressing Example: MOV BX, VAR1 ; VAR1 is a symbol disparity. MOV AL, DA1+3 ; DA1 is a symbol disparity. Symbol disparity will be replaced as data form by assembler ( 汇编程序 ).

1) Direct Addressing False usage: MOV [0100H], 04H ; 16-bit or 8-bit? It is a syntax error. Correct one: MOV BYTE PTR [0100H], 04H

2) Register Indirect Addressing If EA is provided by one register entirely, it is register indirect addressing. EA = ( BX ) EA = ( BP ) EA = ( SI ) EA = ( DI )

2) Register Indirect Addressing Examples: MOV AL, [BX] MOV BYTE PTR [SI], 03H ADD [DI], BL ; BX, SI, and DI imply DS MOV [BP], AX ;BP imply SS ADD DS:[BP], AL

3) Based Addressing If EA is composed of base component and DISP, it is based addressing. EA = ( BX ) + Disp EA = ( BP ) + Disp

4) Indexed Addressing If EA is composed of index component and DISP, it is indexed addressing. EA = ( SI ) + Disp EA = ( DI ) + Disp

Based Addressing and Indexed Addressing Example: MOV AX , 10H[SI] DEST: Register Addressing SRC: Indexed Addressing, EA = 10H+(SI), DS is implied.

Based Addressing and Indexed Addressing Example: MOV TAB1[BP] , CL DEST: Based addressing, EA=TAB1+(BP), and SS is implied. SRC: Register addressing

Based Addressing and Indexed Addressing Do you remember the 1D array in high- level language? BX, BP, SI, DI can be the subscript variable when the array is operated.

5) Based Indexed Addressing If EA is composed of three components, it is based indexed addressing. EA = ( BX ) + ( SI ) + Disp EA = ( BX ) + ( DI ) + Disp EA = ( BP ) + ( SI ) + Disp EA = ( BP ) + ( DI ) + Disp BX imply DS, and BP imply SS.

5) Based Indexed Addressing Example: MOV AX , 200H[BX][SI] SRC: Based indexed addressing, EA = 200H+(BX)+(SI), DS is implied.

5) Based Indexed Addressing Example: MOV TAB1[BP][DI] , DL DEST: Based indexed addressing, EA = TAB1+(BP)+(DI), and SS is implied. Do you remember 2D arrays in high-level language? How about n-D arrays?

Note in Memory Addressing ; Are they different? MOV AL , [BX] ; not use ALU MOV AL , 10H[BX] ; ALU used ; Are they different? MOV AL , [BX][SI] MOV AL , 20H[BX][SI]

(4) String Addressing In string operation instructions, the addressing mode are all string addressing. No time for string operation now, sorry!

(5) I/O port Addressing When operation data is in I/O port, the addressing mode is I/O port addressing. In 8086/8088, the I/O operation and memory operation are distinguished by control signal on system bus. So, different instructions used to I/O and memory operation.

(5) I/O port Addressing In 8086/8088, only input and output instruction can operate I/O port. All instructions which can operate memory cell can not operate I/O port.

(5) I/O port Addressing Unlike the 20-bit physic address of memory cell, the physic address of I/O port is only 16-bit. When I/O operation occurs, only lower 16 bits of address bus is valid. There is no segment management in I/O port space.

(5) I/O port Addressing There are two addressing modes for I/O port addressing. Direct Addressing: Port address is provided by instruction. Indirect Addressing: Port address is provided by DX register.

(5) I/O port Addressing Example: IN AL, 60H ; 8-bit operation SRC: Direct I/O port addressing, can only provide address as 0~255 (8 bit address) OUT 40H, AX ;16-bit operation

(5) I/O port Addressing Example: MOV DX, 0FF55H IN AL, DX SRC: Indirect I/O port addressing, can provide 16-bit port address (0~65535) 64K is the I/O space size in 8086/8088.