www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/06/18/07:17:43

Xref: news2.mv.net comp.os.msdos.djgpp:5118
From: Bob Platko <platko AT ix DOT netcom DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: __dmpi_regs bug?
Date: Mon, 17 Jun 1996 22:34:15 -0400
Organization: Netcom
Lines: 224
Message-ID: <31C615A7.3FD4@ix.netcom.com>
NNTP-Posting-Host: clv-oh7-14.ix.netcom.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

I been having some problems trying to get some
basic VESA information from my video card via
bios calls in DJGPP's C complier.  My modified
Borland 3.0 code gets the information correctly,
as specified by the DOS graphic utilities I
have.  Yet, with using the __dpmi_regs, I have
had some problems getting other bios calls to
work properly.  (text stuff like moving the 
cursor on the screen, clearing the screen, 
writing characters to the screen, etc..,
which did not work properly, but DID work
using the int86 function.)

Does anybody know what is causing the incorrect
information about VESA video mode 0x103?  (When
I ran it, it said I don't have an A or B window.
This contadicts the Borland compiled version, and
the utilities I used to test it.)


#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <pc.h>
#include <dpmi.h>
#include <go32.h>
#include <dos.h>

#define TRUE  1
#define FALSE 0

#define BYTE unsigned char
#define WORD unsigned int
#define DWORD unsigned long

typedef struct {
  BYTE signature[4];
  BYTE version_min;
  BYTE version_max;
  DWORD oem_ptr;
  BYTE capabilities[4];
  DWORD vid_mode_ptr;
  WORD  vid_ram;   /* In 64k blocks, this and beyond are for Vesa 2.x */
  WORD oem_version;
  DWORD vendor_ptr;
  DWORD product_ptr;
  DWORD revision_ptr;
  BYTE junk[128];
} VESA_info_block;


typedef struct {
  WORD attributes;
  BYTE a_attributes;
  BYTE b_attributes;
  WORD granularity;
  WORD win_size;
  WORD a_segment;
  WORD b_segment;
  DWORD win_ptr;
  WORD bytes_per_scan_line;
  WORD screen_width;
  WORD screen_height;
  BYTE char_width;
  BYTE char_height;
  BYTE num_of_planes;
  BYTE bits_per_pixel;
  BYTE num_of_banks;
  BYTE mem_model;
  BYTE bank_size;
  BYTE num_of_pages;
  BYTE junk[226];
} mode_info_block;


VESA_info_block *get_VESA_info(void);
mode_info_block *get_mode_info(int mode);
void display_info(void);

mode_info_block *get_mode_info(int mode)
{
  static mode_info_block info;
  __dpmi_regs r;


	/* Use the transfer buffer to store the results of VBE call */
	r.x.ax = 0x4F01;
	r.x.cx = mode;
  r.x.es = __tb / 16;
  r.x.di = 0;
  __dpmi_int(0x10, &r);
	if(r.h.ah) return 0;
  dosmemget(__tb, sizeof(mode_info_block), &info);
	return &info;
}

VESA_info_block *get_VESA_info(void)
{
  static VESA_info_block info;
  __dpmi_regs r;

  r.x.ax = 0x4F00;
  r.x.es = __tb / 16;
  r.x.di = 0;
  __dpmi_int(0x10, &r);
  if(r.h.al != 0x4F) return 0;
  dosmemget(__tb, sizeof(VESA_info_block), &info);
	return &info;
}

void main(void)
{
  int l;
  BYTE out[80];

  VESA_info_block *vb;
  vb=get_VESA_info();

  strncpy( out, vb->signature, 4 );
	out[4] = 0x00;
	strcat( out, " Version " );
	printf( out );
  printf( "%i.%i",vb->version_max,vb->version_min );
  printf("\nOEM points to %00000000x",vb->oem_ptr);
  display_info();
  
}

void display_info(void)
{
  mode_info_block *mb;

  mb=get_mode_info(0x103);


    if( mb->attributes & 1 )
			printf( "\n  Mode Supported in Hardware" );
		else
      printf( "\n  Mode NOT Supported in Hardware" );

    if( mb->attributes & 2 )
			printf( "\n  Extended Mode Information Available" );
		else
			printf( "\n  No Extended Mode Information" );

    if( mb->attributes & 4 )
			printf( "\n  Output Functions Supported by BIOS" );
		else
      printf( "\n  Output Functions NOT Supported by BIOS" ); 

    if( mb->attributes & 8 )
			printf( "\n  Color" );
		else
			printf( "\n  Monochrome" );

    if( mb->attributes & 16 )
			printf( " Graphics" );
		else
			printf( " Text" );

    if( mb->attributes & 32)
			printf( "\n  Not VGA Compat..." );
		else
			printf( "\n  IS VGA COMPAt" );

    if( mb->attributes & 64)
			printf( "\n  Not VGA WINDOW Compat..." );
		else
			printf( "\n  IS VGA WINDOW COMPAt" );

    if( mb->attributes & 128)
      printf( "\n  Linear adressing compatible" );
		else
      printf( "\n  Non-linear compatible" );

    if( mb->a_attributes & 1)
      printf( "\n  Window A exists." );
		else
      printf( "\n  Window A does NOT exist." );

    if( mb->a_attributes & 2)
      printf( "\n  Window A readable." );
		else
      printf( "\n  Window A NOT readable." );

    if( mb->a_attributes & 4)
      printf( "\n  Window A writeable." );
		else
      printf( "\n  Window A NOT writeable." );

    if( mb->b_attributes & 1)
      printf( "\n  Window B exists." );
		else
      printf( "\n  Window B does NOT exist." );

    if( mb->b_attributes & 2)
      printf( "\n  Window B readable." );
		else
      printf( "\n  Window B NOT readable." );

    if( mb->b_attributes & 4)
      printf( "\n  Window B writeable." );
		else
      printf( "\n  Window B NOT writeable." );

}



I might have a solution to my own problem but I 
don't know how to do this.

With using the union REGS r & struct SREGS s, 
how do I copy the contents of es thru di without
using this:

  dosmemget(__tb, sizeof(mode_info_block), &info);

Any help will be appreciated.

BTW, what is that __tb thing?  It's not in the C language index in info.exe.


BP

- Raw text -


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