原创dos下用pc喇叭唱月亮代表我的心

STACK SEGMENT STACK
  DB 256 DUP(0)
STACK ENDS
DATA SEGMENT
 OUTB DB 0AH,0DH,"music:yue liang dai biao wo de xin",0AH,0DH,0ah,0dh
    db "               ^ ^                      ^ ^          ",0ah,0dh
    db "            ^        ^              ^        ^      ",0ah,0dh
    db "           ^             ^       ^             ^     ",0ah,0dh
    db "          ^                ^  ^                 ^    ",0ah,0dh
    db "          ^                                     ^    ",0ah,0dh
    db "           ^                                    ^    ",0ah,0dh
    db "            ^                                  ^     ",0ah,0dh   
    db "             ^                                ^      ",0ah,0dh
    db "               ^                            ^       ",0ah,0dh
    db "                ^                         ^        ",0ah,0dh
    db "                  ^                     ^           ",0ah,0dh
    db "                    ^                 ^         ",0ah,0dh
    db "                      ^             ^      ",0ah,0dh
    db "                        ^        ^       ",0ah,0dh
    db "                           ^  ^    ",0ah,0dh
    db " -- Du Tian Wei.",0ah,0dh
    db "   2008.11.25",0ah,0dh
    db 0ah,0dh,"$"
 music  dw 262,1,294,1,330,1,349,1,0,1,392,1,0,1,440,1,0,1,494,1,0,1,523,5
    dw 0,4
    dw 196,1
    dw 262,3,330,1,392,3,262,1
    dw 247,3,330,1,392,2,0,1,392,1
    dw 440,1,494,2,523,3,440,1
    dw 440,1,392,1,392,2,0,2,330,1,294,1
    dw 262,3,262,1,262,2,330,1,294,1
    dw 262,6,294,1,330,1
    dw 294,2,262,1,220,2,294,1,330,1
    dw 294,6,0,1,196,1
    dw 294,2,220,1,247,1,262,1,294,1
    dw 262,6,330,1,392,1
    dw 247,6,220,1,247,1
    dw 220,3,247,1,220,3,196,2
    dw 330,6,392,2
    dw 330,3,294,1,262,2,392,2
    dw 247,6,220,1,247,1
    dw 262,6,294,1,330,1
    dw 294,6,0,1
    dw 196,1
    dw 262,3,330,1,392,3,262,1
    dw 247,3,330,1,392,2,0,1,392,1
    dw 440,1,494,2,523,3,440,1
    dw 440,1,392,1,392,2,0,2,330,1,294,1
    dw 262,3,262,1,262,2,330,1,294,1
    dw 262,6,294,1,330,1
    dw 294,3,220,1,247,2,262,1,294,1
    dw 262,6,"$"
DATA ENDS
CODE SEGMENT
 ASSUME CS:CODE, DS: DATA
 START PROC FAR
        push si
    PUSH DS
        MOV AX,0
        PUSH AX
        MOV AX,DATA
        MOV DS,AX
        ;PROGRAM START !!!
        ;CALL WAITT;WAIT A MOMENT
        MOV AH,09       ; PRINT
        MOV DX,OFFSET OUTB
        INT 21H         ; PRINT
    ;jmp exit;text test
    mov si , offset music
 play:  mov ax,ds:[si]
    cmp ax,'$'
    je exit
    cmp ax,0
    je jtime
        CALL SOUND
jtime:  inc si
    inc si
    mov ax,ds:[si]
    call waittime
    call endsound  ; end sound
    inc si
    inc si
    jmp play
  exit: ret
 START ENDP
 waittime proc near
    push cx
    mov cx,ax
  wloop:call waitt
    loop wloop
    pop cx
    ret
 waittime endp
 SOUND PROC NEAR ;
    push bx
    push cx
    push dx
    mov bx,ax
    mov al,10110110b
    out 43h,al
    mov dx,12h
    mov ax,34dch
    div bx
    out 42h,al
    mov al,ah
    out 42h,al
    in  al,61h
    or  AL,03H
        OUT 61H,AL
    pop dx
    pop cx
    pop bx
        RET
 SOUND ENDP
 endsound proc near
    push ax
    in  al,61h
    and al,11111100b
    out 61h,al
    pop ax
    ret
 endsound endp
 WAITT PROC NEAR
    push cx
    push dx
        mov ah,86h
    mov cx,3     ;cx:dx
    mov dx,0e78dh
    int 15h
    pop dx
    pop cx
    ret
 WAITT ENDP
CODE ENDS
        END START
 

 

你可能感兴趣的:(汇编,dos,月亮代表我的心)