From: Bill Currie Newsgroups: comp.os.msdos.djgpp Subject: Re: (new question) problem with memory allocation Date: Fri, 09 Jan 1998 16:18:37 +1300 Organization: Telecommunication Systems Support Centre Lines: 25 Message-ID: <34B5970D.148A@tssc.co.nz> References: <199801090150 DOT RAA16234 AT adit DOT ap DOT net> <34B58A15 DOT B86CC43B AT xmission DOT com> NNTP-Posting-Host: node106.tssc.co.nz Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk 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? Yup, DPMI is failing your set limit call. Segments over 1M in lengt must be a multiple of 4k. This means you must use a segment limit of 2002944 (unless you want to go the other way). Anyway, wouldn't you want to go to 2097152 (2M exactly)? Bill -- Leave others their otherness