回 帖 发 新 帖 刷新版面

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

自学两个月汇编了,用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个回复)

11 楼

怎么 播放啊 ?

12 楼

请教:
指令部分基本看懂
你定义的那些数值是身摸意思啊

13 楼

厉害  小弟佩服

14 楼

厉害啊!

15 楼

支持一下

16 楼

延时要是长一点,据段所占字节则会更少.

17 楼

若延时长一点,则数据段所占字节会更少.

18 楼

偶像啊
!!!!!!!!!!!!!!!!!!!!!!!

19 楼

我支持

20 楼

佩服佩服,我也准备自学汇编。
现正在看计算机组成原理。CPU的指令运行过程看得我头
都快爆了。[em10]

我来回复

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