home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DP Tool Club 26
/
CD_ASCQ_26_1295.iso
/
vrac
/
user_int.zip
/
QPRINTF.CPP
< prev
next >
Wrap
C/C++ Source or Header
|
1995-08-07
|
953b
|
42 lines
#include <dos.h>
#include <stdarg.h>
#include <stdio.h>
unsigned int _vidseg;
void qp_init(void)
{
const long vidmode = 0x00449lu; // video mode address //
if (*((char far*) vidmode) == 7) // if video mode is 7 //
_vidseg = 0xb000u; // then monochrome //
else
_vidseg = 0xb800u; // else, color //
}
void qputch(int col, int row, int attr, char ch)
{
register int vidofs;
pokeb(_vidseg, vidofs = 160*row+2*col-162, ch); // poke the char //
pokeb(_vidseg, ++vidofs, attr); // poke the attr //
}
void qprintf(int col, int row, int attr, char *str, ...)
{
register int i, x;
int vidofs;
char vstr[90];
va_list vl;
va_start(vl,str); // get the arguments //
vsprintf(vstr,str,vl);
va_end(vl);
for (i = 0, x = col; vstr[i]; i++, x++)
{
pokeb(_vidseg, vidofs = 160*row+2*x-162, vstr[i]); // poke the char //
pokeb(_vidseg, ++vidofs, attr); // poke the attr //
}
}