Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Ralf Brown's Interrupt List (Part 1,2) - int 21 - dos - create psp http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
INT 21 - DOS - CREATE PSP
        AH = 26h
        DX = segment number at which to set up PSP
Return: current PSP is copied to specified segment
Notes:  new PSP is updated with memory size information; INTs 22h, 23h, 24h
          taken from interrupt vector table
        (DOS 2+) DOS assumes that the caller's CS is the segment of the PSP to
          copy
SeeAlso: AH=50h,AH=51h,AH=55h,AH=62h,AH=67h

Format of PSP:
Offset  Size    Description
 00h  2 BYTEs   program exit point (INT 20h instruction)
 02h    WORD    memory size in paragraphs
 04h    BYTE    unused
 05h  5 BYTEs   CP/M entry point (FAR jump to 000C0h)
                BUG: (DOS 2+) PSPs created by INT 21/AH=4Bh point at 000BEh
 06h    WORD    CP/M compatibility--size of first segment for .COM files
 0Ah    DWORD   terminate address (old INT 22h)
 0Eh    DWORD   break address (old INT 23h)
 12h    DWORD   critical error handler (old INT 24h)
 16h    WORD    parent PSP segment
 18h 20 BYTEs   DOS 2+ open file table, FFh = unused
 2Ch    WORD    DOS 2+ environment segment (see below)
 2Eh    DWORD   DOS 2+ process's SS:SP on entry to last INT 21 call
 32h    WORD    DOS 3+ max open files
 34h    DWORD   DOS 3+ open file table address
 38h    DWORD   DOS 3+ pointer to previous PSP (default FFFFFFFFh in 3.x)
                used by SHARE in DOS 3.3
 3Ch 20 BYTEs   unused by DOS versions <= 4.01
 50h  3 BYTEs   DOS function dispatcher (FAR routine)--CDh 21h CBh
 53h  9 BYTEs   unused
 5Ch 16 BYTEs   FCB #1 (see AH=0Fh), filled in from first commandline argument
                (when opened, overwrites following FCB)
 6Ch 20 BYTEs   FCB #2 (see AH=0Fh), filled in from second commandline argument
                (when opened, overwrites part of command tail)
 80h 128 BYTEs  command tail / default DTA buffer
                command tail is BYTE for length of tail, N BYTEs for the tail,
                followed by a BYTE containing 0Dh
Notes:  in DOS versions 3.0 and up, the limit on simultaneously open files may
          be increased by allocating memory for a new open file table, filling
          it with FFh, copying the first 20 bytes from the default table, and
          adjusting the pointer and count at 34h and 32h.  However, DOS
          versions through  at least 3.30 will only copy the first 20 file
          handles into a child PSP (including the one created on EXEC).
        network redirectors based on the original MS-Net implementation use
          values of 80h-FEh in the open file table to indicate remote files

Format of environment block:
Offset  Size    Description
 00h  N BYTEs   first environment variable, ASCIZ string of form "var=value"
      N BYTEs   second environment variable, ASCIZ string
        ...
      N BYTEs   last environment variable, ASCIZ string of form "var=value"
        BYTE    00h
---DOS 3+---
        WORD    number of strings following environment (normally 1)
      N BYTEs   ASCIZ full pathname of program owning this environment
                other strings may follow

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson