⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mao.asm

📁 声乐自制编程系统
💻 ASM
字号:
stack	 segment para			stack 'stack'
	 db	 64			dup('stack...')
stack	 ends

dseg	 segment para 'data'
mus_freq dw 196,262,262,262,330,294,262,294,330,262,262,330,392,440,440
         dw 392,330,330,262,294,262,294,330,262,220,220,196,262,440
         dw 392,330,330,262,294,262,294,440,392,330,330,392,440,440
         dw 392,330,330,262,294,262,294,330,262,220,220,196,262
         dw -1
mus_time dw 50,3 dup(37,13,25,25),75,25
         dw 3 dup(37,13,25,25),75,25
         dw 3 dup(37,13,25,25),75,25
         dw 3 dup(37,13,25,25),75
         dw 60
dseg	 ends

cseg	 segment para 'code'
         assume	 cs:cseg,ss:stack,ds:dseg
music proc far
start:
     push ds
     sub ax,ax
     push ax
     mov ax,dseg
     mov ds,ax
     lea si,mus_freq
     lea bp,mus_time
freq:
     mov di,[si]
     cmp di,-1
     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
soundf proc near
     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
     mov bx,60
wait1:  mov cx,663
        call waitf
delay: loop delay
     dec bx
     jnz wait1
     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 start

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -