Web siteWeb site ExamplesExamples 1 Mode of Operation Protected mode  4 GB  32-bit address  Windows, Linux Real-address mode  1 MB space  20-bit address.

Slides:



Advertisements
Similar presentations
DOS and BIOS Interrupts DOS and BIOS interrupts are used to perform some very useful functions, such as displaying data to the monitor, reading data from.
Advertisements

There are two types of addressing schemes:
Presented By Dr. Shazzad Hosain Asst. Prof. EECS, NSU
Computer Organization and Assembly Languages Yung-Yu Chuang
Intel MP.
Assembly Language for Intel-Based Computers Chapter 15: BIOS-Level Programming (c) Pearson Education, All rights reserved. You may modify and.
IA-32 Processor Architecture
11/13/01CS-550 Presentation - Overview of Microsoft disk operating system. 1 An Overview of Microsoft Disk Operating System.
Assembly Language for Intel-Based Computers, 4th Edition
1 Hardware and Software Architecture Chapter 2 n The Intel Processor Architecture n History of PC Memory Usage (Real Mode)
Web siteWeb site ExamplesExamples Irvine, Kip R. Assembly Language for Intel-Based Computers, Symbolic Constants Equal-Sign Directive Calculating.
Assembly Language for Intel-Based Computers, 5 th Edition Chapter 11: 32-Bit Windows Programming (c) Pearson Education, All rights reserved.
© 2006 Pearson Education, Upper Saddle River, NJ All Rights Reserved.Brey: The Intel Microprocessors, 7e Chapter 2 The Microprocessor and its Architecture.
Linux Vs. Windows NT Memory Management Hitesh Kumar
CS2422 Assembly Language & System Programming November 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.
CS2422 Assembly Language & System Programming September 22, 2005.
Introduction to Interrupts
Microprocessor Systems Design I Instructor: Dr. Michael Geiger Fall 2012 Lecture 15: Protected mode intro.
Protected Mode. Protected Mode (1 of 2) 4 GB addressable RAM –( to FFFFFFFFh) Each program assigned a memory partition which is protected from.
Web siteWeb site ExamplesExamples Irvine, Kip R. Assembly Language for Intel-Based Computers, Intel IA-32 Family Intel386 4 GB addressable RAM,
1 JMH Associates © 2004, All rights reserved Chapter 1 Getting Started with Win32/64.
C++ fundamentals.
Assembly Language for x86 Processors 6 th Edition Chapter 2: x86 Processor Architecture (c) Pearson Education, All rights reserved. You may modify.
POSIX: Files Introduction to Operating Systems: Discussion 1 Read Solaris System Interface Guide: Ch. 5.1 Basic File I/O.
Server Design Discuss Design issues for Servers Review Server Creation in Linux.
Chapter 8 File Management
Assembly Language for x86 Processors 6th Edition Chapter 11: MS-Windows Programming (c) Pearson Education, All rights reserved. You may modify and.
Micro-Computer Applications: Procedures & Interrupts Dr. Eng. Amr T. Abdel-Hamid ELECT 707 Fall 2011.
Assembly Language for Intel-Based Computers, 4 th Edition Chapter 3: Assembly Language Fundamentals Assembling, Linking and Running Programs Example Programs.
1/2002JNM1 With 20 bits, 1,048,576 different combinations are available. Each memory location is assigned a different combination. Each memory location.
Programming the Microprocessor A Course in Microprocessor Electrical Engineering Dept. University of Indonesia.
CP104 Introduction to Programming File I/O Lecture 33 __ 1 File Input/Output Text file and binary files File Input/output File input / output functions.
1-1 NET+OS Software Group Flash API Multiple flash memory bank support New Flash API introduction Detailed Flash API Function presentation Supporting.
Assembly Language for Intel-Based Computers, 6 th Edition Chapter 8: Advanced Procedures (c) Pearson Education, All rights reserved. You may.
File System Review bottomupcs.com J. Kubiatowicz, UC Berkeley.
CSNB374: Microprocessor Systems Chapter 5: Procedures and Interrupts.
File I/O MS-DOS Interrupt 21h has many functions dealing with file and directory I/O services. Both MS-DOS and MS_Windows use 16- bit integers called HANDLES.
Windows Operating System Internals - by David A. Solomon and Mark E. Russinovich with Andreas Polze Unit OS2: Operating System Principles 2.4. The Windows.
CNG 140 C Programming (Lecture set 10) Spring Chapter 10 Data Files.
GAME203 – C Files stdio.h C standard Input/Output “getchar()”
1 Microprocessors CSE Protected Mode Memory Addressing Remember using real mode addressing we were previously able to address 1M Byte of memory.
System Programming Course introduction Getting Started …
Assembly Language for Intel-Based Computers, 4 th Edition Chapter 13: 16-Bit MS-DOS Programming Interrupts (c) Pearson Education, All rights reserved.
Microprocessor and Assembly Language Addressing Models
C Programming Day 2. 2 Copyright © 2005, Infosys Technologies Ltd ER/CORP/CRS/LA07/003 Version No. 1.0 Union –mechanism to create user defined data types.
File Operations. FILE PROCESSING For the purposes of the following discussion, reading means copying all or part of an existing file into memory Writing.
File I/O. I/O Flags Flags are passed to give some information about how the file is to be used. – Read only file – flag=0x0 – Write only file – flag=0x1.
Practical Session 5.
Lecture on Real Mode Memory Addressing
Descriptor Table & Register
MICROPROCESSOR BASED SYSTEM DESIGN
CS501 Advanced Computer Architecture
Microprocessor and Assembly Language
Chapter 22 – part a Stream refer to any source of input or any destination for output. Many small programs, obtain all their input from one stream usually.
Anton Burtsev February, 2017
Protection of System Resources
Operating Modes UQ: State and explain the operating modes of X86 family of processors. Show the mode transition diagram highlighting important features.(10.
Windows APIs File Processing Copyright © 2016 Curt Hill.
Files in Windows API David Halbig Lopez.
CS 301 Fall 2002 Computer Organization
File Input and Output.
Unit:08 Software Interrupts
Lecture 37 Syed Mansoor Sarwar
Assembly Language for Intel-Based Computers, 5th Edition
More on operators and procedures in the Linked
Professor Jodi Neely-Ritz University of Florida
Interrupts & Syscalls.
Presentation transcript:

Web siteWeb site ExamplesExamples 1 Mode of Operation Protected mode  4 GB  32-bit address  Windows, Linux Real-address mode  1 MB space  20-bit address  MS-DOS

Web siteWeb site ExamplesExamples 2 Real-Address mode 1 MB RAM maximum addressable Application programs can access any area of memory Single tasking Supported by MS-DOS operating system

Web siteWeb site ExamplesExamples 3 Segmented Memory Segmented memory addressing: absolute (linear) address is a combination of a 16-bit segment value added to a 16-bit offset

Web siteWeb site ExamplesExamples 4 Calculating Linear Addresses Given a segment address, multiply it by 16 (add a hexadecimal zero), and add it to the offset Example: convert 08F1:0100 to a linear address Adjusted Segment value: 0 8 F 1 0 Add the offset: Linear address:

Web siteWeb site ExamplesExamples 5 Protected Mode 4 GB addressable RAM  ( to FFFFFFFFh) Each program assigned a memory partition which is protected from other programs Designed for multitasking Supported by Linux & MS-Windows

Web siteWeb site ExamplesExamples 6 Flat Model All segments are mapped to the entire 32-bit physical address space of the compter.. Each segment is defined by a segment descriptor, a 64-bit value stored in a table known as the global descriptor table (GDT).

Web siteWeb site ExamplesExamples 7 Multi-Segment Model Each program has a local descriptor table (LDT)  holds descriptor for each segment used by the program

32-Bit Windows Programming

Web siteWeb site ExamplesExamples 9 Standard Console Handles STD_INPUT_HANDLE  standard input STD_OUTPUT_HANDLE  standard output STD_ERROR_HANDLE  standard error output A handle is an unsigned 32-bit integer. The following MS-Windows constants are predefined:

Web siteWeb site ExamplesExamples 10 GetStdHandle GetStdHandle returns a handle to a console stream Specify the type of handle (see previous slide) The handle is returned in EAX Prototype: GetStdHandle PROTO, nStdHandle:DWORD; handle type

Web siteWeb site ExamplesExamples 11 ReadConsole The ReadConsole function provides a convenient way to read text input and put it in a buffer. Prototype: ReadConsole PROTO, handle:DWORD,; input handle pBuffer:PTR BYTE,; pointer to buffer maxBytes:DWORD,; number of chars to read pBytesRead:PTR DWORD,; ptr to num bytes read notUsed:DWORD; (not used)

Web siteWeb site ExamplesExamples 12 ReadConsole Example

Web siteWeb site ExamplesExamples 13 ReadConsole Example

Web siteWeb site ExamplesExamples 14 ReadConsole Example

Web siteWeb site ExamplesExamples 15 ReadConsole Example

Web siteWeb site ExamplesExamples 16 WriteConsole The WriteConsole function writes a string to the screen, using the console output handle. Prototype: WriteConsole PROTO, handle:DWORD,; output handle pBuffer:PTR BYTE,; pointer to buffer bufsize:DWORD,; size of buffer pCount:PTR DWORD,; output count lpReserved:DWORD; (not used)

Web siteWeb site ExamplesExamples 17 WriteConsole Example

Web siteWeb site ExamplesExamples 18 WriteConsole Example

Web siteWeb site ExamplesExamples 19 WriteConsole Example

Web siteWeb site ExamplesExamples 20 CreateFile CreateFile either creates a new file or opens an existing file. If successful, it returns a handle to the open file; otherwise, it returns a special constant named INVALID_HANDLE_VALUE. Prototype: CreateFile PROTO, pFilename:PTR BYTE,; ptr to filename desiredAccess:DWORD,; access mode shareMode:DWORD,; share mode lpSecurity:DWORD, ; ptr to security attribs creationDisposition:DWORD,; file creation options flagsAndAttributes:DWORD,; file attributes htemplate:DWORD; handle to template file

Web siteWeb site ExamplesExamples 21 CreateFile Example INVOKE CreateFile, ADDR filename, ; ptr to filename GENERIC_READ,; access mode DO_NOT_SHARE,; share mode NULL,; ptr to security attributes OPEN_EXISTING,; file creation options FILE_ATTRIBUTE_NORMAL,; file attributes 0; handle to template file Opens an existing file for reading:

Web siteWeb site ExamplesExamples 22 CreateFile Example INVOKE CreateFile, ADDR filename, GENERIC_WRITE,; access mode DO_NOT_SHARE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0 Opens an existing file for writing:

Web siteWeb site ExamplesExamples 23 CreateFile Example INVOKE CreateFile, ADDR filename, GENERIC_WRITE, DO_NOT_SHARE, NULL, CREATE_ALWAYS,; overwrite existing file FILE_ATTRIBUTE_NORMAL, 0 Creates a new file with normal attributes, erasing any existing file by the same name:

Web siteWeb site ExamplesExamples 24 ReadFile ReadFile reads text from an input file Prototype: ReadFile PROTO, handle:DWORD,; handle to file pBuffer:PTR BYTE,; ptr to buffer nBufsize:DWORD,; num bytes to read pBytesRead:PTR DWORD,; bytes actually read pOverlapped:PTR DWORD; ptr to asynch info

Web siteWeb site ExamplesExamples 25 ReadFile Example

Web siteWeb site ExamplesExamples 26 ReadFile Example

Web siteWeb site ExamplesExamples 27 ReadFile Example

Web siteWeb site ExamplesExamples 28 WriteFile WriteFile writes data to a file, using an output handle. The handle can be the screen buffer handle, or it can be one assigned to a text file. Prototype: WriteFile PROTO, fileHandle:DWORD,; output handle pBuffer:PTR BYTE,; pointer to buffer nBufsize:DWORD,; size of buffer pBytesWritten:PTR DWORD,; num bytes written pOverlapped:PTR DWORD; ptr to asynch info

Web siteWeb site ExamplesExamples 29 WriteFile Example

Web siteWeb site ExamplesExamples 30 WriteFile Example

Web siteWeb site ExamplesExamples 31 WriteFile Example

16-Bit MS-DOS Programming

Web siteWeb site ExamplesExamples 33 Interrupt Do something else, and get interrupted when I/O events happen. May be triggered by hardware or software.

Web siteWeb site ExamplesExamples 34 INT I/O Example

Web siteWeb site ExamplesExamples 35 INT I/O Example

Web siteWeb site ExamplesExamples 36 Interrupt Vector Processing

Web siteWeb site ExamplesExamples 37 Interrupt Vector Processing

Web siteWeb site ExamplesExamples 38 Common Interrupts INT 10h Video Services INT 16h Keyboard Services INT 17h Printer Services INT 1Ah Time of Day INT 1Ch User Timer Interrupt INT 21h MS-DOS Services