1*41488Smckusick /* 2*41488Smckusick * Copyright (c) 1988 University of Utah. 3*41488Smckusick * Copyright (c) 1990 The Regents of the University of California. 4*41488Smckusick * All rights reserved. 5*41488Smckusick * 6*41488Smckusick * This code is derived from software contributed to Berkeley by 7*41488Smckusick * the Systems Programming Group of the University of Utah Computer 8*41488Smckusick * Science Department. 9*41488Smckusick * 10*41488Smckusick * %sccs.include.redist.c% 11*41488Smckusick * 12*41488Smckusick * from: Utah $Hdr: ite_rb.c 1.5 89/02/20$ 13*41488Smckusick * 14*41488Smckusick * @(#)ite_rb.c 7.1 (Berkeley) 05/08/90 15*41488Smckusick */ 16*41488Smckusick 17*41488Smckusick #include "samachdep.h" 18*41488Smckusick 19*41488Smckusick #ifdef ITECONSOLE 20*41488Smckusick 21*41488Smckusick #include "param.h" 22*41488Smckusick #include "../hpdev/itevar.h" 23*41488Smckusick #include "../hpdev/itereg.h" 24*41488Smckusick #include "../hpdev/grfvar.h" 25*41488Smckusick #include "../hpdev/grf_rbreg.h" 26*41488Smckusick 27*41488Smckusick #define REGBASE ((struct rboxfb *)(ip->regbase)) 28*41488Smckusick #define WINDOWMOVER rbox_windowmove 29*41488Smckusick 30*41488Smckusick rbox_init(ip) 31*41488Smckusick struct ite_softc *ip; 32*41488Smckusick { 33*41488Smckusick int i; 34*41488Smckusick 35*41488Smckusick rb_waitbusy(REGADDR); 36*41488Smckusick DELAY(3000); 37*41488Smckusick 38*41488Smckusick REGBASE->interrupt = 0x04; 39*41488Smckusick REGBASE->display_enable = 0x01; 40*41488Smckusick REGBASE->video_enable = 0x01; 41*41488Smckusick REGBASE->drive = 0x01; 42*41488Smckusick REGBASE->vdrive = 0x0; 43*41488Smckusick 44*41488Smckusick ite_devinfo(ip); 45*41488Smckusick 46*41488Smckusick REGBASE->opwen = 0xFF; 47*41488Smckusick 48*41488Smckusick /* 49*41488Smckusick * Clear the framebuffer. 50*41488Smckusick */ 51*41488Smckusick rbox_windowmove(ip, 0, 0, 0, 0, ip->fbheight, ip->fbwidth, RR_CLEAR); 52*41488Smckusick rb_waitbusy(REGADDR); 53*41488Smckusick 54*41488Smckusick for(i = 0; i < 16; i++) { 55*41488Smckusick *(REGADDR + 0x63c3 + i*4) = 0x0; 56*41488Smckusick *(REGADDR + 0x6403 + i*4) = 0x0; 57*41488Smckusick *(REGADDR + 0x6803 + i*4) = 0x0; 58*41488Smckusick *(REGADDR + 0x6c03 + i*4) = 0x0; 59*41488Smckusick *(REGADDR + 0x73c3 + i*4) = 0x0; 60*41488Smckusick *(REGADDR + 0x7403 + i*4) = 0x0; 61*41488Smckusick *(REGADDR + 0x7803 + i*4) = 0x0; 62*41488Smckusick *(REGADDR + 0x7c03 + i*4) = 0x0; 63*41488Smckusick } 64*41488Smckusick 65*41488Smckusick REGBASE->rep_rule = 0x33; 66*41488Smckusick 67*41488Smckusick /* 68*41488Smckusick * I cannot figure out how to make the blink planes stop. So, we 69*41488Smckusick * must set both colormaps so that when the planes blink, and 70*41488Smckusick * the secondary colormap is active, we still get text. 71*41488Smckusick */ 72*41488Smckusick CM1RED[0x00].value = 0x00; 73*41488Smckusick CM1GRN[0x00].value = 0x00; 74*41488Smckusick CM1BLU[0x00].value = 0x00; 75*41488Smckusick CM1RED[0x01].value = 0xFF; 76*41488Smckusick CM1GRN[0x01].value = 0xFF; 77*41488Smckusick CM1BLU[0x01].value = 0xFF; 78*41488Smckusick 79*41488Smckusick CM2RED[0x00].value = 0x00; 80*41488Smckusick CM2GRN[0x00].value = 0x00; 81*41488Smckusick CM2BLU[0x00].value = 0x00; 82*41488Smckusick CM2RED[0x01].value = 0xFF; 83*41488Smckusick CM2GRN[0x01].value = 0xFF; 84*41488Smckusick CM2BLU[0x01].value = 0xFF; 85*41488Smckusick 86*41488Smckusick REGBASE->blink = 0x00; 87*41488Smckusick REGBASE->write_enable = 0x01; 88*41488Smckusick REGBASE->opwen = 0x00; 89*41488Smckusick 90*41488Smckusick ite_fontinit(ip); 91*41488Smckusick 92*41488Smckusick /* 93*41488Smckusick * Stash the inverted cursor. 94*41488Smckusick */ 95*41488Smckusick rbox_windowmove(ip, charY(ip, ' '), charX(ip, ' '), 96*41488Smckusick ip->cblanky, ip->cblankx, ip->ftheight, 97*41488Smckusick ip->ftwidth, RR_COPYINVERTED); 98*41488Smckusick } 99*41488Smckusick 100*41488Smckusick rbox_putc(ip, c, dy, dx, mode) 101*41488Smckusick register struct ite_softc *ip; 102*41488Smckusick register int dy, dx; 103*41488Smckusick int c, mode; 104*41488Smckusick { 105*41488Smckusick rbox_windowmove(ip, charY(ip, c), charX(ip, c), 106*41488Smckusick dy * ip->ftheight, dx * ip->ftwidth, 107*41488Smckusick ip->ftheight, ip->ftwidth, RR_COPY); 108*41488Smckusick } 109*41488Smckusick 110*41488Smckusick rbox_cursor(ip, flag) 111*41488Smckusick register struct ite_softc *ip; 112*41488Smckusick register int flag; 113*41488Smckusick { 114*41488Smckusick if (flag == DRAW_CURSOR) 115*41488Smckusick draw_cursor(ip) 116*41488Smckusick else if (flag == MOVE_CURSOR) { 117*41488Smckusick erase_cursor(ip) 118*41488Smckusick draw_cursor(ip) 119*41488Smckusick } 120*41488Smckusick else 121*41488Smckusick erase_cursor(ip) 122*41488Smckusick } 123*41488Smckusick 124*41488Smckusick rbox_clear(ip, sy, sx, h, w) 125*41488Smckusick struct ite_softc *ip; 126*41488Smckusick register int sy, sx, h, w; 127*41488Smckusick { 128*41488Smckusick rbox_windowmove(ip, sy * ip->ftheight, sx * ip->ftwidth, 129*41488Smckusick sy * ip->ftheight, sx * ip->ftwidth, 130*41488Smckusick h * ip->ftheight, w * ip->ftwidth, 131*41488Smckusick RR_CLEAR); 132*41488Smckusick } 133*41488Smckusick 134*41488Smckusick rbox_scroll(ip, sy, sx, count, dir) 135*41488Smckusick register struct ite_softc *ip; 136*41488Smckusick register int sy, count; 137*41488Smckusick int dir, sx; 138*41488Smckusick { 139*41488Smckusick register int dy = sy - count; 140*41488Smckusick register int height = ip->rows - sy; 141*41488Smckusick 142*41488Smckusick rbox_cursor(ip, ERASE_CURSOR); 143*41488Smckusick 144*41488Smckusick rbox_windowmove(ip, sy * ip->ftheight, sx * ip->ftwidth, 145*41488Smckusick dy * ip->ftheight, sx * ip->ftwidth, 146*41488Smckusick height * ip->ftheight, 147*41488Smckusick ip->cols * ip->ftwidth, RR_COPY); 148*41488Smckusick } 149*41488Smckusick 150*41488Smckusick rbox_windowmove(ip, sy, sx, dy, dx, h, w, func) 151*41488Smckusick struct ite_softc *ip; 152*41488Smckusick int sy, sx, dy, dx, h, w, func; 153*41488Smckusick { 154*41488Smckusick register struct rboxfb *rp = REGBASE; 155*41488Smckusick if (h == 0 || w == 0) 156*41488Smckusick return; 157*41488Smckusick 158*41488Smckusick rb_waitbusy(REGADDR); 159*41488Smckusick rp->rep_rule = func << 4 | func; 160*41488Smckusick rp->source_y = sy; 161*41488Smckusick rp->source_x = sx; 162*41488Smckusick rp->dest_y = dy; 163*41488Smckusick rp->dest_x = dx; 164*41488Smckusick rp->wheight = h; 165*41488Smckusick rp->wwidth = w; 166*41488Smckusick rp->wmove = 1; 167*41488Smckusick } 168*41488Smckusick #endif 169