🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.micro.pc
Article #6460

Re: Current DOS environment

#6460
From: Lloyd Zusman
Date: Wed, 07 May 1986 23:18
54 lines
2205 bytes
In article <322@bnrmtv.UUCP> connery@bnrmtv.UUCP (Glenn Connery) writes:
>> 
>> 
>> Does anyone out there know how to get a pointer to the
>> CURRENT environment in DOS?  What about version dependencies?
>> 
>>       Joe Maybee
>>       ...!tektronix!pogo!maybee
>> 
>> "We have met the enemy and he is US!"
>>        ---Pogo
>> 
>> -- 
>> 
>> 
>>                  ----maybee@pogo
>> 
>> "We have met the enemy and he is US!"
>>                  ----Pogo
>
>The program segment prefix has the segment address of the environment
>at offset 2C.  If you take this and add offset zero you will be able
>to locate the current environment for THIS program, which is a COPY
>of that for its parent, usually DOS.  It contains a series of strings,
>as displayed by typing SET with no parms, each terminated by a null byte.
>The end of the table is indicated by a trailing NULL (ie. two null bytes
>in a row).
>
>This should be valid for all DOS versions that support the environment.
>-- 
>
>Glenn Connery, Bell Northern Research, Mountain View, CA
>{hplabs,amdahl,3comvax}!bnrmtv!connery


Also, if you need to find the PSP (program segment prefix) in the first place
...

	mov ah, 62h
	int 21h

	The PSP segment address will be in BX.

The above is documented and works on all DOS versions 3.0 and above.  But if
you're using DOS 2.X ...

	mov ah, 51h
	int 21h

	The PSP segment address will be in BX.

This one isn't documented, but to quote Chris Dunford in a letter to Dr.
Dobbs Journal (the source for this information), "... but I don't forsee any
new releases of DOS 2.X in the near future!"
Technical Details
Message-ID: <1040@well.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!linus!philabs!cmcl2!harvard!caip!nike!styx!lll-crg!lll-lcc!well!ljz
References: <2454@pogo.UUCP> <322@bnrmtv.UUCP>

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!linus!philabs!cmcl2!harvard!caip!nike!styx!lll-crg!lll-lcc!well!ljz
From: ljz@well.UUCP (Lloyd Zusman)
Newsgroups: net.micro.pc
Subject: Re: Current DOS environment
Message-ID: <1040@well.UUCP>
Date: Wed, 7-May-86 19:18:52 EDT
Article-I.D.: well.1040
Posted: Wed May  7 19:18:52 1986
Date-Received: Sat, 10-May-86 14:08:03 EDT
References: <2454@pogo.UUCP> <322@bnrmtv.UUCP>
Reply-To: ljz@well.UUCP (Lloyd Zusman)
Organization: Whole Earth Lectronic Link, Sausalito CA
Lines: 54