📄 10.asm
字号:
stack segment para stack 'stack'
db 64 dup('stack...')
stack ends
dseg segment para 'data' ;????
mus_freq dw 330,294,262,294,3 dup(330)
dw 3 dup(294),330,392,392
dw 330,294,262,294,4 dup(330)
dw 294,294,330,294,262,-1
mus_time dw 6 dup(25),50
dw 2 dup(25,25,50)
dw 12 dup(25),100
friend_freq dw 2 dup(294,330,262),294,330,392,440,494,262
dw 220,262,294,294,262,220,220,262,294,330,294,262,294
dw 330,294,262,294,330,262,294,330,392,440,494,262
dw 220,262,294,294,262,220,196,220,262
dw 330,5 dup(392),440,392,440,494,523,440,440,392,330,330
dw 330,294,262,262,262,440,392,392,330,294,262,262,220,294,294
dw 330,5 dup(392),440,392,440,493,523,440,440,392,330,330
dw 330,294,262,262,262,440,392,392,330,294,262,220,262,262,-1
friend_time dw 4 dup(50,50,100)
dw 2 dup(50,50,100),6 dup(50),200
dw 4 dup(50,50,100)
dw 2 dup(50,50,100),50,50,300
dw 2 dup(5 dup(50),25,25,100)
dw 2 dup(50,25,25,100),50,50,100,25,25,50,200
dw 2 dup(5 dup(50),25,25,100)
dw 2 dup(50,25,25,100),50,50,100,50,50,300
dingxia_freq dw 220,330,294,330,294,294,330,330,262,294,330,220,262,220,262,220,220 ;1
dw 220,262,262,220,220,294,330,349,349,349,262,262,294,330 ;2
dw 330,294,330,294,294,330,330,220,330,294,330,294,262,220,220 ;15个 ;3
dw 220,262,262,220,262,294,294,330,349,349,349,262,294,330,330 ;4
dw 294,262,294,262,294,330,294,262,330,330,294,294,262,262,220,220,220 ;5
dw 5 dup(262),220,262,5 dup(247),220,247 ;6
dw 330,440,330,330,392,440,440,440,440,523,440,392,440,392,330,294,330 ;7
dw 220,330,294,294,330,440,440,262,262,330,440,440,330,440,494,494 ;8
dw 330,440,330,330,392,440,440,440,440,523,440,392,440,392,330,294,330 ;9
dw 220,330,294,330,330,330,330,220,220,247,247,247,294,262,247,220,220,-1 ;10
dingxia_time dw 7 dup(35),160,8 dup(35),210 ;1
dw 6 dup(35),210,6 dup(35),140 ;2
dw 6 dup(35),140,7 dup(35),210 ;3
dw 6 dup(35),140,7 dup(35),210 ;4
dw 6 dup(35),210,8 dup(35),70,35 ;5
dw 6 dup(35),210,6 dup(35),210 ;6
dw 2 dup(70,35,35),70,70,8 dup(35),140 ;7
dw 70,35,35,70,4 dup(35),70,6 dup(35),210 ;8
dw 2 dup(70,35,35),70,70,8 dup(35),140 ;9
dw 70,35,35,70,4 dup(35),70,7 dup(35),140 ;10
huanghun_freq dw 220,220,247,262,220,330,20000 ,294,294,330,330,294,262,392,220 ;1 15个
dw 392,392,440,440,392,262,262,262,262,262,262,294,20000 ,262,294,262,294,262,294,392,220 ;2
dw 220,220,247,262,220,330,294,294,330,330,294,262,196,220 ;3
dw 392,392,440,440,392,262,262,262,262,262,262,294,20000 ,262,294,262,294,262,262,196,220 ;4
dw 262,262,294,294,7 dup(330),392,440,392,392,294,20000,294,330,392,5 dup(440),392,392,294 ;5
dw 330,20000 ,294,330,294,330,392,330,220,20000,220,220,262,262,220,196,20000 ,196,196,165,165 ;6
dw 196,196,220,220 ,-1
huanghun_time dw 5 dup(50),150,8 dup(50),150
dw 5 dup(50),100,100,100,12 dup(50),200
dw 5 dup(50),300,7 dup(50),200
dw 5 dup(50),100,100,100,12 dup(50),200
dw 28 dup(50)
dw 100,50,25,25,4 dup(50),100,6 dup(50),100,8 dup(50),200
;----------interface data-------------------------------------------------------------------------
command db '**********************************************',0ah,0dh
db '* Operate: Stop: s Quit: q *',0ah,0dh
db '**********************************************',0ah,0dh,'$'
menu db 'menu:',0ah,0dh,'1: Friend',0ah,0dh,'2: Lilac',0ah,0dh,'3: Nightfall',0ah,0dh,'$'
choose db 'Choose the music wanted to play or quit:$'
err db 0ah,0dh,'Input error$'
continue db 0ah,0dh,'Continue? yse or not(y/n):$'
stop db 'Stop? (s):$'
;---------------------------------------------------------------------------------------------------
dseg ends
cseg segment para 'code'
assume cs:cseg,ss:stack,ds:dseg
music proc far
mov ax,dseg
mov ds,ax
lea dx,command ;show interface
mov ah,09h
int 21h
mov dl,0dh
mov ah,02
int 21h
mov dl,0ah
mov ah,02
int 21h
lea dx,menu
mov ah,09h
int 21h
jmp choice
playf:
lea si,ds:friend_freq
lea bp,ds:friend_time
lea dx,stop
mov ah,09h
int 21h
jmp freq
playd:
lea si,ds:dingxia_freq
lea bp,ds:dingxia_time
lea dx,stop
mov ah,09h
int 21h
jmp freq
playh:
lea si,ds:huanghun_freq
lea bp,ds:huanghun_time
lea dx,stop
mov ah,09h
int 21h
jmp freq
choice:
mov dl,0dh
mov ah,02
int 21h
mov dl,0ah
mov ah,02
int 21h
lea dx,choose
mov ah,09h
int 21h
mov ah,01h
int 21h
mov bl,al
mov dl,0dh
mov ah,02
int 21h
mov dl,0ah
mov ah,02
int 21h
cmp bl,'1'
je playf
cmp bl,'2'
je playd
cmp bl,'3'
je playh
cmp bl,71h
je exit
cuo:
lea dx,err
mov ah,09h
int 21h
jmp choice
freq:
mov di,[si]
cmp di,-1
je end_music
mov bx,ds:[bp]
call soundf
add si,2
add bp,2
mov ah,0bh
int 21h
cmp al,00h
jz freq
mov ah,01h
int 21h
cmp al,'s'
je choice
jmp freq
end_music:
lea dx,continue
mov ah,09h
int 21h
mov ah,01h
int 21h
cmp al,'y'
je choice
cmp al,'n'
jne cuo
exit:
mov ax,4c00h
int 21h
music endp
soundf proc near
push ax
push bx
push cx
push dx
push di
mov al,0b6h
out 43h,al
mov dx,12h
mov ax,348ch
div di
out 42h,al
mov al,ah
out 42h,al
in al,61h
mov ah,al
or al,3
out 61h,al
wait1:
mov cx,2650
call waitf
delay:
dec bx
jnz wait1 ;总延迟时间[bx]*10ms
mov al,ah
out 61h,al
pop di
pop dx
pop cx
pop bx
pop ax
ret
soundf endp
waitf proc near
push ax
waitf1:
in al,61h
and al,10h
cmp al,ah
je waitf1
mov ah,al
loop waitf1 ;触发一次是15.3us
pop ax
ret
waitf endp
cseg ends
end music
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -