delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/08/28/20:35:28

From: Meta <syzmik AT concentric DOT net>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Text in 0x101?
Date: Sun, 24 Aug 1997 21:17:59 -0400
Organization: Concentric Internet Services
Lines: 82
Message-ID: <3400DD47.7725@concentric.net>
References: <5tke8j$813$1 AT news1 DOT epix DOT net>
Reply-To: syzmik AT concentric DOT net DOT NOSPAM
NNTP-Posting-Host: ts019d07.sag-mi.concentric.net
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Avallone wrote:
>
> Is there a way to display black text on a white background in graphics 
> 0x101?

Here's some code, I can't remember where I found it. I think I never
used it because it wouldn't work with mem protection on our something.
Email me with a fix or somethin.

***************************************************************

#include <stdlib.h>

#include <dos.h>
#include <go32.h> 
#include <sys/nearptr.h>
#include <sys/farptr.h>

#include "vesag.h"

#define CHAR_WIDTH  8
#define CHAR_HEIGHT 8

char *rom_char_set = (char *)0xFFA6E;

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

 _farpokeb(_dos_ds, rom_char_set + c * CHAR_HEIGHT, work_char);

 offset = y * SCREEN_H + x;

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

  for(x2=0; x2<CHAR_WIDTH; x2++)
    {
     if((*work_char & bit_mask))
       VG_DB[offset+x2] = color;

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


void blit_string(int x, int y, int color, char *string)
{
 int index;

 for(index=0; string[index] != 0; index++)
 {
  blit_char(x+(index<<3),y,color,string[index]);
 }
}

void main(void)
{
 unsigned count;

 rom_char_set += __djgpp_conventional_base;

 VG_InitGraph(VG_640x480);
 VG_InitDB();

 for(count = 0; count < 32000; count++)
 {
  blit_string(rand() % 296, rand() % 192, rand() % 256, "Hello");        
 }

 VG_ShowDB();
 delay(1500);
 VG_CloseGraph();

 return;
}

- Raw text -


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