Lecture 06 Programming language.

Slides:



Advertisements
Similar presentations
Programming 8086 – Part IV Stacks, Macros
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.
There are two types of addressing schemes:
Computers organization & Assembly Language
CEN 226: Computer Organization & Assembly Language :CSC 225 (Lec#3) By Dr. Syed Noman.
Azir ALIU 1 What is an assembly language?. Azir ALIU 2 Inside the CPU.
Stack Memory H H FFFFF H FFFFE H SS 0105 SP 0008 TOS BOS BOS = FFFF = 1104F H H 1104F H.
3-1 ECE 424 Design of Microprocessor-Based Systems Haibo Wang ECE Department Southern Illinois University Carbondale, IL Intel 8088 (8086) Microprocessor.
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.
80x86 Processor Architecture
Microprocessor Systems Design I Instructor: Dr. Michael Geiger Spring 2013 Lecture 4: 80386DX memory, addressing.
Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 251 Introduction to Computer Organization.
An Introduction to 8086 Microprocessor.
Microprocessors Sunday, Mar. 23 Dr. Asmaa Farouk Faculty of Engineering, Electrical Department, Assiut University.
1.4 INTRODUCTION TO PROGRAM SEGMENTS
Types of Registers (8086 Microprocessor Based)
UHD:CS2401: A. Berrached1 The Intel x86 Hardware Organization.
INTRODUCTION TO MICROPROCESSOR Engr. Ammar Anwar Khan.
Microprocessor Microprocessor (cont..) It is a 16 bit μp has a 20 bit address bus can access upto 220 memory locations ( 1 MB). It can support.
University of Tehran 1 Microprocessor System Design Omid Fatemi Machine Language Programming
Introduction to Microprocessors Chapter 3. Programming Model (8086)  Shows the various internal registers that are accessible to the programmer.
Microprocessor Fundamentals Week 2 Mount Druitt College of TAFE Dept. Electrical Engineering 2008.
Assembly Language Data Movement Instructions. MOV Instruction Move source operand to destination mov destination, source The source and destination are.
Khaled A. Al-Utaibi  Introduction  The MOV Instruction  The LEA Instruction  The Stack Instructions  The String Data Transfer.
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.
I NTEL 8086 M icroprocessor بسم الله الرحمن الرحيم 1.
Instruction set Architecture
An Introduction to 8086 Microprocessor.
Microprocessor Systems Design I
Microprocessor Systems Design I
UNIT Architecture M.Brindha AP/EIE
Introduction to 8086 Microprocessor
8086 Microprocessor.
Computer Organization & Assembly Language Chapter 3
COURSE OUTCOMES OF MICROPROCESSOR AND PROGRAMMING
Instruksi Set Prosesor 8088
ADDRESSING MODES.
Microprocessor Systems Design I
ADDRESSING MODES.
University of Gujrat Department of Computer Science
Intel 8088 (8086) Microprocessor Structure
Assembly Lang. – Intel 8086 Addressing modes – 1
Chapter 3 Addressing Modes
Computer Organization and Assembly Language (COAL)
Microcomputer & Interfacing Lecture 1
Defining Types of data expression Dn [name] expression Dn [name]
Symbolic Instruction and Addressing
Introduction to Assembly Language
Data Addressing Modes • MOV AX,BX; This instruction transfers the word contents of the source-register(BX) into the destination register(AX). • The source.
University of Gujrat Department of Computer Science
8086 MICROPROCESSOR PROGRAMMING – INTEGER INSTRUCTIONS AND COMPUTATIONS Amar Saraswat.
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
Symbolic Instruction and Addressing
CNET 315 Microprocessor & Assembly Language
Computer Architecture CST 250
Microprocessor and Assembly Language
8051 ASSEMBLY LANGUAGE PROGRAMMING
Unit-I 80386DX Architecture
Chapter 6 –Symbolic Instruction and Addressing
Intel 8086.
Memory segmentation and addressing
Part I Data Representation and 8086 Microprocessors
(The Stack and Procedures)
Presentation transcript:

Lecture 06 Programming language

Programming language Programmer’s Point-of-view High-Level Programming Languages Assembly Language Machine code Logic Gates Transistor Level Working at Higher Levels: Programming is easier Programs are more portable (hardware independent) Little or no knowledge if machine required Working at Lower Levels: More control over the machine Possible to write very small, efficient programs

Introduction to Assembly Programming Assembly language is referred to as a low-level language because it deals directly with internal structure of the CPU Programmer must know the number of registers and their size as well as another of the CPU. In High-level languages the programmer does not have to be concerned with internal details of the CPU. Assembly language line consist of Mov & ADD Instruction operands destination source; comment Mov BL, 22H ;copy source operand to destination Mov AL, 25H ;move 25 into AL Mov Bl, 34H ;move 34 into BL ADD AL, BL ;AL = AL + BL

16 bit 8086 microprocessor Data can be moved among all registers except the flag register, MOV FR, AX; Source and destination registers match in size Mov BL,7F2H; illegal Mov AX,2FE24H; illegal Values cannot be loaded directly into any segment register (CS,ES,ES, or SS), to load a value into a segment register, first load it to nonsegment register and then move it to the segment register Mov AX,2345H; load 2345H into AX Mov DS,AX; then load the value of AX into DS

Logical & Physical Address Physical Address Is the 20-bit address that actually put is the address bus. (8086) Has range of 00000H-FFFFFH Offset Address is a location within 64k byte segment range Has range of 0000H-FFFFH Logical Address consist of segment address and offset address Physical address is generated by shifting the segment one hex digit to the left and adding offset Example: 2500:95F3H Shifting the segment 25000 Add the offset 25000 + 95f3 = 2E5F3

Logical & Physical Address Addressing in code segment to execute a program, the 8086 fetches the instruction from the code segment. The logical address of instruction consist of CS (code segment) and IP (instruction pointer) Example: the logical address is CS:IP 2500 : 95F3H

Logical & Physical Address Addressing in data segment associated with offset BX, SI, and DI Example: the logical address is DS = 5000 and the offset is 1950.

Storage of Data Structure Big Endian and Little Endian For multiple-byte data items stored in memory, need to specify which order: Most Significant 8 bits at lowest address ("Big Endian"), OR Least Significant 8 bits at lowest address ("Little Endian") Little Endian: 80x86 Big Endian: mc680x0, SPARC, HP Precision (Vipers)

Storage of Data Structure in 80x86 MOV AX, 35F3H ; load 35F3H into AX MOV [1500], AX ; copy the contents of AX to offset 1500H In cases like this, the lower byte goes to the low memory location and the high byte goes to the high memory address DS:1500 = F3 DS:1501 = 35 Example: assume memory locations with the following contents DS:6826 = 48, and DS:6827 = 22 show the contents of register BX in the instruction MOV BX, [6826] BX = 2248H BL BH 48 22

Offset Register for Various Segments Memory Map of the IBM PC Offset Register for Various Segments SS ES DS CS Segments Register SP, BP SI, DI, BX IP Offset Registers Extra segment register used as extra data segment. In many normal programs this segment is not used.

Pushing and Popping Operations What is a stack, and why is it needed? The stack is a section of read/write memory (RAM) used by CPU to store information temporality. CPU needs this storage area since there are only limited number of register Every register in the CPU (except segment register and SP) can be stored in the stack and loaded from the stack.

Pushing and Popping Operations Pushing onto the stack storing the CPU register in the stack is called a push. Example: SP = 1236, AX = 24B6, DI = 85C2, DX = 5F93. Instruction is executed Push AX Push DI Push DX

Pushing and Popping Operations Popping the stack loading the contents of the stack into the CPU register is called a pop. Example: assume that the stack is shown below, and SP=18FA, show the contents of the stack and register as each of the following instruction is executed pop CX pop DX pop BX

Logical and physical address of the stack Physical address depends on the value of stack segment and stack pointer registers Example: if SS = 3500H and SP = FFFEH calculate Physical address = 35000 + FFFEH = 44FFE Lower range of the stack = 35000 + 0000 = 35000 Upper range of the stack = 35000 + FFFF = 44FF Show the logical address = 3500 : FFFE

The Flag register and the bit fields The flag register is a 16 bit register sometimes referred as the status register Not all bits are used

Function Name Position