Mail Archives: djgpp/1998/01/09/07:16:59
David Eberhard wrote:
>
> Thanks for all the help. It solved my problem, but now I have
> another. Here's the code:
>
> video_selector = __dpmi_allocate_ldt_descriptors(1);
> __dpmi_set_segment_base_address(video_selector, linear_address);
> //Set limit to around 2 Meg
> __dpmi_set_segment_limit(video_selector, 2000000UL);
>
> Here I am setting up a selector so I can access the linear buffer of
> my video card. I wanted to set the segment limit to around 2 meg, but
> it crashes my program and gives about the same error that I got with
> my last problem. It crashes when I try to write to video memory using
> the selector I made above. If I trim down 2000000 to 200000, then my
> program works fine. Anyone know why?
i think the answer might lie in the following remark in the DPMI spec (i
am no expert on this though):
INT 0x31 Function 0x0008
Set Segment Limit
<snip>
* Segment limits greater than or equal to 1MB must be page aligned. That
is, limits greater than 1MB must have the low 12 bits set
<snip>
also, note that "the value supplied to the function (in CX:DX) is the
byte length of the segment-1. so, for 2MB, passing 2048*1024-1 should
work, i guess.
by the way, do check the return values of such calls.
--
----------------------------------------------------------------------
A. Sinan Unur
Department of Policy Analysis and Management, College of Human Ecology,
Cornell University, Ithaca, NY 14853, USA
mailto:sinan DOT unur AT cornell DOT edu
http://www.people.cornell.edu/pages/asu1/
- Raw text -