Reading CDDA sound levels: Difference between revisions

From NeoGeo Development Wiki
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…")
 
No edit summary
Line 3: Line 3:
The CD2 [[BIOSes|BIOS]] uses the following code to reverse the bits:
The CD2 [[BIOSes|BIOS]] uses the following code to reverse the bits:
<pre>
<pre>
;D1:Input
;D1:Input, D0:Output
;D0:Output
reverse16bits:
reverse16bits:
         moveq #16-1,d7
         moveq #16-1,d7
Line 16: Line 15:
</pre>
</pre>


And this to get its absolute value:
The CD2 BIOS reads both registers multiple times during each frame (every 16 raster lines, by using the [[68k interrupts|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).
<pre>
 
abs:
==Demo==
        tst    d1
[[File:screencap_cddaviz.png|right]]
bpl    notneg
 
not    d1
Uses:
notneg:
*Raster line interrupts
</pre>
*[[Sprites]] (shrink and displacement)
*[[Fix layer|Fix]] (displays hex value)
*[[Palettes]]


The CD2 BIOS reads both registers multiple times during each frame (by using the [[68k interrupts|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).
[[http://furrtek.free.fr/noclass/neogeo/demo_vumeter1.zip Source and ISO image]]


[[http://www.youtube.com/watch?v=JP5VAypJIYk Youtube video of a standalone vu-meter]] (need source for this)
[[http://www.youtube.com/watch?v=JP5VAypJIYk Youtube video]]


[[Category:CD systems]]
[[Category:Code]]
[[Category:Code]]
[[Category:HowTo]]

Revision as of 22:49, 20 April 2011

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 suited for the LC78815 DAC (Sample rate =~ 100kHz ?).

The CD2 BIOS 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

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

File:Screencap cddaviz.png

Uses:

  • Raster line interrupts
  • Sprites (shrink and displacement)
  • Fix (displays hex value)
  • Palettes

[Source and ISO image]

[Youtube video]