예제 #1
0
/*
** VESA 2.0 has a PM function for VESA_DISP_START
** Bad news: register values are incompatible with
** real mode function. PM adaption should be done
*/
int _GrViDrvVESAvirtualScroll(GrVideoMode *md,int x,int y,int result[2])
{
	Int86Regs r;
	sttzero(&r);
	IREG_AX(r) = VESA_FUNC + VESA_DISP_START;
	IREG_BX(r) = 0;
	IREG_CX(r) = x;
	IREG_DX(r) = y;
	int10(&r);
	if(IREG_AX(r) == VESA_SUCCESS) {
	    IREG_AX(r) = VESA_FUNC + VESA_DISP_START;
	    IREG_BX(r) = 1;
	    int10(&r);
	    result[0] = IREG_CX(r);
	    result[1] = IREG_DX(r);
	    return(TRUE);
	}
	return(FALSE);
}
예제 #2
0
void _GrViDrvLoadColorEGA4(int c,int r,int g,int b)
{
    Int86Regs rg;
    sttzero(&rg);
    IREG_AX(rg)  = 0x1000;
    IREG_BX(rg)  = c & 0x0f;
    IREG_BX(rg) |= ((r & 0x40) << 7) | ((r & 0x80) << 3);
    IREG_BX(rg) |= ((g & 0x40) << 6) | ((g & 0x80) << 2);
    IREG_BX(rg) |= ((b & 0x40) << 5) | ((b & 0x80) << 1);
    int10(&rg);
}
예제 #3
0
파일: scr_bios.c 프로젝트: LucidOne/Rovio
static void
VGA_close(PSD psd)
{
#if ELKS
	/* allow console switching again*/
	ioctl(0, DCREL_GRAPH);
#endif
#if HWINIT
	ega_hwterm();
#else
	/* init bios 80x25 text mode*/
	int10(FNTEXT, 0);
#endif
}
예제 #4
0
int _GrViDrvVESAsetVirtualSize(GrVideoMode *md,int w,int h,GrVideoMode *result)
{
	Int86Regs r;
	sttzero(&r);
	IREG_AX(r) = VESA_FUNC + VESA_SCAN_LNLEN;
	IREG_BX(r) = 0;
	IREG_CX(r) = w;
	int10(&r);
	if(IREG_AX(r) == VESA_SUCCESS) {
	    result->lineoffset = IREG_BX(r);
	    result->width      = IREG_CX(r);
	    result->height     = umin(IREG_DX(r),h);
	    return(TRUE);
	}
	return(FALSE);
}
예제 #5
0
/* init PC ROM routines, must be called in graphics mode*/
void
pcrom_init(PSD psd)
{
	char *	p;

	/* use INT 10h to get address of rom character table*/
	rom_char_addr = int10(FNGETROMADDR, GETROM8x14);
#if 0
	/* check bios data area for actual character height,
	 * as the returned font isn't always 14 high
	 */
	ROM_CHAR_HEIGHT = GETBYTE_FP(MK_FP(0x0040, 0x0085));
	if(ROM_CHAR_HEIGHT > MAX_ROM_HEIGHT)
		ROM_CHAR_HEIGHT = MAX_ROM_HEIGHT;
#endif
	p = getenv("CHARHEIGHT");
	if(p)
		ROM_CHAR_HEIGHT = atoi(p);
}
예제 #6
0
파일: scr_bios.c 프로젝트: LucidOne/Rovio
static PSD
VGA_open(PSD psd)
{
#if _MINIX
int s;
struct mio_ldt86 mldt86;
struct segdesc_s {              /* segment descriptor for protected mode */
	u16_t limit_low;
	u16_t base_low;
	u8_t base_middle;
	u8_t access;                  /* |P|DL|1|X|E|R|A| */
	u8_t granularity;             /* |G|X|0|A|LIMT| */
	u8_t base_high;
} *dp;
int fd;
unsigned long vidmem = 0xA0000;

	fd = open("/dev/mem", O_RDONLY);
	dp = (struct segdesc_s *) mldt86.entry;
	mldt86.idx = 1;
	s = ioctl(fd, MIOCGLDT86, &mldt86);
	dp->limit_low    = 0xFFFF;
	dp->base_low     = (vidmem >>  0) & 0xFFFF;
	dp->base_middle  = (vidmem >> 16) & 0xFF;
	dp->base_high    = (vidmem >> 24) & 0xFF;
	dp->granularity |= 0x80;
	mldt86.idx = 2;
	s = ioctl(fd, MIOCSLDT86, &mldt86);
	close(fd);
#endif
	/* setup operating mode from environment variable*/
	if(getenv("EGAMODE"))
		VGAMODE = FALSE;
	else VGAMODE = TRUE;

#if ELKS
	/* disallow console switching while in graphics mode*/
	if(ioctl(0, DCGET_GRAPH) != 0)
		return NULL;
#endif

#if HWINIT
	/* enter graphics mode*/
	ega_hwinit();
#else
	/* init bios graphics mode*/
	int10(VGAMODE? FNGR640x480: FNGR640x350, 0);
#endif

	/* init driver variables depending on ega/vga mode*/
	psd->xres = psd->xvirtres = 640;
	psd->yres = psd->yvirtres = VGAMODE? 480: 350;
	psd->planes = 4;
	psd->bpp = 4;
	psd->ncolors = 16;
	psd->pixtype = MWPF_PALETTE;
#if HAVEBLIT
	psd->flags = PSF_SCREEN | PSF_HAVEBLIT;
#else
	psd->flags = PSF_SCREEN;
#endif

	/* init planes driver (sets psd->addr and psd->linelen)*/
	ega_init(psd);

#if ROMFONT
	/* init pc rom font routines*/
	pcrom_init(psd);
#endif
#if 0
	ROM_CHAR_HEIGHT = VGAMODE? 16: 14;
#endif
	/* FIXME: add palette code*/
	return psd;
}