Mail Archives: djgpp/2000/01/29/14:58:54
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, ®s, ®s);
blit_string(50, 60, 15, "Hello World");
getch();
regs.x.ax = 0x03;
int86(0x10, ®s, ®s);
__djgpp_nearptr_disable(); // reactive toute les protections memoire
}
=================================
Arnaud DESMONS
http://logarno.planet-d.net
- Raw text -