delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/02/09/21:57:51

From: Shawn Hargreaves <Shawn AT talula DOT demon DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: VBE 2.0 Pmode Bank Switching...
Date: Sun, 9 Feb 1997 21:10:04 +0000
Organization: None
Distribution: world
Message-ID: <o9ZZ4BAs0j$yEw+O@talula.demon.co.uk>
References: <Pine DOT SUN DOT 3 DOT 95 DOT 970208215834 DOT 13653A-100000 AT linknet DOT kitsap DOT lib DOT wa DOT us>
NNTP-Posting-Host: talula.demon.co.uk
MIME-Version: 1.0
Lines: 38
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

KaRNaGE writes:
>ok...i'm trying to get VBE 2.0 Bank Switching to work, but for some reason
>it's not switching banks...i got the code from a FAQ..here is how i'm
>using it...
[snip]
>  pm_bank = (void *)((char *)pm_info + pm_info->setWindow);
[snip]
>pm_bank(0);

Oy! You can't do that! :-)

This function doesn't use the normal C calling convention, so you need
to call it in a special way. You should put the window number (usually
0, but it depends on the card) in %bx, the bank number in %dx, and then
call it. This means you have to do it from asm...

Also, some cards use memory-mapped IO, in which case you have to create
a pmode selector for accessing the required addresses, and put it in %es
before calling the switch routine. You can determine if this is the case
by looking at the IOPrivInfo field in the PM_INFO structure.

>  regs.x.ax = 0x4F05;
>  regs.x.bx = 0;
>  regs.x.dx = bank << 4; /* bank * 16 */
>  __dpmi_int(0x10, &regs);

That won't work on most cards (and is probably why your stuff doesn't
work with UniVBE loaded). The Cirrus uses 16k banks, hence the multiply
by 16, but these days 99% of cards have 64k banks. And there are even
worse things out there just waiting to trip you up, like 16k banks and
128k memory apertures from 0xA0000 to 0xC0000. For a reliable program,
you need to examine the VESA window information structures to get all
these params right...

/*
 *  Shawn Hargreaves - shawn AT talula DOT demon DOT co DOT uk - http://www.talula.demon.co.uk/
 *  Ghoti: 'gh' as in 'enough', 'o' as in 'women', and 'ti' as in 'nation'.
 */

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019