IRF Posted March 4, 2017 Author Report Share Posted March 4, 2017 (edited) Here's another quirky tune-related effect: to make the in-game tune play backwards, insert a CPL command immediately prior to the AND #7E command at #8B47 in the Main Loop. This requires a bit of consolidation in order to insert the extra byte, but I've just noticed a one-byte efficiency that can be achieved in this part of the JSW code. [Which would also be useful in implementing the effect of slowing the music down to half speed by inserting an extra RRCA instruction, as detailed in the second post in this thread.] The efficiency is as follows: At #8B4B, there is a LD D, #00 command, which takes up two bytes. But at #8B3C, there is a single-byte XOR A command which sets A to zero. So if a single-byte LD D, A command is inserted before the value of A gets altered from zero, then one byte can be saved overall - thereby allowing the above to be implemented. You can test this out by making the following quick alterations to the hex code of Dr Andrew Broad's game ylliW teS teJ (a.k.a. MIRRORJSW): - Clear the LD D, #00 from #8B4B-4C; - Shift the code from #8B47-4A along by two bytes, to occupy #8B49-4C; - At #8B48, insert a CPL instruction (opcode '2F'); - Shift the code from #8B40-46 along by one byte, to occupy #8B41-47; - At #8B40, insert a LD D, A command (opcode '57'). In the unedited version of MirrorJSW, the in-game tune already plays backwards - but I believe that Andrew achieved this by manually physically inverting the positions of all the 'notes' in the range of addresses #865F-#869E. (i.e. the value '56' at #865F in the original JSW is located at #869E in MirrorJSW, whilst the value '40' at #869E in original JSW occupies #865F in MirrorJSW'; the value '60' which was originally at #8660 is shifted to #869D in the mirrored game, etc.) By making the above changes to the Main Loop (which only require 14 POKES to achieve), you will find that the in-game tune gets reverted back to being played 'forwards' (with all the notes in the correct order) - thus proving the effectiveness of the solution which I have come up with for 'reversing' the tune. Edited March 4, 2017 by IRF jetsetdanny 1 Quote Link to comment Share on other sites More sharing options...
IRF Posted March 4, 2017 Author Report Share Posted March 4, 2017 (edited) P.S. Reversing the order of the notes for the Title Screen tune can be achieved by just three POKES: - At #88A9-AA, insert '5D 86', to point the 'Title Screen' routine to the final note in the first instance; - At #96C6, replace the INC HL (opcode '23') with a DEC HL (opcode '2B') command, to make the 'Play the theme tune' subroutine select the notes in reverse order. However, this means that there is no longer a terminating 'FF' byte at the end (formerly the beginning) of the tune, so the program plays random notes (code interpreted as data) for some time, until it eventually chances upon a value 'FF' and proceeds to the Scrolling Message. (The WRITETYPER look-up table immediately precedes the Title Screen tune data in the code, so it isn't easy to insert the 'FF' marker here.) Again, you can test out the above by applying it to Andrew Broad's 'ylliW teS teJ', in which the order of the Title Screen tune notes have all been manually reversed (actually, the process might have been done automatically via software; perhaps "physically reversed" would be a better turn of phrase?) Applying the above code changes to the mirrored game file causes the notes to be played in the correct (original) order. ****** P.P.S. It would be fun to edit the code which normally generates the 'falling pitch' sound effect during the Scrolling Message, in such a way that the sound rises in pitch instead as the message progresses! I haven't investigated that in detail yet, but first thoughts are that a CPL or a NEG command could be inserted at or around #88DE, with some modification to the ADD A, #32 thereabouts (changing it to a SUB A and/or changing the value of the operand). EDIT: It can be done by adding a CPL ('2F'), immediately prior to the ADD at #88DE, and then making the latter an ADD A, #52 ('C6 52'). One additional byte needs to be inserted, which can be achieved by replacing the CP #01 at #88EA-EB with a DEC A ('3D') and shuffling down the intervening 10 bytes (12 bytes if you include the ADD command). It's quite a cool effect; strangely familiar yet quite different!! Edited March 4, 2017 by IRF jetsetdanny and Spider 2 Quote Link to comment Share on other sites More sharing options...
jetsetdanny Posted March 6, 2017 Report Share Posted March 6, 2017 Nice tricks, Ian! :) Such modifications can serve to enhance future projects, just to give them a familiar yet distinct flavour. IRF 1 Quote Link to comment Share on other sites More sharing options...
IRF Posted March 6, 2017 Author Report Share Posted March 6, 2017 Nice tricks, Ian! :) Such modifications can serve to enhance future projects, just to give them a familiar yet distinct flavour. Or it could be implemented on a 'per room' basis - I think The Nightmare Room in 'WRN' might feature a backwards tune (to match Willy's backwards Flying Pig sprite)! Spider 1 Quote Link to comment Share on other sites More sharing options...
jetsetdanny Posted September 24, 2022 Report Share Posted September 24, 2022 On the first page of this topic instructions are giving on how to modify the code to have a 64-byte-long in-game tune play twice as fast or half as fast. Instructions are also given how to have a 32-byte-long in-game tune and a 128-byte long in-game tune (playing at regular speed). They all involve modifing the value of #8B48 (i.e. the operand of an AND command) and a modification of the following RRCA instruction in one way or another. Would there be a way to: 1. make a 32-byte-long tune play half as fast; 2. make a 128-byte-long tune play half as fast? Quote Link to comment Share on other sites More sharing options...
jetsetdanny Posted September 25, 2022 Report Share Posted September 25, 2022 To answer my own question, I've solved the problem, although probably in a different way than Ian would have done. I used the timer (tick counter) to increase the music note index only every other tick. Here it is (ignore the NOPped addresses, I can't be bothered to consolidate the code right now): 8B3C 3A CB 85 LD A,(#85CB) pick up the timer 8B3F E6 02 AND #02 do it every other tick 8B41 28 0A JR Z,#8B4C jump over the code that increments the music note index 8B43 00 00 two bytes are NOPped out 8B45 3A E1 85 LD A,(#85E1) pick up the music note index 8B48 3C INC A increment it 8B49 32 E1 85 LD (#85E1),A 8B4C 00 one NOPped out byte 8B4D 3A E1 85 LD A,(#85E1) pick up the music note index and then the code continues as usual. In other words, the music note index is only incremented every other tick of the timer, which produces the effect of the in-game tune playing at half speed. As far as I can tell by listening - and also from thinking about the way both solutions work - I believe this effect is exactly the same (the player listens to a tune playing in exactly the same way) as the solution invented by Ian, which involves manipulating the value of #8B48 (i.e. the operand of an AND command). Please correct me if I'm wrong. It requires more bytes to apply, but it also has a certain possible advantage - it can be used to play a tune of ANY length at half speed, even a 256-byte-long tune Ian applied in "Jet Set Mini". Again, that's my theoretical understanding, please correct me if I'm wrong. While I was at it, I also came up with a similar solution, where every other tick the program jumps to #8B70, omitting the playing of the in-game tune altogether. This produces a choppy playback, a constant staccato, so to speak. While I wouldn't recommend setting the in-game tune to play in this way everywhere, the effect may be very suitable for some rooms... Spider and IRF 1 1 Quote Link to comment Share on other sites More sharing options...
Hamish Posted October 17, 2023 Report Share Posted October 17, 2023 I just posted the following at "Unusual Pokes", but just noticed this forum which might be a more appropriate place to ask. Having now seen the depth into which you guys have gone exploring the in-game music, though, I am wonder whether I must have dreamed the whole thing. Just in case... Hello everyone, In my youth, I bought a second-hand ZX Spectrum with a cassette tape on which a POKEd version of JSW had been saved. The POKEs appeared to have at least three effects: Remove copy protection Infinite lives Easter egg in-game music (replacing Hall of the Mountain King) (...possibly also some of the official bugfixes?) I can still remember the music, or a close approximation. Here it is in ABC notation: M:3/4 E |: A2 B | c2 d | e2 f | e d c | d2 e | d c B | c2 d | c B E A2 B | c2 d | e2 f | e d c | d2 e | d c E | A3 | -A2 A a2 g | f2 e | f2 g | f e d | e2 f | e d c | d2 e | d c A a2 g | f2 e | f2 g | f e d | e d c | d c B | c B A | B A ^G A B c | B c d | c d e | d e f ^G A B | A B c | B c d | c d e a g f | g f e | f e d | e d c d c B | c B A | E3 | -E2 E :| You can easily hear this by pasting it at https://abc.rectanglered.com/. Alternatively, I have attached a MIDI file to this post. I remember the sum total of bytes POKEd being way fewer than the number of notes above, so I figured at the time that the music must be an alternative soundtrack already hidden within the game. I have tried searching for this melody on various services, without success. Can anyone shed any light on this? Might it be an original composition by Matthew Smith? Many thanks, Hamish query.mid Spider and IRF 2 Quote Link to comment Share on other sites More sharing options...
IRF Posted October 17, 2023 Author Report Share Posted October 17, 2023 Hmmm... It seems vaguely familiar but I'm not sure what it is. Spider 1 Quote Link to comment Share on other sites More sharing options...
DigitalDuck Posted October 17, 2023 Report Share Posted October 17, 2023 Jet Set Willy Online also had this music, I don't know where it was taken from though. Spider and Hamish 2 Quote Link to comment Share on other sites More sharing options...
Spider Posted October 17, 2023 Report Share Posted October 17, 2023 7 hours ago, Hamish said: I just posted the following at "Unusual Pokes", but just noticed this forum which might be a more appropriate place to ask. Welcome. 🙂 I removed that post as its (as you say) better suited to this area. 7 hours ago, Hamish said: The POKEs appeared to have at least three effects: Remove copy protection Infinite lives Easter egg in-game music (replacing Hall of the Mountain King) (...possibly also some of the official bugfixes?) There's many 'unofficial' versions and two in-game tunes in the official versions. "If I was a rich man" and "In the hall of the mountain king" For a long time I had assumed the latter was an earlier release then replaced with the former, however from what I do recall it may of been (the music) under copyright still at that point in time so the "in-game tune switched to Manic Miner" (one way of putting it) Indeed my original 84 tape has "Rich Man" and one of the ones I aquired has "Mountain King" , the last official release on the "Sold A Million" tape has the keycode bypassed and the four official bug fixes applied and uses the "Mountain King" in-game tune. This version is very easy to identify as it uses Speedlock 1 to load in. I'm not up on my music so others will be able to assist you better I'm sure. 🙂 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.