Program Segment Prefix: Difference between revisions

Content deleted Content added
Undid revision 153181667 by Vinnie taylor (talk)
Line 90:
The PSP is most often used to get the command line arguments of a DOS program, for example the command "foo.exe -a -f" executes foo.exe with the arguments '-a' and '-f'.
 
==Code Samples==
hello ruby tuesday
 
The segment address of the PSP can be determined by using interrupt 21 subfunction 62. This interrupt will return the PSP address in register BX.<sup>1</sup>
 
Alternatively, in COM programs, one can address the PSP directly just by using the offsets listed above. 00h points to the beginning of the PSP, FFh points to the end, etc. For example, the following code gets the length (in bytes) of the command line arguments:
 
<pre><nowiki>
org 100h
mov al, byte [80h]
; al now contains the number of characters on the command-line (byte 80h of the PSP)
</nowiki></pre>
 
<sup>1</sup> http://www.htl-steyr.ac.at/~morg/pcinfo/hardware/interrupts/inte8fjk.htm
 
[[Category:DOS on IBM PC compatibles]]
 
[[de:Program Segment Prefix]]
[[he:תחילית מקטע התוכנית]]