diff options
author | kato <kato@FreeBSD.org> | 1999-06-24 10:51:40 +0000 |
---|---|---|
committer | kato <kato@FreeBSD.org> | 1999-06-24 10:51:40 +0000 |
commit | 2e2fe43a357a07fe5a62764e2d21d93dd709f407 (patch) | |
tree | 4fd299a6d70722066b5c33820fff20f0284d4c11 /sys/pc98/cbus/scgdcrndr.c | |
parent | 4859384f0d8a6d9a04c7f3c535176758cd205454 (diff) | |
download | FreeBSD-src-2e2fe43a357a07fe5a62764e2d21d93dd709f407.zip FreeBSD-src-2e2fe43a357a07fe5a62764e2d21d93dd709f407.tar.gz |
PC98 part of the second phase of syscons reorganization.
Submitted by: yokota
Diffstat (limited to 'sys/pc98/cbus/scgdcrndr.c')
-rw-r--r-- | sys/pc98/cbus/scgdcrndr.c | 180 |
1 files changed, 180 insertions, 0 deletions
diff --git a/sys/pc98/cbus/scgdcrndr.c b/sys/pc98/cbus/scgdcrndr.c new file mode 100644 index 0000000..e1ce7b8 --- /dev/null +++ b/sys/pc98/cbus/scgdcrndr.c @@ -0,0 +1,180 @@ +/*- + * $Id:$ + */ + +#include "sc.h" +#include "gdc.h" +#include "opt_syscons.h" +#include "opt_gdc.h" + +#if NSC > 0 && NGDC > 0 + +#include <sys/param.h> +#include <sys/systm.h> +#include <sys/kernel.h> + +#include <machine/console.h> +#include <machine/md_var.h> + +#include <pc98/pc98/pc98.h> +#include <pc98/pc98/pc98_machdep.h> + +#include <dev/fb/fbreg.h> +#include <dev/syscons/syscons.h> + +#ifndef SC_RENDER_DEBUG +#define SC_RENDER_DEBUG 0 +#endif + +static vr_clear_t gdc_txtclear; +static vr_draw_border_t gdc_txtborder; +static vr_draw_t gdc_txtdraw; +static vr_set_cursor_t gdc_txtcursor_shape; +static vr_draw_cursor_t gdc_txtcursor; +#ifndef SC_NO_CUTPASTE +static vr_draw_mouse_t gdc_txtmouse; +#else +#define gdc_txtmouse (vr_draw_mouse_t *)gdc_nop +#endif + +#ifndef SC_NO_MODE_CHANGE +static vr_draw_border_t gdc_grborder; +#endif + +static void gdc_nop(scr_stat *scp, ...); + +static sc_rndr_sw_t txtrndrsw = { + gdc_txtclear, + gdc_txtborder, + gdc_txtdraw, + gdc_txtcursor_shape, + gdc_txtcursor, + (vr_blink_cursor_t *)gdc_nop, + (vr_set_mouse_t *)gdc_nop, + gdc_txtmouse, +}; +RENDERER(gdc, 0, txtrndrsw); + +#ifndef SC_NO_MODE_CHANGE +static sc_rndr_sw_t grrndrsw = { + (vr_clear_t *)gdc_nop, + gdc_grborder, + (vr_draw_t *)gdc_nop, + (vr_set_cursor_t *)gdc_nop, + (vr_draw_cursor_t *)gdc_nop, + (vr_blink_cursor_t *)gdc_nop, + (vr_set_mouse_t *)gdc_nop, + (vr_draw_mouse_t *)gdc_nop, +}; +RENDERER(gdc, GRAPHICS_MODE, grrndrsw); +#endif /* SC_NO_MODE_CHANGE */ + +static void +gdc_nop(scr_stat *scp, ...) +{ +} + +/* text mode renderer */ + +static void +gdc_txtclear(scr_stat *scp, int c, int attr) +{ + sc_vtb_clear(&scp->scr, c, attr); +} + +static void +gdc_txtborder(scr_stat *scp, int color) +{ + (*vidsw[scp->sc->adapter]->set_border)(scp->sc->adp, color); +} + +static void +gdc_txtdraw(scr_stat *scp, int from, int count, int flip) +{ + vm_offset_t p; + int c; + int a; + + if (from + count > scp->xsize*scp->ysize) + count = scp->xsize*scp->ysize - from; + + if (flip) { + p = sc_vtb_pointer(&scp->scr, from); + for (; count-- > 0; ++from) { + c = sc_vtb_getc(&scp->vtb, from); + a = sc_vtb_geta(&scp->vtb, from) ^ 0x4; + sc_vtb_putchar(&scp->scr, p, c, a); + } + } else { + sc_vtb_copy(&scp->vtb, from, &scp->scr, from, count); + } +} + +static void +gdc_txtcursor_shape(scr_stat *scp, int base, int height, int blink) +{ + if (base < 0 || base >= scp->font_size) + return; + /* the caller may set height <= 0 in order to disable the cursor */ + (*vidsw[scp->sc->adapter]->set_hw_cursor_shape)(scp->sc->adp, + base, height, + scp->font_size, blink); +} + +static void +gdc_txtcursor(scr_stat *scp, int at, int blink, int on, int flip) +{ + if (on) { + scp->status |= VR_CURSOR_ON; + (*vidsw[scp->sc->adapter]->set_hw_cursor)(scp->sc->adp, + at%scp->xsize, at/scp->xsize); + } else { + if (scp->status & VR_CURSOR_ON) + (*vidsw[scp->sc->adapter]->set_hw_cursor)(scp->sc->adp, + -1, -1); + scp->status &= ~VR_CURSOR_ON; + } +} + +#ifndef SC_NO_CUTPASTE + +static void +draw_txtmouse(scr_stat *scp, int x, int y) +{ + int at; + + at = (y/scp->font_size - scp->yoff)*scp->xsize + x/8 - scp->xoff; + sc_vtb_putc(&scp->scr, at, + sc_vtb_getc(&scp->scr, at), + sc_vtb_geta(&scp->scr, at) ^ 0x4); +} + +static void +remove_txtmouse(scr_stat *scp, int x, int y) +{ +} + +static void +gdc_txtmouse(scr_stat *scp, int x, int y, int on) +{ + if (on) + draw_txtmouse(scp, x, y); + else + remove_txtmouse(scp, x, y); +} + +#endif /* SC_NO_CUTPASTE */ + +#ifndef SC_NO_MODE_CHANGE + +/* graphics mode renderer */ + +static void +gdc_grborder(scr_stat *scp, int color) +{ + (*vidsw[scp->sc->adapter]->set_border)(scp->sc->adp, color); +} + +#endif /* SC_NO_MODE_CHANGE */ + +#endif /* NSC > 0 && NGDC > 0 */ |