Overlays in MS-DOS

advertisement
Overlays in MS-DOS
By Andrew C. Vogan
For CS 450
12/03/2002
This work complies with the JMU Honor Code.
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
Overlays in MS-DOS
3. Overlays
- Concept and Programmer
Perspective
- Operating System
Perspective
- Summary
by Andrew C. Vogan
2
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
3
Major Features NOT Included in DOS
multitasking, CPU scheduler
fault tolerance
multiprocessor support
deadlock management
threads
paged memory
multiuser
graphical user interface
hard/soft real-time
file system security
Major Features Included in DOS
FAT file system:
Direct, complete hardware control:
- file attributes
- simple file locks
- memory/device access
- interrupt vector overrides
Overlays in MS-DOS
by Andrew C. Vogan
4
80x86 Addressing Modes
CPU
Mode
8086
80286
80386/80486
Real
Protected
Protected
Address Physical
Bits
Lines
32
20
32
24
32
32
Addressable
Memory
1 MB
16 MB
4 GB
80x86 “Real Mode” Segmentation
16
segment
16
4
segment
0x0
16
offset
16
offset
20
physical address
Overlays in MS-DOS
by Andrew C. Vogan
5
DOS Memory Organization and OS Loading
Diagrams derived from Ray Duncan, Advanced MS-DOS Programming
ROM Bootstrap Program
ROM Bootstrap Program
top of
RAM
top of
RAM
Transient part of COMMAND.COM
Disk Bootstrap Program
TPA
Resident part of COMMAND.COM
DOS kernel, from MSDOS.SYS
(temporary location)
Drivers, file control blocks
and disk buffer cache
SYSINIT, from IO.SYS
DOS kernel
BIOS, from IO.SYS
BIOS
0x00400
0x00400
Interrupt vectors
Interrupt vectors
0x00000
Overlays in MS-DOS
(moved)
by Andrew C. Vogan
0x00000
6
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
A
D
E
Overlays in MS-DOS
B
C
by Andrew C. Vogan
D
E
7
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.
Overlay Manager
Unit1
(interrupt handler)
Overlay Manager
Unit2
(code)
…
(code)
…
Unit2Function
…
CALL Unit2Function
…
Overlays in MS-DOS
(interrupt handler)
by Andrew C. Vogan
8
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.
Overlays in MS-DOS
by Andrew C. Vogan
9
Download