It is currently Thu Oct 19, 2017 4:13 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: CPU emulation
PostPosted: Fri Oct 06, 2006 3:15 pm 
Offline
Formerly Fx3
User avatar

Joined: Fri Nov 12, 2004 4:59 pm
Posts: 3064
Location: Brazil
- When I wrote my CPU core, I used a single reference that 1 CPU clock equals to 3 PPU clocks. By reading the CPU opcodes reference, it seems clear enough that if a certain instruction (example) uses 1 cycle to fetch the opcode, another for the immediate byte and another for reading memory, so the PPU would execute 3 cycles per CPU cycle. By the way, the last CPU test ROMs fail and nobody could make my question answered... I knew the "half" CPU cycle thing, but what about the PPU itself? An hypotetical example (sorry for those ones that dislike pasting any code):

Code:
//this is pseudo-code

opcode = readmem(cpu->PC); ppu_clock(3);
byte = readmem(cpu->PC); ppu_clock(3);
cpu->A = readmem(byte);
ppu_clock(3); //executes 3 PPU cycles


The following block gives me an error of +1 CPU cycle. I wonder why...

_________________
Zepper
RockNES developer


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 06, 2006 3:49 pm 
Offline
User avatar

Joined: Mon Sep 27, 2004 8:33 am
Posts: 3715
Location: Central Texas, USA
Does it work if you take out one of the ppu_clock(3) calls? I'm assuming the above example is for a 3 CPU cycle instruction using zero-page addressing. Are you sure you aren't clocking the PPU elsewhere?


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: Bing [Bot] and 7 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group