【dos】两只老虎的音乐程序 beep

【dos】两只老虎的音乐程序 beep
 1          ; 98  z.bin
 2          ;两只老虎的音乐程序
 3  date segment
 4          freq dw  2  dup ( 262 , 294 , 330 , 262 )
 5          dw  2  dup ( 330 , 350 , 392 )
 6          dw  2  dup ( 392 , 440 , 392 , 349 , 330 , 262 )
 7          dw  2  dup( 330 , 294 , 262 ),0ffffh
 8          time dw  8  dup( 500 )
 9          dw  2  dup ( 500 , 500 , 1000 )
10          dw  2  dup( 250 , 250 , 250 , 250 , 500 , 500 )
11          dw  2  dup ( 500 , 500 , 1000 )
12  date ends
13 
14  code segment
15          assume cs:code,ds:date
16          begin:  push ds
17          mov ax, 0
18          push ax
19          mov ax,date
20          mov ds,ax
21          ; **************************
22          lea si,freq
23          lea bp,time
24          n0: mov ah,0bh
25           int  21h
26          cmp al,0ffh
27          je exit
28          mov di,[si]
29          cmp di,0ffffh
30          je n8
31 
32          mov bx,ds:[bp]
33          call s_sound
34          add si, 2
35          add bp, 2
36          jmp n0
37          n8: lea si,freq
38          lea bp,time
39          jmp n0
40          exit:mov ah,4ch
41           int  21h
42          s_sound proc near
43          push  bp
44          push si
45 
46          mov al,0b6h
47          out 43h,al
48          mov dx,12h
49          mov ax,533h * 896
50          div di
51          out 42h,al
52          mov al,ah
53          out 42h,al
54          in al,61h
55          mov ah,al
56          or al, 3
57          out 61h,al
58 
59          n1:  mov cx,2801h
60          n2: loop n2
61 
62          dec bx
63          jnz n1
64          mov al,ah
65          out 61h,al
66          pop si
67          pop bp
68          ret
69          s_sound endp
70          code ends
71          end begin
72 
73 
74 
75 
76 
77 

你可能感兴趣的:(【dos】两只老虎的音乐程序 beep)