Assembly Programming Notes for Practical2 Munaf Sheikh

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.
There are two types of addressing schemes:
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.
Video systems (continue). Practice Modify the program to get a string from a keyboard to display the input string on the middle of the screen with reverse.
Azir ALIU 1 What is an assembly language?. Azir ALIU 2 Inside the CPU.
CS2422 Assembly Language & System Programming September 19, 2006.
8086 Assembly Language Programming I
Princess Sumaya University
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.
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.
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.
Joseph L. Lindo Assembly Programming Sir Joseph Lindo University of the Cordilleras.
Fundamentals of Assembly language
CEG 320/520: Computer Organization and Assembly Language ProgrammingIntel Assembly 1 Intel IA-32 vs Motorola
An Introduction to 8086 Microprocessor.
1/2002JNM1 Basic Elements of Assembly Language Integer Constants –If no radix is given, the integer is assumed to be decimal. Int 21h  Int 21 –A hexadecimal.
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.
1 Fundamental of Computer Suthida Chaichomchuen : SCC
Introduction to 8086 Assembly Language Assembly Language Programming University of Akron Dr. Tim Margush.
Types of Registers (8086 Microprocessor Based)
Chapter Five–80x86 Assembly program development Principles of Microcomputers 2015年11月15日 2015年11月15日 2015年11月15日 2015年11月15日 2015年11月15日 2015年11月15日 1.
Strings, Procedures and Macros
Binary Number Output To display a number in binary format, a program looks at each bit in the number and sends the ASCII equivalent of a ‘1’ (31h) or a.
UHD:CS2401: A. Berrached1 The Intel x86 Hardware Organization.
Click to add Title Comunicación y Gerencia Click To add Subtitle Click to add Text Fundamentals of Assembly Language.
Assembly Programming Notes for Practical 1
University of Tehran 1 Microprocessor System Design Omid Fatemi Machine Language Programming
Review of Assembly language. Recalling main concepts.
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.
Computer Organization & Assembly Language University of Sargodha, Lahore Campus Prepared by Ali Saeed.
Assembly Programming Practical2. Initialising Variables (Recap) Initialising variables are done in the.data section Initialising variables are done in.
Preliminary to Assembly Language Programming CE 140 A1/A2 28 June 2003.
Computer Organization & Assembly Language University of Sargodha, Lahore Campus Prepared by Ali Saeed.
Assembly language programming
Instruction set Architecture
Format of Assembly language
Data Transfers, Addressing, and Arithmetic
Introduction to 8086 Microprocessor
8086 Microprocessor.
ADDRESSING MODES.
ADDRESSING MODES.
University of Gujrat Department of Computer Science
Defining Types of data expression Dn [name] expression Dn [name]
Symbolic Instruction and Addressing
Introduction to Assembly Language
BIC 10503: COMPUTER ARCHITECTURE
שפת סף וארכיטקטורה של מעבד 8086
Assembly Programming Notes for Practical 1 1.
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
Symbolic Instruction and Addressing
Computer Architecture CST 250
Unit-I 80386DX Architecture
Assembler Directives end label end of program, label is entry point
Chapter 6 –Symbolic Instruction and Addressing
Intel 8086.
Chapter 8: Instruction Set 8086 CPU Architecture
Computer Organization and Assembly Language
Introduction to 8086 Assembly Language
Part I Data Representation and 8086 Microprocessors
Presentation transcript:

Assembly Programming Notes for Practical2 Munaf Sheikh

Stub Program

Data representation Electrical current has two states (on or off) Electrical current has two states (on or off) Binary used to represent the states Binary used to represent the states (1 = on, 0 = off)  bits Octal (0 to 8)  bytes Octal (0 to 8)  bytes Hexadecimal (0 to F) used when binary strings get TOO long Hexadecimal (0 to F) used when binary strings get TOO long

Operations on binary Add Add –101 ADD 110 = 011 overflow 1 Subtract Subtract –101 SUB 110 = And And –101 AND 110 = 100 Or Or –101 OR 110 = 111 Not Not –Not 101 = 010

CPU Registers Central Processing Unit (CPU) ALUCUCLOCK IO Devices #1… #N Memory Storage Unit Control bus Address bus Data bus

Registers Registers are named locations within the CPU that can be accessed VERY quickly Registers are named locations within the CPU that can be accessed VERY quickly –General Purpose –Segment –Pointer –Index

General-Purpose Registers AX Accumulator Register mostly used for calculations and for input/output AX Accumulator Register mostly used for calculations and for input/output BX Base Register Only register that can be used as an index BX Base Register Only register that can be used as an index CX Count Register register used for the loop instruction CX Count Register register used for the loop instruction DX Data Register input/output and used by multiply and divide DX Data Register input/output and used by multiply and divide

Pointer Registers IP Instruction Pointer 16-bit number that points to the offset of the next instruction IP Instruction Pointer 16-bit number that points to the offset of the next instruction SP Stack Pointer 16-bit number that points to the offset that the stack is using SP Stack Pointer 16-bit number that points to the offset that the stack is using BP Base Pointer used to pass data to and from the stack BP Base Pointer used to pass data to and from the stack

Segment Registers CS Code Segment 16-bit number that points to the active code-segment CS Code Segment 16-bit number that points to the active code-segment DS Data Segment 16-bit number that points to the active data-segment DS Data Segment 16-bit number that points to the active data-segment SS Stack Segment 16-bit number that points to the active stack-segment SS Stack Segment 16-bit number that points to the active stack-segment ES Extra Segment 16-bit number that points to the active extra-segment ES Extra Segment 16-bit number that points to the active extra-segment

Index Registers SI Source Index used by string operations as source SI Source Index used by string operations as source DI Destination Index used by string operations as destination DI Destination Index used by string operations as destination

Basic Elements of Assembly Integer Constants Integer Constants 26; 26d (decimal); 42o (octal); 1Ah (hex) Integer Expressions Integer Expressions -(3+4) * (6-1) Real Number Constants Real Number Constants 2.0; +3.0; -44.2E+05; 26E5 Character Constants Character Constants ‘A’; “d” String Constants String Constants ‘ABC’; ‘X’; “Hello World”; ‘4096’;

Basic Elements (cnt..) Reserved Words Reserved Words –Instruction mnemonics –Directives –Attributes –Operators –Predefined Symbols Identifiers Identifiers Programmer chosen name: identifier, constant, procedure, code lable Directives Directives.data;.code; …

Basic Elements (cnt..) Instructions Instructions –Label (optional) –Instruction Mnemonic (required) –Operands (usually required) –Comment (optional) Eg: Eg: target: mov ax, bx …. jmp target Eg: mov ax, myVariable Eg: mov ax, myVariable Label:MnemonicOperands ; Comment

Intel Instruction set Add dest, src Add dest, src Sub dest, src Sub dest, src And dest, src And dest, src Or dest, src Or dest, src Not dest Not dest Mul src Mul src

Prac 2 Irvine16 library provides functions that can be used in your programs Irvine16 library provides functions that can be used in your programs Declaring prototypes for library functions Declaring prototypes for library functions Crlf PROTO Readstring PROTO Readint PROTO Writestring PROTO Writeint PROTO

Prac 2 (cnt..) – writing strings userprompt db "What's your name:",0 userprompt db "What's your name:",0 ; prompt for uname (.data) mov dx, offset userprompt mov dx, offset userprompt ; point dx, to address of for display Invoke Writestring Invoke Writestring ; display (function in IRVINE library) dx: data register, used for input/output of text

Prac 2 (Cnt..) – writing ints anumber dw ? anumber dw ? ; integer (.data) mov ax, anumber mov ax, anumber ; copy to AX register for display invoke Writeint invoke Writeint ; display AX register as signed-integer ax: accumulator register, used for calculations and input/output

Prac 2 (cnt..) – reading strings uname db 50 dup(0) uname db 50 dup(0) ; string (.data) mov dx, offset uname mov dx, offset uname ; point dx, to address of input var ; point dx, to address of input var invoke Readstring ; read input as string into ; read input as string into

Prac 2 (cnt..) – reading ints anumber dw ? anumber dw ? ; integer (.data) invoke Readint ; read input as 16bit integer (input in register AX) mov anumber, ax mov anumber, ax ; copy read in integer into ; copy read in integer into

Due date: Not later than 23:59: /02/2005 Not later than 23:59: /02/2005