EDIT: The files upon which the attached test files were based are Copyright of Broadsoft (2004).
Many years ago, Dr Andrew Broad created a conversion of Jet Set Willy to the Manic Miner game engine, and conversely, a conversion of Manic Miner to the Jet Set Willy game engine. They were released as 'Easter eggs' in the 'Party Willy' box set.
This topic concerns itself purely with the title-screen tunes in both conversions, which are 'remixes of the original tunes for the new game engine'. I have analysed the title tunes, and created updated versions of each conversion with the aim of finessing these 'remixes' - hopefully capturing the spirit of what Andrew was originally trying to achieve. And since Easter is upon us, and everyone presumably has lots of spare time on their hands at the moment, I thought I'd share them with you.
The MM->JSW conversion features a rendition of MM's title tune 'The Blue Danube', complete with the 'octave-shifting' modulation that you normally hear in the JSW theme tune. Thus Andrew managed to capture rather well the atmosphere of the JSW title screen in the MM->JSW conversion. However, I would say there are a couple of flaws in that rendition:
(1) There were a few notes [directly taken from Matthew Smith's original score of the tune] which dropped below Middle C, causing erratic, very high-pitched notes to play. This happens because if you have a value higher than #80 and try to double the pitch (via the RL E command in the 'Play the theme tune' routine), then the highest bit drops off the end of the byte. This is a flaw in Matthew's title tune routine; it should really detect the Carry Flag being set in such circumstances and adjust the note-playing loop accordingly. So that's what I've done in the attached update of the MM->JSW conversion, by inserting a four-byte intervention into that routine. Now if the RL E command sets the Carry Flag, the value in E is simply overwritten with #00. (This is a fixed pitch value - corresponding with Bottom C - but it isn't too far off being an octave below the problematic notes in question, because they all happen to hold a pitch value of #88 - Middle B. However, the effectiveness of this crude patch would probably break down if you tried to play notes much lower down the scale.)
(2) Andrew's JSW-style rendition of 'The Blue Danube' also seemed to finish rather hurriedly. In original MM, some of the notes towards the end of the tune are played for twice the duration of the rest of the tune's notes. However, it isn't possible to assign notes of differing lengths for the title tune in the JSW game engine. But since there were a few spare bytes available at the end of the score*, in the attached update to MM->JSW I have taken the opportunity to insert a couple of additional notes (so that there are two consecutive notes of identical pitch, where in MM there would be a single note of that pitch set to play for twice the duration), in order to keep the tune going at a constant pace until the end.
[* Arising from the fact that JSW's Moonlight Sonata is 99 bytes long, whereas MM's Blue Danube is 95x3 bytes and so Andrew had inserted 95 pitch values into the regular 'JSW title tune' area of memory.]
Andrew's JSW->MM conversion plays a pure tone version of JSW's title tune 'Moonlight Sonata'. It achieves this by making each pair of notes consist of one value (x) followed by a note with exactly double the pitch value (2x). This seems to turn off** the 'dischordancy' feature of the tune that you normally hear. i.e. when 'The Blue Danube' is playing in the original MM.
[** Incidentally, looking at the Manic Miner title tune-playing routine, I can see why that would have the effect of generating pure tones, although I can't recall this ever being discussed - either here or on the Yahoo! Group - as an available technique to employ when creating MM title-screen tunes?]
However, I think an opportunity was missed there to have 'Moonlight Sonata' playing in a dischordant manner, in order to give a more 'Manic Miner'-like flavour to the title-screen tune of the JSW->MM conversion.
Furthermore, Andrew's rendition of 'Moonlight Sonata' in the MM engine cuts off a few notes early, because the original MM title tune consists of 95 pairs of notes (i.e. 95 sets of three bytes, one determining length and two for pitch), whereas the JSW tune is 99 bytes long (each byte corresponding to a note which is played at a higher pitch for half of its duration, before the pitch is doubled for the second half of the note). So converting the JSW tune's score into a 99x3 byte tune wouldn't fit into the space in memory where the MM theme tune is stored.
Finally, all the notes in Andrew's 'Moonlight Sonata Manic Miner Remix' are of exactly the same duration. This is consistent with the original title tune in JSW, where the length of each note is the same, but it does mean that another available feature of the MM game engine's tune-playing routine (the ability to play notes of different length) isn't taken advantage of.
...So, after reflecting on all of the above...
Please find attached an updated version of JSW->MM [which, as per Andrew's original version, is in three parts, because there are 60 playable rooms in JSW and the MM game engine can only handle 20 caverns].
Hopefully you will agree that this is a much more 'Manic Miner-esque' rendition of 'Moonlight Sonata', befitting of this JSW->MM conversion!
I also took the opportunity of extending the title tune to its full, original length (99 notes, or rather 99 sets of three bytes now). That ate into the space in memory where the in-game tune is stored, and so in order to compensate for that, I replaced what was left of 'If I were a Rich Man' with Andrew Broad's 'remix' of 'Hall of the Mountain King'*** from the SE of his game 'Manic Miner 4'. That rendition repeats 32 identical sets of notes twice, so I tweaked a command in the tune-playing part of the Main Loop so that the in-game tune is just 32 bytes long.
[*** I confess that it's not ideal not to have '...Rich Man' playing in a variant of JSW, but there is a history of '...Mountain King' being used instead in some releases of JSW (back in the day when it was thought that an 8-bit rendition of a tune from a West End Musical might constitute some outrageous breach of copyright!) And it was a quick and easy fix; I didn't want to carry out major code-shuffling to fit both the extended title tune and a 64-byte in-game tune into the available space, but nor did I want to leave a random half-tune playing once the game starts up.]
One last point of interest is that the final, sustained note of 'Moonlight Sonata' in the attached file has a duration of #00 [i.e. the value of the first of the three bytes which define the parameters of the last note]. This is the longest possible duration of a note in the game engine - it is interpreted as a value of #100 (256 in decimal) to define the length of the note-playing loop, rather than a value of zero, because the register to which it is copied is decremented (to #FF / 255 in decimal) before a check is made of whether a zero value has been reached yet.