INSTRUCTION SET AND ASSEMBLY LANGUAGE PROGRAMMING

Slides:



Advertisements
Similar presentations
Chapter 2 (cont.) An Introduction to the 80x86 Microprocessor Family Objectives: The different addressing modes and instruction types available The usefulness.
Advertisements

Machine/Assembler Language Putting It All Together Noah Mendelsohn Tufts University Web:
COMP 2003: Assembly Language and Digital Logic
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.
Chapter 3 Addressing Modes
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.
The 8086 Assembly Programming Data Allocation & Addressing Modes
Addressing Modes Instruction – Op-code – Operand Addressing mode indicates a way of locating data or operands. – Any instruction may belong to one or more.
© 2006 Pearson Education, Upper Saddle River, NJ All Rights Reserved.Brey: The Intel Microprocessors, 7e Chapter 2 The Microprocessor and its Architecture.
1 ICS 51 Introductory Computer Organization Fall 2006 updated: Oct. 2, 2006.
ICS312 Set 3 Pentium Registers. Intel 8086 Family of Microprocessors All of the Intel chips from the 8086 to the latest pentium, have similar architectures.
Microprocessor Systems Design I
Microprocessor Systems Design I Instructor: Dr. Michael Geiger Spring 2013 Lecture 4: 80386DX memory, addressing.
Microprocessor Systems Design I Instructor: Dr. Michael Geiger Spring 2014 Lecture 4: x86 memory.
© 2006 Pearson Education, Upper Saddle River, NJ All Rights Reserved.Brey: The Intel Microprocessors, 7e Chapter 2 The Microprocessor and its Architecture.
Chapter 3: Addressing Modes. Copyright ©2009 by Pearson Education, Inc. Upper Saddle River, New Jersey All rights reserved. The Intel Microprocessors:
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.
CSC 221 Computer Organization and Assembly Language
An Introduction to 8086 Microprocessor.
Faculty of Engineering, Electrical Department,
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.
Types of Registers (8086 Microprocessor Based)
Faculty of Engineering, Electrical Department,
UHD:CS2401: A. Berrached1 The Intel x86 Hardware Organization.
(-133)*33+44* *33+44*14 Input device memory calculator Output device controller Control bus data bus memory.
Chapter 2 Parts of a Computer System. 2.1 PC Hardware: Memory.
Computers organization & Assembly Language Chapter 1 THE 80x86 MICROPROCESSOR.
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.
University of Sargodha, Lahore Campus Prepared by Ali Saeed.
Addressing Modes. Addressing Mode The data is referred as operand. The operands may be contained in registers, memory or I/O ports, within the instruction.
Computer Organization & Assembly Language University of Sargodha, Lahore Campus Prepared by Ali Saeed.
Internal Programming Architecture or Model
Computer Organization & Assembly Language University of Sargodha, Lahore Campus Prepared by Ali Saeed.
Microprocessors CSE- 341 Dr. Jia Uddin Assistant Professor, CSE, BRAC University Dr. Jia Uddin, CSE, BRAC University.
Intel MP Organization. Registers - storage locations found inside the processor for temporary storage of data 1- Data Registers (16-bit) AX, BX, CX, DX.
Addressing Modes Instruction – Op-code – Operand Addressing mode indicates a way of locating data or operands. – Any instruction may belong to one or more.
Microprocessors CSE- 341 Dr. Jia Uddin Assistant Professor, CSE, BRAC University Dr. Jia Uddin, CSE, BRAC University.
Homework Reading Lab with your assigned section starts next week
Instruction set Architecture
Credits and Disclaimers
Format of Assembly language
Microprocessor Systems Design I
Difference between Microprocessor and Microcontroller
Introduction to 8086 Microprocessor
Computer Organization & Assembly Language Chapter 3
COURSE OUTCOMES OF MICROPROCESSOR AND PROGRAMMING
ADDRESSING MODES.
Assembly IA-32.
ADDRESSING MODES.
Homework Reading Continue work on mp1
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 Registers Module M14.2 Sections 9.2, 10.1.
Morgan Kaufmann Publishers Computer Organization and Assembly Language
Symbolic Instruction and Addressing
The Microprocessor & Its Architecture
Symbolic Instruction and Addressing
CNET 315 Microprocessor & Assembly Language
Computer Architecture CST 250
Unit-I 80386DX Architecture
Machine-Level Programming II: Basics Comp 21000: Introduction to Computer Organization & Systems Instructor: John Barr * Modified slides from the book.
Chapter 6 –Symbolic Instruction and Addressing
Credits and Disclaimers
Presentation transcript:

INSTRUCTION SET AND ASSEMBLY LANGUAGE PROGRAMMING RTA: (06 : 06) CHAPTER 3 INSTRUCTION SET AND ASSEMBLY LANGUAGE PROGRAMMING CLO 3: construct a simple program in assembly language to perform a given task Summary : This topic introduces the instruction set, data format, addressing modes, status flag and assembly language programming.

3.1 UNDERSTANDING INSTRUCTION SET AND ASSEMBLY LANGUAGE

3.1.1 Define instruction set,machine and assembly language An instruction set is a list of commands ready to be executed directly by CPU. We can simply say that the functions of instruction set is to instruct all CPU's with a set of instruction that can tells the CPU where to find data when to read the data  what to do with the data Now we will see some of the type of instruction set. Data transfer instruction Arithmetic instruction Logical instruction and bit manipulation Program control instruction Processing control instruction Shift and rotate instruction

Machine Language A machine language sometimes referred to as machine code or object code. Machine language is a collection of binary digits or bits that the computer reads and interprets. Machine language is the only language a computer is capable of understanding. Machine language consists of 0s and 1s.

Assembly Language Is a low-level programming language for computers,microprocessors,  microcontrollers and other programmable devices.  Assembly language is just one level higher than machine language. Assembly language consists of simple codes. Each statement in an assembly language corresponds directly to a machine code understood by the microprocessor. The software used to convert an assembly program into machines codes is called an assembler.

high Level Programming Low Level Programming

3.1.2 Describe features and architectures of various type of microprocessor MOTOROLA 6800 The Motorola 68000 is a 32-bit CISC microprocessor. 24 bit address bus 16 bit data bus.

INTEL 8086 8086 has 16-bit ALU; this means 16-bit numbers are directly processed by 8086. It has 16-bit data bus, so it can read data or write data to memory or I/O ports either 16 bits or 8 bits at a time. It has 20 address lines, so it can address up to 220 i.e. 1048576 = 1Mbytes of memory (words i.e. 16 bit numbers are stored in consecutive memory locations).

3.1.3 Describe the Addressing Modes Many instructions, such as MOV, operates on two operands. MOV dest, source Addressing mode indicates where the operands are located. There are various addressing modes in x86. Register, immediate, direct, register indirect, base-plus-index, register relative, base relative-plus-index, Register is a storage element inside a microprocessor.

ADDRESSING MODES

1. Register Addressing Instruction gets its source data from a register. Data resulting from the operation is stored in another register. Data length depends on register being used. 8-bit registers: AH, AL, BH, BL, CH, CL, DH, DL. 16-bit registers: AX, BX, CX, DX, SP, BP, SI, DI. 32-bit registers: EAX, EBX, ECX, EDX, ESP, EBP, EDI, ESI. 64-bit registers: RAX, RBX, RCX, RDX, RSP, RBP, RDI, RSI, and R8 through R15.

1.Register Addressing Examples: MOV AX, BX ;Copy the 16-bit content of BX to AX MOV AL, BL ;Copy the 8-bit content of BL to AL MOV SI, DI ;Copy DI into SI MOV DS, AX ;Copy AX into DS Note that the instruction must use registers of the same size. Cannot mix between 8-bit and 16-bit registers. Will result in an error when assembled.

2. Immediate Addressing The source data is coded directly into the instruction. The term immediate means that the data immediately follows the hexadecimal opcode in the memory. Immediate data are constant data such as a number, a character, or an arithmetic expression. Examples: MOV AX, 100 MOV BX, 189CH MOV AH, 10110110B MOV AL, (2 + 3)/5

3. Direct Addressing The operand is stored in a memory location, usually in data segment. The instruction takes the offset address. This offset address must be put in a bracket [ ]. Example: MOV [1234H], AL The actual memory location is obtained by combining the offset address with the segment address in the segment register DS (unless specified otherwise) If we want to use another segment register such as ES, you can use the syntax ES:[1234H] Assuming DS = 1000H, then this instruction will move the content of AL into the memory location 1234H.

4. Register Indirect Addressing Similar to direct data addressing, except that the offset address is specified using an index or base register. Base registers = BP, BX. Index registers = DI, SI. In 80386 and above, any register (EAX, EBX, ECX, EDX, EBP, EDI, ESI) can store the offset address. The registers must be specified using a bracket [ ]. DS is used as the default segment register for BX, DI and SI. Example: MOV AX, [BX] Assuming DS = 1000H and BX = 1234H, this instruction will move the content memory location 11234H and 11235H into AX.

5. Base-plus-index Addressing Similar to register indirect addressing, except that the offset address is obtained by adding a base register (BP, BX) and an index register (DI, SI). Example: MOV [BX+SI], BP Assuming DS = 1000H, BX = 0300H and SI = 0200H, this instruction will move the content of register BP to memory location 10500H.

6. Register Relative Addressing Similar to register indirect addressing, except that the offset address is obtained by adding an index or base register with a displacement. Example 1: MOV AX, [DI+100H] Assuming DS = 1000H and DI = 0300H, this instruction will move the content from memory location 10400H into AX. Example 2: MOV ARRAY[SI], BL Assuming DS = 1000H, ARRAY = 5000H and SI = 500H, this instruction will move the content in register BL to memory location 15500H.

7. Base Relative-plus-index Addressing Combines the base-plus-index addressing and relative addressing. Examples: MOV AH, [BX+DI+20H] MOV FILE[BX+DI], AX MOV LIST[BP+SI+4], AL

3.2 APPLY ASSEMBLY LANGUAGE

3.2.1 Write simple program in assembly language Example of assembly languange: MOV CL, 55H ; move 55H into register CL MOV DL, CL ; copy the contents of CL into DL (now DL=CL=55H) MOV AH, DL ; copy the contents of DL into AH (now AH=CL=55H) MOV AL, AH ; copy the contents of AH into AL (now AL=AH=55H) MOV BH, CL ; copy the contents of CL into BH (now BH=CL=55H) MOV CH, BH ; copy the contents of BH into CH (now CH=BH=55H) HLT

3.2.2 Tool in analyzing and debugging assembly language program Emulator 8086k –analyze for INTEL 8086 Easy68k- analyze for MOTOROLA 6800