🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.msdos.programmer
Article #6067

Querying screen mode with int 10h, function 0fh

#6067
From: Alex Nicolaou
Date: Sun, 05 May 1991 21:26
54 lines
1667 bytes
 Ok, this is a simple problem, but I cannot seem to get my 
program to work correctly. I am trying to get the value for
the current screen mode out of my graphics card. It works when
I'm in an EGA mode, but in CGA mode kills the screen. 
 Please help by giving me a suggestion that works!

Here is the program:

/**** program ****/
#include <stdio.h>
#include <graphics.h>
#include <dos.h>
 
union REGS iReg, oReg;
struct SREGS segregs;
 
main()
{
	int mode;
	/* if you try EGA EGAHI this program will suddenly
 	 * work! */
	int gdriver = CGA,
	    gmode = CGAHI;
 
	initgraph(&gdriver, &gmode, "");
 
	/* draw a line to prove to myself that the video mode is
	 * correct 						*/
	moveto(0, getmaxy());
	lineto(getmaxx(), 0);
	/* make the user press return to go to next stage */
	getchar();
 
	/* use int 10h function 0fh to get video mode */
	iReg.x.ax = 0x000f;
	/* if you comment out this line, the code works, except
	 * of course you don't have the screen mode */
	int86x(0x10, &iReg, &oReg, &segregs);
	/* save the mode */
	mode = oReg.h.al&0x007f;
 
	moveto(0,0);
	lineto(getmaxx(), getmaxy());
 
	getchar();
	closegraph();
}

/*** end of program ***/

Thanks for any help!

alex
Technical Details
Message-ID: <1991May5.212632.7577@watcgl.waterloo.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watserv1!watcgl!anicolao

Show Full Headers
Complete Article Headers
Newsgroups: comp.os.msdos.programmer
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watserv1!watcgl!anicolao
From: anicolao@watcgl.waterloo.edu (Alex Nicolaou)
Subject: Querying screen mode with int 10h, function  0fh
Message-ID: <1991May5.212632.7577@watcgl.waterloo.edu>
Keywords: Turbo C++ graphics handling
Organization: Computer Graphics Laboratory, University of Waterloo, Ontario, Canada
Date: Sun, 5 May 1991 21:26:32 GMT
Lines: 54