overlays in ms-dos by andrew c. vogan for cs 450 12/03/2002 this work complies with the jmu honor...
TRANSCRIPT
Overlays in MS-DOS
By Andrew C. Vogan
For CS 450
12/03/2002
This work complies with the JMU Honor Code.
Overlays in MS-DOS by Andrew C. Vogan 2
Overview of Presentation
1. Introduction to MS-DOS - History of DOS - Limitations and Features
2. DOS Memory Limitations - 80x86 Addressing Modes - 8086 Segmentation - DOS Memory Organization and Loading
3. Overlays - Concept and Programmer Perspective - Operating System Perspective - Summary
Overlays in MS-DOS by Andrew C. Vogan 3
History of MS-DOS
• Seattle Computer Products 86-DOS was loosely based on CP/M.
• In 1981, Microsoft purchased 86-DOS, and renamed it as “MS-DOS.” From the start, MS-DOS was intended for IBM’s personal computers, designed for the Intel 8086/8088 CPUs.
• MS-DOS shipped with the original IBM PC in 1981, and quickly grew to be the OS of choice for both IBM PC’s and “clones.”
• “DOS” stands for “Disk Operating System.” MS-DOS came to provide not only the basic disk features provided by CP/M, but also some UNIX-like features (I/O redirection, piping, filters).
Overlays in MS-DOS by Andrew C. Vogan 4
multitasking, CPU scheduler
multiprocessor support
threads
multiuser
hard/soft real-time
Major Features NOT Included in DOS
fault tolerance
deadlock management
paged memory
graphical user interface
file system security
FAT file system:- file attributes- simple file locks
Major Features Included in DOS
Direct, complete hardware control:- memory/device access- interrupt vector overrides
Overlays in MS-DOS by Andrew C. Vogan 5
80x86 Addressing Modes
CPU Mode AddressBits
PhysicalLines
AddressableMemory
8086 Real 32 20 1 MB80286 Protected 32 24 16 MB80386/80486 Protected 32 32 4 GB
80x86 “Real Mode” Segmentation
segment
offset
16
16
segment16
0x04
offset16
physical address20
Overlays in MS-DOS by Andrew C. Vogan 6
DOS Memory Organization and OS LoadingDiagrams derived from Ray Duncan, Advanced MS-DOS Programming
ROM Bootstrap Program
Disk Bootstrap Program
SYSINIT, from IO.SYS
DOS kernel, from MSDOS.SYS
BIOS, from IO.SYS
Interrupt vectors 0x00000
0x00400
(temporary location)
top of RAM
ROM Bootstrap Program
Transient part of COMMAND.COM
TPA
Resident part of COMMAND.COM
Drivers, file control blocksand disk buffer cache
DOS kernel
BIOS
Interrupt vectors 0x00000
0x00400
(moved)
top of RAM
Overlays in MS-DOS by Andrew C. Vogan 7
Overlays -- The Concept
• Overlaying is the technique of loading different portions of a program into the same memory area.
• Overlay programming techniques were first developed and refined on mainframes in the 1960’s.
• This allowed MS-DOS developers to split a program up, that was otherwise would not fit in conventional memory.
A
B C ED
A
B C ED
Overlays in MS-DOS by Andrew C. Vogan 8
Overlays -- From OS Perspective
• Overlay files were loaded in a similar manner to normal spawned executables. The main difference was less control by MS-DOS (no PSP or automatic execution point transfer).
• One popular mechanism of switching between overlaid code units was raising a custom interrupt, intercepted by a custom overlay manager.
(interrupt handler)
(code)
…
CALL Unit2Function…
Overlay Manager
Unit1
(interrupt handler)
(code)
…Unit2Function
…
Overlay Manager
Unit2
Overlays in MS-DOS by Andrew C. Vogan 9
Summary
• Overlays provided an adequate solution to MS-DOS’s memory limitations for many applications.
• Problems with overlaid programs included that they did not take advantage of extended memory, and that they were difficult to implement (often requiring intricate modular design).
• Windows 3.x operating systems (bringing full 80386 protected mode support) were a welcome upgrade for many developers.
• It is still instructive to analyze techniques like overlaying, particularly for the sake of PDA’s and other small-footprint devices.