Introduction to Assembly Language

Slides:



Advertisements
Similar presentations
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.
Advertisements

Registers of the 8086/ /2002 JNM.
Introduction to 8086 Microprocessor
CEN 226: Computer Organization & Assembly Language :CSC 225 (Lec#3) By Dr. Syed Noman.
Princess Sumaya Univ. Computer Engineering Dept. د. بســام كحـالــه Dr. Bassam Kahhaleh.
Azir ALIU 1 What is an assembly language?. Azir ALIU 2 Inside the CPU.
Princess Sumaya University
© 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.
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.
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.
Types of Registers (8086 Microprocessor Based)
INSTRUCTION SET AND ASSEMBLY LANGUAGE PROGRAMMING
Faculty of Engineering, Electrical Department,
1 ICS 51 Introductory Computer Organization Fall 2009.
UHD:CS2401: A. Berrached1 The Intel x86 Hardware Organization.
Chapter 2 Parts of a Computer System. 2.1 PC Hardware: Memory.
University of Tehran 1 Microprocessor System Design Omid Fatemi Machine Language Programming
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.
6-4 CPU-Registers, effective address General registers vs Segment registers Computer Studies (AL)
Introduction to Microprocessors Chapter 3. Programming Model (8086)  Shows the various internal registers that are accessible to the programmer.
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.
Internal Programming Architecture or Model
Intel 8086 MICROPROCESSOR ARCHITECTURE
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.
Computer Science 516 Intel x86 Overview. Intel x86 Family Eight-bit 8080, 8085 – 1970s 16-bit 8086 – was internally 16 bits, externally 8 bits.
Μ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.
An Introduction to 8086 Microprocessor.
UNIT Architecture M.Brindha AP/EIE
Introduction to 8086 Microprocessor
Assembly Language Programming Part 3
8086 Microprocessor.
Computer Organization & Assembly Language Chapter 3
ADDRESSING MODES.
Intel 8086 MICROPROCESSOR Architecture.
Basic Microprocessor Architecture
Assembly IA-32.
ADDRESSING MODES.
University of Gujrat Department of Computer Science
Intel 8088 (8086) Microprocessor Structure
Basic of Computer Organization
Defining Types of data expression Dn [name] expression Dn [name]
Symbolic Instruction and Addressing
BIC 10503: COMPUTER ARCHITECTURE
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
CS 301 Fall 2002 Computer Organization
Shift & Rotate Instructions)
The Microprocessor & Its Architecture
Symbolic Instruction and Addressing
CNET 315 Microprocessor & Assembly Language
Computer Architecture CST 250
Unit-I 80386DX Architecture
COMP 1321 Digital Infrastructure
Chapter 6 –Symbolic Instruction and Addressing
Process.
CSC 497/583 Advanced Topics in Computer Security
Chapter 8: Instruction Set 8086 CPU Architecture
Part I Data Representation and 8086 Microprocessors
Presentation transcript:

Introduction to Assembly Language

Overview What is Assembly Language? Why is AL important to learn? Machine instructions AL Instructions Intel 8086 Architecture Hands on Activity

What is Assembly Language (AL)? To learn how a computer and its software really work, you need to view them at machine level. Assembly language is a specific set of instructions for a particular computer system. AL teaches you about the way the computer’s hardware and OS work together and how application programs communicate with the OS. It is a programming language with a one-to-one correspondence between its statement and a computer’s main machine language.

Cont… Each computer or family of computers uses a different set of machine instructions and a different assembly language (the computer’s design influences the instructions it can execute). An assembler – a program that converts or translates source-code programs into machine language, which may in turn be executed by the computer (runs under the disk operating systems MS-DOS or PC-DOS).

Why is AL important to learn? Provides opportunity to know more about the operations of the PC Enable control of the PC – access to specific hardware features Quicker, smaller and have larger capacities compared to other HL languages

Machine Instructions A machine instruction is a binary code that has a special meaning for a computer’s CPU – it tells the computer to perform a task. Each machine instruction is precisely defined when the CPU is constructed, and it is specified to that type of CPU. For example: 00000100 Add a number to the AL register. 10100011 Move the AX register to another register

Registers are high-speed storage locations inside the CPU which are used by nearly every instructions They are identified by 2-letter names, such as AH, AL, AX and so on. We refer to machine instructions using hexadecimal numbers because they take up less writing space.

Assembly Language Instructions Mnemonic – a short alphabetic code that literally “assists the memory” in remembering CPU instruction It may be an instruction or a directive E.g. an instruction MOV (move) E.g. a directive DB (definite byte, used to create memory variables) An instruction may contain zero, one or two operands.

Intel 8086 Architecture There are 14 internal registers in Intel 8086 All of them are represented in 16-bit mode or equivalent to 4 digits in hexadecimal They are grouped into several categories For general-purpose registers, each of these is a combination of two 8-bit registers which are separately accessible as AL, BL, CL, DL (the "low'' bytes) and AH, BH, CH, and DH (the "high'' bytes) For example, if AX contains the 16-bit number 1234h, then AL contains 34h and AH contains 12h

Figure 1: 14 Registers in Intel 8086 General-purpose registers Special-purpose registers segment registers Status register Instruction Pointer PC / IP AX = AH + AL, BX = BH + BL , CX = CH + CL, DX = DH + DL SP, BP, SI, DI CS, DS, ES, SS FLAGS   Figure 1: 14 Registers in Intel 8086

General Purpose Registers There are 4 general-purpose registers, each of them is designed to play a particular role in common use: AX – Accumulator Register Used for operations involving i/o and most arithmetic such as MUL and DIV, require that one of the operands be in the accumulator As a place to store data BX – Base Register The only general-purpose register which may be used for indirect addressing, MOV [BX], AX CX – Count Register It may contain a value to control the number of times a loop is repeated or a value to shift/rotate bits left or right DX – Data Register Used together with AX for the word-size MUL and DIV operations

Special Purpose Registers There are 4 special-purpose registers: Stack Pointer Register (SP) Holds add of top of stack Base Pointer Register (BP) Holds add of ref point in the stack Source Index Register (SI) Holds memory add of source Destination Index Register (DI) Holds memory add of destination

Segment registers There 4 segment register: Code Segment Register (CS) Holds selector for code segment Data Segment Register (DS) Holds selector for data segment Extra Segment Register (ES) Holds selector for extra segment Stack Segment Register (SS) Holds selector for stack segment

Status Register The status register, FLAGS, is a collection of 1-bit values, which reflect the current state of the processor and the results of recent operations 9 of the 16 bits are used in the 8086. In this lesson you will only learn 6 flags: Carry flag Parity flag Sign flag Zero flag Overflow flag Auxiliary Flag

Symbol Set Clear Carry Flag CF CY NC Parity Flag PF PE PO Zero Flag ZF ZR NZ Sign Flag SF NG PL Overflow Flag OF OV NV Auxiliary Flag AF AC NA

Instruction Pointer The instruction pointer (sometimes called Program Counter - PC), IP, gives the address of the next instruction to be executed, relative to the code segment .

Debug commands Command Purpose r Display the contents of all registers Alter the contents of a register u List the instructions contained in the given address and following in assembly language form D Display the contents of memory in hexadecimal format and as ASCII character starting with the address given e Enter values into memory, beginning at a specific location t Trace the execution of an instruction a Choose an address to write a program q Quit the debug session

Example: 0100 MOV AX, 0123 Move value 0123H to AX 0103 ADD AX, 0025  Add value 0025H to AX 0106 MOV BX, AX  Move contents of AX to BX 0108 ADD BX, AX  Add contents of AX to BX 010A MOV CX, BX  Move contents of BX to CX 010C SUB CX, AX  Subtract contents of AX from CX 010E SUB AX, AX  Subtract AX from AX (clear AX) 0110 JMP 100  Go back to the start