- mc6845's cursor is disabled by punching bit 6 of cursor start register.

- Add new option (PCDISPLAY_SOFTCURSOR) that provides a large, non-blinking
  cursor in software.
This commit is contained in:
ad 1999-09-19 21:48:08 +00:00
parent 072a96b17d
commit f96e055d70
5 changed files with 64 additions and 13 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: files,v 1.315 1999/09/12 01:17:32 chs Exp $
# $NetBSD: files,v 1.316 1999/09/19 21:48:09 ad Exp $
# @(#)files.newconf 7.5 (Berkeley) 5/10/93
@ -381,6 +381,7 @@ define wsmousedev {[mux = -1]}
# attribute to pull in raster support
define wsrasteremulops
# common PC display functions
defopt opt_pcdisplay.h PCDISPLAY_SOFTCURSOR
define pcdisplayops
file dev/ic/pcdisplay_subr.c pcdisplayops
file dev/ic/pcdisplay_chars.c pcdisplayops

View File

@ -1,4 +1,4 @@
/* $NetBSD: pcdisplay_subr.c,v 1.6 1998/07/24 16:12:18 drochner Exp $ */
/* $NetBSD: pcdisplay_subr.c,v 1.7 1999/09/19 21:48:08 ad Exp $ */
/*
* Copyright (c) 1995, 1996 Carnegie-Mellon University.
@ -45,27 +45,54 @@ pcdisplay_cursor(id, on, row, col)
void *id;
int on, row, col;
{
#ifdef PCDISPLAY_SOFTCURSOR
struct pcdisplayscreen *scr = id;
bus_space_tag_t memt = scr->hdl->ph_memt;
bus_space_handle_t memh = scr->hdl->ph_memh;
int off;
/* Remove old cursor image */
if (scr->cursoron) {
off = scr->vc_crow * scr->type->ncols + scr->vc_ccol;
if (scr->active)
bus_space_write_2(memt, memh, scr->dispoffset + off * 2,
scr->cursortmp);
else
scr->mem[off] = scr->cursortmp;
}
scr->vc_crow = row;
scr->vc_ccol = col;
if ((scr->cursoron = on) == 0)
return;
off = (scr->vc_crow * scr->type->ncols + scr->vc_ccol);
scr->cursortmp = bus_space_read_2(memt, memh, scr->dispoffset + off*2);
if (scr->active)
bus_space_write_2(memt, memh, scr->dispoffset + off * 2,
scr->cursortmp ^ 0x7000);
else
scr->mem[off] = scr->cursortmp ^ 0x7000;
#else /* PCDISPLAY_SOFTCURSOR */
struct pcdisplayscreen *scr = id;
int pos;
#if 0
printf("pcdisplay_cursor: %d %d\n", row, col);
#endif
scr->vc_crow = row;
scr->vc_ccol = col;
scr->cursoron = on;
if (scr->active) {
if (!on) {
/* XXX disable cursor how??? */
pos = -1;
} else
if (!on)
pos = 0x1010;
else
pos = scr->dispoffset / 2
+ row * scr->type->ncols + col;
pcdisplay_6845_write(scr->hdl, cursorh, pos >> 8);
pcdisplay_6845_write(scr->hdl, cursorl, pos);
}
#endif /* PCDISPLAY_SOFTCURSOR */
}
#if 0

View File

@ -1,4 +1,4 @@
/* $NetBSD: pcdisplayvar.h,v 1.5 1999/02/12 11:25:24 drochner Exp $ */
/* $NetBSD: pcdisplayvar.h,v 1.6 1999/09/19 21:48:08 ad Exp $ */
/*
* Copyright (c) 1998
@ -32,6 +32,8 @@
*
*/
#include "opt_pcdisplay.h"
struct pcdisplayscreen {
struct pcdisplay_handle *hdl;
@ -41,6 +43,9 @@ struct pcdisplayscreen {
u_int16_t *mem; /* backing store for contents */
int cursoron; /* cursor displayed? */
#ifdef PCDISPLAY_SOFTCURSOR
int cursortmp; /* glyph & attribute behind software cursor */
#endif
int vc_ccol, vc_crow; /* current cursor position */
int dispoffset; /* offset of displayed area in video mem */

View File

@ -1,4 +1,4 @@
/* $NetBSD: vga.c,v 1.17 1999/04/10 14:02:11 drochner Exp $ */
/* $NetBSD: vga.c,v 1.18 1999/09/19 21:48:08 ad Exp $ */
/*
* Copyright (c) 1995, 1996 Carnegie-Mellon University.
@ -408,6 +408,11 @@ vga_init_screen(vc, scr, type, existing, attrp)
if (scr->pcs.dispoffset < scr->mindispoffset ||
scr->pcs.dispoffset > scr->maxdispoffset)
scr->pcs.dispoffset = scr->mindispoffset;
#ifdef PCDISPLAY_SOFTCURSOR
/* disable hardware cursor */
vga_6845_write(&vc->hdl, curstart, 0x10);
vga_6845_write(&vc->hdl, curend, 0x10);
#endif
} else {
cpos = 0;
scr->pcs.dispoffset = scr->mindispoffset;
@ -866,6 +871,10 @@ vga_copyrows(id, srcrow, dstrow, nrows)
if (scr->pcs.active) {
if (dstrow == 0 && (srcrow + nrows == scr->pcs.type->nrows)) {
#ifdef PCDISPLAY_SOFTCURSOR
pcdisplay_cursor(&scr->pcs, 0, scr->pcs.vc_crow,
scr->pcs.vc_ccol);
#endif
/* scroll up whole screen */
if ((scr->pcs.dispoffset + srcrow * ncols * 2)
<= scr->maxdispoffset) {
@ -881,6 +890,10 @@ vga_copyrows(id, srcrow, dstrow, nrows)
scr->pcs.dispoffset >> 9);
vga_6845_write(&scr->cfg->hdl, startadrl,
scr->pcs.dispoffset >> 1);
#ifdef PCDISPLAY_SOFTCURSOR
pcdisplay_cursor(&scr->pcs, scr->pcs.cursoron,
scr->pcs.vc_crow, scr->pcs.vc_ccol);
#endif
} else {
bus_space_copy_region_2(memt, memh,
scr->pcs.dispoffset + srcoff * 2,

View File

@ -1,4 +1,4 @@
/* $NetBSD: vga_subr.c,v 1.4 1999/08/17 16:15:05 drochner Exp $ */
/* $NetBSD: vga_subr.c,v 1.5 1999/09/19 21:48:08 ad Exp $ */
/*
* Copyright (c) 1998
@ -141,10 +141,15 @@ vga_setscreentype(vh, type)
/* lo byte */
vga_6845_write(vh, vde, type->fontheight * type->nrows - 1);
#ifdef PCDISPLAY_SOFTCURSOR
/* disable hardware cursor */
vga_6845_write(vh, curstart, 0x10);
vga_6845_write(vh, curend, 0x10);
#else
/* set cursor to last 2 lines */
vga_6845_write(vh, curstart, type->fontheight - 2);
vga_6845_write(vh, curend, type->fontheight - 1);
#endif
/*
* disable colour plane 3 if needed for font selection
*/