home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / bsd_srcs / sys / hp300 / stand / ite_tc.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-05-05  |  4.7 KB  |  165 lines

  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_tc.c 1.9 89/02/20$
  39.  *
  40.  *    @(#)ite_tc.c    7.2 (Berkeley) 12/16/90
  41.  */
  42.  
  43. #include "samachdep.h"
  44.  
  45. #ifdef ITECONSOLE
  46.  
  47. #include "sys/param.h"
  48. #include "../dev/itevar.h"
  49. #include "../dev/itereg.h"
  50. #include "../dev/grfvar.h"
  51. #include "../dev/grf_tcreg.h"
  52.  
  53. #define REGBASE            ((struct tcboxfb *)(ip->regbase))
  54. #define WINDOWMOVER     topcat_windowmove
  55.  
  56. topcat_init(ip)
  57.     register struct ite_softc *ip;
  58. {
  59.  
  60.     /*
  61.      * Determine the number of planes by writing to the first frame
  62.      * buffer display location, then reading it back. 
  63.      */
  64.     REGBASE->wen = ~0;
  65.     REGBASE->fben = ~0;
  66.     REGBASE->prr = RR_COPY;
  67.     *FBBASE = 0xFF;
  68.     ip->planemask = *FBBASE;
  69.  
  70.     /*
  71.      * Enable reading/writing of all the planes.
  72.      */
  73.     REGBASE->fben = ip->planemask;
  74.     REGBASE->wen  = ip->planemask;
  75.     REGBASE->ren  = ip->planemask;
  76.     REGBASE->prr  = RR_COPY;
  77.  
  78.     ite_devinfo(ip);
  79.  
  80.     /*
  81.      * Clear the framebuffer on all planes.
  82.      */
  83.     topcat_windowmove(ip, 0, 0, 0, 0, ip->fbheight, ip->fbwidth, RR_CLEAR);
  84.     tc_waitbusy(REGADDR, ip->planemask);
  85.  
  86.     ite_fontinit(ip);
  87.  
  88.     /*
  89.      * Stash the inverted cursor.
  90.      */
  91.     topcat_windowmove(ip, charY(ip, ' '), charX(ip, ' '),
  92.               ip->cblanky, ip->cblankx, ip->ftheight,
  93.               ip->ftwidth, RR_COPYINVERTED);
  94. }
  95.  
  96. topcat_putc(ip, c, dy, dx, mode)
  97.     register struct ite_softc *ip;
  98.         register int dy, dx;
  99.     int c, mode;
  100. {
  101.     topcat_windowmove(ip, charY(ip, c), charX(ip, c),
  102.               dy * ip->ftheight, dx * ip->ftwidth,
  103.               ip->ftheight, ip->ftwidth, RR_COPY);
  104. }
  105.  
  106. topcat_cursor(ip, flag)
  107.     register struct ite_softc *ip;
  108.         register int flag;
  109. {
  110.     if (flag == DRAW_CURSOR)
  111.         draw_cursor(ip)
  112.     else if (flag == MOVE_CURSOR) {
  113.         erase_cursor(ip)
  114.         draw_cursor(ip)
  115.     }
  116.     else
  117.         erase_cursor(ip)
  118. }
  119.  
  120. topcat_clear(ip, sy, sx, h, w)
  121.     struct ite_softc *ip;
  122.     register int sy, sx, h, w;
  123. {
  124.     topcat_windowmove(ip, sy * ip->ftheight, sx * ip->ftwidth,
  125.               sy * ip->ftheight, sx * ip->ftwidth, 
  126.               h  * ip->ftheight, w  * ip->ftwidth,
  127.               RR_CLEAR);
  128. }
  129.  
  130. topcat_scroll(ip, sy, sx, count, dir)
  131.         register struct ite_softc *ip;
  132.         register int sy, count;
  133.         int dir, sx;
  134. {
  135.     register int dy = sy - count;
  136.     register int height = ip->rows - sy;
  137.  
  138.     topcat_cursor(ip, ERASE_CURSOR);
  139.  
  140.     topcat_windowmove(ip, sy * ip->ftheight, sx * ip->ftwidth,
  141.               dy * ip->ftheight, sx * ip->ftwidth,
  142.               height * ip->ftheight,
  143.               ip->cols  * ip->ftwidth, RR_COPY);
  144. }
  145.  
  146. topcat_windowmove(ip, sy, sx, dy, dx, h, w, func)
  147.     struct ite_softc *ip;
  148.     int sy, sx, dy, dx, h, w, func;
  149. {
  150.       register struct tcboxfb *rp = REGBASE;
  151.     
  152.     if (h == 0 || w == 0)
  153.         return;
  154.     tc_waitbusy(REGADDR, ip->planemask);
  155.     rp->wmrr     = func;
  156.     rp->source_y = sy;
  157.     rp->source_x = sx;
  158.     rp->dest_y   = dy;
  159.     rp->dest_x   = dx;
  160.     rp->wheight  = h;
  161.     rp->wwidth   = w;
  162.     rp->wmove    = ip->planemask;
  163. }
  164. #endif
  165.