Skull & Crossbones - Split Screen Shakes - Nestopia

This is an archive of a topic from NESdev BBS, taken in mid-October 2019 before a server upgrade.
View original topic
Skull & Crossbones - Split Screen Shakes - Nestopia
by on (#132453)
Under Nestopia (Undead) 1.45 (and older versions), as well as the (un)official releases (I.E. 1.40-1.42), when you split the screen by starting the second player in Skull & Crossbones in-game, the bottom portion shakes and there's some graphic corruption.

The ROM dump, per Nestopia's launcher shows it as a "Good" dump. Presuming then, it's an emulation issue (?)

Trying Nintendulator (Aug 10, 2014 beta), there's some minor graphic corruption (Just below 2nd player/"RED DOG" status info), but no shaking screen with the 2nd players enabled utilizing the same ROM.
Re: Skull & Crossbones - Split Screen Shakes - Nestopia
by on (#132454)
I don't think we understood exactly how the RAMBO-1's IRQ worked until James tested recently, which postdated the original author abdication. Rdanbrook has probably not had this pointed out to him yet?
Re: Skull & Crossbones - Split Screen Shakes - Nestopia
by on (#132456)
Just opened this ticket for him. :-)

Also for lidnariq: check out the Discussion part of the RAMBO-1 Wiki page please. Zepper proposed a different methodology that may help with Hard Drivin' and no real follow-up to that discussion took place (at least on the Wiki). If it took place here on the forums, if you could find me the discussion that would be great.
Re: Skull & Crossbones - Split Screen Shakes - Nestopia
by on (#132467)
Wait for fixed
Re: Skull & Crossbones - Split Screen Shakes - Nestopia
by on (#171452)
Sorry to bring this back up but i think i found another bug with this mapper and shinobi on nestopia.

Everything is fine until you get to the last set of levels. The masked ninja set on the bamboo forest level the mirroring becomes screwed up on sideways scrolling. I opened this ticket on rdanbrook :

https://github.com/rdanbrook/nestopia/issues/181

Could these 2 games be related with the issues? They are both mapper 64, unless i am crazy here. Everything starts off fine in that level until you get about midway then the scrolling issues start and the next level seems to be screwed too.

I wonder if there's an easy fix for this or maybe its related to the database entry for shinobi.
Re: Skull & Crossbones - Split Screen Shakes - Nestopia
by on (#171454)
I hope it helps. All the games work with no glitches.

-edited- Code removed.
Please, read the wiki discussion page!
Re: Skull & Crossbones - Split Screen Shakes - Nestopia
by on (#171459)
Thanks zepper, is this a patch for nestopia or code that you are using in your own emulator?
Re: Skull & Crossbones - Split Screen Shakes - Nestopia
by on (#171475)
*Spitfire_NES* wrote:
Thanks zepper, is this a patch for nestopia or code that you are using in your own emulator?


Nope. Just the info you'll need to the proper fix. The IRQ isn't triggered when the counter expires. It'll trigger after 4 CPU cycles.
Re: Skull & Crossbones - Split Screen Shakes - Nestopia
by on (#171493)
Im currently parsing through the nestopia source and I see the source file NstBoardTengenRambo1.cpp. Maybe I can get someone to help me a little bit, its very difficult to parse where to put a patch. And thanks again zepper for posting the code, guess its a matter of deciphering what goes where with what you posted.
Re: Skull & Crossbones - Split Screen Shakes - Nestopia
by on (#171553)
Sorry for the double post, im looking through nestopia undeads source to try to do this myself,

https://github.com/rdanbrook/nestopia/b ... Rambo1.cpp

if you scroll down to this part:

if (!count && enabled) {
/* wait one M2 cycle, then trigger IRQ */
return true;

do i just need to wait 3 more cycles or am i way off? I never claimed to be an expert but am trying my best here.

I believe this is dragon2snows experimental code, but im not seeing where i can actually change the cycle count to 4. This also might explain why part of the odometer is cut off in hard drivin.
Re: Skull & Crossbones - Split Screen Shakes - Nestopia
by on (#171573)
Argh... fine. I'll take a look later... and make the necessary changes in the code. You should be able to do that, by the way. :x
Re: Skull & Crossbones - Split Screen Shakes - Nestopia
by on (#171574)
ahh zepper. You rock man! 8-) And yes, im a noob but I am trying. :lol: :mrgreen:
Re: Skull & Crossbones - Split Screen Shakes - Nestopia
by on (#172231)
Hey zepper, do you know by chance if this might help fix the top of the odometer missing in hard drivin?
Re: Skull & Crossbones - Split Screen Shakes - Nestopia
by on (#174377)
Hey Zepper, am I still lucky enough to get your help with this? If not, that's obviously ok. Just figured I would check. :D
Re: Skull & Crossbones - Split Screen Shakes - Nestopia
by on (#174411)
Sorry, I'm definitely unfamiliar with nestopia code style.
Re: Skull & Crossbones - Split Screen Shakes - Nestopia
by on (#174440)
Zepper wrote:
Sorry, I'm definitely unfamiliar with nestopia code style.


Thanks zepper, no worries. Just to clarify I did not mean the odometer from hard drivin, it was about the shinobi patch. :D
Re: Skull & Crossbones - Split Screen Shakes - Nestopia
by on (#174489)
Who can provide the real machine video for skull & crossbones.
or provide real machine video for all mapper 64 game;

I try fix.......
Re: Skull & Crossbones - Split Screen Shakes - Nestopia
by on (#174709)
http://v.youku.com/v_show/id_XMTYzMDQzMzMxNg==.html

is working fine?
Re: Skull & Crossbones - Split Screen Shakes - Nestopia
by on (#177579)
is this your video dragon? Have you been able to successfully fix this or something? This is obviously one of your builds (nestopia plus) so can you share your fix?
Re: Skull & Crossbones - Split Screen Shakes - Nestopia
by on (#198313)
I've updated my mapper 64 IRQ code. It was broken, so Hard Drivin' now works as it should be.
The wiki has been updated with this information.
Re: Skull & Crossbones - Split Screen Shakes - Nestopia
by on (#198333)
I'm having trouble understanding that code. In particular, when is irq_rambo1 called? Every M2 cycle, with ppuflag set when at the end of a scanline? Then why is the //IRQ reset part in there, when according to the updated wiki, the IRQ reload business should be happening at the end of a scanline, not every M2 cycle.

As far as a glitch-free performance is concerned, here are a few things to look out for in Skull & Crossbones:

Correct (according to these real-machine-captured videos: 1, 2):
Image
Wrong:
Image

Look for a rogue scanline above the status bar in the left picture, a garbled "CONTINUES" lettering in the middle picture, and the level selection rectangle being one scanline off in the right picture. I have never seen an emulator that could get all three right AND run Hard Drivin' glitch-free (This video shows that at least during Hard Drivin's title screen, the top scanline of the lower part of the screen should be cut off.) Does your emulator manage to do that?

Here is a real-machine-captured video of the two-player mode, and what glitches should be expected (none, except some jitter at the far right side of the screen in the scanline directly below the status bar).
Re: Skull & Crossbones - Split Screen Shakes - Nestopia
by on (#198353)
FWIW, for S&C there is a garbage scanline in both of the flash carts, but the item and level selection screens are correct. Hard Drivin is a glitchy mess below the driving portion of the screen in both.
Re: Skull & Crossbones - Split Screen Shakes - Nestopia
by on (#198355)
NewRisingSun wrote:
In particular, when is irq_rambo1 called?

At every CPU cycle, or 3 PPU cycles (NTSC), like you do with any other PPU IRQs, such as MMC3.
Quote:
Every M2 cycle, with ppuflag set when at the end of a scanline? Then why is the //IRQ reset part in there, when according to the updated wiki, the IRQ reload business should be happening at the end of a scanline, not every M2 cycle.

Correct, read it again. Once the IRQ counter is zero, wait for 4 CPU cycles, then trigger an IRQ. This isn't an hack, as it was already confirmed.
Quote:
(...)during Hard Drivin's title screen, the top scanline of the lower part of the screen should be cut off.) Does your emulator manage to do that?

The current public version has broken IRQs for mapper 64. The unreleased version has fixed such issue.
Re: Skull & Crossbones - Split Screen Shakes - Nestopia
by on (#198501)
I believe Shinobi may have similar corruption on the last line of the in-game status bar

Is there any emulator available today that can demonstrate the accurate RAMBO-1 IRQ behavior?
Re: Skull & Crossbones - Split Screen Shakes - Nestopia
by on (#198714)
Not to my knowledge. As I mentioned before, no current emulator gets all screens of Skulls and Crossbones right. We'll see how that revised RockNES code actually performs once it is released.
Re: Skull & Crossbones - Split Screen Shakes - Nestopia
by on (#198906)
Here's a pre-release of my emulator.
Download it.
Re: Skull & Crossbones - Split Screen Shakes - Nestopia
by on (#198912)
Thank-you. Using that pre-release build of RockNES, while Hard Driving works, as you described, Skull & Crossbones still has some glitches:

Corrupt "CONTINUES" in item screen, background one scanline off against selection:
Image

Background off by one scanline against selection on level select screen:
Image

Refer to the videos I linked to in my earlier post for proof that the actual cartridge does not produce these errors.
Re: Skull & Crossbones - Split Screen Shakes - Nestopia
by on (#198955)
And why do you think that is?IRQ?
Re: Skull & Crossbones - Split Screen Shakes - Nestopia
by on (#199150)
I couldn't suit both games in a standard IRQ operation. If I fix Skull & Crossbones, then Hard Drivin' is glitched, and so on.

EDIT: it seems they do NOT use a same board..!?
S&C requires the IRQ to clock only after reset, next clock ($C001 write).
HD' requires the IRQ to clock immediately after reset ($C001 write).
Re: Skull & Crossbones - Split Screen Shakes - Nestopia
by on (#199468)
Zepper wrote:
I couldn't suit both games in a standard IRQ operation. If I fix Skull & Crossbones, then Hard Drivin' is glitched, and so on.

EDIT: it seems they do NOT use a same board..!?
S&C requires the IRQ to clock only after reset, next clock ($C001 write).
HD' requires the IRQ to clock immediately after reset ($C001 write).


You may want to ask Frank Cifaldi/TheRedEye over at LostLevels.org for a board shot.
Re: Skull & Crossbones - Split Screen Shakes - Nestopia
by on (#199532)
Actually, the current info regarding RAMBO-1 IRQs is... wrong. I've updated the wiki (discussion page) with my suggestion of how it should work. Of course, I'm guessing and... it's working better than ever.

Is Kevtris around to analyse a RAMBO-1 board and its IRQ timing, like in the old days? He did even a RE of the mapper 90 IRQs!
Re: Skull & Crossbones - Split Screen Shakes - Nestopia
by on (#199744)
I believe I have figured out how RAMBO-1 IRQ timing works. 8-) :lol:

http://wiki.nesdev.com/w/index.php/Talk ... IRQ_timing
Re: Skull & Crossbones - Split Screen Shakes - Nestopia
by on (#207572)
Zepper wrote:
I believe I have figured out how RAMBO-1 IRQ timing works. 8-) :lol:

http://wiki.nesdev.com/w/index.php/Talk ... IRQ_timing


Is this still accurate information Zepper? Nestopia is very close to this IRQ in the undead implementation, and i would like to implement the rest of it if it is.

writes to $E001: irq_enable=true; IRQ acknowledge by CPU.

Nestopia was missing this in $E001 and i added it, but it does not seem like hard drivin works correctly with this. Can you confirm?
Re: Skull & Crossbones - Split Screen Shakes - Nestopia
by on (#207735)
What is the collateral effect?
Re: Skull & Crossbones - Split Screen Shakes - Nestopia
by on (#207745)
Well i need to do a little more testing but using that write to $E001: (irq_enable=true; IRQ acknowledge by CPU) makes hard drivin lose it's status bar before passing through the first gate.

At the moment, i am using Zxbdragon's implementation of code from when he added support for hard drivin. This code here:

Code:
// From dragon2snow
               if (reload)  {
                  if (latch < 1) {
                     count = latch + 1;
                  }
                  else {
                     count = latch + 2;
                  }
                  reload = false;
               }
               else if (!count) {
                  count = latch + 1;
               }
               
               count--;
               
               if (!count && enabled) {
                  /* wait one M2 cycle, then trigger IRQ */
                  return true;
               }
               
               return false;


After looking through what is posted on the talk link for the proper behavior, it is somewhat similar to that but not quite the same. One problem i am running into is not being able to outright add the line for irq_delay firing after 4 cycles due to the level of abstraction. In the hpp file for NstTengenRambo1.hpp i do see this though:

Code:
struct Irq
               {
                  Irq(Cpu&,Ppu&);

                  void Update();

                  enum
                  {
                     M2_CLOCK   = 4,
                     A12_FILTER = 16,
                     IRQ_DELAY  = 2,
                     SOURCE_PPU = 0x0,
                     SOURCE_CPU = 0x1,
                     SOURCE     = 0x1
                  };


So maybe i can just change that to 4 there after fixing the line of code above. One thing to note is martin's original code for this are used to be this:

Code:
bool Rambo1::Irq::Unit::Clock()
            {
               if (!reload)
               {
                  if (count)
                  {
                     return !--count && enabled;
                  }
                  else
                  {
                     count = latch;
                     return false;
                  }
               }
               else
               {
                  reload = false;
                  count = latch + 1;
                  return false;
               }
Re: Skull & Crossbones - Split Screen Shakes - Nestopia
by on (#207747)
Here's my current C code.
Code:
static inline void rambo1_clock(void)
{   
   if(MMC.irq_reset) {
      MMC.irq_counter = MMC.irq_latch+1;
      MMC.irq_reset = 0;
   } else if(0 == MMC.irq_counter) {
      MMC.irq_counter = MMC.irq_latch;
   } else {
      MMC.irq_counter--;
      if((0 == MMC.irq_counter) && MMC.irq_flag && (-1 == m64_irq)) {
      MMC.irq_reset = 1;
         m64_irq = 3; }
   }
}
/* runs at every CPU cycle.
 ppuflag is PPUADDR & $1000
 */
static void irq_rambo1(const unsigned int scanline, const unsigned int ppuflag)
{
   if(m64_irq > 0)
      m64_irq--;
   if(0 == m64_irq) {
      cpu_irqtrigger(TIRQ_MPR);
      m64_irq = -1;
   }
   if(0 != MMC.write) {
      if(0 == MMC.irq_timing) {
         rambo1_clock();
         MMC.irq_timing = 3;
      } else
         MMC.irq_timing--;
   } else {
      if( !ppu_is_rendering() ) { irq_latency = 8; return; }
      if(irq_latency > 0)
         irq_latency--;
      if(!irq_latency && ppuflag)
         rambo1_clock();
      if(ppuflag)
         irq_latency = 8;
   }
}
Re: Skull & Crossbones - Split Screen Shakes - Nestopia
by on (#207749)
I'll keep messing with it, thanks for posting that up zepper, but is this info still accurate?:

http://wiki.nesdev.com/w/index.php/Talk ... IRQ_timing
Re: Skull & Crossbones - Split Screen Shakes - Nestopia
by on (#207763)
*Spitfire_NES* wrote:

It's a try-and-error result.