Jump to content
IGNORED

Does anyone know how many machine cycles each 6502 operation takes?


Recommended Posts

NMOS 6502 Opcodes

 

as an example, look at LDA and you'll find:

 

 

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 TIM column is the cycles so LDA #0 takes 2 cycles while LDA $0 takes 3.

 

The only thing that'll take more time is if you write to WSYNC (Wait for SYNC) such as STA WSYNC. That's used to halt the CPU until the end of the scanline so you can synchronize your code with the electron beam.

Link to comment
Share on other sites

NMOS 6502 Opcodes

 

as an example, look at LDA and you'll find:

 

 

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 TIM column is the cycles so LDA #0 takes 2 cycles while LDA $0 takes 3.

 

The only thing that'll take more time is if you write to WSYNC (Wait for SYNC) such as STA WSYNC. That's used to halt the CPU until the end of the scanline so you can synchronize your code with the electron beam.

 

 

 

Thank you so much! This resource will be extremely helpful to me.

Edited by Pantomchap
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...