delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1993/02/22/15:28:50

Date: Mon, 22 Feb 93 14:04:22 CST
From: bobp AT hal DOT com (Bob Pendleton)
To: dmb AT ai DOT mit DOT edu
Cc: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: Replacing arbitrary interrupt handlers

Is "ticks" declared to be "volatile?"

>	for (;;) {
>		if (ticks > 100)
>			break;
>	}

If not, it is probably being loaded into a register before the start
of the loop and you are testing the value of the register many many times.

>	for (;;) {
>		vsync();	/* wait for vertical blank */
>
>		if (ticks > 100)
>			break;
>	}

Of course the compiler doesn't know if you whacked "ticks" as a side effect
of calling "vsync()" so it reloads it after each call.

Just a guess...


				Bob P.

- Raw text -


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