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