Assembly Language Advantages 1. It reveals the secret of your computer’s hardware and software. 2. Speed. 3. Some special applications and occasions. Disadvantages.

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

Chapter 2 (cont.) An Introduction to the 80x86 Microprocessor Family Objectives: The different addressing modes and instruction types available The usefulness.
COMP 2003: Assembly Language and Digital Logic
CEN 226: Computer Organization & Assembly Language :CSC 225 (Lec#3) By Dr. Syed Noman.
Memory Address Segment-offset address Base location (segment) + logical location (offset) Example: For 32-bits segment-offset address, 08F1:0100 represents.
Lect 3: Instruction Set and Addressing Modes. 386 Instruction Set (3.4) –Basic Instruction Set : 8086/8088 instruction set –Extended Instruction Set :
Outline Learning Assembly by an Example.  Program Formats  Some Simple Instructions  Assemble and Execute Learning Another Example  Data Definition.
© 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.
Kip Irvine: Assembly Language for Intel-Based Computers Overview Stack Operations (PUSH and POP) Procedures Procedure Parameters Software Interrupts MS-DOS.
Assembly Language for Intel-Based Computers Chapter 2: IA-32 Processor Architecture Kip Irvine.
Assembly Language Basic Concepts IA-32 Processor Architecture.
Assembly Language Advantages 1. It reveals the secret of your computer’s hardware and software. 2. Speed. 3. Some special applications and occasions. Disadvantages.
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 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.
Lect 4: Instruction Set and Addressing Modes. 386 Instruction Set (3.4)  Basic Instruction Set : 8086/8088 instruction set  Extended Instruction Set.
CEG 320/520: Computer Organization and Assembly Language ProgrammingIntel Assembly 1 Intel IA-32 vs Motorola
INSTRUCTION SET AND ASSEMBLY LANGUAGE PROGRAMMING
CET 3510 Microcomputer Systems Tech. Lecture 2 Professor: Dr. José M. Reyes Álamo.
ECE291 Computer Engineering II Lecture 3 Josh Potts University of Illinois at Urbana- Champaign.
1 ICS 51 Introductory Computer Organization Fall 2009.
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.
Assembly Programming Notes for Practical 1
Chapter 2 Parts of a Computer System. 2.1 PC Hardware: Memory.
ECE291 Computer Engineering II Lecture 3 Josh Potts University of Illinois at Urbana- Champaign.
Computers organization & Assembly Language Chapter 1 THE 80x86 MICROPROCESSOR.
ECE291 Computer Engineering II Lecture 3 Dr. Zbigniew Kalbarczyk University of Illinois at Urbana- Champaign.
X86 Assembly Language We will be using the nasm assembler (other assemblers: MASM, as, gas)
INTRODUCTION TO INTEL X-86 FAMILY
University of Sargodha, Lahore Campus Prepared by Ali Saeed.
Assembly Language Data Movement Instructions. MOV Instruction Move source operand to destination mov destination, source The source and destination are.
1 x86 Programming Model Microprocessor Computer Architectures Lab Components of any Computer System Control – logic that controls fetching/execution of.
Week 6 Dr. Muhammad Ayaz Intro. to Assembly Language.
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.
1 Using the Assembler Chapter – 4(A). 2 Exchanging Two Variables title Exchange Two Variables (Exchange.asm).model small.stack 100h.data value1 db 0Ah.
Microprocessors CSE- 341 Dr. Jia Uddin Assistant Professor, CSE, BRAC University Dr. Jia Uddin, CSE, BRAC University.
Precept 7: Introduction to IA-32 Assembly Language Programming
Assembly language programming
Instruction Set Architecture
Homework Reading Lab with your assigned section starts next week
Credits and Disclaimers
Format of Assembly language
8086 Microprocessor.
Computer Organization & Assembly Language Chapter 3
Computer skills CPU Jakub Yaghob.
Chapter 4 Data Movement Instructions
Basic Microprocessor Architecture
Assembly IA-32.
Homework Reading Continue work on mp1
Basic of Computer Organization
Symbolic Instruction and Addressing
Introduction to Assembly Language
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
The Microprocessor & Its Architecture
Symbolic Instruction and Addressing
Assembly Language (CSW 353)
Computer Architecture CST 250
Unit-I 80386DX Architecture
Chapter 6 –Symbolic Instruction and Addressing
CSC 497/583 Advanced Topics in Computer Security
Intel 8086.
Credits and Disclaimers
Presentation transcript:

Assembly Language Advantages 1. It reveals the secret of your computer’s hardware and software. 2. Speed. 3. Some special applications and occasions. Disadvantages 1. Not as easy to do the programming. 2. Debug is not as easy compared with high- level language. 3. Not transferable between different CPUs.

Registers Intel 16-bits registers AH AL BH BL CH CL DH DL AX BX CX DX Flag IP BP SP SI DI CS SS DS ES Status and Control RegistersSegment Registers Date Registers Index Registers

Registers Intel 32-bits registers AX BX CX DX FLAGS IP EAX EBX ECX EDX EFLAGS EIP EBP ESP ESI EDI CS SS DS ES Status and Control RegistersSegment Registers Date Registers Index Registers FS GS

Flag Register 16-bits Flag Register The most common used flag bits x x x x O D I T S Z x A x P x C O D I S Z A P C O—Overflow D--- Direction I-----Interrupt S----Sign Z---Zero A---Auxiliary Carry P----Parity C----Carry

General Rules about Flags “1”---Set the flag. “0”---Clear the flag. “?”---May change the flag to an undetermined value (Blank)---The flag is not changed * ----Change the flag to specific rules associated with the flag

Examples * * * ADD --- Instruction O D I S Z A P C HLT---Stop the CPU until a hardware interrupt occurs. O D I S Z A P C IDIV---Signed Integer Division ? ? ?

The Hello World Program title Hello World Program (hello.asm) ; This program displays "Hello, world!".model small.stack 100h.data message db "Hello, world!",0dh,0ah,'$'.code main proc mov mov ds,ax mov ah,9 mov dx,offset message int 21h mov ax,4C00h int 21h main endp end main

Arithmetic Instructions ADD and SUB instructions ADD reg, reg ADD mem, reg ADD reg, mem ADD reg, immed ADD mem, immed ADD accum, immed Flag O D I S Z A P C SUB has the similar instruction format * * *

Debug -F -D -E -T----Make sure you check the IP to see if its counts is pointing the right location. -R IP to change it -A 100 Mov dl, [0200] Mov [0201], dl Mov ax, 4c00(h) Int 21

Debug Mov si, 0200 Mov ax, [si] Mov [0270], ax Mov ax, 4c00 Int 21 -T

Assembling, linking, And Debugging Debug and Assembler Source File Listing File Object File Link Library Map File Executable Program Output Assembler Linker Loader

Start Stop Length Name Class 00000H 004D0H 004D1H _TEXT CODE 004D2H 00665H 00194H _DATA DATA 00670H 0076FH 00100H STACK STACK Origin Group 004D:0 DGROUP Program entry point at 0000:0000 A typical Map File (From Hello.asm) The main feature for the map file is that it list all the information about each program segments.

Object File (From Hello.asm) € C:\IRVINE\CH01\HELLO.asm! ˆ ¡CV7–K STACK_DATADGROUP _TEXT$$TYPES $$SYMBOLSDEBTYP DEBSYMSTACKDATACODEø˜H ö˜ H ú˜ t ß™ !† ¦™! š ÿÿY Hello, world!$† ¸ ŽØ´º Í!¸ LÍ!Õœ ÈUÄX” ¨ òñ, Š HELLO.obj6 /Microsoft (R) Macro Assembler Version message main œ ÌRÌvTŽŠ ÁP ^

Target Processor Directives , When using.386, the program can only run on 386 and above processors.

Floating-Point Unit 80-bit Registers ST(0) ST(1) ST(7) FPU Instruction Pointer FPU Data Pointer Tag Register Control Register Status Register 48-bit Pointer Register 16-bit Control Register Opcode Register

Debug and Debugger MASM supplies a good 16-bit debugger named Code View. TASM supplies one named Turbo Debugger. For 32-bit Windows Console programs, the preferred debugger is Microsoft Visual Studio (msdev.exe), part of Microsoft Visual C++.