From: hackeroc3 AT aol DOT com (HackerOC3) Newsgroups: comp.os.msdos.djgpp Subject: Char blitting Date: 16 Jan 1998 19:46:37 GMT Lines: 65 Message-ID: <19980116194601.OAA28275@ladder02.news.aol.com> NNTP-Posting-Host: ladder02.news.aol.com Organization: AOL http://www.aol.com To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk I am using a function to blit chars and strings to the screen. Below is the version that blits chars. It crashes my computer. I think it may have something to do with the base address for the ASCII chars, 0xF000FA6EL. void Blit_Char(int xc, int yc, char c, int color, int trans_flag) { //This function uses the ROM 8x8 character set to blit a character on the //video screen. Notice the trick used to extract bits out of each character //byte that comprises a line. int offset, x, y; unsigned char * work_char; unsigned char bit_mask = 0x80; //Compute the starting offset in the ROM character look - up table. *work_char = (unsigned char)0xF000FA6EL + c * CHAR_HEIGHT); //Compute the offset of the character in the video buffer. offset = (yc<<8) + (yc<<6) + xc; for(y = 0; y>1); } //end for x //Move to the next line in the video buffer and in the ROM data area. offset += SCREEN_WIDTH; work_char++; } //end for y; } //end Blit_Char //CHAR_WIDTH and CHAR_HEIGHT are both 8, SCREEN_WIDTH is 320 //This function is called by Blit_String: void Blit_String(int x, int y, int color, char *string, int trans_flag) { int index; for (index=0; string[index]!=0; index++) { Blit_Char(x+(index<<3),y,string[index],color,trans_flag); } } DO NOT RUN THIS AS IS: IT WILL CRASH YOUR COMPUTER HackerOC3 AT aol DOT com