Mail Archives: djgpp/1993/08/23/12:13:47
Glance at the following source for writing directly to video memory on
IBMs.
MODE3_BASE is where the video memory starts on non monochrome cards.
/* The old way */
#define MODE3_BASE 0xB8000000L
void dWrStr(unsigned char *toWrite, int att, int off)
{
unsigned int far *video;
video = MODE3_BASE;
while(*toWrite)
*(video+off++) = *toWrite++ + (att<<8);
}
/* The 'new' way */
#define MK_FP( seg,ofs ) ( ( void _seg * )( seg ) + ( void near * )( ofs ))
void dWrStr(unsigned char *toWrite, int att, int off)
{
unsigned int *video = (unsigned int *) MK_FP(0xB800,0);
while(*toWrite)
*(video+off++) = *toWrite++ + (att<<8);
}
The old way compiles nicely in things like microsoft C and borland C.
It compiles (and links) in DJGPP if you take out the far, but whenever I
used it generates an exception at pointer B8000000 and crashed. So I figured
I'd try using MK_FP, but DJGPP gives a 'parse error' before '_seg' anda 'parse
error' before 'ofs'. Any clues on how to get this working?
-Weimer
- Raw text -