www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/02/09/01:45:56

Date: Sat, 8 Feb 1997 22:34:49 -0800 (PST)
From: KaRNaGE <dlydiard AT linknet DOT kitsap DOT lib DOT wa DOT us>
To: djgpp AT delorie DOT com
Subject: VBE 2.0 Pmode Bank Switching...
Message-ID: <Pine.SUN.3.95.970208215834.13653A-100000@linknet.kitsap.lib.wa.us>
MIME-Version: 1.0

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...

BTW i'm using UNIVBE v5.3 It Reports:
Video Card: Cirrus Logic SuperVGA (CL-GD5422) with 1 Mb
RAM DAC:    Cirrus Logic 24 bit DAC
Clock Chip: Cirrus 5422/24/26/28 Internal Clock
 . Installing VBE 2.0 32 bit protected mode extensions

UniVBE(tm) is currently enabled with the following features:

    VBE 2.0 support:             on
    Linear framebuffer support:  off
    Native mode centering:       on
    VBE 2.0 palette functions:   on
    VBE 2.0 32-bit interface:    on

i can't use a LFB with my crappy video card, so i have to use PM Bank
switching wich i can't get to work, here is some snippets of my code:

#define PACKED __attribute__ ((packed))
#pragma pack(1)
typedef struct PM_INFO /* VESA 2.0 protected mode interface */
{
   unsigned short setWindow PACKED;
   unsigned short setDisplayStart PACKED;
   unsigned short setPalette PACKED;
   unsigned short IOPrivInfo PACKED;
} PM_Int;
#pragma pack()

static PM_Int *pm_info = NULL;
void (*pm_bank)(char) = NULL;

void VESA_get_pm_interface(void)
{
  __dpmi_regs regs;

  regs.x.ax = 0x4F0A; /* retrieve pmode interface */
  regs.x.bx = 0;
  __dpmi_int(0x10, &regs);
  if (regs.h.ah) exit(1);
  if (pm_info) free(pm_info);     /* free it if it's allocated */
  pm_info = malloc(regs.x.cx);    /* copy into our address space */
  _go32_dpmi_lock_data(pm_info, regs.x.cx);
  dosmemget((regs.x.es * 16) + regs.x.di, regs.x.cx, pm_info);
  pm_bank = (void *)((char *)pm_info + pm_info->setWindow);
}

Ok that's what i use to get the Pmode VBE 32bit interface
And Here's the main part of what i use for my 'copy to screen' function:
(this is for mode 101h - 640x480x256)

pm_bank(0);
movedata(_my_ds(), (unsigned)source, _dos_ds, (unsigned)dest, 65536);
pm_bank(1);
movedata(_my_ds(), (unsigned)source + 65536, _dos_ds, (unsigned)dest,65536);
pm_bank(2);
movedata(_my_ds(), (unsigned)source + 131072, _dos_ds, (unsigned)dest,65536);
pm_bank(3);
movedata(_my_ds(), (unsigned)source + 196608, _dos_ds, (unsigned)dest,65536);
pm_bank(4);
movedata(_my_ds(), (unsigned)source + 262144, _dos_ds,
(unsigned)dest,REMAINING_BYTES);

I know for sure that something is wrong the code i posted, because if i
replace pm_bank() with rm_bank(), Wich lookes like this:

void rm_bank(char bank)
{
  __dpmi_regs regs;

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

So With rm_bank() it works Perfectly!

but for some reason even rm_bank() doesn't work when UNIVBE is loaded..
but works fine when UNIVBE is NOT loaded.  kinda wierd....since my video
card fails to bankswitch with programs like ACiDViEW, unless i load UNIVBE
=)

I Don't want to use GRX, Jlib, Allegro Etc, Because I like using my own
rootines for graphics.  So can anyone help?.. Working example source code
would be the most help...BTW i looked at the source for those graphics
libs but that still didn't help...and it looked almost identical to the
code i'm using to retrieve Pmode Bank swithing...

      
 

- Raw text -


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