bob@cald80.UUCP (bob) (05/12/87)
[ eat bits, Line Eater! ] I am running SCO Xenix 2.2 on a Kaypro 286i w/Everex EGA board and a NEC 40 Mbyte disk. I have programmed EGA boards before on PCs and clones under Mush-dos and now am tasked to get some decent graphics libraries built for the new system (I know that there are probably commercially available ones around but the company finds it easier to spend labor $ rather than purchase anything :-)). First, following the programming example in the HW manual is virtually useless. For some reason the compiler blows up violently on 'char far *gp;' (yes I'm using -Me). Mind you, I am proficient in C on UNIX and have never had to deal with segments (yech) before. So I told it to use the large memory model and recoded the 'sotofar' macro in my code to convert the selector (segment number?) to a char pointer. The system now lets me write to graphics memory and I can do all sorts of neat things like setpixel and readpixel...in white. Next problem: to change colors, you have to be able to set the registers on the EGA card. I built my 'port_io_args' structure like it says in the manual, put 0x3C4 in the first port and 0x02 as the data (set the index to 2) and 0x3C5 in the second port with a color as the data. I put the constant 'OUT_ON_PORT' in both dir vars. I did 'ioctl(gtout, EGAIO, gports)' (gtout is the file descriptor for the EGA and gports is my structure) and SHAZAM, presto-chango, white again. Hmmm... sounds fishy to me so I checked the return value from the 'ioctl' and sure enough -- ERR (-1). 'errno' is 14 which says that I gave it a bad address. This is one of those problems that could ruin your whole day. As I said, I'm pretty decent at C on UNIX and I know a thing or three about PCs but this is frustrating. To top it all off, there's a small but crucial part missing out of the code segment in the manual (called SCO and guess what? It's missing from their In-House version too!). Am I missing something fundamental here? Does the 'ioctl' want the real hardware port or some offset number from a base? Is the 'EGAIO' command bogus? Why didn't SCO/Microsoft finish the support of the device instead of providing pieces parts of fragments of things that might work if you add a pinch of this and a touch of that? Why doesn't the 'far' keyword work in the small memory model? Please mail responses to me 'cuz I'm going out of town for a few days and our news system expires anything more than 2 days old (we don't have a lot of disk you see :-(). Post them too if you think there's sufficient interest. Mucho Gracias.... -- Bob Meyer Calspan ATC seismo!kitty!sunybcs!cald80!bob decvax!sunybcs!cald80!bob