static int txt_splash(video_adapter_t *adp, const int on) { sc_softc_t *sc; scr_stat *scp; sc = sc_find_softc(adp, NULL); if (sc == NULL) return (EAGAIN); scp = sc->cur_scp; if (on) { if (!splash_on) { if (adp->va_info.vi_flags & V_INFO_GRAPHICS) return EAGAIN; /* Clear screen and set border colour. */ sc_vtb_clear(&scp->scr, sc->scr_map[0x20], (FG_LIGHTGREY | BG_BLACK) << 8); (*vidsw[adp->va_index]->set_hw_cursor)(adp, -1, -1); sc_set_border(scp, 0); splash_on = TRUE; /* Display the splash screen. */ draw_text_splash(sc); } return (0); } else { /* The video mode will be restored by the caller. */ splash_on = FALSE; return (0); } }
/* * Alternate saver that got its inspiration from a well known utility * package for an inferior^H^H^H^H^H^Hfamous OS. */ static int star_saver(video_adapter_t *adp, int blank) { sc_softc_t *sc; scr_stat *scp; int cell, i; static u_char pattern[] = {"...........++++*** "}; static char color16[] = {FG_DARKGREY, FG_LIGHTGREY, FG_WHITE, FG_LIGHTCYAN}; static char color8[] = {FG_BLUE, FG_BROWN, FG_LIGHTGREY, FG_CYAN}; static char *colors; static u_short stars[NUM_STARS][2]; sc = sc_find_softc(adp, NULL); if (sc == NULL) return EAGAIN; scp = sc->cur_scp; if (blank) { if (adp->va_info.vi_flags & V_INFO_GRAPHICS) return EAGAIN; if (!blanked) { switch (adp->va_mode) { case M_PC98_80x25: case M_PC98_80x30: colors = color8; break; default: colors = color16; break; } /* clear the screen and set the border color */ sc_vtb_clear(&scp->scr, sc->scr_map[0x20], (FG_LIGHTGREY | BG_BLACK) << 8); vidd_set_hw_cursor(adp, -1, -1); sc_set_border(scp, 0); blanked = TRUE; for(i=0; i<NUM_STARS; i++) { stars[i][0] = random() % (scp->xsize*scp->ysize); stars[i][1] = 0; } } cell = random() % NUM_STARS; sc_vtb_putc(&scp->scr, stars[cell][0], sc->scr_map[pattern[stars[cell][1]]], colors[random()%sizeof(color16)] << 8); if ((stars[cell][1]+=(random()%4)) >= sizeof(pattern)-1) { stars[cell][0] = random() % (scp->xsize*scp->ysize); stars[cell][1] = 0; } } else blanked = FALSE; return 0; }
/* * Alternate saver that got its inspiration from a well known utility * package for an inferior^H^H^H^H^H^Hfamous OS. */ static int star_saver(video_adapter_t *adp, int blank) { sc_softc_t *sc; scr_stat *scp; int cell, i; static u_char pattern[] = {"...........++++*** "}; #ifndef PC98 static char colors[] = {FG_DARKGREY, FG_LIGHTGREY, FG_WHITE, FG_LIGHTCYAN}; #else static char colors[] = {FG_BLUE, FG_LIGHTGREY, FG_LIGHTGREY, FG_CYAN}; #endif /* PC98 */ static u_short stars[NUM_STARS][2]; sc = sc_find_softc(adp, NULL); if (sc == NULL) return EAGAIN; scp = sc->cur_scp; if (blank) { if (adp->va_info.vi_flags & V_INFO_GRAPHICS) return EAGAIN; if (!blanked) { #ifdef PC98 if (epson_machine_id == 0x20) { outb(0x43f, 0x42); outb(0x0c17, inb(0xc17) & ~0x08); outb(0x43f, 0x40); } #endif /* PC98 */ /* clear the screen and set the border color */ sc_vtb_clear(&scp->scr, sc->scr_map[0x20], (FG_LIGHTGREY | BG_BLACK) << 8); (*vidsw[adp->va_index]->set_hw_cursor)(adp, -1, -1); sc_set_border(scp, 0); blanked = TRUE; for(i=0; i<NUM_STARS; i++) { stars[i][0] = random() % (scp->xsize*scp->ysize); stars[i][1] = 0; } } cell = random() % NUM_STARS; sc_vtb_putc(&scp->scr, stars[cell][0], sc->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 { #ifdef PC98 if (epson_machine_id == 0x20) { outb(0x43f, 0x42); outb(0x0c17, inb(0xc17) | 0x08); outb(0x43f, 0x40); } #endif /* PC98 */ blanked = FALSE; } return 0; }
static int snake_saver(video_adapter_t *adp, int blank) { static int dirx, diry; int f; sc_softc_t *sc; scr_stat *scp; /* XXX hack for minimal changes. */ #define save message #define savs messagep sc = sc_find_softc(adp, NULL); if (sc == NULL) return EAGAIN; scp = sc->cur_scp; if (blank) { if (adp->va_info.vi_flags & V_INFO_GRAPHICS) return EAGAIN; if (blanked <= 0) { #ifdef PC98 if (epson_machine_id == 0x20) { outb(0x43f, 0x42); outb(0x0c17, inb(0xc17) & ~0x08); outb(0x43f, 0x40); } #endif /* PC98 */ sc_vtb_clear(&scp->scr, sc->scr_map[0x20], (FG_LIGHTGREY | BG_BLACK) << 8); (*vidsw[adp->va_index]->set_hw_cursor)(adp, -1, -1); sc_set_border(scp, 0); dirx = (scp->xpos ? 1 : -1); diry = (scp->ypos ? scp->xsize : -scp->xsize); for (f=0; f< messagelen; f++) savs[f] = scp->xpos + scp->ypos*scp->xsize; sc_vtb_putc(&scp->scr, savs[0], sc->scr_map[*save], (FG_LIGHTGREY | BG_BLACK) << 8); blanked = 1; } if (blanked++ < 4) return 0; blanked = 1; sc_vtb_putc(&scp->scr, savs[messagelen - 1], sc->scr_map[0x20], (FG_LIGHTGREY | BG_BLACK) << 8); for (f=messagelen-1; f > 0; f--) savs[f] = savs[f-1]; f = savs[0]; 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] += dirx + diry; for (f=messagelen-1; f>=0; f--) sc_vtb_putc(&scp->scr, savs[f], sc->scr_map[save[f]], (FG_LIGHTGREY | BG_BLACK) << 8); } else { #ifdef PC98 if (epson_machine_id == 0x20) { outb(0x43f, 0x42); outb(0x0c17, inb(0xc17) | 0x08); outb(0x43f, 0x40); } #endif /* PC98 */ blanked = 0; } return 0; }
static int daemon_saver(video_adapter_t *adp, int blank) { static int txpos = 10, typos = 10; static int txdir = -1, tydir = -1; static int dxpos = 0, dypos = 0; static int dxdir = 1, dydir = 1; static int moved_daemon = 0; static int xoff, yoff, toff; static int xlen, ylen, tlen; sc_softc_t *sc; scr_stat *scp; int min, max; sc = sc_find_softc(adp, NULL); if (sc == NULL) return EAGAIN; scp = sc->cur_scp; if (blank) { if (adp->va_info.vi_flags & V_INFO_GRAPHICS) return EAGAIN; if (blanked == 0) { /* clear the screen and set the border color */ sc_vtb_clear(&scp->scr, sc->scr_map[0x20], ATTR(FG_LIGHTGREY | BG_BLACK)); vidd_set_hw_cursor(adp, -1, -1); sc_set_border(scp, 0); xlen = ylen = tlen = 0; } if (blanked++ < 2) return 0; blanked = 1; clear_daemon(sc, dxpos, dypos, dxdir, xoff, yoff, xlen, ylen); clear_string(sc, txpos, typos, toff, message, tlen); if (++moved_daemon) { /* * The daemon picture may be off the screen, if * screen size is chagened while the screen * saver is inactive. Make sure the origin of * the picture is between min and max. */ if (scp->xsize <= DAEMON_MAX_WIDTH) { /* * If the screen width is too narrow, we * allow part of the picture go off * the screen so that the daemon won't * flip too often. */ min = scp->xsize - DAEMON_MAX_WIDTH - 10; max = 10; } else { min = 0; max = scp->xsize - DAEMON_MAX_WIDTH; } if (dxpos <= min) { dxpos = min; dxdir = 1; } else if (dxpos >= max) { dxpos = max; dxdir = -1; } if (scp->ysize <= DAEMON_MAX_HEIGHT) { min = scp->ysize - DAEMON_MAX_HEIGHT - 10; max = 10; } else { min = 0; max = scp->ysize - DAEMON_MAX_HEIGHT; } if (dypos <= min) { dypos = min; dydir = 1; } else if (dypos >= max) { dypos = max; dydir = -1; } moved_daemon = -1; dxpos += dxdir; dypos += dydir; /* clip the picture */ xoff = 0; xlen = DAEMON_MAX_WIDTH; if (dxpos + xlen <= 0) xlen = 0; else if (dxpos < 0) xoff = -dxpos; if (dxpos >= scp->xsize) xlen = 0; else if (dxpos + xlen > scp->xsize) xlen = scp->xsize - dxpos; yoff = 0; ylen = DAEMON_MAX_HEIGHT; if (dypos + ylen <= 0) ylen = 0; else if (dypos < 0) yoff = -dypos; if (dypos >= scp->ysize) ylen = 0; else if (dypos + ylen > scp->ysize) ylen = scp->ysize - dypos; } if (scp->xsize <= messagelen) { min = scp->xsize - messagelen - 10; max = 10; } else { min = 0; max = scp->xsize - messagelen; } if (txpos <= min) { txpos = min; txdir = 1; } else if (txpos >= max) { txpos = max; txdir = -1; } if (typos <= 0) { typos = 0; tydir = 1; } else if (typos >= scp->ysize - 1) { typos = scp->ysize - 1; tydir = -1; } txpos += txdir; typos += tydir; toff = 0; tlen = messagelen; if (txpos + tlen <= 0) tlen = 0; else if (txpos < 0) toff = -txpos; if (txpos >= scp->xsize) tlen = 0; else if (txpos + tlen > scp->xsize) tlen = scp->xsize - txpos; draw_daemon(sc, dxpos, dypos, dxdir, xoff, yoff, xlen, ylen); draw_string(sc, txpos, typos, toff, message, tlen); } else blanked = 0; return 0; }