[comp.sys.ibm.pc] VGA routines

dorn@fabscal.UUCP (Alan Dorn Hetzel) (10/10/88)

I am looking for routines useable under DOS and/or XENIX on a 80386
based system to do the following:

   1) switch my VGA from text to 320x200x256color mode

   2) write information to the graphics screen either pixel at a time
      or in blocks.

   3) switch  the screen back to 80x24 text mode.

Any suggestions>?

 p.s. assembly or C would be preferable, but whatever else would be
      fine too.

  Dorn

  gatech.edu!fabscal!dorn

mcdonald@uxe.cso.uiuc.edu (10/10/88)

>I am looking for routines useable under DOS and/or XENIX on a 80386
>based system to do the following:

>   1) switch my VGA from text to 320x200x256color mode

>   2) write information to the graphics screen either pixel at a time
>      or in blocks.

>   3) switch  the screen back to 80x24 text mode.
For DOS this is truly trivial. The display is bitmapped, one unsigned
char per pixel, starting at 0xa0000000 (that is a000:0000).
The following program fills the screen with the first 200 default colors.
#include <dos.h>
#include <conio.h>
#include <stdio.h>

main(){
union REGS rg;
unsigned char far *screenptr;
int i,j;

    rg.x.ax = 19;
    int86(16,&rg,&rg);

    screenptr = (unsigned char far *)(0xa0000000l);

    for (i = 0; i < 200; i++)
        for(j = 0; j < 320; j++)*screenptr++ = i;

    while(!kbhit);
    (void)getchar();
    rg.x.ax = 3;
    int86(16,&rg,&rg);
}
The translation to assembly is obvious.

Xenix is of course another thing ENTIRELY. I'll bet it isn't so easy.


Doug McDonald (mcdonald@uiucuxe)

kory@avatar.UUCP (Kory Hamzeh) (10/12/88)

In article <490@fabscal.UUCP>, dorn@fabscal.UUCP (Alan Dorn Hetzel) writes:
> I am looking for routines useable under DOS and/or XENIX on a 80386
> based system to do the following:
> 
>    1) switch my VGA from text to 320x200x256color mode
>    2) write information to the graphics screen either pixel at a time
>       or in blocks.
>    3) switch  the screen back to 80x24 text mode.
> 


Look at the screens section in the HW (hardware reference) section in the
xenix manuals. There are provisions to set different video modes and map
the vga memory into your address space. There are also ways of doing
port input/output. All of this is accomplished by opening the screen
devices (/dev/ttyxx) and doing a series of ioctl() calls.

However, as far as I know, none of the VGA modes were supported in
any of the xenix releases prior to 2.3.


-- 
-------------------------------------------------------------------------------
Kory Hamzeh			    UUCP:     ..!uunet!psivax!quad1!avatar!kory
				    INTERNET: avatar!kory@quad.com