| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | VioGetPhysBuf |
I have been doing some full screen graphics programming lately and can not
seem to get VioGetPhysBuf to work. I expected it to be the easiest part,
but it eludes me even though all the 'tough' parts are working flawlessly.
I have used it before under 2.1 but I do not have my code from then to use
as a reference anymore. I am starting to suspect a change in Warp or
VisualAge versus 2.1 and CSet++ 2.0. The idea is to get a basic graphics
system working and then compare the performance difference versus DIVE in
order to decide if it warrants the development of seperate graphics code
for multiple video cards.
The problem is that when I attempt to write to the address defined by the
pointer returned from the function GetPhysBuf below I get a memory
violation. The only similar source code I could find was in the EMX SVGA
libararies for OS/2 and the code was essentially no different from mine.
Here's a version of it that has been stripped down to a simple attempt to
put one character on the text screen using the direct buffer access. The
error checking is overkill until I can find why this fails, so the
assertions, logging and VioScr(Un)Lock can be removed to really strip this
down.
#define INCL_NOPMAPI
#define INCL_NODOS
#define INCL_VIO
#include
#include
#include
#include "log.h"
HLOG hlLog;
PBYTE GetPhysBuf(void)
{
VIOMODEINFO vmi;
VIOPHYSBUF vpb;
PBYTE result;
APIRET rc;
vmi.cb = sizeof(VIOMODEINFO);
assert(!(rc=VioGetMode(&vmi, 0)));
logEntry(hlLog, TRACE, "vmi.buf_addr : %p", vmi.buf_addr);
logEntry(hlLog, TRACE, "vmi.buf_length : %lu", vmi.buf_length);
logEntry(hlLog, TRACE, "vmi.full_length : %lu", vmi.full_length);
vpb.pBuf = (PBYTE) vmi.buf_addr;
vpb.cb = vmi.buf_length;
assert(!(rc=VioGetPhysBuf(&vpb, 0)));
result = (rc!=0) ? NULL : MAKEP(vpb.asel[0], 0);
logEntry(hlLog, TRACE, "GetPhysBuf returning : %p", result);
return result;
}
void main (void)
{
PBYTE ScreenBuffer;
UCHAR pfLock;
APIRET rc;
rc = logOpen(&hlLog, TRACE, "LOGFILE", "DEMO");
assert(!(rc=VioScrLock(LOCKIO_NOWAIT, &pfLock, 0)));
assert(pfLock==LOCK_SUCCESS);
ScreenBuffer=GetPhysBuf();
*ScreenBuffer='A';
/* call to nonexistant ReleasePhysBuf() */
assert(!(rc=VioScrUnLock(0)));
rc = logClose(&hlLog);
}
and here is logfile:
Sun Oct 1 08:45:43 1995 DEMO:P Log file "LOGFILE" opened.
Sun Oct 1 08:45:43 1995 DEMO:P Log level set to trace.
Sun Oct 1 08:45:43 1995 DEMO:T vmi.buf_addr : B8000
Sun Oct 1 08:45:43 1995 DEMO:T vmi.buf_length : 32768
Sun Oct 1 08:45:43 1995 DEMO:T vmi.full_length : 8096
Sun Oct 1 08:45:43 1995 DEMO:T GetPhysBuf returning : 9F0000
--- Maximus/2 3.00
* Origin: PowerHouse Point, Burnaby, BC - 604-431-4569/9365 - (1:153/894)SEEN-BY: 270/101 620/243 711/401 409 410 413 430 807 808 809 934 955 712/407 SEEN-BY: 712/515 628 704 713/888 800/1 7877/2809 @PATH: 153/894 7070 3615/50 396/1 270/101 712/515 711/808 809 934 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.