Chapter 2 Instruction Addressing and Execution. Lesson plan Review some concepts in the first week First assembly program with EMU8086 Related concepts.

Slides:



Advertisements
Similar presentations
Virtual Memory. Invented on Manchester atlas 1962 It embodied many pioneering features, which we now take for granted. These include system features such.
Advertisements

Unit 4 Chapter-1 Multitasking. The Task State Segment.
Intel MP.
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.
Lecture 6 Machine Code: How the CPU is programmed.
Set 20 Interrupts. INTERRUPTS The Pentium has a mechanism whereby external devices can interrupt it. Devices such as the keyboard, the monitor, hard disks.
11/13/01CS-550 Presentation - Overview of Microsoft disk operating system. 1 An Overview of Microsoft Disk Operating System.
1 Hardware and Software Architecture Chapter 2 n The Intel Processor Architecture n History of PC Memory Usage (Real Mode)
X86 segmentation, page tables, and interrupts 3/17/08 Frans Kaashoek MIT
CS2422 Assembly Language & System Programming November 2, 2006.
3-1 ECE 424 Design of Microprocessor-Based Systems Haibo Wang ECE Department Southern Illinois University Carbondale, IL Intel 8088 (8086) Microprocessor.
CS2422 Assembly Language & System Programming September 22, 2005.
Introduction to Interrupts
80x86 Processor Architecture
Introduction to Computer Engineering by Richard E. Haskell Interrupts Module M17.3 Sections 11.3, 14.1.
Administrative Overview 6 Projects Design Review: Monday before 6:30pm Lab Friend Center 010 (“Fishbowl”)
Micro-Computer Applications: Procedures & Interrupts Dr. Eng. Amr T. Abdel-Hamid ELECT 707 Fall 2011.
An Introduction to 8086 Microprocessor.
The Pentium Processor.
The Pentium Processor Chapter 3 S. Dandamudi To be used with S. Dandamudi, “Introduction to Assembly Language Programming,” Second Edition, Springer,
The Intel Microprocessors. Real Mode Memory Addressing Real mode, also called real address mode, is an operating mode of and later x86-compatible.
1 Fundamental of Computer Suthida Chaichomchuen : SCC
Chapter 3 Examining Computer Memory and Executing Instructions.
Chapter 2 Instruction Addressing and Execution. Lesson plan Review some concepts in the first week First assembly program with EMU8086 Related concepts.
Lesson 3 — How a Computer Processes Data Unit 1 — Computer Basics.
SAPC Hardware Pentium CPU (or 486) 4M usable memory no hard disk; boot from floppy no keyboard or monitor or mouse COM2 serial port: used for console i/o.
CSNB374: Microprocessor Systems Chapter 5: Procedures and Interrupts.
UHD:CS2401: A. Berrached1 The Intel x86 Hardware Organization.
Video systems. Lesson plan Review the code for the previous exercise Video systems Review for midterm exam.
EEL 3801C EEL 3801 Part II System Architecture. EEL 3801C Components Video Display Terminal – self explanatory Keyboard – self-explanatory Disk Drives.
Segment Descriptor Segments are areas of memory defined by a programmer and can be a code, data or stack segment. In segments need not be all the.
EEL 3801 Part IV The Assembler. OFFSET Operator Returns address of variable used as operand. Actually, it represents the offset from the beginning of.
Microprocessors used in Personal Computers. The Memory Map of a Personal Computers Transient Program Area (TPA): Holds the operating system (interrupt.
Intel 8086 (8088) Microprocessor Structure
Page Replacement Implementation Issues Text: –Tanenbaum ch. 4.7.
University of Sargodha, Lahore Campus Prepared by Ali Saeed.
10. Epilogue ENGI 3655 Lab Sessions.  We took control of the computer as early as possible, right after the end of the BIOS  Our multi-stage bootloader.
Microprocessor Fundamentals Week 2 Mount Druitt College of TAFE Dept. Electrical Engineering 2008.
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.
EEL 4709C Prof. Watson Herman Group 4 Ali Alshamma, Derek Montgomery, David Ortiz 11/11/2008.
2.1 :Input Output Control System. Learning Outcomes Distinguish between Directory Management and Disk Space Management Identify the primary function perform.
Introduction to Operating Systems Concepts
Assembly language programming
An Interrupt is either a Hardware generated CALL (externally derived from a hardware signal) OR A Software-generated CALL (internally derived from.
Format of Assembly language
MICROPROCESSOR BASED SYSTEM DESIGN
Microprocessor and Assembly Language
Computer Maintenance Unit Subtitle: Basic Input/Output System (BIOS)
Computer Organization & Assembly Language Chapter 3
16.317: Microprocessor System Design I
Microprocessor and Assembly Language
x86 segmentation, page tables, and interrupts
Intel 8088 (8086) Microprocessor Structure
Microprocessor and Assembly Language
Symbolic Instruction and Addressing
Introduction to Assembly Language
שפת סף וארכיטקטורה של מעבד 8086
Intel Microprocessor.
Intel 8088 (8086) Microprocessor Structure
8086 Registers Module M14.2 Sections 9.2, 10.1.
SAPC Hardware Pentium CPU (or 486) 4M usable memory
Morgan Kaufmann Publishers Computer Organization and Assembly Language
Symbolic Instruction and Addressing
CS 301 Fall 2002 Computer Organization
Symbolic Instruction and Addressing
Chapter 6 –Symbolic Instruction and Addressing
CS-401 Computer Architecture & Assembly Language Programming
Assembly Language for Intel-Based Computers, 5th Edition
Presentation transcript:

Chapter 2 Instruction Addressing and Execution

Lesson plan Review some concepts in the first week First assembly program with EMU8086 Related concepts with the first program: –Loading program –Boot process –Handling the stack

Recalling main concepts

Segment: special areas defined to contain CODE, DATA and STACK Paragraph boundary: location evenly divisible by 16 or 10H

Recalling main concepts Stack Segment Data Segment Code Segment SS DS CS Segment Registers

Practice Start EMU8086 Type the first assembly language given Compile: Compile icon Run:Run icon

DSEG SEGMENT 'DATA‘ ; TODO: add your data here!!!! DSEG ENDS CSEG SEGMENT 'CODE‘ START PROC FAR MOV AX, DSEG MOV DS, AX ; TODO: add your code here!!!! Mov ah, 4ch Int 21h START ENDP CSEG ENDS END START ; set entry point.

Types of programs *.COM and *.EXE files –*.COM: consists of one segment containing code, data and stack –*.exe: separate code, data and stack segments

Loading *.exe program Access *.exe from disk 256-byte Program Segment Prefix (PSP) on a paragraph boundary Store the program immediately following the PSP Load address of PSP in the DS & ES Load code segment in CS, set IP Load address of the stack to SS, set SP Transfer control to the program for execution

PSP

Real and Protected mode Real Mode 16-bit Protected Mode 32-bit Protected Mode Segment base address 20-bit 24-bit, from descriptor 32-bit, from descriptor Segment size (limit) 16-bit, 64K bytes (fixed) 16-bit, 1-64K bytes 20-bit, 1-1M bytes or 4K-4G bytes Segment protection noyes Segment register segment base address / 16 selector

Protected mode -Is a type of memory utilization, available on Intel and later -Support: protection: each program is protected from interference from other programs. extended memory : Enables a single program to access more than 640K of memory. virtual memory : Expands the address space to over 1GB. Multitasking:

Booting process What is booting? The process of starting or restarting a computer cold boot Process of turning on a computer after it has been powered off completely warm boot Process of restarting a computer that is already powered on Also called a warm start

Booting process processor BIOS hard disk CD-ROM drive (RAM) memory modules CMOS floppy disk drive Step 6 expansion cards How does a personal computer boot up?

BIOS Boot process BIOS routine FFFF0H Interrupt Vector Table BIOS Data Areas Access the bootstrap loader Check ports Initialize devices

STACK The word is from data structure Last In, First Out (LIFO) mechanism STACK in OS has three main functions: –Contains return address –Data –Content of present registers

STACK PUSH –Decrease SP by 2 and store a value there POP –Return a value from stack and increase SP by 2

Lesson plan Review loading an *.exe file Concept of execution of instructions Practice: Execution of instructions

Access *.exe from disk 256-byte Program Segment Prefix (PSP) on a paragraph boundary Store the program immediately following the PSP Load address of PSP in the DS & ES Load code segment in CS, set IP Load address of the stack to SS, set SP Transfer control to the program for execution Loading *.exe file

The sequence of segments (code, data, and stack) is given SS: contains the address of the beginning of the stack CS: contains the address of the beginning of the code segment DS: contains the address of the beginning of the data segment SP: contains the size of stack

Practice 2B360H PSP Stack Segment Data Segment Code Segment Memory

Practice 2B360H PSP Stack Segment Data Segment Code Segment Memory PSP 2B360H PSP size 100H Offset 0H SS 2B460H (stored as 2B46) 2B46H SS

Practice 2B360H PSP Stack Segment Data Segment Code Segment Memory 2B46H SS PSP 2B360H PSP size 100H Offset 30H 70H CS 2B500H (stored as 2B50) CS 2B50H

Practice 2B360H PSP Stack Segment Data Segment Code Segment Memory 2B46H SS CS 2B50H 2B36H DS ES SP 0030H

Instruction Execution and Addressing Executing an instruction include –Fetch the next instruction, put to a queue (QUEUE: FIFO vs. STACK LIFO) –Decode the instruction –Execute the instruction

Example 4AF0 CS 0013 IP 4AF13H CS segment address: 4AF00H IP offset: 0013H ________________________ + Instruction address: 04B1 DS

Example 4AF0 CS 0013 IP 4AF13H A01200 Memory 04B1 DS Decode instruction: AO: MOV [0012] to AL

Example 4AF0 CS 0013 IP 04B03H A01200 Memory 04B1 DS DS segment address:04B10H IP offset: 0012H ________________________ + Data address: 04B22H

Example 4AF0 CS 0013 IP 04B03H A B Memory 04B1 DS 04B22 Data address: 04B22H | 1B AX AHAL

Practice Viewing memory location using DEBUG At DOS prompt, type: DEBUG Checking Serial and parallel port: D 40:00 Checking system equipment D 40:10

Practice Viewing memory location using DEBUG At DOS prompt, type: DEBUG Checking Serial and parallel port: D 40:00 Checking system equipment D 40:10

Practice Viewing memory location using DEBUG At DOS prompt, type: DEBUG Checking Serial and parallel port: D 40:00 Checking system equipment D 40:10 22 C8C822 reverse Number of parallel printer ports=11(binary)=3 (15,14) Number of serial ports=100(binary)=4 (11-9) Number of diskette devices=00(binary)=1 (7,6) Initial video mode =10 (5,4) (80x25 color) Coprocessor present: 1 (1) Diskette drive is present: 0 (0)

Checking the keyboard status –D 40:17 (With Numlock and Caplock) Checking video status –D 40:49 –D 40:84 Practice (cont.)

Checking copyright notice & serial number –D FE00:0 Checking ROM BIOS date D FFFF:5 Practice (cont.)

Running the first assembly program step by step using EMU 8086 Practice (cont.)