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

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:  *
                     40:  *     @(#)ite_gb.c    7.2 (Berkeley) 12/16/90
                     41:  */
                     42: 
                     43: #include "samachdep.h"
                     44: 
                     45: #ifdef ITECONSOLE
                     46: 
                     47: #include "sys/param.h"
                     48: 
                     49: #include "../dev/itevar.h"
                     50: #include "../dev/itereg.h"
                     51: #include "../dev/grfvar.h"
                     52: #include "../dev/grf_gbreg.h"
                     53: 
                     54: #define REGBASE        ((struct gboxfb *)(ip->regbase))
                     55: #define WINDOWMOVER    gatorbox_windowmove
                     56: 
                     57: gatorbox_init(ip)
                     58:        register struct ite_softc *ip;
                     59: {
                     60:        REGBASE->write_protect = 0x0;
                     61:        REGBASE->interrupt = 0x4;
                     62:        REGBASE->rep_rule = RR_COPY;
                     63:        REGBASE->blink1 = 0xff;
                     64:        REGBASE->blink2 = 0xff;
                     65:        REGBASE->sec_interrupt = 0x01;
                     66: 
                     67:        /*
                     68:         * Set up the color map entries. We use three entries in the
                     69:         * color map. The first, is for black, the second is for
                     70:         * white, and the very last entry is for the inverted cursor.
                     71:         */
                     72:        REGBASE->creg_select = 0x00;
                     73:        REGBASE->cmap_red    = 0x00;
                     74:        REGBASE->cmap_grn    = 0x00;
                     75:        REGBASE->cmap_blu    = 0x00;
                     76:        REGBASE->cmap_write  = 0x00;
                     77:        gbcm_waitbusy(REGADDR);
                     78:        
                     79:        REGBASE->creg_select = 0x01;
                     80:        REGBASE->cmap_red    = 0xFF;
                     81:        REGBASE->cmap_grn    = 0xFF;
                     82:        REGBASE->cmap_blu    = 0xFF;
                     83:        REGBASE->cmap_write  = 0x01;
                     84:        gbcm_waitbusy(REGADDR);
                     85: 
                     86:        REGBASE->creg_select = 0xFF;
                     87:        REGBASE->cmap_red    = 0xFF;
                     88:        REGBASE->cmap_grn    = 0xFF;
                     89:        REGBASE->cmap_blu    = 0xFF;
                     90:        REGBASE->cmap_write  = 0x01;
                     91:        gbcm_waitbusy(REGADDR);
                     92: 
                     93:        ite_devinfo(ip);
                     94:        ite_fontinit(ip);
                     95: 
                     96:        /*
                     97:         * Clear the display. This used to be before the font unpacking
                     98:         * but it crashes. Figure it out later.
                     99:         */
                    100:        gatorbox_windowmove(ip, 0, 0, 0, 0, ip->dheight, ip->dwidth, RR_CLEAR);
                    101:        tile_mover_waitbusy(REGADDR);
                    102: 
                    103:        /*
                    104:         * Stash the inverted cursor.
                    105:         */
                    106:        gatorbox_windowmove(ip, charY(ip, ' '), charX(ip, ' '),
                    107:                            ip->cblanky, ip->cblankx, ip->ftheight,
                    108:                            ip->ftwidth, RR_COPYINVERTED);
                    109: }
                    110: 
                    111: gatorbox_putc(ip, c, dy, dx, mode)
                    112:        register struct ite_softc *ip;
                    113:         register int dy, dx;
                    114:        int c, mode;
                    115: {
                    116:        gatorbox_windowmove(ip, charY(ip, c), charX(ip, c),
                    117:                            dy * ip->ftheight, dx * ip->ftwidth,
                    118:                            ip->ftheight, ip->ftwidth, RR_COPY);
                    119: }
                    120: 
                    121: gatorbox_cursor(ip, flag)
                    122:        register struct ite_softc *ip;
                    123:         register int flag;
                    124: {
                    125:        if (flag == DRAW_CURSOR)
                    126:                draw_cursor(ip)
                    127:        else if (flag == MOVE_CURSOR) {
                    128:                erase_cursor(ip)
                    129:                draw_cursor(ip)
                    130:        }
                    131:        else
                    132:                erase_cursor(ip)
                    133: }
                    134: 
                    135: gatorbox_clear(ip, sy, sx, h, w)
                    136:        struct ite_softc *ip;
                    137:        register int sy, sx, h, w;
                    138: {
                    139:        gatorbox_windowmove(ip, sy * ip->ftheight, sx * ip->ftwidth,
                    140:                            sy * ip->ftheight, sx * ip->ftwidth, 
                    141:                            h  * ip->ftheight, w  * ip->ftwidth,
                    142:                            RR_CLEAR);
                    143: }
                    144: 
                    145: #define        gatorbox_blockmove(ip, sy, sx, dy, dx, h, w) \
                    146:        gatorbox_windowmove((ip), \
                    147:                            (sy) * ip->ftheight, \
                    148:                            (sx) * ip->ftwidth, \
                    149:                            (dy) * ip->ftheight, \
                    150:                            (dx) * ip->ftwidth, \
                    151:                            (h)  * ip->ftheight, \
                    152:                            (w)  * ip->ftwidth, \
                    153:                            RR_COPY)
                    154: 
                    155: gatorbox_scroll(ip, sy, sx, count, dir)
                    156:         register struct ite_softc *ip;
                    157:         register int sy;
                    158:         int dir, sx, count;
                    159: {
                    160:        register int height, dy, i;
                    161:        
                    162:        tile_mover_waitbusy(REGADDR);
                    163:        REGBASE->write_protect = 0x0;
                    164: 
                    165:        gatorbox_cursor(ip, ERASE_CURSOR);
                    166: 
                    167:        dy = sy - count;
                    168:        height = ip->rows - sy;
                    169:        for (i = 0; i < height; i++)
                    170:                gatorbox_blockmove(ip, sy + i, sx, dy + i, 0, 1, ip->cols);
                    171: }
                    172: 
                    173: gatorbox_windowmove(ip, sy, sx, dy, dx, h, w, mask)
                    174:      register struct ite_softc *ip;
                    175:      int sy, sx, dy, dx, mask;
                    176:      register int h, w;
                    177: {
                    178:        register int src, dest;
                    179: 
                    180:        src  = (sy * 1024) + sx;        /* upper left corner in pixels */
                    181:        dest = (dy * 1024) + dx;
                    182: 
                    183:        tile_mover_waitbusy(REGADDR);
                    184:        REGBASE->width = -(w / 4);
                    185:        REGBASE->height = -(h / 4);
                    186:        if (src < dest)
                    187:                REGBASE->rep_rule = MOVE_DOWN_RIGHT|mask;
                    188:        else {
                    189:                REGBASE->rep_rule = MOVE_UP_LEFT|mask;
                    190:                /*
                    191:                 * Adjust to top of lower right tile of the block.
                    192:                 */
                    193:                src = src + ((h - 4) * 1024) + (w - 4);
                    194:                dest= dest + ((h - 4) * 1024) + (w - 4);
                    195:        }
                    196:        FBBASE[dest] = FBBASE[src];
                    197: }
                    198: #endif

unix.superglobalmegacorp.com

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