ftp.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1993/08/23/12:13:47

Date: Mon, 23 Aug 1993 11:24:15 -0400 (EDT)
From: "Weimer}" <WEIMER AT JUNCOL DOT JUNIATA DOT EDU>
Subject: Far Pointers
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Mail-System-Version: <MultiNet-MM(330)+TOPSLIB(156)@JUNCOL.JUNIATA.EDU>

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 -


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