delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/10/22/18:11:58

Message-ID: <326D61C1.4AFD@gbrmpa.gov.au>
Date: Wed, 23 Oct 1996 08:07:30 +0800
From: Leath Muller <leathm AT gbrmpa DOT gov DOT au>
Reply-To: leathm AT gbrmpa DOT gov DOT au
Organization: Great Barrier Reef Marine Park Authority
MIME-Version: 1.0
To: Mohan Khurana <mohan AT stealth DOT net>
CC: djgpp AT delorie DOT com
Subject: Re: VESA Programming -- oh boy.
References: <54h0j2$hu3 AT news DOT stealth DOT net>

> Inside this structure there is a pointer called "OemStringPtr" defined
> in the struct statement as:
> char *OemStringPtr PACKED;
> If I try to print this pointer to a null terminated string, using the
> following line:
> printf("%s", vesastruct->OemStringPtr);
> I get the following error:
> Exiting due to signal SIGSEGV
> ...
> The specs say that OemStringPtr is a real mode far pointer in
> protected mode.  How do I access it?
 
> Please help.  I have been trying to figure this out for a while now.

You could always do something like:
	char oem_string[256];
	unsigned int oem_str_ptr;
	char letter;
	int i;

	oem_str_ptr = (unsigned int) vesastruct->OemStringPtr;
	oem_str_ptr = (((oem_str_ptr & 0xFFFF0000) >> 12) |
					(oem_str_ptr & 0xFFFF));

	i = 0;
	do
	{
		letter = (char) farnspeekb(oem_str_ptr);
		oem_string[i] = letter;
		i++;
	} while ((i < 256) | (i != '\0'));
	printf("%s\n",oem_string);

Its kludgy, but I have never worried about the oem string before, and
right now I am very bored... :)

Leathal.

- Raw text -


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