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_subr.c 1.1 90/07/09$ 13 * 14 * @(#)ite_subr.c 7.4 (Berkeley) 05/04/91 15 */ 16 17 #include "ite.h" 18 #if NITE > 0 19 20 #include "param.h" 21 #include "conf.h" 22 #include "proc.h" 23 #include "ioctl.h" 24 #include "tty.h" 25 #include "systm.h" 26 27 #include "itevar.h" 28 #include "itereg.h" 29 30 #include "machine/cpu.h" 31 32 ite_devinfo(ip) 33 struct ite_softc *ip; 34 { 35 struct fontinfo *fi; 36 struct font *fd; 37 38 fi = (struct fontinfo *) ((*FONTROM << 8 | *(FONTROM + 2)) + REGADDR); 39 fd = (struct font *) ((fi->haddr << 8 | fi->laddr) + REGADDR); 40 41 ip->ftheight = fd->fh; 42 ip->ftwidth = fd->fw; 43 ip->fbwidth = ITEREGS->fbwidth_h << 8 | ITEREGS->fbwidth_l; 44 ip->fbheight = ITEREGS->fbheight_h << 8 | ITEREGS->fbheight_l; 45 ip->dwidth = ITEREGS->dispwidth_h << 8 | ITEREGS->dispwidth_l; 46 ip->dheight = ITEREGS->dispheight_h << 8 | ITEREGS->dispheight_l; 47 ip->rows = ip->dheight / ip->ftheight; 48 ip->cols = ip->dwidth / ip->ftwidth; 49 50 if (ip->fbwidth > ip->dwidth) { 51 /* 52 * Stuff goes to right of display. 53 */ 54 ip->fontx = ip->dwidth; 55 ip->fonty = 0; 56 ip->cpl = (ip->fbwidth - ip->dwidth) / ip->ftwidth; 57 ip->cblankx = ip->dwidth; 58 ip->cblanky = ip->fonty + ((128 / ip->cpl) +1) * ip->ftheight; 59 } 60 else { 61 /* 62 * Stuff goes below the display. 63 */ 64 ip->fontx = 0; 65 ip->fonty = ip->dheight; 66 ip->cpl = ip->fbwidth / ip->ftwidth; 67 ip->cblankx = 0; 68 ip->cblanky = ip->fonty + ((128 / ip->cpl) + 1) * ip->ftheight; 69 } 70 } 71 72 ite_fontinit(ip) 73 register struct ite_softc *ip; 74 { 75 struct fontinfo *fi; 76 struct font *fd; 77 register u_char *fbmem, *dp; 78 register int bn; 79 int c, l, b; 80 81 fi = (struct fontinfo *) ((*FONTROM << 8 | *(FONTROM + 2)) + REGADDR); 82 fd = (struct font *) ((fi->haddr << 8 | fi->laddr) + REGADDR); 83 84 dp = fd->data; 85 86 for (c = 0; c < 128; c++) { 87 fbmem = (u_char *) FBBASE + 88 (ip->fonty + (c / ip->cpl) * ip->ftheight) * 89 ip->fbwidth; 90 fbmem += ip->fontx + (c % ip->cpl) * ip->ftwidth; 91 for (l = 0; l < ip->ftheight; l++) { 92 bn = 7; 93 for (b = 0; b < ip->ftwidth; b++) { 94 if ((1 << bn) & *dp) 95 *fbmem++ = 1; 96 else 97 *fbmem++ = 0; 98 if (--bn < 0) { 99 bn = 7; 100 dp += 2; 101 } 102 } 103 if (bn < 7) 104 dp += 2; 105 fbmem -= ip->ftwidth; 106 fbmem += ip->fbwidth; 107 } 108 } 109 110 } 111 #endif 112