ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
can both use as write a character to standard output and read character from standard input?how to distinguish them? is it base on the value of DL register? because read from input needs DL to be FFh while write to output needs DL to be the character value that output.is this the only way to distinguish them?
Code:
mov ah,6
mov dl,"A"
int 21
while the other one is
Code:
mov ah,6
mov dl,0FFh
int 21
jz skip
mov char,AL
;AL contains the character’s ASCII code.
thanks very much
Last edited by topheraholic; 06-19-2011 at 07:41 AM.
Click here to see the post LQ members have rated as the most helpful post in this thread.
The "int 21" cluster (as I use to call it) is a collection of sub funtions. Int 21 does pretty much. You address the sub funtions with a code in AH (as you seem to have done) and let that info be a "parameter" for the int 21 function.
Int 21 is pretty much a work horse...
AH = 02 writes to stdout, and AH = 09 reads from the stdin...
DOS functions (to be clear) are accessed throught he software interrupt 21H. All parameter passing is done through registers, with the AH register always containing the function code. Other registers are used according to the requirements of the function. Examples of common uses of registers or register pairs are 'DL' holding single byte data, 'DS:DX' pointing to input buffer, and 'AL' used as the return status of the function call. I haven't done any DOS assembler programming for a couple of decades, but when I did I always had one of my copies of the Programmers's PC Sourcebook by Thom Hogan nearby. In it, he says function 09H is 'Display String'. The definitive online guide to PC real-mode programming has long been Ralf Brown's Interrupt List, and in it you can find the table of Int21H functions.
MS-DOS has a fairly weak concept and implementation of 'stdout' and 'stdin', and I always resist the temptation to use those terms in the context of DOS.
--- rod.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.