Symbolic Instruction and Addressing

Slides:



Advertisements
Similar presentations
Intel 8086.
Advertisements

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.
Introduction to 8086 Microprocessor
CEN 226: Computer Organization & Assembly Language :CSC 225 (Lec#3) By Dr. Syed Noman.
ICS312 Set 6 Operands. Basic Operand Types (1) Register Operands. An operand that refers to a register. MOV AX, BX ; moves contents of register BX to.
Azir ALIU 1 What is an assembly language?. Azir ALIU 2 Inside the CPU.
80x86 Processor Architecture
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.
An Introduction to 8086 Microprocessor.
Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 251 Introduction to Computer Organization.
Types of Registers (8086 Microprocessor Based)
Click to add Title Comunicación y Gerencia Click To add Subtitle Click to add Text Fundamentals of Assembly Language.
Assembly Language. Symbol Table Variables.DATA var DW 0 sum DD 0 array TIMES 10 DW 0 message DB ’ Welcome ’,0 char1 DB ? Symbol Table Name Offset var.
University of Sargodha, Lahore Campus Prepared by Ali Saeed.
Computer Organization & Assembly Language University of Sargodha, Lahore Campus Prepared by Ali Saeed.
Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 251 Introduction to Computer Organization.
Assembly Language Lecture 2. Lecture Outline Program Structure Memory models Data Segment Stack Segment Code Segment Input and Output Instructions INT.
Internal Programming Architecture or Model
Computer Organization & Assembly Language University of Sargodha, Lahore Campus Prepared by Ali Saeed.
Intel MP Organization. Registers - storage locations found inside the processor for temporary storage of data 1- Data Registers (16-bit) AX, BX, CX, DX.
I NTEL 8086 M icroprocessor بسم الله الرحمن الرحيم 1.
ΜComputer Structure μProcessor Memory Bus System I/O Ports.
Assembly language programming
Instruction set Architecture
Format of Assembly language
Data Transfers, Addressing, and Arithmetic
UNIT Architecture M.Brindha AP/EIE
Introduction to 8086 Microprocessor
8086 Microprocessor.
Computer Organization & Assembly Language Chapter 3
COURSE OUTCOMES OF MICROPROCESSOR AND PROGRAMMING
ADDRESSING MODES.
Microprocessor and Assembly Language
Assembly Language Programming Part 2
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
Defining Types of data expression Dn [name] expression Dn [name]
Symbolic Instruction and Addressing
Introduction to Assembly Language
BIC 10503: COMPUTER ARCHITECTURE
Data Addressing Modes • MOV AX,BX; This instruction transfers the word contents of the source-register(BX) into the destination register(AX). • The source.
8086 MICROPROCESSOR PROGRAMMING – INTEGER INSTRUCTIONS AND COMPUTATIONS Amar Saraswat.
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
Shift & Rotate Instructions)
The Microprocessor & Its Architecture
(Array and Addressing Modes)
Lecture 06 Programming language.
University of Gujrat Department of Computer Science
Computer Architecture CST 250
Microprocessor and Assembly Language
Unit-I 80386DX Architecture
UNIT-II Assembly Language Programs Involving Logical
Chapter 6 –Symbolic Instruction and Addressing
Process.
Intel 8086.
Chapter 8: Instruction Set 8086 CPU Architecture
Part I Data Representation and 8086 Microprocessors
(Array and Addressing Modes)
Presentation transcript:

Symbolic Instruction and Addressing Lecture 2 Symbolic Instruction and Addressing

Chapter Outline Registers Data Transfer Instruction Basic Arithmetic Instruction The INT Instruction

Registers Information inside the microprocessor is stored in registers. The registers are classified according to the functions they perform In general there are fourteen 16-bit registers: Data registers: There are four general data registers. They hold data for an operation. Address registers: They are divided into segment, pointer, and index registers. They hold the address of an instruction or data. Status register: It is called the FLAGS register. It keeps the current status of the processor.

Pointer and Index Registers Data Registers AX AH AL BH BL BX CX CH CL DX DH DL Segment Registers CS DS SS ES Pointer and Index Registers SI DI SP BP IP FLAGS Register

Data Registers: AX, BX, CX, DX These four registers, in addition to being general-purpose registers, also perform special functions. The high and low bytes of these registers can be accessed separately. Ex. The high byte of AX is called AH, and the low byte is called AL. This arrangement gives us more registers to use when dealing with byte-size data.

Data Registers: AX, BX, CX, DX AX (Accumulator Register) is the preferred register to use in arithmetic, logic, and data transfer instructions BX (Base Register) also serves as an address register. CX (Count Register) Program loop constructions are facilitated by the use of CX, which serves as a loop counter. DX (Data Register) is used in multiplication and division.

Address Registers - Segment Registers CS, DS, SS, ES Address registers store addresses of instructions and data in memory. To keep track of the various program segments, the 8086 is equipped with four segments registers to hold segment numbers: CS (Code Segment): contains the code segment number. DS (Data segment): contains the data segment number. SS (Stack Segment): contains the stack segment number. ES (Extra Segment): is used if a program needs to access a second data segment.

Pointer and Index Registers: SP, IP Address Registers - Pointer and Index Registers: SP, IP SP (Stack Pointer) register is used in conjunction with SS for accessing the stack segment. IP is updated each time an instruction is executed so that it will point to the next instruction. Unlike other registers, the IP cannot be directly manipulated by an instruction (i.e. The instruction cannot contain IP as its operand).

Data Transfer Instruction MOV XCHG LEA

MOV Instruction The MOV (move) instruction is used to: Transfer data between Registers. Transfer data between registers and memory locations. Move a number directly into a register or memory location. Syntax: MOV destination, source Example: MOV AX, WORD1 MOV AX, BX MOV AX, 'A' Note: any register can be used except CS & IP Before After 0006 0008 AX AX 0008 0008 WORD1 WORD1

Legal Combinations of operands for MOV Destination Operand General Segment Memory Source operand register register location Constant General register yes yes yes no Segment register yes no yes no Memory location yes yes no no Constant yes no yes no Illegal: MOV WORD1, WORD2 • Legal: MOV AX, WORD2 MOV WORD1, AX Illegal: MOV DS, CS • Legal: MOV AX, CS MOV DS, AX

Type Agreement of Operands The operands of any two-operand instruction must be of the same type (i.e. Both bytes or words). Illegal: MOV AX, BYTE1 However, the assembler will accept both of the following: MOV AH, 'A' moves 41H into AH MOV AX, 'A' moves 0041H into AX

XCHG Instruction The XCHG (exchange) operation is used to exchange the contents of: Two registers. A register and a memory location. Syntax: XCHG destination, source Example: XCHG AH, BL XCHG AX,WORD1 Before After AH AL AH AL BH BL BH BL 1A 00 05 00 00 05 00 1A

Legal Combinations of operands for XCHG Destination Operand General Memory Source Operand register location General register yes yes Memory location yes no

LEA Instruction LEA (Load Effective Address) puts a copy of the source offset address into the destination. Syntax: LEA destination, source Where destination is a general register and source is a memory location Example: MSG DB 41H, 42H, 43H LEA DX, MSG puts the offset address of the variable MSG into DX. Data Definition + Basic Instructions 17

Basic Arithmetic Instruction ADD SUB INC DEC

ADD and SUB Instructions The ADD (add) and SUB (subtract) instructions are used to: Add/subtract the contents of: Two registers. A register and a memory location. Add/subtract a number to/from a register or memory location. Syntax: ADD destination, source SUB destination, source Examples: ADD WORD1, AX SUB AX, DX Before After 01BC 01BC AX AX 0523 06DF WORD1 WORD1 Before After 0000 FFFF AX AX 0001 0001 DX DX

Legal Combinations of operands for ADD & SUB Destination Operand General Memory Source Operand register location General register yes yes Memory location yes no Constant yes yes Illegal: ADD BYTE1, BYTE2 Legal: MOV AL, BYTE2 ADD BYTE1, AL

INC and DEC Instructions INC (increment) is used to add 1 to the contents of a register or memory location. DEC (decrement) is used to subtract 1 from a register or memory location. Syntax: INC destination DEC destination Examples: INC WORD1 DEC BYTE1 Before After WORD1 WORD1 0002 0003 Before After BYTE1 BYTE1 FFFE FFFD

INT Instruction To invoke a DOS or BIOS routine, the INT (interrupt) instruction is used. Format: INT interrupt_number where interrupt_number is a number that specifies a routine.

INT 21h INT 21h may be used to invoke a large number of DOS functions. A particular function is requested by placing a function number in the AH register and invoking INT 21h. Some of the functions are: INT21h functions expect input values to be in certain registers and return output values in other registers. Function number Routine 1 single-key input 2 single-character output 9 character string output

INT 21h Function 1: Single-Key Input Input: AH = 1 Output: AL = ASCII code if character key is pressed = 0 if non-character key is pressed To invoke the routine, the following instructions should be executed: MOV AH,1 ; input key function INT 21H ; ASCII code in AL

INT 21h Function 2: Display a character or execute a control function Input: AH = 2 DL = ASCII code of the character Output AL = ASCII code of the character To invoke the routine, the following instructions should be executed: MOV AH, 2 ; display character function MOV DL, '?' ; character is '?' (or any other character) INT 21H ; display character

INT 21h Function 2 may be used to perform control functions. If DL contains the ASCII code of a control character, INT 21h causes the control function to be performed. The principal control characters are : ASCII code (Hex) Symbol Function 07H BEL beep (sounds a tone) 08H BS backspace 09H HT tab 0AH LF line feed (new line) 0DH CR carriage return (start of current line)

INT 21h Function 9: Display a string Input: AH = 9 DX = offset address of string. The string must end with a '$' character To invoke the routine, the following instructions should be executed: MOV AX, @DATA MOV DS, AX MOV AH, 9 ; display string function LEA DX, MSG ; get message (Load Effective Address) INT 21H ; display string A program containing a data segment should begins with these two instructions

INT 21h Function 4CH: Returning control to DOS Input: AH = 4CH To invoke the routine, the following instructions should be executed: MOV AH, 4CH ; DOS exit function INT 21H ; exit to DOS