Program Segment Prefix: Difference between revisions

Content deleted Content added
CE, added refs
Mentioned long command lines
Line 106:
 
The PSP is most often used to get the [[argc|command line arguments]] of a DOS program; for example, the command "FOO.EXE /A /F" executes FOO.EXE with the arguments '/A' and '/F'.
 
If the PSP entry for the command line length is non-zero and the pointer to the environment segment is neither 0000h nor FFFFh<!-- 0000h indicating "no environment" and "FFFF" reserved -->, programs should first try to retrieve the command line from the [[environment variable]] [[%CMDLINE%]] before extracting it from the PSP. This way, it is possible to pass command lines longer than 126 characters to applications.
 
The segment address of the PSP is passed in the DS register when the program is executed. It can also be determined later by using Int 21h function 51h or Int 21h function 62h. Either function will return the PSP address in register BX.<ref name="R1"/>