PSP

PSP STRUC

pspInt20 dw ? ;Int 20h instruction

pspNextParagraph dw ? ;segment addr of next paragraph

db ? ;reserved

pspDispatcher db 5 dup(?) ;long call to MS-DOS

pspTerminateVector dd ? ;Termination Address (Int 22h)

pspControlCVector dd ? ;CTRL+C Handler (Int 23h) addr

pspCritErrorVector dd ? ;Crit-Err Handler (Int 24h) addr

dw 11 dup(?) ;reserved

pspEnvironment dw ? ;segment address of environment

dw 23 dup(?) ;reserved

pspFCB_1 db 16 dup(?) ;default FCB #1

pspFCB_2 db 16 dup(?) ;default FCB #2

dd ? ;reserved

pspCommandTail db 128 dup(?) ;command tail (also default DTA)

PSP ENDS

The PSP structure contains information about the program's execution environment, such as the amount of memory the system allocates for the program, the location of the program's environment block, and the command-line arguments supplied to the program.

Fields

pspInt20

Contains a Terminate Program (Interrupt 20h) instruction. This field is provided for compatibility with earlier versions of MS-DOS.

pspNextParagraph

Specifies the segment address of the first paragraph immediately following the program. (This address does not point to free memory available for the program to use.) Programs use this field to determine quickly whether they were allocated sufficient memory to run successfully.

pspDispatcher

Contains a call instruction to the MS-DOS function-request handler. This field is provided for compatibility with earlier versions of MS-DOS.

pspTerminateVector

Specifies Termination Address (Interrupt 22h). MS-DOS uses this address to restore the corresponding entry in the interrupt-vector table when the process terminates.

pspControlCVector

Specifies the address of CTRL+C Handler (Interrupt 23h). MS-DOS uses this address to restore the corresponding entry in the interrupt-vector table when the process terminates.

pspCritErrorVector

Specifies the address of Critical-Error Handler (Interrupt 24h). MS-DOS uses this address to restore the corresponding entry in the interrupt-vector table when the process terminates.

pspEnvironment

Specifies the segment address of the environment block for the program.

pspFCB_1

Specifies the first 16 bytes of the first default file control block (FCB) for the program. If the FCB contains a filename, it usually matches the first argument in the command tail. This field is provided for compatibility with earlier versions of MS-DOS.

pspFCB_2

Specifies the first 16 bytes of the second default FCB for the program. If the FCB contains a filename, it usually matches the second argument in the command tail. This field is provided for compatibility with earlier versions of MS-DOS.

pspCommandTail

Specifies an ASCII string containing command-line arguments, such as filenames and switches.

Comments

The system places the PSP in the first 256 bytes of memory allocated for the program. The PSP is followed immediately by the program code and data.

The pspCommandTail field is also used as the default buffer pointed to by the default disk transfer address (DTA). Unless a program explicitly changes the DTA, the system uses this area as a buffer for file information returned by Find First File (Interrupt 21h Function 4Eh) and Find Next File (Interrupt 21h Function 4Fh), as well as for all FCB-type read and write operations.

See Also

Interrupt 20h Terminate Program
Interrupt 21h Function 4Eh Find First File
Interrupt 21h Function 4Fh Find Next File
Interrupt 21h Function 50h Set PSP Address
Interrupt 21h Function 51h Get PSP Address
Interrupt 22h Termination Address
Interrupt 23h CTRL+C Handler
Interrupt 24h Critical-Error Handler