gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Coding > Clock Program?

#34138 - Todge - Fri Jan 14, 2005 2:39 am

My son just asked me if I could make him a clock face program for his gba. I can probably hammer one out after some trial and error, but I wonder if somone has something already made that they wouldn't mind making available? Just a simple analog clock dial and maybe an alarm function.

I apologize if this request is out of line or out of place.
_________________
I am -way- too cool to use a sig...

#34140 - LOst? - Fri Jan 14, 2005 4:15 am

Todge wrote:
My son just asked me if I could make him a clock face program for his gba. I can probably hammer one out after some trial and error, but I wonder if somone has something already made that they wouldn't mind making available? Just a simple analog clock dial and maybe an alarm function.

I apologize if this request is out of line or out of place.


You can make one with line drawing and fixed point sine table. However there is no way to set the clock to the right time as far as I know. I would always begin the clock at mid-night. And drawing with lines would work best in mode 3. In mode 4 you need to write two pixels at once.

I would be able to do a clock pretty fast since I have a line drawing fuction and circle drawing function in mode 4. If I only had time.

#34142 - tepples - Fri Jan 14, 2005 4:31 am

You'd also need to look up the hardware interface to each supported flash cart in order to get the time.

An "alarm" might be tricky, as the GBA can't ring an alarm while it's turned off, and it eats a lot of battery power while it's turned on, even if you use battery-saving techniques such as VBlankIntrWait() and running all your code from EWRAM rather than from ROM.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#34150 - ampz - Fri Jan 14, 2005 7:24 am

tepples wrote:
You'd also need to look up the hardware interface to each supported flash cart in order to get the time.

Why?

The RTC interface is the same on all flashcarts with Pokemon compatible RTCs. I think that includes all RTC flashcarts except the EZ which for some weird reason use their own RTC and patch the Pokemon RTC library to use it.

How to read the RTC:
http://www.brolinembedded.se/projects/gba_rtc/

#34165 - Todge - Fri Jan 14, 2005 3:03 pm

Thanks for the replies!

I am assuming that the clock in the cart is accessible, what he does right now is plug the GBA in, and on the menu for the rom games there is a little digital clock. He keeps that running all night.

I have it packed up, but I believe I have the "EZ" type flash device, so maybe it's a little harder than I thought... I just got internet back after our move, so I will look around a little today.

Thanks again, and any additionial thoughts or assistance will be appreciated.

Rain just turned to heavy snow out my window
_________________
I am -way- too cool to use a sig...