IRF Posted April 11, 2020 Report Share Posted April 11, 2020 (edited) 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. The Blue Danube in JSW style.TAP Moonlight Sonata in MM style_1.TAP Moonlight Sonata in MM style_2.TAP Moonlight Sonata in MM style_3.TAP Edited April 28, 2020 by IRF Spider and jetsetdanny 2 Quote Link to comment Share on other sites More sharing options...
jetsetdanny Posted April 13, 2020 Report Share Posted April 13, 2020 Interesting experiments, Ian, thanks for them! :) Spider and IRF 2 Quote Link to comment Share on other sites More sharing options...
IRF Posted April 21, 2020 Author Report Share Posted April 21, 2020 (edited) 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?] Explanation for the above: say you had a set of three pitch values for a MM title tune note of #32 [the duration], #40 and #80 [pair of pitch values]. Those values are assigned to the C, D and E registers respectively. The inner note playing loop decrements D and E once for each pass through the loop, and when either of those reaches zero then an XOR #18 command is executed - meaning that the speaker state will be toggled at the start of the next pass through the inner loop - before D or E is reset back to its original value for this note. (The inner loop is controlled by the B register, which is set to #00 at the start, and that effectively means #100 iterations since B is decremented to #FF before a check for a zero value is made. The outer loop decrements C to repeat all of the above C times, meaning that the duration of the note is C x #100 iterations of the inner loop [#3200 iterations in the above example].) But if you have two pitch values which are exactly separated by a factor of 2, as in the above example, then the following happens: On the #40th iteration of the inner loop, D has reached zero so an XOR #18 activates the speaker. On the #80th iteration of the inner loop, D and E both reach zero so XOR #18 is executed twice; those operations cancel each other out*, so the speaker is not activated. On the #C0th iteration, D has reached zero again so XOR #18 activates the speaker. On the #100th iteration, D and E both reach zero so XOR #18 is executed twice; those operations cancel each other out, so the speaker is not activated. B has now reached zero which brings an end to the inner loop for now. Then C is decremented and the whole of the above is repeated, until C reaches zero, bringing the outer loop to an end. (Then there is a check for whether the ENTER key is being pressed to start the game - if not, then the next note will be played [next set of three note definition bytes will be considered].) If you look at the above pattern, you can see that - except for in the very first instance shortly after the start of the loop - the speaker diaphragm is only actually activated once every #80 passes through the inner loop. So the note that is played has a pitch of #80, corresponding to the lower of the two pitches represented by the note data (i.e. the numerically higher of the two pitch values, since a smaller number yields a higher pitch and vice versa). (* Applying XOR #18 to the A register, and then applying another XOR #18 to A, is effectively the same as applying XOR #00, which has no effect on the value in A.) Edited June 18, 2020 by IRF jetsetdanny 1 Quote Link to comment Share on other sites More sharing options...
IRF Posted April 21, 2020 Author Report Share Posted April 21, 2020 (edited) #40 and #80 [pair of pitch values] So the note that is played has a pitch of #80, corresponding to the lower of the two pitches represented by the note data (i.e. the numerically higher of the two pitch values, since a smaller number yields a higher pitch). P.S. If you wanted a pure tone of #40, then you would need to use a pair of pitch values #40 and #20. (I don't think it would matter in which order the two values are stored in the data, as long as one is half the value of t'other.) In terms of Andrew's original JSW->MM conversion, the upshot is that the pure tone version of 'Moonlight Sonata' plays the lower pitched half of each note (as if the doubling of pitch that you get in the JSW engine was applied immediately, instead of halfway through each note). Rather than only playing the higher pitched half of each note (which is what you get if you just NOP out the RL E command from #96BC in the JSW game engine). Edited April 30, 2020 by IRF jetsetdanny and Spider 2 Quote Link to comment Share on other sites More sharing options...
IRF Posted April 30, 2020 Author Report Share Posted April 30, 2020 (edited) For 'compare and contrast' purposes, Dr Broad's original versions of the JSW->MM and MM->JSW conversions are available within this Zip folder: https://jswcentral.org/download/02-jsw48/a/oth/party_willy.zip Edited April 30, 2020 by IRF Spider and jetsetdanny 2 Quote Link to comment Share on other sites More sharing options...
IRF Posted June 18, 2020 Author Report Share Posted June 18, 2020 (edited) Making full use of Matthew's original tune data:The original Manic Miner title screen tune consists of pairs of note pitch values (alongside a duration byte). In most cases, the pitch values just differ by a value of 1, which yields a 'slightly dischordant' note of around that pitch. But there are a few pairs of pitch values which differ by a significant amount, to yield a 'chord' of two distinct notes played together. In Andrew Broad's MM->JSW conversion (which I only subjected to minor tweaks in the file that I previously uploaded, unlike my more substantial intervention with the JSW->MM conversion's tune), Andrew took all of the first pitch values for each pair of notes, and put them through the 'octave-shift modulation' effect from the JSW game engine. In the attached file 'The Blue Danube in JSW style - Alternative notes', I have gone through all the notes in the title tune, identified where there is a 'chord' in the original Manic Miner 'Blue Danube' score (pairs of pitch values which differ by a larger value than 1), and used the 'alternative' note pitch value (i.e. the second value in the pair, as listed in the original MM score). For example, the first phrase of the Blue Danube (as originally scored by Matthew, for the MM game engine) is comprised of the following pairs of pitch values (these are in hexadecimal; I have omitted the duration bytes for clarity): 80 81 66 67 56 57 56 57 AB CB 2B 33 2B 33 AB CB 33 40 33 40 AB CB The equivalent data for the rendition of Blue Danube in the JSW engine, as can be heard in Andrew's MM->JSW conversion, consists of a single pitch for each note, as follows: 80 81 66 67 56 57 56 57 AB CB 2B 33 2B 33 AB CB 33 40 33 40 AB CB In the attached 'Alternative notes' file, I used the following values: 80* 81 66 67 56 57 56 57 AB CB 2B 33 2B 33 AB CB 33 40 33 40 AB CB (*In both 'The Blue Danube in JSW style' and 'The Blue Danube in JSW style - Alternative notes' files, I actually used a value '00' for the very first note - Bottom C instead of Middle C - to try and replicate the way in which the tune starts off slowly in original MM. Since it isn't possible to specify notes of different duration in the JSW engine, that seemed the best way to try and achieve a similar effect.) ** It would be good to try and play both title tunes from the two files simultaneously, if that were possible with two emulators running at the same time - you would end up with a title tune that has the character of both the MM and the JSW theme tunes! (i.e. chords punctuating the tune, and the doubling-octave modulation.) The Blue Danube in JSW style - Alternative notes.TAP Edited June 18, 2020 by IRF jetsetdanny, Spider and MtM 2 1 Quote Link to comment Share on other sites More sharing options...
IRF Posted January 5, 2023 Author Report Share Posted January 5, 2023 Random observation from Andrew Broad's Party Willy boxset (Special Edition): the title screen of the laterally-inverted JSW game 'ylliW teS teJ' isn't quite a mirror-imaged version of the original JSW title screen - the entire Impossible Triangle has been vertically shifted* by a single pixel (as well as being laterally inverted). *It's been a while since I noticed this, so I can't recall whether it has been moved upwards or downwards by one pixel? So consider that to be. New Year's trivia question; answers on a postcard please... (P.S. Check out the title screen of the same file from the Original Edition of Party Willy - Andrew evidently had difficulties laterally inverting the triangle at the first attempt!) jetsetdanny 1 Quote Link to comment Share on other sites More sharing options...
IRF Posted January 5, 2023 Author Report Share Posted January 5, 2023 (edited) Whilst I'm on the subject of the Party Willy boxset (Special Edition), the laterally-inverted MM game 'reniM cinaM' lacks a proper fix for the new switch positions in the Kong rooms. If you want to laterally invert the location of a Kong room switch, (or have a switch located at an odd x-coordinate in general), then you have to replace the two instructions at #921E-#9220: INC A AND #FE with these two instructions: NOP OR #01 I had previously included the above fix in a thread in the Contributor Forum, but thought it might be useful to make it more publicly available here. Edited January 5, 2023 by IRF jetsetdanny 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.