Article View: alt.msdos.programmer
Article #626Re: detecting parameters
From: Duane A. Paulson
Date: Wed, 11 Nov 1992 17:51
Date: Wed, 11 Nov 1992 17:51
29 lines
1474 bytes
1474 bytes
In a previous article, d91mf@efd.lth.se (Mats Fraennhagen) says: >I've written a small program in assembler and I would like to >detect if any parameters like: > >test -? > > is given after the filename. Does DOS support this? > > /Mats > >-- > Mats Fraennhagen Email: d91mf@efd.lth.se > Sure does. This info is in the Program Segment Prefix (PSP), which dos loads as the first 256 bytes of any program. Register ES always points to the beginning of the PSP at the start of a program, no matter whether the program is .COM or .EXE. The start of the command tail (everything following the program name) is at offset 81hex within the PSP. It ends with a CR. A count of the characters in the command tail, including the terminating CR, can be found at offset 80hex within the PSP. Have fun! (C overhead isn't that much!) -- Duane Paulson ci922@cleveland.freenet.edu duane.paulson@pcb.batpad.lgb.ca.us
Technical Details
Message-ID:
<1drh65INNqu@usenet.INS.CWRU.Edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!think.com!ames!agate!usenet.ins.cwru.edu!cleveland.Freenet.Edu!ci922References:
<1992Nov11.093240.22162@lth.se>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!think.com!ames!agate!usenet.ins.cwru.edu!cleveland.Freenet.Edu!ci922 From: ci922@cleveland.Freenet.Edu (Duane A. Paulson) Newsgroups: alt.msdos.programmer,comp.os.msdos.programmer Subject: Re: detecting parameters Date: 11 Nov 1992 17:51:01 GMT Organization: Case Western Reserve University, Cleveland, OH (USA) Lines: 29 Message-ID: <1drh65INNqu@usenet.INS.CWRU.Edu> References: <1992Nov11.093240.22162@lth.se> Reply-To: ci922@cleveland.Freenet.Edu (Duane A. Paulson) NNTP-Posting-Host: hela.ins.cwru.edu