Using the SSG sound channels: Difference between revisions

From NeoGeo Development Wiki
Jump to navigation Jump to search
m (Created page with "<pre> .org $8 push af ld a, d out (4), a ;Set YM2610 "Port A" register D to value E ld a, e out (5), a pop af </pre> <pre> FastBeep: ld de, 0040h …")
 
mNo edit summary
Line 1: Line 1:
<pre>
<pre>
         .org $8
         .org $8
push af
push af         ;Set YM2610 "Port A" register D to value E
ld  a, d
ld  a, d
out  (4), a         ;Set YM2610 "Port A" register D to value E
out  (4), a
ld  a, e
ld  a, e
out  (5), a
out  (5), a
Line 11: Line 11:
<pre>
<pre>
FastBeep:
FastBeep:
ld de, 0040h         ;Channel A frequency = 2kHz
ld de, 0040h         ;Channel 1 frequency: 2kHz
rst 08h
rst 08h
ld de, 0100h
ld de, 0100h
rst 08h
rst 08h


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


ld de, 0708h ;Noise off
ld de, 0810h ;Channel's 1 amplitude is tied to the EG
rst 08h
rst 08h
ld de, 0810h ;Mode 1 for channel A
ld de, 0D08h ;EG shape: Repetitive ramp down
rst 08h
rst 08h
ld de, 0D08h ;Ramp shape
ld de, 070Eh ;All channels except 1 are off
rst 08h
rst 08h
ret
ret
</pre>
</pre>
Line 32: Line 33:
<pre>
<pre>
SSG_Silence:
SSG_Silence:
ld de, 0800h ;Channel A volume = 0
ld de, 0800h ;SSG channel 1 volume = 0
rst 08h
rst 08h
ld de, 0900h ;Channel B volume = 0
ld de, 0900h ;SSG channel 2 volume = 0
rst 08h
rst 08h
ld de, 0A00h ;Channel C volume = 0
ld de, 0A00h ;SSG channel 3 volume = 0
rst 08h
rst 08h
ld de, 070Fh ;Disable all channels
ld de, 070Fh ;Disable all channels
Line 43: Line 44:
</pre>
</pre>


[[Category:Audio system]]
[[Category:HowTo]]
[[Category:Code]]
[[Category:Code]]

Revision as of 05:59, 16 April 2011

        .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