delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/01/29/14:58:54

From: "logarno" <webmaster DOT logarno AT freesbee DOT fr>
Newsgroups: comp.os.msdos.djgpp
References: <388E6990 DOT AC4BA921 AT ns DOT sympatico DOT ca> <804u8s0lcap61qsh0v3rlvnqg0d8b7jclh AT 4ax DOT com>
Subject: Re: Few GraphicQuestions
Lines: 69
X-Newsreader: Microsoft Outlook Express 4.72.3110.5
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3
Message-ID: <2qGk4.3323$J%4.14677@nnrp1.none.net>
Date: Sat, 29 Jan 2000 19:33:46 +0100
NNTP-Posting-Host: 212.129.4.16
X-Complaints-To: abuse AT freesbee DOT fr
X-Trace: nnrp1.none.net 949170942 212.129.4.16 (Sat, 29 Jan 2000 19:35:42 MET)
NNTP-Posting-Date: Sat, 29 Jan 2000 19:35:42 MET
Organization: Freesbee.fr
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Hi,
>Second, how can text be displayed in video mode?
Extract from my tutorial although in french :
Look at this = )


=========================================

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

#define CHAR_WIDTH  8
#define CHAR_HEIGHT 8

char *video_buffer = (char *)0xa0000;
char *rom_char_set = (char *)0xffa6e;

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

 for(index=0; string[index] != 0; index++)
 {
  work_char = rom_char_set + string[index] * CHAR_HEIGHT;
  offset = (y << 8) + (y << 6) + x+(index<<3);

  for(y2=0; y2<CHAR_HEIGHT; y2++)
  {
   bit_mask = 0x80;
   for(x2=0; x2<CHAR_WIDTH; x2++)
                        {
                                if((*work_char & bit_mask))
                                 video_buffer[offset+x2] = color;
                                bit_mask = (bit_mask >> 1);
                        }
   offset += 320;
   work_char++;
             }
 }
}

main()
{
union REGS regs;
video_buffer += __djgpp_conventional_base;
rom_char_set += __djgpp_conventional_base;
__djgpp_nearptr_enable();
regs.x.ax = 0x013;
int86(0x10, &regs, &regs);

blit_string(50, 60, 15, "Hello World");
getch();

regs.x.ax = 0x03;
int86(0x10, &regs, &regs);
__djgpp_nearptr_disable();  // reactive toute les protections memoire
}
=================================

Arnaud DESMONS
http://logarno.planet-d.net




- Raw text -


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