mcdonald@uxe.cso.uiuc.edu (05/11/88)
>Has anyone ever written directly to the screen memory with UNIX or >XENIX on a PC? I know that I probably open /dev/mem and start >writing at the ega address space (after probably massaging the >video controller or whatever). The UNIX that I am running is I am also interested in this. It appears that the cheapest way to get access to a 386 operating system and good C compiler is some flavor of Unix. I need, however, to be able to write direct to the screen and use the IO ports on the graphics board to do animation graphics. There should be some way to get a segment selector to point to the graphics memory, but one would also need to get IO access to the IO ports on the graphics card to be able to do anything useful. I looked in a book about the 386, and it is clear that it can be done, but, the question is how. Does any flavor of Unix for the 386 allow graphics access? I know that OS/2 does do so, but only for the 286 mode. Doug McDonald (mcdonald@uxe.cso.uiuc.edu)
erskine@force10.UUCP (Neil Erskine) (05/13/88)
In article <47900007@uxe.cso.uiuc.edu> mcdonald@uxe.cso.uiuc.edu writes: >>Has anyone ever written directly to the screen memory with UNIX or >>XENIX on a PC? I know that I probably open /dev/mem and start >>writing at the ega address space (after probably massaging the >>video controller or whatever). The UNIX that I am running is > >I am also interested in this. It appears that the cheapest way to >get access to a 386 operating system and good C compiler is some flavor >of Unix. I need, however, to be able to write direct to the screen >and use the IO ports on the graphics board to do animation graphics. >There should be some way to get a segment selector to point to the >graphics memory, but one would also need to get IO access to the IO >ports on the graphics card to be able to do anything useful. I looked >in a book about the 386, and it is clear that it can be done, but, >the question is how. Does any flavor of Unix for the 386 allow >graphics access? >Doug McDonald (mcdonald@uxe.cso.uiuc.edu) SCO Xenix Release 2.2 supports this through ioctl calls. The documentation is included in the manual entry SCREEN(HW), which is normally in the 'RUN TIME ENVIRONMENT manual. Here is a stupid program which writes directly to screen memory. Compile with the -Me option. It works on Xenix-286 and Xenix-386. BE WARNED! Don't expect multi-screens to work properly when running programs that use this facility. Although the screen flip works, the program doing direct update is still mapped to do this. Xenix doesn't do anything clever about remapping the segment descriptor to an alternate site when you flip to an alternate screen, so you get two programs writing to the screen at the same time. I have stopped using this facility, finding that watching my buffering of output data gives me reasonable performance. However, MicroGnuEmacs really smoked with it! Neil -------------------------- Cut here ---------------------------------------- #include <stdio.h> #include <fcntl.h> #include <sys/machdep.h> #include <sys/sysmacros.h> main (argc, argv) int argc; char *argv[]; { int adaptor; char *adaptor_dev; char attr; int cmode; int dmode; extern int errno; int fd; int selector; char far *scr; char far *cf; char *c; char ch; int i; initsfu (); sc_move_disp(5,5); sc_refresh_disp(); adaptor = ioctl (1, CONS_CURRENT, 0); switch (adaptor) { case MONO: adaptor_dev = "/dev/mono"; dmode = M_MCA_MODE; break; case CGA: adaptor_dev = "/dev/color"; dmode = M_C80x25; break; case EGA: adaptor_dev = "/dev/ega"; dmode = M_ENH_C80x25; /* break; /* I don't know anything about this guy */ default: printf ("Unsupported adaptor %d\n\r", adaptor); stopsfu (); exit(0); break; } printf ("Using adaptor %s\n\r", adaptor_dev); fd = open (adaptor_dev, O_WRONLY); if (fd < 0) { fprintf (stderr, "Could not access %s, errno = %d\n\r", adaptor_dev, errno); stopsfu (); exit (-1); } cmode = ioctl (fd, CONS_GET, 0); printf ("Current display mode is %d\n\r", cmode); getchar (); selector = ioctl (fd, MAPCONS, 0); scr = sotofar (selector, 0); (void) ioctl (fd, MODESWITCH | dmode, 0); ch = 'A'; attr = 0x0f; while (getchar() != 'F') { for (cf=scr,i=0; i < 80*25; i++) { *cf++ = ch; *cf++ = attr ^= 0x7f; } ch++; } (void) ioctl (fd, MODESWITCH | cmode, 0); stopsfu (); exit (0); } -- Neil S. Erskine MT&T - (902) 453-4915 x340 AP Computers USENET { garfield, watmath, ihnp4!utzoo!utai, 3845 Dutch Village Rd. uunet } !dalcs!force10!erskine Halifax, N.S. B3L-4H9
wtr@moss.ATT.COM (05/13/88)
In article <47900007@uxe.cso.uiuc.edu> mcdonald@uxe.cso.uiuc.edu writes: >>Has anyone ever written directly to the screen memory with UNIX or >>XENIX on a PC? I know that I probably open /dev/mem and start >>writing at the ega address space > >I am also interested in this. It appears that the cheapest way to >get access to a 386 operating system and good C compiler is some flavor >of Unix. I need, however, to be able to write direct to the screen >and use the IO ports on the graphics board to do animation graphics. > >Doug McDonald (mcdonald@uxe.cso.uiuc.edu) First of all, thia article will refer to microport unix. This was the only group where i could find this message and thus am posting this follow-up here. I also think that the concepts expressed here could be usefull in a xenix system, of which I know little specifics about. Now, for the meat ;-) Doug- Microport Unix V/AT (and I believe their 386 V.3 also) has a process called "shmcreate" which you run at bootup. It locks a block of memory as a shared memory resource. By using this on the video memory space, you can allow user programs (at the console) to access the memory space directly as an array in memory. (making life mucho easier for graphics implementations :-) I have a set of graphics primitives that currently run on this machine. (microport V/AT 2.3.0-L) (point, line, bit mapped character set, stroke fonts for scalible characters, boxes) FULL credit for these routines goes to: dave lewis arpa!umix.cc.umich.edu!m-net!dtlewis!lewis I'm currently looking at implementing some other basic primitives such as an elipse, pixel read, and a fast flood fill. If I recall, doesn't Xenix also support a set of graphics routines as part of the SCO release for the 386? That may be the way to go. good luck! ===================================================================== Bill Rankin Bell Labs, Whippany NJ (201) 386-4154 (cornet 232) email address: ...![ ihnp4 ulysses cbosgd allegra ]!moss!wtr ...![ ihnp4 cbosgd akgua watmath ]!clyde!wtr =====================================================================
terry@wsccs.UUCP (Every system needs one) (05/28/88)
In article <47900007@uxe.cso.uiuc.edu> mcdonald@uxe.cso.uiuc.edu writes: >>Has anyone ever written directly to the screen memory with UNIX or >>XENIX on a PC? I know that I probably open /dev/mem and start >>writing at the ega address space Not really. SCO has some calls to do this for you, including mapping the screen memory into your address space. See the "Xenix Runtime Environment" manual with the "(HW)" on it. >I am also interested in this. It appears that the cheapest way to >get access to a 386 operating system and good C compiler is some flavor >of Unix. I need, however, to be able to write direct to the screen >and use the IO ports on the graphics board to do animation graphics. > >Doug McDonald (mcdonald@uxe.cso.uiuc.edu) SCO sells CGI for Xenix. It's a little slower than a roll-your-own, and it has been rumored that CGI stands for "Consistant Graphics Impossible"; I have used this a teeny-tiny-itsy-bitty-bit and have found it to be reliable, with the single drawback that everything is scaled to device units, rather than me being able to give absolute units. I have to open it, ask it what it's units are, close it, and open it and scale it; other than that, it's pretty happy. (I go through those gyrations because I want an inch to be "an-inch-by-GOD!") | Terry Lambert UUCP: ...{ decvax, ihnp4 } ...utah-cs!century!terry | | @ Century Software OR: ...utah-cs!uplherc!sp7040!obie!wsccs!terry | | SLC, Utah | | These opinions are not my companies, but if you find them | | useful, send a $20.00 donation to Brisbane Australia... | | 'Admit it! You're just harrasing me because of the quote in my signature!' |