Using the SSG sound channels

From NeoGeo Development Wiki
Revision as of 04:49, 26 November 2015 by Freem (talk | contribs) (add sound code category)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
        .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