xref: /csrg-svn/sys/hp300/stand/ite_tc.c (revision 41488)
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_tc.c 1.9 89/02/20$
13*41488Smckusick  *
14*41488Smckusick  *	@(#)ite_tc.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_tcreg.h"
26*41488Smckusick 
27*41488Smckusick #define REGBASE	    	((struct tcboxfb *)(ip->regbase))
28*41488Smckusick #define WINDOWMOVER 	topcat_windowmove
29*41488Smckusick 
30*41488Smckusick topcat_init(ip)
31*41488Smckusick 	register struct ite_softc *ip;
32*41488Smckusick {
33*41488Smckusick 
34*41488Smckusick 	/*
35*41488Smckusick 	 * Determine the number of planes by writing to the first frame
36*41488Smckusick 	 * buffer display location, then reading it back.
37*41488Smckusick 	 */
38*41488Smckusick 	REGBASE->wen = ~0;
39*41488Smckusick 	REGBASE->fben = ~0;
40*41488Smckusick 	REGBASE->prr = RR_COPY;
41*41488Smckusick 	*FBBASE = 0xFF;
42*41488Smckusick 	ip->planemask = *FBBASE;
43*41488Smckusick 
44*41488Smckusick 	/*
45*41488Smckusick 	 * Enable reading/writing of all the planes.
46*41488Smckusick 	 */
47*41488Smckusick 	REGBASE->fben = ip->planemask;
48*41488Smckusick 	REGBASE->wen  = ip->planemask;
49*41488Smckusick 	REGBASE->ren  = ip->planemask;
50*41488Smckusick 	REGBASE->prr  = RR_COPY;
51*41488Smckusick 
52*41488Smckusick 	ite_devinfo(ip);
53*41488Smckusick 
54*41488Smckusick 	/*
55*41488Smckusick 	 * Clear the framebuffer on all planes.
56*41488Smckusick 	 */
57*41488Smckusick 	topcat_windowmove(ip, 0, 0, 0, 0, ip->fbheight, ip->fbwidth, RR_CLEAR);
58*41488Smckusick 	tc_waitbusy(REGADDR, ip->planemask);
59*41488Smckusick 
60*41488Smckusick 	ite_fontinit(ip);
61*41488Smckusick 
62*41488Smckusick 	/*
63*41488Smckusick 	 * Stash the inverted cursor.
64*41488Smckusick 	 */
65*41488Smckusick 	topcat_windowmove(ip, charY(ip, ' '), charX(ip, ' '),
66*41488Smckusick 			  ip->cblanky, ip->cblankx, ip->ftheight,
67*41488Smckusick 			  ip->ftwidth, RR_COPYINVERTED);
68*41488Smckusick }
69*41488Smckusick 
70*41488Smckusick topcat_putc(ip, c, dy, dx, mode)
71*41488Smckusick 	register struct ite_softc *ip;
72*41488Smckusick         register int dy, dx;
73*41488Smckusick 	int c, mode;
74*41488Smckusick {
75*41488Smckusick 	topcat_windowmove(ip, charY(ip, c), charX(ip, c),
76*41488Smckusick 			  dy * ip->ftheight, dx * ip->ftwidth,
77*41488Smckusick 			  ip->ftheight, ip->ftwidth, RR_COPY);
78*41488Smckusick }
79*41488Smckusick 
80*41488Smckusick topcat_cursor(ip, flag)
81*41488Smckusick 	register struct ite_softc *ip;
82*41488Smckusick         register int flag;
83*41488Smckusick {
84*41488Smckusick 	if (flag == DRAW_CURSOR)
85*41488Smckusick 		draw_cursor(ip)
86*41488Smckusick 	else if (flag == MOVE_CURSOR) {
87*41488Smckusick 		erase_cursor(ip)
88*41488Smckusick 		draw_cursor(ip)
89*41488Smckusick 	}
90*41488Smckusick 	else
91*41488Smckusick 		erase_cursor(ip)
92*41488Smckusick }
93*41488Smckusick 
94*41488Smckusick topcat_clear(ip, sy, sx, h, w)
95*41488Smckusick 	struct ite_softc *ip;
96*41488Smckusick 	register int sy, sx, h, w;
97*41488Smckusick {
98*41488Smckusick 	topcat_windowmove(ip, sy * ip->ftheight, sx * ip->ftwidth,
99*41488Smckusick 			  sy * ip->ftheight, sx * ip->ftwidth,
100*41488Smckusick 			  h  * ip->ftheight, w  * ip->ftwidth,
101*41488Smckusick 			  RR_CLEAR);
102*41488Smckusick }
103*41488Smckusick 
104*41488Smckusick topcat_scroll(ip, sy, sx, count, dir)
105*41488Smckusick         register struct ite_softc *ip;
106*41488Smckusick         register int sy, count;
107*41488Smckusick         int dir, sx;
108*41488Smckusick {
109*41488Smckusick 	register int dy = sy - count;
110*41488Smckusick 	register int height = ip->rows - sy;
111*41488Smckusick 
112*41488Smckusick 	topcat_cursor(ip, ERASE_CURSOR);
113*41488Smckusick 
114*41488Smckusick 	topcat_windowmove(ip, sy * ip->ftheight, sx * ip->ftwidth,
115*41488Smckusick 			  dy * ip->ftheight, sx * ip->ftwidth,
116*41488Smckusick 			  height * ip->ftheight,
117*41488Smckusick 			  ip->cols  * ip->ftwidth, RR_COPY);
118*41488Smckusick }
119*41488Smckusick 
120*41488Smckusick topcat_windowmove(ip, sy, sx, dy, dx, h, w, func)
121*41488Smckusick 	struct ite_softc *ip;
122*41488Smckusick 	int sy, sx, dy, dx, h, w, func;
123*41488Smckusick {
124*41488Smckusick   	register struct tcboxfb *rp = REGBASE;
125*41488Smckusick 
126*41488Smckusick 	if (h == 0 || w == 0)
127*41488Smckusick 		return;
128*41488Smckusick 	tc_waitbusy(REGADDR, ip->planemask);
129*41488Smckusick 	rp->wmrr     = func;
130*41488Smckusick 	rp->source_y = sy;
131*41488Smckusick 	rp->source_x = sx;
132*41488Smckusick 	rp->dest_y   = dy;
133*41488Smckusick 	rp->dest_x   = dx;
134*41488Smckusick 	rp->wheight  = h;
135*41488Smckusick 	rp->wwidth   = w;
136*41488Smckusick 	rp->wmove    = ip->planemask;
137*41488Smckusick }
138*41488Smckusick #endif
139