示例#1
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);
}
示例#2
0
/*
 * PC ROM low level routine to get the bitmap associated
 * with a character.  Handles bios ROM font only.
 */
void
pcrom_gettextbits(PMWFONT pfont, int ch, const MWIMAGEBITS **retmap,
	MWCOORD *pwidth, MWCOORD *pheight, MWCOORD *pbase)
{
	FARADDR	bits;
	int	n;
	static MWIMAGEBITS map[MAX_ROM_HEIGHT * ROM_CHAR_WIDTH / MWIMAGE_BITSPERIMAGE];
	MWIMAGEBITS *bitmap = map;
 
	/* read character bits from rom*/
	bits = rom_char_addr + ch * ROM_CHAR_HEIGHT;
	for(n=0; n<ROM_CHAR_HEIGHT; ++n)
		*bitmap++ = GETBYTE_FP(bits++) << 8;

	*retmap = map;
	*pwidth = ROM_CHAR_WIDTH;
	*pheight = ROM_CHAR_HEIGHT;
	*pbase = ROM_CHAR_HEIGHT;
}
示例#3
0
void
ega_hwterm(void)
{
  setmode(MODE_SET);

  /* Copy character table from ROM back into bit plane 2 before turning
   * off graphics.
   */
  out_word(SEQREG, 0x0100);	/* syn reset */
  out_word(SEQREG, 0x0402);	/* cpu writes only to map 2 */
  out_word(SEQREG, 0x0704);	/* sequential addressing */
  out_word(SEQREG, 0x0300);	/* clear synchronous reset */

  out_word(GRREG, 0x0204);	/* select map 2 for CPU reads */
  out_word(GRREG, 0x0005);	/* disable odd-even addressing */

#if ROMFONT
  {
	  FARADDR	srcoffset;
	  FARADDR	destoffset;
	  int 		data;
	  int 		ch;
	  int 		row;

	  srcoffset = rom_char_addr;
	  destoffset = EGA_BASE;
	  for (ch = 0; ch < FONT_CHARS; ch++) {
		for(row = 0; row < ROM_CHAR_HEIGHT; row++) {
			data = GETBYTE_FP(srcoffset++);
			PUTBYTE_FP(destoffset++, data);
		}
		destoffset += (RAM_SCAN_LINES - ROM_CHAR_HEIGHT);
	  }
  }
#endif

  /* Finally set the registers back for text mode. */
  writeregs(graph_off);
}