nesdev.com
https://forums.nesdev.com/

Do Mapper 0 games use illegal opcodes? (no, a bit, a lot?)
https://forums.nesdev.com/viewtopic.php?f=3&t=12765
Page 1 of 1

Author:  Petruza [ Sat May 02, 2015 11:57 pm ]
Post subject:  Do Mapper 0 games use illegal opcodes? (no, a bit, a lot?)

I've compared my emulator's disassembly to nestest's log and fixed every difference until I hit an illegal opcode, of which I haven't implemented any yet.
Since my phase 1 goal is making the emulator work with mapper 0 games, I'd like to know if implementing all the illegal codes is a must or if I can avoid them for now.

Author:  thefox [ Sun May 03, 2015 1:16 am ]
Post subject:  Re: Do Mapper 0 games use illegal opcodes? (no, a bit, a lot

Practically no games use them. So yes, you can skip them when you're just getting started.

Author:  Petruza [ Sun May 03, 2015 11:52 am ]
Post subject:  Re: Do Mapper 0 games use illegal opcodes? (no, a bit, a lot

Yay! thanks.

Author:  Sik [ Sun May 03, 2015 12:53 pm ]
Post subject:  Re: Do Mapper 0 games use illegal opcodes? (no, a bit, a lot

I think Nintendo had imposed a ban on them, hadn't they? That doesn't mean some didn't slip past them but it explains why they're so rare in general. (I imagine they were concerned a later revision of the system would break them - this happened between the C64 and C128 because of the switch to CMOS 6502, after all)

Author:  Myask [ Sun May 03, 2015 2:09 pm ]
Post subject:  Re: Do Mapper 0 games use illegal opcodes? (no, a bit, a lot

None of the games we have listed as using unofficial opcodes that are in Bootgod's database use NROM=mapper 0. (Not sure about Beauty and the Beast (E) 036.)
Of the homebrew games mentioned, Driar uses MMC1, STREEMERZ uses UxROM, Attribute Zone uses Color Dreams, and I expect zzo's Zork port is going to use a custom mapper therefor: so none of them use mapper 0 either.

Mind, implementing unofficial NOPs and the alternate SBC aren't going to cost you very much...

Author:  tepples [ Sun May 03, 2015 2:47 pm ]
Post subject:  Re: Do Mapper 0 games use illegal opcodes? (no, a bit, a lot

Driar was ported to NROM for the multicart. That's the only NROM game I know of that uses unofficial opcodes. The rest are opcode tests.

Author:  zzo38 [ Sun May 03, 2015 6:25 pm ]
Post subject:  Re: Do Mapper 0 games use illegal opcodes? (no, a bit, a lot

Nevertheless, for the implementation to be correct (even if you are only implementing mapper 0) you still have to implement the stable unofficial opcodes even if no mapper 0 games currently used them; however, you need not implement them now; you can implement other stuff first and then add it later on to make it complete.

What Myask (and tepples) said is probably correct though. So, unless you want it to run the NROM version of Driar even before you complete the implementation, you do not need to implement these opcodes right now.

Author:  thefox [ Sun May 03, 2015 7:41 pm ]
Post subject:  Re: Do Mapper 0 games use illegal opcodes? (no, a bit, a lot

Sik wrote:
I think Nintendo had imposed a ban on them, hadn't they?

It's possible, but as far as I know it's just speculation. We could find out by asking some of the programmers from back in the day whether such a restriction was in place.

Author:  Dwedit [ Sun May 03, 2015 7:51 pm ]
Post subject:  Re: Do Mapper 0 games use illegal opcodes? (no, a bit, a lot

Puzznic is CNROM, that's pretty close...

Author:  rainwarrior [ Sun May 03, 2015 9:09 pm ]
Post subject:  Re: Do Mapper 0 games use illegal opcodes? (no, a bit, a lot

thefox wrote:
It's possible, but as far as I know it's just speculation. We could find out by asking some of the programmers from back in the day whether such a restriction was in place.


1. I would highly suspect that they were forbidden in documentation given by Nintendo to licensed developers, and of course, also undocumented.

2. I sincerely doubt they had any practical test to verify whether illegal opcodes were being used, so whether or not they were "forbidden" is a moot issue.

3. Licensed games do end up executing illegal opcodes now and then due to programming bugs that end up running non-code data as code. It's rare, and usually leads to an unrecoverable crash anyway, but it happens.

Author:  Drag [ Mon May 04, 2015 12:22 am ]
Post subject:  Re: Do Mapper 0 games use illegal opcodes? (no, a bit, a lot

The reason Nintendo would've discouraged the use of undocumented opcodes is for situations where NES games might be running on a revision of the NES that didn't use the same 6502 core, and thus, had incompatible undocumented opcodes. The SNES would've been a great example of this, but Nintendo scrapped the NES backwards compatibility they originally wanted it to have.

Given this information, I would speculate that the NES library contains very little in the way of undocumented opcodes. It'll be mainly unlicensed games and homebrews that use them, very few licensed games.

Author:  Petruza [ Mon May 04, 2015 8:12 am ]
Post subject:  Re: Do Mapper 0 games use illegal opcodes? (no, a bit, a lot

rainwarrior wrote:
1. I would highly suspect that they were forbidden in documentation given by Nintendo to licensed developers, and of course, also undocumented.

Is such a documentation available somewhere? Is there any Nintendo official programming reference for the NES?

Author:  tepples [ Mon May 04, 2015 8:34 am ]
Post subject:  Re: Do Mapper 0 games use illegal opcodes? (no, a bit, a lot

I'm not privy to any official NES docs. But the fact that unofficial opcodes other than $89 mostly appeared in games released after the Super Famicom came out (fourth quarter 1990) might be part of it. Opcode $89 (BIT #ii) works identically on all 6502 versions except that it doesn't affect the Z flag on the original 6502.

The 1-byte NOPs in Dynowarz, on the other hand, pose a problem to this hypothesis.

Author:  Drag [ Mon May 04, 2015 9:27 am ]
Post subject:  Re: Do Mapper 0 games use illegal opcodes? (no, a bit, a lot

Yeah, that's what I was thinking, if any licensed games used unofficial opcodes (other than NOPs and stuff), it would've likely been after the SNES was released, which is when developers would've known Nintendo scrapped the NES backwards compatibility.

Author:  Sik [ Tue May 05, 2015 1:59 pm ]
Post subject:  Re: Do Mapper 0 games use illegal opcodes? (no, a bit, a lot

rainwarrior wrote:
1. I would highly suspect that they were forbidden in documentation given by Nintendo to licensed developers, and of course, also undocumented.

When did undocumented opcodes become commonplace in the C64 demoscene? (as far as I know it's based off the same 6502 core, ergo the same undocumented opcodes)

Page 1 of 1 All times are UTC - 7 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/