[SOLVED] VRC2 to VRC4 conversion

This is an archive of a topic from NESdev BBS, taken in mid-October 2019 before a server upgrade.
View original topic
[SOLVED] VRC2 to VRC4 conversion
by on (#134876)
Hi, need some help.
Im trying to run wai wai world 1 (mapper 023 vrc2b) with vrc4c pcb (mapper 21, Ganbare Goemon Gaiden 2 as a donor).

VRC2b: A0, A1 $x000, $x001, $x002, $x003 023
VRC4c: A6, A7 $x000, $x040, $x080, $x0C0 021

I change mapper and swap STA opcodes.
Emulators runs game normaly. But with hardware - gray screen.
Re: VRC2 to VRC4 conversion
by on (#134909)
seem's its prg mode or irq control of vrc4.
Re: VRC2 to VRC4 conversion
by on (#134931)
On emulators, mapper registers may have fixed power up values. On real hardware, they could be semi-random. If you don't initialize a register in the program, it may not be set to the value you are hoping for.

If the game is working on an emulator, then you probably just need to insert code somewhere soon after reset that writes zero to the PRG Mode register. You may want to write to disable and acknowledge the IRQ too, just incase.

Even after that, it may not work on a real cartridge depending on how the emulator you used to test it works. Since the VRC4 has so many different configurations living under one mapper number, how emulators deal with what address lines are used for register writes may be different than the real hardware. I can't recall from when I worked on it in my emulator, but it's possible if you missed patching a mapper write it could still function in the emulator but fail on real hardware.

This is one reason rather than patching the software it may be a better idea to rewire the board and mapper chip to use the address lines desired.
Re: VRC2 to VRC4 conversion
by on (#134936)
VRC2 と VRC4 では CPU address $c000-$dfff の挙動が異なる。
VRC2 では CPU address $c000-$dfff は固定で page = -2 だ。 VRC4 では CPU address $c000-$dfff は半固定で reset 直後には切り替え可能なバンクになっているようだった。エミュレータでは VRC4 のこの page は -2 に設定されているが事実と異なる。
いくつかの VRC4 のROM image を調査したところ、 reset vector address は全て $e000-$ffff になっているのを確認した。

Konami WaiWai の場合、 reset vector address に $c000-$dfff の値が振られているので、エミュレータでも動いていても 本物では $c000-$dfff はプログラムが期待する page のデータではないと思われる。

reset vector を書き換えて $e000-$ffff の空き領域に $c000-$dfff を固定にする命令をいれてからオリジナルのプログラムを再開するのはどうだろうか。
Re: VRC2 to VRC4 conversion
by on (#134940)
Translated:

VRC4 and VRC2 differ in their behavior of CPU address $C000-$DFFF.
In VRC2, CPU address $C000-$DFFF is fixed to page -2. In VRC4, CPU address $C000-$DFFF is semi-fixed immediately after reset but seems to become a switchable window. Emulators set this window to page -2, but this is not accurate.
Some investigation of VRC4 ROM images showed that all reset vector addresses are $E000-$FFFF.

In Konami WaiWai's case, the reset vector is $C000-$DFFF which doesn't work. Though emulators put the correct page there, I suspect the hardware doesn't and that's what's causing it not to work.

To fix it, you'll have to find some free space in $E000-$FFFF for init code and point the reset vector there.
Re: VRC2 to VRC4 conversion
by on (#135071)
thx to all.
problem solved by mixing vrc4 game and vrc2 game in one cart. vrc4 initialize vrc4 chip normaly and after reset vrc2 game working normaly.
this my repro:
Image
http://youtu.be/C4U6Q35A5sA
Re: [SOLVED] VRC2 to VRC4 conversion
by on (#135075)
Souds like the oppening of a new Repro section doesn't prevent annoying threads like this one to spread out of the Repro section. I don't know why but this was somehow to be expected. :mrgreen:
Re: [SOLVED] VRC2 to VRC4 conversion
by on (#135091)
As usual, if you think a topic has been posted in the wrong forum, feel free to press the first post's ! button to bring it to our attention.