delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/02/26/01:39:32

From: Damian Yerrick <DONT DOT YOU DOT DAREd_yerrick AT hotmail DOT comSEND DOT SPAM>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Fastest bitblt?
Organization: Pin Eight Software http://pineight.8m.com/
Message-ID: <83mebssig8p8d943fekqr2sgumh48ermno@4ax.com>
References: <38B73FC4 DOT 82FCECB8 AT videotron DOT ca>
X-Newsreader: Forte Agent 1.7/32.534
MIME-Version: 1.0
Lines: 83
X-Trace: 9ms/G960FcNjtoRpOCA2w49f6/bnHA9l6sOzoEEjPnGYY5hU1bSg0oEg4LgWsFPpIyGlU7AA4geJ!MxOY2II3DthyilV1zDaHqFntAxDmpd2fpzkyBHrnaIEZFhr6zd6mYP/5bK5Cu18luI60hgLy9E4L!W7s=
X-Complaints-To: abuse AT gte DOT net
X-Abuse-Info: Please be sure to forward a copy of ALL headers
X-Abuse-Info: Otherwise we will be unable to process your complaint properly
NNTP-Posting-Date: Sat, 26 Feb 2000 04:50:42 GMT
Distribution: world
Date: Sat, 26 Feb 2000 04:50:42 GMT
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

On Fri, 25 Feb 2000 21:51:48 -0500, Trancelucid
<trancelucid AT videotron DOT ca> wrote:

>I'm porting some source of mine (from Watcom and TC) to DJGPP, and the
>main problem I'm having right now is accessing 0xA0000.

If you're having trouble with getting video to work,
you can always look at how Allegro does it.

>I read the libc reference

C:\>info libc

>and a few tutorials on the net, and the most popular buffer-to-
>video functions seem to be memcpy() and _farpokeb().. I have
>some unanswered questions, and I'd like your opinion on the matter.

If you're copying data in far memory (e.g. blitting), use movedata().

>It may be off-topic, but just for curiosity...

Read on.  This kind of question is frequently asked but not offtopic.

>Why can you access
>0xA0000 in Watcom and not in DJGPP?

Watcom automatically nearptrs all memory.  DJGPP doesn't, primarily
because it's descended from a GNU tool, and GNU is a protected OS.

>Both are 32bit compilers, so why would you need to
>disable protection to access video memory in DJGPP?

You don't.

>How (un)safe is it to disable protection to access
>video memory with memcpy()?

You could _potentially_ overwrite the OS, leading to a crash or a
corrupted FAT.  Very bad.  And according to Murphy, very probable.  It
happened when I was using TroubleSpace (officially DriveSpace from MS-
DOS 6.22); good thing I was using DoubleGuard (extra layer of memory
protection for DriveSpace drives).

However, if you ask DPMI for a selector that covers segment
0xa0000-0xaffff, you can movedata() the pixels in via a farpointer.
Think of movedata() as a DJGPP-specific farpointer memcpy().
  C:\>info libc alpha movedata

>As for _farpokeb(), is there a way to make it faster?

_farpokel() can potentially be four times faster as it moves
four times as much per instruction.  (However, the optimizer...)
I think movedata() uses _farpokel() internally.

>Right now I use it
>in a for loop:
>
>for(i=0;i<64000;i++) 
>   _farpokeb(_dos_ds,0xA0000,+i,buffer[i]);

The optimizer may be casting your char*'s to long*'s and using
_farpokel().

>Also, when I use optimization parameters (-O3), both seem the same
>speed.. Are they the same code when optimized? And how can I look if
>they use the same asm instructions?

There is a switch to get GCC to show its assembler opcodes.  Browse
the GCC manual:
  C:\>info gcc

>Is there any faster way than those 2?

Not on Intel.

-- 
Damian Yerrick  http://yerricde.tripod.com/
Comment on story ideas: http://home1.gte.net/frodo/quickjot.html
AOL is sucks! Find out why: http://anti-aol.org/faqs/aas/
View full sig: http://www.rose-hulman.edu/~yerricde/sig.html

This is McAfee VirusScan. Add these two lines to your .sig to
prevent the spread of .sig viruses.  http://www.mcafee.com/

- Raw text -


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