回 帖 发 新 帖 刷新版面

主题:[原创]汇编版张雨生《大海》

自学两个月汇编了,用MASM5.0编译。

data segment
freq dw 196,220
     dw 262,262,262,262,262,220,196
     dw 262,262,262,262,294,262,220,262
     dw 294,294,294,294,294,262,220
     dw 294,294,294,294,330,294,330,392
     dw 440,440,392,440,392,330
     dw 294,294,330,294,262,220,196,220
     dw 262,262,262,262,262,220
     dw 262,196,220
     dw 440,440,392,440,524,440
     dw 392,330,294,262,220,196,220
     dw 262,262,262,262,294,262
     dw 262,330,392
     dw 440,440,440,440,524,440
     dw 392,392,392,440,392,330,294
     dw 262,262,262,262,294
     dw 330,330,294
     dw 262,262,262,262,524,440
     dw 392,392,392,440,392,330,392
     dw 440,524,524,440,392
     dw 392,330,392
     dw 440,440,440,440,524,440
     dw 392,392,392,440,392,330,294
     dw 262,262,262,262,392
     dw 330,330,294
     dw 262,262,262,262,294,330
     dw 392,392,330,392,330,392
     dw 440
     dw 9,9,196,660,294,294,262
     dw 262,-1

time dw 400,400
     dw 400,200,400,400,800,400,400
     dw 400,200,400,200,200,800,400,400
     dw 400,200,400,400,800,400,400
     dw 400,200,400,200,200,800,400,400
     dw 400,800,400,800,400,400
     dw 400,200,200,400,400,800,400,400
     dw 400,200,400,400,800,800
     dw 1600,800,800
     dw 400,800,400,800,400,400
     dw 400,400,400,400,800,400,400
     dw 400,800,400,800,400,200
     dw 2400,400,400
     dw 400,800,400,800,400,400
     dw 400,800,200,200,800,400,400
     dw 400,800,400,800,800
     dw 2400,400,400
     dw 400,800,400,800,400,400
     dw 400,800,200,200,800,400,400
     dw 800,400,800,400,200
     dw 2400,400,400
     dw 400,800,400,800,400,400
     dw 400,800,200,200,800,400,400
     dw 400,800,400,800,800
     dw 2400,400,400
     dw 400,800,400,800,400,400
     dw 400,800,400,800,400,400
     dw 3200
     dw 800,400,400,400,400,400,400
     dw 4000
data ends

code segment
assume cs:code,ds:data
main proc far
start:mov ax,data
      mov ds,ax
      mov si,offset freq
      mov di,offset time
l1:  mov cx,[si]
      cmp cx,-1
      je exit
      mov bx,[di]
      call gensound
      add si,2
      add di,2
      jmp l1
exit:mov ax,4c00h
      int 21h
main endp

gensound proc near
       push dx
       mov al,0b6h
       out 43h,al
       mov dx,8h
       mov ax,3208h
       div cx
       out 42h,al
       mov al,ah
       out 42h,al
       in al,61h
       mov ah,al
       or al,3
       out 61h,al
l2:    push dx
       push ax
       mov dx,8h
       mov ax,0f05h
s1:    sub ax,1
       sbb dx,0
       jnz s1
       pop ax
       pop dx
       dec bx
       jnz l2
  
  mov al,ah
  out 61h,al
  pop dx
  ret
  gensound endp
  code ends
  end start

回复列表 (共68个回复)

沙发

好,阁下了不起啊

板凳

应该加CTRL+C或其它的中断呀,这首歌很长,如何不想听了就可以退出

3 楼

这个大部分时间是花在乐谱的翻译吧!

4 楼

大部分时间花在填数据,
就研究出来4/4拍的,
有点走音, 因为不知道乐符中的停顿用什么好办法表示。

5 楼

好胸啊

6 楼

厉害啊

7 楼

小弟刚才用tasm汇编的,好nb啊,原来是学c的学汇编没多久。

8 楼

牛啊!
I 服了!

9 楼

怎么样才能播放?

10 楼

强啊!楼主!!

我来回复

您尚未登录,请登录后再回复。点此登录或注册