141488Smckusick /* 241488Smckusick * Copyright (c) 1988 University of Utah. 341488Smckusick * Copyright (c) 1990 The Regents of the University of California. 441488Smckusick * All rights reserved. 541488Smckusick * 641488Smckusick * This code is derived from software contributed to Berkeley by 741488Smckusick * the Systems Programming Group of the University of Utah Computer 841488Smckusick * Science Department. 941488Smckusick * 1041488Smckusick * %sccs.include.redist.c% 1141488Smckusick * 1241488Smckusick * from: Utah $Hdr: ite_subr.c 1.1 89/02/17$ 1341488Smckusick * 14*45790Sbostic * @(#)ite_subr.c 7.2 (Berkeley) 12/16/90 1541488Smckusick */ 1641488Smckusick 1741488Smckusick #include "samachdep.h" 1841488Smckusick 1941488Smckusick #ifdef ITECONSOLE 2041488Smckusick 21*45790Sbostic #include "sys/param.h" 22*45790Sbostic #include "../dev/itevar.h" 23*45790Sbostic #include "../dev/itereg.h" 2441488Smckusick 2541488Smckusick ite_devinfo(ip) 2641488Smckusick struct ite_softc *ip; 2741488Smckusick { 2841488Smckusick struct fontinfo *fi; 2941488Smckusick struct font *fd; 3041488Smckusick 3141488Smckusick fi = (struct fontinfo *) ((*FONTROM << 8 | *(FONTROM + 2)) + REGADDR); 3241488Smckusick fd = (struct font *) ((fi->haddr << 8 | fi->laddr) + REGADDR); 3341488Smckusick 3441488Smckusick ip->ftheight = fd->fh; 3541488Smckusick ip->ftwidth = fd->fw; 3641488Smckusick ip->fbwidth = ITEREGS->fbwidth_h << 8 | ITEREGS->fbwidth_l; 3741488Smckusick ip->fbheight = ITEREGS->fbheight_h << 8 | ITEREGS->fbheight_l; 3841488Smckusick ip->dwidth = ITEREGS->dispwidth_h << 8 | ITEREGS->dispwidth_l; 3941488Smckusick ip->dheight = ITEREGS->dispheight_h << 8 | ITEREGS->dispheight_l; 4041488Smckusick ip->rows = ip->dheight / ip->ftheight; 4141488Smckusick ip->cols = ip->dwidth / ip->ftwidth; 4241488Smckusick 4341488Smckusick if (ip->fbwidth > ip->dwidth) { 4441488Smckusick /* 4541488Smckusick * Stuff goes to right of display. 4641488Smckusick */ 4741488Smckusick ip->fontx = ip->dwidth; 4841488Smckusick ip->fonty = 0; 4941488Smckusick ip->cpl = (ip->fbwidth - ip->dwidth) / ip->ftwidth; 5041488Smckusick ip->cblankx = ip->dwidth; 5141488Smckusick ip->cblanky = ip->fonty + ((128 / ip->cpl) +1) * ip->ftheight; 5241488Smckusick } 5341488Smckusick else { 5441488Smckusick /* 5541488Smckusick * Stuff goes below the display. 5641488Smckusick */ 5741488Smckusick ip->fontx = 0; 5841488Smckusick ip->fonty = ip->dheight; 5941488Smckusick ip->cpl = ip->fbwidth / ip->ftwidth; 6041488Smckusick ip->cblankx = 0; 6141488Smckusick ip->cblanky = ip->fonty + ((128 / ip->cpl) + 1) * ip->ftheight; 6241488Smckusick } 6341488Smckusick } 6441488Smckusick 6541488Smckusick ite_fontinit(ip) 6641488Smckusick register struct ite_softc *ip; 6741488Smckusick { 6841488Smckusick struct fontinfo *fi; 6941488Smckusick struct font *fd; 7041488Smckusick register u_char *fbmem, *dp; 7141488Smckusick register int bn; 7241488Smckusick int c, l, b; 7341488Smckusick 7441488Smckusick fi = (struct fontinfo *) ((*FONTROM << 8 | *(FONTROM + 2)) + REGADDR); 7541488Smckusick fd = (struct font *) ((fi->haddr << 8 | fi->laddr) + REGADDR); 7641488Smckusick 7741488Smckusick dp = fd->data; 7841488Smckusick 7941488Smckusick for (c = 0; c < 128; c++) { 8041488Smckusick fbmem = (u_char *) FBBASE + 8141488Smckusick (ip->fonty + (c / ip->cpl) * ip->ftheight) * 8241488Smckusick ip->fbwidth; 8341488Smckusick fbmem += ip->fontx + (c % ip->cpl) * ip->ftwidth; 8441488Smckusick for (l = 0; l < ip->ftheight; l++) { 8541488Smckusick bn = 7; 8641488Smckusick for (b = 0; b < ip->ftwidth; b++) { 8741488Smckusick if ((1 << bn) & *dp) 8841488Smckusick *fbmem++ = 1; 8941488Smckusick else 9041488Smckusick *fbmem++ = 0; 9141488Smckusick if (--bn < 0) { 9241488Smckusick bn = 7; 9341488Smckusick dp += 2; 9441488Smckusick } 9541488Smckusick } 9641488Smckusick if (bn < 7) 9741488Smckusick dp += 2; 9841488Smckusick fbmem -= ip->ftwidth; 9941488Smckusick fbmem += ip->fbwidth; 10041488Smckusick } 10141488Smckusick } 10241488Smckusick 10341488Smckusick } 10441488Smckusick #endif 105