Direct output
Andrew Davenport
gandalf at valnet.UUCP
Thu Mar 14 04:52:57 AEST 1991
I am writing a program on an IBM AT compatible computer, and I want to
use direct input/output. I wrote the following function, but it doesn't
work. Can anyone give me a pointer as to why not?
--------------------------------- Cut Here ----------------------------------
int far *screen = (int far *)0xB8000000;
void dir_scr_write(int x, int y, char *str, char fore, char back)
{
int c=0, temp=0, string[80];
unsigned int attr=0;
int far *tmp = screen;
temp = strlen(str);
attr = (((((int)back & 0x0f) << 4) | ((int)fore & 0x0f)) & 0x00ff);
for(c = 0; c <= temp; c++)
{
string[c] = (int)str[c];
string[c] <<= 8;
string[c] &= attr;
}
tmp += (y * 80) + x;
memcpy(tmp, string, (temp * 2));
}
--------------------------------- Cut Here ----------------------------------
Also, I want to read/write the cursor position directly...how might that be
done?
Please help!!!
Thanks in advance, and please e-mail responses to gandalf at valnet.UUCP, I'll be
happy to post a summary of replys if there's any interest...
Gandalf (a.k.a. Andrew Davenport)
More information about the Comp.lang.c
mailing list