Program Segment Prefix: Difference between revisions

Content deleted Content added
Nevuer (talk | contribs)
m he:
Nevuer (talk | contribs)
m converted to wiki-style table
Line 2:
It has the following structure:
 
<table{| border="1">
| Offset
<tr><td>Offset</td><td>Size</td><td>Contents</td></tr>
| Size
<tr><td>00-01</td><td>Code</td><td>CP/M exit (always contain INT 20)</td></tr>
| Contents
<tr><td>02-03</td><td>Word</td><td>Memory size in paragraphs</td></tr>
|-
<tr><td>04</td><td> </td><td>Reserved</td></tr>
| 00-01
<tr><td>05-09</td><td>Code</td><td>Far call to CP/M compatibility code within DOS</td></tr>
| Code
<tr><td>0A-0D</td><td>[[DWord]]</td><td>Terminate address of previous program (old INT 22)</td></tr>
| CP/M exit (always contain INT 20)
<tr><td>0E-11</td><td>DWord</td><td>Break address of previous program (old INT 23)</td></tr>
|-
<tr><td>12-15</td><td>DWord</td><td>Critical error address of previous program (old INT 24)</td></tr>
| 02-03
<tr><td>16-17</td><td>Word</td><td>Parent psp segment (PSP of caller - usually command.com - internal)</td></tr>
| Word
<tr><td>18-2B</td><td>Bytes</td><td>[[Job File Table]](JFT) (internal)</td></tr>
| Memory size in paragraphs
<tr><td>2C-2D</td><td>Word</td><td>Environment segment</td></tr>
|-
<tr><td>2E-31</td><td>DWord</td><td>SS:SP on entry to last INT 21 call (Internal)</td></tr>
| 04
<tr><td>32-33</td><td>Word</td><td>Max open files (Internal - see below)</td></tr>
|
<tr><td>34-37</td><td>DWord</td><td>Handle-entries address (Internal - see below)</td></tr>
| Reserved
<tr><td>38-4F</td><td> </td><td>Reserved</td></tr>
|-
<tr><td>50-52</td><td>Code</td><td>Far call to DOS (always contain INT 21 + RETF)</td></tr>
| 05-09
<tr><td>53-5B</td><td> </td><td>Reserved</td></tr>
| Code
<tr><td>5C-6B</td><td> </td><td>Unopened Standard FCB 1</td></tr>
| Far call to CP/M compatibility code within DOS
<tr><td>6C-7F</td><td> </td><td>Unopened Standard FCB 2 (overwritten if FCB 1 is opened)</td></tr>
|-
<tr><td>80</td><td>Byte</td><td>Number of characters on command-line</td></tr>
| 0A-0D
<tr><td>81-FF</td><td>Bytes</td><td>Command-line (terminated by a 0Dh)</td></tr>
| [[DWord]]
</table>
| Terminate address of previous program (old INT 22)
 
|-
| 0E-11
| DWord
| Break address of previous program (old INT 23)
|-
| 12-15
| DWord
| Critical error address of previous program (old INT 24)
|-
| 16-17
| Word
| Parent psp segment (PSP of caller - usually command.com - internal)
|-
| 18-2B
| Bytes
| [[Job File Table]](JFT) (internal)
|-
| 2C-2D
| Word
| Environment segment
|-
| 2E-31
| DWord
| SS:SP on entry to last INT 21 call (Internal)
|-
| 32-33
| Word
| Max open files (Internal - see below)
|-
| 34-37
| DWord
| Handle-entries address (Internal - see below)
|-
| 38-4F
|
| Reserved
|-
| 50-52
| Code
| Far call to DOS (always contain INT 21 + RETF)
|-
| 53-5B
|
| Reserved
|-
| 5C-6B
|
| Unopened Standard FCB 1
|-
| 6C-7F
|
| Unopened Standard FCB 2 (overwritten if FCB 1 is opened)
|-
| 80
| Byte
| Number of characters on command-line
|-
| 81-FF
| Bytes
| Command-line (terminated by a 0Dh)
|}
 
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'.