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