Using the SSG sound channels

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.
        .org $8
	push af	        	;Set YM2610 "Port A" register D to value E
	ld   a, d
	out  (4), a
	ld   a, e
	out  (5), a
	pop af
FastBeep:
	ld de, 0040h	        ;Channel 1 frequency: 2kHz
	rst 08h
	ld de, 0100h
	rst 08h

	ld de, 0B0Fh		;EG period: $50F
	rst 08h
	ld de, 0C05h
	rst 08h

	ld de, 0810h		;Channel's 1 amplitude is tied to the EG
	rst 08h
	ld de, 0D08h		;EG shape: Repetitive ramp down
	rst 08h
	ld de, 070Eh		;All channels except 1 are off
	rst 08h

	ret
SSG_Silence:
	ld de, 0800h		;SSG channel 1 volume = 0
	rst 08h
	ld de, 0900h		;SSG channel 2 volume = 0
	rst 08h
	ld de, 0A00h		;SSG channel 3 volume = 0
	rst 08h
	ld de, 070Fh		;Disable all channels
	rst 08h
	ret