[comp.sys.ibm.pc] Making The Cursor Appear In EGA 43-Line Mode

cramer@kontron.UUCP (02/25/87)

There is a little trick to making the cursor appear when using the 43-line
mode of the EGA: the little trick is that the standard cursor block is
more than eight pixels high, but in 43-line mode, the character box is
eight by eight pixels.  The result is that if you change to 43-line mode,
your cursor disappears.

The trick is to use the INT 10H call that sets the height of the cursor.
The following piece of Microsoft C V3.0 sets you up in 43-line mode:


/*===========================================================================*\

NAME:		Set43LineMode			AUTHOR: Clayton E. Cramer

FUNCTION:	Turns on the 43 line mode of the EGA.

PARAMETERS:	Color				TRUE: color display
						FALSE: monochrome display

OTHER INPUTS:	none

RETURNS:	none

OUTPUTS:	Does some ROM BIOS interrupts to set the mode.  Doesn't (can't)
		check if this is an EGA or not.

SIDE EFFECTS:	none

PORTABILITY:	Specific to the PC family

\*========================================================================*/

Set43LineMode(Color)

  {
  union REGS	InRegs, OutRegs;
  
  if (Color)
    InRegs.h.al = 0x3;		/* Color, 80x43 */
  else
    InRegs.h.al = 0x7;		/* Monochrome, 80x43 */
  int86 (0x10, &InRegs, &OutRegs);
  InRegs.x.ax = 0x1112;	/* character generator BIOS routine */
  InRegs.h.bl = 0;		/* load 8x8 double dot character font */
  int86 (0x10, &InRegs, &OutRegs);
  InRegs.x.ax = 0x1200;	/* alternate screen routine */
  InRegs.h.bl = 0x20;		/* alternate print screen routine */
  int86 (0x10, &InRegs, &OutRegs);
  InRegs.x.ax = 0x100;
  InRegs.h.ch = 0;
  InRegs.h.cl = 7;
  int86 (0x10, &InRegs, &OutRegs);	/* set cursor type */
  }    

The following function puts you back into 25-line mode:

/*===========================================================================*\

NAME:		Reset43LineMode			AUTHOR: Clayton E. Cramer

FUNCTION:	Turns off the 43 line mode of the EGA.

PARAMETERS:	Color				TRUE: color display
						FALSE: monochrome display

OTHER INPUTS:	none

RETURNS:	none

OUTPUTS:	Does some ROM BIOS interrupts to set the mode.  Doesn't 
		check if this is an EGA or not.  Because the COMPAQ seems
                slightly incompatible, we also run the DOS command MODE CO80
                to force everything back to the correct form.

SIDE EFFECTS:	none

PORTABILITY:	Specific to the PC family

\*========================================================================*/

Reset43LineMode(Color)

  {
  union REGS	InRegs, OutRegs;
  
  if (Color)
    InRegs.h.al = 0x3;		/* Color, 80x25 */
  else
    InRegs.h.al = 0x7;		/* Monochrome, 80x25 */
  int86 (0x10, &InRegs, &OutRegs);
  InRegs.x.ax = 0x1101;	/* character generator BIOS routine */
  InRegs.h.bl = 0;		/* load 8x8 double dot character font */
  int86 (0x10, &InRegs, &OutRegs);
  InRegs.x.ax = 0x1200;	/* alternate screen routine */
  InRegs.h.bl = 0x20;		/* alternate print screen routine */
  int86 (0x10, &InRegs, &OutRegs);
  }    

I hope these save someone else some time.

Clayton E. Cramer