Reading CDDA sound levels: Difference between revisions
Jump to navigation
Jump to search
(Created page with "Registers '''REG_CDDALEFTL''' ($FF0188) and '''REG_CDDARIGHTL''' ($FF01AA) hold the values of the currently streamed CD audio data, in a reversed 16bit 2's complement format suit…") |
mNo edit summary |
||
(11 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
Registers | Registers {{Reg|REG_CDDALEFTL}} and {{Reg|REG_CDDARIGHTL}} hold the values of the currently streamed CD audio data, in a reversed 16bit 2's complement format suited for the [[LC78815]] DAC. They were only used to display the vu-meters in the CD player interface. | ||
The | The CD [[system ROM]] uses the following code to reverse the bits: | ||
< | <syntaxhighlight> | ||
;D1:Input | ;D1:Input, D0:Output | ||
reverse16bits: | reverse16bits: | ||
moveq #16-1,d7 | |||
moveq #0,d0 | moveq #0,d0 | ||
rev: | rev: | ||
lsr #1,d1 | lsr #1,d1 | ||
bcc zerobit | bcc zerobit | ||
bset d7,d0 | bset d7,d0 | ||
zerobit: | zerobit: | ||
dbf d7,rev | dbf d7,rev | ||
</ | </syntaxhighlight> | ||
It reads both registers multiple times during each frame (every 16 raster lines, by using the [[68k interrupts|raster interrupt]]) to get an average value. | |||
==Demo== | |||
[[File:screencap_cddaviz.png|right]] | |||
This does NOT work on current emulators. | |||
[[ | Uses: | ||
*Raster line interrupts | |||
*[[Sprites]] (shrink and displacement) | |||
*[[Fix layer|Fix]] (frame counter) | |||
*[[Palettes]] | |||
Source for AS and iso image: [[File:Vumeter1.zip]] | |||
[[http://www.youtube.com/watch?v=JP5VAypJIYk Youtube video]] | |||
[[Category:Code]] | |||
[[Category:Sound Code]] | |||
[[Category:CD systems]] | [[Category:CD systems]] | ||
Latest revision as of 04:14, 26 September 2023
Registers REG_CDDALEFTL and REG_CDDARIGHTL hold the values of the currently streamed CD audio data, in a reversed 16bit 2's complement format suited for the LC78815 DAC. They were only used to display the vu-meters in the CD player interface.
The CD system ROM uses the following code to reverse the bits:
;D1:Input, D0:Output
reverse16bits:
moveq #16-1,d7
moveq #0,d0
rev:
lsr #1,d1
bcc zerobit
bset d7,d0
zerobit:
dbf d7,rev
It reads both registers multiple times during each frame (every 16 raster lines, by using the raster interrupt) to get an average value.
Demo
This does NOT work on current emulators.
Uses:
Source for AS and iso image: File:Vumeter1.zip