'=========================================================================== ' Subject: PRINT GRAPHICS ON DOT MATRIX Date: 11-08-98 (18:49) ' Author: ATyler85@aol.com Code: QB, PDS ' Origin: ATyler85@aol.com Packet: MISC.ABC '=========================================================================== ' This program prints 320 by 200 graphic images on a regular Dot Matrix printer. DECLARE SUB EPRINT (widths!, lines!) DECLARE FUNCTION getbit! (y!, x!) DECLARE SUB pstring (s$) DECLARE SUB pchar (c!) '$INCLUDE: 'c:\qb\qb.bi' DIM SHARED InRegs AS RegType, OutRegs AS RegType ' sub uses picture, widths,lines DIM SHARED bits(1 TO 10) SCREEN 13 ' Image here(black and white, only) CIRCLE (50, 50), 50 EPRINT 200, 320 SUB EPRINT (lines, widths) width$ = HEX$(widths) IF LEN(width$) = 0 THEN END IF LEN(width$) = 1 THEN width$ = "000" + width$ IF LEN(width$) = 2 THEN width$ = "00" + width$ IF LEN(width$) = 3 THEN width$ = "0" + width$ pstring CHR$(27) + "@" FOR i = 0 TO lines STEP 8 pstring CHR$(&H1B) + "*" + CHR$(6) pchar VAL("&H" + RIGHT$(width$, 2)) pchar VAL("&H" + LEFT$(width$, 2)) FOR j = 0 TO widths a = getbit(i, j) pchar a a = 0 NEXT j pstring CHR$(13) + CHR$(27) + "J" + CHR$(18) NEXT i pstring CHR$(27) + "@" END SUB FUNCTION getbit (y, x) IF y + 8 > 199 THEN END FOR i = y + 8 TO y STEP -1 j = j + 1 IF POINT(x, i) = 0 THEN bits(j) = 0 ELSE bits(j) = 1 END IF NEXT i jay = (bits(1) * 1) + (bits(2) * 2) + (bits(3) * 4) + (bits(4) * 8) jay = jay + (bits(5) * 16) + (bits(6) * 32) + (bits(7) * 64) + (bits(8) * 128) getbit = jay END FUNCTION SUB pchar (c) ' Wait for printer to receive character DO InRegs.ax = &H200 InRegs.dx = 0 CALL INTERRUPT(&H17, InRegs, OutRegs) LOOP WHILE ((OutRegs.ax AND &HFF) AND &H80) = 1 ' Print character InRegs.ax = c InRegs.dx = 0 CALL INTERRUPT(&H17, InRegs, OutRegs) END SUB SUB pstring (s$) FOR i = 1 TO LEN(s$) B = ASC(MID$(s$, i, 2)) pchar B NEXT i END SUB