8.7 Memory management Program E Program D System memory DOS INT 21, function 48H: Allocate Memory Specification: allocates a number of memory paragraphs.

Slides:



Advertisements
Similar presentations
Computer Programming Spring-2007
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.
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.
There are two types of addressing schemes:
MICROPROCESSORS TWO TYPES OF MODELS ARE USED :  PROGRAMMER’S MODEL :- THIS MODEL SHOWS FEATURES, SUCH AS INTERNAL REGISTERS, ADDRESS,DATA & CONTROL BUSES.
©annax1 PC-technology Keyboard Graphics Interface cards.
University of Tehran 1 Microprocessor System Design Interrupt Omid Fatemi
Microprocessor and Microcontroller
Mouse handling Suthida Chaichomchuen
More about procedures and Video Processing. Lesson plan Review existing concepts More about procedures and boolean expression Video processing.
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.
Chaining Interrupts. Short contents What does chaining interrupts mean? TSR programs Chaining an interrupt example program Reentrancy problems with DOS.
Set 20 Interrupts. INTERRUPTS The Pentium has a mechanism whereby external devices can interrupt it. Devices such as the keyboard, the monitor, hard disks.
Assembly Language for Intel-Based Computers Chapter 15: BIOS-Level Programming (c) Pearson Education, All rights reserved. You may modify and.
SET 19 PROGRAMMING THE MOUSE. Mouse Features All mouse operations within a program are performed by standard INT 33H functions of the form: MOV AX, function.
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)
Chapter 7 Programming with DOS and BIOS Function Calls Objectives: The use of DOS and BIOS function call How to read the PC’s keyboard How to send text.
3-1 ECE 424 Design of Microprocessor-Based Systems Haibo Wang ECE Department Southern Illinois University Carbondale, IL Intel 8088 (8086) Microprocessor.
Structure of DOS application programs. Contents: 1. PSP 2..COM and.EXE 3. TSR: Terminate and Stay Resident Programs.
80x86 Processor Architecture
Introduction to Computer Engineering by Richard E. Haskell Interrupts Module M17.3 Sections 11.3, 14.1.
8.4 Instruction Execution Times TOBIN PROC FAR SUB AX,AX MOV DX,AX MOV CX,4 NEXTD: PUSH CX SUB BP,BP MOV CX,4 GETNUM: RCL BX,1 RCL BP,1 LOOP GETNUM.
Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 251 Introduction to Computer Organization.
Assembly Language Lecture By Shery khan
Introduction Part 1 The Microprocessor Based Systems  Memory and I/O System  Microprocessor.
Interrupts. 2 Definition: An electrical signal sent to the CPU (at any time) to alert it to the occurrence of some event that needs its attention Purpose:
ICS312 Set 4 Program Structure. Outline for a SMALL Model Program Note the quiz at the next lecture will be to reproduce this slide.MODEL SMALL.586 ;
An Introduction to 8086 Microprocessor.
ORG ; FOUR INT 21H and INT 10H Programming and Macros Dec Hex Bin
Lecture 11 Last notes on interrupts and exam review Dr. Dimitrios S. Nikolopoulos CSL/UIUC.
ECE291 Computer Engineering II Lecture 13 Dr. Zbigniew Kalbarczyk University of Illinois at Urbana- Champaign.
The x86 PC Assembly Language, Design, and Interfacing By Muhammad Ali Mazidi, Janice Gillespie Mazidi and Danny Causey © 2010, 2003, 2000, 1998 Pearson.
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.
Programming the Microprocessor A Course in Microprocessor Electrical Engineering Dept. University of Indonesia.
Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 251 Introduction to Computer Organization.
TERMINATE-AND-STAY-RESIDENT TSR IS A SOFTWARE PROGRAM THAT REMAINS IN MEMORY UNTIL IT IS NEEDED, AND THEN PERFORMS SOME FUNCTION. AN GOOD EXAMPLE OF A.
1 Screen and Keyboard Operations Suthida Chaichomchuen
1 Microprocessor-based Systems Course 8 Design of input/output interfaces.
Chapter 2 Instruction Addressing and Execution. Lesson plan Review some concepts in the first week First assembly program with EMU8086 Related concepts.
Mouse Question #1 Which INT number is used for the mouse?
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.
Video systems. Lesson plan Review the code for the previous exercise Video systems Review for midterm exam.
Writing and Reading Files Methods for processing disk files File Control Blocks (FCBs) –Supported by DOS –Can address drives and filenames.
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.
10H Interrupt. Option 0H – Sets video mode. Registers used: – AH = 0H – AL = Video Mode. 3H - CGA Color text of 80X25 7H - Monochrome text of 80X25 Ex:
String Instructions String instructions were designed to operate on large data structures. The SI and DI registers are used as pointers to the data structures.
Chapter 2 Parts of a Computer System. 2.1 PC Hardware: Memory.
Chapter 7 Input/Output Interface and Interruption System Principles of Microcomputers 2016年1月12日 2016年1月12日 2016年1月12日 2016年1月12日 2016年1月12日 2016年1月12日.
1 After completing this lesson, you will be able to: Open a file. Navigate through a document. Scroll through a document. Insert text in a document. Select.
ECE291 Lecture 10 Interrupts II. ECE 291 Lecture 9Slide 2 of 22 Lecture outline Installing/Removing ISRsInstalling/Removing ISRs Interrupt SchedulingInterrupt.
Assembly Language Lecture 2. Lecture Outline Program Structure Memory models Data Segment Stack Segment Code Segment Input and Output Instructions INT.
Preliminary to Assembly Language Programming CE 140 A1/A2 28 June 2003.
File Operations. FILE PROCESSING For the purposes of the following discussion, reading means copying all or part of an existing file into memory Writing.
7-Nov Fall 2001: copyright ©T. Pearce, D. Hutchinson, L. Marshall Oct lecture23-24-hll-interrupts 1 High Level Language vs. Assembly.
Chapter 2 Instruction Addressing and Execution. Lesson plan Review some concepts in the first week First assembly program with EMU8086 Related concepts.
Introduction to Kernel
Mouse Programming With “C” or “C++”
Lecture 2 Programming of 8086 Лектор: Люличева И.А. 1.
8086 Microprocessor.
Microprocessor and Assembly Language
Symbolic Instruction and Addressing
8086 Registers Module M14.2 Sections 9.2, 10.1.
CS 301 Fall 2002 Computer Organization
CS-401 Computer Architecture & Assembly Language Programming
Symbolic Instruction and Addressing
Unit:08 Software Interrupts
Unit-I 80386DX Architecture
Process.
Presentation transcript:

8.7 Memory management Program E Program D System memory DOS INT 21, function 48H: Allocate Memory Specification: allocates a number of memory paragraphs. Paragraph = a chunk of 16 memory bytes, starting at a physical address of type XXXX0H. Input: AH = 48H (function code), BX = the number of requested paragraphs. Output: if succeeds: CF = 0, AX = the starting segment address of the allocated memory block. if DOS cannot allocate the requested memory: CF = 1, AX = error code, BX = the largest free memory block size (in paragraphs). DOS INT 21, function 49H: Free Allocated Memory Specification: frees a memory block. Input: AH = 49H (function code), ES = the block segment address. Output: if succeeds: CF = 0. if DOS cannot free memory block: CF = 1, AX = error code. Constrain: the block segment address must be previously obtained trough INT 21H, function 48H. DOS INT 21, function 4AH: Modify Allocated Memory Blocks Specification: modifies the length of an already allocated memory block. Input: AH = 4AH (function code), ES = the block segment address, BX = the block size (in paragraphs) needed after modification. Output: if succeeds: CF = 0. if DOS cannot modify the memory block: CF = 1, AX = error code, BX = the maximum size available for the requested block (in paragraphs). Constrain: the block segment address must be previously obtained trough INT 21H, function 48H.

8.7 Memory management Program A Program B Program C Program A Program C Program A Program C Program D Program C Program D Program E Program C Program D Program E Program D System memory DOS INT 21, function 48H: Allocate Memory Specification: allocates a number of memory paragraphs. Paragraph = a chunk of 16 memory bytes, starting at a physical address of type XXXX0H. Input: AH = 48H (function code), BX = the number of requested paragraphs. Output: if succeeds: CF = 0, AX = the starting segment address of the allocated memory block. if DOS cannot allocate the requested memory: CF = 1, AX = error code, BX = the largest free memory block size (in paragraphs). DOS INT 21, function 49H: Free Allocated Memory Specification: frees a memory block. Input: AH = 49H (function code), ES = the block segment address. Output: if succeeds: CF = 0. if DOS cannot free memory block: CF = 1, AX = error code. Constrain: the block segment address must be previously obtained trough INT 21H, function 48H. DOS INT 21, function 4AH: Modify Allocated Memory Blocks Specification: modifies the length of an already allocated memory block. Input: AH = 4AH (function code), ES = the block segment address, BX = the block size (in paragraphs) needed after modification. Output: if succeeds: CF = 0. if DOS cannot modify the memory block: CF = 1, AX = error code, BX = the maximum size available for the requested block (in paragraphs). Constrain: the block segment address must be previously obtained trough INT 21H, function 48H. Program E Program D

8.8 Using the Mouse MOUSE INT 33, function 00H: Mouse Reset and Status Specification: reset mouse controller and return status. Input: AH = 00 (function code) Output: AX = Mouse Status (0FFh = mouse initialized, 0 = no mouse functions available) BX = mouse buttons status (bit 0 = 1 =>left button pressed, bit 1 = 1 =>right button pressed. Constrain: INT 33 is neither a DOS or BIOS interrupt. The mouse driver MOUSE.SYS should be loaded or MOUSE.COM executed, to install this interrupt. MOUSE INT 33, function 01H: Show mouse cursor Specification: turn on the mouse cursor (inverse video box in text mode, arrow in graphics mode). MOUSE INT 33, function 02H: Hide mouse cursor Specification: turn off the mouse cursor. MOUSE INT 33, function 03H: Get Button Status and Mouse Position Specification: returns button status and mouse position. Input: AH = 03 (function code) Output:BX = Button Status (similar to function 00), CX = horizontal position of the mouse cursor (CX = 0 => cursor on the most left position. DX = vertical position of the mouse cursor (DX = 0 => cursor on the most upper position. The maximum CX and DX values depend on current video mode. Input: AH = 01(function code) Input: AH = 02 (function code)

8.9 Writing a Memory Resident Program DOS INT 21, function 31H: Terminate and Stay Resident Specification: returns control to DOS, keeping allocated memory. Input: AH = 31H (function code), DX the number of paragraphs remaining resident. Note: The keeped memory allocation must be large enough to store the Program Segment Prefix and the necessary code and data segments. DOS INT 21, function 27H: Terminate and Stay Resident (only.COM files) Specification: returns control to DOS, keeping allocated memory. Constrain: used only for.COM programs. Input: AH = 27H (function code), DX = the number of bytes remaining resident. The TSR (Terminate and Stay Resident) program can be activated using an interrupt. To be able to do this, it should be installed = hooking an interrupt (timer, keyboard, serial port...). When discharging the allocated memory, the TSR should restore the IPT (Interrupt Pointer Table) at the previous state. The TSR (when activated by the hooked interrupt) uses the current SS:SP of the interrupted program to save the used registers (beside FLAGS and return address already saved by interrupt acknowledging). If a large stack amount is needed, the TSR should use it’s own stack area (modifying SS:SP) and restore the current SS:SP before returning.