Resource centre for ZX Spectrum games
using Manic Miner and Jet Set Willy game engines
Archive of the
Manic Miner & Jet Set Willy Yahoo! Group
messages
|
|
||
|
|
Message: 7204
Author: ian.rushforth
Date: 18/06/2018
Subject: Re: Manic Miner: Format of title-screen tune
Andrew wrote:
>The unit duration will determine the speed of the tune, and you have to bear in mind that the maximum
> duration is 255, so if, for example, your tune includes quadruple-length notes, you will either have to choose > a unit duration of 63 or less (63*4 = 252 but 64*4 = 256), or split long notes into two consecutive notes.
Looking at the code, it would appear that you can have a note of length 256, by selecting a duration byte value of 0.
There are two loops in the routine which plays the title-screen tune; an outer loop and an inner loop.
There is a check for a terminator byte value of 255 (#FF) at the start of the outer loop, which would not be triggered by a duration byte value of 0. Then the duration is fed into the C register, which is then incremented 256 times by the inner loop, until it once again reaches zero to signify that it's time to move onto the next pair of notes.
The relative jump at #930D causes the inner loop to repeat if the Zero Flag is not set, and the first incrementation of C takes it from 0 to 255 without setting the Zero Flag. So C passes through a value of 255 after the first execution of the inner loop, but that does not get checked by the command at the start of the outer loop.
In summary, I believe that you can select a unit duration of 64 and then have quadruple-length notes of duration 256.
