Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Borland C++ 2.x ( with Turbo C ) - <b>biosprint() printer i/o</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 biosprint()             Printer I/O

 include    <bios.h>

 int        biosprint(cmd,byte,port);
 int        cmd;                         Operation to perform
 int        byte;                        Byte value
 int        port;                        Port

    Using BIOS interrupt 0x17, biosprint() performs a printer function
    specified by 'cmd' on the printer specified by 'port', where 0 =
    LPT1, 1 = LPT2, and so on.

    'cmd' can be one of the following:

                0   Print the character whose value (0 to 255) is
                    specified in 'byte'
                1   Initialize 'port'
                2   Read printer status

       Returns:     The current printer status, which is derived  by
                    ORing the following bit values:

                    0x01 Device time out
                    0x08 I/0 error
                    0x10 Selected
                    0x20 Out of paper
                    0x40 Acknowledge
                    0x80 Not busy

                A returned value of 0x01 (device time out) indicates an
                output error if 'cmd' is set to 0 (print a character).

   Portability:     IBM PC and compatibles only.

   -------------------------------- Example ---------------------------------

           #include <stdio.h>              /* for printf */
           #include <bios.h>               /* for biosprint */
           #define PORT_LPT1 0

           int pstring(char *s)    /* returns 0 if successful, 1 if not */
           {
               while (*s)
                   if (biosprint(0,*s++,PORT_LPT1) & 1)
                       return(1);
               return(0);
           }


           main()
           {
               int x;

               biosprint(1,0,PORT_LPT1);
               if ((x = pstring("Hello world")) != 0)
                   printf("Error printing string\n");
               else
                  printf("string sent to printer\n");
           }





Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson