It is currently Tue Oct 24, 2017 2:47 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 9 posts ] 
Author Message
 Post subject: RAMBO-1 IRQ timing
PostPosted: Sat Aug 31, 2013 10:25 am 
Offline
User avatar

Joined: Sat Jan 22, 2005 8:51 am
Posts: 427
Location: Chicago, IL
Here's the results of my analysis of RAMBO-1 IRQ timing.

For MMC3-style IRQs, RAMBO-1 checks A12 on falling edges of M2. When it's time to do so, IRQ is asserted on the next falling edge of M2 (plus about 20ns). Since there are 4 possible CPU/PPU alignments, there are 4 variations of IRQ timing. Furthermore, since odd frames are 1 PPU cycle short, there are two different delays for each variation. Here's the IRQ assertion time, relative to the rising edge of A12, for each alignment:

Code:
Short      Long
ns (cycles)
761 (4.1)   947 (5.1)
621 (3.3)   812 (4.3)
900 (4.8)   1088 (5.8)
582 (3.1)   950 (5.1)


Alignment 1:
Image
Image

Alignment 2:
Image
Image

Alignment 3:
Image
Image

Alignment 4:
Image
Image

Edit: Revised CPU cycle-based IRQ info below.

_________________
get nemulator
http://nemulator.com


Last edited by James on Mon Sep 02, 2013 3:41 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: RAMBO-1 IRQ timing
PostPosted: Sun Sep 01, 2013 10:49 am 
Offline
User avatar

Joined: Mon Apr 04, 2011 11:49 am
Posts: 1905
Location: WhereverIparkIt, USA
Awesome work James! That's an interesting approach they took and now makes complete sense on the wide range of delays seen by the RAMBO-1. Thanks for taking the time to get that chip to spill it's guts.

We need to make sure this gets updated in the wiki and Disch docs.

_________________
If you're gonna play the Game Boy, you gotta learn to play it right. -Kenny Rogers


Top
 Profile  
 
 Post subject: Re: RAMBO-1 IRQ timing
PostPosted: Mon Sep 02, 2013 3:49 pm 
Offline
User avatar

Joined: Sat Jan 22, 2005 8:51 am
Posts: 427
Location: Chicago, IL
I took a closer look at CPU cycle-based IRQs today:

The IRQ counter reload is set to 0x74 (116) so, once IRQs are enabled, the next IRQ should occur 464 (116*4) CPU cycles later (or about 259.25us later):
Image

IRQs are enabled by writing to 0xE001 at D. The IRQ counter starts counting down on the next falling edge of M2 (E):
Image

The IRQ counter reaches 0 at F (as predicted, 259.25us after E) then, like MMC3-style IRQs, IRQ is asserted on the next falling edge of M2 (G):
Image

_________________
get nemulator
http://nemulator.com


Top
 Profile  
 
 Post subject: Re: RAMBO-1 IRQ timing
PostPosted: Mon Sep 02, 2013 4:17 pm 
Offline
User avatar

Joined: Mon Apr 04, 2011 11:49 am
Posts: 1905
Location: WhereverIparkIt, USA
James wrote:
The IRQ counter reaches 0 at F (as predicted, 259.25us after E) then, like MMC3-style IRQs, IRQ is asserted on the next falling edge of M2 (G):

Good stuff,

So just to clarify, when you say 'like MMC3 style IRQs', you mean 'like RAMBO-1's CHR-A12 scanline counter' (which is similar to the MMC3 but different in delay amongst possible other things). Not 'like Nintendo's MMC3'. Correct?

_________________
If you're gonna play the Game Boy, you gotta learn to play it right. -Kenny Rogers


Top
 Profile  
 
 Post subject: Re: RAMBO-1 IRQ timing
PostPosted: Mon Sep 02, 2013 5:00 pm 
Offline
User avatar

Joined: Sat Jan 22, 2005 8:51 am
Posts: 427
Location: Chicago, IL
That's correct. Similar to RAMBO-1's scanline counter mode.

_________________
get nemulator
http://nemulator.com


Top
 Profile  
 
 Post subject: Re: RAMBO-1 IRQ timing
PostPosted: Mon Sep 02, 2013 7:31 pm 
Offline
User avatar

Joined: Fri Mar 08, 2013 9:55 pm
Posts: 349
Location: Linköping, Sweden
Thanks for the investigation.

Another thing I'm curious about is the precise circumstances where MMC1 ignores writes. thefox implied it's not as simple as all writes but the first always being ignored for consecutive writes (can't remember where he said that though). Emulating it like that fixes Bill and Ted's Excellent Adventure but breaks the polynes3 demo.


Top
 Profile  
 
 Post subject: Re: RAMBO-1 IRQ timing
PostPosted: Mon Sep 02, 2013 7:46 pm 
Offline
Formerly 65024U

Joined: Sat Mar 27, 2010 12:57 pm
Posts: 2257
Isn't it consecutive writes the first one is the only one that takes effect? At least that's what I thought was determined from all tests, ever.


Top
 Profile  
 
 Post subject: Re: RAMBO-1 IRQ timing
PostPosted: Mon Sep 02, 2013 7:50 pm 
Offline
User avatar

Joined: Fri Mar 08, 2013 9:55 pm
Posts: 349
Location: Linköping, Sweden
3gengames wrote:
Isn't it consecutive writes the first one is the only one that takes effect? At least that's what I thought was determined from all tests, ever.


Yeah, that was what I meant - "...all writes but the first always being ignored..."


Top
 Profile  
 
 Post subject: Re: RAMBO-1 IRQ timing
PostPosted: Mon Sep 02, 2013 11:53 pm 
Offline
User avatar

Joined: Mon Apr 04, 2011 11:49 am
Posts: 1905
Location: WhereverIparkIt, USA
I verified the MMC1's double write cycle protection was based on what appears to be latching of PRG R/W with M2 as a clock. I verified that by leaving M2 low while writing to the mapper and every write was accepted or blocked based on the status of PRG R/W for the most recent latch.

_________________
If you're gonna play the Game Boy, you gotta learn to play it right. -Kenny Rogers


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 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