VBE2.0 w/ LFB + GCC

Started by
0 comments, last by Graham Reeds 23 years, 7 months ago
Okay. I was wondering whether any of you can help me out here. I''m going over some of my old code, straightening it out, tidying it up, and regurgitating it as tutorials for my site(:-P when I hit a brick wall. Well more accurately, I hit VBE2.0. I know that this is an old topic, and like I said it was old code, but it used to work. I have in my setvbemode() routine a peice of code that detects for VBE2.0 and if it is present it then detects for a LFB, and if that is present, sets it, if not goes for normal bankswitching. All well and good and the topic of many an old doc. However, I came around to tidying up the code, and make it more ~streamlined, recompiled and it broke - GPF''d out. After tweaking about the code until I was blue in my face (and blue on the screen on a couple of times) I rebooted to Command Prompt Only only to find that it was broke there - meaning that I can''t blame Win98SE. So I looked at my old code and found a program with an .exe file that worked, so I recompiled - and shock horrors - it broke. I was just wondering whether or not due to some quirk of fate it is me or what. So I symify''d my code and noticed that it is reporting that _movedatal() is being substituted/called from _dosmemputl(). So I then added created a selector in there and called movedata() directly. Still no joy. I have a look at my video card in My Computer->Properties and see that a range of memory is situated at 0xE000 0000 and if I check where .physbaseptr references that is 0xE000 0000. So I skip the calculating of the lfb and try that (grasping at straws now I know). I then fall back to the nearptr pixels hacks, which I was trying to avoid, and fair enough, it doesn''t crash, but nothing gets drawn to the screen either. But here is the code that is being problematic below, the full code plus makefile and main.c can be downloaded from http://homepage.dtn.ntl.com/grahamr/vbe2.0.zip /* FRAGMENT OF SETVBEMODE THAT SETS UP THE LFB */ /* lfb available */ mode += 0x4000; /* get videomemory address */ meminfo.size = (unsigned long)(modeinfoblock.bytesperscanline * modeinfoblock.yresolution); meminfo.address = (unsigned long)modeinfoblock.physbaseptr; __dpmi_physical_address_mapping(&meminfo); videomemory = meminfo.address; // videomemory = (unsigned long)modeinfoblock.physbaseptr; /* grasping at straws now */ /* try selectors */ videoselector = __dpmi_allocate_ldt_descriptors(1); __dpmi_set_segment_base_address(videoselector, videomemory); __dpmi_set_segment_limit(videoselector, modeinfoblock.bytesperscanline * modeinfoblock.yresolution); /* try NEARPTR hacks */ video = (unsigned char *)((unsigned long)videomemory + __djgpp_conventional_base); /* set up lfb frameend() */ remainder = (int)((modeinfoblock.bytesperscanline * modeinfoblock.yresolution) / 4); frameend = &frameendlfb /* THE CODE THAT ACTUALLY FLIPS THE IMAGE */ void frameendlfb() { /* wait for retrace */ vsync(); /* copy to lfb */ /* use dosmemputl */ // _dosmemputl(primarysurface->dsimage, remainder, videomemory); /* use movedata + selector */ movedata(_my_ds(), (int)primarysurface->dsimage, videoselector, videomemory, remainder * 4); /* try NEARPTR hacks */ /* __djgpp_nearptr_enable(); memcpy(primarysurface->dsimage, video, remainder * 4); __djgpp_nearptr_disable(); */ return; } Any help would be much appreciated. Stay Lucky, Graham "Mournblade" Reeds.
Stay Lucky, Graham "Mournblade" Reeds.The Ivory Tower
Advertisement
Okay.

Update: I have now got it so it doesn''t crash when I try to blit the screen via _dosmemputl(); but it now doesn''t actually display anything on the screen.

void frameendlfb()
{
/* wait for retrace */
vsync();

/* copy to lfb */
_dosmemputl(primarysurface->dsimage, remainder, videomemory);

return;
}

/* CONTAINED WITHIN SETVBEMODE() */
/* vbe >2.0 */
/* check for lfb */
if (modeinfoblock.modeattributes & 0x08)
{
/* lfb available */
mode += 0x4000;

/* get videomemory address */
meminfo.size = (unsigned long)(modeinfoblock.bytesperscanline * modeinfoblock.yresolution);
meminfo.address = (unsigned long)modeinfoblock.physbaseptr;
__dpmi_physical_address_mapping(&meminfo);
// __dpmi_lock_linear_region(&meminfo);
videomemory = meminfo.address;

/* try selectors */
// videoselector = __dpmi_allocate_ldt_descriptors(1);
// __dpmi_set_segment_base_address(videoselector, videomemory);
// __dpmi_set_segment_limit(videoselector, modeinfoblock.bytesperscanline * modeinfoblock.yresolution + 1);

/* set up lfb frameend() */
remainder = (modeinfoblock.bytesperscanline * modeinfoblock.yresolution) / 4;
frameend = &frameendlfb
}

I have updated the code which is available from my homepage at http://homepage.dtn.ntl.com/grahamr/vbe2.0.zip to see the full code listing.




Stay Lucky, Graham "Mournblade" Reeds.
Stay Lucky, Graham "Mournblade" Reeds.The Ivory Tower

This topic is closed to new replies.

Advertisement