141488Smckusick /*
241488Smckusick * Copyright (c) 1988 University of Utah.
3*63163Sbostic * Copyright (c) 1990, 1993
4*63163Sbostic * The Regents of the University of California. All rights reserved.
541488Smckusick *
641488Smckusick * This code is derived from software contributed to Berkeley by
741488Smckusick * the Systems Programming Group of the University of Utah Computer
841488Smckusick * Science Department.
941488Smckusick *
1041488Smckusick * %sccs.include.redist.c%
1141488Smckusick *
1254073Shibler * from: Utah $Hdr: ite_rb.c 1.6 92/01/20$
1341488Smckusick *
14*63163Sbostic * @(#)ite_rb.c 8.1 (Berkeley) 06/10/93
1541488Smckusick */
1641488Smckusick
1756510Sbostic #include <hp300/stand/samachdep.h>
1841488Smckusick
1941488Smckusick #ifdef ITECONSOLE
2041488Smckusick
2156510Sbostic #include <sys/param.h>
2256510Sbostic #include <hp/dev/itevar.h>
2356510Sbostic #include <hp/dev/itereg.h>
2454073Shibler
2556510Sbostic #include <hp300/dev/grf_rbreg.h>
2641488Smckusick
2741488Smckusick #define REGBASE ((struct rboxfb *)(ip->regbase))
2841488Smckusick #define WINDOWMOVER rbox_windowmove
2941488Smckusick
3041488Smckusick rbox_init(ip)
3141488Smckusick struct ite_softc *ip;
3241488Smckusick {
3341488Smckusick int i;
3441488Smckusick
3554073Shibler rb_waitbusy(ip->regbase);
3641488Smckusick DELAY(3000);
3741488Smckusick
3841488Smckusick REGBASE->interrupt = 0x04;
3941488Smckusick REGBASE->display_enable = 0x01;
4041488Smckusick REGBASE->video_enable = 0x01;
4141488Smckusick REGBASE->drive = 0x01;
4241488Smckusick REGBASE->vdrive = 0x0;
4341488Smckusick
4454073Shibler ite_fontinfo(ip);
4541488Smckusick
4641488Smckusick REGBASE->opwen = 0xFF;
4741488Smckusick
4841488Smckusick /*
4941488Smckusick * Clear the framebuffer.
5041488Smckusick */
5141488Smckusick rbox_windowmove(ip, 0, 0, 0, 0, ip->fbheight, ip->fbwidth, RR_CLEAR);
5254073Shibler rb_waitbusy(ip->regbase);
5341488Smckusick
5441488Smckusick for(i = 0; i < 16; i++) {
5554073Shibler *(ip->regbase + 0x63c3 + i*4) = 0x0;
5654073Shibler *(ip->regbase + 0x6403 + i*4) = 0x0;
5754073Shibler *(ip->regbase + 0x6803 + i*4) = 0x0;
5854073Shibler *(ip->regbase + 0x6c03 + i*4) = 0x0;
5954073Shibler *(ip->regbase + 0x73c3 + i*4) = 0x0;
6054073Shibler *(ip->regbase + 0x7403 + i*4) = 0x0;
6154073Shibler *(ip->regbase + 0x7803 + i*4) = 0x0;
6254073Shibler *(ip->regbase + 0x7c03 + i*4) = 0x0;
6341488Smckusick }
6441488Smckusick
6541488Smckusick REGBASE->rep_rule = 0x33;
6641488Smckusick
6741488Smckusick /*
6841488Smckusick * I cannot figure out how to make the blink planes stop. So, we
6941488Smckusick * must set both colormaps so that when the planes blink, and
7041488Smckusick * the secondary colormap is active, we still get text.
7141488Smckusick */
7241488Smckusick CM1RED[0x00].value = 0x00;
7341488Smckusick CM1GRN[0x00].value = 0x00;
7441488Smckusick CM1BLU[0x00].value = 0x00;
7541488Smckusick CM1RED[0x01].value = 0xFF;
7641488Smckusick CM1GRN[0x01].value = 0xFF;
7741488Smckusick CM1BLU[0x01].value = 0xFF;
7841488Smckusick
7941488Smckusick CM2RED[0x00].value = 0x00;
8041488Smckusick CM2GRN[0x00].value = 0x00;
8141488Smckusick CM2BLU[0x00].value = 0x00;
8241488Smckusick CM2RED[0x01].value = 0xFF;
8341488Smckusick CM2GRN[0x01].value = 0xFF;
8441488Smckusick CM2BLU[0x01].value = 0xFF;
8541488Smckusick
8641488Smckusick REGBASE->blink = 0x00;
8741488Smckusick REGBASE->write_enable = 0x01;
8841488Smckusick REGBASE->opwen = 0x00;
8941488Smckusick
9041488Smckusick ite_fontinit(ip);
9141488Smckusick
9241488Smckusick /*
9341488Smckusick * Stash the inverted cursor.
9441488Smckusick */
9541488Smckusick rbox_windowmove(ip, charY(ip, ' '), charX(ip, ' '),
9641488Smckusick ip->cblanky, ip->cblankx, ip->ftheight,
9741488Smckusick ip->ftwidth, RR_COPYINVERTED);
9841488Smckusick }
9941488Smckusick
rbox_putc(ip,c,dy,dx,mode)10041488Smckusick rbox_putc(ip, c, dy, dx, mode)
10141488Smckusick register struct ite_softc *ip;
10241488Smckusick register int dy, dx;
10341488Smckusick int c, mode;
10441488Smckusick {
10541488Smckusick rbox_windowmove(ip, charY(ip, c), charX(ip, c),
10641488Smckusick dy * ip->ftheight, dx * ip->ftwidth,
10741488Smckusick ip->ftheight, ip->ftwidth, RR_COPY);
10841488Smckusick }
10941488Smckusick
rbox_cursor(ip,flag)11041488Smckusick rbox_cursor(ip, flag)
11141488Smckusick register struct ite_softc *ip;
11241488Smckusick register int flag;
11341488Smckusick {
11441488Smckusick if (flag == DRAW_CURSOR)
11541488Smckusick draw_cursor(ip)
11641488Smckusick else if (flag == MOVE_CURSOR) {
11741488Smckusick erase_cursor(ip)
11841488Smckusick draw_cursor(ip)
11941488Smckusick }
12041488Smckusick else
12141488Smckusick erase_cursor(ip)
12241488Smckusick }
12341488Smckusick
12441488Smckusick rbox_clear(ip, sy, sx, h, w)
12541488Smckusick struct ite_softc *ip;
12641488Smckusick register int sy, sx, h, w;
12741488Smckusick {
12841488Smckusick rbox_windowmove(ip, sy * ip->ftheight, sx * ip->ftwidth,
12941488Smckusick sy * ip->ftheight, sx * ip->ftwidth,
13041488Smckusick h * ip->ftheight, w * ip->ftwidth,
13141488Smckusick RR_CLEAR);
13241488Smckusick }
13341488Smckusick
rbox_scroll(ip,sy,sx,count,dir)13441488Smckusick rbox_scroll(ip, sy, sx, count, dir)
13541488Smckusick register struct ite_softc *ip;
13641488Smckusick register int sy, count;
13741488Smckusick int dir, sx;
13841488Smckusick {
13941488Smckusick register int dy = sy - count;
14041488Smckusick register int height = ip->rows - sy;
14141488Smckusick
14241488Smckusick rbox_cursor(ip, ERASE_CURSOR);
14341488Smckusick
14441488Smckusick rbox_windowmove(ip, sy * ip->ftheight, sx * ip->ftwidth,
14541488Smckusick dy * ip->ftheight, sx * ip->ftwidth,
14641488Smckusick height * ip->ftheight,
14741488Smckusick ip->cols * ip->ftwidth, RR_COPY);
14841488Smckusick }
14941488Smckusick
15041488Smckusick rbox_windowmove(ip, sy, sx, dy, dx, h, w, func)
15141488Smckusick struct ite_softc *ip;
15241488Smckusick int sy, sx, dy, dx, h, w, func;
15341488Smckusick {
15441488Smckusick register struct rboxfb *rp = REGBASE;
15541488Smckusick if (h == 0 || w == 0)
15641488Smckusick return;
15741488Smckusick
15854073Shibler rb_waitbusy(ip->regbase);
15941488Smckusick rp->rep_rule = func << 4 | func;
16041488Smckusick rp->source_y = sy;
16141488Smckusick rp->source_x = sx;
16241488Smckusick rp->dest_y = dy;
16341488Smckusick rp->dest_x = dx;
16441488Smckusick rp->wheight = h;
16541488Smckusick rp->wwidth = w;
16641488Smckusick rp->wmove = 1;
16741488Smckusick }
16841488Smckusick #endif
169