www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/05/05/17:15:02

From: Shawn Hargreaves <Shawn AT talula DOT demon DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Allegro, Blit called by a timer, can it be done?
Date: Mon, 5 May 1997 13:12:52 +0100
Organization: None
Distribution: world
Message-ID: <lCHqXKAE7cbzEwIO@talula.demon.co.uk>
References: <01bc5873$63530600$62676682 AT byrne>
NNTP-Posting-Host: talula.demon.co.uk
MIME-Version: 1.0
Lines: 33
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Daniel England/Shaun Byrne writes:
>I'm relatively new to Allegro and I would like to know if blit can be used
>by a timer function.

It can indeed: in fact the Allegro mouse pointer display code does
exactly this.

>Would this increase the number of blits (to the screen) per
>second/minute/whatever?

Probably not: running code in an interrupt doesn't make it go any faster
(you only have a certain number of clock ticks to play with, and if you
use lots of them up in an interrupt handler, that's so many less for
your mainline code to play with). Timers can be useful for getting
things to happen at the right time, and so letting you make more
efficient use of your cpu resources, but IMHO that tends to be more
applicable to small, irregular tasks (eg. playing music in the
background) than to a major time hog like the screen update...

The other big hassle you must be aware of if you do any drawing in an
interrupt handler is the problem of reentrancy. Timer interrupts can go
off at any time, and this is not a good thing if you are halfway through
some other drawing operation when it happens. Most of the Allegro
drawing code is semi-reentrant (except for stretch_blit(), floodfill(),
and the polygon code, which use global scratch space), but they won't
correctly restore the SVGA bank switching registers on exit, so if your
blit gets triggered while you are in the middle of drawing something
else, you are liable to get garbage pixels written to the screen.


--
Shawn Hargreaves - shawn AT talula DOT demon DOT co DOT uk - http://www.talula.demon.co.uk/
Beauty is a French phonetic corruption of a short cloth neck ornament.

- Raw text -


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