MMC3 with CHR-RAM on specific device.
Moderator: Moderators
MMC3 with CHR-RAM on specific device.
Hi guys, I'm facing some problem with a ROM a very specific device.
It's a generic DVD player that has support for playing some NES roms.
Given this demo at this github branch https://github.com/gutomaia/NES_bankswi ... th_chr_ram
I'm trying to make it work properly on the device itself. The ROM, works perfectly on all emulators that I've tested. As benchmark I was suggested by rainwarrior to test with Megaman 4. Witch uses MMC3 with CHR-RAM. And it works perfectly. So, it's not a lack of support of CHR-RAM.
Any clues about what might be missing on the ROM to make it work on the device?
Below I have some images of the demo and Megaman 4 running on the device.
https://ibb.co/XJ4XJr2 Megaman
https://ibb.co/Mp1Ffh6 Demo
It's a generic DVD player that has support for playing some NES roms.
Given this demo at this github branch https://github.com/gutomaia/NES_bankswi ... th_chr_ram
I'm trying to make it work properly on the device itself. The ROM, works perfectly on all emulators that I've tested. As benchmark I was suggested by rainwarrior to test with Megaman 4. Witch uses MMC3 with CHR-RAM. And it works perfectly. So, it's not a lack of support of CHR-RAM.
Any clues about what might be missing on the ROM to make it work on the device?
Below I have some images of the demo and Megaman 4 running on the device.
https://ibb.co/XJ4XJr2 Megaman
https://ibb.co/Mp1Ffh6 Demo
Re: MMC3 with CHR-RAM on specific device.
Unless I'm missing something, your demo doesn't appear to initialize the MMC3's CHR bank registers, the mirroring state, or the IRQ counter. Many emulators initialize these to "nice" values for various unknown reasons, but other emulators (and real hardware) might not initialize them at all, causing them to be random on powerup.
Just because a game uses CHR RAM doesn't mean you don't have to initialize the CHR bank registers - even though it might not seem useful to do so, it's still possible to rearrange the banks.
Just because a game uses CHR RAM doesn't mean you don't have to initialize the CHR bank registers - even though it might not seem useful to do so, it's still possible to rearrange the banks.
Quietust, QMT Productions
P.S. If you don't get this note, let me know and I'll write you another.
P.S. If you don't get this note, let me know and I'll write you another.
- rainwarrior
- Posts: 8732
- Joined: Sun Jan 22, 2012 12:03 pm
- Location: Canada
- Contact:
Re: MMC3 with CHR-RAM on specific device.
There is code to initialize, and debugging the artifact build for that branch this code does run. Unless the test was done with a different ROM (e.g. the master branch build?) I don't think MMC3 initialization is the issue here?
It seems to run OK in emulators I've tried, and on PowerPak. Mesen in particular has option to randomize MMC3 power-on state, and it gets through that just fine.crt0.s wrote:Code: Select all
.segment "STARTUP" ; startup values for the 8 MMC3 registers mmc3_register_init: .byte $00 ; 2KB CHR $0000 .byte $02 ; 2KB CHR $0800 .byte $04 ; 1KB CHR $1000 .byte $05 ; 1KB CHR $1500 .byte $06 ; 1KB CHR $1800 .byte $07 ; 1KB CHR $1C00 .byte $00 ; 4KB PRG $8000 .byte $01 ; 4KB PRG $A000 start: _exit: sei ldx #$ff txs inx stx PPU_MASK stx DMC_FREQ stx PPU_CTRL ;no NMI ; initialize all registers of MMC3 initMMC3: lda #0 sta $E000 ; IRQ disable sta $A000 ; mirroring init tax : stx $8000 ; select register lda mmc3_register_init, X sta $8001 ; initialize regiter inx cpx #8 bcc :-
Re: MMC3 with CHR-RAM on specific device.
As a random shot in the dark, try padding your proof-of-concept PRG up to 256KB.
Re: MMC3 with CHR-RAM on specific device.
Thanks for replying guys.
@lidnariq i've just tryed to raise the PRG up to 256 KB. Change made is on the last commit: https://github.com/gutomaia/NES_bankswi ... ec11297ea9
The actual result was:
https://ibb.co/RczS1j3
Well, something interesting is that the noise pattern that appears on the screen is the same of the first smaller ROM.
@lidnariq i've just tryed to raise the PRG up to 256 KB. Change made is on the last commit: https://github.com/gutomaia/NES_bankswi ... ec11297ea9
The actual result was:
https://ibb.co/RczS1j3
Well, something interesting is that the noise pattern that appears on the screen is the same of the first smaller ROM.
Re: MMC3 with CHR-RAM on specific device.
It appears to be ignoring your header and giving you some uninitialized RAM as though it were CHR ROM. But that's weird. I was hoping that pretending to be an Established TNROM/TGROM game would fix that but ... apparently not.
Maybe the emulator incorrectly uses the PRG RAM protection bits for CHR RAM also??
Maybe the emulator incorrectly uses the PRG RAM protection bits for CHR RAM also??
- rainwarrior
- Posts: 8732
- Joined: Sun Jan 22, 2012 12:03 pm
- Location: Canada
- Contact:
Re: MMC3 with CHR-RAM on specific device.
Mega Man 4 doesn't ever write $A001 (or its mirrors) as far as I can tell.
Though it might be worth having a "sta $A001" after the "sta $A000" in the initMMC3 code there, just to be sure to initialize that.
- rainwarrior
- Posts: 8732
- Joined: Sun Jan 22, 2012 12:03 pm
- Location: Canada
- Contact:
Re: MMC3 with CHR-RAM on specific device.
Another thought: change one byte in the Mega Man 4 ROM and see if it still runs? Might want to rule out that the emulator is relying on a database of CRCs to select the cart function.
Re: MMC3 with CHR-RAM on specific device.
Hi,rainwarrior wrote: ↑Tue May 11, 2021 1:00 pmMega Man 4 doesn't ever write $A001 (or its mirrors) as far as I can tell.
Though it might be worth having a "sta $A001" after the "sta $A000" in the initMMC3 code there, just to be sure to initialize that.
Just didit, although, it's still looks that's is showing some dirty on memory.
Check it out: https://ibb.co/QYxZKb1
Re: MMC3 with CHR-RAM on specific device.
Any recommendation for a specific program that works on mac for patching it out?rainwarrior wrote: ↑Wed May 12, 2021 12:07 pm Another thought: change one byte in the Mega Man 4 ROM and see if it still runs? Might want to rule out that the emulator is relying on a database of CRCs to select the cart function.
- rainwarrior
- Posts: 8732
- Joined: Sun Jan 22, 2012 12:03 pm
- Location: Canada
- Contact:
Re: MMC3 with CHR-RAM on specific device.
You could just open it with a hex editor and change any byte (except the first 16).gutomaia wrote: ↑Thu May 13, 2021 2:08 pmAny recommendation for a specific program that works on mac for patching it out?rainwarrior wrote: ↑Wed May 12, 2021 12:07 pm Another thought: change one byte in the Mega Man 4 ROM and see if it still runs? Might want to rule out that the emulator is relying on a database of CRCs to select the cart function.
Or I dunno, pick a random hack and apply the patch?
The point is to figure out whether the device actually uses the header, or does a CRC check on the ROM to guess what game it is. (If it requires a CRC, an altered ROM will fail.)
Re: MMC3 with CHR-RAM on specific device.
The great news is that it does work!rainwarrior wrote: ↑Thu May 13, 2021 3:43 pmYou could just open it with a hex editor and change any byte (except the first 16).gutomaia wrote: ↑Thu May 13, 2021 2:08 pmAny recommendation for a specific program that works on mac for patching it out?rainwarrior wrote: ↑Wed May 12, 2021 12:07 pm Another thought: change one byte in the Mega Man 4 ROM and see if it still runs? Might want to rule out that the emulator is relying on a database of CRCs to select the cart function.
Or I dunno, pick a random hack and apply the patch?
The point is to figure out whether the device actually uses the header, or does a CRC check on the ROM to guess what game it is. (If it requires a CRC, an altered ROM will fail.)
I've tested a Megaman 4 hack, patched from romhacking and it runs nicely.
check it out:
https://ibb.co/pRF5J1c
https://ibb.co/hWwJ4hW
Now, what comes in mind is, what's the real difference between Megaman 4 ROM and my demo.
Re: MMC3 with CHR-RAM on specific device.
Guys,
I still don't have any clues on why my demo ROM does not work on that specific device. What I'm doing then? Using FCEux debugger to try to find if any particular instruction on the start of the MegaMan game makes any sense.
Any tips on how to better use the debugger?
I still don't have any clues on why my demo ROM does not work on that specific device. What I'm doing then? Using FCEux debugger to try to find if any particular instruction on the start of the MegaMan game makes any sense.
Any tips on how to better use the debugger?
- rainwarrior
- Posts: 8732
- Joined: Sun Jan 22, 2012 12:03 pm
- Location: Canada
- Contact:
Re: MMC3 with CHR-RAM on specific device.
Put a breakpoint on writes to $4020-$FFFF (i.e. writes that could affect the mapper) and see if you spot it doing anything unusual up until the point the first graphics are properly displayed.
Do that with both ROMs you are comparing, make a log of all the writes. See if anything stands out as unusually different.
However, I've kind of already done this and not found anything of interest. I haven't made a meticulous log, but I have gone over the startup on both ROMs with just the breakpoints looking for anything weird. I haven't noticed any differences that should be significant, but it's possible I missed something.
One other thing I noticed is that your ROM has "vertical" mirroring in the header and the Mega Man 4 ROM I have has "horizontal" mirroring in its header. This shouldn't have an effect on MMC3, since mirroring is mapper controlled, but you might try changing your header to "horizontal" just to see if it affects your device?
Do that with both ROMs you are comparing, make a log of all the writes. See if anything stands out as unusually different.
However, I've kind of already done this and not found anything of interest. I haven't made a meticulous log, but I have gone over the startup on both ROMs with just the breakpoints looking for anything weird. I haven't noticed any differences that should be significant, but it's possible I missed something.
One other thing I noticed is that your ROM has "vertical" mirroring in the header and the Mega Man 4 ROM I have has "horizontal" mirroring in its header. This shouldn't have an effect on MMC3, since mirroring is mapper controlled, but you might try changing your header to "horizontal" just to see if it affects your device?
- rainwarrior
- Posts: 8732
- Joined: Sun Jan 22, 2012 12:03 pm
- Location: Canada
- Contact:
Re: MMC3 with CHR-RAM on specific device.
So you've verified that the ROM works and runs some code. It's clear that it's setting the nametable data.
Try reducing your main() to just the minimum needed. Maybe just clear the nametable to 0 and try to write some simple pattern to CHR tile 0. Don't do any PRG switching, just verify that you can write to CHR-RAM first.
If CHR-RAM writes are working, then my next guess would be maybe there's something weird about switching to the PRG bank where CHR is contained?
Try reducing your main() to just the minimum needed. Maybe just clear the nametable to 0 and try to write some simple pattern to CHR tile 0. Don't do any PRG switching, just verify that you can write to CHR-RAM first.
If CHR-RAM writes are working, then my next guess would be maybe there's something weird about switching to the PRG bank where CHR is contained?