home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / alt / msdos / programm / 2712 < prev    next >
Encoding:
Internet Message Format  |  1992-11-11  |  1.5 KB

  1. Xref: sparky alt.msdos.programmer:2712 comp.os.msdos.programmer:10515
  2. Path: sparky!uunet!think.com!ames!agate!usenet.ins.cwru.edu!cleveland.Freenet.Edu!ci922
  3. From: ci922@cleveland.Freenet.Edu (Duane A. Paulson)
  4. Newsgroups: alt.msdos.programmer,comp.os.msdos.programmer
  5. Subject: Re: detecting parameters
  6. Date: 11 Nov 1992 17:51:01 GMT
  7. Organization: Case Western Reserve University, Cleveland, OH (USA)
  8. Lines: 29
  9. Message-ID: <1drh65INNqu@usenet.INS.CWRU.Edu>
  10. References: <1992Nov11.093240.22162@lth.se>
  11. Reply-To: ci922@cleveland.Freenet.Edu (Duane A. Paulson)
  12. NNTP-Posting-Host: hela.ins.cwru.edu
  13.  
  14.  
  15. In a previous article, d91mf@efd.lth.se (Mats Fraennhagen) says:
  16.  
  17. >I've written a small program in assembler and I would like to
  18. >detect if any parameters like:
  19. >
  20. >test -?
  21. >
  22. > is given after the filename. Does DOS support this?
  23. > /Mats
  24. >
  25. >-- 
  26. > Mats Fraennhagen     Email: d91mf@efd.lth.se
  27. >
  28.  
  29. Sure does. This info is in the Program Segment Prefix (PSP), which dos loads
  30. as the first 256 bytes of any program. Register ES always points to the 
  31. beginning of the PSP at the start of a program, no matter whether the program
  32. is .COM or .EXE.
  33.  
  34. The start of the command tail (everything following the program name) is at
  35. offset 81hex within the PSP. It ends with a CR. A count of the characters
  36. in the command tail, including the terminating CR, can be found at offset
  37. 80hex within the PSP. Have fun! (C overhead isn't that much!)
  38. -- 
  39. Duane Paulson
  40. ci922@cleveland.freenet.edu
  41. duane.paulson@pcb.batpad.lgb.ca.us
  42.