Board index » delphi » VESA BankSwitching under DPMI

VESA BankSwitching under DPMI

Hi !
I had tried to program some VESA BankSwitching with the function $4F05 on
interrupt $10. Now it was me to slow and I coded it with the far call, whose
address I got from the function $4F01.
And it works. But under DPMI there is always a General protection fault. Of
course I got a Selector for the Segment.
Can anybody help me ?

Christopher.Ska...@gmx.net

 

Re:VESA BankSwitching under DPMI


Quote
Christopher Skanda wrote:
> Hi !
> I had tried to program some VESA BankSwitching with the function $4F05 on
> interrupt $10. Now it was me to slow and I coded it with the far call, whose
> address I got from the function $4F01.
> And it works. But under DPMI there is always a General protection fault. Of
> course I got a Selector for the Segment.
> Can anybody help me ?

Yes, I recently posted to borland.public.turbopascal a full program which
demonstrates how to do this.  To summarize, you can't call the interrupt
directly, you have to call via the DPMI server (int 31h), and also allocate
memory below 1MB.  If you can't turn it up on your server, or DejaNews, drop a
line and I'll e-mail you a copy (258 lines).  

Quote
> Christopher.Ska...@gmx.net

--
Scott Earnest            | SPAM protection in effect. Remove  |
setech@_ix.netcom.com    | "_" as needed for true addresses.  |
earnests@_homenet.lm.com |    UIN:1136443  EFnet:pale_blue    |
sinykal@_{*word*104}space.org  | URL: http://www.netcom.com/~setech |

Re:VESA BankSwitching under DPMI


Scott Earnest schrieb in Nachricht <354D2DAA.F02C412B@_ix.netcom.com>...

Quote
>Christopher Skanda wrote:
>> .......

>Yes, I recently posted to borland.public.turbopascal a full program which
>demonstrates how to do this.  To summarize, you can't call the interrupt
>directly, you have to call via the DPMI server (int 31h), and also allocate
>memory below 1MB.  If you can't turn it up on your server, or DejaNews,
drop a
>line and I'll e-mail you a copy (258 lines).

>> Christopher.Ska...@gmx.net

>--
>Scott Earnest            | SPAM protection in effect. Remove  |
>setech@_ix.netcom.com    | "_" as needed for true addresses.  |
>earnests@_homenet.lm.com |    UIN:1136443  EFnet:pale_blue    |
>sinykal@_{*word*104}space.org  | URL: http://www.netcom.com/~setech |

Oh please send me the source. You're right, T-Online doesn't allow me to get
news from this server.
What about your Email-Address, I can't send a message to you.
Thanks.
Christopher.Ska...@gmx.net

Re:VESA BankSwitching under DPMI


In article: <6icesl$pr...@news02.btx.dtag.de>  Skan...@t-online.de (Christopher

Quote
Skanda) writes:

>Hi !
>I had tried to program some VESA BankSwitching with the function $4F05 on
>interrupt $10. Now it was me to slow and I coded it with the far call, whose
>address I got from the function $4F01.
>And it works. But under DPMI there is always a General protection fault. Of
>course I got a Selector for the Segment.
>Can anybody help me ?

It is possible to call the function from protected mode directly on most (but
not all) VBE implementations, so if you want to do it this way you must setup
temporary exception handlers, then "exercise" the function to see if a GPF
occurs. If not then you're ok, otherwise your code will have to fallback to
using a DPMI function to call the bank switching.

Btw, you did set up a CODE selector and not a DATA selector didn't you?

-- Jay

 -----------------------------------------
| Jason Burgon - author of Graphic Vision |
| g...@jayman.demon.co.uk                   |
| http://www.jayman.demon.co.uk           |
 -----------------------------------------

Re:VESA BankSwitching under DPMI


In article <354D2DAA.F02C412B@_ix.netcom.com>,
Scott Earnest  <setech@_ix.netcom.com> wrote:

Quote
>Christopher Skanda wrote:

>> Hi !
>> I had tried to program some VESA BankSwitching with the function $4F05 on
>> interrupt $10. Now it was me to slow and I coded it with the far call, whose
>> address I got from the function $4F01.
>> And it works. But under DPMI there is always a General protection fault. Of
>> course I got a Selector for the Segment.
>> Can anybody help me ?

>Yes, I recently posted to borland.public.turbopascal a full program which
>demonstrates how to do this.  To summarize, you can't call the interrupt
>directly, you have to call via the DPMI server (int 31h), and also allocate
>memory below 1MB.  

Er, this isn't true.  You can set up a code segment at the
address of the direct bankswitching call.  The code goes something
like:

uses winapi;
type dword=record LoWord, HiWord:word end;
var VesaSelector,CodeSelector:word;
    SwitchBank:procedure;
...
CodeSelector:=0;
VesaSelector:=0;
{obviously ModeRec is the mode information returned by $4f01}
SetSelectorBase(VESASelector,longint(dword(ModeRec^.BankSwitch).HiWord)*16);
SetSelectorLimit(VESASelector,65535);
CodeSelector:=AllocDStoCSAlias(VesaSelector);
@SwitchBank:=ptr(CodeSelector,Dword(ModeRec^.BankSwitch).LoWord);

Switchbank is now the direct bankswitching call.  Note that this
doesn't work under SciTech's Display Doctor drivers because
they actually write the bank value to the code segment which
is a no-no in protected mode.  I have code that checks to see if their
driver is installed but isn't very useful to print here since it will
be out of context.  Email me if you want it.

Quote
>> Christopher.Ska...@gmx.net
>Scott Earnest  

--Mark Iuzzolino
one of the monst...@monstersoft.com  |  "Who do you want to kill today?"
http://www.monstersoft.com

Re:VESA BankSwitching under DPMI


Quote
Mark Iuzzolino wrote:
> In article <354D2DAA.F02C412B@_ix.netcom.com>,
> Scott Earnest  <setech@_ix.netcom.com> wrote:
> >Christopher Skanda wrote:

> >> Hi !
> >> [...]
> >> interrupt $10. Now it was me to slow and I coded it with the far call, whose
> >> address I got from the function $4F01.
> >Yes, I recently posted to borland.public.turbopascal a full program which
> >demonstrates how to do this.  To summarize, you can't call the interrupt
> >directly, you have to call via the DPMI server (int 31h), and also allocate
> >memory below 1MB.

> Er, this isn't true.  You can set up a code segment at the
> address of the direct bankswitching call.  The code goes something
> like:

As it turns out, I misread the question, and my code doesn't do quite what was
requested, namely using the far call for bank switching.

Quote
> uses winapi;
> type dword=record LoWord, HiWord:word end;
> var VesaSelector,CodeSelector:word;
>     SwitchBank:procedure;
> ...
> CodeSelector:=0;
> VesaSelector:=0;
> {obviously ModeRec is the mode information returned by $4f01}
> SetSelectorBase(VESASelector,longint(dword(ModeRec^.BankSwitch).HiWord)*16);
> SetSelectorLimit(VESASelector,65535);
> CodeSelector:=AllocDStoCSAlias(VesaSelector);
> @SwitchBank:=ptr(CodeSelector,Dword(ModeRec^.BankSwitch).LoWord);

True, but I'm left wondering something here.  What about context?  If the
processor is running in protected mode and suddenly jumps to BIOS code with
real mode context, wouldn't it GPF?  All BIOSes aren't smart enough to know
this, are they?  Is switching to real mode and back to protected mode needed?

Quote
> --Mark Iuzzolino
> one of the monst...@monstersoft.com  |  "Who do you want to kill today?"
> http://www.monstersoft.com

--
Scott Earnest            | SPAM protection in effect. Remove  |
setech@_ix.netcom.com    | "_" as needed for true addresses.  |
earnests@_homenet.lm.com |    UIN:1136443  EFnet:pale_blue    |
sinykal@_{*word*104}space.org  | URL: http://www.netcom.com/~setech |

Other Threads