Register | Login
Views: 19364387
Main | Memberlist | Active users | ACS | Commons | Calendar | Online users
Ranks | FAQ | Color Chart | Photo album | IRC Chat
11-02-05 12:59 PM
0 user currently in Programming. | 3 guests
Acmlm's Board - I2 Archive - Programming - Just how fast is this thing?
  
User name:
Password:
Reply:
 

UserPost
HyperLamer
Posts: 1431/8210
I don't exactly have a choice at the moment.

I'm assuming it's 3 if true and 2 if false, since 'jr blah' (no condition) is 3. (I'm not quite sure how I got that number though. Note to self: Avoid math when tired. )

[edit] Alright, I figured out something to work around the delay: I've simply created a sound table with frequency and length entries. The code writes the frequency to the channel 1 frequency registers each run through the loop, looping however many times is specified, then moving to the next entry. (So say you had a table that said 2200hz x4, 1000hz x2, the loop would play a 2200hz tone 4 times and a 1000hz twice.) The problem this time is stopping the sound. (FYI: The sounds are actually for communicating with another device, which is why they need to be so precise. No, I can't do it any other way.) Say I want to play a tone for exactly 33ms, I put in the proper time value that makes it play that long. Once it's done, though, it fades out instead of just stopping. I've tried using frequencies of 0 and 65,535 (the highest possible value), but no go. How do I cut the sound off immediately? (Prefferably without shutting off the entire sound system, that seems pretty extreme.)
Dish
Posts: 112/596
Originally posted by HyperHacker
Wow, IE sucks so much.



hahahah. why use it then? ;P


So, one cycle is about 1/2,000,000 sec, which means I need to delay 1,384,120 cycles?



Erm, well 1 cycle is closer to 1/4194304th of a second ;P. But you do want to wait for about that many cycles (I got 4194304/3 = ~1398101).



BTW: 'jr nz, blah' and 'jr z, blah' are 3 cycles if the condition is met, correct?


Well now this is where it got weird for me. Different docs said different things for the cycle usage of each instruction. Some docs say it uses 3, some say 12 (the ones that say 12 have 4x the cycles for every instruction). I was under the impression that it was 12... but I don't really know for sure.
HyperLamer
Posts: 1430/8210
Wow, IE sucks so much.

So, one cycle is about 1/2,000,000 sec, which means I need to delay 1,384,120 cycles? Sounds right (a lot more than I expected though ). I can't really use 20 frames, I have the screen off and I don't think the FPS is exactly 60.
BTW: 'jr nz, blah' and 'jr z, blah' are 3 cycles if the condition is met, correct?
Dish
Posts: 111/596
4194304 Hz according to every source I checked when researching GB sound.

Although... if you want to wait for 1/3 of a second... it seems to make much more sense to me to count the passing of 20 frames than it does to cound the cycles that pass
HyperLamer
Posts: 1429/8210
Well I'm trying to develop a rather simple Gameboy program, and need to delay for exactly 0.33 seconds. I figure this shouldn't be a huge problem, I can just write a simple delay loop. There is a problem, though - I'm not sure just how fast the CPU is. Some say 1mhz, others say 4. To put things simply, how long does it take to execute one machine cycle?
Acmlm's Board - I2 Archive - Programming - Just how fast is this thing?


ABII


AcmlmBoard vl.ol (11-01-05)
© 2000-2005 Acmlm, Emuz, et al



Page rendered in 0.009 seconds.