www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/05/16/11:08:01

From: "Qurob" <Qurob AT hotmail DOT com>
Newsgroups: comp.os.msdos.djgpp
References: <7hegr8$8q6$1 AT orudios DOT magnet DOT at> <373ad5f6 DOT 24447073 AT newsserver DOT cc DOT monash DOT edu DOT au> <7heta5$ebk$1 AT orudios DOT magnet DOT at> <373c0de9 DOT 1310913 AT news DOT tudelft DOT nl>
Subject: Re: Writing directly to video RAM
Lines: 47
X-Newsreader: Microsoft Outlook Express 4.72.2106.4
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.2106.4
Message-ID: <bAn%2.7351$LP2.138465@news6.ispnews.com>
NNTP-Posting-Host: 209.69.166.161
X-Trace: news6.ispnews.com 926811527 209.69.166.161 (Sat, 15 May 1999 19:38:47 EDT)
NNTP-Posting-Date: Sat, 15 May 1999 19:38:47 EDT
Date: Sat, 15 May 1999 19:39:29 -0400
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Getting the BIOS font, and writing it to the screen.
Some rough functions ripped from my graphics code:

// first we get the font from the ROM BIOS

void GI_LoadFont(void)
{
 GI_CHAR_SET = malloc(8*128);       // allocate non-near memory

 // get the ROM font and load into memory

 dosmemget((0xF000*16)+0xFA6E, 8*128, GI_CHAR_SET);
}

// we can draw it, but do conversion first. Its stored funny.

void GI_BlitChar(int x, int y, char color, char c, char t_flag)
{
 int offset, x2, y2;
 char *work_char;
 unsigned char bit_mask = 0x80;

 work_char = GI_CHAR_SET + c * CHAR_HEIGHT;

 offset = y * SCREEN_W + x;

 for(y2=0; y2<CHAR_HEIGHT; y2++)
 {
  bit_mask = 0x80;

  for(x2=0; x2<CHAR_WIDTH; x2++)
  {
   if((*work_char & bit_mask))
    _farpokeb(VideoSelector, offset+x2, color);

//    _farpokeb(VideoSelector, y * SCREEN_W + x, color);

   else if(!t_flag)
    _farpokeb(VideoSelector, offset+x2, 0);

   bit_mask = (bit_mask >> 1);
  }
 offset += SCREEN_W;
 work_char++;
 }


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019