Interrupt 2Fh Function 4810h Read Command Line

mov dx, seg Line

mov ds, dx

mov dx, offset Line ;ds:dx points to buffer to receive input

mov ax, 4810h ;Read Command Line

int 2Fh ;Multiplex Interrupt

Read Command Line (Interrupt 2Fh Function 4810h) reads a line of up to 126 characters and copies it to the specified buffer. While the line is being read, all Doskey function keys and macros are enabled. This means, for example, that the user can select a line from the Doskey history, edit a line, or enter macros that are automatically expanded.

Parameter

Line

Points to a buffer that receives the command line. The buffer must have the following form:

Offset Contents

00h The maximum size of the buffer. It must be 128 bytes.
01h A number that is one less than the number of characters read. The function copies a carriage-return character (ASCII 0Dh) to the buffer but does not include the byte in its total.
02h The first byte of the input line.

Return Value

If the function is successful, the AX register contains zero and the input line is copied, along with the number of bytes in the line, to the buffer pointed to by the Line parameter.

If the user types a macro name, AX contains zero, but no text is copied to the buffer. Instead, the program must immediately call the function a second time to expand the macro and copy the macro text to the buffer.

Comments

This function adds the command line to the Doskey history. If the user types a macro name or a special parameter (such as $*), the program must call the function a second time to expand the macro or parameter. On the second call, the function automatically writes the expanded macro to the screen, overwriting the macro name. It also copies the expanded macro text to the buffer.