delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/07/12/01:38:18

Date: Fri, 11 Jul 1997 22:36:19 -0700 (PDT)
Message-Id: <199707120536.WAA15668@adit.ap.net>
Mime-Version: 1.0
To: csantill AT lausd DOT k12 DOT ca DOT us
From: Nate Eldredge <eldredge AT ap DOT net>
Subject: Re: Strange Descriptor Error?
Cc: djgpp AT delorie DOT com

You wrote:
>I'm trying one of the VGA mem mapping procedures that is in
>the FAQ(right out of 18.4).  When I try to get the descriptor
>w/  "short vid_mem=__dpmi_segment_to_descriptor(0xA000);"
>I get this error - "Intializer is not constant" (paraphrased).
My guess is you placed the line outside of any function. In C, global or
static variables can only be initialized to something which can be figured
out at compile time, and that doesn't include function calls. Probably you
should do something like this:

short vid_mem;

/* stuff */
int main(void)
{
  /* ... */
  vid_mem = __dpmi_segment_to_descriptor(0xA000);
  /* ... */
}

If the program is more complicated, you could move it to an `init' function.

Nate Eldredge
eldredge AT ap DOT net



 flag) of the EFLAGS CPU
>> register afterwards, e.g. by a JPE (conditional jump short on parity even
>> PF=1).
>
>You'ld be better off using 'setpe' rather than 'jpe', as it't much less
>expensive:
>
>asm volatile("or %1,%1;setpe %b0":"=g"(result):"r"(value):"cc");
>

Nate Eldredge
eldredge AT ap DOT net



- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019