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 by IRF, 04 March 2017 - 11:09 PM.