INT 2fH 4810H: Get Keyboard Input with Doskey Editing
Expects: AX 4810H
DS:DX address of special-format 128-byte buffer to hold input
Returns: AX status: 00H =success and...
DS:DX buffer contains input text or
DS:DX[+1] contains 00H (means macro name was
used; call again to expand the macro)
else =unsuccessful (bad input parms)
Info: This fn performs two services:
■ Gets up to 126 bytes of text input from the keyboard (it can
edit an existing line of text, too).
It recognizes and handles all of the Doskey editing keys,
including arrow keys, F8 to search the history list, etc.
■ Expands a Doskey macro to process parameters such as $1, or $*,
DS:DX On entry, this points to a buffer formatted as a DkLineRec:
Offset Size Contents
▀▀▀▀▀▀ ▀▀▀▀ ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
+0 1 bBufMax must be 80H
+1 1 bTextLen size of input text less the CR at end
+2 126 abText area to hold input text
128 size of a DkLineRec structure
The bBufMax field must contain 80H. The bTextLen must be the
length of the current line of text (use 00H to input new text).
db 80H,00H, 126 dup (0)
On return, bTextLen will contain the length of the input, not
including a CR (ASCII 0dH) which is appended to the end. And
abText will contain the characters of the input text.
If, the user started the line with the name of a Doskey macro.
then this fn set bTextLen to 00h. In that case, you should
immediately call this fn again to obtain the expanded text of the
macro. In that case, this fn displays the expanded text and
places its size in bTextLen and the text itself in abText.
Notes: ■ Doskey does not initially display abText. When using this fn
to edit an existing line of text (i.e., when bTextLen is non-
zero on entry), you may want to use DOS fn 09H or 40H to
display the text before calling.
■ There appears to be no way to differentiate between the case
where the user typed Enter only and the case where the user
typed a macro name.
■ All Doskey keystrokes are supported, including those that
handle command-line history (such as up arrow to see
previously-typed commands). When the user inputs text, that
line is added to the command-line history. If you expect to
process macros, you must always call this fn again when the
bTextLen comes back containing 00H.
■ Be sure to use INT 2fH 4800H to verify that Doskey is loaded
before using this fn.
See Also: INT 2fH 48xxH (Doskey Functions)
INT 2fH: Multiplex Interrupt