Compucolor.org – Virtual Media

Listing of file='SOUNDM.SRC;01' on disk='vmedia/chip_128-sector.ccvf'

; SOUNDM - SOUND MANAGER ROUTINE
; REG A = SOUND SEQUENCE REQUESTED
	ORG	09F00H
SOUNDM:	PUSH	H
	PUSH	D
	PUSH	B
CMPHD	EQU	344DH
	LXI	H,SNDTBL	;ADDRESS SOUNDS TABLE
	LXI	B,3		;LENGTH EACH ENTRY
GENTRY:	DCR	A
	JZ	GOTIT
	DAD	B
	JMP	GENTRY
GOTIT:	MOV	A,M		;GET THE SOUNDS COUNT
	INX	H
	MOV	E,M
	INX	H
	MOV	D,M		;DE=TABLE BASE
	MOV	C,A		;SAVE LENGTH
MAINLP:	LXI	H,LO		;SOUND SUBRTN DATA AREA
	MVI	B,8		;LENGTH OF MOVE
	CALL	MOVHD
MOVHD	EQU	3444H
	PUSH	D
	PUSH	H
	MVI	A,0
	LHLD	LO
	LXI	D,50
	CALL	CMPHD
	JNZ	NOT50
	MVI	A,0FFH
NOT50:	STA	MISSIT
	POP	H
	POP	D
	CALL	SOUND
	MOV	A,C
	DCR	A
	MOV	C,A
	JNZ	MAINLP		;ALL DONE?
	POP	B		;YES.
	POP	D
	POP	H
	RET
MISSIT:	DB	0

SOUND:	PUSH	H
	PUSH	D
	PUSH	B
	DI
	MVI	E,8
	LDA	LO+5
	MOV	D,A
	LDA	LO+6
	CPI	0
	JNZ	X9F63
	MOV	A,D
	STA	LO+6
X9F63:	LHLD	LO
	SHLD	LXIADR+1
	LHLD	LO+2
	SHLD	X9F6F+1
X9F6F:	LXI	H,000FH
LXIADR:	LXI	B,0019H
X9F75:	DCX	B
	MOV	A,B
	ORA	C
	JNZ	X9F75
	MOV	A,E
	XRI	2
	PUSH	PSW
	LDA	MISSIT
	CPI	0FFH
	JZ	YESMIS
	POP	PSW
	OUT	4
	JMP	DOIT
YESMIS:	POP	PSW
DOIT:	MOV	E,A
	DCX	H
	MOV	A,H
	ORA	L
	JNZ	LXIADR
	LDA	LO+4
	CPI	0
	JZ	X9FA6
	DCR	A
	STA	LO+4
	LDA	LXIADR+1
	ADD	D
	STA	LXIADR+1
	LDA	LO+6
	MOV	H,A
	MOV	A,D
	STA	LO+6
	MOV	D,H
	JMP	X9F6F
X9FA6:	STA	LO+6
	STA	LO+3
	STA	LO+1
	MVI	A,0FH
	STA	LO+2
	MVI	A,32H
	STA	LO
	POP	B
	POP	D
	POP	H
	EI
	RET
LO:	DS	8
SNDTBL:	DB	1
	DW	SND1		;CATCH CREATURE
	DB	1
	DW	SND2		;CATCH PACMAN
	DB	1
	DW	SND3		;5 PT SPOT
	DB	1
	DW	SND4		;20 PT SPOT
	DB	1
	DW	SND5		;BONUS
	DB	31
	DW	SND6		;TAPS...
	DB	13
	DW	SND7		;CHARGE...
	DB	33
	DW	SND8		;PACMAN THEME
	DB	11
	DW	SND9		;DEATH MARCH
; SOUNDS ARRAY
SND1:	DW	1,75
	DB	20,5,254,0
SND2:	DW	150,1
	DB	250,200,0,0
SND3:	DW	25,25,0,0
SND4:	DW	10,10
	DB	3,15,0,0
SND5:	DW	200,2
	DB	150,255,0,0
SND6:	DW	280,106,0,0
	DW	280,53,0,0
	DW	210,141,0,0
	DW	50,596,0,0
	DW	280,106,0,0
	DW	210,70,0,0
	DW	168,177,0,0
	DW	50,596,0,0
	DW	280,106,0,0
	DW	210,70,0,0
	DW	168,88,0,0
	DW	50,298,0,0
	DW	280,53,0,0
	DW	210,70,0,0
	DW	168,88,0,0
	DW	50,298,0,0
	DW	280,53,0,0
	DW	210,70,0,0
	DW	168,88,0,0
	DW	50,596,0,0
	DW	210,141,0,0
	DW	168,88,0,0
	DW	140,106,0,0
	DW	50,298,0,0
	DW	168,177,0,0
	DW	210,141,0,0
	DW	280,106,0,0
	DW	50,596,0,0
	DW	280,106,0,0
	DW	280,53,0,0
	DW	210,319,0,0
SND7:	DW	280,106,0,0
	DW	210,106,0,0
	DW	168,133,0,0
	DW	140,63,0,0,140,63,0,0,140,63,0,0
	DW	168,54,0,0,168,54,0,0,168,54,0,0
	DW	210,35,0,0,168,54,0,0,210,35,0,0
	DW	280,106,0,0
SND8:	DW	280,26,0,0,188,39,0,0,221,33,0,0
	DW	280,26,0,0,188,39,0,0,221,33,0,0
	DW	280,26,0,0,50,149,0,0,262,28,0,0
	DW	176,42,0,0,210,35,0,0,262,28,0,0
	DW	176,42,0,0,210,35,0,0,262,28,0,0
	DW	50,149,0,0,280,26,0,0,188,39,0,0
	DW	221,33,0,0,280,26,0,0,188,39,0,0
	DW	221,33,0,0,280,25,0,0,50,149,0,0
	DW	298,25,0,0,280,26,0,0,262,28,0,0
	DW	250,29,0,0,238,31,0,0,221,33,0,0
	DW	140,266,0,0,280,26,0,0,280,239,0,0
SND9:	DW	168,266,0,0,168,266,0,0,168,133,0,0
	DW	168,266,0,0,140,319,0,0,149,150,0,0
	DW	149,300,0,0,168,133,0,0,168,266,0,0
	DW	176,126,0,0,168,266,0,0
	END	SOUNDM