delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/02/04/02:14:37

Sender: nate AT cartsys DOT com
Message-ID: <36B7A2EF.D1D49DE0@cartsys.com>
Date: Tue, 02 Feb 1999 17:14:23 -0800
From: Nate Eldredge <nate AT cartsys DOT com>
X-Mailer: Mozilla 4.08 [en] (X11; I; Linux 2.0.36 i586)
MIME-Version: 1.0
To: djgpp AT delorie DOT com
Subject: Re: Q: Forcing mode CO80
References: <3 DOT 0 DOT 6 DOT 32 DOT 19990202110837 DOT 008059f0 AT pop DOT netaddress DOT com>
Reply-To: djgpp AT delorie DOT com

Paul Derbyshire wrote:
> 
> Can anyone exhibit for me a snippet of code that retrieves the current
> video mode code number and one that sets an arbitrary video mode by number?
> 
> Nothing fancy needed here...no drivers or svga detection or anything. Just
> intend to retrieve a video mode at the start of a program, then put it back
> at the end of the program.

Untested:

#include <dpmi.h>

void set_mode(int m)
{
  __dpmi_regs r;
  r.h.ah = 0;
  r.h.al = m;
  __dpmi_int(0x10, &r);
}

int get_mode(void)
{
  __dpmi_regs r;
  r.h.ah = 0x0f;
  __dpmi_int(0x10, &r);
  return r.h.al;
}

For stuff like this, you should read Ralf Brown's Interrupt List,
available as inter* in the info tree of Simtelnet.
-- 

Nate Eldredge
nate AT cartsys DOT com

- Raw text -


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