|
|
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 is only permitted until one year after the first shipment
11: * of 4.4BSD by the Regents. Otherwise, redistribution and use in source and
12: * binary forms are permitted provided that: (1) source distributions retain
13: * this entire copyright notice and comment, and (2) distributions including
14: * binaries display the following acknowledgement: This product includes
15: * software developed by the University of California, Berkeley and its
16: * contributors'' in the documentation or other materials provided with the
17: * distribution and in all advertising materials mentioning features or use
18: * of this software. Neither the name of the University nor the names of
19: * its contributors may be used to endorse or promote products derived from
20: * this software without specific prior written permission.
21: * THIS SOFTWARE IS PROVIDED AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
22: * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
23: * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
24: *
25: * from: Utah $Hdr: ite_gb.c 1.8 89/02/23$
26: *
27: * @(#)ite_gb.c 7.1 (Berkeley) 5/8/90
28: */
29:
30: #include "samachdep.h"
31:
32: #ifdef ITECONSOLE
33:
34: #include "param.h"
35:
36: #include "../hpdev/itevar.h"
37: #include "../hpdev/itereg.h"
38: #include "../hpdev/grfvar.h"
39: #include "../hpdev/grf_gbreg.h"
40:
41: #define REGBASE ((struct gboxfb *)(ip->regbase))
42: #define WINDOWMOVER gatorbox_windowmove
43:
44: gatorbox_init(ip)
45: register struct ite_softc *ip;
46: {
47: REGBASE->write_protect = 0x0;
48: REGBASE->interrupt = 0x4;
49: REGBASE->rep_rule = RR_COPY;
50: REGBASE->blink1 = 0xff;
51: REGBASE->blink2 = 0xff;
52: REGBASE->sec_interrupt = 0x01;
53:
54: /*
55: * Set up the color map entries. We use three entries in the
56: * color map. The first, is for black, the second is for
57: * white, and the very last entry is for the inverted cursor.
58: */
59: REGBASE->creg_select = 0x00;
60: REGBASE->cmap_red = 0x00;
61: REGBASE->cmap_grn = 0x00;
62: REGBASE->cmap_blu = 0x00;
63: REGBASE->cmap_write = 0x00;
64: gbcm_waitbusy(REGADDR);
65:
66: REGBASE->creg_select = 0x01;
67: REGBASE->cmap_red = 0xFF;
68: REGBASE->cmap_grn = 0xFF;
69: REGBASE->cmap_blu = 0xFF;
70: REGBASE->cmap_write = 0x01;
71: gbcm_waitbusy(REGADDR);
72:
73: REGBASE->creg_select = 0xFF;
74: REGBASE->cmap_red = 0xFF;
75: REGBASE->cmap_grn = 0xFF;
76: REGBASE->cmap_blu = 0xFF;
77: REGBASE->cmap_write = 0x01;
78: gbcm_waitbusy(REGADDR);
79:
80: ite_devinfo(ip);
81: ite_fontinit(ip);
82:
83: /*
84: * Clear the display. This used to be before the font unpacking
85: * but it crashes. Figure it out later.
86: */
87: gatorbox_windowmove(ip, 0, 0, 0, 0, ip->dheight, ip->dwidth, RR_CLEAR);
88: tile_mover_waitbusy(REGADDR);
89:
90: /*
91: * Stash the inverted cursor.
92: */
93: gatorbox_windowmove(ip, charY(ip, ' '), charX(ip, ' '),
94: ip->cblanky, ip->cblankx, ip->ftheight,
95: ip->ftwidth, RR_COPYINVERTED);
96: }
97:
98: gatorbox_putc(ip, c, dy, dx, mode)
99: register struct ite_softc *ip;
100: register int dy, dx;
101: int c, mode;
102: {
103: gatorbox_windowmove(ip, charY(ip, c), charX(ip, c),
104: dy * ip->ftheight, dx * ip->ftwidth,
105: ip->ftheight, ip->ftwidth, RR_COPY);
106: }
107:
108: gatorbox_cursor(ip, flag)
109: register struct ite_softc *ip;
110: register int flag;
111: {
112: if (flag == DRAW_CURSOR)
113: draw_cursor(ip)
114: else if (flag == MOVE_CURSOR) {
115: erase_cursor(ip)
116: draw_cursor(ip)
117: }
118: else
119: erase_cursor(ip)
120: }
121:
122: gatorbox_clear(ip, sy, sx, h, w)
123: struct ite_softc *ip;
124: register int sy, sx, h, w;
125: {
126: gatorbox_windowmove(ip, sy * ip->ftheight, sx * ip->ftwidth,
127: sy * ip->ftheight, sx * ip->ftwidth,
128: h * ip->ftheight, w * ip->ftwidth,
129: RR_CLEAR);
130: }
131:
132: #define gatorbox_blockmove(ip, sy, sx, dy, dx, h, w) \
133: gatorbox_windowmove((ip), \
134: (sy) * ip->ftheight, \
135: (sx) * ip->ftwidth, \
136: (dy) * ip->ftheight, \
137: (dx) * ip->ftwidth, \
138: (h) * ip->ftheight, \
139: (w) * ip->ftwidth, \
140: RR_COPY)
141:
142: gatorbox_scroll(ip, sy, sx, count, dir)
143: register struct ite_softc *ip;
144: register int sy;
145: int dir, sx, count;
146: {
147: register int height, dy, i;
148:
149: tile_mover_waitbusy(REGADDR);
150: REGBASE->write_protect = 0x0;
151:
152: gatorbox_cursor(ip, ERASE_CURSOR);
153:
154: dy = sy - count;
155: height = ip->rows - sy;
156: for (i = 0; i < height; i++)
157: gatorbox_blockmove(ip, sy + i, sx, dy + i, 0, 1, ip->cols);
158: }
159:
160: gatorbox_windowmove(ip, sy, sx, dy, dx, h, w, mask)
161: register struct ite_softc *ip;
162: int sy, sx, dy, dx, mask;
163: register int h, w;
164: {
165: register int src, dest;
166:
167: src = (sy * 1024) + sx; /* upper left corner in pixels */
168: dest = (dy * 1024) + dx;
169:
170: tile_mover_waitbusy(REGADDR);
171: REGBASE->width = -(w / 4);
172: REGBASE->height = -(h / 4);
173: if (src < dest)
174: REGBASE->rep_rule = MOVE_DOWN_RIGHT|mask;
175: else {
176: REGBASE->rep_rule = MOVE_UP_LEFT|mask;
177: /*
178: * Adjust to top of lower right tile of the block.
179: */
180: src = src + ((h - 4) * 1024) + (w - 4);
181: dest= dest + ((h - 4) * 1024) + (w - 4);
182: }
183: FBBASE[dest] = FBBASE[src];
184: }
185: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.