Make the blank screen saver work with MDA and CGA. The fade and green

savers are also modified so that they behave in the same way as the
blank saver on MDA and CGA, although it's not the way these screen
savers are supposed to work, but fading monitor and tickling green
monitor cannot be done on MDA and CGA, AFAIK.  So, this is the second
best solution.

As of this change, the current state of support of screen savers is
summarized in the following table.

		MDA	CGA	EGA	VGA
blank		OK	OK	NA	OK
daemon		OK	OK	OK	OK
fade		*	*	NA	OK
green		*	*	NA	OK
snake		OK	OK	OK	OK
star		OK	OK	OK	OK

OK: works
NA: doesn't work, the module cannot be loaded for this adapter.
*: behave the same way as the blank saver.

As you can see, EGA is left out for now. But, we can do no better, as
EGA registers cannot be read...

Reviewed by: sos
This commit is contained in:
yokota 1997-10-04 04:24:18 +00:00
parent 2bc6063c47
commit 94a432355f
11 changed files with 511 additions and 115 deletions

View File

@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
* $Id: blank_saver.c,v 1.9 1997/04/06 10:48:10 dufault Exp $ * $Id: blank_saver.c,v 1.10 1997/07/15 14:49:09 yokota Exp $
*/ */
#include <sys/param.h> #include <sys/param.h>
@ -46,12 +46,44 @@ blank_saver(int blank)
u_char val; u_char val;
if (blank) { if (blank) {
scrn_blanked = 1; scrn_blanked = 1;
outb(TSIDX, 0x01); val = inb(TSREG); switch (crtc_type) {
outb(TSIDX, 0x01); outb(TSREG, val | 0x20); case KD_VGA:
outb(TSIDX, 0x01); val = inb(TSREG);
outb(TSIDX, 0x01); outb(TSREG, val | 0x20);
break;
case KD_EGA:
/* not yet done XXX */
break;
case KD_CGA:
outb(crtc_addr + 4, 0x25);
break;
case KD_MONO:
case KD_HERCULES:
outb(crtc_addr + 4, 0x21);
break;
default:
break;
}
} }
else { else {
outb(TSIDX, 0x01); val = inb(TSREG); switch (crtc_type) {
outb(TSIDX, 0x01); outb(TSREG, val & 0xDF); case KD_VGA:
outb(TSIDX, 0x01); val = inb(TSREG);
outb(TSIDX, 0x01); outb(TSREG, val & 0xDF);
break;
case KD_EGA:
/* not yet done XXX */
break;
case KD_CGA:
outb(crtc_addr + 4, 0x2d);
break;
case KD_MONO:
case KD_HERCULES:
outb(crtc_addr + 4, 0x29);
break;
default:
break;
}
scrn_blanked = 0; scrn_blanked = 0;
} }
} }
@ -59,8 +91,17 @@ blank_saver(int blank)
static int static int
blank_saver_load(struct lkm_table *lkmtp, int cmd) blank_saver_load(struct lkm_table *lkmtp, int cmd)
{ {
if (!crtc_vga) switch (crtc_type) {
return EINVAL; case KD_MONO:
case KD_HERCULES:
case KD_CGA:
case KD_VGA:
break;
case KD_EGA:
/* EGA is yet to be supported */
default:
return ENODEV;
}
return add_scrn_saver(blank_saver); return add_scrn_saver(blank_saver);
} }

View File

@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
* $Id: fade_saver.c,v 1.10 1997/04/06 10:48:18 dufault Exp $ * $Id: fade_saver.c,v 1.11 1997/07/15 14:49:25 yokota Exp $
*/ */
#include <sys/param.h> #include <sys/param.h>
@ -48,34 +48,80 @@ fade_saver(int blank)
if (blank) { if (blank) {
scrn_blanked = 1; scrn_blanked = 1;
if (count < 64) { switch (crtc_type) {
outb(PIXMASK, 0xFF); /* no pixelmask */ case KD_VGA:
outb(PALWADR, 0x00); if (count < 64) {
outb(PALDATA, 0); outb(PIXMASK, 0xFF); /* no pixelmask */
outb(PALDATA, 0); outb(PALWADR, 0x00);
outb(PALDATA, 0); outb(PALDATA, 0);
for (i = 3; i < 768; i++) { outb(PALDATA, 0);
if (palette[i] - count > 15) outb(PALDATA, 0);
outb(PALDATA, palette[i]-count); for (i = 3; i < 768; i++) {
else if (palette[i] - count > 15)
outb(PALDATA, 15); outb(PALDATA, palette[i]-count);
else
outb(PALDATA, 15);
}
inb(crtc_addr+6); /* reset flip/flop */
outb(ATC, 0x20); /* enable palette */
count++;
} }
inb(crtc_addr+6); /* reset flip/flop */ break;
outb(ATC, 0x20); /* enable palette */ case KD_EGA:
count++; /* not yet done XXX */
break;
case KD_CGA:
outb(crtc_addr + 4, 0x25);
break;
case KD_MONO:
case KD_HERCULES:
outb(crtc_addr + 4, 0x21);
break;
default:
break;
} }
} }
else { else {
load_palette(palette); switch (crtc_type) {
count = scrn_blanked = 0; case KD_VGA:
load_palette(palette);
count = 0;
break;
case KD_EGA:
/* not yet done XXX */
break;
case KD_CGA:
outb(crtc_addr + 4, 0x2d);
break;
case KD_MONO:
case KD_HERCULES:
outb(crtc_addr + 4, 0x29);
break;
default:
break;
}
scrn_blanked = 0;
} }
} }
static int static int
fade_saver_load(struct lkm_table *lkmtp, int cmd) fade_saver_load(struct lkm_table *lkmtp, int cmd)
{ {
if (!crtc_vga) switch (crtc_type) {
return EINVAL; case KD_MONO:
case KD_HERCULES:
case KD_CGA:
/*
* `fade' saver is not fully implemented for MDA and CGA.
* It simply blanks the display instead.
*/
case KD_VGA:
break;
case KD_EGA:
/* EGA is yet to be supported */
default:
return ENODEV;
}
return add_scrn_saver(fade_saver); return add_scrn_saver(fade_saver);
} }

View File

@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
* $Id: green_saver.c,v 1.9 1997/04/06 10:49:13 dufault Exp $ * $Id: green_saver.c,v 1.10 1997/07/15 14:49:29 yokota Exp $
*/ */
#include <sys/param.h> #include <sys/param.h>
@ -46,16 +46,48 @@ green_saver(int blank)
u_char val; u_char val;
if (blank) { if (blank) {
scrn_blanked = 1; scrn_blanked = 1;
outb(TSIDX, 0x01); val = inb(TSREG); switch (crtc_type) {
outb(TSIDX, 0x01); outb(TSREG, val | 0x20); case KD_VGA:
outb(crtc_addr, 0x17); val = inb(crtc_addr + 1); outb(TSIDX, 0x01); val = inb(TSREG);
outb(crtc_addr + 1, val & ~0x80); outb(TSIDX, 0x01); outb(TSREG, val | 0x20);
outb(crtc_addr, 0x17); val = inb(crtc_addr + 1);
outb(crtc_addr + 1, val & ~0x80);
break;
case KD_EGA:
/* not yet done XXX */
break;
case KD_CGA:
outb(crtc_addr + 4, 0x25);
break;
case KD_MONO:
case KD_HERCULES:
outb(crtc_addr + 4, 0x21);
break;
default:
break;
}
} }
else { else {
outb(TSIDX, 0x01); val = inb(TSREG); switch (crtc_type) {
outb(TSIDX, 0x01); outb(TSREG, val & 0xDF); case KD_VGA:
outb(crtc_addr, 0x17); val = inb(crtc_addr + 1); outb(TSIDX, 0x01); val = inb(TSREG);
outb(crtc_addr + 1, val | 0x80); outb(TSIDX, 0x01); outb(TSREG, val & 0xDF);
outb(crtc_addr, 0x17); val = inb(crtc_addr + 1);
outb(crtc_addr + 1, val | 0x80);
break;
case KD_EGA:
/* not yet done XXX */
break;
case KD_CGA:
outb(crtc_addr + 4, 0x2d);
break;
case KD_MONO:
case KD_HERCULES:
outb(crtc_addr + 4, 0x29);
break;
default:
break;
}
scrn_blanked = 0; scrn_blanked = 0;
} }
} }
@ -63,8 +95,21 @@ green_saver(int blank)
static int static int
green_saver_load(struct lkm_table *lkmtp, int cmd) green_saver_load(struct lkm_table *lkmtp, int cmd)
{ {
if (!crtc_vga) switch (crtc_type) {
return EINVAL; case KD_MONO:
case KD_HERCULES:
case KD_CGA:
/*
* `green' saver is not fully implemented for MDA and CGA.
* It simply blanks the display instead.
*/
case KD_VGA:
break;
case KD_EGA:
/* EGA is yet to be supported */
default:
return ENODEV;
}
return add_scrn_saver(green_saver); return add_scrn_saver(green_saver);
} }

View File

@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
* $Id: saver.h,v 1.8 1997/05/21 14:18:00 yokota Exp $ * $Id: saver.h,v 1.9 1997/07/15 14:48:11 yokota Exp $
*/ */
#include <machine/apm_bios.h> #include <machine/apm_bios.h>
@ -36,7 +36,7 @@
extern scr_stat *cur_console; extern scr_stat *cur_console;
extern u_short *Crtat; extern u_short *Crtat;
extern u_int crtc_addr; extern u_int crtc_addr;
extern char crtc_vga; extern char crtc_type;
extern char scr_map[]; extern char scr_map[];
extern int scrn_blanked; extern int scrn_blanked;
extern int fonts_loaded; extern int fonts_loaded;

View File

@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
* $Id: blank_saver.c,v 1.9 1997/04/06 10:48:10 dufault Exp $ * $Id: blank_saver.c,v 1.10 1997/07/15 14:49:09 yokota Exp $
*/ */
#include <sys/param.h> #include <sys/param.h>
@ -46,12 +46,44 @@ blank_saver(int blank)
u_char val; u_char val;
if (blank) { if (blank) {
scrn_blanked = 1; scrn_blanked = 1;
outb(TSIDX, 0x01); val = inb(TSREG); switch (crtc_type) {
outb(TSIDX, 0x01); outb(TSREG, val | 0x20); case KD_VGA:
outb(TSIDX, 0x01); val = inb(TSREG);
outb(TSIDX, 0x01); outb(TSREG, val | 0x20);
break;
case KD_EGA:
/* not yet done XXX */
break;
case KD_CGA:
outb(crtc_addr + 4, 0x25);
break;
case KD_MONO:
case KD_HERCULES:
outb(crtc_addr + 4, 0x21);
break;
default:
break;
}
} }
else { else {
outb(TSIDX, 0x01); val = inb(TSREG); switch (crtc_type) {
outb(TSIDX, 0x01); outb(TSREG, val & 0xDF); case KD_VGA:
outb(TSIDX, 0x01); val = inb(TSREG);
outb(TSIDX, 0x01); outb(TSREG, val & 0xDF);
break;
case KD_EGA:
/* not yet done XXX */
break;
case KD_CGA:
outb(crtc_addr + 4, 0x2d);
break;
case KD_MONO:
case KD_HERCULES:
outb(crtc_addr + 4, 0x29);
break;
default:
break;
}
scrn_blanked = 0; scrn_blanked = 0;
} }
} }
@ -59,8 +91,17 @@ blank_saver(int blank)
static int static int
blank_saver_load(struct lkm_table *lkmtp, int cmd) blank_saver_load(struct lkm_table *lkmtp, int cmd)
{ {
if (!crtc_vga) switch (crtc_type) {
return EINVAL; case KD_MONO:
case KD_HERCULES:
case KD_CGA:
case KD_VGA:
break;
case KD_EGA:
/* EGA is yet to be supported */
default:
return ENODEV;
}
return add_scrn_saver(blank_saver); return add_scrn_saver(blank_saver);
} }

View File

@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
* $Id: fade_saver.c,v 1.10 1997/04/06 10:48:18 dufault Exp $ * $Id: fade_saver.c,v 1.11 1997/07/15 14:49:25 yokota Exp $
*/ */
#include <sys/param.h> #include <sys/param.h>
@ -48,34 +48,80 @@ fade_saver(int blank)
if (blank) { if (blank) {
scrn_blanked = 1; scrn_blanked = 1;
if (count < 64) { switch (crtc_type) {
outb(PIXMASK, 0xFF); /* no pixelmask */ case KD_VGA:
outb(PALWADR, 0x00); if (count < 64) {
outb(PALDATA, 0); outb(PIXMASK, 0xFF); /* no pixelmask */
outb(PALDATA, 0); outb(PALWADR, 0x00);
outb(PALDATA, 0); outb(PALDATA, 0);
for (i = 3; i < 768; i++) { outb(PALDATA, 0);
if (palette[i] - count > 15) outb(PALDATA, 0);
outb(PALDATA, palette[i]-count); for (i = 3; i < 768; i++) {
else if (palette[i] - count > 15)
outb(PALDATA, 15); outb(PALDATA, palette[i]-count);
else
outb(PALDATA, 15);
}
inb(crtc_addr+6); /* reset flip/flop */
outb(ATC, 0x20); /* enable palette */
count++;
} }
inb(crtc_addr+6); /* reset flip/flop */ break;
outb(ATC, 0x20); /* enable palette */ case KD_EGA:
count++; /* not yet done XXX */
break;
case KD_CGA:
outb(crtc_addr + 4, 0x25);
break;
case KD_MONO:
case KD_HERCULES:
outb(crtc_addr + 4, 0x21);
break;
default:
break;
} }
} }
else { else {
load_palette(palette); switch (crtc_type) {
count = scrn_blanked = 0; case KD_VGA:
load_palette(palette);
count = 0;
break;
case KD_EGA:
/* not yet done XXX */
break;
case KD_CGA:
outb(crtc_addr + 4, 0x2d);
break;
case KD_MONO:
case KD_HERCULES:
outb(crtc_addr + 4, 0x29);
break;
default:
break;
}
scrn_blanked = 0;
} }
} }
static int static int
fade_saver_load(struct lkm_table *lkmtp, int cmd) fade_saver_load(struct lkm_table *lkmtp, int cmd)
{ {
if (!crtc_vga) switch (crtc_type) {
return EINVAL; case KD_MONO:
case KD_HERCULES:
case KD_CGA:
/*
* `fade' saver is not fully implemented for MDA and CGA.
* It simply blanks the display instead.
*/
case KD_VGA:
break;
case KD_EGA:
/* EGA is yet to be supported */
default:
return ENODEV;
}
return add_scrn_saver(fade_saver); return add_scrn_saver(fade_saver);
} }

View File

@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
* $Id: green_saver.c,v 1.9 1997/04/06 10:49:13 dufault Exp $ * $Id: green_saver.c,v 1.10 1997/07/15 14:49:29 yokota Exp $
*/ */
#include <sys/param.h> #include <sys/param.h>
@ -46,16 +46,48 @@ green_saver(int blank)
u_char val; u_char val;
if (blank) { if (blank) {
scrn_blanked = 1; scrn_blanked = 1;
outb(TSIDX, 0x01); val = inb(TSREG); switch (crtc_type) {
outb(TSIDX, 0x01); outb(TSREG, val | 0x20); case KD_VGA:
outb(crtc_addr, 0x17); val = inb(crtc_addr + 1); outb(TSIDX, 0x01); val = inb(TSREG);
outb(crtc_addr + 1, val & ~0x80); outb(TSIDX, 0x01); outb(TSREG, val | 0x20);
outb(crtc_addr, 0x17); val = inb(crtc_addr + 1);
outb(crtc_addr + 1, val & ~0x80);
break;
case KD_EGA:
/* not yet done XXX */
break;
case KD_CGA:
outb(crtc_addr + 4, 0x25);
break;
case KD_MONO:
case KD_HERCULES:
outb(crtc_addr + 4, 0x21);
break;
default:
break;
}
} }
else { else {
outb(TSIDX, 0x01); val = inb(TSREG); switch (crtc_type) {
outb(TSIDX, 0x01); outb(TSREG, val & 0xDF); case KD_VGA:
outb(crtc_addr, 0x17); val = inb(crtc_addr + 1); outb(TSIDX, 0x01); val = inb(TSREG);
outb(crtc_addr + 1, val | 0x80); outb(TSIDX, 0x01); outb(TSREG, val & 0xDF);
outb(crtc_addr, 0x17); val = inb(crtc_addr + 1);
outb(crtc_addr + 1, val | 0x80);
break;
case KD_EGA:
/* not yet done XXX */
break;
case KD_CGA:
outb(crtc_addr + 4, 0x2d);
break;
case KD_MONO:
case KD_HERCULES:
outb(crtc_addr + 4, 0x29);
break;
default:
break;
}
scrn_blanked = 0; scrn_blanked = 0;
} }
} }
@ -63,8 +95,21 @@ green_saver(int blank)
static int static int
green_saver_load(struct lkm_table *lkmtp, int cmd) green_saver_load(struct lkm_table *lkmtp, int cmd)
{ {
if (!crtc_vga) switch (crtc_type) {
return EINVAL; case KD_MONO:
case KD_HERCULES:
case KD_CGA:
/*
* `green' saver is not fully implemented for MDA and CGA.
* It simply blanks the display instead.
*/
case KD_VGA:
break;
case KD_EGA:
/* EGA is yet to be supported */
default:
return ENODEV;
}
return add_scrn_saver(green_saver); return add_scrn_saver(green_saver);
} }

View File

@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
* $Id: blank_saver.c,v 1.9 1997/04/06 10:48:10 dufault Exp $ * $Id: blank_saver.c,v 1.10 1997/07/15 14:49:09 yokota Exp $
*/ */
#include <sys/param.h> #include <sys/param.h>
@ -46,12 +46,44 @@ blank_saver(int blank)
u_char val; u_char val;
if (blank) { if (blank) {
scrn_blanked = 1; scrn_blanked = 1;
outb(TSIDX, 0x01); val = inb(TSREG); switch (crtc_type) {
outb(TSIDX, 0x01); outb(TSREG, val | 0x20); case KD_VGA:
outb(TSIDX, 0x01); val = inb(TSREG);
outb(TSIDX, 0x01); outb(TSREG, val | 0x20);
break;
case KD_EGA:
/* not yet done XXX */
break;
case KD_CGA:
outb(crtc_addr + 4, 0x25);
break;
case KD_MONO:
case KD_HERCULES:
outb(crtc_addr + 4, 0x21);
break;
default:
break;
}
} }
else { else {
outb(TSIDX, 0x01); val = inb(TSREG); switch (crtc_type) {
outb(TSIDX, 0x01); outb(TSREG, val & 0xDF); case KD_VGA:
outb(TSIDX, 0x01); val = inb(TSREG);
outb(TSIDX, 0x01); outb(TSREG, val & 0xDF);
break;
case KD_EGA:
/* not yet done XXX */
break;
case KD_CGA:
outb(crtc_addr + 4, 0x2d);
break;
case KD_MONO:
case KD_HERCULES:
outb(crtc_addr + 4, 0x29);
break;
default:
break;
}
scrn_blanked = 0; scrn_blanked = 0;
} }
} }
@ -59,8 +91,17 @@ blank_saver(int blank)
static int static int
blank_saver_load(struct lkm_table *lkmtp, int cmd) blank_saver_load(struct lkm_table *lkmtp, int cmd)
{ {
if (!crtc_vga) switch (crtc_type) {
return EINVAL; case KD_MONO:
case KD_HERCULES:
case KD_CGA:
case KD_VGA:
break;
case KD_EGA:
/* EGA is yet to be supported */
default:
return ENODEV;
}
return add_scrn_saver(blank_saver); return add_scrn_saver(blank_saver);
} }

View File

@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
* $Id: fade_saver.c,v 1.10 1997/04/06 10:48:18 dufault Exp $ * $Id: fade_saver.c,v 1.11 1997/07/15 14:49:25 yokota Exp $
*/ */
#include <sys/param.h> #include <sys/param.h>
@ -48,34 +48,80 @@ fade_saver(int blank)
if (blank) { if (blank) {
scrn_blanked = 1; scrn_blanked = 1;
if (count < 64) { switch (crtc_type) {
outb(PIXMASK, 0xFF); /* no pixelmask */ case KD_VGA:
outb(PALWADR, 0x00); if (count < 64) {
outb(PALDATA, 0); outb(PIXMASK, 0xFF); /* no pixelmask */
outb(PALDATA, 0); outb(PALWADR, 0x00);
outb(PALDATA, 0); outb(PALDATA, 0);
for (i = 3; i < 768; i++) { outb(PALDATA, 0);
if (palette[i] - count > 15) outb(PALDATA, 0);
outb(PALDATA, palette[i]-count); for (i = 3; i < 768; i++) {
else if (palette[i] - count > 15)
outb(PALDATA, 15); outb(PALDATA, palette[i]-count);
else
outb(PALDATA, 15);
}
inb(crtc_addr+6); /* reset flip/flop */
outb(ATC, 0x20); /* enable palette */
count++;
} }
inb(crtc_addr+6); /* reset flip/flop */ break;
outb(ATC, 0x20); /* enable palette */ case KD_EGA:
count++; /* not yet done XXX */
break;
case KD_CGA:
outb(crtc_addr + 4, 0x25);
break;
case KD_MONO:
case KD_HERCULES:
outb(crtc_addr + 4, 0x21);
break;
default:
break;
} }
} }
else { else {
load_palette(palette); switch (crtc_type) {
count = scrn_blanked = 0; case KD_VGA:
load_palette(palette);
count = 0;
break;
case KD_EGA:
/* not yet done XXX */
break;
case KD_CGA:
outb(crtc_addr + 4, 0x2d);
break;
case KD_MONO:
case KD_HERCULES:
outb(crtc_addr + 4, 0x29);
break;
default:
break;
}
scrn_blanked = 0;
} }
} }
static int static int
fade_saver_load(struct lkm_table *lkmtp, int cmd) fade_saver_load(struct lkm_table *lkmtp, int cmd)
{ {
if (!crtc_vga) switch (crtc_type) {
return EINVAL; case KD_MONO:
case KD_HERCULES:
case KD_CGA:
/*
* `fade' saver is not fully implemented for MDA and CGA.
* It simply blanks the display instead.
*/
case KD_VGA:
break;
case KD_EGA:
/* EGA is yet to be supported */
default:
return ENODEV;
}
return add_scrn_saver(fade_saver); return add_scrn_saver(fade_saver);
} }

View File

@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
* $Id: green_saver.c,v 1.9 1997/04/06 10:49:13 dufault Exp $ * $Id: green_saver.c,v 1.10 1997/07/15 14:49:29 yokota Exp $
*/ */
#include <sys/param.h> #include <sys/param.h>
@ -46,16 +46,48 @@ green_saver(int blank)
u_char val; u_char val;
if (blank) { if (blank) {
scrn_blanked = 1; scrn_blanked = 1;
outb(TSIDX, 0x01); val = inb(TSREG); switch (crtc_type) {
outb(TSIDX, 0x01); outb(TSREG, val | 0x20); case KD_VGA:
outb(crtc_addr, 0x17); val = inb(crtc_addr + 1); outb(TSIDX, 0x01); val = inb(TSREG);
outb(crtc_addr + 1, val & ~0x80); outb(TSIDX, 0x01); outb(TSREG, val | 0x20);
outb(crtc_addr, 0x17); val = inb(crtc_addr + 1);
outb(crtc_addr + 1, val & ~0x80);
break;
case KD_EGA:
/* not yet done XXX */
break;
case KD_CGA:
outb(crtc_addr + 4, 0x25);
break;
case KD_MONO:
case KD_HERCULES:
outb(crtc_addr + 4, 0x21);
break;
default:
break;
}
} }
else { else {
outb(TSIDX, 0x01); val = inb(TSREG); switch (crtc_type) {
outb(TSIDX, 0x01); outb(TSREG, val & 0xDF); case KD_VGA:
outb(crtc_addr, 0x17); val = inb(crtc_addr + 1); outb(TSIDX, 0x01); val = inb(TSREG);
outb(crtc_addr + 1, val | 0x80); outb(TSIDX, 0x01); outb(TSREG, val & 0xDF);
outb(crtc_addr, 0x17); val = inb(crtc_addr + 1);
outb(crtc_addr + 1, val | 0x80);
break;
case KD_EGA:
/* not yet done XXX */
break;
case KD_CGA:
outb(crtc_addr + 4, 0x2d);
break;
case KD_MONO:
case KD_HERCULES:
outb(crtc_addr + 4, 0x29);
break;
default:
break;
}
scrn_blanked = 0; scrn_blanked = 0;
} }
} }
@ -63,8 +95,21 @@ green_saver(int blank)
static int static int
green_saver_load(struct lkm_table *lkmtp, int cmd) green_saver_load(struct lkm_table *lkmtp, int cmd)
{ {
if (!crtc_vga) switch (crtc_type) {
return EINVAL; case KD_MONO:
case KD_HERCULES:
case KD_CGA:
/*
* `green' saver is not fully implemented for MDA and CGA.
* It simply blanks the display instead.
*/
case KD_VGA:
break;
case KD_EGA:
/* EGA is yet to be supported */
default:
return ENODEV;
}
return add_scrn_saver(green_saver); return add_scrn_saver(green_saver);
} }

View File

@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
* $Id: saver.h,v 1.8 1997/05/21 14:18:00 yokota Exp $ * $Id: saver.h,v 1.9 1997/07/15 14:48:11 yokota Exp $
*/ */
#include <machine/apm_bios.h> #include <machine/apm_bios.h>
@ -36,7 +36,7 @@
extern scr_stat *cur_console; extern scr_stat *cur_console;
extern u_short *Crtat; extern u_short *Crtat;
extern u_int crtc_addr; extern u_int crtc_addr;
extern char crtc_vga; extern char crtc_type;
extern char scr_map[]; extern char scr_map[];
extern int scrn_blanked; extern int scrn_blanked;
extern int fonts_loaded; extern int fonts_loaded;