Contra J repro on Batman 2?

A place that you can discuss reproduction of classic titles or "licensed-for-reproduction" homebrew for personal use.

Moderators: B00daW, Moderators

Forum rules
1. NO BLATANT PIRACY. This includes reproducing homebrew less than 10 years old, with the exception of free software.
2. No advertising your reproductions, with the exception of free software.
3. Be nice. See RFC 1855 if you aren't sure what this means.
User avatar
l_oliveira
Posts: 409
Joined: Wed Jul 13, 2011 6:51 am
Location: Brasilia, Brazil

Re: Contra J repro on Batman 2?

Post by l_oliveira »

FARID wrote:@ BootGod
Thank you very much
But it seems the problem is not just Contra J I couldn't run any VRC2 game with AX5208C!
For example VRC4b and VRC2a are the same on PRG side and registers
I can run VRC4b games but VRC2a games don't work at all! (which I expect to run with bad graphic because of difference in CHR wiring)
Someone should explain it first :

VRC2a : Not Working
Ganbare Pennant Race! (J) [!].nes (PCB 351618)
TwinBee 3 - Poko Poko Dai Maou (J) [!].nes (PCB 351618)
(fr) CPU A0 -> |03 38| -> PRG A15 (r)
(fr) CPU A1 -> |04 37| <- CPU A12 (f)
⋮ ⋮
(f) PPU A10 -> |13 28| -> CHR A16 (r)
(f) /ROMSEL -> |14 27| -> CHR A14 (r)
(f) M2 -> |15 26| -> CHR A11 (r)
VRC2 µWire DO -> |16 25| -> CHR A13 (r)
VRC2 µWire DI <- |17 24| -> CHR A12 (r)
VRC2 µWire SK <- |18 23| -> CHR A10 (r)
VRC2 µWire CS <- |19 22| -> CHR A15 (r)
GND -- |20 21| -> n/c
Code which write CHR mapper registers in Twinbee 3:

Code: Select all

F82F:E6 D2     INC $00D2 = #$01
F831:AD F0 07  LDA $07F0 = #$60
F834:0A        ASL    <-   Arithmetic Shift Left
F835:8D 00 B0  STA $B000 = #$B9
F838:4A        LSR
F839:4A        LSR
F83A:4A        LSR
F83B:4A        LSR
F83C:8D 02 B0  STA $B002 = #$04
F83F:AD F1 07  LDA $07F1 = #$01
F842:0A        ASL    <-   Arithmetic Shift Left
F843:8D 01 B0  STA $B001 = #$75
F846:4A        LSR
F847:4A        LSR
F848:4A        LSR
F849:4A        LSR
F84A:8D 03 B0  STA $B003 = #$FD
F84D:AD F2 07  LDA $07F2 = #$02
F850:0A        ASL    <-   Arithmetic Shift Left
F851:8D 00 C0  STA $C000 = #$55
F854:4A        LSR
F855:4A        LSR
F856:4A        LSR
F857:4A        LSR
F858:8D 02 C0  STA $C002 = #$55
F85B:AD F3 07  LDA $07F3 = #$03
F85E:0A        ASL    <-   Arithmetic Shift Left
F85F:8D 01 C0  STA $C001 = #$55
F862:4A        LSR
F863:4A        LSR
F864:4A        LSR
F865:4A        LSR
F866:8D 03 C0  STA $C003 = #$95
F869:A9 00     LDA #$00
F86B:85 D2     STA $00D2 = #$01
F86D:60        RTS 

ASL instruction changes the data to be written so any value set on the register skips the bit which toggles pin 21 of mapper chip.Ganbare Pennant Race does the same thing.

I got both working on my VRCIV board:

Image
Image

Image
User avatar
rainwarrior
Posts: 8734
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: Contra J repro on Batman 2?

Post by rainwarrior »

BootGod wrote:Something must be bugged on my end, if your logged in and click on an image, it's supposed to download the image in original source dimensions.
I've had the same problem for a long while. I dunno why it only affects some people? I remember I could get to the big images if I could deduce the URL, but otherwise there is no way to navigate to them.
User avatar
koitsu
Posts: 4201
Joined: Sun Sep 19, 2004 9:28 pm
Location: A world gone mad

Re: Contra J repro on Batman 2?

Post by koitsu »

Re: BootGod and rainwarrior's convo about the site and image linking / clicking / etc.:

I just registered, logged in, and followed these steps:

1. Opened new tab for this URL: http://bootgod.dyndns.org:7777/profile.php?id=3986
2. Page was rendered correctly
3. Clicked left PCB image ("PCB Front")
4. That took me here: http://bootgod.dyndns.org:7777/image.php?ImageID=10301
5. Image on this page *is not* clickable. The raw HTML returned:

Code: Select all

<div class="content"><center><img src="imagegen.php?ImageID=10301&width=600" alt="PCB Front" title="PCB Front" border="0"></center></div>
Clearly there is no <a href="..."></a> around any of this, so that's why it's not clickable.

Also, the src URL in that code is not doing URL encoding correctly; & should be & (really, trust me). Other parts of the site are doing it correctly, example from step #2 above (look at the <img> line):

Code: Select all

<a class="myimg" href="image.php?ImageID=10301" onMouseover="ddrivetip('PCB Front<br>LROG009-00<br>Submitted by: bootgod<br>Linked from profile 3986')" onMouseout="hideddrivetip()">
<img align="middle" border="0" alt="" src="imagegen.php?ImageID=10301&width=175">
</a>
So yes, this is purely a server-side issue of some sort.
BootGod
Posts: 359
Joined: Wed Jul 13, 2005 3:14 pm

Re: Contra J repro on Batman 2?

Post by BootGod »

It was checking a user permission to see if they were allowed to download source images, but the setting of this permission got botched at some point. So I've just removed the check for the time being, so it should work for anyone logged in now. I fixed the & encoding too :P Honestly, the source for the currently live site is a disaster. The new one is much leaner and cleaner, but hell I just don't have the free time I used too and have kinda lost the motivation to work on it :/ So for now, the clunky old one lives on...
User avatar
koitsu
Posts: 4201
Joined: Sun Sep 19, 2004 9:28 pm
Location: A world gone mad

Re: Contra J repro on Batman 2?

Post by koitsu »

Confirmed it works. Folks should be happy. :)

And I know exactly what you mean about old crusty code needing to be replaced but not having the time + motivation.
User avatar
FARID
Posts: 499
Joined: Wed Apr 07, 2010 1:14 am
Location: Iran
Contact:

Re: Contra J repro on Batman 2?

Post by FARID »

@ BootGod
Thank you, it works here too!
User avatar
l_oliveira
Posts: 409
Joined: Wed Jul 13, 2011 6:51 am
Location: Brasilia, Brazil

Re: Contra J repro on Batman 2?

Post by l_oliveira »

For anyone willing to play this game in a MMC3:

http://www.bwass.org/bucket/Contra%20(J ... 0patch.zip

Patch with byuu's beat (.bps) patcher.
User avatar
FARID
Posts: 499
Joined: Wed Apr 07, 2010 1:14 am
Location: Iran
Contact:

Re: Contra J repro on Batman 2?

Post by FARID »

Thank you oliveira, this is great!
User avatar
FARID
Posts: 499
Joined: Wed Apr 07, 2010 1:14 am
Location: Iran
Contact:

Re: Contra J repro on Batman 2?

Post by FARID »

l_oliveira wrote:For anyone willing to play this game in a MMC3:

http://www.bwass.org/bucket/Contra%20(J ... 0patch.zip

Patch with byuu's beat (.bps) patcher.
Works perfect on AX5202P, thanks

Oh by the way there is another MMC3 patch for this game which is translated to english :

魂斗羅 -> Gryzor -> Contra [NESDEV]

魂斗羅 -> Gryzor -> Contra [Romhakcing]
kuroiryu
Posts: 8
Joined: Tue Jun 09, 2015 5:34 pm

Re: Contra J repro on Batman 2?

Post by kuroiryu »

Sorry to necro this post a bit, but I've been looking into the actual differences between VRC2 and VRC4, and it's led me to an attempt to "port" a VRC2 game to VRC4 (Dragon Scroll, since that's the first VRC2 game I found in my pile of Famicom games).

l_oliveira, you mentioned you had Twinbee 3 and Ganbare Pennant Race running on VRC4, but it wasn't clear how you did it. My testing makes it seem more complicated than just rewiring the board or changing the addresses of the register writes, and Farid's tests agree.

What all did you have to do to get the games working?
User avatar
l_oliveira
Posts: 409
Joined: Wed Jul 13, 2011 6:51 am
Location: Brasilia, Brazil

Re: Contra J repro on Batman 2?

Post by l_oliveira »

kuroiryu wrote:Sorry to necro this post a bit, but I've been looking into the actual differences between VRC2 and VRC4, and it's led me to an attempt to "port" a VRC2 game to VRC4 (Dragon Scroll, since that's the first VRC2 game I found in my pile of Famicom games).

l_oliveira, you mentioned you had Twinbee 3 and Ganbare Pennant Race running on VRC4, but it wasn't clear how you did it. My testing makes it seem more complicated than just rewiring the board or changing the addresses of the register writes, and Farid's tests agree.

What all did you have to do to get the games working?
Firstly before anything else, VRC2 and VRC4 are basically the same, exact thing. VRC4 uses a VRC2 as basis and add more memory control bits, a 6116 SRAM interface (2KB only. nope it can't use 6264s) and CPU cycle counting IRQ.

To make these two games run on VRC4, I firstly read the documentation on the mapper they use. Because only now the people writing emulators and related documentation are caring about hardware details it was quite cryptic to understand that the SOLE DIFFERENCE these games board wiring had to regular games was that it leaves one address line of the CHR bus disconnected, skipping it.

So, I disassembled the routines which control the graphics side of the mapper. I found out that to make up for the disconnected bit on the mapper routine they were simply rotating the mapper page data using the ASL instruction before writing. I just NOP'ed the ASL instructions. Also I changed all the mapper writes to match the wiring for the board I was using at the time:

Image

Image
That board is the one used by the two TMNT games which use the VRC4 mapper.

The reason I modded the board was to make it work with 8KB SRAM (you need to decode the SRAM address space yourself because the VRC4 does it only for 2KB of address space) so I could run the Batman Return of the Joker pirate hack.

In the end, I was able to hack the game so I did not need to do any modifications on my board.
lidnariq
Posts: 11432
Joined: Sun Apr 13, 2008 11:12 am

Re: Contra J repro on Batman 2?

Post by lidnariq »

l_oliveira wrote:a 6116 SRAM interface (2KB only. nope it can't use 6264s)
To briefly be super-pedantic: 4 KiB; CPU A11isn't connected.
User avatar
l_oliveira
Posts: 409
Joined: Wed Jul 13, 2011 6:51 am
Location: Brasilia, Brazil

Re: Contra J repro on Batman 2?

Post by l_oliveira »

Basically this is what I did to Pennant race:

Original:
00000000 4E 45 53 1A 08 10 60 10 00 00 00 00 00 00 00 00

Patched:
00000000 4E 45 53 1A 08 10 90 10 00 00 00 00 00 00 00 00

Original:
0001F7F0 4C 2F F8 AD F4 07 E6 D2 EA 8D 00 D0 4A 4A 4A 4A
0001F800 8D 08 D0 4C 69 F8 AD F5 07 E6 D2 EA 8D 04 D0 4A
0001F810 4A 4A 4A 8D 0C D0 4C 69 F8 AD F6 07 E6 D2 EA 8D
0001F820 00 E0 4A 4A 4A 4A 8D 08 E0 4C 69 F8 AD F7 07 E6
0001F830 D2 EA 8D 04 E0 4A 4A 4A 4A 8D 0C E0 4C 69 F8 E6
0001F840 D2 AD F0 07 EA 8D 00 B0 4A 4A 4A 4A 8D 08 B0 AD
0001F850 F1 07 EA 8D 04 B0 4A 4A 4A 4A 8D 0C B0 AD F2 07
0001F860 EA 8D 00 C0 4A 4A 4A 4A 8D 08 C0 AD F3 07 EA 8D
0001F870 04 C0 4A 4A 4A 4A 8D 0C C0 A9 00 85 D2 60 00 00

Patched:
0001F7F0 4C 2F F8 AD F4 07 E6 D2 EA 8D 00 D0 4A 4A 4A 4A
0001F800 8D 08 D0 4C 69 F8 AD F5 07 E6 D2 EA 8D 04 D0 4A
0001F810 4A 4A 4A 8D 0C D0 4C 69 F8 AD F6 07 E6 D2 EA 8D
0001F820 00 E0 4A 4A 4A 4A 8D 08 E0 4C 69 F8 AD F7 07 E6
0001F830 D2 EA 8D 04 E0 4A 4A 4A 4A 8D 0C E0 4C 69 F8 E6
0001F840 D2 AD F0 07 EA 8D 00 B0 4A 4A 4A 4A 8D 08 B0 AD
0001F850 F1 07 EA 8D 04 B0 4A 4A 4A 4A 8D 0C B0 AD F2 07
0001F860 EA 8D 00 C0 4A 4A 4A 4A 8D 08 C0 AD F3 07 EA 8D
0001F870 04 C0 4A 4A 4A 4A 8D 0C C0 A9 00 85 D2 60 00 00
Last edited by l_oliveira on Wed Jun 10, 2015 7:01 pm, edited 2 times in total.
User avatar
l_oliveira
Posts: 409
Joined: Wed Jul 13, 2011 6:51 am
Location: Brasilia, Brazil

Re: Contra J repro on Batman 2?

Post by l_oliveira »

lidnariq wrote:
l_oliveira wrote:a 6116 SRAM interface (2KB only. nope it can't use 6264s)
To briefly be super-pedantic: 4 KiB; CPU A11isn't connected.
I don't think you can buy 4KB SRAM parts anywhere. Toshiba tried to sell a 4KB part some time in the early 80s and it didn't "stick".

I dunno if that matters anyway. ;)
lidnariq
Posts: 11432
Joined: Sun Apr 13, 2008 11:12 am

Re: Contra J repro on Batman 2?

Post by lidnariq »

Totally doesn't matter! :)

But you could drop a 6264 on there, and then be very confused why you were only getting access to 4 KiB of it.
Post Reply