[comp.graphics] EGA Pages: What Am I doing wrong??

NU113738@NDSUVM1.BITNET (08/05/89)

Ok, maybe I'm doing something stupid that I don't recognize, maybe someone
can tell me what.

I've been messing around with some code to work with the EGA/VGA
multiple pages.  I wrote 2 routines that look simple but aren't working
in the least.

Routine 1:
void set_display_page(int page){
  union REGS regs;

  regs.h.ah=0x05;
  regs.h.al=page;
  int86(0x10,&regs,&regs);
}
Simple enough, just int 10H to call Set Active Display Page.

Routine 2:
void set_write_ofs(int page){
#define PEEK_WORD(seg,ofs) (*(int far *) ((long)(seg) << 16 | (ofs)))

  gr_page_ofs=(char far *)(0xA00000000L);
/* gr_page_ofs pointer to tell my line routine where to go. */
  while (page){
    gr_page_ofs+=PEEK_WORD(0x40,0x4C);
    page--;
  }
}

The PEEK_WORD define is straight out of MS DOS BIBLE by the Waite Group
and 0x40,0x4C is supposed to contain the page length of the current mode.

Problem:  In  640x200 16 color (0x0E), The write function correctly
defines where to write to which page.  But, the set_display_page function,
correctly shows page 0, but if called with set_dp(1) (page 1), it
displays the memory somewhat a page 1/2 would be like.  Half of both
pages show up.  If you call Page 2 with the display function, then
page 1 correctly shows up.

Now, in 640x350 mode, Page 0 is again correct, but trying to show
page 1 again gives a half page type output.  But, if you try to call
Page 2, (which isn't supposed to exist), it still stays in the half
page output.

Question:  Am I doing something extremely stupid that only I can't see..
or is this p.o.s. clone got a weirdo VGA board?  Anyhelp would
be appreciated.  If you've got a better method to direct the write and
display of pages I'd love to see it.

Also, if anyone has a good, fast, efficient algorithm or Assembly implementatio
n of a Page to Page copy function, I'd really like to get my hands on one.
The One I implemented is dogged...



Jeff Bakke
NU113738@NDSUVM1.BITNET

I appreciate any help whatsoever....

Thanx.