Playing sound samples: Difference between revisions

From NeoGeo Development Wiki
Jump to navigation Jump to search
m (6 revisions: Import from wikkii)
mNo edit summary
Line 3: Line 3:
Definitions of [[YM2610_registers#ADPCM-A part|ADPCM-A registers]]:
Definitions of [[YM2610_registers#ADPCM-A part|ADPCM-A registers]]:


<pre>
<syntaxhighlight lang="z80">
;ADPCM-A reg defines
;ADPCM-A reg defines
PA_CTRL: EQU $00
PA_CTRL: EQU $00
Line 12: Line 12:
PA_ENDL: EQU $20
PA_ENDL: EQU $20
PA_ENDH: EQU $28
PA_ENDH: EQU $28
</pre>
</syntaxhighlight>


(Full list of defines [[YM2610 ASM defines|here]])
(Full list of defines [[YM2610 ASM defines|here]])


Example code to play back V ROM $000000-$00FFFF on CH1 with max volume.
Example code to play back V ROM $000000-$00FFFF on CH1 with max volume.
<pre>
<syntaxhighlight lang="z80">
;playback parameters
;playback parameters
CHMASK: equ $01
CHMASK: equ $01
Line 41: Line 41:
rst $18
rst $18
ret
ret
</pre>
</syntaxhighlight>


RST $18 writes D reg to port $06 and E reg to port $07.
RST $18 writes D reg to port $06 and E reg to port $07.

Revision as of 12:12, 4 May 2012

ADPCM-A

Definitions of ADPCM-A registers:

;ADPCM-A reg defines
PA_CTRL:	EQU $00
PA_MVOL:	EQU $01
PA_CVOL:	EQU $08
PA_STARTL:	EQU $10
PA_STARTH:	EQU $18
PA_ENDL:	EQU $20
PA_ENDH:	EQU $28

(Full list of defines here)

Example code to play back V ROM $000000-$00FFFF on CH1 with max volume.

;playback parameters
CHMASK: equ $01
MVOL: equ $3F
CVOL: equ $C0+$1F
START: equ $0000
END: equ $00FF

PlayADPCMA:
	ld	de,PA_MVOL<<8 +MVOL		;master volume
	rst	$18
	ld	de,PA_CVOL<<8 +CVOL		;left/right/channel volume
	rst	$18
	ld	de,PA_STARTL<<8	+START AND $FF	;start address low
	rst	$18
	ld	de,PA_STARTH<<8 +START / $100	;start address high
	rst	$18
	ld	de,PA_ENDL<<8 +END AND $FF	;end address low
	rst	$18
	ld	de,PA_ENDH<<8 +END / $100	;end address high
	rst	$18
	ld	de,PA_CTRL<<8 +CHMASK		;play this channel
	rst	$18	
	ret

RST $18 writes D reg to port $06 and E reg to port $07.

ADPCM-A demo

An interactive demo with source files can be found here.