/*
 * Sets BIOS Video modes.
 *
 * This file is also a convienient place to declare some Global
 * variables that get used in the *.asm Routines.
 */

unsigned	int	_buffer_segment = 0xA000;	/* Current buffer being drawn to */
unsigned	int	_buffer_offset = 0;	/* Current buffer being drawn to */
unsigned	int	_cur_mode = 3;	/* The current video mode */
unsigned	int	_cur_color = 0;	/* The current color */

#include <dos.h>

union	REGS	regs;

#ifdef WATCOM
#include <graph.h>
#endif

int  setmode(int mode)
{
  int	old_mode;
#ifdef WATCOM
  struct videoconfig VC;
#endif  
  
  _cur_mode = mode;
  
#ifdef WATCOM
  _getvideoconfig( &VC );
  old_mode= VC.mode;
  _setvideomode( mode );
#else
  regs.h.ah = 15;
  int86(0x10, &regs, &regs);
  old_mode = regs.h.al;
  regs.h.ah = 0;
  regs.h.al = mode;
  int86(0x10, &regs, &regs);
#endif
  return (old_mode);
}
