| View previous topic :: View next topic |
| Author |
Message |
MottZilla

Joined: 06 Dec 2006 Posts: 1040
|
Posted: Tue Jul 22, 2008 1:16 pm Post subject: Nintendo MMC-5. EXRAM - Can the CPU execute from it? |
|
|
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 |
|
 |
Bregalad

Joined: 12 Nov 2004 Posts: 4040 Location: Jongny, VD, Switzerland
|
Posted: Tue Jul 22, 2008 2:44 pm Post subject: |
|
|
| 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 |
|
 |
MottZilla

Joined: 06 Dec 2006 Posts: 1040
|
Posted: Tue Jul 22, 2008 5:09 pm Post subject: |
|
|
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 |
|
 |
blargg

Joined: 27 Sep 2004 Posts: 2412
|
Posted: Tue Jul 22, 2008 6:02 pm Post subject: |
|
|
| 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 |
|
 |
kyuusaku
Joined: 27 Sep 2004 Posts: 1341 Location: .ma.us
|
Posted: Tue Jul 22, 2008 9:36 pm Post subject: |
|
|
| 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 |
|
 |
MottZilla

Joined: 06 Dec 2006 Posts: 1040
|
Posted: Tue Jul 22, 2008 10:43 pm Post subject: |
|
|
| 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 |
|
 |
dvdmth
Joined: 22 Mar 2006 Posts: 354
|
Posted: Wed Jul 23, 2008 9:40 am Post subject: |
|
|
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 |
|
 |
|