1*41480Smckusick /* 2*41480Smckusick * Copyright (c) 1988 University of Utah. 3*41480Smckusick * Copyright (c) 1990 The Regents of the University of California. 4*41480Smckusick * All rights reserved. 5*41480Smckusick * 6*41480Smckusick * This code is derived from software contributed to Berkeley by 7*41480Smckusick * the Systems Programming Group of the University of Utah Computer 8*41480Smckusick * Science Department. 9*41480Smckusick * 10*41480Smckusick * %sccs.include.redist.c% 11*41480Smckusick * 12*41480Smckusick * from: Utah $Hdr: ite_subr.c 1.3 89/04/11$ 13*41480Smckusick * 14*41480Smckusick * @(#)ite_subr.c 7.1 (Berkeley) 05/08/90 15*41480Smckusick */ 16*41480Smckusick 17*41480Smckusick #include "ite.h" 18*41480Smckusick #if NITE > 0 19*41480Smckusick 20*41480Smckusick #include "param.h" 21*41480Smckusick #include "conf.h" 22*41480Smckusick #include "user.h" 23*41480Smckusick #include "proc.h" 24*41480Smckusick #include "ioctl.h" 25*41480Smckusick #include "tty.h" 26*41480Smckusick #include "systm.h" 27*41480Smckusick #include "uio.h" 28*41480Smckusick 29*41480Smckusick #include "itevar.h" 30*41480Smckusick #include "itereg.h" 31*41480Smckusick 32*41480Smckusick #include "machine/cpu.h" 33*41480Smckusick 34*41480Smckusick ite_devinfo(ip) 35*41480Smckusick struct ite_softc *ip; 36*41480Smckusick { 37*41480Smckusick struct fontinfo *fi; 38*41480Smckusick struct font *fd; 39*41480Smckusick 40*41480Smckusick fi = (struct fontinfo *) ((*FONTROM << 8 | *(FONTROM + 2)) + REGADDR); 41*41480Smckusick fd = (struct font *) ((fi->haddr << 8 | fi->laddr) + REGADDR); 42*41480Smckusick 43*41480Smckusick ip->ftheight = fd->fh; 44*41480Smckusick ip->ftwidth = fd->fw; 45*41480Smckusick ip->fbwidth = ITEREGS->fbwidth_h << 8 | ITEREGS->fbwidth_l; 46*41480Smckusick ip->fbheight = ITEREGS->fbheight_h << 8 | ITEREGS->fbheight_l; 47*41480Smckusick ip->dwidth = ITEREGS->dispwidth_h << 8 | ITEREGS->dispwidth_l; 48*41480Smckusick ip->dheight = ITEREGS->dispheight_h << 8 | ITEREGS->dispheight_l; 49*41480Smckusick ip->rows = ip->dheight / ip->ftheight; 50*41480Smckusick ip->cols = ip->dwidth / ip->ftwidth; 51*41480Smckusick 52*41480Smckusick if (ip->fbwidth > ip->dwidth) { 53*41480Smckusick /* 54*41480Smckusick * Stuff goes to right of display. 55*41480Smckusick */ 56*41480Smckusick ip->fontx = ip->dwidth; 57*41480Smckusick ip->fonty = 0; 58*41480Smckusick ip->cpl = (ip->fbwidth - ip->dwidth) / ip->ftwidth; 59*41480Smckusick ip->cblankx = ip->dwidth; 60*41480Smckusick ip->cblanky = ip->fonty + ((128 / ip->cpl) +1) * ip->ftheight; 61*41480Smckusick } 62*41480Smckusick else { 63*41480Smckusick /* 64*41480Smckusick * Stuff goes below the display. 65*41480Smckusick */ 66*41480Smckusick ip->fontx = 0; 67*41480Smckusick ip->fonty = ip->dheight; 68*41480Smckusick ip->cpl = ip->fbwidth / ip->ftwidth; 69*41480Smckusick ip->cblankx = 0; 70*41480Smckusick ip->cblanky = ip->fonty + ((128 / ip->cpl) + 1) * ip->ftheight; 71*41480Smckusick } 72*41480Smckusick } 73*41480Smckusick 74*41480Smckusick ite_fontinit(ip) 75*41480Smckusick register struct ite_softc *ip; 76*41480Smckusick { 77*41480Smckusick struct fontinfo *fi; 78*41480Smckusick struct font *fd; 79*41480Smckusick register u_char *fbmem, *dp; 80*41480Smckusick register int bn; 81*41480Smckusick int c, l, b; 82*41480Smckusick 83*41480Smckusick fi = (struct fontinfo *) ((*FONTROM << 8 | *(FONTROM + 2)) + REGADDR); 84*41480Smckusick fd = (struct font *) ((fi->haddr << 8 | fi->laddr) + REGADDR); 85*41480Smckusick 86*41480Smckusick dp = fd->data; 87*41480Smckusick 88*41480Smckusick for (c = 0; c < 128; c++) { 89*41480Smckusick fbmem = (u_char *) FBBASE + 90*41480Smckusick (ip->fonty + (c / ip->cpl) * ip->ftheight) * 91*41480Smckusick ip->fbwidth; 92*41480Smckusick fbmem += ip->fontx + (c % ip->cpl) * ip->ftwidth; 93*41480Smckusick for (l = 0; l < ip->ftheight; l++) { 94*41480Smckusick bn = 7; 95*41480Smckusick for (b = 0; b < ip->ftwidth; b++) { 96*41480Smckusick if ((1 << bn) & *dp) 97*41480Smckusick *fbmem++ = 1; 98*41480Smckusick else 99*41480Smckusick *fbmem++ = 0; 100*41480Smckusick if (--bn < 0) { 101*41480Smckusick bn = 7; 102*41480Smckusick dp += 2; 103*41480Smckusick } 104*41480Smckusick } 105*41480Smckusick if (bn < 7) 106*41480Smckusick dp += 2; 107*41480Smckusick fbmem -= ip->ftwidth; 108*41480Smckusick fbmem += ip->fbwidth; 109*41480Smckusick } 110*41480Smckusick } 111*41480Smckusick 112*41480Smckusick } 113*41480Smckusick #endif 114