Register | Login | |||||
Main
| Memberlist
| Active users
| ACS
| Commons
| Calendar
| Online users Ranks | FAQ | Color Chart | Photo album | IRC Chat |
| |
0 user currently in Programming. | 3 guests |
Acmlm's Board - I2 Archive - Programming - Just how fast is this thing? | | | |
Add to favorites | "RSS" Feed | Next newer thread | Next older thread |
User | Post | ||
HyperLamer <||bass> and this was the soloution i thought of that was guarinteed to piss off the greatest amount of people Sesshomaru Tamaranian Level: 118 Posts: 1429/8210 EXP: 18171887 For next: 211027 Since: 03-15-04 From: Canada, w00t! LOL FAD Since last post: 2 hours Last activity: 2 hours |
| ||
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? | |||
Dish Spiny Level: 38 Posts: 111/596 EXP: 355646 For next: 14801 Since: 03-15-04 From: Disch Since last post: 18 days Last activity: 18 days |
| ||
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 (edited by Disch on 08-05-04 10:37 PM) |
|||
HyperLamer <||bass> and this was the soloution i thought of that was guarinteed to piss off the greatest amount of people Sesshomaru Tamaranian Level: 118 Posts: 1430/8210 EXP: 18171887 For next: 211027 Since: 03-15-04 From: Canada, w00t! LOL FAD Since last post: 2 hours Last activity: 2 hours |
| ||
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 Spiny Level: 38 Posts: 112/596 EXP: 355646 For next: 14801 Since: 03-15-04 From: Disch Since last post: 18 days Last activity: 18 days |
| ||
Originally posted by HyperHacker hahahah. why use it then? ;P
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).
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 <||bass> and this was the soloution i thought of that was guarinteed to piss off the greatest amount of people Sesshomaru Tamaranian Level: 118 Posts: 1431/8210 EXP: 18171887 For next: 211027 Since: 03-15-04 From: Canada, w00t! LOL FAD Since last post: 2 hours Last activity: 2 hours |
| ||
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.) (edited by HyperHacker on 08-07-04 09:21 PM) |
Add to favorites | "RSS" Feed | Next newer thread | Next older thread |
Acmlm's Board - I2 Archive - Programming - Just how fast is this thing? | | | |