From: Shawn Hargreaves Newsgroups: comp.os.msdos.djgpp Subject: Re: help on VESA 2.0 PMode interface and pointers to functions (in C++)... Date: Fri, 20 Jun 1997 20:00:46 +0100 Organization: None Distribution: world Message-ID: References: <33A988FE DOT 38A29093 AT execulink DOT com> NNTP-Posting-Host: talula.demon.co.uk MIME-Version: 1.0 Lines: 47 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Jeff Weeks writes: > void (*_pm_vesa_switcher)(); ... > _pm_vesa_switcher = (void *)((char *)pm_info + pm_info->setWindow); ... >And this is where I get the errors about being non ANSI. Something to >the effect of: > > ANSI C++ forbids pointer conversion from void * It means exactly what it says: assigning a void * to a variable is valid C, but not permitted in C++. You need to add a cast, eg: _pm_vesa_switcher = (void (*)())((char *)pm_info + pm_info->setWindow); Or you could just make _pm_vesa_switcher a void pointer itself: it isn't a regular function in the first place (uses a weird register based calling convention that means you have to call it from an asm wrapper). >I was wondered what all this about memory mapped IO was about? After >you get the protected mode interface, you do something related to >memory mapped IO. What is it, and why do you do it? In order for the driver to do it's work, it (obviously) needs to access the video card hardware. From real mode that is no problem, but this little code stub is running in protected mode. That means it can't access any I/O ports without having the appropriate permissions, and needs any physical addresses (for memory-mapped hardware registers) to be mapped into your virtual address space where it can get at them. This isn't usually an issue because under DOS all apps have access to all the I/O registers (that info would be needed under other more highly protected systems), and because the vast majority of cards don't use memory-mapped registers. Every now and then, though, you'll stumble across one that does, and your code will die horribly if you don't deal with it properly :-) The VESA driver tells you which physical addresses it wants to access: you should map these into linear memory (as you would for an LFB), create a selector to access them, and pass this in the %es register whenever you call the VESA code stubs. The exception is the set palette function, which wants the selector in %ds. That's not mentioned anywhere in the VESA spec, but Kendall Bennett (from SciTech) confirmed to me that it is nevertheless correct :-) -- Shawn Hargreaves - shawn AT talula DOT demon DOT co DOT uk - http://www.talula.demon.co.uk/ Beauty is a French phonetic corruption of a short cloth neck ornament.