home *** CD-ROM | disk | FTP | other *** search
- struct intregs{
- unsigned ds; /* data segment register */
- unsigned es; /* extra segment */
- unsigned si; /* source index */
- unsigned di; /* destination index */
- unsigned ah; /* high byte of ax register */
- unsigned al; /* low byte of ax register */
- unsigned bh; /* set up other general registers as his and lows */
- unsigned bl;
- unsigned ch;
- unsigned cl;
- unsigned dh;
- unsigned dl;
- };
-
- doschar(charac) /* print a character to the line printer */
- /* goes to the standard printing device */
- char charac; /* the character to be printed */
- {
- extern unsigned filhandl;
- extern int plot_port; /* comm port for the plotter */
- extern int p_filesw;
- struct intregs regs; /* registers for gdosint */
- int ret_code; /* return code for gdosint */
- unsigned actual;
- extern int hpgl_on;
- int i;
-
- if (p_filesw == 1){
- i = writefil(filhandl,1,&charac,&actual);
- return(i);
- }
- if (hpgl_on){
- asysend(plot_port,charac); /* use asysend to go thru Int 14h */
- return(0);
- }
- else{
-
- /* use interrupt 17H for ROM BIOS printer controller services */
-
- regs.dh=0;
- regs.dl= 0; /* default is 0 - for LPT1 */
- /* may be changed to 1 - LPT2 | 2 - LPT3 */
- regs.es=regs.ds=0; /* default value - no changes to register */
- regs.ah=0; /* initialize to 0 */
- regs.al = charac; /* put the character in the al register */
- gdosint(0x17,®s,®s);
- return(0);
-
- /* we do not check for printer errors, but for a given printer you */
- /* may be using the return code errors are in the AH register and */
- /* each bit of the byte is as follows : */
- /* return(regs.ah) */
- /* bit 7 - printer not busy */
- /* bit 6 - acknowledge */
- /* bit 5 - out of paper */
- /* bit 4 - printer selected */
- /* bit 3 - I/O error */
- /* bit 2 - unused */
- /* bit 1 - unused */
-
- }
- }
-