⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sound_tab.asm

📁 一款智能老鼠的玩具源代码
💻 ASM
字号:
;****************************************************************;
; Sound Play Set Library
;
; Written by: lixy
; Date: 2004-02-16
;****************************************************************;

;================================================================;
;Constant Area
;================================================================;
c_voc			equ	#06h		;R_VOC: bit2:PWM, bit1:DA, bit0:OP
						;enable PWM and DA
c_pwmc			equ	#0f7h		;R_PWMC: bit7:COM/DATA, bit6-bit4:PWM OP DRIVER
						;        bit3-bit1:PCK SELECTION, bit0:PWM ENABLE
						;set PWM enable
;c_cry_times		equ	#2
;c_snd_intvl_h		equ	#050h		;the interval of the mouse sound play
;c_snd_intvl_l		equ	#02h

c_dly_r_f		equ	#10h		;the sound rise and fall delay constant

;================================================================;
;Sound Data Area
;================================================================;
;	.area	sound_var(data)

;flg_cry_for_key_press::	.ds	1
;m_cry_times::		.ds	1
;cnt_snd_intvl::		.ds	2	;the counter of the mouse sound play interval

;temp_pwmc::		.ds	1	;pwmc temporary variable
;temp_dly_r_f::		.ds	1	;sound rise and fall delay temp variable

;================================================================;
;Sound Code Library
;================================================================;
	.area	sound_lib(code)

;sound::

;//04-03-19// add the sound output from vo
;	lda	r_voc
;	cmpe	#00h
;	brz	next_cry	
;	call	tail
;	lda	#00h
;	sta	r_voc			;close PWM and D/A
;next_cry:
;end add //04-03-19//

;sound_play_set:
;	call	select_sound
;	call	play_initial
;	br	sound_end



;----------------------------------------------------------------;
;Select Sound0 (for free run) Subroutine
;----------------------------------------------------------------;
select_sound_normal::
	lda	#00h
        sta	M_sphptr+2
        lda	#>(sound_tab)
        sta	M_sphptr+1
        lda	#<(sound_tab)
        sta	M_sphptr
        call	play_initial
        ret
sound_tab::
	.include	"normal.inc"
;//04-03-23// add the sound played in the course
;of stop which is caused by pressing the key.
;----------------------------------------------------------------;
;Select Sound1 (for key pressed or barrier) Subroutine
;----------------------------------------------------------------;
select_sound_barrier::
;	lda	#00h
;       sta	M_sphptr+2
;        lda	#>(sound_tab_1)
;        sta	M_sphptr+1
;        lda	#<(sound_tab_1)
;        sta	M_sphptr
;        call	play_initial        
        ret
sound_tab_1::
;	.include	"barrier.inc"
;end add //04-03-23//
;----------------------------------------------------------------;
;Select Sound2 (for Gameover) Subroutine
;----------------------------------------------------------------;
select_sound_gameover::
	lda	#00h
        sta	M_sphptr+2
        lda	#>(sound_tab_2)
        sta	M_sphptr+1
        lda	#<(sound_tab_2)
        sta	M_sphptr
        call	play_initial
        ret
sound_tab_2::
	.include	"gameover.inc"
;end add //04-07-1//
;----------------------------------------------------------------;
;Select Sound3 (for fail) Subroutine
;----------------------------------------------------------------;
select_sound_fail::
	lda	#00h
        sta	M_sphptr+2
        lda	#>(sound_tab_3)
        sta	M_sphptr+1
        lda	#<(sound_tab_3)
        sta	M_sphptr        
        call	play_initial
        ret
sound_tab_3::
	.include	"fail.inc"
;end add //04-07-2//
;----------------------------------------------------------------;
;Play Initial Subroutine
;----------------------------------------------------------------;
play_initial:
	lda	#c_voc
	sta	r_voc
	lda	#c_pwmc
	sta	r_pwmc
	;call	header
	lda	#00h
	sta	M_stopbit
        ret

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -