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