Nope. Remember when the additional timpani pitches stopped working? We somehow left these two functions intact but broken: the remnants still handle alternate tom and bongo pitches. As with the timpani, we must add these to the
Samples Table and eliminate the remnants. We'll start with familiar ground and begin with the former.
Look for
byte_71CC4 again, and you'll find this:
byte_71CC4: dc.b $14, $17, $1E, $1F
Tom_71CC4: dc.b $4, $7, $A, $FF
Bongo_71CC4: dc.b $A, $D, $14, $FF
The first list contains the timpani tempos we used earlier, the second contains the tom tempos, and the third holds the bongo tempos. Adding this to the
Samples Table should give you this:
DAC_Entry $19, DAC1KICK, dpcm ; $81 - Kick
DAC_Entry $04, DAC2SNARE, dpcm ; $82 - Snare
DAC_Entry $08, DAC3CLAP, dpcm ; $83 - Clap
DAC_Entry $0A, DAC4SCRATCH, dpcm ; $84 - Scratch
DAC_Entry $1D, DAC5TIMPANI, dpcm ; $85 - Timpani
DAC_Entry $0C, DAC6TOM, dpcm ; $86 - Tom
DAC_Entry $1D, DAC7BONGO, dpcm ; $87 - Bongo
DAC_Entry $14, DAC5TIMPANI, dpcm ; $88 - Hi-Timpani
DAC_Entry $17, DAC5TIMPANI, dpcm ; $89 - Mid-Timpani
DAC_Entry $1E, DAC5TIMPANI, dpcm ; $8A - Low-Timpani
DAC_Entry $1F, DAC5TIMPANI, dpcm ; $8B - Floor-Timpani
DAC_Entry $04, DAC6TOM, dpcm ; $8C - Hi-Tom
DAC_Entry $07, DAC6TOM, dpcm ; $8D - Mid-Tom
DAC_Entry $0A, DAC6TOM, dpcm ; $8E - Low-Tom
DAC_Entry $FF, DAC6TOM, dpcm ; $8F - Floor-Tom
DAC_Entry $0A, DAC7BONGO, dpcm ; $90 - Hi-Bongo
DAC_Entry $0D, DAC7BONGO, dpcm ; $91 - Mid-Bongo
DAC_Entry $14, DAC7BONGO, dpcm ; $92 - Low-Bongo
DAC_Entry $FF, DAC7BONGO, dpcm ; $93 - Floor-Bongo
Hang on, why are the floor entries $FF? The most likely answer is that the floor entries borrow the tempos of the default tom and bongo entries.
DAC_Entry $0C, DAC6TOM, dpcm ; $86 - Tom
DAC_Entry $1D, DAC7BONGO, dpcm ; $87 - Bongo
These ones.
In any case, they sound better than $FF so let's replace them with those.
DAC_Entry $19, DAC1KICK, dpcm ; $81 - Kick
DAC_Entry $04, DAC2SNARE, dpcm ; $82 - Snare
DAC_Entry $08, DAC3CLAP, dpcm ; $83 - Clap
DAC_Entry $0A, DAC4SCRATCH, dpcm ; $84 - Scratch
DAC_Entry $1D, DAC5TIMPANI, dpcm ; $85 - Timpani
DAC_Entry $0C, DAC6TOM, dpcm ; $86 - Tom
DAC_Entry $1D, DAC7BONGO, dpcm ; $87 - Bongo
DAC_Entry $14, DAC5TIMPANI, dpcm ; $88 - Hi-Timpani
DAC_Entry $17, DAC5TIMPANI, dpcm ; $89 - Mid-Timpani
DAC_Entry $1E, DAC5TIMPANI, dpcm ; $8A - Low-Timpani
DAC_Entry $1F, DAC5TIMPANI, dpcm ; $8B - Floor-Timpani
DAC_Entry $04, DAC6TOM, dpcm ; $8C - Hi-Tom
DAC_Entry $07, DAC6TOM, dpcm ; $8D - Mid-Tom
DAC_Entry $0A, DAC6TOM, dpcm ; $8E - Low-Tom
DAC_Entry $0C, DAC6TOM, dpcm ; $8F - Floor-Tom
DAC_Entry $0A, DAC7BONGO, dpcm ; $90 - Hi-Bongo
DAC_Entry $0D, DAC7BONGO, dpcm ; $91 - Mid-Bongo
DAC_Entry $14, DAC7BONGO, dpcm ; $92 - Low-Bongo
DAC_Entry $1D, DAC7BONGO, dpcm ; $93 - Floor-Bongo
With that done, we can remove the pitch-shifting code.
loc_71C88:
move.l a4,4(a5)
btst #2,(a5)
bne.s locret_71CAA
moveq #0,d0
move.b $10(a5),d0
cmpi.b #$80,d0
beq.s locret_71CAA
cmp.b #0,($FFFFFF3A).w
bgt.s locret_71CAA
cmp.b #$8C,d0
bge.s loc_71CAC
move.b d0,($A01FFF).l
locret_71CAA:
rts
Our problem stems from loc_71C88, seen here. It checks for a DAC value above $8C, and if so, branches to a subroutine which handles each instrument and pitch. This isn't the first we've seen of this system: A smaller version can be found in Sonic 1, though it only handles the timpani. Anyway, this is now redundant, and soon, it will become a hindrance, so we'd best remove it. We shall begin by removing the branch, also, it might be worth removing the one above it too, it check an unused RAM address that's never written to, it's useless. You should be left with this:
loc_71C88:
move.l a4,4(a5)
btst #2,(a5)
bne.s locret_71CAA
moveq #0,d0
move.b $10(a5),d0
cmpi.b #$80,d0
beq.s locret_71CAA
move.b d0,($A01FFF).l
locret_71CAA:
rts
Now to finally be rid of this code. Starting with
loc_71CAC, we shall remove the code before reaching its end at
sub_71CCA.
Find and delete this code:
loc_71CAC:
cmpi.b #$8C,d0
beq.w Tom_71CAC
cmpi.b #$8D,d0
beq.w Tom_71CAC
cmpi.b #$8E,d0
beq.w Tom_71CAC
cmpi.b #$8F,d0
beq.w Bongo_71CAC
cmpi.b #$90,d0
beq.w Bongo_71CAC
cmpi.b #$91,d0
beq.w Bongo_71CAC
move.l d0,-(sp)
move.b #$85,d0
move.l (sp)+,d0
subi.b #$88,d0
move.b byte_71CC4(pc,d0.w),d0
move.b d0,($A00224).l
move.b #$85,($A01FFF).l
rts
Tom_71CAC:
move.l d0,-(sp)
move.b #$86,d0
move.l (sp)+,d0
subi.b #$8C,d0
move.b Tom_71CC4(pc,d0.w),d0
move.b d0,($A0022C).l
move.b #$86,($A01FFF).l
rts
Bongo_71CAC:
move.l d0,-(sp)
move.b #$87,d0
move.l (sp)+,d0
subi.b #$8F,d0
move.b Bongo_71CC4(pc,d0.w),d0
move.b d0,($A00234).l
move.b #$87,($A01FFF).l
rts
NoBend_71CAC:
move.b d0,d1
subi.b #7,d1
move.b d1,d0
move.b d0,($A01FFF).l
bra.w locret_71CAA
; End of function sub_71C4E
; ===========================================================================
byte_71CC4: dc.b $14, $17, $1E, $1F
Tom_71CC4: dc.b $4, $7, $A, $FF
Bongo_71CC4: dc.b $A, $D, $14, $FF
With that finally eliminated, we can move on to Vladikcomper's optimisations!