Compucolor.org – Virtual Media

Listing of file='AYSND.MAC;01' on disk='vmedia/joystick_sound-sector.ccvf'

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
;	ROUTINES FOR THE AY-3-8910 SOUND CHIP
;
;	VALUES ON ENTRY:
;	   A  - AMPLITUDE (1-15)
;	   HL - DEFAULT PITCH (1-4095)
;	THE PUBLIC VARIABLES PITCH AND AMP CAN BE ALTERED
;	BEFORE EACH CALL TO SND, WHICH CHANGES THE TONE.
;
;	RETURNS:
;	   NOTHING
;
;	DESTROYS:
;	   ALL REGISTERS
;

SNDADR	EQU	0B0H	;ADDRESS REGISTER ON AY-3-8910,
			;   AND READ FROM CHIP
SNDDAT	EQU	0B1H	;LOAD (WRITE) DATA INTO AY-3-8910

;
;	SNDSET - SET UP SOUND CHIP FOR CHANNEL "A"
;
;	NOTE: THIS ROUTINE DISABLES EVERYTHING EXCEPT PURE
;		TONE ON CHANNEL "A"
;
	ENTRY	SNDSET
	PUBLIC	PITCH,AMP

SNDSET:	SHLD	PITCH
	STA	AMP
	MVI	B,14
CLRREG:	MOV	A,B	;CLEAR ALL REGISTERS IN SOUND CHIP
	DCR	A
	OUT	SNDADR
	XRA	A
	OUT	SNDDAT
	DCR	B
	JNZ	CLRREG

	MVI	A,7
	OUT	SNDADR
	MVI	A,3EH	;ENABLE TONE ON "A" ONLY
	OUT	SNDDAT
	RET

PITCH:	DW	50
AMP:	DB	15

;
;	SNDOFF - TURN SOUND OFF ON CHANNEL "A"
;
	ENTRY	SNDOFF

SNDOFF:	MVI	A,8
	OUT	SNDADR
	XRA	A
	OUT	SNDDAT
	RET

	END