回 帖 发 新 帖 刷新版面

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

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

61 楼

能否解释一下各段程序意义

62 楼

解释不了,一年不碰都忘了

63 楼

把他这个程序保存成.asm,然后用masm *.asm, 生成.obj文件。然后再用link *.obj。
在命令提示符下运行这个生成的*.exe文件就OK了!!
这位朋友真花了不好时间I 服了他

64 楼

学习.强

65 楼

it's funny!haha

66 楼

那些数字上面是关于频率的,下面是关于延时的。

67 楼

我试了一下,开始有点走调,速度也少显快了一些,看来搂住所定的频率值及延时的长短还值得商榷,嘿嘿

68 楼


强悍!不是一般的强悍,是二般的强悍!好厉害

我来回复

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