Reading CDDA sound levels

Registers REG_CDDALEFTL ($FF0188) and REG_CDDARIGHTL ($FF018A) hold the values of the currently streamed CD audio data, in a reversed 16bit 2's complement format suited for the LC78815 DAC (Sample rate =~ 100kHz ?).

The CD2 BIOS uses the following code to reverse the bits:

The CD2 BIOS reads both registers multiple times during each frame (every 16 raster lines, by using the raster interrupt) to get an average value. The displayed vu-meters use a double buffer to avoid getting updated with the average of only the first few register reads (those that were made before the vu-meters were actually drawn to the screen).

Demo
This does NOT work on current emulators.

Uses:
 * Raster line interrupts
 * Sprites (shrink and displacement)
 * Fix (frame counter)
 * Palettes

Source for AS and iso image:

[Youtube video]