Assembly Language Lecture BY SHERY KHAN

Slides:



Advertisements
Similar presentations
Registers of the 8086/ /2002 JNM.
Advertisements

Week 3. Assembly Language Programming  Difficult when starting assembly programming  Have to work at low level  Use processor instructions >Requires.
INSTRUCTION SET ARCHITECTURES
There are two types of addressing schemes:
ITCS 3181 Logic and Computer Systems 2015 B. Wilkinson slides3.ppt Modification date: March 16, Addressing Modes The methods used in machine instructions.
Computer Architecture and Operating Systems CS 3230 :Assembly Section Lecture 2 Department of Computer Science and Software Engineering University of Wisconsin-Platteville.
Computer Organization and Architecture
1 ICS 51 Introductory Computer Organization Fall 2006 updated: Oct. 2, 2006.
CS2422 Assembly Language & System Programming September 28, 2006.
ARM programmer’s model and assembler Embedded Systems Programming.
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.
EET 2261 Unit 2 HCS12 Architecture
Implementation of a Stored Program Computer
Chapter 4 Basic Instructions. 4.1 Copying Data mov Instructions mov (“move”) instructions are really copy instructions, like simple assignment statements.
Computer Architecture
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.
Lecture 18 Last Lecture Today’s Topic Instruction formats
Monday, October 4 Assignment(s) due: Assignment #5: COMPLEMENT ARITHMETIC Assignment #6: DEBUG EXERCISES Quiz(zes) due:Quiz #5: Base Arithmetic Quiz #6.
An Introduction to 8086 Microprocessor.
Instruction Set Architecture
Implementation of a Stored Program Computer ITCS 3181 Logic and Computer Systems 2014 B. Wilkinson Slides2.ppt Modification date: Oct 16,
Types of Registers (8086 Microprocessor Based)
Chapter 4 - Implementing Standard Program Structures in 8086 Assembly Language from Microprocessors and Interfacing by Douglas Hall.
LAB Flag Bits and Register
Faculty of Engineering, Electrical Department,
ECE 456 Computer Architecture
Chapter 5 A Closer Look at Instruction Set Architectures.
UHD:CS2401: A. Berrached1 The Intel x86 Hardware Organization.
Computer Architecture Lecture 03 Fasih ur Rehman.
Computer Organization 1 Instruction Fetch and Execute.
COMPUTER ORGANISATION Sri.S.A.Hariprasad Sr.Lecturer R.V.C.E Bangalore.
Topics covered: Instruction Set Architecture CSE243: Introduction to Computer Architecture and Hardware/Software Interface.
Instruction Sets: Addressing modes and Formats Group #4  Eloy Reyes  Rafael Arevalo  Julio Hernandez  Humood Aljassar Computer Design EEL 4709c Prof:
COMPUTER ORGANIZATION AND ASSEMBLY LANGUAGE Lecture 21 & 22 Processor Organization Register Organization Course Instructor: Engr. Aisha Danish.
1 The Instruction Set Architecture September 27 th, 2007 By: Corbin Johnson CS 146.
Microprocessors used in Personal Computers. The Memory Map of a Personal Computers Transient Program Area (TPA): Holds the operating system (interrupt.
What is a program? A sequence of steps
Introduction to Microprocessors Chapter 3. Programming Model (8086)  Shows the various internal registers that are accessible to the programmer.
Assembly 06. Outline cmp (review) Jump commands test mnemonic bt mnemonic Addressing 1.
Microprocessor & Assembly Language Arithmetic and logical Instructions.
Internal Programming Architecture or Model
INSTRUCTION SET PRINCIPLES. Computer Architecture’s Changing Definition  1950s to 1960s: Computer Architecture Course = Computer Arithmetic  1970s to.
Microprocessor T. Y. B. Sc..
A Closer Look at Instruction Set Architectures
A Closer Look at Instruction Set Architectures
Chapter 3 Bit Operations
Microprocessor and Assembly Language
William Stallings Computer Organization and Architecture 8th Edition
University of Gujrat Department of Computer Science
Intel 8088 (8086) Microprocessor Structure
Computer Organization and Assembly Language (COAL)
CS-401 Assembly Language Programming
COMP3221: Microprocessors and Embedded Systems
Processor Organization and Architecture
Introduction to Assembly Language
Intel 8088 (8086) Microprocessor Structure
The University of Adelaide, School of Computer Science
CS-401 Computer Architecture & Assembly Language Programming
University of Gujrat Department of Computer Science
ECEG-3202 Computer Architecture and Organization
Lecture 06 Programming language.
ECEG-3202 Computer Architecture and Organization
University of Gujrat Department of Computer Science
University of Gujrat Department of Computer Science
Microprocessor and Assembly Language
Computer Architecture and System Programming Laboratory
Chapter 8: Instruction Set 8086 CPU Architecture
Part I Data Representation and 8086 Microprocessors
Presentation transcript:

Assembly Language Lecture 04-06 BY SHERY KHAN sherykhan@gmail.com www.sherykhan.jimdo.com Review By Sultan Fahad April 26 2013

LACUNY Web Roundtable galina.letnikova@lehman.cuny.edu Agenda To day we learn about Recap & Exercise (Page 15) Data Declaration (Page 17) Direct Addressing (page 17) Size Mismatch Errors (page 21) Register Indirect Addressing (page 22) sherykhan186@gmail.com 03345042123 sherykhan186@gmail.com October 21, 2005 LACUNY Web Roundtable galina.letnikova@lehman.cuny.edu April 26 2013

LACUNY Web Roundtable galina.letnikova@lehman.cuny.edu RECAP & EXERCISE Last Lecture we can discuss the Few Important Topics Now on the basis of previous knowledge we can Solve the Exercise sherykhan186@gmail.com October 21, 2005 LACUNY Web Roundtable galina.letnikova@lehman.cuny.edu April 26 2013

LACUNY Web Roundtable galina.letnikova@lehman.cuny.edu Exercise How the Processor uses the Address Bus ,Data bus and control Bus? Processor Execute Operation and memory contain data element Memory is a Dump Device in which Data resides Key point is that Processor want to read or write Data so for reading data or writing purposes are achieved by Address bus & data Bus & Control Bus Address bus is Used When Processor Want to Certain read or write operation. Data Bus is Used to move data form Memory to Processor in Read Operation & Processor to Memory For Write Operation. Control BUS is independent lines used to inform Memory about Certain operation October 21, 2005 LACUNY Web Roundtable galina.letnikova@lehman.cuny.edu sherykhan186@gmail.com April 26 2013

EXERCISE Qno2 Which of the Following are Uni & Bi Directional Address Bus Is Uni Directional because Address Always Travel From Processor to Memory & Memory Cannot Predict which Element the Processor want to read or Write DATA BUS: data Travel From Both processor to memory& vice versa So data Bus is Bi Directional Control Bus Is Bi directional sherykhan186@gmail.com October 21, 2005 LACUNY Web Roundtable galina.letnikova@lehman.cuny.edu

What is The Size of the Accumulator of 64 bit Processor? The Size of Accumulator of 64 bit processor is 64 bit According to defination “ the Word size of processor is defined by the width of accumulator” sherykhan186@gmail.com October 21, 2005 LACUNY Web Roundtable galina.letnikova@lehman.cuny.edu April 26 2013

How many Instruction Classified into groups? There are Four Categories of Instructions. Data Movement Instruction Arithmetic Logic instruction Program Control Instruction Special Instructions sherykhan186@gmail.com October 21, 2005 LACUNY Web Roundtable galina.letnikova@lehman.cuny.edu

A combination of 8 bit are Byte what is name of Four Bit & 16 bit?? Four BITS: are called as NIBBLE Four Bytes : Are Called double Word (32bit) 16 Bits : are called word (2 byte long) sherykhan186@gmail.com October 21, 2005 LACUNY Web Roundtable galina.letnikova@lehman.cuny.edu

What is Maximum Memory 8088 can access?? The 8088 can Allow Whole MEGA BYTE Which can be Accessed with 20 bits sherykhan186@gmail.com October 21, 2005 LACUNY Web Roundtable galina.letnikova@lehman.cuny.edu

LACUNY Web Roundtable galina.letnikova@lehman.cuny.edu List the 14 register of 8088 ? HERE TO New the Register the Afd View sherykhan186@gmail.com October 21, 2005 LACUNY Web Roundtable galina.letnikova@lehman.cuny.edu

What is Difference Little Endean & Big Endian Little Endian: Big Endian: Least Significant Most Significant More Significant Less Significant Most Significant Least Significant For e.g. 0123 For e.g. 3 2 1 0 sherykhan186@gmail.com October 21, 2005 LACUNY Web Roundtable galina.letnikova@lehman.cuny.edu

Which Format was Used by INTEL 8088 Little Endian Order is used By Intel8088 sherykhan186@gmail.com October 21, 2005 LACUNY Web Roundtable galina.letnikova@lehman.cuny.edu

LACUNY Web Roundtable galina.letnikova@lehman.cuny.edu Give the Value of Zero flag carry flag sign flag and overflow flag after each of the Following instructions mov ax 0x1254 mov bx 0x0FFF add ax,0xEDAB Zero FLAG:0 CF:0 SF:1 OF:0 Add ax,bx ZF:0 SF:0 oF:0 Add bx,0xf001 ZF:0, CF:1 SF:0 OF:0 sherykhan186@gmail.com October 21, 2005 LACUNY Web Roundtable galina.letnikova@lehman.cuny.edu

LACUNY Web Roundtable galina.letnikova@lehman.cuny.edu 13. For each of the following words identify the byte that is stored at lower memory address and the byte that is stored at higher memory address in a little endian computer. a. 1234 b. ABFC c. B100 d. B800 FEW SLIDE SHOW WE DISCUSS THE LITTLE ENDIAN Above the 1234 Followed the Definition So this Is our desired Result 1234 sherykhan186@gmail.com October 21, 2005 LACUNY Web Roundtable galina.letnikova@lehman.cuny.edu

LACUNY Web Roundtable galina.letnikova@lehman.cuny.edu 15. What is the offset at which the first executable instruction of a COM file must be placed? The First Instruction of COM File Must be Offset at 0x0100(decimal 255) as required What is the difference between an instruction mnemonic and its opcode? Opcode Short for operational code, it is a number that determines the computer instruction to be executed. (machine language representation of an instruction sherykhan186@gmail.com October 21, 2005 LACUNY Web Roundtable galina.letnikova@lehman.cuny.edu April 26 2013

What flags are defined in the 8088 FLAGS register What flags are defined in the 8088 FLAGS register? Describe the function of the zero flag, the carry flag, the sign flag, and the overflow flag. Zero flag????? The Zero flag is set if the last mathematical or logical instruction has produced a zero in its destination. Carry flag When two 16bit numbers are added the answer can be 17 bits long or when two 8bit numbers are added the answer can be 9 bits long. This extra bit that won’t fit in the target register is placed in the carry flag where it can be used and tested. Sign flag A signed number is represented in its two’s complement form in the computer. The most significant bit (MSB) of a negative number in this representation is 1 and for a positive number it is zero. The sign bit of the last mathematical or logical operation’s destination is copied into the sign flag. Overflow flag The overflow flag is set during signed arithmetic, e.g. addition or subtraction, when the sign of the destination changes unexpectedly. The actual process sets the overflow flag whenever the carry into the MSB is different from the carry out of the MSB.

What are the contents of memory locations 200, 201, 202, and 203 if the word 1234 is stored at offset 200 and the word 5678 is stored at offset 202? In Little Endean, least significant byte is stored first at lower addresses; most significant byte is stored after it. Like for example the number 0x1234 is stored at memory address 0x123 then it will appear like as below: Address Contents … 0x123 34 0x124 12 Do try it for the given memory addresses with given numbers.

Why was segmentation originally introduced in 8088 architecture? Four windows of 64K Code window Data window Stack window The segmented memory model allows multiple functional windows into the main memory, a code window, a data window etc. The processor sees code from the code window and data from the data window. The size of one window is restricted to 64K. 8085 software fits in just one such window. It sees code, data, and stack from this one window, so downward compatibility is attained.

What are the first and the last physical memory addresses accessible using the following segment values? First 0x0000 and last 0xFFFF First physical address Last physical address a. 1000 0x10000 0x10000 +0x00000 +0x0FFFF =0x10000 =0x1FFFF b. 0FFF 0x0FFF0 0x0FFF0 +0x00000 +0x0FFFF =0x0FFF0 =0x1FFEF 1002 0x10020 0x10020 +0x00000 +0x0FFFF =0x10020 =0x2001F d. 0001 0x00010 0x00010 =0x00010 =0x1000F E000 0xE0000 0xE0000 =0xE0000 =0xEFFFF

Why a segment start cannot start from the physical address 55555??. For any segment base address, segment first physical address will have 0 in the least significant position in hexadecimal format. Let say,our Segment base =0x1234, and we calculate segment first physical address as 0x12340 <- 0x12340 + 0x00000 (Segment First Address) Thusall segments starting physical address has 0 at its least significant position. In case of 55555 as segment first physical address there in no 0 at least significant positions so this cannot be a segment starting physical address.

Q21 Write a program in assembly language that Calculate the Square ? [org 0x0100] Mov ax, 6 Add ax, 6 Mov ax, 0x4c00 Int 0x21 April 26 2013 Sherykhan186@gmail.com

Table of Hexa To Deci October 21, 2005 Sherykhan186@gmail.com

First physical address = 00000 + 00000 = 00000 What are the first and the last physical memory addresses accessible using the following segment values? (2 mark each) 0000 FFFF Answer: a) First physical address = 00000 + 00000 = 00000 Last physical address = 00000 + 0FFFF = 0FFFF   b) First physical address = FFFF0 + 00000 = FFFF0 Last physical address = FFFF0 + 0FFFF = 10FFEF = 0FFEF (wraparound) 26 April 2013 Shery khan

TODAY LECTURE 05 DATA DECLARATION: IMMEDIATE OPERANDS: In our previous Programs We use a Immediate operand but in Meaningful Programs we use data from Memory instead of Constant because constant cannot change Constant cannot appear as destination operand which is Ilegal if we place it as Destination we know that operation destination, source operation destination operation source operation sherykhan186@gmail.com October 21, 2005 LACUNY Web Roundtable galina.letnikova@lehman.cuny.edu

LACUNY Web Roundtable galina.letnikova@lehman.cuny.edu DATA DECLARATION: Only Register or data Can be placed in memory can be changed So real data is one stored in memory with Few constant so there is Mechanism which is used And is Called Data Declaration sherykhan186@gmail.com October 21, 2005 LACUNY Web Roundtable galina.letnikova@lehman.cuny.edu

LACUNY Web Roundtable galina.letnikova@lehman.cuny.edu DATA DECLARATION: To Declare a part of our program as holding data instead of instruction we need a Special Directives which are Following DEFINE BYTE: (db) I byte DEFINE WORD :(dw) 16 bits(2 byte) Db: reserve one single byte cell in memory dw:reserve whole 16 bits instead of Byte sherykhan186@gmail.com October 21, 2005 LACUNY Web Roundtable galina.letnikova@lehman.cuny.edu