Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
97 views

Runtime Program Structure

The command processor, usually COMMAND.COM, interprets commands typed at the prompt. It first checks for internal commands, then looks for matching files with COM, EXE, or BAT extensions in the current directory. If not found, it searches directories in the path. COM and EXE programs are transient, loaded into memory temporarily. They have a Program Segment Prefix area for MS-DOS pointers. COM programs are loaded at the lowest address with code, data, and stack together. EXE programs have an EXE header, and code and data are loaded above the PSP separately from the stack.

Uploaded by

mb_4u
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
97 views

Runtime Program Structure

The command processor, usually COMMAND.COM, interprets commands typed at the prompt. It first checks for internal commands, then looks for matching files with COM, EXE, or BAT extensions in the current directory. If not found, it searches directories in the path. COM and EXE programs are transient, loaded into memory temporarily. They have a Program Segment Prefix area for MS-DOS pointers. COM programs are loaded at the lowest address with code, data, and stack together. EXE programs have an EXE header, and code and data are loaded above the PSP separately from the stack.

Uploaded by

mb_4u
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 6

Runtime Program Structure

Command.com program supplied with MSDOS and Windows (CMD.EXE for 2000 and XP)is called the command processor. It interprets each command typed at a prompt.

Procedure for Command Typed at Prompt


1. Is command internal (DIR, REN, or ERASE)? if so, immediately execute by a memory-resident MS-DOS routine. 2. Is there a matching file with extension of COM? if file is in current directory, it is executed. 3. Is there a matching file with extension of EXE? If file is in current directory, it is executed. 4. Is there a matching file with extension of BAT? -If file is in current directory, it is executed. BAT are batch files a text file containing MS_DOS commands to be executed as if commands were typed at the console. 5. If no COM, EXE, or BAT file in the current directory, first directory in current path is searched. If not found, proceeds to next directory in path. Continues until file is found or search is exhausted.

Transient Programs (COM and EXE programs)


Application programs with extensions of COM and EXE are called transient programs. Generally, loaded into memory long enough to be executed; then the memory they occupy is released. Can leave a portion of their code in menry when they exit; these are called memoryresident programs.

Program Segment Prefix (PSP)


A special 256-byte block at the beginning of a a program as it is loaded into memory
Offset Comments 00-15 MS-DOS pointers and vector addresses

16-2B Reserved by MS-DOS 2C-2D Segment address of the current environment string 2E-5B Reserved by MS-DOS 5C-7F 80-FF File Control Blocks 1 and 2, used mainly by pre-MS-DOS 2.0 programs Default disk transfer area and a copy of the current MS_DOS command tail

COM Programs
Unmodified binary image of a machine-language program. Loaded into memory by MS_DOS at the lowest available segment address; a PSP is created at offset 0. Code, data and stack are all stored in the same segment (physical and logical)Uses TINY memory model Program can be as large as 64k (minus 256 for PSP and 2 bytes at end of stack).
0000 0100 FFFE

PSP

CODE

DATA------------------------------------------STACK

CS,DS,ES,SS

SP

EXE Programs
Stored on Disk with an EXE header followed by a load module containing program. Header is not loaded into memory; instead contains info used by MS_DOS to load and execute the program. PS is created at first available address, program is placed in memory above it. DS and ES ared set to programs load address. CS and IP set to entry point of code, SS set to beginning of stack segment, SP set to stack size.

You might also like