能力值:
( LV9,RANK:320 )
61 楼
玩命大哥啊,,你这个有点啰嗦了,,,,看看我这个。。。这样的东西大学的课程设计都搞这个,一点意思没有
data segment
assume ds:data
FREQ dw 0,4552,4029,3617,3415
dw 3042,2710,2415,2279;定义各频率对应的N值
NOTE db 3,2,1,2,3,3,3,2,2,2
db 3,5,5,3,2,1,2,3,3,3
db 3,2,2,3,2,1,-1;定义乐谱,-1表示结束
DL_TIME db 4,4,4,4,4,4,8,4,4,8
db 4,4,8,4,4,4,4,4,4,4
db 4,4,4,4,4,8;定义节拍
data ends
code segment
assume cs:code
main proc far
mov ax,data
mov ds,ax
mov al,10110110B
out 43h,al;初始化TIMER2
mov bx,0;初始化音符数组下标,也就是起始值
play:
mov al,NOTE[bx] ;取第一个音符
mov ah,DL_TIME[bx]
inc bx
push bx
push ax
cbw
shl ax,1
mov bx,ax
mov ax,FREQ[bx] ;取出频率
out 42h,al ;输出频率值 ,输出倒42端口
mov al,ah
out 42h,al
in al,61h ;开启定时器
or al,3
out 61h,al
mov ah,0
int 1ah
pop ax
mov al,ah
cbw
add ax,dx
mov bx,ax
;延时子程序
deplay:
mov ah,0
int 1ah
cmp bx,dx
jnz deplay
in al,61h
and al,0fch
out 61h,al
pop bx
cmp NOTE[bx],-1 ;是不是道儿结尾
jnz play
mov ah,4ch
int 21h
main endp
code ends
end main
能力值:
( LV2,RANK:10 )
65 楼
城里的月光,把梦照亮,请温暖她身旁。
看多了人间聚散,能不能多点幸福片断。 #include "stdafx.h"
#include "windows.h"
#define ONE_BEEP 600
#define HALF_BEEP 300
#define Quarter_BEEP 150
#define NOTE_1 440
#define NOTE_2 495
#define NOTE_3 550
#define NOTE_4 587
#define NOTE_5 660
#define NOTE_6 733
#define NOTE_7 825
#define NOTE_NONE Sleep(ONE_BEEP); int main(int argc, char* argv[])
{
Beep(NOTE_5,ONE_BEEP);
Beep(NOTE_3, HALF_BEEP);
Beep(NOTE_5, HALF_BEEP);
Beep(NOTE_6, ONE_BEEP);
Beep(NOTE_5, 2*ONE_BEEP);
Beep(NOTE_1, ONE_BEEP);
Beep(NOTE_2, HALF_BEEP);
Beep(NOTE_3, ONE_BEEP);
Beep(NOTE_1, 2*ONE_BEEP);
NOTE_NONE
Beep(NOTE_1*2, ONE_BEEP);
Beep(NOTE_2*2, HALF_BEEP);
Beep(NOTE_1*2, HALF_BEEP);
Beep(NOTE_6, ONE_BEEP);
Beep(NOTE_3, 2*HALF_BEEP);
Beep(NOTE_5, 2*ONE_BEEP);
NOTE_NONE
Beep(NOTE_6, 2*HALF_BEEP);
Beep(NOTE_5, HALF_BEEP);
Beep(NOTE_6, HALF_BEEP);
Beep(NOTE_1*2, ONE_BEEP);
Beep(NOTE_6, ONE_BEEP);
Beep(NOTE_5, 2*ONE_BEEP);
Beep(NOTE_3,2*HALF_BEEP);
NOTE_NONE
Beep(NOTE_3, HALF_BEEP);
Beep(NOTE_2, HALF_BEEP);
Beep(NOTE_3, HALF_BEEP);
Beep(NOTE_5, HALF_BEEP);
Beep(NOTE_3, HALF_BEEP);
Beep(NOTE_2, HALF_BEEP);
Beep(NOTE_1, HALF_BEEP);
Beep(NOTE_3, Quarter_BEEP);
Beep(NOTE_2, ONE_BEEP); return 0;
}
能力值:
( LV3,RANK:30 )
68 楼
来个字幕版的。
#include "windows.h"
#include "stdio.h"
#define ONE_BEEP 600
#define HALF_BEEP 300
#define NOTE_1 440
#define NOTE_2 495
#define NOTE_3 550
#define NOTE_4 587
#define NOTE_5 660
#define NOTE_6 733
#define NOTE_7 825
#define NOTE_NONE Sleep(ONE_BEEP); int main(int argc, char* argv[])
{
printf ("长") ;
Beep(NOTE_5, ONE_BEEP);
printf ("亭") ;
Beep(NOTE_3, HALF_BEEP);
Beep(NOTE_5, HALF_BEEP);
printf ("外\t") ;
Beep(NOTE_1*2, ONE_BEEP*2);
printf ("古") ;
Beep(NOTE_6, ONE_BEEP);
printf ("道") ;
Beep(NOTE_1*2, ONE_BEEP);
printf ("边\n") ;
Beep(NOTE_5, ONE_BEEP*2);
printf ("芳") ;
Beep(NOTE_5, ONE_BEEP);
printf ("草") ;
Beep(NOTE_1, HALF_BEEP);
Beep(NOTE_2, HALF_BEEP);
printf ("碧") ;
Beep(NOTE_3, ONE_BEEP);
printf ("连") ;
Beep(NOTE_2, HALF_BEEP);
Beep(NOTE_1, HALF_BEEP);
printf ("天\n") ;
Beep(NOTE_2, ONE_BEEP*4);
printf ("晚") ;
Beep(NOTE_5, ONE_BEEP);
printf ("风") ;
Beep(NOTE_3, HALF_BEEP);
Beep(NOTE_5, HALF_BEEP);
printf ("拂") ;
Beep(NOTE_1*2, HALF_BEEP*3);
printf ("柳") ;
Beep(NOTE_7, HALF_BEEP);
printf ("笛") ;
Beep(NOTE_6, ONE_BEEP);
printf ("声") ;
Beep(NOTE_1*2, ONE_BEEP);
printf ("残\n") ;
Beep(NOTE_5, ONE_BEEP*2);
printf ("夕") ;
Beep(NOTE_5, ONE_BEEP);
printf ("阳") ;
Beep(NOTE_2, HALF_BEEP);
Beep(NOTE_3, HALF_BEEP);
printf ("山") ;
Beep(NOTE_4, HALF_BEEP*3);
printf ("外") ;
Beep(NOTE_7/2, HALF_BEEP);
printf ("山\n") ;
Beep(NOTE_1, ONE_BEEP*4);
printf ("天") ;
Beep(NOTE_6, ONE_BEEP);
printf ("之") ;
Beep(NOTE_1*2, ONE_BEEP);
printf ("涯\t") ;
Beep(NOTE_1*2, ONE_BEEP*2);
printf ("地") ;
Beep(NOTE_7, ONE_BEEP);
printf ("之") ;
Beep(NOTE_6, HALF_BEEP);
Beep(NOTE_7, HALF_BEEP);
printf ("角\n") ;
Beep(NOTE_1*2, ONE_BEEP*2);
printf ("知") ;
Beep(NOTE_6, HALF_BEEP);
Beep(NOTE_7, HALF_BEEP);
printf ("交") ;
Beep(NOTE_1*2, HALF_BEEP);
Beep(NOTE_6, HALF_BEEP);
printf ("半") ;
Beep(NOTE_6, HALF_BEEP);
Beep(NOTE_5, HALF_BEEP);
printf ("零") ;
Beep(NOTE_3, HALF_BEEP);
Beep(NOTE_1, HALF_BEEP);
printf ("落\n") ;
Beep(NOTE_2, ONE_BEEP*4);
printf ("人") ;
Beep(NOTE_5, ONE_BEEP);
printf ("生") ;
Beep(NOTE_3, HALF_BEEP);
Beep(NOTE_5, HALF_BEEP);
printf ("难") ;
Beep(NOTE_1*2, HALF_BEEP*3);
printf ("得") ;
Beep(NOTE_7, HALF_BEEP);
printf ("是") ;
Beep(NOTE_6, ONE_BEEP);
printf ("欢") ;
Beep(NOTE_1*2, ONE_BEEP);
printf ("聚\n") ;
Beep(NOTE_5, ONE_BEEP*2);
printf ("唯") ;
Beep(NOTE_5, ONE_BEEP);
printf ("有") ;
Beep(NOTE_2, HALF_BEEP);
Beep(NOTE_3, HALF_BEEP);
printf ("别") ;
Beep(NOTE_4, HALF_BEEP*3);
printf ("离") ;
Beep(NOTE_7/2, HALF_BEEP);
printf ("多\n") ;
Beep(NOTE_1, ONE_BEEP*3);
return 0;
}