#include <conio.h>
#include <dos.h>
int currentPage = 0;
void Init256()
{
union REGS r;
r.x.ax = 0x4F02;
r.x.bx = 0x101;
int86(0x10,&r,&r);
}
void Close256()
{
union REGS r;
r.x.ax = 0x03;
int86(0x10,&r,&r);
}
void SelectPage(int page)
{
union REGS r;
r.x.ax = 0x4F05;
r.x.bx = 0;
r.x.dx = page;
int86(0x10,&r,&r);
}
void SetPixel(long x, long y, int color)
{
long pos = (y<<9) + (y<<7) + x;
int page = pos>>16;
long offset = pos - (page<<16);
if (page != currentPage)
{
SelectPage(page);
currentPage = page;
}
*((char far *)(0xA0000000L+offset)) = color;
}
void main()
{
int i, j;
Init256();
for (i=0;i<480;i++)
for (j=0;j<640;j++)
SetPixel(j,i,i);
getch();
Close256();
}
[此贴子已经被作者于2006-6-18 12:42:03编辑过]