www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1995/09/01/17:17:26

Date: Fri, 1 Sep 95 14:39 MDT
From: mat AT ardi DOT com (Mat Hostetter)
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: Re: Graphics in v2.0
Newsgroups: comp.os.msdos.djgpp
References: <DE242E DOT CII AT jade DOT mv DOT net> <420l92$f04 AT bug DOT rahul DOT net> <427g3j$5n0 AT krel DOT iea DOT com>

>>>>> "Brainfried" == Brainfried  <unlisted AT email DOT adress> writes:

    >>  I don't do any of that, for both 1.6 and 2.0 I've used: char *
    >> screen
    >> 
    >> screen=(char*)0xa0000;
    >> 
    >> screen[x+y*320]=somecolor;
    >> 
    >> As long as I set stuff up with a INT 10 call it works fine, no
    >> need to muck with this near/far pointer crapola. *bleh* This is
    >> GCC after all, not DOS. :)

    Brainfried> How do you get this to work? Every time I try to do
    Brainfried> this I get a GPF!

Right, the technique described won't work under djgpp.

    Brainfried> Here is the code for the simple test program I use (It
    Brainfried> doesn't work), am I doing something wrong?

The flaw is with the original poster's erroneous claim, not your
interpretation of it.  You can't simply copy to 0xA0000 and expect it
to appear on the screen.

However, since you asked, your program also has two problems:

   1) Your asm clobbers %ax without telling gcc about it.  Assuming int 10h
      preserves all registers, I'd write it like this:

	      asm ("int $0x10" : : "a" (0x0013));

   2) You use `strcpy' to copy a range of memory which is not 0-terminated.
      The strcpy will just run off the end of the array and probably hit
      a zero somewhere, but who knows where the copy will stop.
      Use 'memcpy' to copy a given number of bytes.  Use `movedata'
      or `dosmemput' to write to the 0xA0000 frame buffer.

It would be good if you could provide an email address (at iea.com?)
so people like me don't need to clutter up the newsgroup with
suggestions like this which are probably only of interest to you.

-Mat

- Raw text -


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