nesdev.parodius.com Forum Index nesdev.parodius.com
NES Development and Strangulation Records message boards
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Nintendo MMC-5. EXRAM - Can the CPU execute from it?

 
Post new topic   Reply to topic    nesdev.parodius.com Forum Index -> NES Hardware and Flash Equipment
View previous topic :: View next topic  
Author Message
MottZilla



Joined: 06 Dec 2006
Posts: 1040

PostPosted: Tue Jul 22, 2008 1:16 pm    Post subject: Nintendo MMC-5. EXRAM - Can the CPU execute from it? Reply with quote

Simple question I think. If you set EXRAM to mode 2 where the CPU can read and write to it from $5C00 to $5FFF, can you copy code there and execute it?

I'm trying to do this but Nestopia and Nintendulator seem to say I can't do that. When the CPU try to execute at $5C00 range it seems to get all FFs. However when I copy my routine there, and then read it back I can see in the debugger that each byte was written correctly to EXRAM. To be clear, I copy each byte to EXRAM, then I just loaded each byte from EXRAM back into Reg-A and so through the debugger I could see it was written correctly. But the CPU when watched in the debugger will jump to $5C00 and read FF through the whole region.

So can the CPU for some reason not execute from EXRAM? The reason I'm doing this is I wanted to avoid using PRG-RAM so I could use the MMC-5 board without any.

I hope someone knows the answer to this or can do their own test.
Back to top
View user's profile Send private message
Bregalad



Joined: 12 Nov 2004
Posts: 4040
Location: Jongny, VD, Switzerland

PostPosted: Tue Jul 22, 2008 2:44 pm    Post subject: Reply with quote

Well, if you can read it then definitely you should be able to execute code from it (but I never tried). Definitely the emulators should be wrong on this point. After all executing code is a particular case of reading !
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
MottZilla



Joined: 06 Dec 2006
Posts: 1040

PostPosted: Tue Jul 22, 2008 5:09 pm    Post subject: Reply with quote

Well, if someone doesn't beat me to it first, I'll put together a decent test ROM or someone could modify a demo of theirs to use MMC5 and store a routine in EXRAM and see what happens on the NES. If you try it on Nestopia or Nintendulator it should crash (the NES program) though.

I agree with you, I think this is the emulator at fault as I don't see why EXRAM shouldn't be able to hold code. But the real hardware will have to be tested unless someone else has already tried this.
Back to top
View user's profile Send private message
blargg



Joined: 27 Sep 2004
Posts: 2412

PostPosted: Tue Jul 22, 2008 6:02 pm    Post subject: Reply with quote

Does the NES cartridge connector expose any signals which the MMC5 could use to differentiate opcode from data memory accesses? I couldn't find much information about M2.
Back to top
View user's profile Send private message Visit poster's website
kyuusaku



Joined: 27 Sep 2004
Posts: 1341
Location: .ma.us

PostPosted: Tue Jul 22, 2008 9:36 pm    Post subject: Reply with quote

Not only is there no signal to detect opcode reads (called SYNC) on the connector but the signal isn't available on the 2A03 at all, so without a doubt you can execute from any memory on any mapper.
Back to top
View user's profile Send private message
MottZilla



Joined: 06 Dec 2006
Posts: 1040

PostPosted: Tue Jul 22, 2008 10:43 pm    Post subject: Reply with quote

Well then, Nintendulator and Nestopia both fail to emulate execution from EXRAM. Anyone interested in fixing either? Preferably Nintendulator for it's debugger but either would be useful to me. I'd try to do it myself but I rarely have much luck compiling other people's projects. That and I don't know why they are broken.
Back to top
View user's profile Send private message
dvdmth



Joined: 22 Mar 2006
Posts: 354

PostPosted: Wed Jul 23, 2008 9:40 am    Post subject: Reply with quote

There's no reason I can think of why EXRAM cannot be used for code execution. The fact that Nestopia fails is likely due to optimizations designed at fetching instructions as quickly as possible. Those optimizations may not account for the possibility of special memory such as EXRAM. Nintendulator might have a similar problem - don't know what kinds of optimizations that emu uses.

If I get around to it, I will get the latest Nestopia source and see what I can find.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    nesdev.parodius.com Forum Index -> NES Hardware and Flash Equipment All times are GMT - 7 Hours
Page 1 of 1

 
Jump to:  
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 vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group