Mail Archives: djgpp/2010/12/23/19:22:16
X-Authentication-Warning: | delorie.com: mail set sender to djgpp-bounces using -f
|
X-Recipient: | djgpp AT delorie DOT com
|
X-Yahoo-Newman-Property: | ymail-3
|
X-Yahoo-Newman-Id: | 48373 DOT 82156 DOT bm AT omp1024 DOT mail DOT sp2 DOT yahoo DOT com
|
DKIM-Signature: | v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com.ar; s=s1024; t=1293149374; bh=+O1Uhf7FvZVzyiK8qWMtf6/+yDTFDW3//adQQZ7xiJ0=; h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=M65n2kO/XbSbZyoPIsUblweDbUGIk4eG7UF4v3jRdO5RMLA4vRlo4BXOFYPyvA2lnt4SPNU9achhBY7thaoV4KTL/B5Q6HMRgIMDOHOJIXGj21RrHy5zVlnZHlWUFL09yJ4NGGLguwC7JcNxg56IkR9Fw25ZxYhlfgzLr7o0TGY=
|
DomainKey-Signature:a=rsa-sha1; q=dns; c=nofws;
: | |
| s=s1024; d=yahoo.com.ar;
|
| h=Message-ID:X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding;
|
| b=o+p9RANs8SJPPsOnMIfZ/sW4d5Ykiqk+W4Zj79iMZcq8ucB64xsJ8cjO9iWW4kF3WxYVeTh+hgLY+11MkF82GIc7bRhbL1YtWiCVfzMEDZAD6BH9eODUl57+ANTFfOGr5PPNneh+lVfl53/fZVxse3F2nbLxKYHrzlC3qCGNKLY=;
|
Message-ID: | <846345.79275.qm@web45108.mail.sp1.yahoo.com>
|
X-YMail-OSG: | GltZ57UVM1mDGGXFaZUZ.gPRotVL_lMfLDvRmO63WdGyLuk
|
| qviQX6yOXCjBdSqA5gZzj_lWPqCZzPsIj8mXG.T.SZDvJw4wgbd_7Vg57Ln1
|
| 5PdLpvC1NIswWDAb_svqWZnwfieBlg_f.spxFkaSHfcsJX.IoBg0V6aBBguw
|
| OONI6GFh4SwbR2RdRarG60Nm48UfA8AvNNHn9bUGPx2MTh8w4i8sHDgtn.uS
|
| 1JSPcCWknuzmAdq6NTn4aIRjk2ujX4XAVijY-
|
X-Mailer: | YahooMailClassic/11.4.20 YahooMailWebService/0.8.107.285259
|
Date: | Thu, 23 Dec 2010 16:09:34 -0800 (PST)
|
From: | Pablo Marty <tigrepotrazosalvaje AT yahoo DOT com DOT ar>
|
Subject: | question of assembler
|
To: | djgpp AT delorie DOT com
|
MIME-Version: | 1.0
|
Reply-To: | djgpp AT delorie DOT com
|
hi guys and girls
I'm still a the search of the VESA VBE protected mode bank switching functi=
on in order to run my SuperMarioBros videogame normally fast and with music=
under DOSBox=20
this is the code I got from the DJGPP page about VESA 2.0
the compiler throws an error at the set_vesa_bank_pm() function (at the end=
of the code)
In the last time I wrote to the list, Mr DJ Delorie told me that "you can't=
clobber and use them", I suppose refering to the CPU registers. But he did=
n't tell me how to clobber them without using them .... I suppose that's wh=
at has to be done, because beside the code there is a coment that says "clo=
bber list ..."
Can someone tell me how to clobber the list of registers correctly? I'm sur=
e all of you (including Rugxulo) will enjoy my game when it runs Ok and wit=
h sound under DOSBox
And, by the way, i can't understand how there is an eliminating error in th=
e code in the page of such great and important programming platform .... bu=
t, .... will is the important thing
Thank you
Pablo Marty
Bs As - Argentina=20
=A0
//***********************************************************************
=A0 typedef struct VESA_PM_INFO
{
unsigned short setWindow __attribute__ ((packed));
unsigned short setDisplayStart __attribute__ ((packed));
unsigned short setPalette __attribute__ ((packed));
unsigned short IOPrivInfo __attribute__ ((packed));
} VESA_PM_INFO;
VESA_PM_INFO *vesa_pm_info;
void *pm_bank_switcher;
int get_vesa_pm_functions()
{
__dpmi_regs r;
/* check that the driver is at least VBE version 2.0 */
if (vesa_info.VESAVersion < 0x200)=20
=09 return -1;
/* call the VESA function */
r.x.ax =3D 0x4F0A;
r.x.bx =3D 0;
__dpmi_int(0x10, &r);
if (r.h.ah)
=09 return -1;
/* allocate space for the code stubs */
vesa_pm_info =3D malloc(r.x.cx);
/* copy the code into our address space */
dosmemget(r.x.es*16+r.x.di, r.x.cx, vesa_pm_info);
/* store a pointer to the bank switch routine */
pm_bank_switcher =3D (void *)((char *)vesa_pm_info +=20
=09=09=09=09 vesa_pm_info->setWindow);
return 0;
}
This code will give you a pointer to the protected mode bank switching func=
tion, but you cannot call this directly from C because it uses a special re=
gister based argument passing convention. A little bit of inline asm is nee=
ded to make sure the parameters go into the correct registers, eg: void s=
et_vesa_bank_pm(int bank_number)
{
asm (
=09 " call *%0 "
: /* no outputs */
: "r" (pm_bank_switcher), /* function pointer in any register */
=09"b" (0), /* set %ebx to zero */
=09"d" (bank_number) /* bank number in %edx */
: "%eax", /* clobber list (we have no way of */
=09"%ebx", /* knowing which registers the VESA */
=09"%ecx", /* code is going to change, so we */
=09"%edx", /* have to assume the worst and list */
=09"%esi", /* them all here) */
=09"%edi"
);
}
=0A=0A=0A
- Raw text -