home *** CD-ROM | disk | FTP | other *** search
- /* putchar() and puts() functions for device driver */
-
- /*
-
- SYNOPSIS
-
- putchar(c);
- puts(s);
-
- int c; character to be sent to screen
- char *s; string to be sent to screen
-
- DESCRIPTION
-
- These functions can be called by a device driver to send output to the screen
- through the ROM BIOS, instead of the standard output. They act very much
- like their standard C counterparts, using \n as a line terminator. However,
- puts() does not automatically put a \n at the end of the string. CAUTION: Do
- not include stdio.h; that would cause the wrong version of putchar() to be
- compiled.
-
- */
-
- #include <dos.h>
-
- void putchar(c) int c; {
- union REGS r;
- if (c=='\n') putchar('\r');
- r.h.ah = 14;
- r.h.al = c;
- r.x.bx = 0;
- int86(0x10, &r, &r);
- }
-
- void puts(s) char *s; {
- while (*s) putchar(*s++);
-
- /*
- for complete compatibility with the standard C function,
- add the command putchar('\n');
- */
-
- }