141488Smckusick /* 241488Smckusick * Copyright (c) 1988 University of Utah. 341488Smckusick * Copyright (c) 1990 The Regents of the University of California. 441488Smckusick * 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 * 1241488Smckusick * from: Utah $Hdr: ite_gb.c 1.8 89/02/23$ 1341488Smckusick * 14*45790Sbostic * @(#)ite_gb.c 7.2 (Berkeley) 12/16/90 1541488Smckusick */ 1641488Smckusick 1741488Smckusick #include "samachdep.h" 1841488Smckusick 1941488Smckusick #ifdef ITECONSOLE 2041488Smckusick 21*45790Sbostic #include "sys/param.h" 2241488Smckusick 23*45790Sbostic #include "../dev/itevar.h" 24*45790Sbostic #include "../dev/itereg.h" 25*45790Sbostic #include "../dev/grfvar.h" 26*45790Sbostic #include "../dev/grf_gbreg.h" 2741488Smckusick 2841488Smckusick #define REGBASE ((struct gboxfb *)(ip->regbase)) 2941488Smckusick #define WINDOWMOVER gatorbox_windowmove 3041488Smckusick 3141488Smckusick gatorbox_init(ip) 3241488Smckusick register struct ite_softc *ip; 3341488Smckusick { 3441488Smckusick REGBASE->write_protect = 0x0; 3541488Smckusick REGBASE->interrupt = 0x4; 3641488Smckusick REGBASE->rep_rule = RR_COPY; 3741488Smckusick REGBASE->blink1 = 0xff; 3841488Smckusick REGBASE->blink2 = 0xff; 3941488Smckusick REGBASE->sec_interrupt = 0x01; 4041488Smckusick 4141488Smckusick /* 4241488Smckusick * Set up the color map entries. We use three entries in the 4341488Smckusick * color map. The first, is for black, the second is for 4441488Smckusick * white, and the very last entry is for the inverted cursor. 4541488Smckusick */ 4641488Smckusick REGBASE->creg_select = 0x00; 4741488Smckusick REGBASE->cmap_red = 0x00; 4841488Smckusick REGBASE->cmap_grn = 0x00; 4941488Smckusick REGBASE->cmap_blu = 0x00; 5041488Smckusick REGBASE->cmap_write = 0x00; 5141488Smckusick gbcm_waitbusy(REGADDR); 5241488Smckusick 5341488Smckusick REGBASE->creg_select = 0x01; 5441488Smckusick REGBASE->cmap_red = 0xFF; 5541488Smckusick REGBASE->cmap_grn = 0xFF; 5641488Smckusick REGBASE->cmap_blu = 0xFF; 5741488Smckusick REGBASE->cmap_write = 0x01; 5841488Smckusick gbcm_waitbusy(REGADDR); 5941488Smckusick 6041488Smckusick REGBASE->creg_select = 0xFF; 6141488Smckusick REGBASE->cmap_red = 0xFF; 6241488Smckusick REGBASE->cmap_grn = 0xFF; 6341488Smckusick REGBASE->cmap_blu = 0xFF; 6441488Smckusick REGBASE->cmap_write = 0x01; 6541488Smckusick gbcm_waitbusy(REGADDR); 6641488Smckusick 6741488Smckusick ite_devinfo(ip); 6841488Smckusick ite_fontinit(ip); 6941488Smckusick 7041488Smckusick /* 7141488Smckusick * Clear the display. This used to be before the font unpacking 7241488Smckusick * but it crashes. Figure it out later. 7341488Smckusick */ 7441488Smckusick gatorbox_windowmove(ip, 0, 0, 0, 0, ip->dheight, ip->dwidth, RR_CLEAR); 7541488Smckusick tile_mover_waitbusy(REGADDR); 7641488Smckusick 7741488Smckusick /* 7841488Smckusick * Stash the inverted cursor. 7941488Smckusick */ 8041488Smckusick gatorbox_windowmove(ip, charY(ip, ' '), charX(ip, ' '), 8141488Smckusick ip->cblanky, ip->cblankx, ip->ftheight, 8241488Smckusick ip->ftwidth, RR_COPYINVERTED); 8341488Smckusick } 8441488Smckusick 8541488Smckusick gatorbox_putc(ip, c, dy, dx, mode) 8641488Smckusick register struct ite_softc *ip; 8741488Smckusick register int dy, dx; 8841488Smckusick int c, mode; 8941488Smckusick { 9041488Smckusick gatorbox_windowmove(ip, charY(ip, c), charX(ip, c), 9141488Smckusick dy * ip->ftheight, dx * ip->ftwidth, 9241488Smckusick ip->ftheight, ip->ftwidth, RR_COPY); 9341488Smckusick } 9441488Smckusick 9541488Smckusick gatorbox_cursor(ip, flag) 9641488Smckusick register struct ite_softc *ip; 9741488Smckusick register int flag; 9841488Smckusick { 9941488Smckusick if (flag == DRAW_CURSOR) 10041488Smckusick draw_cursor(ip) 10141488Smckusick else if (flag == MOVE_CURSOR) { 10241488Smckusick erase_cursor(ip) 10341488Smckusick draw_cursor(ip) 10441488Smckusick } 10541488Smckusick else 10641488Smckusick erase_cursor(ip) 10741488Smckusick } 10841488Smckusick 10941488Smckusick gatorbox_clear(ip, sy, sx, h, w) 11041488Smckusick struct ite_softc *ip; 11141488Smckusick register int sy, sx, h, w; 11241488Smckusick { 11341488Smckusick gatorbox_windowmove(ip, sy * ip->ftheight, sx * ip->ftwidth, 11441488Smckusick sy * ip->ftheight, sx * ip->ftwidth, 11541488Smckusick h * ip->ftheight, w * ip->ftwidth, 11641488Smckusick RR_CLEAR); 11741488Smckusick } 11841488Smckusick 11941488Smckusick #define gatorbox_blockmove(ip, sy, sx, dy, dx, h, w) \ 12041488Smckusick gatorbox_windowmove((ip), \ 12141488Smckusick (sy) * ip->ftheight, \ 12241488Smckusick (sx) * ip->ftwidth, \ 12341488Smckusick (dy) * ip->ftheight, \ 12441488Smckusick (dx) * ip->ftwidth, \ 12541488Smckusick (h) * ip->ftheight, \ 12641488Smckusick (w) * ip->ftwidth, \ 12741488Smckusick RR_COPY) 12841488Smckusick 12941488Smckusick gatorbox_scroll(ip, sy, sx, count, dir) 13041488Smckusick register struct ite_softc *ip; 13141488Smckusick register int sy; 13241488Smckusick int dir, sx, count; 13341488Smckusick { 13441488Smckusick register int height, dy, i; 13541488Smckusick 13641488Smckusick tile_mover_waitbusy(REGADDR); 13741488Smckusick REGBASE->write_protect = 0x0; 13841488Smckusick 13941488Smckusick gatorbox_cursor(ip, ERASE_CURSOR); 14041488Smckusick 14141488Smckusick dy = sy - count; 14241488Smckusick height = ip->rows - sy; 14341488Smckusick for (i = 0; i < height; i++) 14441488Smckusick gatorbox_blockmove(ip, sy + i, sx, dy + i, 0, 1, ip->cols); 14541488Smckusick } 14641488Smckusick 14741488Smckusick gatorbox_windowmove(ip, sy, sx, dy, dx, h, w, mask) 14841488Smckusick register struct ite_softc *ip; 14941488Smckusick int sy, sx, dy, dx, mask; 15041488Smckusick register int h, w; 15141488Smckusick { 15241488Smckusick register int src, dest; 15341488Smckusick 15441488Smckusick src = (sy * 1024) + sx; /* upper left corner in pixels */ 15541488Smckusick dest = (dy * 1024) + dx; 15641488Smckusick 15741488Smckusick tile_mover_waitbusy(REGADDR); 15841488Smckusick REGBASE->width = -(w / 4); 15941488Smckusick REGBASE->height = -(h / 4); 16041488Smckusick if (src < dest) 16141488Smckusick REGBASE->rep_rule = MOVE_DOWN_RIGHT|mask; 16241488Smckusick else { 16341488Smckusick REGBASE->rep_rule = MOVE_UP_LEFT|mask; 16441488Smckusick /* 16541488Smckusick * Adjust to top of lower right tile of the block. 16641488Smckusick */ 16741488Smckusick src = src + ((h - 4) * 1024) + (w - 4); 16841488Smckusick dest= dest + ((h - 4) * 1024) + (w - 4); 16941488Smckusick } 17041488Smckusick FBBASE[dest] = FBBASE[src]; 17141488Smckusick } 17241488Smckusick #endif 173