guddler said:Thats truly awful! I'm not surprised people want to replace it![]()
The master lookup table (32 little endian pointers) for all the musics and sound effects of 1942 is at $007a in the sound rom. The CPU passes a sound index value between 0 and $1f to the sound CPU through the latch @ $6000. The sound CPU polls address $6000 every interrupt to see if the main cpu wants it to play a tune/sound effect. If it does then the sound CPU jumps to the correct sound handler via an rst $30 call at $0079.
The addresses of the 32 sound effect/tune handlers are as follows :-
0 - $00ba (seems to be used to kill all 3 channels of the AY chip)
1 - $045b (sound effect)
2 - $0464 (sound effect)
3 - $046c (sound effect)
4 - $0474 (sound effect)
5 - $047c (sound effect)
6 - $0484 (sound effect)
7 - $048c (sound effect/maybe done by the AY?)
8 - $0494 (AY tune)
9 - $049c (sound effect)
A - $04a4 (sound effect)
B - $04ac (seems to be used to kill a single channel of the AY chip)
C - $04b5 (sound effect)
D - $04bd (sound effect)
E - $04c5 (sound effect)
F - $04cd (seems to be used to kill a single channel of the AY chip)
10 - $00d3 (probably used to kill analog sounds)
11 - $1076 (tune)
12 - $1115 (AY tune)
13 - $11c5 (AY tune)
14 - $134d (AY tune)
15 - $14a9 (AY tune)
16 - $140f (AY tune)
17 - $18a6 (AY tune)
18 - $1756 (AY tune)
19 - $1820 (AY tune)
1A - $15f6 (AY tune)
1B - $04d6 (AY tune)
1C - $00d3 (as above)
1D - $00d3 (as above)
1E - $00d3 (as above
1F - $1034 (AY tune)
So, now you know the addresses of the various sound handlers it's simply a case of studying the routines and the AY tune format and you're halfway there.![]()
Luckily there's about 2.6Kb of unused rom space in the sound rom, plenty enough to insert a new tune. All you have to do then is adjust a pointer to point to the new tune data and you're done.
grobda said:The vectrex uses the same sound chip (28 pin ay3912 version but functionally identical) and has a few homebrew carts that are just music rips from other games - sound pretty similar to Atari ST chip tunes (although the ST ym2149F chip has a couple of extra features) so you might even be able to use some ST chiptunes.
cmonkey said:So, how are you getting on with replacing the God-awful main tune in 1942 then?
I had a spare half hour to look at this last night and figured out a few things about the tune format. The header of each tune is a byte value for the number of tracks and then n pointers to the track data (where n = number of tracks from the first byte of the tune header).
So, the header for the in-game theme tune (if that's what you can call it!) at $107f looks like this :-
03 8610 0711 0E11
i.e. 3 tracks and then 3 little endian pointers ($1086, $1107 and $110e) to the track data.
I haven't figured out all the track data yet but here's what I have figured out :-
$5f = set volume for this track (the byte following this is the requested volume (from $0 to $f))
$3f = set note duration (the byte following this is the duration (higher value = longer duration)
$1f = set base note value from a lookup table of note values @ $00f4 (this lookup table contains the note frequencies of 96 individual notes in little endian word format) (the byte following $1f is the offset into this note table to use as the base note - you'd use this to set the key of the tune you want to compose)
Then after you've set the volume, note duration and note table base offset you start laying down a few notes in byte format, like this :-
Upper nibble of a byte = envelope type (see the AY-3-8910 datasheet for the various envelope types)
Lower nibble of a byte = note pitch (this is added to the note table base offset that you set earlier)
So, a value of $81 would use envelope type 8 and note pitch 1 (added to your base offset).
You can also loop within each track by using the $7f command followed by a pointer to where you want to loop back to.
So, armed with this amazing amount of knowledge you can do simply awesome things like this :-
Which sounds considerably better than the sh*te effort that Capcom pushed the game out the door with.
To insert this amazing new tune into the sound rom simply overwrite the bytes from $2000 with this data :-
01 03 20 5F 0A 3F 10 1F 24 81 83 85 86 88 8A 8C 8D 7F 09 20 FF
And then adjust the pointer to the main in-game tune @ $107a from :-
7F 10 (little endian $107f)
to
00 20 (little endian $2000)
cmonkey said:So, how are you getting on with replacing the God-awful main tune in 1942 then?
cmonkey said:Lives are at $e101
Score is the 6 bytes from $e048 to $e04d
Armed with that knowledge it should be simple for someone (not me, too busy!) to reverse the extra lives logic in the game engine and figure out the bug.
minwah said:Spent a good few hours on this tonight and have a tune at least. Needs some more work and only one channel so far. Getting the timing right is tough!