[ Usenet FAQs | Web FAQs | Documents | RFC Index ]
    Search the FAQ Archives

Part1 - Part2 - Part3 - Single Page

Top Document: x86 Assembly Language FAQ - General Part 3/3
Previous Document: 32. Pseudo Random Number Generator in Assembly Language
Next Document: 34. Free 32 bit and DJGPP Assemblers


33. Command Line Arguments


33.1  WHERE IS THE COMMAND LINE

DOS loads the command line into the PSP.  The length of the command line
is stored in a byte at offset 80h.  The command line is stored in the
next 127 bytes starting at 81h.  As, generally, there is a space between
the filename and the start of the command line argument; a space usually
is the first character in this string.  The string is terminated with a
carriage return character, 0dh.

At startup for both .COM and .EXE format programs, DS and ES point to
the PSP.

33.2  HOW TO ACCESS THE COMMAND LINE ARGUMENTS

See Subject #8, How to Redirect STDERR to a File.  I have written a
demonstration program that contains assembly language startup code that
parses the command line arguments onto the stack and provides them as
argc and *argv[] to the main procedure.  Anyone interested in accessing
command line arguments should look at this code.

Contributor:  Raymond Moon, raymoon@moonware.dgsys.com
Last changed: 15 Jun 96



Top Document: x86 Assembly Language FAQ - General Part 3/3
Previous Document: 32. Pseudo Random Number Generator in Assembly Language
Next Document: 34. Free 32 bit and DJGPP Assemblers

Part1 - Part2 - Part3 - Single Page


[ Usenet FAQs | Web FAQs | Documents | RFC Index ]

Send corrections/additions to the FAQ Maintainer:
raymoon@moonware.dgsys.com

Last Update October 22 2009 @ 05:22 AM

Some parts © 2009 Advameg, Inc.