Added PC-98 supports.

Submitted by:	Chiharu Shibata <chi@bd.mbn.or.jp>,
		Tomokazu HARADA <tkhara@osk4.3web.ne.jp> and
		yokota
This commit is contained in:
nyan 2000-04-27 13:37:40 +00:00
parent 34c45fc8f0
commit a523934af1
3 changed files with 86 additions and 0 deletions

View File

@ -35,9 +35,11 @@
#include <dev/fb/fbreg.h>
#include <dev/fb/splashreg.h>
#ifndef PC98
#include <dev/fb/vgareg.h>
#include <isa/isareg.h>
#endif
#define FADE_TIMEOUT 15 /* sec */
#define FADE_LEVELS 10
@ -62,6 +64,15 @@ bmp_start(video_adapter_t *adp)
{
/* currently only 256-color modes are supported XXX */
static int modes[] = {
#ifdef PC98
/*
* As 640x400 doesn't generally look great,
* it's least preferred here.
*/
M_PC98_PEGC640x400,
M_PC98_PEGC640x480,
M_PC98_EGC640x400,
#else
M_VESA_CG640x480,
M_VESA_CG800x600,
M_VESA_CG1024x768,
@ -71,6 +82,7 @@ bmp_start(video_adapter_t *adp)
* it's least preferred here.
*/
M_VGA_CG320,
#endif
-1,
};
video_info_t info;
@ -226,6 +238,9 @@ typedef struct
u_char *vidmem; /* video memory allocated for drawing */
video_adapter_t *adp;
int bank;
#ifdef PC98
u_char prev_val;
#endif
} BMP_INFO;
static BMP_INFO bmp_info;
@ -257,6 +272,26 @@ bmp_SetPix(BMP_INFO *info, int x, int y, u_char val)
x += (info->swidth - info->width) / 2;
switch(info->sdepth) {
#ifdef PC98
case 4:
x += (info->swidth - info->width) / 2;
sofs += (x >> 3);
bofs = x & 0x7; /* offset within byte */
outb(0x7c, 0x80 | 0x40); /* GRCG on & RMW mode */
if (val != info->prev_val) {
outb(0x7e, (val & 1) ? 0xff : 0); /* tile B */
outb(0x7e, (val & 2) ? 0xff : 0); /* tile R */
outb(0x7e, (val & 4) ? 0xff : 0); /* tile G */
outb(0x7e, (val & 8) ? 0xff : 0); /* tile I */
info->prev_val = val;
}
*(info->vidmem+sofs) = (0x80 >> bofs); /* write new bit */
outb(0x7c, 0); /* GRCG off */
break;
#else
case 4:
case 1:
/* EGA/VGA planar modes */
@ -272,6 +307,7 @@ bmp_SetPix(BMP_INFO *info, int x, int y, u_char val)
outw(GDCIDX, (val << 8) | 0x00); /* set/reset */
*(info->vidmem + sofs) ^= 0xff; /* read-modify-write */
break;
#endif
case 8:
sofs += x;
@ -567,10 +603,14 @@ bmp_Draw(video_adapter_t *adp)
/* initialise the info structure for drawing */
bmp_info.index = bmp_info.data;
#ifdef PC98
bmp_info.prev_val = 255;
#endif
/* set the palette for our image */
(*vidsw[adp->va_index]->load_palette)(adp, (u_char *)&bmp_info.palette);
#ifndef PC98
/* XXX: this is ugly, but necessary for EGA/VGA 1bpp/4bpp modes */
if ((adp->va_type == KD_EGA) || (adp->va_type == KD_VGA)) {
inb(adp->va_crtc_addr + 6); /* reset flip-flop */
@ -588,6 +628,7 @@ bmp_Draw(video_adapter_t *adp)
if (bmp_info.sdepth == 1)
outw(TSIDX, 0x0102); /* unmask plane #0 */
}
#endif
for (line = 0; (line < bmp_info.height) && bmp_info.index; line++) {
bmp_DecodeLine(&bmp_info, line);

View File

@ -5,4 +5,8 @@ SRCS= splash_bmp.c
NOMAN=
.if ${MACHINE} == "pc98"
CFLAGS+= -DPC98
.endif
.include <bsd.kmod.mk>

View File

@ -35,9 +35,11 @@
#include <dev/fb/fbreg.h>
#include <dev/fb/splashreg.h>
#ifndef PC98
#include <dev/fb/vgareg.h>
#include <isa/isareg.h>
#endif
#define FADE_TIMEOUT 15 /* sec */
#define FADE_LEVELS 10
@ -62,6 +64,15 @@ bmp_start(video_adapter_t *adp)
{
/* currently only 256-color modes are supported XXX */
static int modes[] = {
#ifdef PC98
/*
* As 640x400 doesn't generally look great,
* it's least preferred here.
*/
M_PC98_PEGC640x400,
M_PC98_PEGC640x480,
M_PC98_EGC640x400,
#else
M_VESA_CG640x480,
M_VESA_CG800x600,
M_VESA_CG1024x768,
@ -71,6 +82,7 @@ bmp_start(video_adapter_t *adp)
* it's least preferred here.
*/
M_VGA_CG320,
#endif
-1,
};
video_info_t info;
@ -226,6 +238,9 @@ typedef struct
u_char *vidmem; /* video memory allocated for drawing */
video_adapter_t *adp;
int bank;
#ifdef PC98
u_char prev_val;
#endif
} BMP_INFO;
static BMP_INFO bmp_info;
@ -257,6 +272,26 @@ bmp_SetPix(BMP_INFO *info, int x, int y, u_char val)
x += (info->swidth - info->width) / 2;
switch(info->sdepth) {
#ifdef PC98
case 4:
x += (info->swidth - info->width) / 2;
sofs += (x >> 3);
bofs = x & 0x7; /* offset within byte */
outb(0x7c, 0x80 | 0x40); /* GRCG on & RMW mode */
if (val != info->prev_val) {
outb(0x7e, (val & 1) ? 0xff : 0); /* tile B */
outb(0x7e, (val & 2) ? 0xff : 0); /* tile R */
outb(0x7e, (val & 4) ? 0xff : 0); /* tile G */
outb(0x7e, (val & 8) ? 0xff : 0); /* tile I */
info->prev_val = val;
}
*(info->vidmem+sofs) = (0x80 >> bofs); /* write new bit */
outb(0x7c, 0); /* GRCG off */
break;
#else
case 4:
case 1:
/* EGA/VGA planar modes */
@ -272,6 +307,7 @@ bmp_SetPix(BMP_INFO *info, int x, int y, u_char val)
outw(GDCIDX, (val << 8) | 0x00); /* set/reset */
*(info->vidmem + sofs) ^= 0xff; /* read-modify-write */
break;
#endif
case 8:
sofs += x;
@ -567,10 +603,14 @@ bmp_Draw(video_adapter_t *adp)
/* initialise the info structure for drawing */
bmp_info.index = bmp_info.data;
#ifdef PC98
bmp_info.prev_val = 255;
#endif
/* set the palette for our image */
(*vidsw[adp->va_index]->load_palette)(adp, (u_char *)&bmp_info.palette);
#ifndef PC98
/* XXX: this is ugly, but necessary for EGA/VGA 1bpp/4bpp modes */
if ((adp->va_type == KD_EGA) || (adp->va_type == KD_VGA)) {
inb(adp->va_crtc_addr + 6); /* reset flip-flop */
@ -588,6 +628,7 @@ bmp_Draw(video_adapter_t *adp)
if (bmp_info.sdepth == 1)
outw(TSIDX, 0x0102); /* unmask plane #0 */
}
#endif
for (line = 0; (line < bmp_info.height) && bmp_info.index; line++) {
bmp_DecodeLine(&bmp_info, line);