'=========================================================================== ' Subject: BACKGROUND COLOR PRINTING Date: Unknown Date ' Author: Unknown Author(s) Code: QB, PDS ' Origin: PC Magazine Packet: GRAPHICS.ABC '=========================================================================== 'I put this together from a short article in PC-Mag: by using the 'ColorPrint subroutine, I can display text against various coloured 'backgrounds in screen modes 9 and 12. It does NOT work in screen mode '1. In the CALL below, the CSRLIN and POS(0) are the location at which 'you want to print, and the 14 and 5 are the foreground and background 'colours. NOTE: I have this coded for PDS 7.1; in QB4.5, replace SSEG by 'VARSEG. CALL ColorPrint(" Status Bar ", CSRLIN, POS(0), 14, 5) SUB ColorPrint (TEXT$, ROW%, COL%, FC%, BC%) STATIC REM Prints TEXT$ in EGA or VGA graphics mode with both Foreground and ' Background colours specified. Doesn't work in graphics CGA modes. ' Achieves result by XORing text with a solid string of CHR$(219). DIM INReg AS REGTypeX, OUTReg AS REGTypeX C$ = STRING$(LEN(TEXT$), 219) ' String of solid chars for backgrnd INReg.AX = &H1300 ' Video service 13h, subfunction 0 INReg.BX = BC% ' Background colour INReg.CX = LEN(TEXT$) ' String length INReg.DX = 256 * (ROW% - 1) + (COL% - 1) ' Text pos. in "origin 0" INReg.ES = SSEG(C$) ' String's segment INReg.BP = SADD(C$) ' String's address CALL InterruptX(&H10, INReg, OUTReg) ' Output the background INReg.BX = (FC% XOR BC%) + &H80 ' BL=ForeColor; BH=&H80 uses XOR to draw INReg.ES = SSEG(TEXT$) INReg.BP = SADD(TEXT$) CALL InterruptX(&H10, INReg, OUTReg) ' Output the text, XORing w/backgrnd END SUB