|
|
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_subr.c 1.1 90/07/09$
39: *
40: * @(#)ite_subr.c 7.4 (Berkeley) 5/4/91
41: */
42:
43: #include "ite.h"
44: #if NITE > 0
45:
46: #include "param.h"
47: #include "conf.h"
48: #include "proc.h"
49: #include "ioctl.h"
50: #include "tty.h"
51: #include "systm.h"
52:
53: #include "itevar.h"
54: #include "itereg.h"
55:
56: #include "machine/cpu.h"
57:
58: ite_devinfo(ip)
59: struct ite_softc *ip;
60: {
61: struct fontinfo *fi;
62: struct font *fd;
63:
64: fi = (struct fontinfo *) ((*FONTROM << 8 | *(FONTROM + 2)) + REGADDR);
65: fd = (struct font *) ((fi->haddr << 8 | fi->laddr) + REGADDR);
66:
67: ip->ftheight = fd->fh;
68: ip->ftwidth = fd->fw;
69: ip->fbwidth = ITEREGS->fbwidth_h << 8 | ITEREGS->fbwidth_l;
70: ip->fbheight = ITEREGS->fbheight_h << 8 | ITEREGS->fbheight_l;
71: ip->dwidth = ITEREGS->dispwidth_h << 8 | ITEREGS->dispwidth_l;
72: ip->dheight = ITEREGS->dispheight_h << 8 | ITEREGS->dispheight_l;
73: ip->rows = ip->dheight / ip->ftheight;
74: ip->cols = ip->dwidth / ip->ftwidth;
75:
76: if (ip->fbwidth > ip->dwidth) {
77: /*
78: * Stuff goes to right of display.
79: */
80: ip->fontx = ip->dwidth;
81: ip->fonty = 0;
82: ip->cpl = (ip->fbwidth - ip->dwidth) / ip->ftwidth;
83: ip->cblankx = ip->dwidth;
84: ip->cblanky = ip->fonty + ((128 / ip->cpl) +1) * ip->ftheight;
85: }
86: else {
87: /*
88: * Stuff goes below the display.
89: */
90: ip->fontx = 0;
91: ip->fonty = ip->dheight;
92: ip->cpl = ip->fbwidth / ip->ftwidth;
93: ip->cblankx = 0;
94: ip->cblanky = ip->fonty + ((128 / ip->cpl) + 1) * ip->ftheight;
95: }
96: }
97:
98: ite_fontinit(ip)
99: register struct ite_softc *ip;
100: {
101: struct fontinfo *fi;
102: struct font *fd;
103: register u_char *fbmem, *dp;
104: register int bn;
105: int c, l, b;
106:
107: fi = (struct fontinfo *) ((*FONTROM << 8 | *(FONTROM + 2)) + REGADDR);
108: fd = (struct font *) ((fi->haddr << 8 | fi->laddr) + REGADDR);
109:
110: dp = fd->data;
111:
112: for (c = 0; c < 128; c++) {
113: fbmem = (u_char *) FBBASE +
114: (ip->fonty + (c / ip->cpl) * ip->ftheight) *
115: ip->fbwidth;
116: fbmem += ip->fontx + (c % ip->cpl) * ip->ftwidth;
117: for (l = 0; l < ip->ftheight; l++) {
118: bn = 7;
119: for (b = 0; b < ip->ftwidth; b++) {
120: if ((1 << bn) & *dp)
121: *fbmem++ = 1;
122: else
123: *fbmem++ = 0;
124: if (--bn < 0) {
125: bn = 7;
126: dp += 2;
127: }
128: }
129: if (bn < 7)
130: dp += 2;
131: fbmem -= ip->ftwidth;
132: fbmem += ip->fbwidth;
133: }
134: }
135:
136: }
137: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.