Category : Word Processors
Archive   : HP22D5.ZIP
Filename : SWITCH.C

 
Output of file : SWITCH.C contained in archive : HP22D5.ZIP

#include "extern.h"

/*
** This routine switches between color and monochrome monitors
**
** To call this handler from HyperPAD:
**
** switch;
*/
toggle(NumArgs,...)

{
PACKETPTR Screen;
SHAREDPTR pShared;
BYTE b,m;

/* release HyperPAD, including the video driver */
ReleaseHPAD();

/* get a pointer to the screen */
pShared = GetSharedArea();
Screen = pShared -> pVideoModes[0];

if (Screen -> Screen == (PTR)0xB8000000L) {
/* switch to mono */
Screen -> Screen = (PTR)0xB0000000L;
b = 0x30; /* equipment flags for mono */
}
else {
/* switch to color */
Screen -> Screen = (PTR)0xB8000000L;
b = 0x10; /* equipment flags for color */
}

/* set equipment flags for the correct monitor */
*((PTR)0x00400010L) &= 0xcf;
*((PTR)0x00400010L) |= b;

/* switch HyperPAD's monitor types in the video driver */
m = pShared -> MonitorType[0];
pShared -> MonitorType[0] = pShared -> MonitorType[1];
pShared -> MonitorType[1] = m;

/* re-install HyperPAD, including its video driver */
RestoreHPAD();

/* turn off blinking on the MONO card */
if (b == 0x30) outp(0x3B8,*((PTR)0x00400065L) &= 0xDF);
}

POOL pascal Pool[] = {
{ "switch",
toggle,
0,
HANDLER},

{ NULL,
NULL,
0,
0} };