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 > Using the Real time clock....

#67311 - Fenderocker - Mon Jan 16, 2006 10:45 pm

How do I access(did I spell that right?) the real time clock on the EFA linker II I'm ordering. I want to make a game that plays differently at night time and day time.

thanks!

#67365 - pure_ev1l - Tue Jan 17, 2006 2:14 pm

good question, I'm kinda up for doing the same thing.

one thing to note, the code that ppl give you may be wrong as pogoshell doesn't report time correctly.

but that may be pogoshell bug.
_________________
-Rory

"Planning makes for a boring life, but a good game"

#67612 - Fenderocker - Thu Jan 19, 2006 12:59 pm

I didn't say anything about pogoshell................ I don't even know if i'm going to use it.........

#67627 - pure_ev1l - Thu Jan 19, 2006 4:37 pm

I know.

what I'm trying to say is it may be different from other flash cards as pogoshell reports incorrect time with EFA Linker cards.

so all I'm trying to say is if someone gives you code that applies to a different flash card beware.

tis all :-)
_________________
-Rory

"Planning makes for a boring life, but a good game"

#67679 - Fenderocker - Thu Jan 19, 2006 9:48 pm

Thanks I didn't know that. I'm still looking for the code though so if anyone knows please post!

#67721 - CyteX - Fri Jan 20, 2006 1:05 am

Hi !

Sometimes the search function is very helpful ;)

AmpZ did a little test program and put it on his site. Have a look at http://forum.gbadev.org/viewtopic.php?t=2844 there you'll find the link.

I didn't manage to get the Multiboot image from AmpZ to run with VBA, so I recompiled it with devkitARM as a normal card. It showed that an RTC is detected, but no time is displayed. Afterwards I download it to my EFA-II and it reports that no RTC is detected.

IMHO games using RTC does not need to be patched for use with EFA-II, but I got none, so I really couldn't verify that. Furthermore I'm quite sure AmpZ code is right, but maybe incomplete ? Or has a MB image to be used, so that no FLASH/ROM is overlaying the RTC address space ? Don't know.

Have you already asked for RTC information on the www.efa.cc forum ?

I read out the EFA-II and give it to VBA, it does not run using the emulator, it stucks by initializing the RTC, I think, because it is accessing the addresses AmpZ used in his code.

After patching the EFA-II firmware runs on VBA. Now, its only a question of (spare) time till we might be able to access the U-Disk.

bye Cy'

#67892 - Fenderocker - Sat Jan 21, 2006 3:52 am

CyteX wrote:
Sometimes the search function is very helpful ;)

No duh..... I just searched and couldn't find anything recent about my card on the forums so I decided to ask.

CyteX wrote:

AmpZ did a little test program and put it on his site. Have a look at http://forum.gbadev.org/viewtopic.php?t=2844 there you'll find the link.

AmpZ site says nothing about EFA II...........

CyteX wrote:

Have you already asked for RTC information on the www.efa.cc forum ?

I just looked there after you posted this.... There was only one topic about the RTC and only you had answered it giving the poor person no info.

If any one knows anything about this type of thing I would still like to know. I still can't find any tutorials about using the RTC.

#68116 - CyteX - Sun Jan 22, 2006 5:34 pm

Fenderocker wrote:

No duh..... I just searched and couldn't find anything recent about my card on the forums so I decided to ask.

Hey, calm down, no problem read this => ;)

Fenderocker wrote:

AmpZ site says nothing about EFA II...........

Correct, but there is also nothing said it wouldn't, so isn't it worth a try ? Keep in mind he did it back in 2004 !

Fenderocker wrote:

I just looked there after you posted this.... There was only one topic about the RTC and only you had answered it giving the poor person no info.

Yes, afterwards I think my post on efa.cc is useless. The EFA guys wrote in their FAQ that they currently do not support or answer questions from the homebrew scene. So it is up to us.

Fenderocker wrote:

If any one knows anything about this type of thing I would still like to know. I still can't find any tutorials about using the RTC.

OK, here we go: I figured out, that the EFA Firmware accesses the same addresses as Ampz Code which are $080000c4 c6 and c8. Ampz rtc_detect function writes to $080000c8 and read back the value from the same address. On EFA2 the rtc_detect function returns 0, so it seems that on EFA2 $080000c8 is implemented as write only register. Makes sense when RTC check is used for copy protection of comercial games. So comment the while-loop:

Code:

   if(rtc_detect())
      typestr("  RTC Detected.");
   else{
      typestr("  No RTC Detected.");
//      while(1);


Does the VCOUNTER has to be enabled in some way ? AFAIK not, but AmpZ RTC test stucks on my System (VBA and Real HW) when it is waiting for VSync. Hmm.. doesn't matter for the test, we do not need a VBL synchronization, so:

Code:

   //Main loop
   while(1){
      charpos=258;
   //   scrWaitVSync();


Now, all is fine and the RTC of my EFA2 is read out and displayed on screen (but with wrong day of week). Currently we haven't figured out how to set the clock, but do we need this ? As a starting point this should be sufficient.


Furthermore, I think the function rtc_detect and rtc_end_transfer are staying in contrast. In rtc_detect writing 1 to $080000c8 is enabling the RTC, whereas in rtc_end_transfer the same thing is done to end the transfer ? Any comments on this ?

Hope it helps !

bye Cy'

#68120 - Fenderocker - Sun Jan 22, 2006 6:36 pm

So you're basicly saying that the code ampz wrote works on the hardware?

#68127 - CyteX - Sun Jan 22, 2006 7:21 pm

Yes, it works, except the rtc_detect function. You must not rely its results on EFA2.

#68130 - kusma - Sun Jan 22, 2006 7:31 pm

Fenderocker wrote:
So you're basicly saying that the code ampz wrote works on the hardware?

i just tested the code on my efa aswell, and it does indeed work.

#68178 - Fenderocker - Sun Jan 22, 2006 11:48 pm

Awsome that means that I can study up on his code and learn how to use the RTC!!! WAHOO!!!!!