Jump to content


cycles explanation

I cant figure out what cycle can someone explain to me wha

2 replies to this topic

#1 esplonky OFFLINE  



  • 440 posts
  • Kinetic, Not synthetic.
  • Location:Canyon Lake, TX

Posted Sat Oct 8, 2011 6:04 PM

I want to know what cycles are and how to calculate how many i have in my game.

#2 Random Terrain OFFLINE  

Random Terrain

    Visual batari Basic User

  • 27,801 posts
  • Controlled Randomness
    Replay Value
  • Location:North Carolina (USA)

Posted Sun Oct 9, 2011 12:11 AM

I want to know what cycles are and how to calculate how many i have in my game.

Have you looked at this section of the bB page yet:


#3 SpiceWare OFFLINE  



  • 10,709 posts
  • Medieval Mayhem
  • Location:Planet Houston

Posted Sun Oct 9, 2011 10:22 AM

A cycle is like "a second of time", but much-much faster. Similar to how 60 seconds occur in a minute, 76 cycles occur during the time it takes to draw a single scan line on your TV. The Atari has 19,912 (if using the standard 262 scan line count for an NTSC display) cycles per frame(1 update of the TV's display, which gets updated 60 times per second - also known as 60 frames per second, or 60 fps).

That sounds like a lot, but the Atari's video chip is so primitive that the CPU must update it in real-time as the screen is being drawn. Games often display 192 scan lines of picture, so subtracting out 192 * 76 only leaves 5,320 cycles of time for your game logic. The section of the game that draws the screen is known as the kernel, and is one of the things that bB does for you. bB does other things as well, so you only get what's left over (of the 5,320 cycles) after bB has finished it's processing.

While this is probably more detailed than you're looking for - the Atari uses a 6507, which is a 6502 derivative, so you can reference 6502 tutorials. Looking at the 6502 opcodes you'll see info like this:
LDA (LoaD Accumulator)
Affects Flags: S Z
MODE           SYNTAX       HEX LEN TIM
Immediate     LDA #$44      $A9  2   2
Zero Page     LDA $44       $A5  2   3
Zero Page,X   LDA $44,X     $B5  2   4
Absolute      LDA $4400     $AD  3   4
Absolute,X    LDA $4400,X   $BD  3   4+
Absolute,Y    LDA $4400,Y   $B9  3   4+
Indirect,X    LDA ($44,X)   $A1  2   6
Indirect,Y    LDA ($44),Y   $B1  2   5+

+ add 1 cycle if page boundary crossed

The column labeled TIM is how many cycles each instruction uses.

0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users