Pattern Sequence

(Offset 470 - 15 samples; Offset 950 - 31 samples)

A module is divided into a number of patterns. These patterns can be played
in any order and any number of times - it is in this area that you specify
what gets played when. It has the following format.

┌──────────┬─────────┬─────────┬─────────┬─────────┬─ ∙∙∙ ─┬─────────┐
│ Offset │ 0 │ 1 │ 2 │ 3 │ │ 130 │
├──────────┼─────────┼─────────┼─────────┼─────────┼─ ∙∙∙ ─┼─────────┤
│ Contents │ Length │ Repeat │ 1st Pat │ 2nd Pat │ │ Last │
└──────────┴─────────┴─────────┴─────────┴─────────┴─ ∙∙∙ ─┴─────────┛

The length is the number of patterns in the sequence.

Repeat is the offset in the sequence from which the module will begin
playing when it reaches the end of the sequence. A value of zero means to
repeat from the 1st pattern. A value of 7F hex (possibly 78) means that
the module does not repeat.

The next 128 bytes specify which patterns should be played when (1 byte for
each pattern). A value of zero refers to the first pattern defined, etc.

For example, the following sequence of bytes:

07 7F 01 02 02 00 03 04 04 00 00 .......
│ │
│ └─ don't repeat
└── the sequence length

will play pattern number 1 (the second pattern defined), then play pattern
number 2 twice, then pattern zero (the first pattern defined), then pattern
3, and finally play pattern number 4 twice - a total of 7 patterns. Notice
that all positions past the end of the sequence should be set to zero.