Wednesday, April 29, 2009

Silkworm

stephh from The Ultimate Patchers earns 1000 points!

SPOT THE DIFFERENCE : 'silkworm' and 'silkwrm2'
Version 1.0 - Copyright Steph from The Ultimate Patchers, 2009.04.26

Besides a completely different sound CPU, in the main CPU, there are only 3 (THREE) bytes of difference !

Z:\>fc /B silkworm.4 r4
Comparing files silkworm.4 and R4
00000570: 51 59
00000598: 29 21
000042AE: C9 21

Let's now compare the Z80 code :
Z:\>diff silkworm.asm silkwrm2.asm
739c739
<> 056F: CB 59 bit 3,c
765c765
<> 0597: CB 21 sla c
9804,9806c9804
<> 42AE: 21 40 C8 ld hl,$C840

Routine at 0x42ae is called in attract mode after the scores are displayed ...Its purpose is to display a Japan warning screen ...So in S1, there is NO Japan warning screen, even if the text is still in the ROM !

Here is the full routine where there are the 2 other changes :

0562: 21 23 D0 ld hl,$D023
0565: 11 21 D0 ld de,$D021
0568: 3A 0F F8 ld a,($F80F)
056B: 2F cpl
056C: 4F ld c,a
056D: 06 02 ld b,$02
056F: CB 51 bit 2,c CB 59 bit 3,c
0571: 20 03 jr nz,$0576
0573: 34 inc (hl)
0574: 18 1E jr $0594
0576: 7E ld a,(hl)
0577: B7 or a
0578: 28 1A jr z,$0594
057A: 36 00 ld (hl),$00
057C: FE 18 cp $18
057E: 30 14 jr nc,$0594
0580: 23 inc hl
0581: 34 inc (hl)
0582: 7E ld a,(hl)
0583: 23 inc hl
0584: BE cp (hl)
0585: 38 0D jr c,$0594
0587: 2B dec hl
0588: 36 00 ld (hl),$00
058A: 23 inc hl
058B: 23 inc hl
058C: 1A ld a,(de)
058D: 86 add a,(hl)
058E: 12 ld (de),a
058F: 3E 01 ld a,$01
0591: 32 06 F8 ld ($F806),a
0594: 21 28 D0 ld hl,$D028
0597: CB 29 sra c CB 21 sla c
0599: 10 D4 djnz $056F

To sum up, this routine handles coinage ...

In S1, bit 2 is tested first (code at 0x056f) then bit 3 is tested due to the 'sra' instruction at 0x0597.
In S2, bit 3 is tested first (code at 0x056f) then bit 3 is tested due to the 'sla' instruction at 0x0597.

As there are no other changes, this means that COIN1 and COIN2 are swapped ...

As an example, do this in the 2 sets with MAME 0.131 or prior version
(this won't work with a further version as I'll fix that) :
- change "Coin A" Dip Switch to "2 Coins 1 Credit"
- change "Coin B" Dip Switch to "1 Coin 2 Credits"
- reset the game and you shall see a "2 COINS 1 PLAY" message
next screen after the "ALL RIGHTS RESERVED" message
- press COIN1 twice
- press COIN2 twice

In S1, you'll get 0 credit, 1 credit, 3 credits, 5 credits ...
In S2, you'll get 2 credits, 4 credits, 4 credits, 5 credits ...

S2 is a Japan set, but what about S1 ? Is it an export version ? Is it official ?And why are the coins mechanisms swapped between these 2 versions ?Unfortunately, code doesn't help here, and only an old Tecmo coder or project coordonatorcould answer such weird question ... If you ever find the answer, please let me know ...

No comments:

Post a Comment