Eric Auer said:

EA>You can also search the other way round: Use int 21.52 ("D-2152"),
EA>subtract 2 from the BX which you get, and ES:BX points to a word with
EA>the segment of the first memory control block. Each memory control
EA>block contains, at offset 3, the value which you have to increment
EA>and then add to the segment value of the MCB to get the segment where
EA>you can find the next MCB.

EA>For me, the first match (match: MCB[1] == MCBsegment+1, meaning that
EA>the MCB is one for a PSP, and MCBsegment+1 is the segment of the PSP)
EA>for which the program name is the COMSPEC (but that can change after
EA>booting... still it is good to use COMSPEC as that is what defines
EA>the current notion of shell) is actually the master FreeCOM.
EA>To get the program name for a PSP: At PSP[0x2c] you find the segment
EA>of the ENVIRONMENT, which consists of 0-byte separated strings, each
EA>looking like SOME=THING. At the end of the environment, you have
EA>(read the docs) usually some header and, as extra string, the name
EA>of the program itself. Interestingly, this is NOT the case for the
EA>master shell. Maybe the kernel does not initialize it in that case?

EA>So I have to correct myself: The first PSP linked by the MCB chain
EA>is the one of the master shell,

   Usually not. More probably some DEVICE

EA> but this has non [own program name]
EA>set in the environment (which is linked from the PSP). However, it
EA>does have "FREECOM" (or if your shell has another name, that name)
EA>at MCB[8]. Can be useful, but experience tells that MCB[8] sometimes
EA>just contains 8 uninitialized or faked bytes.


EA>So alternative methods are welcomed.

 A method described in "PC Magazine Assembly Language Lab Notes" is quite like 
Eric's, but looks instead at PSP [0x0A]-[0x0D] (INT 22), the parent's PSP
address- If PSP program is it's own parent,then it is the primary shell. If 
not, 
proceed to next MCB which is owned by a PSP and so on.
  
  Regards
    JAS



-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Freedos-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freedos-devel

Reply via email to