Games that use unofficial opcodes

Discuss emulation of the Nintendo Entertainment System and Famicom.

Moderator: Moderators

isosceles
Posts: 17
Joined: Sat Mar 08, 2014 12:59 pm

Games that use unofficial opcodes

Post by isosceles »

I've noticed a few other games seem to use unofficial opcodes other than the ones mentioned here:

http://wiki.nesdev.com/w/index.php/Tric ... late_games
http://wiki.nesdev.com/w/index.php/CPU_ ... al_opcodes

Dynowarz uses $DA and $FA (one byte NOPs) - you can see this happen on the first level when your dino throws his fist.
F-117A Stealth Fighter uses $89 (two byte NOP) - you can see this happen when your stealth fighter first takes off and gets to the top of the screen before switching to the interior cockpit view
Infiltrator also uses $89 (two byte NOP) - on the title screen

We should probably update the wiki page(s) to mention these other usages of unofficial opcodes.

Are there more that anyone is aware of? I suspect Rollergames uses $03...but I'm still investigating that one...
User avatar
thefox
Posts: 3134
Joined: Mon Jan 03, 2005 10:36 am
Location: 🇫🇮
Contact:

Re: Games that use unofficial opcodes

Post by thefox »

isosceles wrote:Dynowarz uses $DA and $FA (one byte NOPs) - you can see this happen on the first level when your dino throws his fist.
Confirmed on Nintendulator:

Code: Select all

Invalid opcode $DA (NOP) encountered at $E56D
Invalid opcode $FA (NOP) encountered at $E57D
(Note that "throws his fist" literally means that the fist goes flying, so have to pick up a powerup for that to happen.)
isosceles wrote:F-117A Stealth Fighter uses $89 (two byte NOP) - you can see this happen when your stealth fighter first takes off and gets to the top of the screen before switching to the interior cockpit view
Also confirmed:

Code: Select all

Invalid opcode $89 (NOP) encountered at $B702
Invalid opcode $89 (NOP) encountered at $B753
Invalid opcode $89 (NOP) encountered at $B9AA
isosceles wrote:Infiltrator also uses $89 (two byte NOP) - on the title screen
And this one also:

Code: Select all

Invalid opcode $89 (NOP) encountered at $8939
(Seems to be in sound code, and funnily enough it's also in sync with the "tick tick tick" sound being played.)
Download STREEMERZ for NES from fauxgame.com! — Some other stuff I've done: fo.aspekt.fi
User avatar
koitsu
Posts: 4201
Joined: Sun Sep 19, 2004 9:28 pm
Location: A world gone mad

Re: Games that use unofficial opcodes

Post by koitsu »

isosceles wrote:We should probably update the wiki page(s) to mention these other usages of unofficial opcodes.
So what's stopping you? Did you make an account on the wiki? If so, do you need us to grant you edit access? (Tepples or I can do this no problem, just drop one of us a PM with your Wiki username and we'll make it happen).

The wiki is a collaborate effort -- in other words, this post here on the forum is totally cool and appreciated, but you effectively could have done the same thing by editing the wiki in the first place. "We should probably update it" implies that for some reason you can't or won't, so let's work together to make sure you can and will!
User avatar
Bregalad
Posts: 8056
Joined: Fri Nov 12, 2004 2:49 pm
Location: Divonne-les-bains, France

Re: Games that use unofficial opcodes

Post by Bregalad »

It'd be also interesting to see if the usage of those unofficial opcodes is the result of a program flow bug that miraculously didn't make the game crash (so the developers never fixed it), or if it is really the result of using them on purpose.
I really see no advantage in using unofficial multi-bytes nop as opposed to real nops.
User avatar
Zepper
Formerly Fx3
Posts: 3262
Joined: Fri Nov 12, 2004 4:59 pm
Location: Brazil
Contact:

Re: Games that use unofficial opcodes

Post by Zepper »

...or a bad dump.
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Games that use unofficial opcodes

Post by tepples »

$89 can be the result of a mistaken BIT in code originally intended for a TurboGrafx, Lynx, or Super NES. The 65C02 interprets $89 as BIT #ii, which sets the Z flag based on A & ii. The 6502 interprets it as a 2-byte NOP, which is exactly the same except flags aren't affected.
Bregalad wrote:I really see no advantage in using unofficial multi-bytes nop as opposed to real nops.
Do any of these games use the 2-byte NOP as a clockslide? Besides, now that flash memory has replaced mask ROM, 2-byte NOPs are useful for making each copy identifiably unique.
User avatar
tokumaru
Posts: 12427
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Re: Games that use unofficial opcodes

Post by tokumaru »

tepples wrote:clockslide
Heh, interesting way to play with the opcodes.
isosceles
Posts: 17
Joined: Sat Mar 08, 2014 12:59 pm

Re: Games that use unofficial opcodes

Post by isosceles »

It appears Rollergames uses $03 (SLO), at $C7EE - this happens almost immediately upon the start of the first level, and periodically thereafter.
isosceles
Posts: 17
Joined: Sat Mar 08, 2014 12:59 pm

Re: Games that use unofficial opcodes

Post by isosceles »

...and The Simpsons: Bart vs The World uses $0B (ANC) at $F126. You can see this happen on the China boat level, when Bart throws his ball.
User avatar
thefox
Posts: 3134
Joined: Mon Jan 03, 2005 10:36 am
Location: 🇫🇮
Contact:

Re: Games that use unofficial opcodes

Post by thefox »

Couldn't reproduce either one of those.
Download STREEMERZ for NES from fauxgame.com! — Some other stuff I've done: fo.aspekt.fi
User avatar
koitsu
Posts: 4201
Joined: Sun Sep 19, 2004 9:28 pm
Location: A world gone mad

Re: Games that use unofficial opcodes

Post by koitsu »

Noting here: now that you (isosceles) have wiki edit access, please be careful in adding entries for these games. If folks can reproduce + verify the behaviour, then thumbs up, but don't be hasty with your additions. We don't want to send emulator authors on wild goose chases if we can avoid it.
Sik
Posts: 1589
Joined: Thu Aug 12, 2010 3:43 am

Re: Games that use unofficial opcodes

Post by Sik »

tepples wrote:Do any of these games use the 2-byte NOP as a clockslide?
This was my first thought, either that or for doing cycle-exact timing of hardware accesses without needlessly messing with the CPU state (I know I have used otherwise inefficient opcodes in the past because they happen to give me the perfect timing for the hardware).
isosceles
Posts: 17
Joined: Sat Mar 08, 2014 12:59 pm

Re: Games that use unofficial opcodes

Post by isosceles »

thefox wrote:Couldn't reproduce either one of those.
Oops - my apologies - Turns out I had bad dumps of both Rollergames and Bart Vs. The World. There is no unofficial opcode use in either. :oops:
User avatar
Zepper
Formerly Fx3
Posts: 3262
Joined: Fri Nov 12, 2004 4:59 pm
Location: Brazil
Contact:

Re: Games that use unofficial opcodes

Post by Zepper »

isosceles wrote:
thefox wrote:Couldn't reproduce either one of those.
Oops - my apologies - Turns out I had bad dumps of both Rollergames and Bart Vs. The World. There is no unofficial opcode use in either. :oops:
That's what I had warned... and ignored.
User avatar
thefox
Posts: 3134
Joined: Mon Jan 03, 2005 10:36 am
Location: 🇫🇮
Contact:

Re: Games that use unofficial opcodes

Post by thefox »

The first three games mentioned in the thread are unlikely to be bad dumps. When I made my first post I verified their CRC32 against those from bootgod's NES cart database. At least one of the games had been dumped twice by different people. I'm not sure what's the likelihood that some of the dumps I have originate from bootgod. In any case, I believe bootgod has been fairly careful about getting the dumps right on his site.
Download STREEMERZ for NES from fauxgame.com! — Some other stuff I've done: fo.aspekt.fi
Post Reply