DOS Fn 51H: Query Current PSP
Compatibility: 2.0+ (doc'd: 5.0)
Expects: AH 51H
──────────────────────────────────────────────────────────────────
Returns: BX Process ID (i.e, PSP segment) of current process
──────────────────────────────────────────────────────────────────
Info: This function obtains the segment address of the PSP (a.k.a, the
Process ID) of the calling program.
A TSR should save its PSP during initialization. Before popping
up, the TSR should use fn 51H to get the ID of the interrupted
program, then use fn 50H to set the PID to the saved value. Be
sure to change the PID back before popping down.
Notes: ■ On program startup, DS and ES both contain the PSP segment.
■ Undocumented fn 62H performs this same function. You may use
either one (62H is more commonly used, perhaps because it was
uncovered earlier).
See Also: PSP (Program Segment Prefix)
Process Control Functions
Program Startup & Exit
DOS Environment
DOS Functions
-♦-