Int86 function in C

A

Arun

I recently came to know that using int86 function with interrupt number
22 we can identify keystrokes.
I want to know whether this is in any way different from getch()
function.
any help on this is much appreciated.
 
V

Vladimir S. Oka

Arun said:
I recently came to know that using int86 function with interrupt number
22 we can identify keystrokes.
I want to know whether this is in any way different from getch()
function.
any help on this is much appreciated.

[Posting once every minute does not hasten the responses (unless it's
Google playing up again, but it usualy does it thrice).]

Why not look into a standard `getchar()` function, which is guaranteed
to exist on any conforming implementation?

<OT>
It is different in a fundamental way. You stand a fighting chance that
`getch()`, although non-standard will be implemented in the next
incartnation of your compiler/library. Using interrupts locks you
completely to MS DOS platform.
</OT>
 
S

santosh

Arun said:
I recently came to know that using int86 function with interrupt number
22 we can identify keystrokes.
I want to know whether this is in any way different from getch()
function.
any help on this is much appreciated.

There is no 'int86' or getch() function in standard C. The latter
though is a common extension. For the former you probably meant INT 80h
interface to the Linux kernel? In any case, none of it is standard (and
hence portable) C, which is the topic for this newsgroup.
 
S

santosh

Vladimir said:
Arun said:
I recently came to know that using int86 function with interrupt number
22 we can identify keystrokes.
I want to know whether this is in any way different from getch()
function.
any help on this is much appreciated.

[Posting once every minute does not hasten the responses (unless it's
Google playing up again, but it usualy does it thrice).]

Why not look into a standard `getchar()` function, which is guaranteed
to exist on any conforming implementation?

<OT>
It is different in a fundamental way. You stand a fighting chance that
`getch()`, although non-standard will be implemented in the next
incartnation of your compiler/library. Using interrupts locks you
completely to MS DOS platform.
</OT>

<OT>
Software interrupt based interfaces are also present in Linux and
Windows, though in the latter's case, they aren't really usable. It
depends on the Interrupt number. I think the OP means INT 80h for
Linux.
</OT>
 
J

Jack Klein

There is no 'int86' or getch() function in standard C. The latter
though is a common extension. For the former you probably meant INT 80h
interface to the Linux kernel? In any case, none of it is standard (and
hence portable) C, which is the topic for this newsgroup.

Off topic, but no, he probably didn't mean the Linux system call
interrupt.
 
K

Keith Thompson

santosh said:
There is no 'int86' or getch() function in standard C. The latter
though is a common extension. For the former you probably meant INT 80h
interface to the Linux kernel? In any case, none of it is standard (and
hence portable) C, which is the topic for this newsgroup.

Actually, getch() is several common extensions. There's a function by
that name in DOS and/or Windows, and another one in curses/ncurses
(which is mostly Unix-ish).
 
S

santosh

Keith said:
Actually, getch() is several common extensions. There's a function by
that name in DOS and/or Windows, and another one in curses/ncurses
(which is mostly Unix-ish).

Yes, along with getche() and others. That's what I said too. I have no
idea though about 'int86', whatever it may be, and it's differences
from getch(), which is what the OP wants to know.
 
S

santosh

Arun said:
I recently came to know that using int86 function with interrupt number
22 we can identify keystrokes.
I want to know whether this is in any way different from getch()
function.
any help on this is much appreciated.

<OT>
It depends on the implementation. In one system getch() might end up
calling the same code (BIOS?) as int86 with service no. 22 might. In
another system int86() may not even be available while getch() may be.
This is something you should not worry about to write programs.

In fact, sticking to pure ISO standard C is a good way to start out.
Then as your programming skill improves and you need platform specific
functionality, you can learn such specific stuff as the above.

Look up the description for getch() and int86() at the following URL.
If you absolutely need to know their implementation in DJGPP, you can
look up the sources, as it is Free Software.
http://www.delorie.com/djgpp/doc/libc/
</OT>

Finally, in future, please post only standard C related questions to
this group. Post platform specific questions like the above to their
respective groups like comp.os.msdos.djgpp. That way, you're assured of
the most relavent and accurate response.
 
H

hdante

int86() is a standard non-standard way of acessing the DOS and BIOS
API on a PC. It's possible to do things easily in DOS by using them. An
overly complete set of things you can do in such architectures is in
the Ralf Brown Interrupt list:

http://www.ctyme.com/rbrown.htm

There it says int 0x16 (22) is keyboard utilities.

Remember: use int86 and you'll be locked in that awful operating
system, FOREVER !!!
Hint: there's a curses version for DOS. It has getch() and much more !
http://pdcurses.sourceforge.net/
Hint 2: If you'd like to code more easily and faster, use a high level
language, with many built-in features, like Python or Ruby.

Henrique Dante de Almeida
 
S

santosh

int86() is a standard non-standard way of acessing the DOS and BIOS
API on a PC.
<rest snipped>

Thanks for the info, but can we end this highly off-topic thread now?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,156
Messages
2,570,878
Members
47,408
Latest member
AlenaRay88

Latest Threads

Top