其他语言

本类阅读TOP10

·基于Solaris 开发环境的整体构思
·使用AutoMake轻松生成Makefile
·BCB数据库图像保存技术
·GNU中的Makefile
·射频芯片nRF401天线设计的分析
·iframe 的自适应高度
·BCB之Socket通信
·软件企业如何实施CMM
·入门系列--OpenGL最简单的入门
·WIN95中日志钩子(JournalRecord Hook)的使用

分类导航
VC语言Delphi
VB语言ASP
PerlJava
Script数据库
其他语言游戏开发
文件格式网站制作
软件工程.NET开发
两首歌曲的汇编演示(发声代码)...

作者:未知 来源:月光软件站 加入时间:2005-2-28 月光软件站

第一次作发声代码:

        title music -- a music of 'Mary  had a little lamb'
        extrn soundf :far  ;link  music+soundf
        stack   segment para stack 'stack'
                db 64 dup('stack...')
        stack ends

        dseg    segment para'data'
        mus_freg 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
        dseg ends

        cseg segment para 'code'
                assume cs:cseg,ss:stack,ds:dseg
        music proc far
                mov ax,dseg
                mov ds,ax
                lea si,mus_freg
                lea bp,ds:mus_time
        freq:
                mov di,[si]
                cmp di,-1
                je music
               ; je end_mus
                mov bx,ds:[bp]
                call soundf
                add si,2
                add bp,2
                jmp freq
        end_mus:
                mov ax,4c00h
                int 21h
        music endp
        cseg ends
                end music


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

       title music -- a music of 'Mary  had a little lamb'
        extrn soundf :far
        stack   segment para stack 'stack'
                db 64 dup('stack...')
        stack ends

        dseg    segment para'data'
        mus_freg dw 330,392,330,294,330,392,330,294,330
                 dw 330,392,330,294,262,294,330,392,294
                 dw 262,262,220,196,196,220,262,294,330,262
                 dw -1
        mus_time dw 3 dup(500),250,250,500,250,250,1000
                 dw 2 dup(500,500,250,250),1000
                 dw 3 dup(500,250,250),1000
        dseg ends

        cseg segment para 'code'
                assume cs:cseg,ss:stack,ds:dseg
        music proc far
                mov ax,dseg
                mov ds,ax
                lea si,mus_freg
                lea bp,ds:mus_time
        freq:
                mov di,[si]
                cmp di,-1
                je music
               ; je end_mus
                mov bx,ds:[bp]
                call soundf
                add si,2
                add bp,2
                jmp freq
        end_mus:
                mov ax,4c00h
                int 21h
        music endp
        cseg ends
                end music


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


        title  soundf -- the speaker beeper   
        public soundf
        cseg    segment para 'code'
                assume cs:cseg
        soundf  proc far
                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
        waitl:
                mov cx,6630
                call waitf
                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
                pop ax
                ret
        waitf endp
       cseg ends
      ;---------------------------------------------------
       end


下载代码:http://blogfile0.tom.com/file/0/9/3/f_85909_7938.rar




相关文章

相关软件