Mail Archives: djgpp/2000/10/14/09:00:23
Graham Reeds <grahamr AT dtn DOT ntl DOT com> schrieb...
> > Video RAM is not system RAM. The DPMI host cannot page it to disk,
> > it's always there. No need to lock it.
>
> I have the __dpmi_lock_linear_region() in there because one of the
examples
> I had (basically it was Allegro) had it in there, and though it didn't
seem
> to affect it either way, I felt that if he has it in, there must be a
> reason.
Hmm, I have never needed it yet.
> > The limit you must specify here is the highest accessible offset, so it
> must
> > be size-1.
>
> I had that in, but I took it out for a recompile (grasping at straws
again).
Well, take it back in, it's correct. :-)
> It works fine as it compiles with no warnings and no errors (-Wall is on).
> Like I said at the start it only draws the top eighth of the screen, and
not
> the entirety of it like it should. If you ran the program from my website
> you'll see that the purple smiley comes on to the cropped section and
> disappears off the cropped section, so the logics of the screen are fine.
> Just something I can't figure out.
I looked at your sources, and this is what I noticed:
- You allocate your "primarysurface" AFTER you calculate the remainder
stuff.
This works for LFB, because you don't use it with the LDT descriptor
allocating part.
But as soon as bank switching is used, you will get a crash.
Put it before
if (vbeinfoblock.vbeversion >= 0x0200)
- After you decide about LFB or bankswitching, you calculate the remainder
and videomemory pointer again with the bankswitching formula.
So you destroy them both in the case of LFB.
That's why you had only a fraction of your image on the screen.
- You calculate the remainder to be xres*yres. This is OK, because with LFB
you can copy the full screen at once. But you use _movedatal() for this,
which gets the number of DWORDS to copy, but you give it the number of
BYTES.
Either calculate remainder to be xres*yres/4 or divide it at the
_movedatal()
call.
- Your calculation of the bankswitch-remainder works, but the modulo
operator
is predestinated to calculate remainders :-) Why don't you use it?
- Talking about bank switching... I think everyone's graphic card supports
LFB and VBE2.0 nowadays. You can simply require it. Systems that support
only bankswitching are too slow for your drawing technique anyways...
Bankswitching was a stupid hack to get around stupid old limitations.
And it's a major PITA programming with it...
Peter
- Raw text -