Date: Thu, 28 Sep 1995 15:54:48 +0200 (IST) From: Eli Zaretskii To: "A.Appleyard" Cc: DJGPP AT SUN DOT SOE DOT CLARKSON DOT EDU Subject: Re: How to get command-line args? On Tue, 26 Sep 1995, A.Appleyard wrote: > If I write a program QAZAQ.EXE or QAZAQ.COM in machine code (assembler), if > I call it with arguments from the DOS prompt e.g. by typing > QAZAQ 123 \MYFILE.TXT "the cat caught the mouse" 1.65e-34 > how can the program QAZAQ read these call arguments? Call Interrupt 21h, function 51h or 62h (both do the same). They'll return the PSP segment in BX register (the offset is always zero). At offset 80h in that segment you'll find a single byte which gives you the length of the command-line tail (after the program name was stripped). Starting at offset 81h, you'll find N characters of the command-line tail, where N is given by the length byte. You will have to parse the arguments yourself; in particular, quoted arguments aren't different from unquoted ones, and the command line ends with a CR.