Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!dimacs.rutgers.edu!seismo!ukma!rex!samsung!caen!news.cs.indiana.edu!valnet!gandalf From: gandalf@valnet.UUCP (Andrew Davenport) Newsgroups: comp.lang.c Subject: Direct output Message-ID: Date: 13 Mar 91 18:52:57 GMT Organization: Valley BBS Network Lines: 38 Disclaimer: Author responsible for contents 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@valnet.UUCP, I'll be happy to post a summary of replys if there's any interest... Gandalf (a.k.a. Andrew Davenport)