Nestopia or Nintendulator, Do Either emulate Bus Conflicts?

Discuss emulation of the Nintendo Entertainment System and Famicom.

Moderator: Moderators

Post Reply
User avatar
MottZilla
Posts: 2837
Joined: Wed Dec 06, 2006 8:18 pm

Nestopia or Nintendulator, Do Either emulate Bus Conflicts?

Post by MottZilla »

Very simple question. I did a hack of a game from one mapper to UxROM and I cannot be sure it conforms to avoid bus conflicts so I was wondering if either emulator would emulate this. Both emulators seem to run the hack fine. Problem is I'm in doubt that the game doesn't have bus conflicts as some mapper writes aren't your typical STA $####,X where you have an array of 00 01 02 and so on. However some of the mapper writes ARE that way. So it's confusing and so if either emulator does emulate bus conflicts that would be nice to know. Neither said anything in their readme files.
User avatar
kyuusaku
Posts: 1665
Joined: Mon Sep 27, 2004 2:13 pm

Post by kyuusaku »

I don't think any emulator will crash on a bus conflict so I would go about this by using FCEUXDSP for the conditional breakpoint feature. First break on any write, and note every address used, then put conditional breakpoints for A, X and Y != $address for each of the addresses.
User avatar
MottZilla
Posts: 2837
Joined: Wed Dec 06, 2006 8:18 pm

Post by MottZilla »

I'll grab FCEUXDSP sometime and see myself I guess. And I didn't mean the emulator crashing, I mean do these emulators emulate bus conflicts where with UxROM if you write to $8000 - $FFFF a value of lets say 1 but the address you wrote to contains 2, shouldn't the emulator not respond to the program as you would think? I seem to recall bus confilcts tend to take both values and they are ANDed together. At the very least you are unlikely to get what you wanted unless you write to an address containing the value you are writing.

So that's what I'm asking is if either emulator handles bus conflict behavior or if it lets bad ROMs behave badly.
User avatar
kyuusaku
Posts: 1665
Joined: Mon Sep 27, 2004 2:13 pm

Post by kyuusaku »

How bus conflicts work depends on the ROM family, the values won't always be ANDed if the ROM can source as well as it can sink.

I wouldn't call a UNROM game with bus conflicts really a bad ROM, just not suitable for the original UNROM board, which is the programmer's problem, not the mapper or emulator's. Mappers generally take a few liberties with boards, like extending CNROM for mapper 3 and giving all mappers WRAM, so it's no surprise they aleve bus conflicts which certainly weren't intended in the first place.
User avatar
MottZilla
Posts: 2837
Joined: Wed Dec 06, 2006 8:18 pm

Post by MottZilla »

Well, I took an easier route and modified my emulator to tell me when a UxROM game was writing to ROM a value that was different than what exists there and the game I was concerned about does have bus conflicts. However, only during the startup, not during the game itself. And no matter what I did to decide what bank to make it if there was a bus conflict, such as ANDing, ORing, setting any value I want, the game always ran still so I'm happy with it now.

It is interesting to know more about bus conflicts now though.
tepples
Posts: 22603
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Post by tepples »

Bus conflict avoidance is one 74HC02 chip to disable the ROM during writes. This chip was the only difference between AMROM and ANROM. WRAM is two chips: a 6264 RAM and kyuusaku's 74HC10 based decoder. But granted, chips weren't cheap as chips in the classic era.
User avatar
kyuusaku
Posts: 1665
Joined: Mon Sep 27, 2004 2:13 pm

Post by kyuusaku »

OT: I don't think the 7410 circuit will work afterall because there's a race condition that could trigger unintentional writes :( Still a 7410 could be used to decode an active high enable RAM like 6264 while preventing bus conflicts and have an AND3 gate left over. Since Phi2 apparently goes HiZ during reset, this circuit's pulldown may offer some write protection: http://img504.imageshack.us/img504/9528/updatepr8.png

Or you could just use a NAND4 to decode any active low memory, also using the /WE priority method. If this is done with a two gate 7420, the second gate could be used to invert r/w to prevent bus conflicts as in the circuit above. This is probably the *final* best way unless you happen to need the extra AND3 from the 7410 and have a positive CE.
bunnyboy
Posts: 449
Joined: Thu Oct 27, 2005 1:44 pm
Location: CA
Contact:

Post by bunnyboy »

kyuusaku wrote:Since Phi2 apparently goes HiZ during reset, this circuit's pulldown may offer some write protection: http://img504.imageshack.us/img504/9528/updatepr8.png
Any suggestions for how large "big R" should be? 1K? 10K? 100K?
User avatar
Zepper
Formerly Fx3
Posts: 3262
Joined: Fri Nov 12, 2004 4:59 pm
Location: Brazil
Contact:

Post by Zepper »

- Since both emulators are open source, you should give a look into it. As far as I can tell you, from a quick look into it, yes, Nintendulator emulates bus conflicts. Of course, this might be subjective, as I'm "guessing" anyways.
User avatar
blargg
Posts: 3715
Joined: Mon Sep 27, 2004 8:33 am
Location: Central Texas, USA
Contact:

Post by blargg »

For intentional writes to $8000-$FFFF, you could always read the current value then write it back, ensuring there are no conflicts. But this doesn't cover unintentional writes there, as your improvement to the emulator does.
User avatar
kyuusaku
Posts: 1665
Joined: Mon Sep 27, 2004 2:13 pm

Post by kyuusaku »

bunnyboy wrote:Any suggestions for how large "big R" should be? 1K? 10K? 100K?
4.7K for LS or 10K for HC inputs I'd guess. I wonder how much protection this would actually offer. <OT> Anyone have an idea how to best corrupt RAM powering off?
Post Reply