Hi, I did a bit of thinking about the master environment search... - you can use the "parent PSP segment" word at PSP[0x16], but this gets into a loop not only for FreeCOM but also for DEBUG. Are other programs affected by that as well? - you can use the "stored int 22" (at PSP[0x0a], see RBIL "D-2126" section about program segment prefixes) or similar values, but they loop for DEBUG, too. - you can use the "int 24 critical error pointer" - that one does not seem to loop, but is that always the case? And: You do not know which segment value it has relative to the PSP. For debug: Delta is 0x10. The PSP[0x12] int 24 pointer points to the kernel if you look at the PSP of the master FreeCOM shell
You can also search the other way round: Use int 21.52 ("D-2152"), subtract 2 from the BX which you get, and ES:BX points to a word with the segment of the first memory control block. Each memory control block contains, at offset 3, the value which you have to increment and then add to the segment value of the MCB to get the segment where you can find the next MCB. For me, the first match (match: MCB[1] == MCBsegment+1, meaning that the MCB is one for a PSP, and MCBsegment+1 is the segment of the PSP) for which the program name is the COMSPEC (but that can change after booting... still it is good to use COMSPEC as that is what defines the current notion of shell) is actually the master FreeCOM. To get the program name for a PSP: At PSP[0x2c] you find the segment of the ENVIRONMENT, which consists of 0-byte separated strings, each looking like SOME=THING. At the end of the environment, you have (read the docs) usually some header and, as extra string, the name of the program itself. Interestingly, this is NOT the case for the master shell. Maybe the kernel does not initialize it in that case? So I have to correct myself: The first PSP linked by the MCB chain is the one of the master shell, but this has non [own program name] set in the environment (which is linked from the PSP). However, it does have "FREECOM" (or if your shell has another name, that name) at MCB[8]. Can be useful, but experience tells that MCB[8] sometimes just contains 8 uninitialized or faked bytes. And I believe that using INSTALL or SHELLHIGH could cause the master shell to end up at a less exposed location in the MCB chain. So alternative methods are welcomed. Eric ------------------------------------------------------- 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 Freedos-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/freedos-devel