The Church Modes
The musical system of the Middle Ages involved the usage of the Church Modes. They have been developed over time, and at their 'peek' there were eight discernable church modes existing. A mode can be easily compared to our modern definition of scales, although there are some differences. Let's start from the start.
A church mode contained eight notes within an octave range, separated by half or whole steps (see picture below). A given mode was usually ending on the so-called finalis note (depicted by arrows in the picture below). The finalis was the bottom note of the mode, or as we would say today, the root note of a scale. The church modes were also chategorized by numbers, and grouped in pairs: authentic, the odd-numbered, and plagal, the even-numbered. Notice that the plagal modes have the same finalis note as their corresponding authentic modes, but their range starts a fourth lower. Additionaly, there was also another note of a special importance, called the confinalis (depicted by underlines in the picture below). This note was on a fifth or sixth interval up from the finalis note in an authentic mode. In the plagal modes, the confinalis was placed a third below the confinalis of the corresponding authentic mode - unless it fell on a B, in which case it was moved up to C (compare Mixolydian and Hypomyxolydian mode for example). The confinalis could function as a second tonal center (kind-of modulation device back then).
Another thing separated the authentic and the plagal modes. It was the range of the notes. Notice that in the authentic modes, all the other notes lie above above the finalis note, but in the plagal modes the finalis is more or less in the middle of the range of the notes.
The difference between any of the modes is, as you may already have discovered, the interval pattern between the different notes of a mode. For example, the dorian mode has the W-H-W-W-W-H-W pattern (where W is a whole step, and H is a half step). Sometimes, this pattern could be broken by flattening the note above the confinalis note - if the melody was moving towards the confinalis from the note above. And that's it for accidentals - no more flatted or sharpened notes were used. Of course, the modes on the picture below could be transposed, and so the accidentals were used to maintain the correct intervals between the notes, exactly as in our modern music.
In practice, modes were used in different manners. One mode could build up an entire composition, but it could also be combined with a corresponding mode. Some compositions may also have used combinations of different non-corresponding modes. Another characteristic is that a melody could use a small range of a mode, but it also could make usage of the entire range of notes of the authetic and plagal mode.
As you look at the picture below, you may think it's not complete. If you are familiar with the modes as they are taught today, you may have noticed the absence of ionian, aeolian and locrian modes. This is because these modes were first classified in 1547, except for the locrian mode which was characterized even later on. This system of classifying modes was something that musical theorists did to describe what was already practiced, i.e. the modes existed and were used long before the theorists attempted to classify what was going on in the music.