Annotation of Net2/arch/hp300/stand/ite_gb.c, revision 1.1.1.2

1.1       root        1: /*
                      2:  * Copyright (c) 1988 University of Utah.
                      3:  * Copyright (c) 1990 The Regents of the University of California.
                      4:  * All rights reserved.
                      5:  *
                      6:  * This code is derived from software contributed to Berkeley by
                      7:  * the Systems Programming Group of the University of Utah Computer
                      8:  * Science Department.
                      9:  *
                     10:  * Redistribution and use in source and binary forms, with or without
                     11:  * modification, are permitted provided that the following conditions
                     12:  * are met:
                     13:  * 1. Redistributions of source code must retain the above copyright
                     14:  *    notice, this list of conditions and the following disclaimer.
                     15:  * 2. Redistributions in binary form must reproduce the above copyright
                     16:  *    notice, this list of conditions and the following disclaimer in the
                     17:  *    documentation and/or other materials provided with the distribution.
                     18:  * 3. All advertising materials mentioning features or use of this software
                     19:  *    must display the following acknowledgement:
                     20:  *     This product includes software developed by the University of
                     21:  *     California, Berkeley and its contributors.
                     22:  * 4. Neither the name of the University nor the names of its contributors
                     23:  *    may be used to endorse or promote products derived from this software
                     24:  *    without specific prior written permission.
                     25:  *
                     26:  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
                     27:  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
                     28:  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
                     29:  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
                     30:  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
                     31:  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
                     32:  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
                     33:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
                     34:  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
                     35:  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
                     36:  * SUCH DAMAGE.
                     37:  *
                     38:  * from: Utah $Hdr: ite_gb.c 1.8 89/02/23$
                     39:  *
1.1.1.2 ! root       40:  *     from: @(#)ite_gb.c      7.2 (Berkeley) 12/16/90
        !            41:  *     ite_gb.c,v 1.2 1993/05/22 07:59:05 cgd Exp
1.1       root       42:  */
                     43: 
                     44: #include "samachdep.h"
                     45: 
                     46: #ifdef ITECONSOLE
                     47: 
                     48: #include "sys/param.h"
                     49: 
                     50: #include "../dev/itevar.h"
                     51: #include "../dev/itereg.h"
                     52: #include "../dev/grfvar.h"
                     53: #include "../dev/grf_gbreg.h"
                     54: 
                     55: #define REGBASE        ((struct gboxfb *)(ip->regbase))
                     56: #define WINDOWMOVER    gatorbox_windowmove
                     57: 
                     58: gatorbox_init(ip)
                     59:        register struct ite_softc *ip;
                     60: {
                     61:        REGBASE->write_protect = 0x0;
                     62:        REGBASE->interrupt = 0x4;
                     63:        REGBASE->rep_rule = RR_COPY;
                     64:        REGBASE->blink1 = 0xff;
                     65:        REGBASE->blink2 = 0xff;
                     66:        REGBASE->sec_interrupt = 0x01;
                     67: 
                     68:        /*
                     69:         * Set up the color map entries. We use three entries in the
                     70:         * color map. The first, is for black, the second is for
                     71:         * white, and the very last entry is for the inverted cursor.
                     72:         */
                     73:        REGBASE->creg_select = 0x00;
                     74:        REGBASE->cmap_red    = 0x00;
                     75:        REGBASE->cmap_grn    = 0x00;
                     76:        REGBASE->cmap_blu    = 0x00;
                     77:        REGBASE->cmap_write  = 0x00;
                     78:        gbcm_waitbusy(REGADDR);
                     79:        
                     80:        REGBASE->creg_select = 0x01;
                     81:        REGBASE->cmap_red    = 0xFF;
                     82:        REGBASE->cmap_grn    = 0xFF;
                     83:        REGBASE->cmap_blu    = 0xFF;
                     84:        REGBASE->cmap_write  = 0x01;
                     85:        gbcm_waitbusy(REGADDR);
                     86: 
                     87:        REGBASE->creg_select = 0xFF;
                     88:        REGBASE->cmap_red    = 0xFF;
                     89:        REGBASE->cmap_grn    = 0xFF;
                     90:        REGBASE->cmap_blu    = 0xFF;
                     91:        REGBASE->cmap_write  = 0x01;
                     92:        gbcm_waitbusy(REGADDR);
                     93: 
                     94:        ite_devinfo(ip);
                     95:        ite_fontinit(ip);
                     96: 
                     97:        /*
                     98:         * Clear the display. This used to be before the font unpacking
                     99:         * but it crashes. Figure it out later.
                    100:         */
                    101:        gatorbox_windowmove(ip, 0, 0, 0, 0, ip->dheight, ip->dwidth, RR_CLEAR);
                    102:        tile_mover_waitbusy(REGADDR);
                    103: 
                    104:        /*
                    105:         * Stash the inverted cursor.
                    106:         */
                    107:        gatorbox_windowmove(ip, charY(ip, ' '), charX(ip, ' '),
                    108:                            ip->cblanky, ip->cblankx, ip->ftheight,
                    109:                            ip->ftwidth, RR_COPYINVERTED);
                    110: }
                    111: 
                    112: gatorbox_putc(ip, c, dy, dx, mode)
                    113:        register struct ite_softc *ip;
                    114:         register int dy, dx;
                    115:        int c, mode;
                    116: {
                    117:        gatorbox_windowmove(ip, charY(ip, c), charX(ip, c),
                    118:                            dy * ip->ftheight, dx * ip->ftwidth,
                    119:                            ip->ftheight, ip->ftwidth, RR_COPY);
                    120: }
                    121: 
                    122: gatorbox_cursor(ip, flag)
                    123:        register struct ite_softc *ip;
                    124:         register int flag;
                    125: {
                    126:        if (flag == DRAW_CURSOR)
                    127:                draw_cursor(ip)
                    128:        else if (flag == MOVE_CURSOR) {
                    129:                erase_cursor(ip)
                    130:                draw_cursor(ip)
                    131:        }
                    132:        else
                    133:                erase_cursor(ip)
                    134: }
                    135: 
                    136: gatorbox_clear(ip, sy, sx, h, w)
                    137:        struct ite_softc *ip;
                    138:        register int sy, sx, h, w;
                    139: {
                    140:        gatorbox_windowmove(ip, sy * ip->ftheight, sx * ip->ftwidth,
                    141:                            sy * ip->ftheight, sx * ip->ftwidth, 
                    142:                            h  * ip->ftheight, w  * ip->ftwidth,
                    143:                            RR_CLEAR);
                    144: }
                    145: 
                    146: #define        gatorbox_blockmove(ip, sy, sx, dy, dx, h, w) \
                    147:        gatorbox_windowmove((ip), \
                    148:                            (sy) * ip->ftheight, \
                    149:                            (sx) * ip->ftwidth, \
                    150:                            (dy) * ip->ftheight, \
                    151:                            (dx) * ip->ftwidth, \
                    152:                            (h)  * ip->ftheight, \
                    153:                            (w)  * ip->ftwidth, \
                    154:                            RR_COPY)
                    155: 
                    156: gatorbox_scroll(ip, sy, sx, count, dir)
                    157:         register struct ite_softc *ip;
                    158:         register int sy;
                    159:         int dir, sx, count;
                    160: {
                    161:        register int height, dy, i;
                    162:        
                    163:        tile_mover_waitbusy(REGADDR);
                    164:        REGBASE->write_protect = 0x0;
                    165: 
                    166:        gatorbox_cursor(ip, ERASE_CURSOR);
                    167: 
                    168:        dy = sy - count;
                    169:        height = ip->rows - sy;
                    170:        for (i = 0; i < height; i++)
                    171:                gatorbox_blockmove(ip, sy + i, sx, dy + i, 0, 1, ip->cols);
                    172: }
                    173: 
                    174: gatorbox_windowmove(ip, sy, sx, dy, dx, h, w, mask)
                    175:      register struct ite_softc *ip;
                    176:      int sy, sx, dy, dx, mask;
                    177:      register int h, w;
                    178: {
                    179:        register int src, dest;
                    180: 
                    181:        src  = (sy * 1024) + sx;        /* upper left corner in pixels */
                    182:        dest = (dy * 1024) + dx;
                    183: 
                    184:        tile_mover_waitbusy(REGADDR);
                    185:        REGBASE->width = -(w / 4);
                    186:        REGBASE->height = -(h / 4);
                    187:        if (src < dest)
                    188:                REGBASE->rep_rule = MOVE_DOWN_RIGHT|mask;
                    189:        else {
                    190:                REGBASE->rep_rule = MOVE_UP_LEFT|mask;
                    191:                /*
                    192:                 * Adjust to top of lower right tile of the block.
                    193:                 */
                    194:                src = src + ((h - 4) * 1024) + (w - 4);
                    195:                dest= dest + ((h - 4) * 1024) + (w - 4);
                    196:        }
                    197:        FBBASE[dest] = FBBASE[src];
                    198: }
                    199: #endif

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.