Search the web
Sign In
New User? Sign Up
gbadev
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Message search is now enhanced, find messages faster. Take it for a spin.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
using a timer to pause   Message List  
Reply | Forward Message #10740 of 15019 |
Re: [gbadev] Re: using a timer to pause

> > > ScanlineCounter = (volatile u16*)0x4000006; //this is the
> > > scan line counter
> >
> > you should declare ScanlineCounter a vu16* (volatile).
>
> Er. Maybe I'm misunderstanding. Can't you get away with it during
> declaration like he did there? Like, I thought a typedef was really a
> special form of a macro?

That wasn't declaration, it was assignment. He cast 0x40000006 as a volatile
u16* value, then assigned it to a non-volatile u16* variable. Since
ScanlineCounter wasn't declared volatile u16* (or the equivalent vu16*), the
compiler was free to cache *ScanlineCounter in a register for the duration
of the while loop.

(Of course, that doesn't explain his observations. If the compiler had
optimized away the memory access, then you'd expect an infinite loop when
the V counter was less than 160, rather than no delay at all.)

- Mike






Tue Apr 2, 2002 9:24 pm

evi1twin
Offline Offline
Send Email Send Email

Forward
Message #10740 of 15019 |
Expand Messages Author Sort by Date

I'm using the code from devoto's pern project (the Wait() function) to attain the proper speed for some animation in mode 4. I'm making a call to this function...
j_north2002
Offline Send Email
Mar 29, 2002
6:26 pm

Is the Wait() function doing a vsync wait or just an empty loop wait? ... From: j_north2002 [mailto:jmartin10@...] Sent: 29 March 2002 18:19 To:...
Martin Piper
fnagaton
Offline Send Email
Mar 29, 2002
7:31 pm

... wait? Correction - dovoto not devoto sorry... I cut and pasted the code from his tutorial /************************************\ * Timers.h by dovoto * ...
j_north2002
Offline Send Email
Mar 29, 2002
9:21 pm

... _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com...
John Q. Pretentious
johnisaheadcase
Offline Send Email
Mar 29, 2002
10:49 pm

... function) ... making a ... that ... simpler ... get them ... my current ... ok, i'm now calling the following code from a drawing loop to try to get some...
j_north2002
Offline Send Email
Mar 30, 2002
12:05 pm

you should declare ScanlineCounter a vu16* (volatile)....
Jan-Lieuwe Koopmans
jan-lieuwe@...
Send Email
Mar 30, 2002
2:42 pm

... _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com...
John Q. Pretentious
johnisaheadcase
Offline Send Email
Apr 2, 2002
8:17 pm

... C typedefs aren't true macros, but they act the same way. (volatile u16 *) does work on hardware, even at GCC optimization level 3. Here's an excerpt from...
yerricde
Offline Send Email
Apr 2, 2002
9:06 pm

... That wasn't declaration, it was assignment. He cast 0x40000006 as a volatile u16* value, then assigned it to a non-volatile u16* variable. Since ...
Mike Danylchuk
evi1twin
Offline Send Email
Apr 2, 2002
9:34 pm

... had ... loop when ... I think all of the suggestions actually worked. I had just begun using double buffering and neglected to flip the buffers in a new ...
j_north2002
Offline Send Email
Apr 11, 2002
8:26 am

Hello, ... Just out of pure curiosity -- does anyone know whether there's any difference between this code and testing display status register (there are bits...
Maciej Sinilo
yarpen2002
Offline Send Email
Apr 11, 2002
7:46 pm

... _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com...
John Q. Pretentious
johnisaheadcase
Offline Send Email
Apr 3, 2002
6:39 am
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help