Next syscons update (given up on numbering :)

Removed screensavers from syscons, they are now LKM's. This makes it
possible to do some really "interesting" screensavers...
Fixed bug that sometimes caused garbage to appear when leaving
"scroll-lock" history.
Reformattet indentation, it got too deep for a normal 80 pos screen.
Split up in syscons.c & syscons.h for use with the saver-lkm's.
Temporarily removed -s option from vidcontrol, savers should now
be loaded with modload.
This commit is contained in:
Søren Schmidt 1995-02-22 13:48:07 +00:00
parent dd33263156
commit 17ee9d00bc
39 changed files with 10056 additions and 9108 deletions

View File

@ -1,7 +1,7 @@
# $Id: Makefile,v 1.6 1994/10/16 20:39:52 sos Exp $
# $Id: Makefile,v 1.7 1995/01/30 14:21:46 ugen Exp $
SUBDIR= cd9660 coff fdesc ibcs2 ip_mroute_mod ipfw kernfs msdos nfs nullfs \
portal procfs socksys umapfs union
portal procfs socksys syscons umapfs union
#
# Doesn't work:
# mfs

5
lkm/syscons/Makefile Normal file
View File

@ -0,0 +1,5 @@
# $Id$
SUBDIR= blank fade green snake star
.include <bsd.subdir.mk>

View File

@ -0,0 +1,10 @@
# $Id$
BINDIR= ${DESTDIR}/lkm
KMOD= blank_saver_mod
SRCS= blank_saver.c
NOMAN=
CFLAGS+= -DLKM -I${.CURDIR}/.. -I${.CURDIR}/../../../sys
.include <bsd.kmod.mk>

View File

@ -0,0 +1,81 @@
/*-
* Copyright (c) 1995 Søren Schmidt
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer
* in this position and unchanged.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software withough specific prior written permission
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id$
*/
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/conf.h>
#include <sys/exec.h>
#include <sys/sysent.h>
#include <sys/lkm.h>
#include <sys/errno.h>
#include <saver.h>
MOD_MISC("blank_saver")
void (*current_saver)();
void (*old_saver)();
static void
blank_saver(int blank)
{
u_char val;
if (blank) {
scrn_blanked = 1;
outb(TSIDX, 0x01); val = inb(TSREG);
outb(TSIDX, 0x01); outb(TSREG, val | 0x20);
}
else {
outb(TSIDX, 0x01); val = inb(TSREG);
outb(TSIDX, 0x01); outb(TSREG, val & 0xDF);
scrn_blanked = 0;
}
}
saver_load(struct lkm_table *lkmtp, int cmd)
{
(*current_saver)(0);
old_saver = current_saver;
current_saver = blank_saver;
uprintf("blank screen saver installed\n");
return 0;
}
saver_unload(struct lkm_table *lkmtp, int cmd)
{
(*current_saver)(0);
current_saver = old_saver;
uprintf("blank screen saver removed\n");
return 0;
}
saver_init(struct lkm_table *lkmtp, int cmd, int ver)
{
DISPATCH(lkmtp, cmd, ver, saver_load, saver_unload, nosys);
}

10
lkm/syscons/fade/Makefile Normal file
View File

@ -0,0 +1,10 @@
# $Id$
BINDIR= ${DESTDIR}/lkm
KMOD= fade_saver_mod
SRCS= fade_saver.c
NOMAN=
CFLAGS+= -DLKM -I${.CURDIR}/.. -I${.CURDIR}/../../../sys
.include <bsd.kmod.mk>

View File

@ -0,0 +1,96 @@
/*-
* Copyright (c) 1995 Søren Schmidt
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer
* in this position and unchanged.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software withough specific prior written permission
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id$
*/
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/conf.h>
#include <sys/exec.h>
#include <sys/sysent.h>
#include <sys/lkm.h>
#include <sys/errno.h>
#include <saver.h>
MOD_MISC("fade_saver")
void (*current_saver)();
void (*old_saver)();
static void
fade_saver(int blank)
{
static int count = 0;
int i;
if (blank) {
scrn_blanked = 1;
if (count < 64) {
outb(PIXMASK, 0xFF); /* no pixelmask */
outb(PALWADR, 0x00);
outb(PALDATA, 0);
outb(PALDATA, 0);
outb(PALDATA, 0);
for (i = 3; i < 768; i++) {
if (palette[i] - count > 15)
outb(PALDATA, palette[i]-count);
else
outb(PALDATA, 15);
}
inb(crtc_addr+6); /* reset flip/flop */
outb(ATC, 0x20); /* enable palette */
count++;
}
}
else {
load_palette();
count = scrn_blanked = 0;
}
}
saver_load(struct lkm_table *lkmtp, int cmd)
{
(*current_saver)(0);
old_saver = current_saver;
current_saver = fade_saver;
uprintf("fade screen saver installed\n");
return 0;
}
saver_unload(struct lkm_table *lkmtp, int cmd)
{
(*current_saver)(0);
current_saver = old_saver;
uprintf("fade screen saver removed\n");
return 0;
}
saver_init(struct lkm_table *lkmtp, int cmd, int ver)
{
DISPATCH(lkmtp, cmd, ver, saver_load, saver_unload, nosys);
}

View File

@ -0,0 +1,10 @@
# $Id$
BINDIR= ${DESTDIR}/lkm
KMOD= green_saver_mod
SRCS= green_saver.c
NOMAN=
CFLAGS+= -DLKM -I${.CURDIR}/.. -I${.CURDIR}/../../../sys
.include <bsd.kmod.mk>

View File

@ -0,0 +1,85 @@
/*-
* Copyright (c) 1995 Søren Schmidt
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer
* in this position and unchanged.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software withough specific prior written permission
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id$
*/
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/conf.h>
#include <sys/exec.h>
#include <sys/sysent.h>
#include <sys/lkm.h>
#include <sys/errno.h>
#include <saver.h>
MOD_MISC("green_saver")
void (*current_saver)();
void (*old_saver)();
static void
green_saver(int blank)
{
u_char val;
if (blank) {
scrn_blanked = 1;
outb(TSIDX, 0x01); val = inb(TSREG);
outb(TSIDX, 0x01); outb(TSREG, val | 0x20);
outb(crtc_addr, 0x17); val = inb(crtc_addr + 1);
outb(crtc_addr + 1, val & ~0x80);
}
else {
outb(TSIDX, 0x01); val = inb(TSREG);
outb(TSIDX, 0x01); outb(TSREG, val & 0xDF);
outb(crtc_addr, 0x17); val = inb(crtc_addr + 1);
outb(crtc_addr + 1, val | 0x80);
scrn_blanked = 0;
}
}
saver_load(struct lkm_table *lkmtp, int cmd)
{
(*current_saver)(0);
old_saver = current_saver;
current_saver = green_saver;
uprintf("green screen saver installed\n");
return 0;
}
saver_unload(struct lkm_table *lkmtp, int cmd)
{
(*current_saver)(0);
current_saver = old_saver;
uprintf("green screen saver removed\n");
return 0;
}
saver_init(struct lkm_table *lkmtp, int cmd, int ver)
{
DISPATCH(lkmtp, cmd, ver, saver_load, saver_unload, nosys);
}

16
lkm/syscons/saver.h Normal file
View File

@ -0,0 +1,16 @@
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/tty.h>
#include <i386/include/pc/display.h>
#include <i386/include/console.h>
#include <i386/i386/cons.h>
#include <i386/isa/isa.h>
#include <i386/isa/isa_device.h>
#include <i386/isa/syscons.h>
extern scr_stat *cur_console;
extern u_short *Crtat;
extern u_int crtc_addr;
extern char scr_map[];
extern int scrn_blanked;
extern char *palette;

View File

@ -0,0 +1,10 @@
# $Id$
BINDIR= ${DESTDIR}/lkm
KMOD= snake_saver_mod
SRCS= snake_saver.c
NOMAN=
CFLAGS+= -DLKM -I${.CURDIR}/.. -I${.CURDIR}/../../../sys
.include <bsd.kmod.mk>

View File

@ -0,0 +1,121 @@
/*-
* Copyright (c) 1995 Søren Schmidt
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer
* in this position and unchanged.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software withough specific prior written permission
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id$
*/
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/conf.h>
#include <sys/exec.h>
#include <sys/sysent.h>
#include <sys/lkm.h>
#include <sys/errno.h>
#include <saver.h>
MOD_MISC("snake_saver")
void (*current_saver)();
void (*old_saver)();
static void
snake_saver(int blank)
{
const char saves[] = {"FreeBSD-2.1"};
static u_char *savs[sizeof(saves)-1];
static int dirx, diry;
int f;
scr_stat *scp = cur_console;
if (blank) {
if (!scrn_blanked) {
fillw((FG_LIGHTGREY|BG_BLACK)<<8 | scr_map[0x20],
Crtat, scp->xsize * scp->ysize);
set_border(0);
dirx = (scp->xpos ? 1 : -1);
diry = (scp->ypos ?
scp->xsize : -scp->xsize);
for (f=0; f< sizeof(saves)-1; f++)
savs[f] = (u_char *)Crtat + 2 *
(scp->xpos+scp->ypos*scp->xsize);
*(savs[0]) = scr_map[*saves];
f = scp->ysize * scp->xsize + 5;
outb(crtc_addr, 14);
outb(crtc_addr+1, f >> 8);
outb(crtc_addr, 15);
outb(crtc_addr+1, f & 0xff);
scrn_blanked = 1;
}
if (scrn_blanked++ < 4)
return;
scrn_blanked = 1;
*(savs[sizeof(saves)-2]) = scr_map[0x20];
for (f=sizeof(saves)-2; f > 0; f--)
savs[f] = savs[f-1];
f = (savs[0] - (u_char *)Crtat) / 2;
if ((f % scp->xsize) == 0 ||
(f % scp->xsize) == scp->xsize - 1 ||
(random() % 50) == 0)
dirx = -dirx;
if ((f / scp->xsize) == 0 ||
(f / scp->xsize) == scp->ysize - 1 ||
(random() % 20) == 0)
diry = -diry;
savs[0] += 2*dirx + 2*diry;
for (f=sizeof(saves)-2; f>=0; f--)
*(savs[f]) = scr_map[saves[f]];
}
else {
if (scrn_blanked) {
set_border(scp->border);
scrn_blanked = 0;
scp->status |= UPDATE_SCREEN;
}
}
}
saver_load(struct lkm_table *lkmtp, int cmd)
{
(*current_saver)(0);
old_saver = current_saver;
current_saver = snake_saver;
uprintf("snake screen saver installed\n");
return 0;
}
saver_unload(struct lkm_table *lkmtp, int cmd)
{
(*current_saver)(0);
current_saver = old_saver;
uprintf("snake screen saver removed\n");
return 0;
}
saver_init(struct lkm_table *lkmtp, int cmd, int ver)
{
DISPATCH(lkmtp, cmd, ver, saver_load, saver_unload, nosys);
}

10
lkm/syscons/star/Makefile Normal file
View File

@ -0,0 +1,10 @@
# $Id$
BINDIR= ${DESTDIR}/lkm
KMOD= star_saver_mod
SRCS= star_saver.c
NOMAN=
CFLAGS+= -DLKM -I${.CURDIR}/.. -I${.CURDIR}/../../../sys
.include <bsd.kmod.mk>

View File

@ -0,0 +1,111 @@
/*-
* Copyright (c) 1995 Søren Schmidt
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer
* in this position and unchanged.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software withough specific prior written permission
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id$
*/
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/conf.h>
#include <sys/exec.h>
#include <sys/sysent.h>
#include <sys/lkm.h>
#include <sys/errno.h>
#include <saver.h>
MOD_MISC("star_saver")
void (*current_saver)();
void (*old_saver)();
#define NUM_STARS 50
/*
* Alternate saver that got its inspiration from a well known utility
* package for an inferior^H^H^H^H^H^Hfamous OS.
*/
void
star_saver(int blank)
{
scr_stat *scp = cur_console;
int cell, i;
char pattern[] = {"...........++++*** "};
char colors[] = {FG_DARKGREY, FG_LIGHTGREY,
FG_WHITE, FG_LIGHTCYAN};
static u_short stars[NUM_STARS][2];
if (blank) {
if (!scrn_blanked) {
scrn_blanked = 1;
fillw((FG_LIGHTGREY|BG_BLACK)<<8|scr_map[0x20], Crtat,
scp->xsize * scp->ysize);
set_border(0);
for(i=0; i<NUM_STARS; i++) {
stars[i][0] =
random() % (scp->xsize*scp->ysize);
stars[i][1] = 0;
}
}
cell = random() % NUM_STARS;
*((u_short*)(Crtat + stars[cell][0])) =
scr_map[pattern[stars[cell][1]]] |
colors[random()%sizeof(colors)] << 8;
if ((stars[cell][1]+=(random()%4)) >= sizeof(pattern)-1) {
stars[cell][0] = random() % (scp->xsize*scp->ysize);
stars[cell][1] = 0;
}
}
else {
if (scrn_blanked) {
set_border(scp->border);
scrn_blanked = 0;
scp->status |= UPDATE_SCREEN;
}
}
}
saver_load(struct lkm_table *lkmtp, int cmd)
{
(*current_saver)(0);
old_saver = current_saver;
current_saver = star_saver;
uprintf("star screen saver installed\n");
return 0;
}
saver_unload(struct lkm_table *lkmtp, int cmd)
{
(*current_saver)(0);
current_saver = old_saver;
uprintf("star screen saver removed\n");
return 0;
}
saver_init(struct lkm_table *lkmtp, int cmd, int ver)
{
DISPATCH(lkmtp, cmd, ver, saver_load, saver_unload, nosys);
}

View File

@ -0,0 +1,81 @@
/*-
* Copyright (c) 1995 Søren Schmidt
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer
* in this position and unchanged.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software withough specific prior written permission
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id$
*/
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/conf.h>
#include <sys/exec.h>
#include <sys/sysent.h>
#include <sys/lkm.h>
#include <sys/errno.h>
#include <saver.h>
MOD_MISC("blank_saver")
void (*current_saver)();
void (*old_saver)();
static void
blank_saver(int blank)
{
u_char val;
if (blank) {
scrn_blanked = 1;
outb(TSIDX, 0x01); val = inb(TSREG);
outb(TSIDX, 0x01); outb(TSREG, val | 0x20);
}
else {
outb(TSIDX, 0x01); val = inb(TSREG);
outb(TSIDX, 0x01); outb(TSREG, val & 0xDF);
scrn_blanked = 0;
}
}
saver_load(struct lkm_table *lkmtp, int cmd)
{
(*current_saver)(0);
old_saver = current_saver;
current_saver = blank_saver;
uprintf("blank screen saver installed\n");
return 0;
}
saver_unload(struct lkm_table *lkmtp, int cmd)
{
(*current_saver)(0);
current_saver = old_saver;
uprintf("blank screen saver removed\n");
return 0;
}
saver_init(struct lkm_table *lkmtp, int cmd, int ver)
{
DISPATCH(lkmtp, cmd, ver, saver_load, saver_unload, nosys);
}

View File

@ -0,0 +1,96 @@
/*-
* Copyright (c) 1995 Søren Schmidt
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer
* in this position and unchanged.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software withough specific prior written permission
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id$
*/
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/conf.h>
#include <sys/exec.h>
#include <sys/sysent.h>
#include <sys/lkm.h>
#include <sys/errno.h>
#include <saver.h>
MOD_MISC("fade_saver")
void (*current_saver)();
void (*old_saver)();
static void
fade_saver(int blank)
{
static int count = 0;
int i;
if (blank) {
scrn_blanked = 1;
if (count < 64) {
outb(PIXMASK, 0xFF); /* no pixelmask */
outb(PALWADR, 0x00);
outb(PALDATA, 0);
outb(PALDATA, 0);
outb(PALDATA, 0);
for (i = 3; i < 768; i++) {
if (palette[i] - count > 15)
outb(PALDATA, palette[i]-count);
else
outb(PALDATA, 15);
}
inb(crtc_addr+6); /* reset flip/flop */
outb(ATC, 0x20); /* enable palette */
count++;
}
}
else {
load_palette();
count = scrn_blanked = 0;
}
}
saver_load(struct lkm_table *lkmtp, int cmd)
{
(*current_saver)(0);
old_saver = current_saver;
current_saver = fade_saver;
uprintf("fade screen saver installed\n");
return 0;
}
saver_unload(struct lkm_table *lkmtp, int cmd)
{
(*current_saver)(0);
current_saver = old_saver;
uprintf("fade screen saver removed\n");
return 0;
}
saver_init(struct lkm_table *lkmtp, int cmd, int ver)
{
DISPATCH(lkmtp, cmd, ver, saver_load, saver_unload, nosys);
}

View File

@ -0,0 +1,85 @@
/*-
* Copyright (c) 1995 Søren Schmidt
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer
* in this position and unchanged.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software withough specific prior written permission
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id$
*/
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/conf.h>
#include <sys/exec.h>
#include <sys/sysent.h>
#include <sys/lkm.h>
#include <sys/errno.h>
#include <saver.h>
MOD_MISC("green_saver")
void (*current_saver)();
void (*old_saver)();
static void
green_saver(int blank)
{
u_char val;
if (blank) {
scrn_blanked = 1;
outb(TSIDX, 0x01); val = inb(TSREG);
outb(TSIDX, 0x01); outb(TSREG, val | 0x20);
outb(crtc_addr, 0x17); val = inb(crtc_addr + 1);
outb(crtc_addr + 1, val & ~0x80);
}
else {
outb(TSIDX, 0x01); val = inb(TSREG);
outb(TSIDX, 0x01); outb(TSREG, val & 0xDF);
outb(crtc_addr, 0x17); val = inb(crtc_addr + 1);
outb(crtc_addr + 1, val | 0x80);
scrn_blanked = 0;
}
}
saver_load(struct lkm_table *lkmtp, int cmd)
{
(*current_saver)(0);
old_saver = current_saver;
current_saver = green_saver;
uprintf("green screen saver installed\n");
return 0;
}
saver_unload(struct lkm_table *lkmtp, int cmd)
{
(*current_saver)(0);
current_saver = old_saver;
uprintf("green screen saver removed\n");
return 0;
}
saver_init(struct lkm_table *lkmtp, int cmd, int ver)
{
DISPATCH(lkmtp, cmd, ver, saver_load, saver_unload, nosys);
}

View File

@ -0,0 +1,121 @@
/*-
* Copyright (c) 1995 Søren Schmidt
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer
* in this position and unchanged.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software withough specific prior written permission
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id$
*/
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/conf.h>
#include <sys/exec.h>
#include <sys/sysent.h>
#include <sys/lkm.h>
#include <sys/errno.h>
#include <saver.h>
MOD_MISC("snake_saver")
void (*current_saver)();
void (*old_saver)();
static void
snake_saver(int blank)
{
const char saves[] = {"FreeBSD-2.1"};
static u_char *savs[sizeof(saves)-1];
static int dirx, diry;
int f;
scr_stat *scp = cur_console;
if (blank) {
if (!scrn_blanked) {
fillw((FG_LIGHTGREY|BG_BLACK)<<8 | scr_map[0x20],
Crtat, scp->xsize * scp->ysize);
set_border(0);
dirx = (scp->xpos ? 1 : -1);
diry = (scp->ypos ?
scp->xsize : -scp->xsize);
for (f=0; f< sizeof(saves)-1; f++)
savs[f] = (u_char *)Crtat + 2 *
(scp->xpos+scp->ypos*scp->xsize);
*(savs[0]) = scr_map[*saves];
f = scp->ysize * scp->xsize + 5;
outb(crtc_addr, 14);
outb(crtc_addr+1, f >> 8);
outb(crtc_addr, 15);
outb(crtc_addr+1, f & 0xff);
scrn_blanked = 1;
}
if (scrn_blanked++ < 4)
return;
scrn_blanked = 1;
*(savs[sizeof(saves)-2]) = scr_map[0x20];
for (f=sizeof(saves)-2; f > 0; f--)
savs[f] = savs[f-1];
f = (savs[0] - (u_char *)Crtat) / 2;
if ((f % scp->xsize) == 0 ||
(f % scp->xsize) == scp->xsize - 1 ||
(random() % 50) == 0)
dirx = -dirx;
if ((f / scp->xsize) == 0 ||
(f / scp->xsize) == scp->ysize - 1 ||
(random() % 20) == 0)
diry = -diry;
savs[0] += 2*dirx + 2*diry;
for (f=sizeof(saves)-2; f>=0; f--)
*(savs[f]) = scr_map[saves[f]];
}
else {
if (scrn_blanked) {
set_border(scp->border);
scrn_blanked = 0;
scp->status |= UPDATE_SCREEN;
}
}
}
saver_load(struct lkm_table *lkmtp, int cmd)
{
(*current_saver)(0);
old_saver = current_saver;
current_saver = snake_saver;
uprintf("snake screen saver installed\n");
return 0;
}
saver_unload(struct lkm_table *lkmtp, int cmd)
{
(*current_saver)(0);
current_saver = old_saver;
uprintf("snake screen saver removed\n");
return 0;
}
saver_init(struct lkm_table *lkmtp, int cmd, int ver)
{
DISPATCH(lkmtp, cmd, ver, saver_load, saver_unload, nosys);
}

View File

@ -0,0 +1,111 @@
/*-
* Copyright (c) 1995 Søren Schmidt
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer
* in this position and unchanged.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software withough specific prior written permission
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id$
*/
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/conf.h>
#include <sys/exec.h>
#include <sys/sysent.h>
#include <sys/lkm.h>
#include <sys/errno.h>
#include <saver.h>
MOD_MISC("star_saver")
void (*current_saver)();
void (*old_saver)();
#define NUM_STARS 50
/*
* Alternate saver that got its inspiration from a well known utility
* package for an inferior^H^H^H^H^H^Hfamous OS.
*/
void
star_saver(int blank)
{
scr_stat *scp = cur_console;
int cell, i;
char pattern[] = {"...........++++*** "};
char colors[] = {FG_DARKGREY, FG_LIGHTGREY,
FG_WHITE, FG_LIGHTCYAN};
static u_short stars[NUM_STARS][2];
if (blank) {
if (!scrn_blanked) {
scrn_blanked = 1;
fillw((FG_LIGHTGREY|BG_BLACK)<<8|scr_map[0x20], Crtat,
scp->xsize * scp->ysize);
set_border(0);
for(i=0; i<NUM_STARS; i++) {
stars[i][0] =
random() % (scp->xsize*scp->ysize);
stars[i][1] = 0;
}
}
cell = random() % NUM_STARS;
*((u_short*)(Crtat + stars[cell][0])) =
scr_map[pattern[stars[cell][1]]] |
colors[random()%sizeof(colors)] << 8;
if ((stars[cell][1]+=(random()%4)) >= sizeof(pattern)-1) {
stars[cell][0] = random() % (scp->xsize*scp->ysize);
stars[cell][1] = 0;
}
}
else {
if (scrn_blanked) {
set_border(scp->border);
scrn_blanked = 0;
scp->status |= UPDATE_SCREEN;
}
}
}
saver_load(struct lkm_table *lkmtp, int cmd)
{
(*current_saver)(0);
old_saver = current_saver;
current_saver = star_saver;
uprintf("star screen saver installed\n");
return 0;
}
saver_unload(struct lkm_table *lkmtp, int cmd)
{
(*current_saver)(0);
current_saver = old_saver;
uprintf("star screen saver removed\n");
return 0;
}
saver_init(struct lkm_table *lkmtp, int cmd, int ver)
{
DISPATCH(lkmtp, cmd, ver, saver_load, saver_unload, nosys);
}

File diff suppressed because it is too large Load Diff

203
sys/dev/syscons/syscons.h Normal file
View File

@ -0,0 +1,203 @@
/*-
* Copyright (c) 1995 Søren Schmidt
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer
* in this position and unchanged.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software withough specific prior written permission
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id$
*/
/* vm things */
#define ISMAPPED(pa, width) \
(((pa) <= (u_long)0x1000 - (width)) \
|| ((pa) >= 0xa0000 && (pa) <= 0x100000 - (width)))
#define pa_to_va(pa) (KERNBASE + (pa)) /* works if ISMAPPED(pa...) */
/* printable chars */
#define PRINTABLE(ch) (ch>0x1B || (ch>0x0d && ch<0x1b) || ch<0x07)
/* status flags */
#define LOCK_KEY_MASK 0x0000F
#define LED_MASK 0x00007
#define UNKNOWN_MODE 0x00010
#define KBD_RAW_MODE 0x00020
#define SWITCH_WAIT_REL 0x00040
#define SWITCH_WAIT_ACQ 0x00080
#define BUFFER_SAVED 0x00100
#define CURSOR_ENABLED 0x00200
#define CURSOR_SHOWN 0x00400
#define MOUSE_ENABLED 0x00800
#define UPDATE_MOUSE 0x01000
#define UPDATE_SCREEN 0x02000
/* configuration flags */
#define VISUAL_BELL 0x00001
#define BLINK_CURSOR 0x00002
#define CHAR_CURSOR 0x00004
/* video hardware memory addresses */
#define VIDEOMEM 0x000A0000
/* misc defines */
#define FALSE 0
#define TRUE 1
#define MAX_ESC_PAR 5
#define LOAD 1
#define SAVE 0
#define COL 80
#define ROW 25
#define BELL_DURATION 5
#define BELL_PITCH 800
#define TIMER_FREQ 1193182 /* should be in isa.h */
#define CONSOLE_BUFSIZE 1024
#define PCBURST 128
#define FONT_8 0x001
#define FONT_14 0x002
#define FONT_16 0x004
#define HISTORY_SIZE 100*80
/* defines related to hardware addresses */
#define MONO_BASE 0x3B4 /* crt controller base mono */
#define COLOR_BASE 0x3D4 /* crt controller base color */
#define MISC 0x3C2 /* misc output register */
#define ATC IO_VGA+0x00 /* attribute controller */
#define TSIDX IO_VGA+0x04 /* timing sequencer idx */
#define TSREG IO_VGA+0x05 /* timing sequencer data */
#define PIXMASK IO_VGA+0x06 /* pixel write mask */
#define PALRADR IO_VGA+0x07 /* palette read address */
#define PALWADR IO_VGA+0x08 /* palette write address */
#define PALDATA IO_VGA+0x09 /* palette data register */
#define GDCIDX IO_VGA+0x0E /* graph data controller idx */
#define GDCREG IO_VGA+0x0F /* graph data controller data */
/* special characters */
#define cntlc 0x03
#define cntld 0x04
#define bs 0x08
#define lf 0x0a
#define cr 0x0d
#define del 0x7f
typedef struct term_stat {
int esc; /* processing escape sequence */
int num_param; /* # of parameters to ESC */
int last_param; /* last parameter # */
int param[MAX_ESC_PAR]; /* contains ESC parameters */
int cur_attr; /* current attributes */
int std_attr; /* normal attributes */
int rev_attr; /* reverse attributes */
} term_stat;
typedef struct scr_stat {
u_short *scr_buf; /* buffer when off screen */
int xpos; /* current X position */
int ypos; /* current Y position */
int xsize; /* X size */
int ysize; /* Y size */
term_stat term; /* terminal emulation stuff */
int status; /* status (bitfield) */
u_short *cursor_pos; /* cursor buffer position */
u_short cursor_saveunder; /* saved chars under cursor */
char cursor_start; /* cursor start line # */
char cursor_end; /* cursor end line # */
u_short *mouse_pos; /* mouse buffer position */
u_short *mouse_oldpos; /* mouse old buffer position */
u_short mouse_saveunder[4]; /* saved chars under mouse */
short mouse_xpos; /* mouse x coordinate */
short mouse_ypos; /* mouse y coordinate */
u_char mouse_cursor[128]; /* mouse cursor bitmap store */
u_short bell_duration;
u_short bell_pitch;
u_char border; /* border color */
u_char mode; /* mode */
u_char font; /* font on this screen */
pid_t pid; /* pid of controlling proc */
struct proc *proc; /* proc* of controlling proc */
struct vt_mode smode; /* switch mode */
u_short *history; /* circular history buffer */
u_short *history_head; /* current head position */
u_short *history_pos; /* position shown on screen */
u_short *history_save; /* save area index */
int history_size; /* size of history buffer */
#if NAPM > 0
struct apmhook r_hook; /* reconfiguration support */
#endif
} scr_stat;
typedef struct default_attr {
int std_attr; /* normal attributes */
int rev_attr; /* reverse attributes */
} default_attr;
/* function prototypes */
int scprobe(struct isa_device *dev);
int scattach(struct isa_device *dev);
int scopen(dev_t dev, int flag, int mode, struct proc *p);
int scclose(dev_t dev, int flag, int mode, struct proc *p);
int scread(dev_t dev, struct uio *uio, int flag);
int scwrite(dev_t dev, struct uio *uio, int flag);
int scparam(struct tty *tp, struct termios *t);
int scioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p);
void scxint(dev_t dev);
void scstart(struct tty *tp);
void pccnprobe(struct consdev *cp);
void pccninit(struct consdev *cp);
void pccnputc(dev_t dev, char c);
int pccngetc(dev_t dev);
int pccncheckc(dev_t dev);
void scintr(int unit);
int pcmmap(dev_t dev, int offset, int nprot);
static void scinit(void);
static u_int scgetc(int noblock);
static struct tty *get_tty_ptr(dev_t dev);
static scr_stat *get_scr_stat(dev_t dev);
static scr_stat *alloc_scp();
static void init_scp(scr_stat *scp);
static int get_scr_num();
static void scrn_timer();
static void clear_screen(scr_stat *scp);
static int switch_scr(scr_stat *scp, u_int next_scr);
static void exchange_scr(void);
static inline void move_crsr(scr_stat *scp, int x, int y);
static void scan_esc(scr_stat *scp, u_char c);
static inline void draw_cursor(scr_stat *scp, int show);
static void ansi_put(scr_stat *scp, u_char *buf, int len);
static u_char *get_fstr(u_int c, u_int *len);
static void update_leds(int which);
static void history_to_screen(scr_stat *scp);
static int history_up_line(scr_stat *scp);
static int history_down_line(scr_stat *scp);
static void kbd_wait(void);
static void kbd_cmd(u_char command);
static void set_mode(scr_stat *scp);
void set_border(int color);
static void set_vgaregs(char *modetable);
static void set_font_mode();
static void set_normal_mode();
static void copy_font(int operation, int font_type, char* font_image);
static void draw_mouse_image(scr_stat *scp);
static void save_palette(void);
void load_palette(void);
static void do_bell(scr_stat *scp, int pitch, int duration);
static void blink_screen(scr_stat *scp);

File diff suppressed because it is too large Load Diff

203
sys/i386/isa/syscons.h Normal file
View File

@ -0,0 +1,203 @@
/*-
* Copyright (c) 1995 Søren Schmidt
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer
* in this position and unchanged.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software withough specific prior written permission
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id$
*/
/* vm things */
#define ISMAPPED(pa, width) \
(((pa) <= (u_long)0x1000 - (width)) \
|| ((pa) >= 0xa0000 && (pa) <= 0x100000 - (width)))
#define pa_to_va(pa) (KERNBASE + (pa)) /* works if ISMAPPED(pa...) */
/* printable chars */
#define PRINTABLE(ch) (ch>0x1B || (ch>0x0d && ch<0x1b) || ch<0x07)
/* status flags */
#define LOCK_KEY_MASK 0x0000F
#define LED_MASK 0x00007
#define UNKNOWN_MODE 0x00010
#define KBD_RAW_MODE 0x00020
#define SWITCH_WAIT_REL 0x00040
#define SWITCH_WAIT_ACQ 0x00080
#define BUFFER_SAVED 0x00100
#define CURSOR_ENABLED 0x00200
#define CURSOR_SHOWN 0x00400
#define MOUSE_ENABLED 0x00800
#define UPDATE_MOUSE 0x01000
#define UPDATE_SCREEN 0x02000
/* configuration flags */
#define VISUAL_BELL 0x00001
#define BLINK_CURSOR 0x00002
#define CHAR_CURSOR 0x00004
/* video hardware memory addresses */
#define VIDEOMEM 0x000A0000
/* misc defines */
#define FALSE 0
#define TRUE 1
#define MAX_ESC_PAR 5
#define LOAD 1
#define SAVE 0
#define COL 80
#define ROW 25
#define BELL_DURATION 5
#define BELL_PITCH 800
#define TIMER_FREQ 1193182 /* should be in isa.h */
#define CONSOLE_BUFSIZE 1024
#define PCBURST 128
#define FONT_8 0x001
#define FONT_14 0x002
#define FONT_16 0x004
#define HISTORY_SIZE 100*80
/* defines related to hardware addresses */
#define MONO_BASE 0x3B4 /* crt controller base mono */
#define COLOR_BASE 0x3D4 /* crt controller base color */
#define MISC 0x3C2 /* misc output register */
#define ATC IO_VGA+0x00 /* attribute controller */
#define TSIDX IO_VGA+0x04 /* timing sequencer idx */
#define TSREG IO_VGA+0x05 /* timing sequencer data */
#define PIXMASK IO_VGA+0x06 /* pixel write mask */
#define PALRADR IO_VGA+0x07 /* palette read address */
#define PALWADR IO_VGA+0x08 /* palette write address */
#define PALDATA IO_VGA+0x09 /* palette data register */
#define GDCIDX IO_VGA+0x0E /* graph data controller idx */
#define GDCREG IO_VGA+0x0F /* graph data controller data */
/* special characters */
#define cntlc 0x03
#define cntld 0x04
#define bs 0x08
#define lf 0x0a
#define cr 0x0d
#define del 0x7f
typedef struct term_stat {
int esc; /* processing escape sequence */
int num_param; /* # of parameters to ESC */
int last_param; /* last parameter # */
int param[MAX_ESC_PAR]; /* contains ESC parameters */
int cur_attr; /* current attributes */
int std_attr; /* normal attributes */
int rev_attr; /* reverse attributes */
} term_stat;
typedef struct scr_stat {
u_short *scr_buf; /* buffer when off screen */
int xpos; /* current X position */
int ypos; /* current Y position */
int xsize; /* X size */
int ysize; /* Y size */
term_stat term; /* terminal emulation stuff */
int status; /* status (bitfield) */
u_short *cursor_pos; /* cursor buffer position */
u_short cursor_saveunder; /* saved chars under cursor */
char cursor_start; /* cursor start line # */
char cursor_end; /* cursor end line # */
u_short *mouse_pos; /* mouse buffer position */
u_short *mouse_oldpos; /* mouse old buffer position */
u_short mouse_saveunder[4]; /* saved chars under mouse */
short mouse_xpos; /* mouse x coordinate */
short mouse_ypos; /* mouse y coordinate */
u_char mouse_cursor[128]; /* mouse cursor bitmap store */
u_short bell_duration;
u_short bell_pitch;
u_char border; /* border color */
u_char mode; /* mode */
u_char font; /* font on this screen */
pid_t pid; /* pid of controlling proc */
struct proc *proc; /* proc* of controlling proc */
struct vt_mode smode; /* switch mode */
u_short *history; /* circular history buffer */
u_short *history_head; /* current head position */
u_short *history_pos; /* position shown on screen */
u_short *history_save; /* save area index */
int history_size; /* size of history buffer */
#if NAPM > 0
struct apmhook r_hook; /* reconfiguration support */
#endif
} scr_stat;
typedef struct default_attr {
int std_attr; /* normal attributes */
int rev_attr; /* reverse attributes */
} default_attr;
/* function prototypes */
int scprobe(struct isa_device *dev);
int scattach(struct isa_device *dev);
int scopen(dev_t dev, int flag, int mode, struct proc *p);
int scclose(dev_t dev, int flag, int mode, struct proc *p);
int scread(dev_t dev, struct uio *uio, int flag);
int scwrite(dev_t dev, struct uio *uio, int flag);
int scparam(struct tty *tp, struct termios *t);
int scioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p);
void scxint(dev_t dev);
void scstart(struct tty *tp);
void pccnprobe(struct consdev *cp);
void pccninit(struct consdev *cp);
void pccnputc(dev_t dev, char c);
int pccngetc(dev_t dev);
int pccncheckc(dev_t dev);
void scintr(int unit);
int pcmmap(dev_t dev, int offset, int nprot);
static void scinit(void);
static u_int scgetc(int noblock);
static struct tty *get_tty_ptr(dev_t dev);
static scr_stat *get_scr_stat(dev_t dev);
static scr_stat *alloc_scp();
static void init_scp(scr_stat *scp);
static int get_scr_num();
static void scrn_timer();
static void clear_screen(scr_stat *scp);
static int switch_scr(scr_stat *scp, u_int next_scr);
static void exchange_scr(void);
static inline void move_crsr(scr_stat *scp, int x, int y);
static void scan_esc(scr_stat *scp, u_char c);
static inline void draw_cursor(scr_stat *scp, int show);
static void ansi_put(scr_stat *scp, u_char *buf, int len);
static u_char *get_fstr(u_int c, u_int *len);
static void update_leds(int which);
static void history_to_screen(scr_stat *scp);
static int history_up_line(scr_stat *scp);
static int history_down_line(scr_stat *scp);
static void kbd_wait(void);
static void kbd_cmd(u_char command);
static void set_mode(scr_stat *scp);
void set_border(int color);
static void set_vgaregs(char *modetable);
static void set_font_mode();
static void set_normal_mode();
static void copy_font(int operation, int font_type, char* font_image);
static void draw_mouse_image(scr_stat *scp);
static void save_palette(void);
void load_palette(void);
static void do_bell(scr_stat *scp, int pitch, int duration);
static void blink_screen(scr_stat *scp);

File diff suppressed because it is too large Load Diff

203
sys/isa/syscons.h Normal file
View File

@ -0,0 +1,203 @@
/*-
* Copyright (c) 1995 Søren Schmidt
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer
* in this position and unchanged.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software withough specific prior written permission
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id$
*/
/* vm things */
#define ISMAPPED(pa, width) \
(((pa) <= (u_long)0x1000 - (width)) \
|| ((pa) >= 0xa0000 && (pa) <= 0x100000 - (width)))
#define pa_to_va(pa) (KERNBASE + (pa)) /* works if ISMAPPED(pa...) */
/* printable chars */
#define PRINTABLE(ch) (ch>0x1B || (ch>0x0d && ch<0x1b) || ch<0x07)
/* status flags */
#define LOCK_KEY_MASK 0x0000F
#define LED_MASK 0x00007
#define UNKNOWN_MODE 0x00010
#define KBD_RAW_MODE 0x00020
#define SWITCH_WAIT_REL 0x00040
#define SWITCH_WAIT_ACQ 0x00080
#define BUFFER_SAVED 0x00100
#define CURSOR_ENABLED 0x00200
#define CURSOR_SHOWN 0x00400
#define MOUSE_ENABLED 0x00800
#define UPDATE_MOUSE 0x01000
#define UPDATE_SCREEN 0x02000
/* configuration flags */
#define VISUAL_BELL 0x00001
#define BLINK_CURSOR 0x00002
#define CHAR_CURSOR 0x00004
/* video hardware memory addresses */
#define VIDEOMEM 0x000A0000
/* misc defines */
#define FALSE 0
#define TRUE 1
#define MAX_ESC_PAR 5
#define LOAD 1
#define SAVE 0
#define COL 80
#define ROW 25
#define BELL_DURATION 5
#define BELL_PITCH 800
#define TIMER_FREQ 1193182 /* should be in isa.h */
#define CONSOLE_BUFSIZE 1024
#define PCBURST 128
#define FONT_8 0x001
#define FONT_14 0x002
#define FONT_16 0x004
#define HISTORY_SIZE 100*80
/* defines related to hardware addresses */
#define MONO_BASE 0x3B4 /* crt controller base mono */
#define COLOR_BASE 0x3D4 /* crt controller base color */
#define MISC 0x3C2 /* misc output register */
#define ATC IO_VGA+0x00 /* attribute controller */
#define TSIDX IO_VGA+0x04 /* timing sequencer idx */
#define TSREG IO_VGA+0x05 /* timing sequencer data */
#define PIXMASK IO_VGA+0x06 /* pixel write mask */
#define PALRADR IO_VGA+0x07 /* palette read address */
#define PALWADR IO_VGA+0x08 /* palette write address */
#define PALDATA IO_VGA+0x09 /* palette data register */
#define GDCIDX IO_VGA+0x0E /* graph data controller idx */
#define GDCREG IO_VGA+0x0F /* graph data controller data */
/* special characters */
#define cntlc 0x03
#define cntld 0x04
#define bs 0x08
#define lf 0x0a
#define cr 0x0d
#define del 0x7f
typedef struct term_stat {
int esc; /* processing escape sequence */
int num_param; /* # of parameters to ESC */
int last_param; /* last parameter # */
int param[MAX_ESC_PAR]; /* contains ESC parameters */
int cur_attr; /* current attributes */
int std_attr; /* normal attributes */
int rev_attr; /* reverse attributes */
} term_stat;
typedef struct scr_stat {
u_short *scr_buf; /* buffer when off screen */
int xpos; /* current X position */
int ypos; /* current Y position */
int xsize; /* X size */
int ysize; /* Y size */
term_stat term; /* terminal emulation stuff */
int status; /* status (bitfield) */
u_short *cursor_pos; /* cursor buffer position */
u_short cursor_saveunder; /* saved chars under cursor */
char cursor_start; /* cursor start line # */
char cursor_end; /* cursor end line # */
u_short *mouse_pos; /* mouse buffer position */
u_short *mouse_oldpos; /* mouse old buffer position */
u_short mouse_saveunder[4]; /* saved chars under mouse */
short mouse_xpos; /* mouse x coordinate */
short mouse_ypos; /* mouse y coordinate */
u_char mouse_cursor[128]; /* mouse cursor bitmap store */
u_short bell_duration;
u_short bell_pitch;
u_char border; /* border color */
u_char mode; /* mode */
u_char font; /* font on this screen */
pid_t pid; /* pid of controlling proc */
struct proc *proc; /* proc* of controlling proc */
struct vt_mode smode; /* switch mode */
u_short *history; /* circular history buffer */
u_short *history_head; /* current head position */
u_short *history_pos; /* position shown on screen */
u_short *history_save; /* save area index */
int history_size; /* size of history buffer */
#if NAPM > 0
struct apmhook r_hook; /* reconfiguration support */
#endif
} scr_stat;
typedef struct default_attr {
int std_attr; /* normal attributes */
int rev_attr; /* reverse attributes */
} default_attr;
/* function prototypes */
int scprobe(struct isa_device *dev);
int scattach(struct isa_device *dev);
int scopen(dev_t dev, int flag, int mode, struct proc *p);
int scclose(dev_t dev, int flag, int mode, struct proc *p);
int scread(dev_t dev, struct uio *uio, int flag);
int scwrite(dev_t dev, struct uio *uio, int flag);
int scparam(struct tty *tp, struct termios *t);
int scioctl(dev_t dev, int cmd, caddr_t data, int flag, struct proc *p);
void scxint(dev_t dev);
void scstart(struct tty *tp);
void pccnprobe(struct consdev *cp);
void pccninit(struct consdev *cp);
void pccnputc(dev_t dev, char c);
int pccngetc(dev_t dev);
int pccncheckc(dev_t dev);
void scintr(int unit);
int pcmmap(dev_t dev, int offset, int nprot);
static void scinit(void);
static u_int scgetc(int noblock);
static struct tty *get_tty_ptr(dev_t dev);
static scr_stat *get_scr_stat(dev_t dev);
static scr_stat *alloc_scp();
static void init_scp(scr_stat *scp);
static int get_scr_num();
static void scrn_timer();
static void clear_screen(scr_stat *scp);
static int switch_scr(scr_stat *scp, u_int next_scr);
static void exchange_scr(void);
static inline void move_crsr(scr_stat *scp, int x, int y);
static void scan_esc(scr_stat *scp, u_char c);
static inline void draw_cursor(scr_stat *scp, int show);
static void ansi_put(scr_stat *scp, u_char *buf, int len);
static u_char *get_fstr(u_int c, u_int *len);
static void update_leds(int which);
static void history_to_screen(scr_stat *scp);
static int history_up_line(scr_stat *scp);
static int history_down_line(scr_stat *scp);
static void kbd_wait(void);
static void kbd_cmd(u_char command);
static void set_mode(scr_stat *scp);
void set_border(int color);
static void set_vgaregs(char *modetable);
static void set_font_mode();
static void set_normal_mode();
static void copy_font(int operation, int font_type, char* font_image);
static void draw_mouse_image(scr_stat *scp);
static void save_palette(void);
void load_palette(void);
static void do_bell(scr_stat *scp, int pitch, int duration);
static void blink_screen(scr_stat *scp);

View File

@ -1,7 +1,7 @@
# $Id: Makefile,v 1.6 1994/10/16 20:39:52 sos Exp $
# $Id: Makefile,v 1.7 1995/01/30 14:21:46 ugen Exp $
SUBDIR= cd9660 coff fdesc ibcs2 ip_mroute_mod ipfw kernfs msdos nfs nullfs \
portal procfs socksys umapfs union
portal procfs socksys syscons umapfs union
#
# Doesn't work:
# mfs

View File

@ -0,0 +1,5 @@
# $Id$
SUBDIR= blank fade green snake star
.include <bsd.subdir.mk>

View File

@ -0,0 +1,10 @@
# $Id$
BINDIR= ${DESTDIR}/lkm
KMOD= blank_saver_mod
SRCS= blank_saver.c
NOMAN=
CFLAGS+= -DLKM -I${.CURDIR}/.. -I${.CURDIR}/../../../sys
.include <bsd.kmod.mk>

View File

@ -0,0 +1,81 @@
/*-
* Copyright (c) 1995 Søren Schmidt
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer
* in this position and unchanged.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software withough specific prior written permission
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id$
*/
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/conf.h>
#include <sys/exec.h>
#include <sys/sysent.h>
#include <sys/lkm.h>
#include <sys/errno.h>
#include <saver.h>
MOD_MISC("blank_saver")
void (*current_saver)();
void (*old_saver)();
static void
blank_saver(int blank)
{
u_char val;
if (blank) {
scrn_blanked = 1;
outb(TSIDX, 0x01); val = inb(TSREG);
outb(TSIDX, 0x01); outb(TSREG, val | 0x20);
}
else {
outb(TSIDX, 0x01); val = inb(TSREG);
outb(TSIDX, 0x01); outb(TSREG, val & 0xDF);
scrn_blanked = 0;
}
}
saver_load(struct lkm_table *lkmtp, int cmd)
{
(*current_saver)(0);
old_saver = current_saver;
current_saver = blank_saver;
uprintf("blank screen saver installed\n");
return 0;
}
saver_unload(struct lkm_table *lkmtp, int cmd)
{
(*current_saver)(0);
current_saver = old_saver;
uprintf("blank screen saver removed\n");
return 0;
}
saver_init(struct lkm_table *lkmtp, int cmd, int ver)
{
DISPATCH(lkmtp, cmd, ver, saver_load, saver_unload, nosys);
}

View File

@ -0,0 +1,10 @@
# $Id$
BINDIR= ${DESTDIR}/lkm
KMOD= fade_saver_mod
SRCS= fade_saver.c
NOMAN=
CFLAGS+= -DLKM -I${.CURDIR}/.. -I${.CURDIR}/../../../sys
.include <bsd.kmod.mk>

View File

@ -0,0 +1,96 @@
/*-
* Copyright (c) 1995 Søren Schmidt
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer
* in this position and unchanged.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software withough specific prior written permission
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id$
*/
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/conf.h>
#include <sys/exec.h>
#include <sys/sysent.h>
#include <sys/lkm.h>
#include <sys/errno.h>
#include <saver.h>
MOD_MISC("fade_saver")
void (*current_saver)();
void (*old_saver)();
static void
fade_saver(int blank)
{
static int count = 0;
int i;
if (blank) {
scrn_blanked = 1;
if (count < 64) {
outb(PIXMASK, 0xFF); /* no pixelmask */
outb(PALWADR, 0x00);
outb(PALDATA, 0);
outb(PALDATA, 0);
outb(PALDATA, 0);
for (i = 3; i < 768; i++) {
if (palette[i] - count > 15)
outb(PALDATA, palette[i]-count);
else
outb(PALDATA, 15);
}
inb(crtc_addr+6); /* reset flip/flop */
outb(ATC, 0x20); /* enable palette */
count++;
}
}
else {
load_palette();
count = scrn_blanked = 0;
}
}
saver_load(struct lkm_table *lkmtp, int cmd)
{
(*current_saver)(0);
old_saver = current_saver;
current_saver = fade_saver;
uprintf("fade screen saver installed\n");
return 0;
}
saver_unload(struct lkm_table *lkmtp, int cmd)
{
(*current_saver)(0);
current_saver = old_saver;
uprintf("fade screen saver removed\n");
return 0;
}
saver_init(struct lkm_table *lkmtp, int cmd, int ver)
{
DISPATCH(lkmtp, cmd, ver, saver_load, saver_unload, nosys);
}

View File

@ -0,0 +1,10 @@
# $Id$
BINDIR= ${DESTDIR}/lkm
KMOD= green_saver_mod
SRCS= green_saver.c
NOMAN=
CFLAGS+= -DLKM -I${.CURDIR}/.. -I${.CURDIR}/../../../sys
.include <bsd.kmod.mk>

View File

@ -0,0 +1,85 @@
/*-
* Copyright (c) 1995 Søren Schmidt
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer
* in this position and unchanged.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software withough specific prior written permission
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id$
*/
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/conf.h>
#include <sys/exec.h>
#include <sys/sysent.h>
#include <sys/lkm.h>
#include <sys/errno.h>
#include <saver.h>
MOD_MISC("green_saver")
void (*current_saver)();
void (*old_saver)();
static void
green_saver(int blank)
{
u_char val;
if (blank) {
scrn_blanked = 1;
outb(TSIDX, 0x01); val = inb(TSREG);
outb(TSIDX, 0x01); outb(TSREG, val | 0x20);
outb(crtc_addr, 0x17); val = inb(crtc_addr + 1);
outb(crtc_addr + 1, val & ~0x80);
}
else {
outb(TSIDX, 0x01); val = inb(TSREG);
outb(TSIDX, 0x01); outb(TSREG, val & 0xDF);
outb(crtc_addr, 0x17); val = inb(crtc_addr + 1);
outb(crtc_addr + 1, val | 0x80);
scrn_blanked = 0;
}
}
saver_load(struct lkm_table *lkmtp, int cmd)
{
(*current_saver)(0);
old_saver = current_saver;
current_saver = green_saver;
uprintf("green screen saver installed\n");
return 0;
}
saver_unload(struct lkm_table *lkmtp, int cmd)
{
(*current_saver)(0);
current_saver = old_saver;
uprintf("green screen saver removed\n");
return 0;
}
saver_init(struct lkm_table *lkmtp, int cmd, int ver)
{
DISPATCH(lkmtp, cmd, ver, saver_load, saver_unload, nosys);
}

View File

@ -0,0 +1,16 @@
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/tty.h>
#include <i386/include/pc/display.h>
#include <i386/include/console.h>
#include <i386/i386/cons.h>
#include <i386/isa/isa.h>
#include <i386/isa/isa_device.h>
#include <i386/isa/syscons.h>
extern scr_stat *cur_console;
extern u_short *Crtat;
extern u_int crtc_addr;
extern char scr_map[];
extern int scrn_blanked;
extern char *palette;

View File

@ -0,0 +1,10 @@
# $Id$
BINDIR= ${DESTDIR}/lkm
KMOD= snake_saver_mod
SRCS= snake_saver.c
NOMAN=
CFLAGS+= -DLKM -I${.CURDIR}/.. -I${.CURDIR}/../../../sys
.include <bsd.kmod.mk>

View File

@ -0,0 +1,121 @@
/*-
* Copyright (c) 1995 Søren Schmidt
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer
* in this position and unchanged.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software withough specific prior written permission
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id$
*/
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/conf.h>
#include <sys/exec.h>
#include <sys/sysent.h>
#include <sys/lkm.h>
#include <sys/errno.h>
#include <saver.h>
MOD_MISC("snake_saver")
void (*current_saver)();
void (*old_saver)();
static void
snake_saver(int blank)
{
const char saves[] = {"FreeBSD-2.1"};
static u_char *savs[sizeof(saves)-1];
static int dirx, diry;
int f;
scr_stat *scp = cur_console;
if (blank) {
if (!scrn_blanked) {
fillw((FG_LIGHTGREY|BG_BLACK)<<8 | scr_map[0x20],
Crtat, scp->xsize * scp->ysize);
set_border(0);
dirx = (scp->xpos ? 1 : -1);
diry = (scp->ypos ?
scp->xsize : -scp->xsize);
for (f=0; f< sizeof(saves)-1; f++)
savs[f] = (u_char *)Crtat + 2 *
(scp->xpos+scp->ypos*scp->xsize);
*(savs[0]) = scr_map[*saves];
f = scp->ysize * scp->xsize + 5;
outb(crtc_addr, 14);
outb(crtc_addr+1, f >> 8);
outb(crtc_addr, 15);
outb(crtc_addr+1, f & 0xff);
scrn_blanked = 1;
}
if (scrn_blanked++ < 4)
return;
scrn_blanked = 1;
*(savs[sizeof(saves)-2]) = scr_map[0x20];
for (f=sizeof(saves)-2; f > 0; f--)
savs[f] = savs[f-1];
f = (savs[0] - (u_char *)Crtat) / 2;
if ((f % scp->xsize) == 0 ||
(f % scp->xsize) == scp->xsize - 1 ||
(random() % 50) == 0)
dirx = -dirx;
if ((f / scp->xsize) == 0 ||
(f / scp->xsize) == scp->ysize - 1 ||
(random() % 20) == 0)
diry = -diry;
savs[0] += 2*dirx + 2*diry;
for (f=sizeof(saves)-2; f>=0; f--)
*(savs[f]) = scr_map[saves[f]];
}
else {
if (scrn_blanked) {
set_border(scp->border);
scrn_blanked = 0;
scp->status |= UPDATE_SCREEN;
}
}
}
saver_load(struct lkm_table *lkmtp, int cmd)
{
(*current_saver)(0);
old_saver = current_saver;
current_saver = snake_saver;
uprintf("snake screen saver installed\n");
return 0;
}
saver_unload(struct lkm_table *lkmtp, int cmd)
{
(*current_saver)(0);
current_saver = old_saver;
uprintf("snake screen saver removed\n");
return 0;
}
saver_init(struct lkm_table *lkmtp, int cmd, int ver)
{
DISPATCH(lkmtp, cmd, ver, saver_load, saver_unload, nosys);
}

View File

@ -0,0 +1,10 @@
# $Id$
BINDIR= ${DESTDIR}/lkm
KMOD= star_saver_mod
SRCS= star_saver.c
NOMAN=
CFLAGS+= -DLKM -I${.CURDIR}/.. -I${.CURDIR}/../../../sys
.include <bsd.kmod.mk>

View File

@ -0,0 +1,111 @@
/*-
* Copyright (c) 1995 Søren Schmidt
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer
* in this position and unchanged.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software withough specific prior written permission
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id$
*/
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/conf.h>
#include <sys/exec.h>
#include <sys/sysent.h>
#include <sys/lkm.h>
#include <sys/errno.h>
#include <saver.h>
MOD_MISC("star_saver")
void (*current_saver)();
void (*old_saver)();
#define NUM_STARS 50
/*
* Alternate saver that got its inspiration from a well known utility
* package for an inferior^H^H^H^H^H^Hfamous OS.
*/
void
star_saver(int blank)
{
scr_stat *scp = cur_console;
int cell, i;
char pattern[] = {"...........++++*** "};
char colors[] = {FG_DARKGREY, FG_LIGHTGREY,
FG_WHITE, FG_LIGHTCYAN};
static u_short stars[NUM_STARS][2];
if (blank) {
if (!scrn_blanked) {
scrn_blanked = 1;
fillw((FG_LIGHTGREY|BG_BLACK)<<8|scr_map[0x20], Crtat,
scp->xsize * scp->ysize);
set_border(0);
for(i=0; i<NUM_STARS; i++) {
stars[i][0] =
random() % (scp->xsize*scp->ysize);
stars[i][1] = 0;
}
}
cell = random() % NUM_STARS;
*((u_short*)(Crtat + stars[cell][0])) =
scr_map[pattern[stars[cell][1]]] |
colors[random()%sizeof(colors)] << 8;
if ((stars[cell][1]+=(random()%4)) >= sizeof(pattern)-1) {
stars[cell][0] = random() % (scp->xsize*scp->ysize);
stars[cell][1] = 0;
}
}
else {
if (scrn_blanked) {
set_border(scp->border);
scrn_blanked = 0;
scp->status |= UPDATE_SCREEN;
}
}
}
saver_load(struct lkm_table *lkmtp, int cmd)
{
(*current_saver)(0);
old_saver = current_saver;
current_saver = star_saver;
uprintf("star screen saver installed\n");
return 0;
}
saver_unload(struct lkm_table *lkmtp, int cmd)
{
(*current_saver)(0);
current_saver = old_saver;
uprintf("star screen saver removed\n");
return 0;
}
saver_init(struct lkm_table *lkmtp, int cmd, int ver)
{
DISPATCH(lkmtp, cmd, ver, saver_load, saver_unload, nosys);
}

View File

@ -94,11 +94,6 @@ Sets the screensaver timeout to
seconds, or turns it
.I off
.TP
.BI "\-s\ " NAME|help
Sets the screensaver appearance to
.I NAME .
Use \-s help to print a list of the available screen savers.
.TP
.BI "\-x\ "
Use hexadecimal digits for output.
.PP

View File

@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: vidcontrol.c,v 1.7 1995/02/07 11:56:21 sos Exp $
* $Id: vidcontrol.c,v 1.8 1995/02/08 01:07:16 dima Exp $
*/
#include <ctype.h>
@ -34,19 +34,44 @@
#include <sys/errno.h>
#include "path.h"
char legal_colors[16][16] = {
"black", "blue", "green", "cyan",
"red", "magenta", "brown", "white",
"grey", "lightblue", "lightgreen", "lightcyan",
"lightred", "lightmagenta", "yellow", "lightwhite"
};
};
int hex = 0;
int number;
char letter;
struct vid_info info;
void
usage()
{
fprintf(stderr,
"Usage: vidcontrol mode (available modes: VGA_40x25, VGA_80x25,\n"
" VGA_80x50, VGA_320x200,\n"
" EGA_80x25, EGA_80x43)\n"
" (experimental) VGA_80x30, VGA_80x60)\n"
"\n"
" show (show available colors)\n"
" fgcol bgcol (set fore- & background colors)\n"
" -r fgcol bgcol (set reverse fore- & background colors)\n"
" -b color (set border color)\n"
" -c normal (set cursor to inverting block)\n"
" -c blink (set cursor to blinking inverted block)\n"
" -c destructive (set cursor to blinking destructive char)\n"
" -d (dump screenmap to stdout)\n"
" -l filename (load srceenmap file filename)\n"
" -L (load default screenmap)\n"
" -f DxL filename (load font, D dots wide & L lines high)\n"
" -s saver | help (set screensaver type or help for a list)\n"
" -t N (set screensaver timeout in seconds)\n"
" -x (use hex numbers for output)\n"
);
}
char *
nextarg(int ac, char **av, int *indp, int oc)
{
@ -58,14 +83,12 @@ nextarg(int ac, char **av, int *indp, int oc)
return("");
}
char *
mkfullname(const char *s1, const char *s2, const char *s3)
{
static char *buf = NULL;
static int bufl = 0;
int f;
static char *buf = NULL;
static int bufl = 0;
int f;
f = strlen(s1) + strlen(s2) + strlen(s3) + 1;
if (f > bufl)
@ -85,7 +108,6 @@ int f;
return(buf);
}
void
load_scrnmap(char *filename)
{
@ -119,12 +141,11 @@ load_scrnmap(char *filename)
close(fd);
}
void
load_default_scrnmap()
{
int i;
scrmap_t scrnmap;
int i;
for (i=0; i<256; i++)
*((char*)&scrnmap + i) = i;
@ -132,7 +153,6 @@ load_default_scrnmap()
perror("can't load default screenmap");
}
void
print_scrnmap()
{
@ -155,7 +175,6 @@ print_scrnmap()
}
void
load_font(char *type, char *filename)
{
@ -207,7 +226,6 @@ load_font(char *type, char *filename)
free(fontmap);
}
void
set_screensaver_timeout(char *arg)
{
@ -226,44 +244,6 @@ set_screensaver_timeout(char *arg)
perror("setting screensaver period");
}
void
set_screensaver_type(char *type)
{
ssaver_t saver;
int i, e;
if (!strcmp(type, "help")) {
i = 0;
printf("available screen saver types:\n");
do {
saver.num = i;
e = ioctl(0, CONS_GSAVER, &saver);
i ++;
if (e == 0)
printf("\t%s\n", saver.name);
} while (e == 0);
if (e == -1 && errno != EIO)
perror("getting screensaver info");
} else {
i = 0;
do {
saver.num = i;
e = ioctl(0, CONS_GSAVER, &saver);
i ++;
if (e == 0 && !strcmp(type, saver.name)) {
if (ioctl(0, CONS_SSAVER, &saver) == -1)
perror("setting screensaver type");
return;
}
} while (e == 0);
if (e == -1 && errno != EIO)
perror("getting screensaver info");
else
fprintf(stderr, "%s: No such screensaver\n", type);
}
}
void
set_cursor_type(char *appearence)
{
@ -283,7 +263,6 @@ set_cursor_type(char *appearence)
ioctl(0, CONS_CURSORTYPE, &type);
}
int
video_mode(int argc, char **argv, int *index)
{
@ -315,7 +294,6 @@ video_mode(int argc, char **argv, int *index)
return;
}
int
get_color_number(char *color)
{
@ -327,7 +305,6 @@ get_color_number(char *color)
return -1;
}
int
set_normal_colors(int argc, char **argv, int *index)
{
@ -345,7 +322,6 @@ set_normal_colors(int argc, char **argv, int *index)
}
}
set_reverse_colors(int argc, char **argv, int *index)
{
int color;
@ -361,7 +337,6 @@ set_reverse_colors(int argc, char **argv, int *index)
}
}
set_border_color(char *arg)
{
int color;
@ -373,7 +348,6 @@ set_border_color(char *arg)
usage();
}
test_frame()
{
int i;
@ -391,33 +365,6 @@ test_frame()
info.mv_rev.fore, info.mv_rev.back);
}
usage()
{
fprintf(stderr,
"Usage: vidcontrol mode (available modes: VGA_40x25, VGA_80x25,\n"
" VGA_80x50, VGA_320x200,\n"
" EGA_80x25, EGA_80x43)\n"
" (experimental) VGA_80x30, VGA_80x60)\n"
"\n"
" show (show available colors)\n"
" fgcol bgcol (set fore- & background colors)\n"
" -r fgcol bgcol (set reverse fore- & background colors)\n"
" -b color (set border color)\n"
" -c normal (set cursor to inverting block)\n"
" -c blink (set cursor to blinking inverted block)\n"
" -c destructive (set cursor to blinking destructive char)\n"
" -d (dump screenmap to stdout)\n"
" -l filename (load srceenmap file filename)\n"
" -L (load default screenmap)\n"
" -f DxL filename (load font, D dots wide & L lines high)\n"
" -s saver | help (set screensaver type or help for a list)\n"
" -t N (set screensaver timeout in seconds)\n"
" -x (use hex numbers for output)\n"
);
}
void
main(int argc, char **argv)
{
@ -428,10 +375,10 @@ main(int argc, char **argv)
info.size = sizeof(info);
if (ioctl(0, CONS_GETINFO, &info) < 0) {
perror("Must be on a vrtual console");
perror("Must be on a virtual console");
exit(1);
}
while((opt = getopt(argc, argv, "b:c:df:l:Lr:s:t:x")) != -1)
while((opt = getopt(argc, argv, "b:c:df:l:Lr:t:x")) != -1)
switch(opt) {
case 'c':
set_cursor_type(optarg);
@ -455,9 +402,6 @@ main(int argc, char **argv)
case 'r':
set_reverse_colors(argc, argv, &optind);
break;
case 's':
set_screensaver_type(optarg);
break;
case 't':
set_screensaver_timeout(optarg);
break;