Mail Archives: djgpp/1998/06/23/16:06:18
Hi Owen, yes, they are right, read the manual.
But, I didn't found the answers as fast as I wished
when I wrote myself my graphic code(I had for one example,
an old faq...)
Use this to set the mode and the bank:
(uses include <dpmi.h> I think)
int set_bank(int bank)
{
__dpmi_regs reg;
if(bank!=active_bank)
{
reg.h.ah=0x4f;
reg.h.al=0x05;
reg.h.bh=0x00;
reg.h.dl=bank;
reg.h.dh=0;
__dpmi_int(0x10,®);
active_bank=bank;
}
return(0);
}
int setmode(short mode)
{
int ret;
__dpmi_regs reg;
__dpmi_meminfo mi;
int vesa_err;
reg.x.ax=0x4f02;
reg.x.bx=mode;
__dpmi_int(0x10,®);
ret=reg.x.ax;
if(mode=0x111)
{
reg.x.ax=0x4f06;
reg.h.bl=0x00; /* Set scan line length */
reg.x.cx=640; /* desired width in pixels */
__dpmi_int(0x10, ®);
ret=reg.x.cx; /* nr of pixels/scanline */
}
return(ret);
}
And here is a codesnippet (uncomplete, but you might be able
to figure out how you can access the A0000+64kb area):
void plot16(int x,int y,unsigned int col)
{
int b;
int offset=plot16_y[y]+x<<1;
b=offset>>16;
offset=(offset&0x0000FFFF)+0xA0000;
if((x>=0)&&(x<640)&&(y>=0)&&(y<480))
{
if(b!=active_bank)
set_bank(b);
_farpokew(_dos_ds,offset,col);
}
}
It's taken out of my home made graphic package and uses a
lookuptable and a 16bit 640x480 res, but don't bother about
that, look at the _farpoke thing, it "pokes" at absolute
dos adresses(Watch out, there are better ways=more secure ways,
when debugging, check that 'offset' always are between A0000 and
AFFFF, the VGA window, and all should work fine).
Hope it helps.
Ludvig Larsson
- Raw text -