Playing sound samples

From NeoGeo Development Wiki
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

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.