Fixed various bugs in the wave upload API

There were some bugs in the previously untested parts of the wave
uploading API related to the a2_WaveNew(), a2_WaveWrite() and
a2_WavePrepare() calls, which are used when uploading waves in
fragments.

(The built-in waves are uploaded using the mechanisms behind the
a2_WaveUpload() call, which is why these bugs haven't been observed
until now.)
wtosc now checks the length of selected waves

The wtosc wavetable oscillator unit now checks that it can actually
handle the length of a wave when the 'w' register is written.

(There is currently a limit slightly short of 16 Msamples due to
the 24:8 fixed point phase accumulator, and the loop/stop logic
requiring that the accumulator can run slightly beyond the end of
the wave without wrapping.)

Fixes #31.