Program Segment Prefix: Difference between revisions

Content deleted Content added
CE
Line 4:
 
{| border="1" width="100%" class="wikitable"
! Offset
! Offsetimages
! Size
! Contents
|-
| 00h–01h
| 00h-01h
| 2 bytes (code)
| [[CP/M-80]]-like<!-- not CP/M-86! --> exit (always contains [[INT 20h]])<ref name="Taylor_1982_Translators"/><ref name="Paul_2002_COM"/>
|-
| 02h–03h
| 02h-03h
| [[Word (data type)|word]] (2 bytes)
| Segment of the first byte beyond the memory allocated to the program
Line 20:
| Reserved
|-
| 05h–09h
| 05h-09h
| 5 bytes (code)
| [[CALL 5 (PSP)|CP/M-80-like]]<!-- not CP/M-86! --> far call entry into DOS, and program segment size<ref name="Taylor_1982_Translators"/><ref name="Necasek_2011_CALL5"/>
|-
| 0Ah–0Dh
| 0Ah-0Dh
| [[dword]] (4 bytes)
| Terminate address of previous program (old [[INT 22h]])
|-
| 0Eh–11h
| 0Eh-11h
| dword
| Break address of previous program (old [[INT 23h]])
|-
| 12h–15h
| 12h-15h
| dword
| Critical error address of previous program (old [[INT 24h]])
|-
| 16h–17h
| 16h-17h
| word
| Parent's PSP segment (usually [[COMMAND.COM]] - internal)
|-
| 18h–2Bh
| 18h-2Bh
| 20 bytes
| [[Job File Table]] (JFT) (internal)
|-
| 2Ch–2Dh
| 2Ch-2Dh
| word
| [[Environment variable|Environment]] segment
|-
| 2Eh–31h
| 2Eh-31h
| dword
| SS:SP on entry to last [[INT 21h]] call (internal)
|-
| 32h–33h
| 32h-33h
| word
| JFT size (internal)
|-
| 34h–37h
| 34h-37h
| dword
| Pointer to JFT (internal)
|-
| 38h–3Bh
| 38h-3Bh
| dword
| Pointer to previous PSP (only used by SHARE in DOS 3.3 and later)
|-
| 3Ch–3Fh
| 3Ch-3Fh
| 4 bytes
| Reserved
|-
| 40h–41h
| 40h-41h
| word
| DOS version to return (DOS 4 and later, alterable via SETVER in DOS 5 and later)
|-
| 42h–4Fh
| 42h-4Fh
| 14 bytes
| Reserved
|-
| 50h–52h
| 50h-52h
| 3 bytes (code)
| [[Unix]]-like far call entry into DOS (always contains INT 21h + RETF)
|-
| 53h–54h
| 53h-54h
| 2 bytes
| Reserved
|-
| 55h–5Bh
| 55h-5Bh
| 7 bytes
| Reserved (can be used to make first FCB into an extended FCB)
|-
| 5Ch–6Bh
| 5Ch-6Bh
| 16 bytes
| Unopened Standard [[File control block|FCB]] 1
|-
| 6Ch–7Fh
| 6Ch-7Fh
| 20 bytes
| Unopened Standard FCB 2 (overwritten if FCB 1 is opened)
Line 100:
| Number of bytes on command-line
|-
| 81h–FFh
| 81h-FFh
| 127 bytes
| Command-line tail (terminated by a [[Carriage return|0Dh]])<ref name="Paul_1997_MSDOS"/><ref name="Paul_1997_4DOSTIP"/>
Line 156:
</syntaxhighlight>
 
If the executable was a .COM file, this procedure was unnecessary and the program could be terminated merely with a direct INT 20h instruction or else calling INT 21h Functionfunction 0. However, the programmer still had to ensure that the CS register contained the segment address of the PSP at program termination. Thus,
 
<syntaxhighlight lang="nasm">
Line 171:
</syntaxhighlight>
 
In DOS 2.x and higher, program termination was accomplished instead with INT 21h Functionfunction 4Ch which did not require the CS register to contain the segment value of the PSP.
 
== See also ==